From af041cfee48d12fa1dc6a39c25247a1e231bfd71 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 1 Apr 2022 00:10:02 -0400 Subject: [PATCH 1/2] try not to spam builds --- llarp/service/outbound_context.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llarp/service/outbound_context.cpp b/llarp/service/outbound_context.cpp index e2ac2cb6e..2f296207f 100644 --- a/llarp/service/outbound_context.cpp +++ b/llarp/service/outbound_context.cpp @@ -479,7 +479,8 @@ namespace llarp { if (markedBad or path::Builder::BuildCooldownHit(now)) return false; - if (NumInStatus(path::ePathBuilding) >= numDesiredPaths) + + if (NumInStatus(path::ePathBuilding) >= std::max(numDesiredPaths / size_t{2}, size_t{1})) return false; size_t numValidPaths = 0; From ffadcb2e93696d4529207a7b59704398d8aa5d8e Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 1 Apr 2022 10:16:43 -0400 Subject: [PATCH 2/2] clean up paths that are ignored and inactive --- llarp/path/path.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/llarp/path/path.cpp b/llarp/path/path.cpp index d0b5ea72f..e031b845b 100644 --- a/llarp/path/path.cpp +++ b/llarp/path/path.cpp @@ -472,6 +472,11 @@ namespace llarp EnterState(ePathTimeout, now); } } + if (_status == ePathIgnore and now - m_LastRecvMessage >= path::alive_timeout) + { + // clean up this path as we dont use it anymore + EnterState(ePathExpired, now); + } } void