bugfix
This commit is contained in:
parent
02b8cc22b9
commit
f31ab177e6
@ -55,9 +55,7 @@ class UdpWidget(EventDispatcher):
|
|||||||
'pubkey':self.dataencoder.my_text_publickey()
|
'pubkey':self.dataencoder.my_text_publickey()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b = b'0x00' * 18 + json.dumps(d).encode('utf-8')
|
self.udp_transport.broadcast(d)
|
||||||
b = zlib.compress(b)
|
|
||||||
self.udp_transport.broadcast(b)
|
|
||||||
if peer_id is None:
|
if peer_id is None:
|
||||||
print('get_peer_pubkey():return')
|
print('get_peer_pubkey():return')
|
||||||
return
|
return
|
||||||
@ -72,17 +70,7 @@ class UdpWidget(EventDispatcher):
|
|||||||
|
|
||||||
def comm_callback(self, data, addr):
|
def comm_callback(self, data, addr):
|
||||||
print('comm_callback():', data, 'addr=', addr)
|
print('comm_callback():', data, 'addr=', addr)
|
||||||
d = None
|
d = self.dataencoder.unpack(addr[0], data)
|
||||||
if data[:18] == b'0x00' * 18:
|
|
||||||
data = data[18:]
|
|
||||||
try:
|
|
||||||
d = json.loads(data.decode('utf-8'))
|
|
||||||
except Exception as e:
|
|
||||||
print(e, addr, data)
|
|
||||||
print_exc()
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
d = self.dataencoder.unpack(addr[0], data)
|
|
||||||
if d is None:
|
if d is None:
|
||||||
print('comm_callback(): d is None')
|
print('comm_callback(): d is None')
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user