Merge branch 'sync-fixes' into 'master'

Sync fixes

See merge request poezio/slixmpp!37
This commit is contained in:
Maxime Buquet 2020-04-04 15:28:59 +02:00
commit 76f4fb49d6

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
@ -512,6 +516,7 @@ class XMLStream(asyncio.BaseProtocol):
self.event("killed")
self.disconnected.set_result(True)
self.disconnected = asyncio.Future()
self.event("disconnected", self.disconnect_reason)
def reconnect(self, wait=2.0, reason="Reconnecting"):
"""Calls disconnect(), and once we are disconnected (after the timeout, or