From ba91d212614798a371c8a41233a5288c155c4d71 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Mon, 22 Jan 2018 22:18:01 +0100 Subject: [PATCH] CPU hogging fix - handle _command functions that don't return anything - fix udp command function --- src/network/advanceddispatcher.py | 2 +- src/network/udp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/advanceddispatcher.py b/src/network/advanceddispatcher.py index 3e84ed85..31555c62 100644 --- a/src/network/advanceddispatcher.py +++ b/src/network/advanceddispatcher.py @@ -58,7 +58,7 @@ class AdvancedDispatcher(asyncore.dispatcher): break if len(self.read_buf) < self.expectBytes: return False - if getattr(self, "state_" + str(self.state))() is False: + if not getattr(self, "state_" + str(self.state))(): break except AttributeError: logger.error("Unknown state %s", self.state) diff --git a/src/network/udp.py b/src/network/udp.py index e7f6974d..0dba5a3f 100644 --- a/src/network/udp.py +++ b/src/network/udp.py @@ -61,7 +61,7 @@ class UDPSocket(BMProto): pass def state_bm_command(self): - BMProto.state_bm_command(self) + return BMProto.state_bm_command(self) # disable most commands before doing research / testing # only addr (peer discovery), error and object are implemented