"better" (more vigorus) path building

pull/576/head
Jeff Becker 5 years ago
parent d5162c2aad
commit 36369abcb4
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -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);
}

@ -15,9 +15,12 @@ namespace llarp
bool
PathSet::ShouldBuildMore(llarp_time_t now) const
{
(void)now;
Lock_t l(&m_PathsMutex);
return m_Paths.size() < m_NumPaths;
(void) now;
const auto building = NumInStatus(ePathBuilding);
if(building > m_NumPaths)
return false;
const auto established = NumInStatus(ePathEstablished);
return established <= m_NumPaths;
}
bool

Loading…
Cancel
Save