|
|
@ -358,18 +358,18 @@ namespace llarp
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
OutboundContext::ShouldBuildMore(llarp_time_t now) const
|
|
|
|
OutboundContext::ShouldBuildMore(llarp_time_t now) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(markedBad)
|
|
|
|
if(markedBad || path::Builder::BuildCooldownHit(now))
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
const bool should = path::Builder::BuildCooldownHit(now)
|
|
|
|
const bool canBuild = NumInStatus(path::ePathBuilding) == 0
|
|
|
|
and NumInStatus(path::ePathBuilding) < numPaths;
|
|
|
|
and path::Builder::ShouldBuildMore(now);
|
|
|
|
llarp_time_t t = 0;
|
|
|
|
llarp_time_t t = 0;
|
|
|
|
ForEachPath([&t](path::Path_ptr path) {
|
|
|
|
ForEachPath([&t](path::Path_ptr path) {
|
|
|
|
if(path->IsReady())
|
|
|
|
if(path->IsReady())
|
|
|
|
t = std::max(path->ExpireTime(), t);
|
|
|
|
t = std::max(path->ExpireTime(), t);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if(t <= now)
|
|
|
|
if(t <= now)
|
|
|
|
return should;
|
|
|
|
return canBuild;
|
|
|
|
return should && t - now >= path::default_lifetime / 4;
|
|
|
|
return canBuild && t - now >= path::default_lifetime / 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|