From 745b268160660dc5af71e85c2fa1717d6ef622a8 Mon Sep 17 00:00:00 2001 From: Cameron Bytheway Date: Fri, 16 Feb 2024 11:35:25 -0700 Subject: [PATCH 1/2] feat(s2n-quic-core): allow forced PTO transmissions --- quic/s2n-quic-core/src/recovery/pto.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/quic/s2n-quic-core/src/recovery/pto.rs b/quic/s2n-quic-core/src/recovery/pto.rs index b7fb425e48..bfff48b4c0 100644 --- a/quic/s2n-quic-core/src/recovery/pto.rs +++ b/quic/s2n-quic-core/src/recovery/pto.rs @@ -71,6 +71,17 @@ impl Pto { pub fn transmissions(&self) -> u8 { self.state.transmissions() } + + #[inline] + pub fn transmit_once(&mut self) { + self.state.on_transmit(); + } + + #[inline] + pub fn force_transmit(&mut self) { + ensure!(matches!(self.state, State::Idle)); + self.state = State::RequiresTransmission(1); + } } impl timer::Provider for Pto { From 73eac57153f4e1187bd1b5d6f53631162f9a7fdf Mon Sep 17 00:00:00 2001 From: Wesley Rosenblum Date: Thu, 18 Apr 2024 13:01:50 -0700 Subject: [PATCH 2/2] rename to on_transmit_once and use in on_transmit --- quic/s2n-quic-core/src/recovery/pto.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quic/s2n-quic-core/src/recovery/pto.rs b/quic/s2n-quic-core/src/recovery/pto.rs index bfff48b4c0..942b0e520b 100644 --- a/quic/s2n-quic-core/src/recovery/pto.rs +++ b/quic/s2n-quic-core/src/recovery/pto.rs @@ -73,7 +73,7 @@ impl Pto { } #[inline] - pub fn transmit_once(&mut self) { + pub fn on_transmit_once(&mut self) { self.state.on_transmit(); } @@ -131,7 +131,7 @@ impl transmission::Provider for Pto { // The early transmission will automatically ensure all initial packets sent by the // client are padded to 1200 bytes - self.state.on_transmit(); + self.on_transmit_once(); } }