expose is_connecting state based on connection attempt future

This commit is contained in:
Georg Lukas 2020-04-04 13:12:59 +02:00
parent a16e2a0f6c
commit ab9040c30e

View file

@ -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