diff --git a/quiche/src/lib.rs b/quiche/src/lib.rs index 67740057a09..47d1c3233a5 100644 --- a/quiche/src/lib.rs +++ b/quiche/src/lib.rs @@ -3400,7 +3400,7 @@ impl Connection { crypto_open: open_prev, pn_on_update: pn, update_acked: false, - timer: now + (recv_path.recovery.pto() * 3), + timer: now + recv_path.recovery.pto_timeout(), }); self.key_phase = !self.key_phase; @@ -4936,8 +4936,8 @@ impl Connection { }; if push_frame_to_pkt!(b, frames, frame, left) { - let pto = path.recovery.pto(); - self.draining_timer = Some(now + (pto * 3)); + self.draining_timer = + Some(now + path.recovery.pto_timeout()); ack_eliciting = true; in_flight = true; @@ -4952,8 +4952,8 @@ impl Connection { }; if push_frame_to_pkt!(b, frames, frame, left) { - let pto = path.recovery.pto(); - self.draining_timer = Some(now + (pto * 3)); + self.draining_timer = + Some(now + path.recovery.pto_timeout()); ack_eliciting = true; in_flight = true; @@ -8684,7 +8684,7 @@ impl Connection { }); let path = self.paths.get_active()?; - self.draining_timer = Some(now + (path.recovery.pto() * 3)); + self.draining_timer = Some(now + path.recovery.pto_timeout()); }, frame::Frame::ApplicationClose { error_code, reason } => { @@ -8695,7 +8695,7 @@ impl Connection { }); let path = self.paths.get_active()?; - self.draining_timer = Some(now + (path.recovery.pto() * 3)); + self.draining_timer = Some(now + path.recovery.pto_timeout()); }, frame::Frame::HandshakeDone => { diff --git a/quiche/src/recovery/mod.rs b/quiche/src/recovery/mod.rs index 920f46cbe85..d6891a5f382 100644 --- a/quiche/src/recovery/mod.rs +++ b/quiche/src/recovery/mod.rs @@ -241,6 +241,12 @@ pub trait RecoveryOps { fn pto(&self) -> Duration; + /// Returns the PTO-based draining/closing timeout duration (3 * PTO), + /// as recommended in RFC 9000, Section 10.2. + fn pto_timeout(&self) -> Duration { + self.pto() * 3 + } + /// The most recent data delivery rate estimate. fn delivery_rate(&self) -> Bandwidth;