CPU hogging fix

- handle _command functions that don't return anything
- fix udp command function
This commit is contained in:
Peter Šurda 2018-01-22 22:18:01 +01:00
parent c9851b9f41
commit ba91d21261
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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