Mercurial > libervia-backend
diff sat/core/xmpp.py @ 3135:b9395c4df8b9
core (xmpp): don't purge entity on disconnect if continueTrying is set
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 28 Jan 2020 22:42:10 +0100 |
parents | c3ce8c997fdf |
children | 9d0df638c8b4 |
line wrap: on
line diff
--- a/sat/core/xmpp.py Tue Jan 28 22:27:42 2020 +0100 +++ b/sat/core/xmpp.py Tue Jan 28 22:42:10 2020 +0100 @@ -374,15 +374,18 @@ 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")