wait for local interface to show up
This commit is contained in:
parent
87be2e8aca
commit
9744653701
1 changed files with 9 additions and 4 deletions
|
@ -83,9 +83,14 @@ class LocalNodesBase(Thread):
|
|||
pass
|
||||
|
||||
def receive(self):
|
||||
last = time.mktime(time.localtime())
|
||||
s = self.get_socket()
|
||||
s.bind(('', self._PORT))
|
||||
last = time.time()
|
||||
s = None
|
||||
while not s and not state.shutdown:
|
||||
try:
|
||||
s = self.get_socket()
|
||||
s.bind(('', self._PORT))
|
||||
except OSError: # no local interface exists
|
||||
self.wait(60)
|
||||
while not state.shutdown:
|
||||
try:
|
||||
r, _, _ = select.select([s], [], [], 3)
|
||||
|
@ -105,7 +110,7 @@ class LocalNodesBase(Thread):
|
|||
self.wait(60)
|
||||
finally:
|
||||
if not state.shutdown:
|
||||
now = time.mktime(time.localtime())
|
||||
now = time.time()
|
||||
if now - last > 60:
|
||||
last = now
|
||||
_thread.start_new_thread(self.send, ())
|
||||
|
|
Loading…
Reference in a new issue