summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Buquet <pep@bouah.net>2020-03-29 14:26:15 +0200
committerMaxime Buquet <pep@bouah.net>2020-03-29 14:26:15 +0200
commit842aa3be8ff80e93f0183c511d172b8d76da1ce7 (patch)
treeae3f081cc0b6f619fb5cc4019a0461ef5bc8bf7d
parentefe316dc8cb2e75d27492e701cc615e4095f95ad (diff)
parent621255027d5c0a5046d95cef8e80e448ef2ca991 (diff)
downloadslixmpp-842aa3be8ff80e93f0183c511d172b8d76da1ce7.tar.gz
slixmpp-842aa3be8ff80e93f0183c511d172b8d76da1ce7.tar.bz2
slixmpp-842aa3be8ff80e93f0183c511d172b8d76da1ce7.tar.xz
slixmpp-842aa3be8ff80e93f0183c511d172b8d76da1ce7.zip
Merge branch 'fix-reconnect-2.0' into 'master'
Reset reconnect delay on manual reconnect, add delay event See merge request poezio/slixmpp!35
-rw-r--r--slixmpp/xmlstream/xmlstream.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py
index c3c82a37..cbb7950a 100644
--- a/slixmpp/xmlstream/xmlstream.py
+++ b/slixmpp/xmlstream/xmlstream.py
@@ -277,6 +277,7 @@ class XMLStream(asyncio.BaseProtocol):
)
self.disconnect_reason = None
self.cancel_connection_attempt()
+ self.connect_loop_wait = 0
if host and port:
self.address = (host, int(port))
try:
@@ -301,6 +302,10 @@ class XMLStream(asyncio.BaseProtocol):
async def _connect_routine(self):
self.event_when_connected = "connected"
+ if self.connect_loop_wait > 0:
+ self.event('reconnect_delay', self.connect_loop_wait)
+ await asyncio.sleep(self.connect_loop_wait, loop=self.loop)
+
record = await self.pick_dns_answer(self.default_domain)
if record is not None:
host, address, dns_port = record
@@ -317,7 +322,6 @@ class XMLStream(asyncio.BaseProtocol):
else:
ssl_context = None
- await asyncio.sleep(self.connect_loop_wait, loop=self.loop)
if self._current_connection_attempt is None:
return
try: