ammend outbound context logic

pull/1105/head
Jeff Becker 5 years ago
parent 02228ded08
commit 6a495dd090
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -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

Loading…
Cancel
Save