summaryrefslogtreecommitdiff
path: root/common/gamesrv.py
diff options
context:
space:
mode:
authorDiego Roversi <diegor@tiscali.it>2020-05-03 13:12:50 +0200
committerDiego Roversi <diegor@tiscali.it>2020-05-03 13:12:50 +0200
commit3925a488bfa06b549de1eefaafe7e833de9df329 (patch)
treed6b9c4691c0ddf3386e93b7e44711d6a6493f281 /common/gamesrv.py
parente7c8fa54260df54af9e3c6599d3255a2dcde5c8f (diff)
gamesrv: some questionable fixes
Diffstat (limited to 'common/gamesrv.py')
-rw-r--r--common/gamesrv.py11
1 files changed, 7 insertions, 4 deletions
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