tdaemon: call self.start in __init__, and allow not to listen on jsonrpc - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 7dd4032cce0100bc7e23c7b7fec84a7980fee274 DIR parent 4653a1007cb8451c28461a326730900b285f38ad HTML Author: SomberNight <somber.night@protonmail.com> Date: Mon, 1 Oct 2018 17:56:51 +0200 daemon: call self.start in __init__, and allow not to listen on jsonrpc Diffstat: M electrum/daemon.py | 9 ++++++--- M run_electrum | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) --- DIR diff --git a/electrum/daemon.py b/electrum/daemon.py t@@ -121,10 +121,10 @@ def get_rpc_credentials(config): class Daemon(DaemonThread): - def __init__(self, config, fd=None): + def __init__(self, config, fd=None, *, listen_jsonrpc=True): DaemonThread.__init__(self) self.config = config - if fd is None: + if fd is None and listen_jsonrpc: fd, server = get_fd_or_server(config) if fd is None: raise Exception('failed to lock daemon; already running?') if config.get('offline'): t@@ -137,7 +137,10 @@ class Daemon(DaemonThread): self.gui = None self.wallets = {} # type: Dict[str, Abstract_Wallet] # Setup JSONRPC server - self.init_server(config, fd) + self.server = None + if listen_jsonrpc: + self.init_server(config, fd) + self.start() def init_server(self, config, fd): host = config.get('rpchost', '127.0.0.1') DIR diff --git a/run_electrum b/run_electrum t@@ -416,7 +416,6 @@ if __name__ == '__main__': if fd is not None: plugins = init_plugins(config, config.get('gui', 'qt')) d = daemon.Daemon(config, fd) - d.start() d.init_gui(config, plugins) sys.exit(0) else: t@@ -437,7 +436,6 @@ if __name__ == '__main__': sys.exit(0) init_plugins(config, 'cmdline') d = daemon.Daemon(config, fd) - d.start() if config.get('websocket_server'): from electrum import websockets websockets.WebSocketServer(config, d.network).start()