Skip to content

Commit cd373ad

Browse files
ritenguptafacebook-github-bot
authored andcommitted
Write to qlog after ack or loss is processed
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
1 parent 7c36377 commit cd373ad

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

quic/congestion_control/Bbr2.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,23 @@ void Bbr2CongestionController::onPacketSent(
102102
void Bbr2CongestionController::onPacketAckOrLoss(
103103
const AckEvent* FOLLY_NULLABLE ackEvent,
104104
const LossEvent* FOLLY_NULLABLE lossEvent) {
105-
if (conn_.qLogger) {
106-
conn_.qLogger->addCongestionMetricUpdate(
107-
conn_.lossState.inflightBytes,
108-
getCongestionWindow(),
109-
kCongestionPacketAck,
110-
bbr2StateToString(state_));
111-
conn_.qLogger->addNetworkPathModelUpdate(
112-
inflightHi_.value_or(0),
113-
inflightLo_.value_or(0),
114-
0, // bandwidthHi_ no longer available.
115-
std::chrono::microseconds(1), // bandwidthHi_ no longer available.
116-
bandwidthLo_.has_value() ? bandwidthLo_->units : 0,
117-
bandwidthLo_.has_value() ? bandwidthLo_->interval
118-
: std::chrono::microseconds(1));
119-
}
105+
SCOPE_EXIT {
106+
if (conn_.qLogger) {
107+
conn_.qLogger->addCongestionMetricUpdate(
108+
conn_.lossState.inflightBytes,
109+
getCongestionWindow(),
110+
kCongestionPacketAck,
111+
bbr2StateToString(state_));
112+
conn_.qLogger->addNetworkPathModelUpdate(
113+
inflightHi_.value_or(0),
114+
inflightLo_.value_or(0),
115+
0, // bandwidthHi_ no longer available.
116+
std::chrono::microseconds(1), // bandwidthHi_ no longer available.
117+
bandwidthLo_.has_value() ? bandwidthLo_->units : 0,
118+
bandwidthLo_.has_value() ? bandwidthLo_->interval
119+
: std::chrono::microseconds(1));
120+
}
121+
};
120122
if (ackEvent) {
121123
subtractAndCheckUnderflow(
122124
conn_.lossState.inflightBytes, ackEvent->ackedBytes);

0 commit comments

Comments
 (0)