xmlstream: Make the reconnect handler a coroutine
This commit is contained in:
parent
b2dfb4c1f3
commit
f15311bda8
@ -585,7 +585,11 @@ class XMLStream(asyncio.BaseProtocol):
|
|||||||
when the server acknowledgement is received), call connect()
|
when the server acknowledgement is received), call connect()
|
||||||
"""
|
"""
|
||||||
log.debug("reconnecting...")
|
log.debug("reconnecting...")
|
||||||
self.add_event_handler('disconnected', lambda event: self.connect(), disposable=True)
|
async def handler(event):
|
||||||
|
# We yield here to allow synchronous handlers to work first
|
||||||
|
await asyncio.sleep(0, loop=self.loop)
|
||||||
|
self.connect()
|
||||||
|
self.add_event_handler('disconnected', handler, disposable=True)
|
||||||
self.disconnect(wait, reason)
|
self.disconnect(wait, reason)
|
||||||
|
|
||||||
def configure_socket(self):
|
def configure_socket(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user