1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

more clairvoient path building

This commit is contained in:
Jeff Becker 2019-04-22 15:54:43 -04:00
parent 36369abcb4
commit 33d1fb913f
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05

View file

@ -49,14 +49,12 @@ namespace llarp
bool
BaseSession::ShouldBuildMore(llarp_time_t now) const
{
if(!path::Builder::ShouldBuildMore(now))
return false;
const size_t expect = (1 + (m_NumPaths / 2));
// check 30 seconds into the future and see if we need more paths
const llarp_time_t future = now + (30 * 1000);
if(NumPathsExistingAt(future) < expect)
return llarp::randint() % 4
== 0; // 25% chance for build if we will run out soon
// maintain regular number of paths
return path::Builder::ShouldBuildMore(now);
return NumPathsExistingAt(future) < expect;
}
bool