diff options
Diffstat (limited to 'lib/MasterServer/Core')
| -rwxr-xr-x | lib/MasterServer/Core/Core.pm | 21 | ||||
| -rwxr-xr-x | lib/MasterServer/Core/Logging.pm | 2 | ||||
| -rwxr-xr-x | lib/MasterServer/Core/Util.pm | 14 | ||||
| -rwxr-xr-x | lib/MasterServer/Core/Version.pm | 14 |
4 files changed, 34 insertions, 17 deletions
diff --git a/lib/MasterServer/Core/Core.pm b/lib/MasterServer/Core/Core.pm index e4e4836..0e0cd58 100755 --- a/lib/MasterServer/Core/Core.pm +++ b/lib/MasterServer/Core/Core.pm @@ -11,20 +11,26 @@ our @EXPORT = qw | halt main |; ################################################################################ ## Handle shutting down the program in case a fatal error occurs. -## TODO: lockfile! ################################################################################ sub halt { my $self = shift; # log shutdown - $self->log("stop", "Stopping the masterserver now."); + $self->log("stop", "Stopping the masterserver."); # clear all other timers, network servers, etc $self->{dbh}->disconnect() if (defined $self->{dbh}); + $self->{dbh} = undef; $self->{scope} = undef; - # and send signal to condition var + # and send signal to condition var to let the loops end $self->{must_halt}->send; + + # log halt + $self->log("stop", "Shutting down NOW!"); + + # time for a beer. + exit; } ################################################################################ @@ -81,20 +87,21 @@ sub main { # start the beacon checker service (query entries from the pending list) $self->{scope}->{beacon_checker} = $self->beacon_checker() if ($self->{beacon_checker_enabled}); + + # provide server lists to clients with the browser host server + $self->{scope}->{browser_host} = $self->browser_host(); # query other masterserver applets to get more server addresses $self->{scope}->{ucc_applet_query} = $self->ucc_applet_query_scheduler() if ($self->{master_applet_enabled}); + # synchronize with 333networks-based masterservers + $self->{scope}->{syncer_scheduler} = $self->syncer_scheduler() if ($self->{sync_enabled}); # all modules loaded. Running... $self->log("info", "All modules loaded. Masterserver is now running."); # prevent main program from ending prematurely $self->{must_halt}->recv; - $self->log("stop", "Shutting down NOW!"); - - # time for a beer. - exit; } 1; diff --git a/lib/MasterServer/Core/Logging.pm b/lib/MasterServer/Core/Logging.pm index c503e1a..800fa43 100755 --- a/lib/MasterServer/Core/Logging.pm +++ b/lib/MasterServer/Core/Logging.pm @@ -26,7 +26,7 @@ sub log { return if (defined $type && $self->{suppress} =~ m/$type/i); # determine filename - my $f = "MasterServer-333networks"; + my $f = "MasterServer-Perl"; # rotate log filename according to config $f .= $daily if ($self->{log_rotate} =~ /^daily$/i ); diff --git a/lib/MasterServer/Core/Util.pm b/lib/MasterServer/Core/Util.pm index eb4d509..af3a551 100755 --- a/lib/MasterServer/Core/Util.pm +++ b/lib/MasterServer/Core/Util.pm @@ -7,18 +7,26 @@ use IP::Country::Fast; use POSIX qw/strftime/; use Exporter 'import'; -our @EXPORT = qw| valid_address ip2country |; +our @EXPORT = qw| ip2country countryflag valid_address |; ################################################################################ -## return the abbreviated country based on IP +## return the abbreviated country name based on IP ################################################################################ sub ip2country { -my ($self, $ip) = @_; + my ($self, $ip) = @_; my $reg = IP::Country::Fast->new(); return $reg->inet_atocc($ip); } ################################################################################ +## return the flag of a country +################################################################################ +sub countryflag { + my ($self, $country) = @_; + # placeholder function to return the flag of a country +} + +################################################################################ ## Verify whether a given domain name or IP address and port are valid. ## returns 1/0 if valid/invalid ip + port ################################################################################ diff --git a/lib/MasterServer/Core/Version.pm b/lib/MasterServer/Core/Version.pm index 30972e4..aba692f 100755 --- a/lib/MasterServer/Core/Version.pm +++ b/lib/MasterServer/Core/Version.pm @@ -17,22 +17,24 @@ sub version { my $self = shift; # version and author information - # -- addition to the LICENCE, you are only allowed to modify these lines - # if you send Darkelarious a postcard or email with your compliments or, - # in case of a company editing, a letter of commendation. # # You are not allowed to modify these variables without making (significant) # alterations to the source code of this master server program. Only changing # these fields does not count as a significant alteration. + # + # -- addition to the LICENCE, you are only allowed to modify these lines + # if you send Darkelarious a postcard or email with your compliments or, + # in case of a company editing, a letter of (re)commendation. + # # master type - $self->{build_type} = "333networks Masterserver-Perl"; + $self->{build_type} = "333networks Masterserver-Perl (Pg-SQLite) 20150519208"; # version - $self->{build_version} = "2.0.4"; + $self->{build_version} = "2.0.8"; # date yyyy-mm-dd - $self->{build_date} = "2015-02-11"; + $self->{build_date} = "2015-05-19"; #author, email $self->{build_author} = "Darkelarious, darkelarious\@333networks.com"; |
