From fbf3c57576fcc20381b2cba4c8b483ef0b958107 Mon Sep 17 00:00:00 2001 From: Diego Roversi Date: Sun, 15 Sep 2019 15:37:30 +0200 Subject: fix import and convert some string in to bytes --- common/gamesrv.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'common') diff --git a/common/gamesrv.py b/common/gamesrv.py index ecf6cdc..303d7d0 100644 --- a/common/gamesrv.py +++ b/common/gamesrv.py @@ -425,7 +425,7 @@ class Client: self.initialdata = MSG_WELCOME self.initialized = 0 self.msgl = [message(MSG_PING)] - self.buf = "" + self.buf = b"" self.players = { } self.sounds = None self.has_sound = 0 @@ -440,7 +440,7 @@ class Client: def opengame(self, game): if self.initialized == 0: - self.initialdata += game.FnDesc + '\n' + self.initialdata += game.FnDesc.encode() + b'\n' self.initialized = 1 if self.initialized == 1: if game.broadcast_port: @@ -1004,13 +1004,13 @@ def openpingsocket(only_port=None): only_port = only_port or PORTS.get('PING', None) s = findsocket('PING') if s is None: - from . import hostchooser + import hostchooser s = hostchooser.serverside_ping(only_port) if s is None: return None def pingsocket_handler(s=s): global game - from . import hostchooser + import hostchooser if game is not None: args = game.FnDesc, ('', game.address[1]), game.FnExtraDesc() else: @@ -1165,7 +1165,7 @@ class Game: else: try: self.broadcast_s.sendto(BROADCAST_MESSAGE, - ('', self.broadcast_port)) + (b'', self.broadcast_port)) #print "Broadcast ping" except error: pass # ignore failed broadcasts @@ -1174,8 +1174,8 @@ class Game: return delay def sendudpdata(self): - sprites[0] = '' - udpdata = ''.join(sprites) + sprites[0] = b'' + udpdata = b''.join(sprites) if len(broadcast_clients) >= 2: broadcast_extras = {} else: @@ -1188,7 +1188,7 @@ class Game: udpdata = ''.join(list(broadcast_extras.keys()) + [udpdata]) try: self.broadcast_s.sendto(udpdata, - ('', self.broadcast_port)) + (b'', self.broadcast_port)) #print "Broadcast UDP data" except error: pass # ignore failed broadcasts -- cgit v1.2.3