fix hop selection and disable onion key rotation

pull/258/head
Jeff Becker 5 years ago
parent 1e0d82848f
commit fd507e4194
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -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--)
continue;
return false;
--tries;
continue;
}
if(itr->second.addrs.size() && !itr->second.IsExpired(now))
{

@ -682,14 +682,15 @@ namespace llarp
if(rotateKeys)
{
encryption = nextOnionKey;
// propagate RC by renegotiating sessions
ForEachPeer([](llarp::ILinkSession *s) {
if(s->RenegotiateSession())
llarp::LogInfo("renegotiated session");
else
llarp::LogWarn("failed to renegotiate session");
});
}
// propagate RC by renegotiating sessions
ForEachPeer([](llarp::ILinkSession *s) {
if(s->RenegotiateSession())
llarp::LogInfo("renegotiated session");
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");
}
@ -1662,7 +1663,8 @@ namespace llarp
{
self->transport_keyfile = val;
}
if((StrEq(key, "identity-privkey") || StrEq(key, "ident-privkey")) && !self->usingSNSeed)
if((StrEq(key, "identity-privkey") || StrEq(key, "ident-privkey"))
&& !self->usingSNSeed)
{
self->ident_keyfile = val;
}

Loading…
Cancel
Save