@@ -431,8 +431,8 @@ impl PacketNumberSpace {
431
431
Some ( packet)
432
432
}
433
433
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 > {
436
436
// Retain state for at most this many non-ACK-eliciting packets sent after the most recently
437
437
// sent ACK-eliciting packet. We're never guaranteed to receive an ACK for those, and we
438
438
// can't judge them as lost without an ACK, so to limit memory in applications which receive
@@ -441,7 +441,7 @@ impl PacketNumberSpace {
441
441
// due to weird peer behavior.
442
442
const MAX_UNACKED_NON_ACK_ELICTING_TAIL : u64 = 1_000 ;
443
443
444
- let mut forgotten_bytes = 0 ;
444
+ let mut forgotten = None ;
445
445
if packet. ack_eliciting {
446
446
self . unacked_non_ack_eliciting_tail = 0 ;
447
447
self . largest_ack_eliciting_sent = number;
@@ -463,14 +463,14 @@ impl PacketNumberSpace {
463
463
. sent_packets
464
464
. remove ( & oldest_after_ack_eliciting)
465
465
. unwrap ( ) ;
466
- forgotten_bytes = u64:: from ( packet. size ) ;
467
466
debug_assert ! ( !packet. ack_eliciting) ;
467
+ forgotten = Some ( packet) ;
468
468
} else {
469
469
self . unacked_non_ack_eliciting_tail += 1 ;
470
470
}
471
471
472
472
self . sent_packets . insert ( number, packet) ;
473
- forgotten_bytes
473
+ forgotten
474
474
}
475
475
476
476
/// Whether any congestion-controlled packets in this space are not yet acknowledged or lost
0 commit comments