浏览代码

Fix bad index bug (during switching) in balance-rr

Joseph Henry 4 年之前
父节点
当前提交
e607348c7e
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      node/Bond.cpp

+ 2 - 2
node/Bond.cpp

@@ -314,7 +314,7 @@ SharedPtr<Path> 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<Bond> templateBond, bool useT
 	// rr
 
 	_rrPacketsSentOnCurrLink = 0;
-	_rrIdx = ZT_MAX_PEER_NETWORK_PATHS;
+	_rrIdx = 0;
 
 	// General parameters