From 56fea3c4dbfdb05406a6dbb114e191d4c23e1fa8 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 10 Dec 2018 10:31:58 -0500 Subject: [PATCH] limiting on path building --- llarp/exit/session.cpp | 7 ++++--- llarp/path.cpp | 6 +----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/llarp/exit/session.cpp b/llarp/exit/session.cpp index c5ffcce5c..2f0e6cf87 100644 --- a/llarp/exit/session.cpp +++ b/llarp/exit/session.cpp @@ -25,9 +25,9 @@ namespace llarp { const size_t expect = (1 + (m_NumPaths / 2)); if(NumPathsExistingAt(now + (10 * 1000)) < expect) - return true; + return path::Builder::ShouldBuildMore(now); if(AvailablePaths(llarp::path::ePathRoleExit) < expect) - return true; + return path::Builder::ShouldBuildMore(now); return false; } @@ -45,6 +45,7 @@ namespace llarp void BaseSession::HandlePathBuilt(llarp::path::Path* p) { + path::Builder::HandlePathBuilt(p); p->SetDropHandler(std::bind(&BaseSession::HandleTrafficDrop, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); @@ -155,4 +156,4 @@ namespace llarp } } // namespace exit -} // namespace llarp \ No newline at end of file +} // namespace llarp diff --git a/llarp/path.cpp b/llarp/path.cpp index ed4306484..23432cdf2 100644 --- a/llarp/path.cpp +++ b/llarp/path.cpp @@ -264,11 +264,7 @@ namespace llarp { if(builder->ShouldBuildMore(now)) { - builder->BuildOne(ePathRoleAny); - } - if(builder->ShouldBuildMoreForRoles(now, ePathRoleExit)) - { - builder->BuildOne(ePathRoleExit); + builder->BuildOne(); } } }