Skip to content

Commit

Permalink
now a server will give its compatibility version to the metaserver
Browse files Browse the repository at this point in the history
(also, decreased verbosity of server.log)
  • Loading branch information
soundmud committed Jul 27, 2020
1 parent cbe06e8 commit a44d851
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions soundrts/servermain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion soundrts/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit a44d851

Please sign in to comment.