Browse Source
network: fix switching interface (restart old one)
follow-up b3ff173b45
connection_down was killing the already restarted old interface
3.3.3.1
SomberNight
6 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
6 additions and
6 deletions
-
electrum/interface.py
-
electrum/network.py
|
|
@ -253,7 +253,7 @@ class Interface(PrintError): |
|
|
|
except GracefulDisconnect as e: |
|
|
|
self.print_error("disconnecting gracefully. {}".format(e)) |
|
|
|
finally: |
|
|
|
await self.network.connection_down(self.server) |
|
|
|
await self.network.connection_down(self) |
|
|
|
self.got_disconnected.set_result(1) |
|
|
|
return wrapper_func |
|
|
|
|
|
|
|
|
|
@ -638,16 +638,16 @@ class Network(PrintError): |
|
|
|
self.recent_servers = self.recent_servers[0:20] |
|
|
|
self._save_recent_servers() |
|
|
|
|
|
|
|
async def connection_down(self, server): |
|
|
|
async def connection_down(self, interface: Interface): |
|
|
|
'''A connection to server either went down, or was never made. |
|
|
|
We distinguish by whether it is in self.interfaces.''' |
|
|
|
if not interface: return |
|
|
|
server = interface.server |
|
|
|
self.disconnected_servers.add(server) |
|
|
|
if server == self.default_server: |
|
|
|
self._set_status('disconnected') |
|
|
|
interface = self.interfaces.get(server, None) |
|
|
|
if interface: |
|
|
|
await self._close_interface(interface) |
|
|
|
self.trigger_callback('network_updated') |
|
|
|
await self._close_interface(interface) |
|
|
|
self.trigger_callback('network_updated') |
|
|
|
|
|
|
|
@ignore_exceptions # do not kill main_taskgroup |
|
|
|
@log_exceptions |
|
|
|