--- deliantra/server/ext/tcp.ext 2006/12/21 06:12:35 1.3 +++ deliantra/server/ext/tcp.ext 2007/01/21 21:28:27 1.6 @@ -10,6 +10,7 @@ our $LISTEN = new IO::Socket::INET LocalPort => cf::settings->csport, Listen => 1, + Blocking => 0, # bugfix workaround for Event calling handler twice :( ReuseAddr => 1; if (!$LISTEN) { @@ -18,14 +19,22 @@ exit (2); } -Event->io (fd => $LISTEN, poll => 'r', data => cf::WF_AUTOCANCEL, cb => sub { - my ($fh, $peername) = $LISTEN->accept - or return; +Event->io ( + reentrant => 0, + fd => $LISTEN, + nice => 1, + poll => 'r', + data => cf::WF_AUTOCANCEL, + cb => sub { + my ($fh, $peername) = $LISTEN->accept + or return; - my $fd = fileno $fh; - my $host = inet_ntoa +(sockaddr_in $peername)[1]; + my $fd = fileno $fh; + my $host = inet_ntoa +(sockaddr_in $peername)[1]; - warn "new connection from $host\n"; + warn "new connection from $host\n"; + + cf::client::create $fd, $host; + }, +); - cf::client::create $fd, $host; -});