From ab9040c30ecfadfcd30acf9980946aa74c097fe4 Mon Sep 17 00:00:00 2001 From: Georg Lukas Date: Sat, 4 Apr 2020 13:12:59 +0200 Subject: expose is_connecting state based on connection attempt future --- slixmpp/xmlstream/xmlstream.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index cbb7950a..594acbdd 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -380,6 +380,7 @@ class XMLStream(asyncio.BaseProtocol): "ssl_object", default=self.transport.get_extra_info("socket") ) + self._current_connection_attempt = None self.init_parser() self.send_raw(self.stream_header) self.dns_answers = None @@ -438,6 +439,9 @@ class XMLStream(asyncio.BaseProtocol): self.send(error) self.disconnect() + def is_connecting(self): + return self._current_connection_attempt is not None + def is_connected(self): return self.transport is not None -- cgit v1.2.3