mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
"better" (more vigorus) path building
This commit is contained in:
parent
d5162c2aad
commit
36369abcb4
2 changed files with 6 additions and 7 deletions
|
@ -55,10 +55,6 @@ namespace llarp
|
|||
if(NumPathsExistingAt(future) < expect)
|
||||
return llarp::randint() % 4
|
||||
== 0; // 25% chance for build if we will run out soon
|
||||
// if we don't have the expended number of paths right now try building
|
||||
// some if the cooldown timer isn't hit
|
||||
if(AvailablePaths(llarp::path::ePathRoleExit) < expect)
|
||||
return !path::Builder::BuildCooldownHit(now);
|
||||
// maintain regular number of paths
|
||||
return path::Builder::ShouldBuildMore(now);
|
||||
}
|
||||
|
|
|
@ -16,8 +16,11 @@ namespace llarp
|
|||
PathSet::ShouldBuildMore(llarp_time_t now) const
|
||||
{
|
||||
(void) now;
|
||||
Lock_t l(&m_PathsMutex);
|
||||
return m_Paths.size() < m_NumPaths;
|
||||
const auto building = NumInStatus(ePathBuilding);
|
||||
if(building > m_NumPaths)
|
||||
return false;
|
||||
const auto established = NumInStatus(ePathEstablished);
|
||||
return established <= m_NumPaths;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
Loading…
Reference in a new issue