From f7360d31e2f58670368e8f6b2d671269529b6db6 Mon Sep 17 00:00:00 2001 From: Goffi Date: Fri, 6 Mar 2020 18:19:03 +0100 Subject: [PATCH] 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). --- sat/core/xmpp.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sat/core/xmpp.py b/sat/core/xmpp.py index 26ce0935..dc0d8c47 100644 --- a/sat/core/xmpp.py +++ b/sat/core/xmpp.py @@ -466,11 +466,18 @@ class SatXMPPEntity: yield disconnected_cb(self) def isConnected(self): + """Return True is client is fully connected + + client is considered fully connected if transport is started and all plugins + are initialised + """ try: - return bool(self.xmlstream.transport.connected) + transport_connected = bool(self.xmlstream.transport.connected) except AttributeError: return False + return self._connected_d is not None and transport_connected + def entityDisconnect(self): if not self.host_app.trigger.point("disconnecting", self): return