Fix unresponsiveness when moving flows in balance-aware (See #1764)

This commit is contained in:
Joseph Henry 2022-11-02 08:46:11 -07:00
parent bcf27d78e5
commit b02a41751c
No known key found for this signature in database
GPG Key ID: C45B33FF5EBC9344

View File

@ -1374,14 +1374,13 @@ void Bond::processBalanceTasks(int64_t now)
Mutex::Lock _l(_flows_m); Mutex::Lock _l(_flows_m);
std::map<int16_t, SharedPtr<Flow> >::iterator flow_it = _flows.begin(); std::map<int16_t, SharedPtr<Flow> >::iterator flow_it = _flows.begin();
while (flow_it != _flows.end()) { while (flow_it != _flows.end()) {
if (! _paths[flow_it->second->assignedPath].p) { if (_paths[flow_it->second->assignedPath].p) {
continue; int originalPathIdx = flow_it->second->assignedPath;
} if (! _paths[originalPathIdx].eligible) {
int originalPathIdx = flow_it->second->assignedPath; log("moving all flows from dead link %s", pathToStr(_paths[originalPathIdx].p).c_str());
if (! _paths[originalPathIdx].eligible) { if (assignFlowToBondedPath(flow_it->second, now, true)) {
log("moving all flows from dead link %s", pathToStr(_paths[originalPathIdx].p).c_str()); _paths[originalPathIdx].assignedFlowCount--;
if (assignFlowToBondedPath(flow_it->second, now, true)) { }
_paths[originalPathIdx].assignedFlowCount--;
} }
} }
++flow_it; ++flow_it;
@ -1394,14 +1393,13 @@ void Bond::processBalanceTasks(int64_t now)
Mutex::Lock _l(_flows_m); Mutex::Lock _l(_flows_m);
std::map<int16_t, SharedPtr<Flow> >::iterator flow_it = _flows.begin(); std::map<int16_t, SharedPtr<Flow> >::iterator flow_it = _flows.begin();
while (flow_it != _flows.end()) { while (flow_it != _flows.end()) {
if (! _paths[flow_it->second->assignedPath].p) { if (_paths[flow_it->second->assignedPath].p) {
continue; int originalPathIdx = flow_it->second->assignedPath;
} if (_paths[originalPathIdx].shouldAvoid) {
int originalPathIdx = flow_it->second->assignedPath; if (assignFlowToBondedPath(flow_it->second, now, true)) {
if (_paths[originalPathIdx].shouldAvoid) { _paths[originalPathIdx].assignedFlowCount--;
if (assignFlowToBondedPath(flow_it->second, now, true)) { return; // Only move one flow at a time
_paths[originalPathIdx].assignedFlowCount--; }
return; // Only move one flow at a time
} }
} }
++flow_it; ++flow_it;