Skip to content

Commit

Permalink
recovery: ensure lost PMTUD probe bytes are removed from in-flight count
Browse files Browse the repository at this point in the history
This ensure that when a PMTUD probe is lost we decrease the
`bytes_in_flight` counter appropriately.
  • Loading branch information
ghedo committed Apr 11, 2024
1 parent d1c44fc commit 77eccc1
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions quiche/src/recovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,15 @@ impl Recovery {
self.lost[epoch].extend(unacked.frames.drain(..));
unacked.time_lost = Some(now);

if unacked.in_flight && !unacked.pmtud {
if unacked.pmtud {
self.bytes_in_flight =
self.bytes_in_flight.saturating_sub(unacked.size);

// Do not track PMTUD probes losses.
continue;
}

if unacked.in_flight {
lost_bytes += unacked.size;

// Frames have already been removed from the packet, so
Expand All @@ -976,11 +984,8 @@ impl Recovery {
);
}

if !unacked.pmtud {
// Do not add PMTUD probes to loss statistics
lost_packets += 1;
self.lost_count += 1;
}
lost_packets += 1;
self.lost_count += 1;
} else {
let loss_time = match self.loss_time[epoch] {
None => unacked.time_sent + loss_delay,
Expand Down Expand Up @@ -2438,7 +2443,7 @@ mod tests {
assert_eq!(r.loss_probes[packet::Epoch::Application], 0);

assert_eq!(r.sent[packet::Epoch::Application].len(), 2);
assert_eq!(r.bytes_in_flight, 1000);
assert_eq!(r.bytes_in_flight, 0);
assert_eq!(r.congestion_window, 12000);

assert_eq!(r.lost_count, 0);
Expand All @@ -2449,6 +2454,8 @@ mod tests {
r.detect_lost_packets(packet::Epoch::Application, now, "");

assert_eq!(r.sent[packet::Epoch::Application].len(), 0);
assert_eq!(r.bytes_in_flight, 0);
assert_eq!(r.lost_count, 0);
}
}

Expand Down

0 comments on commit 77eccc1

Please sign in to comment.