From b0dd28a346b56752610c8921f4b5d82178b91512 Mon Sep 17 00:00:00 2001 From: Goffi Date: Tue, 28 Jan 2020 22:42:10 +0100 Subject: [PATCH] core (xmpp): don't purge entity on disconnect if continueTrying is set --- sat/core/xmpp.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sat/core/xmpp.py b/sat/core/xmpp.py index be2dd4b3..08b92c88 100644 --- a/sat/core/xmpp.py +++ b/sat/core/xmpp.py @@ -374,15 +374,18 @@ class SatXMPPEntity(object): self.host_app.bridge.disconnected( self.profile ) # we send the signal to the clients - self._connected_d.callback(None) - self.host_app.purgeEntity( - self.profile - ) # and we remove references to this client log.info( _("********** [{profile}] DISCONNECTED **********").format( profile=self.profile ) ) + # we purge only if no new connection attempt is expected + if not self.factory.continueTrying: + log.debug("continueTrying not set, purging entity") + self._connected_d.callback(None) + # and we remove references to this client + self.host_app.purgeEntity(self.profile) + if not self.conn_deferred.called: if reason is None: err = error.StreamError("Server unexpectedly closed the connection")