--- deliantra/server/ext/tcp.ext 2010/01/31 03:46:20 1.14 +++ deliantra/server/ext/tcp.ext 2010/05/09 21:46:39 1.18 @@ -1,4 +1,4 @@ -#! perl # MANDATORY +#! perl # mandatory # this listens for new tcp connections and hands them over to the server core # wether this being an extension introduces or reduces stability problems @@ -8,16 +8,21 @@ use AnyEvent::Socket; our $BIND = $cf::CFG{bind_addresses} || [[undef, 13327]]; +our @LISTENERS; for (@$BIND) { my ($host, $port) = @$_; - warn "listening on ", (format_hostport $host, $port), "\n"; + cf::info "listening on ", (format_hostport $host, $port), "\n"; - tcp_server $host, $port, sub { + push @LISTENERS, tcp_server $host, $port, sub { my ($fh, $host, $port) = @_ or return; - warn "new connection from ", (format_hostport $host, $port), "\n"; + my $lhost = AnyEvent::Socket::format_address + +(AnyEvent::Socket::unpack_sockaddr getsockname $fh)[1]; + + cf::info "new connection from ", (format_hostport $host, $port), "\n" + if $lhost ne $host; # do not log connections from the host, e.g. for watchdogs cf::client::create fileno $fh, $host; };