ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/tcp.ext
Revision: 1.12
Committed: Sun May 25 21:15:44 2008 UTC (16 years ago) by root
Branch: MAIN
CVS Tags: rel-2_82, rel-2_81, rel-2_80, rel-2_6, rel-2_7, rel-2_72, rel-2_73, rel-2_71, rel-2_76, rel-2_77, rel-2_74, rel-2_75, rel-2_56, rel-2_79, rel-2_90, rel-2_78, rel-2_61
Changes since 1.11: +25 -31 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.12 #! perl # MANDATORY
2 root 1.1
3     # this listens for new tcp connections and hands them over to the server core
4     # wether this being an extension introduces or reduces stability problems
5     # is unknown as of today.
6    
7     use Socket;
8 root 1.12 use AnyEvent::Socket;
9 root 1.1
10 root 1.12 our $BIND = $cf::CFG{bind_addresses} || [[undef, 13327]];
11    
12     for (@$BIND) {
13     my ($host, $port) = @$_;
14     warn "listening on $host:$port\n";
15    
16     tcp_server $host, $port, sub {
17     my ($fh, $host, $port) = @_
18     or return;
19    
20     my $fd = fileno $fh;
21    
22     warn "new connection from [$host]:$port\n";
23    
24     # HACK to avoid blocking on common files on log-in.
25     # remove once async
26     cf::async {#d#
27     warn "HACK ext/tcp.ext: $cf::CONFDIR/$_\n" and Coro::AIO::aio_load "$cf::CONFDIR/$_", my $dummy for qw(rules news motd);#d#
28     warn "HACK ext/tcp.ext: $cf::LOCALDIR/crossfiremail\n" and Coro::AIO::aio_load "$cf::LOCALDIR/crossfiremail", my $dummy;#d#
29     cf::client::create $fd, $host;
30     undef $fh;#d#
31     };#d#d
32     };
33 root 1.1 }
34