From db2cf3f8605efe3a354a606a371a5ab02c3ee225 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 14 Jul 2021 19:22:22 +0800 Subject: [PATCH] bugfix --- kivyblocks/udp_widget.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kivyblocks/udp_widget.py b/kivyblocks/udp_widget.py index 6cc0afa..f3a5cae 100644 --- a/kivyblocks/udp_widget.py +++ b/kivyblocks/udp_widget.py @@ -55,7 +55,8 @@ class UdpWidget(EventDispatcher): 'pubkey':self.dataencoder.my_text_publickey() } } - self.udp_transport.broadcast(d) + bd = self.dataencoder.pack('none', d, uncrypt=True) + self.udp_transport.broadcast(bd) if peer_id is None: print('get_peer_pubkey():return') return @@ -110,15 +111,15 @@ class UdpWidget(EventDispatcher): 'pubkey':self.dataencoder.my_text_publickey() } } - self.send(addr[0], data) + self.send(addr[0], data, uncrypt=True) def broadcast(self, data): for peer in self.dataencoder.public_keys.keys(): self.send(peer, data) - def send(self, peer_id, data): + def send(self, peer_id, data, uncrypt=False): print('send():', peer_id, data) - d = self.dataencoder.pack(peer_id, data) + d = self.dataencoder.pack(peer_id, data, uncrypt=uncrypt) addr = (peer_id, self.udp_port) self.udp_transport.send(d, addr)