ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cf.schmorp.de/maps/perl/metaserver.ext
Revision: 1.5
Committed: Fri Dec 15 19:11:46 2006 UTC (17 years, 7 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +0 -0 lines
State: FILE REMOVED
Log Message:
move .ext to server

File Contents

# Content
1 #! perl
2
3 # metaserver reports
4
5 use IO::Socket::INET;
6
7 $cf::CFG{metaserver_comment}
8 or return;
9
10 our $UPDATE_METASERVER = Event->timer (after => 5, interval => 299, data => cf::WF_AUTOCANCEL, cb => sub {
11 my $socket = new IO::Socket::INET
12 Proto => 'udp',
13 PeerAddr => $cf::CFG{metaserver_metaserver},
14 LocalAddr => $cf::CFG{metaserver_serveraddr}
15 or die "metaserver socket creation error: $!";
16
17 my $num_players = grep
18 $_->ob->map
19 && !$_->hidden
20 && !$_->ob->flag (cf::FLAG_WIZ),
21 cf::player::list;
22
23 my $pkt = sprintf "%s|%d|%s|%s|%d|%d|%d",
24 $cf::CFG{metaserver_servername},
25 $num_players,
26 cf::VERSION,
27 $cf::CFG{metaserver_comment},
28 0, # ibytes
29 0, # obytes
30 time - $cf::uptime;
31
32 syswrite $socket, $pkt;
33 });