From e607348c7eeeec803580a65cb122d308c03210a9 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 7 Sep 2021 21:41:54 -0700 Subject: [PATCH] Fix bad index bug (during switching) in balance-rr --- node/Bond.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node/Bond.cpp b/node/Bond.cpp index 77dd007a8..cf4b4eabd 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -314,7 +314,7 @@ SharedPtr Bond::getAppropriatePath(int64_t now, int32_t flowId) } // Reset striping counter _rrPacketsSentOnCurrLink = 0; - if (_numBondedPaths == 1) { + if (_numBondedPaths == 1 || _rrIdx >= (ZT_MAX_PEER_NETWORK_PATHS-1)) { _rrIdx = 0; } else { @@ -1654,7 +1654,7 @@ void Bond::setBondParameters(int policy, SharedPtr templateBond, bool useT // rr _rrPacketsSentOnCurrLink = 0; - _rrIdx = ZT_MAX_PEER_NETWORK_PATHS; + _rrIdx = 0; // General parameters