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.7 by root, Tue Mar 6 21:19:10 2007 UTC vs.
Revision 1.11 by root, Mon May 5 09:03:46 2008 UTC

8use IO::Socket::INET; 8use IO::Socket::INET;
9 9
10our $LISTEN = new IO::Socket::INET 10our $LISTEN = new IO::Socket::INET
11 LocalPort => cf::settings->csport, 11 LocalPort => cf::settings->csport,
12 Listen => 1, 12 Listen => 1,
13 Blocking => 0, # bugfix workaround for Event calling handler twice :( 13 Blocking => 0,
14 ReuseAddr => 1; 14 ReuseAddr => 1;
15 15
16if (!$LISTEN) { 16if (!$LISTEN) {
17 # extension yes, completely stupid, not yet 17 # extension yes, completely stupid, not yet
18 warn "unable to establish listen socket, exiting.\n"; 18 warn "unable to establish listen socket, exiting.\n";
19 exit (2); 19 exit (2);
20} 20}
21 21
22Event->io ( 22our $LISTENER = EV::io $LISTEN, EV::READ, sub {
23 reentrant => 0,
24 fd => $LISTEN,
25 nice => 1,
26 poll => 'r',
27 data => cf::WF_AUTOCANCEL,
28 cb => sub {
29 my ($fh, $peername) = $LISTEN->accept 23 my ($fh, $peername) = $LISTEN->accept
30 or return; 24 or return;
31 25
32 my $fd = fileno $fh; 26 my $fd = fileno $fh;
33 my $host = inet_ntoa +(sockaddr_in $peername)[1]; 27 my $host = inet_ntoa +(sockaddr_in $peername)[1];
34 28
35 warn "new connection from $host\n"; 29 warn "new connection from $host\n";
36 30
31 # HACK to avoid blocking on common files on log-in.
32 # remove once async
33 cf::async {#d#
34 warn "HACK ext/tcp.ext: $cf::CONFDIR/$_\n" and Coro::AIO::aio_load "$cf::CONFDIR/$_", my $dummy for qw(rules news motd);#d#
35 warn "HACK ext/tcp.ext: $cf::LOCALDIR/crossfiremail\n" and Coro::AIO::aio_load "$cf::LOCALDIR/crossfiremail", my $dummy;#d#
37 cf::client::create $fd, $host; 36 cf::client::create $fd, $host;
38 }, 37 undef $fh;#d#
39); 38 };#d#d
39};
40 40

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines