diff options
author | Oleg Antonyan <oleg.b.antonyan@gmail.com> | 2014-11-23 16:46:01 +0200 |
---|---|---|
committer | Oleg Antonyan <oleg.b.antonyan@gmail.com> | 2014-11-23 16:46:01 +0200 |
commit | d33cc00fe9e71329090e5ddffacf190c7c838416 (patch) | |
tree | 8d2949616cf6bd0540199a5951532ee68a3205ed /sleekxmpp/xmlstream | |
parent | 27582f6fd29e365253e7f3bf2e318a5403da9b73 (diff) | |
download | slixmpp-d33cc00fe9e71329090e5ddffacf190c7c838416.tar.gz slixmpp-d33cc00fe9e71329090e5ddffacf190c7c838416.tar.bz2 slixmpp-d33cc00fe9e71329090e5ddffacf190c7c838416.tar.xz slixmpp-d33cc00fe9e71329090e5ddffacf190c7c838416.zip |
On initial connect use delay if connection failed
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index e011cf3d..bba86231 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) |