From a44d8512ed2ac6ba067f395fd54d7418b91164bf Mon Sep 17 00:00:00 2001 From: soundmud Date: Mon, 27 Jul 2020 12:10:37 +0200 Subject: [PATCH] now a server will give its compatibility version to the metaserver (also, decreased verbosity of server.log) --- soundrts/servermain.py | 9 ++++++--- soundrts/version.py | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/soundrts/servermain.py b/soundrts/servermain.py index 03e1f94f..a83a7070 100644 --- a/soundrts/servermain.py +++ b/soundrts/servermain.py @@ -10,7 +10,7 @@ from .serverclient import ConnectionToClient from .serverroom import InTheLobby, OrganizingAGame, Playing, WaitingForTheGameToStart, Game from .lib.ticker import Ticker -from .version import VERSION +from .version import SERVER_COMPATIBILITY from . import config from . import options @@ -78,7 +78,9 @@ def _is_admin(self, client): def remove_client(self, client): client.is_disconnected = True + must_log = False if client in self.clients: # not anonymous + must_log = True info("disconnect: %s" % client.login) self.clients.remove(client) for c in self.players_not_playing(): @@ -94,7 +96,8 @@ def remove_client(self, client): if self._is_admin(client) and not self.is_standalone: info("the admin has disconnected => close the server") sys.exit() - self.log_status() + if must_log: + self.log_status() def handle_write(self): pass @@ -154,7 +157,7 @@ def _get_ip_address(self): def _register(self): try: s = urllib.request.urlopen(REGISTER_URL + "?version=%s&login=%s&ip=%s&port=%s" % - (VERSION, self.login, self.ip, + (SERVER_COMPATIBILITY, self.login, self.ip, options.port)).read() except: s = "couldn't access to the metaserver" diff --git a/soundrts/version.py b/soundrts/version.py index d5c9f922..e6cb605a 100644 --- a/soundrts/version.py +++ b/soundrts/version.py @@ -6,10 +6,13 @@ VERSION = "1.3.1" IS_DEV_VERSION = config.debug_mode CLIENT_COMPATIBILITY = "1.3.0" +SERVER_COMPATIBILITY = "0" def server_is_compatible(version): - return version.startswith("1.3.") or version == "1.2-c12" + if version in ["1.2-c12", "1.3.0", "1.3.1"]: + version = "0" + return version == SERVER_COMPATIBILITY def compatibility_version():