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:
parent
36369abcb4
commit
33d1fb913f
1 changed files with 3 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue