1
0

ServerConnectWizard: use default server instead of ''

Passes the default server (Network.default_server) to
Network.set_parameters instead of an empty string in
ServerConnectWizard.do_configure_server to avoid a traceback like in
I am not entirely sure how the user in #10437 managed to trigger
the exception as Network.set_parameters should already exit early at
`not self._was_started` in the Wizard as the network shouldn't have been
started yet during the wizard. However passing the default ServerAddr
instead of an empty string to set_parameters should avoid this
exception.
This commit is contained in:
f321x
2026-01-26 13:28:09 +01:00
parent 5952d8c614
commit 10aecf66fd

View File

@@ -855,16 +855,18 @@ class ServerConnectWizard(AbstractWizard):
def do_configure_server(self, wizard_data: dict):
self._logger.debug(f'configuring server: {wizard_data!r}')
net_params = self._daemon.network.get_parameters()
server = ''
server = None
oneserver = wizard_data.get('one_server', False)
if not wizard_data['autoconnect']:
try:
server = ServerAddr.from_str_with_inference(wizard_data['server'])
server = ServerAddr.from_str_with_inference(wizard_data.get('server', ''))
if not server:
raise Exception('failed to parse server %s' % wizard_data['server'])
except Exception:
return
net_params = net_params._replace(server=server, auto_connect=wizard_data['autoconnect'], oneserver=oneserver)
self._logger.warn('failed to parse server %s' % wizard_data.get('server', ''))
return # Network._start() will set autoconnect and default server
net_params = net_params._replace(
server=server or net_params.server,
auto_connect=wizard_data['autoconnect'],
oneserver=oneserver,
)
self._daemon.network.run_from_another_thread(self._daemon.network.set_parameters(net_params))
def do_configure_autoconnect(self, wizard_data: dict):