summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorMike Taylor <bear42@gmail.com>2015-04-11 19:20:39 -0400
committerMike Taylor <bear42@gmail.com>2015-04-11 19:20:39 -0400
commit1e77ea0944f1c7f446267c1c10280dab0059b22b (patch)
tree489748fa5f7d21c8cf26e12b7e1b618b10798a2e /sleekxmpp/xmlstream
parent140f0885b2403eb9e9770dc311add4c1cdb46c8d (diff)
parentd33cc00fe9e71329090e5ddffacf190c7c838416 (diff)
downloadslixmpp-1e77ea0944f1c7f446267c1c10280dab0059b22b.tar.gz
slixmpp-1e77ea0944f1c7f446267c1c10280dab0059b22b.tar.bz2
slixmpp-1e77ea0944f1c7f446267c1c10280dab0059b22b.tar.xz
slixmpp-1e77ea0944f1c7f446267c1c10280dab0059b22b.zip
Merge pull request #328 from FlySnake/develop
On initial connect use delay if connection failed
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 62249f78..16705c16 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -460,9 +460,11 @@ class XMLStream(object):
def _connect(self, reattempt=True):
self.scheduler.remove('Session timeout check')
- if self.reconnect_delay is None or not reattempt:
+ if self.reconnect_delay is None:
delay = 1.0
- else:
+ self.reconnect_delay = delay
+
+ if reattempt:
delay = min(self.reconnect_delay * 2, self.reconnect_max_delay)
delay = random.normalvariate(delay, delay * 0.1)
log.debug('Waiting %s seconds before connecting.', delay)