Commit 283f6f54 authored by Jim Fulton's avatar Jim Fulton

If bind fails, presumably because address already in use, retry

traviiiiiiiiis
parent f66e1f6c
...@@ -70,7 +70,18 @@ class Dispatcher(asyncore.dispatcher): ...@@ -70,7 +70,18 @@ class Dispatcher(asyncore.dispatcher):
self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM) self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.set_reuse_addr() self.set_reuse_addr()
log("listening on %s" % str(self.addr), logging.INFO) log("listening on %s" % str(self.addr), logging.INFO)
for i in range(25):
try:
self.bind(self.addr) self.bind(self.addr)
except Exception as exc:
log("bind failed %s waiting", i)
if i == 24:
raise
else:
time.sleep(5)
else:
self.listen(5) self.listen(5)
def writable(self): def writable(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