diff --git a/kivyblocks/udp_widget.py b/kivyblocks/udp_widget.py index f5bac3c..d0f0594 100644 --- a/kivyblocks/udp_widget.py +++ b/kivyblocks/udp_widget.py @@ -30,7 +30,7 @@ class UdpWidget(EventDispatcher): evt_name = 'on_%s' % cmd setattr(self, evt_name, self.my_event_handler) self.register_event_type(evt_name) - print('udp_widget.py:register', evt_name, self.my_event_handler) + # print('udp_widget.py:register', evt_name, self.my_event_handler) self.get_peer_pubkey() Clock.schedule_once(self.get_peer_pubkey_loop, 2) @@ -51,7 +51,7 @@ class UdpWidget(EventDispatcher): self.get_peer_pubkey() def get_peer_pubkey(self, peer_id=None, timeout=1): - print('get_peer_pubkey(), called..') + # print('get_peer_pubkey(), called..') d = { 'c':'get_pubkey', 'd':{ @@ -61,7 +61,7 @@ class UdpWidget(EventDispatcher): bd = self.dataencoder.pack('none', d, uncrypt=True) self.udp_transport.broadcast(bd) if peer_id is None: - print('get_peer_pubkey():return') + # print('get_peer_pubkey():return') return t = t1 = time.time() t1 += timeout @@ -73,30 +73,30 @@ class UdpWidget(EventDispatcher): raise Exception('timeout') def comm_callback(self, data, addr): - print('comm_callback():', data, 'addr=', addr) + # print('comm_callback():', data, 'addr=', addr) d = self.dataencoder.unpack(addr[0], data) if d is None: - print('comm_callback(): d is None') + # print('comm_callback(): d is None') return if not isinstance(d, dict): - print('comm_callback(): d is not a dict data') + # print('comm_callback(): d is not a dict data') return - print('received: data=', d) + # print('received: data=', d) cmd = d['c'] f = self.inner_handlers.get(cmd) if f: f(d, addr) - print('comm_callback():inner callback called(),', cmd) + # print('comm_callback():inner callback called(),', cmd) return if cmd in self.block_commands: - print('comm_callback():', cmd, 'is blocked') + # print('comm_callback():', cmd, 'is blocked') return evt_name = 'on_%s' % cmd evt_data = { 'd': d, 'addr': addr } - print('udp_widget.py dispatch', evt_name, evt_data) + # print('udp_widget.py dispatch', evt_name, evt_data) self.dispatch(evt_name, evt_data) def my_event_handler(self, *args): @@ -105,12 +105,12 @@ class UdpWidget(EventDispatcher): def set_pubkey(self, data, addr): pk = data['d']['pubkey'] id = addr[0] - print('set_pubkey(): ', id, pk) + # print('set_pubkey(): ', id, pk) self.dataencoder.set_peer_text_pubkey(id, pk) def resp_pubkey(self, data, addr): self.set_pubkey(data, addr) - print('resp_pubkey():', addr[0]) + # print('resp_pubkey():', addr[0]) data = { 'c':'set_pubkey', 'd':{ @@ -124,7 +124,7 @@ class UdpWidget(EventDispatcher): self.send(peer, data) def send(self, peer_id, data, uncrypt=False): - print('send():', peer_id, data) + # print('send():', peer_id, data) d = self.dataencoder.pack(peer_id, data, uncrypt=uncrypt) addr = (peer_id, self.udp_port) self.udp_transport.send(d, addr)