--- deliantra/server/ext/tcp.ext 2007/01/21 21:28:27 1.6 +++ deliantra/server/ext/tcp.ext 2007/11/24 05:57:09 1.9 @@ -10,31 +10,24 @@ our $LISTEN = new IO::Socket::INET LocalPort => cf::settings->csport, Listen => 1, - Blocking => 0, # bugfix workaround for Event calling handler twice :( + Blocking => 0, ReuseAddr => 1; if (!$LISTEN) { # extension yes, completely stupid, not yet - warn "unable to establish listen sockect, exiting.\n"; + warn "unable to establish listen socket, exiting.\n"; exit (2); } -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]; - - warn "new connection from $host\n"; - - cf::client::create $fd, $host; - }, -); +our $LISTENER = EV::io $LISTEN, EV::READ, sub { + my ($fh, $peername) = $LISTEN->accept + or return; + + my $fd = fileno $fh; + my $host = inet_ntoa +(sockaddr_in $peername)[1]; + + warn "new connection from $host\n"; + + cf::client::create $fd, $host; +};