network: fix not retrying main interface in some cases
This was a regression from e83f0dd3fc,
introduced by the change in connection_down() there.
(if the initial connection to the main interface is not successful, the
network status will not be set to 'disconnected' - but it should be)
That change is now reverted here.
That change was somewhat independent of the rest of that commit,
except the rest highlighted that something of the sort was needed:
as it might sometimes take many seconds for an interface to close
and we might launch another interface for the same server while the
first one is still closing, the "server == self.default_server" test
is highly problematic.
To fix this second - original - issue, we now introduce a "closing" state
for interfaces (in the form of network._closing_ifaces).
This commit is contained in:
@@ -485,8 +485,8 @@ class Interface(Logger):
|
||||
self.logger.warning(f"disconnecting due to {repr(e)}")
|
||||
self.logger.debug(f"(disconnect) trace for {repr(e)}", exc_info=True)
|
||||
finally:
|
||||
await self.network.connection_down(self)
|
||||
self.got_disconnected.set()
|
||||
await self.network.connection_down(self)
|
||||
# if was not 'ready' yet, schedule waiting coroutines:
|
||||
self.ready.cancel()
|
||||
return wrapper_func
|
||||
|
||||
Reference in New Issue
Block a user