From bf8c2f44f6d62383b19b14cc8593c84c3dfe0975 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Mon, 2 Apr 2018 08:54:44 +0200 Subject: [PATCH] Move test mode into state - test mode variable is now in state --- src/bitmessagemain.py | 13 ++++++------- src/state.py | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 453010ad..f380d6e2 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -221,12 +221,12 @@ class Main: elif opt in ("-c", "--curses"): state.curses = True elif opt in ("-t", "test"): - daemon = 10 + state.testmode = True # is the application already running? If yes then exit. shared.thisapp = singleinstance("", daemon) - if daemon == 1: + if daemon: with shared.printLock: print('Running as a daemon. Send TERM signal to end.') self.daemonize() @@ -343,11 +343,10 @@ class Main: else: BMConfigParser().remove_option('bitmessagesettings', 'dontconnect') - if daemon: - sleep(daemon) - if daemon > 1: - # make testing - self.stop() + if state.testmode: + sleep(10) + self.stop() + if daemon or state.testmode: while state.shutdown == 0: sleep(1) diff --git a/src/state.py b/src/state.py index 73e4f789..3e2b6487 100644 --- a/src/state.py +++ b/src/state.py @@ -55,3 +55,5 @@ def resetNetworkProtocolAvailability(): resetNetworkProtocolAvailability() dandelion = 0 + +testmode = False