ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/tcp.ext
(Generate patch)

Comparing deliantra/server/ext/tcp.ext (file contents):
Revision 1.22 by root, Tue Oct 30 17:32:47 2012 UTC vs.
Revision 1.23 by root, Mon Nov 5 23:23:04 2012 UTC

10CONF BIND_ADDRESSES = [[undef, 13327]]; 10CONF BIND_ADDRESSES = [[undef, 13327]];
11 11
12our $MAX_DETECT = 16; # how many bytes to raed to identify the protocol 12our $MAX_DETECT = 16; # how many bytes to raed to identify the protocol
13 13
14our @LISTENERS; 14our @LISTENERS;
15
16sub flash_policy_server {
17 my ($fh) = @_;
18
19 # socket policy file, just write answer and hope the kernel accepts it in one go
20 syswrite $fh, <<EOF . "\x00"
21<?xml version="1.0"?>
22<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
23<cross-domain-policy>
24 <allow-access-from domain="*" to-ports="*"/>
25</cross-domain-policy>
26EOF
27}
15 28
16for (@$BIND_ADDRESSES) { 29for (@$BIND_ADDRESSES) {
17 my ($host, $port) = @$_; 30 my ($host, $port) = @$_;
18 cf::info "listening on ", (format_hostport $host, $port), "\n"; 31 cf::info "listening on ", (format_hostport $host, $port), "\n";
19 32
43 } elsif ($buf =~ /^GET / && defined &ext::http::server) { # http or websocket 56 } elsif ($buf =~ /^GET / && defined &ext::http::server) { # http or websocket
44 undef $w; 57 undef $w;
45 58
46 &ext::http::server ($id, $fh, $buf); 59 &ext::http::server ($id, $fh, $buf);
47 60
61 } elsif ($buf =~ /^<policy-file-request\/>\x00/) {
62 undef $w;
63
64 flash_policy_server $fh;
65
48 } elsif (length $buf >= $MAX_DETECT) { # unable to detect protocol 66 } elsif (length $buf >= $MAX_DETECT) { # unable to detect protocol
49 undef $w; 67 undef $w;
50 68
51 cf::info "$id: protocol detection error\n"; 69 cf::info "$id: protocol detection error\n";
52 } 70 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines