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.2 by root, Fri Dec 15 19:59:19 2006 UTC vs.
Revision 1.10 by root, Mon May 5 09:01:58 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,
13 ReuseAddr => 1; 14 ReuseAddr => 1;
14 15
15if (!$LISTEN) { 16if (!$LISTEN) {
16 # extension yes, completely stupid, not yet 17 # extension yes, completely stupid, not yet
17 warn "unable to establish listen sockect, exiting.\n"; 18 warn "unable to establish listen socket, exiting.\n";
18 exit (2); 19 exit (2);
19} 20}
20 21
21Event->io (fd => $LISTEN, poll => 'r', data => cf::WF_AUTOCANCEL, cb => sub { 22our $LISTENER = EV::io $LISTEN, EV::READ, sub {
22 my ($fh, $peername) = $LISTEN->accept 23 my ($fh, $peername) = $LISTEN->accept
23 or return; 24 or return;
24 25
25 my $fd = fileno $fh; 26 my $fd = fileno $fh;
26 my $host = inet_ntoa +(sockaddr_in $peername)[1]; 27 my $host = inet_ntoa +(sockaddr_in $peername)[1];
27 28
28 warn "new connection from $host\n"; 29 warn "new connection from $host\n";
29 30
31 # HACK to avoid blocking on common files on log-in.
32 # remove once async
33 cf::async {#d#
34 warn "HACK: $cf::CONFDIR/$_", Coro::AIO::aio_load "$cf::CONFDIR/$_", my $dummy for qw(rules news motd);#d#
35 warn "HACK: $cf::VARDIR/crossfiremail", Coro::AIO::aio_load "$cf::VARDIR/crossfiremail", my $dummy;#d#
30 cf::add_client $fd, $host; 36 cf::client::create $fd, $host;
37 undef $fh;#d#
38 };#d#d
31}); 39};
40

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines