From 62200d4d983b3fcad95249dd953e1ffde3c5ef6d Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Thu, 11 Jul 2019 13:26:57 -0500 Subject: [PATCH] fixed broken daemon queue thread count --- onionr/communicatorutils/daemonqueuehandler.py | 2 +- onionr/communicatorutils/onionrcommunicatortimers.py | 2 +- onionr/communicatorutils/uploadblocks.py | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/onionr/communicatorutils/daemonqueuehandler.py b/onionr/communicatorutils/daemonqueuehandler.py index c11cc929..7c922aa1 100755 --- a/onionr/communicatorutils/daemonqueuehandler.py +++ b/onionr/communicatorutils/daemonqueuehandler.py @@ -53,4 +53,4 @@ def handle_daemon_commands(comm_inst): localcommand.local_command(comm_inst._core, 'queueResponseAdd/' + cmd[4], post=True, postData={'data': response}) response = '' - comm_inst.decrementThreadCount('daemonCommands') \ No newline at end of file + comm_inst.decrementThreadCount('handle_daemon_commands') \ No newline at end of file diff --git a/onionr/communicatorutils/onionrcommunicatortimers.py b/onionr/communicatorutils/onionrcommunicatortimers.py index e765fd66..df3b06d0 100755 --- a/onionr/communicatorutils/onionrcommunicatortimers.py +++ b/onionr/communicatorutils/onionrcommunicatortimers.py @@ -52,7 +52,7 @@ class OnionrCommunicatorTimers: if self.makeThread: for i in range(self.threadAmount): if self.daemonInstance.threadCounts[self.timerFunction.__name__] >= self.maxThreads: - logger.debug('%s is currently using the maximum number of threads, not starting another.' % self.timerFunction.__name__) + logger.debug('%s is currently using the maximum number of threads, not starting another.' % self.timerFunction.__name__, terminal=True) else: self.daemonInstance.threadCounts[self.timerFunction.__name__] += 1 newThread = threading.Thread(target=self.timerFunction, args=self.args, daemon=True) diff --git a/onionr/communicatorutils/uploadblocks.py b/onionr/communicatorutils/uploadblocks.py index 27391195..6285263d 100755 --- a/onionr/communicatorutils/uploadblocks.py +++ b/onionr/communicatorutils/uploadblocks.py @@ -25,6 +25,8 @@ from communicator import onlinepeers def upload_blocks_from_communicator(comm_inst): # when inserting a block, we try to upload it to a few peers to add some deniability + TIMER_NAME = "upload_blocks_from_communicator" + triedPeers = [] finishedUploads = [] core = comm_inst._core @@ -32,8 +34,8 @@ def upload_blocks_from_communicator(comm_inst): if len(comm_inst.blocksToUpload) != 0: for bl in comm_inst.blocksToUpload: if not stringvalidators.validate_hash(bl): - logger.warn('Requested to upload invalid block') - comm_inst.decrementThreadCount('uploadBlock') + logger.warn('Requested to upload invalid block', terminal=True) + comm_inst.decrementThreadCount(TIMER_NAME) return for i in range(min(len(comm_inst.onlinePeers), 6)): peer = onlinepeers.pick_online_peer(comm_inst) @@ -52,4 +54,4 @@ def upload_blocks_from_communicator(comm_inst): comm_inst.blocksToUpload.remove(x) except ValueError: pass - comm_inst.decrementThreadCount('uploadBlock') \ No newline at end of file + comm_inst.decrementThreadCount(TIMER_NAME) \ No newline at end of file