diff --git a/llarp/exit/session.cpp b/llarp/exit/session.cpp index b98a4c89d..f5c0707ab 100644 --- a/llarp/exit/session.cpp +++ b/llarp/exit/session.cpp @@ -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); } diff --git a/llarp/path/pathset.cpp b/llarp/path/pathset.cpp index 203c0d7dd..36f98acda 100644 --- a/llarp/path/pathset.cpp +++ b/llarp/path/pathset.cpp @@ -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