Mercurial > libervia-backend
comparison sat/core/xmpp.py @ 3203:fee8e33e2b3f
core (xmpp): isConnected now returns True when full connection is done:
isConnected was returning True as soon as transport was connected. It is now returning
True only if full connection is done (i.e. transport is connected + all plugins have been
initialised).
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 06 Mar 2020 18:19:03 +0100 |
parents | f4a28767ec35 |
children | b1c90eedbc12 |
comparison
equal
deleted
inserted
replaced
3202:2e892f9f54f6 | 3203:fee8e33e2b3f |
---|---|
464 disconnected_cb = getattr(plugin, trigger_name, None) | 464 disconnected_cb = getattr(plugin, trigger_name, None) |
465 if disconnected_cb is not None: | 465 if disconnected_cb is not None: |
466 yield disconnected_cb(self) | 466 yield disconnected_cb(self) |
467 | 467 |
468 def isConnected(self): | 468 def isConnected(self): |
469 """Return True is client is fully connected | |
470 | |
471 client is considered fully connected if transport is started and all plugins | |
472 are initialised | |
473 """ | |
469 try: | 474 try: |
470 return bool(self.xmlstream.transport.connected) | 475 transport_connected = bool(self.xmlstream.transport.connected) |
471 except AttributeError: | 476 except AttributeError: |
472 return False | 477 return False |
478 | |
479 return self._connected_d is not None and transport_connected | |
473 | 480 |
474 def entityDisconnect(self): | 481 def entityDisconnect(self): |
475 if not self.host_app.trigger.point("disconnecting", self): | 482 if not self.host_app.trigger.point("disconnecting", self): |
476 return | 483 return |
477 log.info(_("Disconnecting...")) | 484 log.info(_("Disconnecting...")) |