Shrink socket hardcoded msg lengths to 7

This commit is contained in:
Nguyễn Gia Phong 2018-03-07 17:04:48 +07:00
parent 5fa4eac9a8
commit d7eb9071a0
2 changed files with 4 additions and 4 deletions

View File

@ -258,13 +258,13 @@ class Game:
self.maze.reinit()
while True:
if self.hero.dead:
connection.send('00000000'.encode())
connection.send('0000000'.encode())
break
data = self.export()
connection.send('{:08}'.format(len(data)).encode())
connection.send('{:07}'.format(len(data)).encode())
connection.send(data)
try:
buf = connection.recv(8)
buf = connection.recv(7)
except: # client is likely to be closed
break
if not buf: break

2
wiki

@ -1 +1 @@
Subproject commit 1b8020f4d1343c582fb3b202048db2b61be29381
Subproject commit 172d7d268f9bb3bd3c90e3f52c7d118ab2921977