|
|
@ -221,12 +221,15 @@ namespace llarp
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool got = false;
|
|
|
|
bool got = false;
|
|
|
|
router->ForEachPeer(
|
|
|
|
router->ForEachPeer(
|
|
|
|
[&](const ILinkSession* s, bool) {
|
|
|
|
[&](const ILinkSession* s, bool isOutbound) {
|
|
|
|
const PubKey k(s->GetPubKey());
|
|
|
|
if(s && s->IsEstablished() && isOutbound && !got)
|
|
|
|
if(got || router->IsBootstrapNode(k))
|
|
|
|
{
|
|
|
|
|
|
|
|
const RouterContact rc = s->GetRemoteRC();
|
|
|
|
|
|
|
|
if(got || router->IsBootstrapNode(rc.pubkey))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
cur = s->GetRemoteRC();
|
|
|
|
cur = rc;
|
|
|
|
got = true;
|
|
|
|
got = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
true);
|
|
|
|
true);
|
|
|
|
return got;
|
|
|
|
return got;
|
|
|
@ -328,7 +331,8 @@ namespace llarp
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(hops.size() == 0)
|
|
|
|
if(hops.size() == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogInfo(Name(), " building path to ", remote);
|
|
|
|
hops.resize(numHops);
|
|
|
|
|
|
|
|
|
|
|
|
auto nodedb = router->nodedb();
|
|
|
|
auto nodedb = router->nodedb();
|
|
|
|
for(size_t hop = 0; hop < numHops; ++hop)
|
|
|
|
for(size_t hop = 0; hop < numHops; ++hop)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -362,6 +366,7 @@ namespace llarp
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LogInfo(Name(), " building path to ", remote);
|
|
|
|
Build(hops);
|
|
|
|
Build(hops);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|