Skip to content

Commit

Permalink
Write to qlog after ack or loss is processed
Browse files Browse the repository at this point in the history
Summary: Bbr.cpp places the call to qlogger's addCongestionMetricUpdate in onPacketAcked in a SCOPE_EXIT macro, causing the qlog update to happen at the end of the method. Bbr2.cpp should do the same in onPacketAckOrLoss.

Reviewed By: jbeshay

Differential Revision: D69890778

fbshipit-source-id: 5492f7252605c680fd8e2d1a1c5a0278163ab0a5
  • Loading branch information
ritengupta authored and facebook-github-bot committed Feb 22, 2025
1 parent 7c36377 commit cd373ad
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions quic/congestion_control/Bbr2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,23 @@ void Bbr2CongestionController::onPacketSent(
void Bbr2CongestionController::onPacketAckOrLoss(
const AckEvent* FOLLY_NULLABLE ackEvent,
const LossEvent* FOLLY_NULLABLE lossEvent) {
if (conn_.qLogger) {
conn_.qLogger->addCongestionMetricUpdate(
conn_.lossState.inflightBytes,
getCongestionWindow(),
kCongestionPacketAck,
bbr2StateToString(state_));
conn_.qLogger->addNetworkPathModelUpdate(
inflightHi_.value_or(0),
inflightLo_.value_or(0),
0, // bandwidthHi_ no longer available.
std::chrono::microseconds(1), // bandwidthHi_ no longer available.
bandwidthLo_.has_value() ? bandwidthLo_->units : 0,
bandwidthLo_.has_value() ? bandwidthLo_->interval
: std::chrono::microseconds(1));
}
SCOPE_EXIT {
if (conn_.qLogger) {
conn_.qLogger->addCongestionMetricUpdate(
conn_.lossState.inflightBytes,
getCongestionWindow(),
kCongestionPacketAck,
bbr2StateToString(state_));
conn_.qLogger->addNetworkPathModelUpdate(
inflightHi_.value_or(0),
inflightLo_.value_or(0),
0, // bandwidthHi_ no longer available.
std::chrono::microseconds(1), // bandwidthHi_ no longer available.
bandwidthLo_.has_value() ? bandwidthLo_->units : 0,
bandwidthLo_.has_value() ? bandwidthLo_->interval
: std::chrono::microseconds(1));
}
};
if (ackEvent) {
subtractAndCheckUnderflow(
conn_.lossState.inflightBytes, ackEvent->ackedBytes);
Expand Down

0 comments on commit cd373ad

Please sign in to comment.