Don't reset exponential backoff delay until a stream has been confirmed.

This commit is contained in:
Lance Stout 2013-01-11 17:18:58 -08:00
parent 7b45245b1d
commit ce977a7809

View file

@ -560,7 +560,6 @@ class XMLStream(object):
self.set_socket(self.socket, ignore=True) self.set_socket(self.socket, ignore=True)
#this event is where you should set your application state #this event is where you should set your application state
self.event("connected", direct=True) self.event("connected", direct=True)
self.reconnect_delay = 1.0
return True return True
except (Socket.error, ssl.SSLError) as serr: except (Socket.error, ssl.SSLError) as serr:
error_msg = "Could not connect to %s:%s. Socket Error #%s: %s" error_msg = "Could not connect to %s:%s. Socket Error #%s: %s"
@ -1493,6 +1492,10 @@ class XMLStream(object):
# as handshakes. # as handshakes.
self.stream_end_event.clear() self.stream_end_event.clear()
self.start_stream_handler(root) self.start_stream_handler(root)
# We have a successful stream connection, so reset
# exponential backoff for new reconnect attempts.
self.reconnect_delay = 1.0
depth += 1 depth += 1
if event == b'end': if event == b'end':
depth -= 1 depth -= 1