core: don't callback self.conn_deferred if already called:

if the connection has been lost (e.g. forced disconnection by server),
`self.conn_deferred` may have already been called, thus this is now checked to avoid an
exception.
This commit is contained in:
Goffi 2021-11-04 18:27:36 +01:00
commit 7c37f32dc4

View file

@ -302,7 +302,11 @@ class SatXMPPEntity:
self.streamInitialized()
def _finish_connection(self, __):
self.conn_deferred.callback(None)
if self.conn_deferred.called:
# can happen in case of forced disconnection by server
log.debug(f"{self} has already been connected")
else:
self.conn_deferred.callback(None)
def streamInitialized(self):
"""Called after _authd"""