This commit is contained in:
Ryan Tharp 2019-01-29 12:48:30 +00:00
commit 1a62382ce7
2 changed files with 17 additions and 11 deletions

View File

@ -434,11 +434,16 @@ llarp_nodedb::select_random_hop(const llarp::RouterContact &prev,
do
{
auto itr = entries.begin();
std::advance(itr, llarp::randint() % sz);
if(itr == entries.end())
{
--tries;
continue;
}
if(prev.pubkey == itr->second.pubkey)
{
if(tries--)
--tries;
continue;
return false;
}
if(itr->second.addrs.size() && !itr->second.IsExpired(now))
{

View File

@ -682,6 +682,7 @@ namespace llarp
if(rotateKeys)
{
encryption = nextOnionKey;
}
// propagate RC by renegotiating sessions
ForEachPeer([](llarp::ILinkSession *s) {
if(s->RenegotiateSession())
@ -689,7 +690,7 @@ namespace llarp
else
llarp::LogWarn("failed to renegotiate session");
});
}
// TODO: do this async
return SaveRC();
} // namespace llarp
@ -737,7 +738,7 @@ namespace llarp
if(_rc.ExpiresSoon(now, llarp::randint() % 10000))
{
llarp::LogInfo("regenerating RC");
if(!UpdateOurRC(IsServiceNode()))
if(!UpdateOurRC(false))
llarp::LogError("Failed to update our RC");
}