* Pass on some flow, remembering it as invalid, for later subtraction from * locally consumed flow. This is necessary because we can't have negative * flows and we don't want to sort the flows before adding them up. * @param origin Origin of the flow. * @param via Next hop. * @param flow Amount of flow to be passed. */
| 5231 | * @param flow Amount of flow to be passed. |
| 5232 | */ |
| 5233 | void FlowStatMap::PassOnFlow(StationID origin, StationID via, uint flow) |
| 5234 | { |
| 5235 | FlowStatMap::iterator prev_it = this->find(origin); |
| 5236 | if (prev_it == this->end()) { |
| 5237 | FlowStat fs(via, flow); |
| 5238 | fs.AppendShare(StationID::Invalid(), flow); |
| 5239 | this->emplace(origin, fs); |
| 5240 | } else { |
| 5241 | prev_it->second.ChangeShare(via, flow); |
| 5242 | prev_it->second.ChangeShare(StationID::Invalid(), flow); |
| 5243 | assert(!prev_it->second.GetShares()->empty()); |
| 5244 | } |
| 5245 | } |
| 5246 | |
| 5247 | /** |
| 5248 | * Subtract invalid flows from locally consumed flow. |
no test coverage detected