mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-17 15:25:35 +00:00
Merge branch 'staging' of https://github.com/majestrate/loki-network
This commit is contained in:
commit
1a62382ce7
@ -434,11 +434,16 @@ llarp_nodedb::select_random_hop(const llarp::RouterContact &prev,
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
auto itr = entries.begin();
|
auto itr = entries.begin();
|
||||||
|
std::advance(itr, llarp::randint() % sz);
|
||||||
|
if(itr == entries.end())
|
||||||
|
{
|
||||||
|
--tries;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(prev.pubkey == itr->second.pubkey)
|
if(prev.pubkey == itr->second.pubkey)
|
||||||
{
|
{
|
||||||
if(tries--)
|
--tries;
|
||||||
continue;
|
continue;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if(itr->second.addrs.size() && !itr->second.IsExpired(now))
|
if(itr->second.addrs.size() && !itr->second.IsExpired(now))
|
||||||
{
|
{
|
||||||
|
@ -682,6 +682,7 @@ namespace llarp
|
|||||||
if(rotateKeys)
|
if(rotateKeys)
|
||||||
{
|
{
|
||||||
encryption = nextOnionKey;
|
encryption = nextOnionKey;
|
||||||
|
}
|
||||||
// propagate RC by renegotiating sessions
|
// propagate RC by renegotiating sessions
|
||||||
ForEachPeer([](llarp::ILinkSession *s) {
|
ForEachPeer([](llarp::ILinkSession *s) {
|
||||||
if(s->RenegotiateSession())
|
if(s->RenegotiateSession())
|
||||||
@ -689,7 +690,7 @@ namespace llarp
|
|||||||
else
|
else
|
||||||
llarp::LogWarn("failed to renegotiate session");
|
llarp::LogWarn("failed to renegotiate session");
|
||||||
});
|
});
|
||||||
}
|
|
||||||
// TODO: do this async
|
// TODO: do this async
|
||||||
return SaveRC();
|
return SaveRC();
|
||||||
} // namespace llarp
|
} // namespace llarp
|
||||||
@ -737,7 +738,7 @@ namespace llarp
|
|||||||
if(_rc.ExpiresSoon(now, llarp::randint() % 10000))
|
if(_rc.ExpiresSoon(now, llarp::randint() % 10000))
|
||||||
{
|
{
|
||||||
llarp::LogInfo("regenerating RC");
|
llarp::LogInfo("regenerating RC");
|
||||||
if(!UpdateOurRC(IsServiceNode()))
|
if(!UpdateOurRC(false))
|
||||||
llarp::LogError("Failed to update our RC");
|
llarp::LogError("Failed to update our RC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user