Skip to content

Commit

Permalink
fix: Correctly manage bytes_in_flight during a rebinding event
Browse files Browse the repository at this point in the history
Fixes #1289
  • Loading branch information
larseggert committed Apr 10, 2024
1 parent c44e536 commit 7b5de65
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions neqo-transport/src/cc/classic_cc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ impl<T: WindowAdjustment> CongestionControl for ClassicCongestionControl<T> {
if pkt.pn < self.first_app_limited {
is_app_limited = false;
}
assert!(self.bytes_in_flight >= pkt.size);
self.bytes_in_flight -= pkt.size;
// BIF is set to 0 on a path change, but in case that was because of a simple rebinding
// event, we may still get ACKs for packets sent before the rebinding.
self.bytes_in_flight = self.bytes_in_flight.saturating_sub(pkt.size);

if !self.after_recovery_start(pkt) {
// Do not increase congestion window for packets sent before
Expand Down Expand Up @@ -271,8 +272,9 @@ impl<T: WindowAdjustment> CongestionControl for ClassicCongestionControl<T> {
pkt.pn,
pkt.size
);
assert!(self.bytes_in_flight >= pkt.size);
self.bytes_in_flight -= pkt.size;
// BIF is set to 0 on a path change, but in case that was because of a simple rebinding
// event, we may still get ACKs for packets sent before the rebinding.
self.bytes_in_flight = self.bytes_in_flight.saturating_sub(pkt.size);
}
qlog::metrics_updated(
&mut self.qlog,
Expand Down

0 comments on commit 7b5de65

Please sign in to comment.