Skip to content

Commit 6bd3d23

Browse files
Merge commit 'c1b181d17bd71a2846078893b9f91892fbfa8cbb' into multipath-quinn-0.11.x-b2b930a-merges
2 parents 95d0260 + c1b181d commit 6bd3d23

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

quinn-proto/src/connection/paths.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ impl PathData {
316316
if self.first_packet.is_none() {
317317
self.first_packet = Some(pn);
318318
}
319-
self.in_flight.bytes -= space.sent(pn, packet);
319+
if let Some(forgotten) = space.sent(pn, packet) {
320+
self.remove_in_flight(&forgotten);
321+
}
320322
}
321323

322324
/// Remove `packet` with number `pn` from this path's congestion control counters, or return

quinn-proto/src/connection/spaces.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ impl PacketNumberSpace {
431431
Some(packet)
432432
}
433433

434-
/// Returns the number of bytes to *remove* from the connection's in-flight count
435-
pub(super) fn sent(&mut self, number: u64, packet: SentPacket) -> u64 {
434+
/// May return a packet that should be forgotten
435+
pub(super) fn sent(&mut self, number: u64, packet: SentPacket) -> Option<SentPacket> {
436436
// Retain state for at most this many non-ACK-eliciting packets sent after the most recently
437437
// sent ACK-eliciting packet. We're never guaranteed to receive an ACK for those, and we
438438
// can't judge them as lost without an ACK, so to limit memory in applications which receive
@@ -441,7 +441,7 @@ impl PacketNumberSpace {
441441
// due to weird peer behavior.
442442
const MAX_UNACKED_NON_ACK_ELICTING_TAIL: u64 = 1_000;
443443

444-
let mut forgotten_bytes = 0;
444+
let mut forgotten = None;
445445
if packet.ack_eliciting {
446446
self.unacked_non_ack_eliciting_tail = 0;
447447
self.largest_ack_eliciting_sent = number;
@@ -463,14 +463,14 @@ impl PacketNumberSpace {
463463
.sent_packets
464464
.remove(&oldest_after_ack_eliciting)
465465
.unwrap();
466-
forgotten_bytes = u64::from(packet.size);
467466
debug_assert!(!packet.ack_eliciting);
467+
forgotten = Some(packet);
468468
} else {
469469
self.unacked_non_ack_eliciting_tail += 1;
470470
}
471471

472472
self.sent_packets.insert(number, packet);
473-
forgotten_bytes
473+
forgotten
474474
}
475475

476476
/// Whether any congestion-controlled packets in this space are not yet acknowledged or lost

0 commit comments

Comments
 (0)