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