From 887d25646e2f1af5fe14247460129c169b56ef88 Mon Sep 17 00:00:00 2001 From: Manuel Bucher Date: Wed, 1 Nov 2023 14:43:50 +0100 Subject: [PATCH] Use packet number instead of time sent to identify packets sent after recovery event This doesn't change behavior, simplifies after_recovery_start check by removing the ambiguousness when the recovery packet was sent at the same time as some other packet. --- neqo-transport/src/cc/classic_cc.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/neqo-transport/src/cc/classic_cc.rs b/neqo-transport/src/cc/classic_cc.rs index 55859a841f..39b98e49a5 100644 --- a/neqo-transport/src/cc/classic_cc.rs +++ b/neqo-transport/src/cc/classic_cc.rs @@ -14,6 +14,7 @@ use std::time::{Duration, Instant}; use super::CongestionControl; use crate::cc::MAX_DATAGRAM_SIZE; +use crate::packet::PacketNumber; use crate::qlog::{self, QlogMetric}; use crate::sender::PACING_BURST_SIZE; use crate::tracking::SentPacket; @@ -109,7 +110,7 @@ pub struct ClassicCongestionControl { bytes_in_flight: usize, acked_bytes: usize, ssthresh: usize, - recovery_start: Option, + recovery_start: Option, qlog: NeqoQlog, } @@ -315,7 +316,7 @@ impl CongestionControl for ClassicCongestionControl { fn on_packet_sent(&mut self, pkt: &SentPacket) { // Record the recovery time and exit any transient state. if self.state.transient() { - self.recovery_start = Some(pkt.time_sent); + self.recovery_start = Some(pkt.pn); self.state.update(); } @@ -464,7 +465,7 @@ impl ClassicCongestionControl { // state and update the variable `self.recovery_start`. Before the // first recovery, all packets were sent after the recovery event, // allowing to reduce the cwnd on congestion events. - !self.state.transient() && self.recovery_start.map_or(true, |t| packet.time_sent >= t) + !self.state.transient() && self.recovery_start.map_or(true, |pn| packet.pn >= pn) } /// Handle a congestion event.