From a0c3f432c4d1bbf192ba5027bf336bd8af23151e Mon Sep 17 00:00:00 2001 From: William Yates Date: Fri, 24 Jan 2025 17:52:17 -0700 Subject: [PATCH 1/2] Sort active backup paths --- node/Bond.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/node/Bond.cpp b/node/Bond.cpp index 2a061796d..817df1691 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -1750,19 +1750,12 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) } } } - /* // Sort queue based on performance - if (! _abFailoverQueue.empty()) { - for (int i = 0; i < _abFailoverQueue.size(); i++) { - int value_to_insert = _abFailoverQueue[i]; - int hole_position = i; - while (hole_position > 0 && (_abFailoverQueue[hole_position - 1] > value_to_insert)) { - _abFailoverQueue[hole_position] = _abFailoverQueue[hole_position - 1]; - hole_position = hole_position - 1; - } - _abFailoverQueue[hole_position] = value_to_insert; - } - }*/ + std::sort(_abFailoverQueue.begin(), _abFailoverQueue.end(), + [this](const int a, const int b) { + // Sort by failover score in descending order (highest score first) + return _paths[a].failoverScore > _paths[b].failoverScore; + }); /** * Short-circuit if we have no queued paths From c4af2d79c59641aabcdd0a9edb2cf60cb89a0b22 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Thu, 3 Jul 2025 09:44:45 -0700 Subject: [PATCH 2/2] Don't count bridges towards multicast limit. Send to all bridges --- node/Multicaster.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/node/Multicaster.cpp b/node/Multicaster.cpp index ccade7083..2438e4f30 100644 --- a/node/Multicaster.cpp +++ b/node/Multicaster.cpp @@ -247,9 +247,6 @@ void Multicaster::send(void* tPtr, int64_t now, const SharedPtr& networ for (unsigned int i = 0; i < activeBridgeCount; ++i) { if ((activeBridges[i] != RR->identity.address()) && (activeBridges[i] != origin)) { out.sendOnly(RR, tPtr, activeBridges[i]); // optimization: don't use dedup log if it's a one-pass send - if (++count >= limit) { - break; - } } }