in congestion_control/CongestionControlEnv.cpp [56:87]
uint64_t CongestionControlEnv::getUpdatedCwndBytes(uint64_t currentCwndBytes,
uint32_t actionIdx) const {
DCHECK_LT(actionIdx, cfg_.actions.size());
const auto &op = cfg_.actions[actionIdx].first;
const auto &val = cfg_.actions[actionIdx].second;
const auto &valBytes = val * conn_.udpSendPacketLen;
switch (op) {
case Config::ActionOp::NOOP:
break;
case Config::ActionOp::ADD:
currentCwndBytes += valBytes;
break;
case Config::ActionOp::SUB:
currentCwndBytes =
(currentCwndBytes >= valBytes) ? (currentCwndBytes - valBytes) : 0;
break;
case Config::ActionOp::MUL:
currentCwndBytes = std::round(currentCwndBytes * val);
break;
case Config::ActionOp::DIV:
currentCwndBytes = std::round(currentCwndBytes * 1.0 / val);
break;
default:
LOG(FATAL) << "Unknown ActionOp";
break;
}
return boundedCwnd(currentCwndBytes, conn_.udpSendPacketLen,
conn_.transportSettings.maxCwndInMss,
conn_.transportSettings.minCwndInMss);
}