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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user