From 5e122b95e7cb594464ee2090ad0ab1a403f09367 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Sat, 30 May 2020 21:21:22 -0700 Subject: [PATCH] Fix segfault during balance-rr when link is brought down --- node/Bond.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/node/Bond.cpp b/node/Bond.cpp index 9aef8f815..28b998049 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -135,13 +135,14 @@ SharedPtr Bond::getAppropriatePath(int64_t now, int32_t flowId) int _tempIdx = _rrIdx; for (int searchCount = 0; searchCount < (_numBondedPaths-1); searchCount++) { _tempIdx = (_tempIdx == (_numBondedPaths-1)) ? 0 : _tempIdx+1; - if (_paths[_bondedIdx[_tempIdx]] && _paths[_bondedIdx[_tempIdx]]->eligible(now,_ackSendInterval)) { - _rrIdx = _tempIdx; - break; + if (_bondedIdx[_tempIdx] != ZT_MAX_PEER_NETWORK_PATHS) { + if (_paths[_bondedIdx[_tempIdx]] && _paths[_bondedIdx[_tempIdx]]->eligible(now,_ackSendInterval)) { + _rrIdx = _tempIdx; + break; + } } } } - fprintf(stderr, "_rrIdx=%d\n", _rrIdx); if (_paths[_bondedIdx[_rrIdx]]) { return _paths[_bondedIdx[_rrIdx]]; }