Browse Source

fix connect retry bug; add reconnect event

pull/34/head v0.8.1
Rossen Georgiev 9 years ago
parent
commit
a96c7f0737
  1. 5
      steam/core/cm.py

5
steam/core/cm.py

@ -71,7 +71,7 @@ class CMClient(EventEmitter):
self._LOG.debug("Emit event: %s" % repr(event))
super(CMClient, self).emit(event, *args)
def connect(self, retry=None, delay=0):
def connect(self, retry=0, delay=0):
"""Initiate connection to CM. Blocks until connected unless ``retry`` is specified.
:param retry: number of retries before returning. Unlimited when set to ``None``
@ -91,12 +91,13 @@ class CMClient(EventEmitter):
if delay:
self._LOG.debug("Delayed connect: %d seconds" % delay)
self.emit('reconnect', delay)
gevent.sleep(delay)
self._LOG.debug("Connect initiated.")
for i, server_addr in enumerate(self.servers):
if retry is not None and i > retry:
if retry and i > retry:
return False
start = time()

Loading…
Cancel
Save