diff --git a/node/Bond.cpp b/node/Bond.cpp index 62adcf5fd..05bd7a842 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -661,7 +661,7 @@ void Bond::processIncomingPathNegotiationRequest(uint64_t now, SharedPtr& if (remoteUtility > _localUtility) { _paths[pathIdx].p->address().toString(pathStr); log("peer suggests alternate link %s/%s, remote utility (%d) greater than local utility (%d), switching to suggested link\n", link->ifname().c_str(), pathStr, remoteUtility, _localUtility); - negotiatedPathIdx = pathIdx; + _negotiatedPathIdx = pathIdx; } if (remoteUtility < _localUtility) { log("peer suggests alternate link %s/%s, remote utility (%d) less than local utility (%d), not switching\n", link->ifname().c_str(), pathStr, remoteUtility, _localUtility); @@ -670,7 +670,7 @@ void Bond::processIncomingPathNegotiationRequest(uint64_t now, SharedPtr& log("peer suggests alternate link %s/%s, remote utility (%d) equal to local utility (%d)\n", link->ifname().c_str(), pathStr, remoteUtility, _localUtility); if (_peer->_id.address().toInt() > RR->node->identity().address().toInt()) { log("agree with peer to use alternate link %s/%s\n", link->ifname().c_str(), pathStr); - negotiatedPathIdx = pathIdx; + _negotiatedPathIdx = pathIdx; } else { log("ignore petition from peer to use alternate link %s/%s\n", link->ifname().c_str(), pathStr); @@ -730,7 +730,7 @@ void Bond::pathNegotiationCheck(void* tPtr, int64_t now) if (_localUtility == 0) { // There's no loss to us, just switch without sending a another request // fprintf(stderr, "BT: (sync) giving up, switching to remote peer's path.\n"); - negotiatedPathIdx = maxInPathIdx; + _negotiatedPathIdx = maxInPathIdx; } } } @@ -1478,13 +1478,15 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) // If using "optimize" primary re-select mode, ignore user link designations failoverScoreHandicap = ZT_BOND_FAILOVER_HANDICAP_PRIMARY; } - if (_paths[i].p.ptr() == _paths[negotiatedPathIdx].p.ptr()) { + /* + if (_paths[i].p.ptr() == _paths[_negotiatedPathIdx].p.ptr()) { _paths[i].negotiated = true; failoverScoreHandicap = ZT_BOND_FAILOVER_HANDICAP_NEGOTIATED; } else { _paths[i].negotiated = false; } + */ _paths[i].failoverScore = _paths[i].allocation + failoverScoreHandicap; if (_paths[i].p.ptr() != _paths[_abPathIdx].p.ptr()) { bool bFoundPathInQueue = false; @@ -1622,6 +1624,7 @@ void Bond::setBondParameters(int policy, SharedPtr templateBond, bool useT _pathNegotiationCutoffCount = 0; _lastPathNegotiationReceived = 0; _localUtility = 0; + _negotiatedPathIdx = 0; // QOS Verb (and related checks) diff --git a/node/Bond.hpp b/node/Bond.hpp index 90c80d974..f9f85beed 100644 --- a/node/Bond.hpp +++ b/node/Bond.hpp @@ -1428,7 +1428,7 @@ class Bond { // path negotiation int16_t _localUtility; - int negotiatedPathIdx; + int _negotiatedPathIdx; uint8_t _numSentPathNegotiationRequests; bool _allowPathNegotiation;