From 0ce3aeb1897f1274507a420ec5c25e3311921927 Mon Sep 17 00:00:00 2001 From: David Schwartz Date: Wed, 16 Jul 2014 15:47:38 -0700 Subject: [PATCH] Stop finding paths when enough are found (RIPD-156) --- src/ripple/module/app/paths/Pathfinder.cpp | 2 ++ src/ripple/module/app/paths/Tuning.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ripple/module/app/paths/Pathfinder.cpp b/src/ripple/module/app/paths/Pathfinder.cpp index 785cc36bb..af4c16435 100644 --- a/src/ripple/module/app/paths/Pathfinder.cpp +++ b/src/ripple/module/app/paths/Pathfinder.cpp @@ -218,6 +218,8 @@ bool Pathfinder::findPaths ( if (costedPath.first <= iLevel) { getPaths(costedPath.second); + if (mCompletePaths.size () > PATHFINDER_MAX_COMPLETE_PATHS) + break; } } diff --git a/src/ripple/module/app/paths/Tuning.h b/src/ripple/module/app/paths/Tuning.h index 4c2d61ce4..cdf4e3e3e 100644 --- a/src/ripple/module/app/paths/Tuning.h +++ b/src/ripple/module/app/paths/Tuning.h @@ -25,7 +25,7 @@ namespace ripple { // VFALCO TODO Why 40? is the number 40 part of protocol? const int CALC_NODE_DELIVER_MAX_LOOPS = 40; const int NODE_ADVANCE_MAX_LOOPS = 100; - +const int PATHFINDER_MAX_COMPLETE_PATHS = 1000; } // ripple #endif