comparison 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
comparison
equal deleted inserted replaced
3134:48eafdab1c34 3135:b9395c4df8b9
372 def disconnectProfile(self, reason): 372 def disconnectProfile(self, reason):
373 if self._connected_d is not None: 373 if self._connected_d is not None:
374 self.host_app.bridge.disconnected( 374 self.host_app.bridge.disconnected(
375 self.profile 375 self.profile
376 ) # we send the signal to the clients 376 ) # we send the signal to the clients
377 self._connected_d.callback(None)
378 self.host_app.purgeEntity(
379 self.profile
380 ) # and we remove references to this client
381 log.info( 377 log.info(
382 _("********** [{profile}] DISCONNECTED **********").format( 378 _("********** [{profile}] DISCONNECTED **********").format(
383 profile=self.profile 379 profile=self.profile
384 ) 380 )
385 ) 381 )
382 # we purge only if no new connection attempt is expected
383 if not self.factory.continueTrying:
384 log.debug("continueTrying not set, purging entity")
385 self._connected_d.callback(None)
386 # and we remove references to this client
387 self.host_app.purgeEntity(self.profile)
388
386 if not self.conn_deferred.called: 389 if not self.conn_deferred.called:
387 if reason is None: 390 if reason is None:
388 err = error.StreamError("Server unexpectedly closed the connection") 391 err = error.StreamError("Server unexpectedly closed the connection")
389 else: 392 else:
390 err = reason 393 err = reason