#! 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 # is unknown as of today. use Socket; 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"; push @LISTENERS, tcp_server $host, $port, sub { my ($fh, $host, $port) = @_ or return; warn "new connection from ", (format_hostport $host, $port), "\n"; cf::client::create fileno $fh, $host; }; }