Commit ed2846b4 authored by Julien Muchembled's avatar Julien Muchembled

Fix possible bootstrap issue

When 2 nodes were started for the first time whereas:
- one of them is in client-only mode, connected to the other one
- the registry node is temporarily down
then the normal node never tried to rebootstrap or connect directly to the
only node it knows (the registry node).
Such case required to restart the daemon when the registry is back.

Moreover, there was no reason to query the registry node immediately after
having open new tunnels to peers found in cache, when this number is less than
expected.
parent 6b35d638
......@@ -262,21 +262,23 @@ class TunnelManager(object):
elif count:
# No route/tunnel to registry, which usually happens when starting
# up. Select peers from cache for which we have no route.
new = 0
for peer, address in self._peer_db.getPeerList():
if peer not in disconnected and self._makeTunnel(peer, address):
count -= 1
if not count:
break
else:
if not (disconnected or self._served or self._connection_dict):
new += 1
if new == count:
return
if not (new or disconnected):
if not (self._served or self._connection_dict):
# Startup without any good address in the cache.
peer = self._peer_db.getBootstrapPeer()
if not (peer and self._makeTunnel(*peer)):
# Failed to bootstrap ! Last change to connect is to
# retry an address that already failed :(
for peer in self._peer_db.getPeerList(1):
if self._makeTunnel(*peer):
break
if peer and self._makeTunnel(*peer):
return
# Failed to bootstrap ! Last change to connect is to
# retry an address that already failed :(
for peer in self._peer_db.getPeerList(1):
if self._makeTunnel(*peer):
break
def _countRoutes(self):
logging.debug('Starting to count the routes on each interface...')
......
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