Browse Source

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
patch-4
Federico 3 years ago
committed by GitHub
parent
commit
f42ae3f01c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      electrum/daemon.py

6
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)

Loading…
Cancel
Save