Merge branch 'master' into 'master'

reconnect: fix callback when not currently connected

See merge request poezio/slixmpp!32
This commit is contained in:
Maxime Buquet 2020-03-28 22:11:34 +01:00
commit e9a87a0b77

View file

@ -494,6 +494,8 @@ class XMLStream(asyncio.BaseProtocol):
self.send_raw(self.stream_footer)
self.schedule('Disconnect wait', wait,
self.abort, repeat=False)
else:
self.event("disconnected", reason)
def abort(self):
"""
@ -512,8 +514,8 @@ class XMLStream(asyncio.BaseProtocol):
when the server acknowledgement is received), call connect()
"""
log.debug("reconnecting...")
self.disconnect(wait, reason)
self.add_event_handler('disconnected', lambda event: self.connect(), disposable=True)
self.disconnect(wait, reason)
def configure_socket(self):
"""Set timeout and other options for self.socket.