--- deliantra/server/ext/tcp.ext 2010/04/29 07:32:34 1.16 +++ deliantra/server/ext/tcp.ext 2012/02/03 03:01:45 1.20 @@ -1,16 +1,17 @@ -#! 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 +# whether this being an extension introduces or reduces stability problems # is unknown as of today. use Socket; use AnyEvent::Socket; -our $BIND = $cf::CFG{bind_addresses} || [[undef, 13327]]; +CONF BIND_ADDRESSES = [[undef, 13327]]; + our @LISTENERS; -for (@$BIND) { +for (@$BIND_ADDRESSES) { my ($host, $port) = @$_; cf::info "listening on ", (format_hostport $host, $port), "\n"; @@ -18,7 +19,11 @@ my ($fh, $host, $port) = @_ or return; - cf::info "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; };