correct thes for compressed pkt; fix output format

This commit is contained in:
2020-01-07 14:54:24 -05:00
parent 9bb5fe20be
commit aab4793fe8
+2 -2
View File
@@ -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]))