commit ed401761f118fa8171b47ac68d330224f02953af
parent 5e6a55edd58940bd1d377a9bb26d42df48c60446
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 30 Jan 2016 11:24:53 +0100
sorry, confused
This reverts commit 5e6a55edd58940bd1d377a9bb26d42df48c60446.
Diffstat:
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/electrum b/electrum
@@ -328,7 +328,13 @@ if __name__ == '__main__':
if server is not None:
result = server.gui(config_options)
else:
- daemon = Daemon(config)
+ if not config.get('offline'):
+ network = Network(config)
+ network.start()
+ else:
+ network = None
+ daemon = Daemon(config, network)
+ daemon.start()
gui = init_gui(config, daemon, plugins)
daemon.gui = gui
gui.main()
@@ -345,12 +351,15 @@ if __name__ == '__main__':
elif subcommand == 'start':
p = os.fork()
if p == 0:
- daemon = Daemon(config)
+ network = Network(config)
+ network.start()
+ daemon = Daemon(config, network)
if config.get('websocket_server'):
from electrum import websockets
- websockets.WebSocketServer(config, daemon.network).start()
+ websockets.WebSocketServer(config, network).start()
if config.get('requests_dir'):
util.check_www_dir(config.get('requests_dir'))
+ daemon.start()
daemon.join()
sys.exit(0)
else:
diff --git a/lib/daemon.py b/lib/daemon.py
@@ -26,7 +26,7 @@ from wallet import WalletStorage, Wallet
from wizard import WizardBase
from commands import known_commands, Commands
from simple_config import SimpleConfig
-from network import Network
+
def lockfile(config):
return os.path.join(config.path, 'daemon')
@@ -62,16 +62,10 @@ class RequestHandler(SimpleJSONRPCRequestHandler):
class Daemon(DaemonThread):
- def __init__(self, config):
+ def __init__(self, config, network):
DaemonThread.__init__(self)
self.config = config
- if not config.get('offline'):
- self.network = Network(config)
- self.network.start()
- else:
- # FIXME: some of the daemon code assumes self.network is not None
- # This is not something this change has introduced
- self.network = None
+ self.network = network
self.gui = None
self.wallets = {}
self.wallet = None
@@ -88,7 +82,6 @@ class Daemon(DaemonThread):
self.server.register_function(self.ping, 'ping')
self.server.register_function(self.run_daemon, 'daemon')
self.server.register_function(self.run_gui, 'gui')
- self.start()
def ping(self):
return True