aboutsummaryrefslogtreecommitdiff
path: root/lib/MasterServer/TCP
diff options
context:
space:
mode:
authorDarkelarious <darkelarious@333networks.com>2015-11-08 15:42:27 +0100
committerDarkelarious <darkelarious@333networks.com>2015-11-08 15:42:27 +0100
commit8b3d393e7755c167eebe4d9f7fc786074f12e9af (patch)
tree756afc39bc4e5794c51b7a947ff3832b341cbb6b /lib/MasterServer/TCP
parent2c7d62f38944f61e7eafea155c6128521d16aed9 (diff)
downloadMasterServer-Perl-8b3d393e7755c167eebe4d9f7fc786074f12e9af.tar.gz
MasterServer-Perl-8b3d393e7755c167eebe4d9f7fc786074f12e9af.zip
Full support for Postgres, MySQL and SQLite3 + minor bug fixes
Diffstat (limited to 'lib/MasterServer/TCP')
-rwxr-xr-xlib/MasterServer/TCP/Handler.pm9
-rwxr-xr-xlib/MasterServer/TCP/Syncer.pm9
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/MasterServer/TCP/Handler.pm b/lib/MasterServer/TCP/Handler.pm
index bf6beb9..9d05a32 100755
--- a/lib/MasterServer/TCP/Handler.pm
+++ b/lib/MasterServer/TCP/Handler.pm
@@ -33,7 +33,7 @@ sub read_tcp_handle {
# allow multiple blocks to add to the response string
my $response = "";
-
+
# replace empty values for the string "undef" and replace line endings from netcatters
# parse the received data and extrapolate all the query commands found
my %r = ();
@@ -243,9 +243,9 @@ sub handle_list {
sub handle_sync {
my ($self, $val, $r, $c, $a, $p) = @_;
- # alternate part 3: wait for the requested action: \sync\(all|list of games)
+ # alternate part 3: wait for the requested action: \sync\(all|list of games)\sender\domainname
$self->log("tcp","Sync request from $a:$p found");
-
+
if ($val && exists $r->{sync}) {
# compile list of addresses
@@ -256,7 +256,8 @@ sub handle_sync {
$c->push_write($data);
# log successful (debug)
- $self->log("sync","$a:$p successfully synced.");
+ if (exists $r->{sender}) {$self->log("sync","$r->{sender} successfully synced.");}
+ else {$self->log("sync","$a:$p successfully synced.");}
# clean and close the connection
$self->clean_tcp_handle($c);
diff --git a/lib/MasterServer/TCP/Syncer.pm b/lib/MasterServer/TCP/Syncer.pm
index dea20a5..69025f0 100755
--- a/lib/MasterServer/TCP/Syncer.pm
+++ b/lib/MasterServer/TCP/Syncer.pm
@@ -6,7 +6,6 @@ use warnings;
use AnyEvent;
use AnyEvent::Handle;
use Exporter 'import';
-use Data::Dumper 'Dumper';
our @EXPORT = qw| syncer_scheduler sync_with_master process_sync_list|;
@@ -85,7 +84,7 @@ sub sync_with_master {
$handle->push_write("\\gamename\\333networks\\location\\0\\validate\\$validate\\final\\");
# part 3: request the list \sync\gamenames consisting of space-seperated game names or "all"
- my $request = "\\sync\\".(($self->{sync_games}[0] == 0) ? "all" : $self->{sync_games}[1])."\\final\\";
+ my $request = "\\sender\\$self->{masterserver_address}\\sync\\".(($self->{sync_games}[0] == 0) ? "all" : $self->{sync_games}[1])."\\final\\";
# push the request to remote host
$handle->push_write($request);
@@ -118,6 +117,12 @@ sub process_sync_list {
# counter
my $c = 0;
+ if (exists $r{echo}) {
+ # remote address says...
+ $self->log("error", "$ms->{address} replied: $r{echo}");
+
+ }
+
# iterate through the gamenames and addresses
while ( my ($gn,$addr) = each %r) {