From f42ae3f01cf5ad11ab21d3610a0e5f50a2fe9f08 Mon Sep 17 00:00:00 2001 From: Federico <65908512+coval3nte@users.noreply.github.com> Date: Wed, 2 Mar 2022 12:42:49 +0100 Subject: [PATCH] fix rpcsock (#7691) some heuristics re default rpcsock type: if tcp-related other config keys are set, use tcp closes https://github.com/spesmilo/electrum/issues/7686 --- electrum/daemon.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/electrum/daemon.py b/electrum/daemon.py index b0087a5ac..6c26d6b7e 100644 --- a/electrum/daemon.py +++ b/electrum/daemon.py @@ -65,7 +65,9 @@ class DaemonNotRunning(Exception): def get_rpcsock_defaultpath(config: SimpleConfig): return os.path.join(config.path, 'daemon_rpc_socket') -def get_rpcsock_default_type(): +def get_rpcsock_default_type(config: SimpleConfig): + if config.get('rpchost') and config.get('rpcport'): + return 'tcp' # Use unix domain sockets when available, # with the extra paranoia that in case windows "implements" them, # we want to test it before making it the default there. @@ -251,7 +253,7 @@ class CommandsServer(AuthenticatedServer): self.fd = fd self.config = daemon.config sockettype = self.config.get('rpcsock', 'auto') - self.socktype = sockettype if sockettype != 'auto' else get_rpcsock_default_type() + self.socktype = sockettype if sockettype != 'auto' else get_rpcsock_default_type(self.config) self.sockpath = self.config.get('rpcsockpath', get_rpcsock_defaultpath(self.config)) self.host = self.config.get('rpchost', '127.0.0.1') self.port = self.config.get('rpcport', 0)