summaryrefslogtreecommitdiff
path: root/slixmpp
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-02-04 18:32:41 +0100
committermathieui <mathieui@mathieui.net>2021-02-04 19:22:13 +0100
commitd3063a0368503daa27d0bb24ea74890952dec707 (patch)
tree2c836517e9c93ef092c633853db818be7296d8ae /slixmpp
parent782dbdea65bfcb09573b1e22f034771a027b4b88 (diff)
downloadslixmpp-d3063a0368503daa27d0bb24ea74890952dec707.tar.gz
slixmpp-d3063a0368503daa27d0bb24ea74890952dec707.tar.bz2
slixmpp-d3063a0368503daa27d0bb24ea74890952dec707.tar.xz
slixmpp-d3063a0368503daa27d0bb24ea74890952dec707.zip
xmlstream: make connect_loop_wait private
Diffstat (limited to 'slixmpp')
-rw-r--r--slixmpp/xmlstream/xmlstream.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py
index 48784a4b..83a197de 100644
--- a/slixmpp/xmlstream/xmlstream.py
+++ b/slixmpp/xmlstream/xmlstream.py
@@ -88,7 +88,9 @@ class XMLStream(asyncio.BaseProtocol):
# The socket that is used internally by the transport object
self.socket = None
- self.connect_loop_wait = 0
+ # The backoff of the connect routine (increases exponentially
+ # after each failure)
+ self._connect_loop_wait = 0
self.parser = None
self.xml_depth = 0
@@ -284,7 +286,7 @@ class XMLStream(asyncio.BaseProtocol):
self.disconnect_reason = None
self.cancel_connection_attempt()
- self.connect_loop_wait = 0
+ self._connect_loop_wait = 0
if host and port:
self.address = (host, int(port))
try:
@@ -309,9 +311,9 @@ 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)
+ 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:
@@ -337,7 +339,7 @@ class XMLStream(asyncio.BaseProtocol):
self.address[1],
ssl=ssl_context,
server_hostname=self.default_domain if self.use_ssl else None)
- self.connect_loop_wait = 0
+ self._connect_loop_wait = 0
except Socket.gaierror as e:
self.event('connection_failed',
'No DNS record available for %s' % self.default_domain)
@@ -346,7 +348,7 @@ class XMLStream(asyncio.BaseProtocol):
self.event("connection_failed", e)
if self._current_connection_attempt is None:
return
- self.connect_loop_wait = self.connect_loop_wait * 2 + 1
+ self._connect_loop_wait = self._connect_loop_wait * 2 + 1
self._current_connection_attempt = asyncio.ensure_future(
self._connect_routine(),
loop=self.loop,