diff options
| author | Darkelarious <darkelarious@333networks.com> | 2016-11-19 20:56:04 +0100 |
|---|---|---|
| committer | Darkelarious <darkelarious@333networks.com> | 2016-11-19 20:56:04 +0100 |
| commit | c3f8d65a4fb1f5674557ee67cf7f74369df86ad1 (patch) | |
| tree | 92aab2a394bda28da0ed7c7c75e633fdf386fc71 /lib/MasterServer/UDP/BeaconCatcher.pm | |
| parent | 1de3da4b8027508a91144639455c934fd6ccb9b7 (diff) | |
| download | MasterServer-Perl-c3f8d65a4fb1f5674557ee67cf7f74369df86ad1.tar.gz MasterServer-Perl-c3f8d65a4fb1f5674557ee67cf7f74369df86ad1.zip | |
Massive improvements on efficiency, robustness, security, reliability and more
Diffstat (limited to 'lib/MasterServer/UDP/BeaconCatcher.pm')
| -rwxr-xr-x | lib/MasterServer/UDP/BeaconCatcher.pm | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/MasterServer/UDP/BeaconCatcher.pm b/lib/MasterServer/UDP/BeaconCatcher.pm index 0d5ce81..06fd38a 100755 --- a/lib/MasterServer/UDP/BeaconCatcher.pm +++ b/lib/MasterServer/UDP/BeaconCatcher.pm @@ -16,8 +16,8 @@ our @EXPORT = qw| beacon_catcher on_beacon_receive|; sub beacon_catcher { my $self = shift; - # module startup log - $self->log("load","Loading UDP Beacon Catcher."); + # display that the server is up and listening for beacons + $self->log("info", "Listening for UDP beacons on port $self->{beacon_port}."); # UDP server my $udp_server; @@ -30,9 +30,6 @@ sub beacon_catcher { on_recv => sub {$self->on_beacon_receive(@_)}, ); - # display that the server is up and listening for beacons - $self->log("info", "Listening for UT Beacons on port $self->{beacon_port}."); - # allow object to exist beyond this scope. Objects have ambitions too. return $udp_server; } @@ -57,14 +54,18 @@ sub on_beacon_receive { # truncate and try to continue $b = substr $b, 0, 64; } - + # if a heartbeat format was detected... $self->process_udp_beacon($udp, $pa, $b, $peer_addr, $port) if ($b =~ m/\\heartbeat\\/ && $b =~ m/\\gamename\\/); - + # or if this is a secure response, verify the response $self->process_udp_validate($b, $peer_addr, $port, undef) if ($b =~ m/\\validate\\/); + + # or if other masterservers check if we're still alive + $self->process_udp_basic($udp, $pa, $b, $peer_addr) + if ($b =~ m/\\basic\\/ || $b =~ m/\\status\\/ || $b =~ m/\\info\\/); } 1; |
