use one variable to track app shutdown state

This commit is contained in:
j 2016-01-31 22:15:14 +05:30
commit 567952d91d
7 changed files with 35 additions and 44 deletions

View file

@ -60,8 +60,12 @@ def log_request(handler):
handler._request_summary(), request_time)
def shutdown():
state.shutdown = True
if state.tor:
state.tor._shutdown = True
if state.nodes:
logger.debug('shutdown nodes')
state.nodes.join()
if state.downloads:
logger.debug('shutdown downloads')
state.downloads.join()
@ -70,9 +74,6 @@ def shutdown():
if state.tasks:
logger.debug('shutdown tasks')
state.tasks.join()
if state.nodes:
logger.debug('shutdown nodes')
state.nodes.join()
if state.node:
state.node.stop()
if state.tor: