correct thes for compressed pkt; fix output format
This commit is contained in:
@@ -136,7 +136,7 @@ def dicttos(ID, d):
|
||||
|
||||
def stodict(msg):
|
||||
d = {}
|
||||
if len(msg) > 0 and chr(msg[0]) == "!":
|
||||
if len(msg) > 0 and msg[0] == "!":
|
||||
pk = zlib.decompress(msg[5:]).decode()
|
||||
d['ID'] = msg[1:4].decode()
|
||||
else:
|
||||
@@ -334,7 +334,7 @@ def process():
|
||||
try:
|
||||
msgDict = stodict(data)
|
||||
except Exception as e:
|
||||
print("failed to parse incoming data from %s: " % (addr, data))
|
||||
print("failed to parse incoming data from %s: %s (%s)" % (addr, data, e))
|
||||
continue
|
||||
|
||||
if verbose: print("sock.recvfrom: %s (%s) %s" % (addr, len(data), str(msgDict)[:80]))
|
||||
|
||||
Reference in New Issue
Block a user