diff options
Diffstat (limited to 'lib/MasterServer/UDP')
| -rwxr-xr-x | lib/MasterServer/UDP/BeaconCatcher.pm | 3 | ||||
| -rwxr-xr-x | lib/MasterServer/UDP/DatagramProcessor.pm | 16 | ||||
| -rwxr-xr-x | lib/MasterServer/UDP/UDPTicker.pm | 5 | ||||
| -rwxr-xr-x | lib/MasterServer/UDP/UpLink.pm | 24 |
4 files changed, 17 insertions, 31 deletions
diff --git a/lib/MasterServer/UDP/BeaconCatcher.pm b/lib/MasterServer/UDP/BeaconCatcher.pm index 6058bfa..1bfc5b0 100755 --- a/lib/MasterServer/UDP/BeaconCatcher.pm +++ b/lib/MasterServer/UDP/BeaconCatcher.pm @@ -34,6 +34,9 @@ sub recv_beacon { # unpack ip from packed client address my ($port, $iaddr) = sockaddr_in($paddress); my $beacon_address = inet_ntoa($iaddr); + + # ignore localhost and restricted IPs like localhost + return unless $self->valid_address($beacon_address, $port); # determine and process heartbeat if ($buffer =~ m/\\heartbeat\\/) { diff --git a/lib/MasterServer/UDP/DatagramProcessor.pm b/lib/MasterServer/UDP/DatagramProcessor.pm index 5587875..87c23a1 100755 --- a/lib/MasterServer/UDP/DatagramProcessor.pm +++ b/lib/MasterServer/UDP/DatagramProcessor.pm @@ -77,14 +77,12 @@ sub process_datagram { enctype => $rx->{enctype}, validate => $rx->{validate}, ); - $self->log("secure","$o{ip}, $o{port} failed validation for ". - ($rx->{gamename} || "empty_gamename") - ."; sent: '". ($o{secure} || "empty_secure") - ."', expected '". ($val_str || "empty_v_string") - ."', got '". ($rx->{validate} || "empty_r_validate") - ."' with cipher '". ($self->get_game_props(gamename => $rx->{gamename})->[0]->{cipher} || "empty_cipher") - ."'" - ); + $self->log("secure","$o{ip}, $o{port} failed validation for ".($rx->{gamename} || "empty_gamename") ); + $self->log("secure", + "cipher: " .($self->get_game_props(gamename => $rx->{gamename})->[0]->{cipher} || "empty_cipher") . ", " + ."secure: " .($o{secure} || "empty_secure"). ", " + ."expected: " .($val_str || "empty_v_string"). ", " + ."received: " .($rx->{validate} || "empty_r_validate")); # remove addresses anyway to prevent error spamming in log $self->remove_pending(ip => $o{ip}, port => $o{port}); @@ -143,7 +141,7 @@ sub unify_information { my %uei; # unified extended info my @upi; # unified player info - # FIXME unify with player playername name + # FIXME unify with {player playername name, other keys/columns} # first process all available player entries for (my $i = 0; exists $rx->{"player_$i"}; $i++) { diff --git a/lib/MasterServer/UDP/UDPTicker.pm b/lib/MasterServer/UDP/UDPTicker.pm index 0566449..f5673a4 100755 --- a/lib/MasterServer/UDP/UDPTicker.pm +++ b/lib/MasterServer/UDP/UDPTicker.pm @@ -30,8 +30,9 @@ sub udp_ticker { # tick through pending list and server list my $server_info = AnyEvent->timer ( - after => 120, # grace time receiving beacons - interval => 0.2, # ~5 servers/s + after => 120, # grace time receiving beacons -- MUST be the last + # function to start as it controls the first_run parameter + interval => 0.2, # ~5 servers/second cb => sub { # reset counters if minimum time before reset passed + list processed if ($self->{firstrun}) { diff --git a/lib/MasterServer/UDP/UpLink.pm b/lib/MasterServer/UDP/UpLink.pm index d523ad0..16550c3 100755 --- a/lib/MasterServer/UDP/UpLink.pm +++ b/lib/MasterServer/UDP/UpLink.pm @@ -70,8 +70,7 @@ sub do_uplink { } ################################################################################ -## Respond to status-like queries. Supported queries are basic, info, rules, -## players, status. +## Respond to status-like queries. Supported: basic, info, rules, status. ## Note: this replaces the \about\ query in the TCP handler! ################################################################################ sub handle_status_query { @@ -124,31 +123,16 @@ sub handle_status_query { # rules query if (defined $rx->{rules} || defined $rx->{status}) { - $response .= "\\mutators\\333networks synchronization, UCC Master applet synchronization, Display Stats As Players" + $response .= "\\mutators\\333networks synchronization, UCC Master applet synchronization, Server Status Checker" . "\\AdminName\\".($self->{masterserver_name} || "") . "\\AdminEMail\\".($self->{masterserver_contact} || "") . "\\queryid\\$query_id.".$sub_id++; } - - # players query - if (defined $rx->{players} || defined $rx->{status}) { - # list game stats as if they were players. let the client figure out how - # to list this information on their website (hint: that's us) - my $c = 0; - foreach my $p (@{$gameinfo}) { - $response .= "\\player_$c\\".($p->{description} || "") - . "\\team_$c\\" .($p->{gamename} || "") - . "\\skin_$c\\" .($p->{num_total} || 0) . " total" - . "\\mesh_$c\\" .($p->{num_uplink} || 0) . " direct"; - $c++; # start with player_0, increment - } - $response .= "\\queryid\\$query_id.".$sub_id++; - } - + # close query with final tag $response .= "\\final\\"; - # split the response in chunks of 512 bytes and send + # split the response in chunks of 512 characters and send while (length $response > 512) { my $chunk = substr $response, 0, 512, ''; $udp->push_send($chunk, $paddress); |
