diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-07-16 11:29:19 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-07-16 13:05:47 -0300 |
commit | 3d6629348aedf2a6863d242d96d64b3492e86f9a (patch) | |
tree | e0e25a94f62a635df1a7840b72fc3645358aefde /src/leap/bitmask | |
parent | 432fcab9f838b0bfc81ed8d40d92b4b5d3854f24 (diff) |
Increase timeout and retries.
With this change we avoid the communication issues on OSX.
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r-- | src/leap/bitmask/backend/signaler.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/leap/bitmask/backend/signaler.py b/src/leap/bitmask/backend/signaler.py index 7401f3a0..574bfa71 100644 --- a/src/leap/bitmask/backend/signaler.py +++ b/src/leap/bitmask/backend/signaler.py @@ -38,8 +38,8 @@ class Signaler(object): """ PORT = "5667" SERVER = "tcp://localhost:%s" % PORT - POLL_TIMEOUT = 1000 # ms - POLL_TRIES = 3 + POLL_TIMEOUT = 2000 # ms + POLL_TRIES = 500 def __init__(self): """ @@ -156,13 +156,18 @@ class Signaler(object): reply = None tries = 0 - while tries < self.POLL_TRIES: + while True: socks = dict(poll.poll(self.POLL_TIMEOUT)) if socks.get(self._socket) == zmq.POLLIN: reply = self._socket.recv() break tries += 1 + if tries < self.POLL_TRIES: + logger.warning('Retrying receive... {0}/{1}'.format( + tries, self.POLL_TRIES)) + else: + break if reply is None: msg = "Timeout error contacting backend." |