prevent crash

pull/598/head
Jeff Becker 5 years ago
parent 12589c4a3a
commit 61d42811be
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -277,7 +277,7 @@ namespace llarp
r->TryConnectAsync(results[0], 5);
});
}
else if(!BuildCooldownHit(now))
else if(ShouldBuildMore(now))
BuildOneAlignedTo(m_ExitRouter);
}
return true;

@ -47,7 +47,7 @@ namespace llarp
/// return true if we are established
virtual bool
IsEstablished() = 0;
IsEstablished() const = 0;
/// return true if this session has timed out
virtual bool

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

@ -120,9 +120,9 @@ namespace llarp
SendKeepAlive() override;
bool
IsEstablished() override
IsEstablished() const override
{
return state == eSessionReady || state == eLinkEstablished;
return state == eSessionReady;
}
bool

Loading…
Cancel
Save