Moved all communicator ext vars to KV

This commit is contained in:
Kevin 2020-07-29 04:32:09 -05:00
parent f28d469e56
commit 5bde99967b
4 changed files with 7 additions and 7 deletions

View file

@ -63,7 +63,7 @@ def download_blocks_from_communicator(comm_inst: "OnionrCommunicatorDaemon"):
if not shoulddownload.should_download(comm_inst, blockHash):
continue
if kv.get('shutdown') or not comm_inst.isOnline or \
if kv.get('shutdown') or not kv.get('isOnline') or \
storage_counter.is_full():
# Exit loop if shutting down or offline, or disk allocation reached
break

View file

@ -56,7 +56,7 @@ def lookup_blocks_from_communicator(comm_inst):
listLookupCommand = 'getblocklist'
if len(kv.get('blockQueue')) >= maxBacklog:
break
if not comm_inst.isOnline:
if not kv.get('isOnline'):
break
# check if disk allocation is used
if storage_counter.is_full():

View file

@ -42,7 +42,7 @@ def net_check(comm_inst):
try:
if (epoch.get_epoch() - int(localcommand.local_command
('/lastconnect'))) <= 60:
comm_inst.isOnline = True
kv.put('isOnline', True)
rec = True
except ValueError:
pass
@ -55,7 +55,7 @@ def net_check(comm_inst):
terminal=True)
restarttor.restart(comm_inst)
kv.put('offlinePeers', [])
comm_inst.isOnline = False
kv.put('isOnline', False)
else:
comm_inst.isOnline = True
kv.put('isOnline', True)
comm_inst.decrementThreadCount('net_check')