Moved communicator shutdown over to KV model for more decoupling

This commit is contained in:
Kevin 2020-07-25 21:36:48 -05:00
parent 0460d3380f
commit 0e4e7bb050
8 changed files with 30 additions and 22 deletions

View file

@ -31,6 +31,7 @@ def get_online_peers(comm_inst: 'OnionrCommunicatorDaemon'):
Connect to more peers if we have none connected
"""
config = comm_inst.config
kv: "DeadSimpleKV" = comm_inst.shared_state.get_by_string("DeadSimpleKV")
if config.get('general.offline_mode', False):
comm_inst.decrementThreadCount('get_online_peers')
return
@ -49,7 +50,7 @@ def get_online_peers(comm_inst: 'OnionrCommunicatorDaemon'):
else:
comm_inst.connectNewPeer()
if comm_inst.shutdown:
if kv.get('shutdown'):
break
else:
if len(comm_inst.onlinePeers) == 0: