From 9c24fc15a86c3ba9a5242237006f721ca924c84c Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 17 Jun 2019 08:43:16 -0400 Subject: [PATCH] try not spamming network with builds --- llarp/service/endpoint.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/llarp/service/endpoint.cpp b/llarp/service/endpoint.cpp index 8b7595922..1f6215caa 100644 --- a/llarp/service/endpoint.cpp +++ b/llarp/service/endpoint.cpp @@ -237,11 +237,6 @@ namespace llarp { RegenAndPublishIntroSet(now); } - else if(NumInStatus(path::ePathEstablished) < 3) - { - if(m_IntroSet.HasExpiredIntros(now)) - ManualRebuild(1); - } // expire snode sessions EndpointUtil::ExpireSNodeSessions(now, m_SNodeSessions); @@ -636,7 +631,7 @@ namespace llarp return false; // make sure we have all paths that are established // in our introset - bool should = false; + size_t numNotInIntroset =0; ForEachPath([&](const path::Path_ptr& p) { if(!p->IsReady()) return; @@ -645,9 +640,9 @@ namespace llarp if(i == p->intro) return; } - should = true; + ++numNotInIntroset; }); - if(m_IntroSet.HasExpiredIntros(now) || should) + if(m_IntroSet.HasExpiredIntros(now) || numNotInIntroset > 1) return now - m_LastPublishAttempt >= INTROSET_PUBLISH_RETRY_INTERVAL; return now - m_LastPublishAttempt >= INTROSET_PUBLISH_INTERVAL; }