From 02b8cc22b9225fe62db37b74d85a7c9e93344801 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 14 Jul 2021 16:14:36 +0800 Subject: [PATCH] bugfix --- kivyblocks/udp_widget.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kivyblocks/udp_widget.py b/kivyblocks/udp_widget.py index fd2a614..4bbdd38 100644 --- a/kivyblocks/udp_widget.py +++ b/kivyblocks/udp_widget.py @@ -4,6 +4,7 @@ except: import json import time +import zlib from kivy.event import EventDispatcher from kivy.clock import Clock from appPublic.udp_comm import UdpComm @@ -55,6 +56,7 @@ class UdpWidget(EventDispatcher): } } b = b'0x00' * 18 + json.dumps(d).encode('utf-8') + b = zlib.compress(b) self.udp_transport.broadcast(b) if peer_id is None: print('get_peer_pubkey():return') @@ -127,9 +129,9 @@ class UdpWidget(EventDispatcher): self.send(peer, data) def send(self, peer_id, data): + print('send():', peer_id, data) d = self.dataencoder.pack(peer_id, data) addr = (peer_id, self.udp_port) - print('send():', peer_id, data) self.udp_transport.send(d, addr) def stop(self):