Commit ca81c6d3 authored by Julien Muchembled's avatar Julien Muchembled

registry: do not retry/wait forever if something goes wrong with babeld

babeld could be in bad state, or it could be incompatible (too old or too new).
parent 896bc9de
......@@ -175,7 +175,10 @@ SetCostMultiplier = Packet(2,
Struct("B", "set_cost_multiplier", "flags"))
class ConnectionClosed(Exception):
class BabelException(Exception): pass
class ConnectionClosed(BabelException):
def __str__(self):
return "connection to babeld closed (%s)" % self.args
......
......@@ -102,16 +102,18 @@ class RegistryServer(object):
def request_dump(self):
assert self.peers_lock.locked()
def abort():
raise ctl.BabelException
self._wait_dump = True
while True:
for _ in 0, 1:
self.ctl.request_dump()
try:
while self._wait_dump:
args = {}, {}, ()
args = {}, {}, ((time.time() + 5, abort),)
self.ctl.select(*args)
utils.select(*args)
break
except ctl.ConnectionClosed:
except ctl.BabelException:
self.ctl.reset()
def babel_dump(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment