From 3925a488bfa06b549de1eefaafe7e833de9df329 Mon Sep 17 00:00:00 2001 From: Diego Roversi Date: Sun, 3 May 2020 13:12:50 +0200 Subject: gamesrv: some questionable fixes --- common/gamesrv.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/gamesrv.py b/common/gamesrv.py index fed2320..eaa9a87 100644 --- a/common/gamesrv.py +++ b/common/gamesrv.py @@ -467,7 +467,7 @@ class Client: if self.udpsocket is not None: if self.sounds: if broadcast_extras is None or self not in broadcast_clients: - udpdata = ''.join(list(self.sounds.keys()) + [udpdata]) + udpdata = b''.join(list(self.sounds.keys()) + [udpdata]) else: broadcast_extras.update(self.sounds) for key, value in list(self.sounds.items()): @@ -477,10 +477,13 @@ class Client: del self.sounds[key] if broadcast_extras is None or self not in broadcast_clients: if self.dyncompress is not None: + # DEBUG: print(f"self.dyncompress={self.dyncompress}", file=sys.stderr) udpdatas = self.dynamic_compress(udpdata) + # DEBUG: print(f"udpdata={udpdata}",file=sys.stderr) else: udpdatas = [udpdata] - for udpdata in udpdatas: + # DEBUG: print(f"udpdatas={udpdatas}",file=sys.stderr) + for udpdata in udpdatas or []: try: self.udpsockcounter += self.udpsocket.send(udpdata) except error as e: @@ -505,7 +508,7 @@ class Client: threads = [] for t in range(3): co = zlib.compressobj(6) - threads.append( (bytes(0x88 + t, t), co) ) + threads.append( (bytes([0x88 + t, t]), co) ) frame = 0 globalsync = 0 @@ -513,7 +516,7 @@ class Client: # write three normal packets, one on each thread for t in range(3): head, co = threads.pop(0) - yield head + chr(frame), co + yield head + frame, co threads.append((chr(ord(head[0]) & 0x87) + chr(frame), co)) yield None, None frame = (frame + 1) & 0xFF -- cgit v1.2.3