Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(s2n-quic-core): decrease minimum allowed RTT sample to 1 microsecond #1651

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions quic/s2n-quic-core/src/recovery/rtt_estimator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl RttEstimator {
is_handshake_confirmed: bool,
space: PacketNumberSpace,
) {
self.latest_rtt = rtt_sample.max(Duration::from_millis(1));
self.latest_rtt = rtt_sample.max(Duration::from_micros(1));

if self.first_rtt_sample.is_none() {
self.first_rtt_sample = Some(timestamp);
Expand Down Expand Up @@ -362,7 +362,7 @@ mod test {
);
}

/// Test a zero RTT value is treated as 1 ms
/// Test a zero RTT value is treated as 1 µs
#[test]
fn zero_rtt_sample() {
let mut rtt_estimator = RttEstimator::new(Duration::from_millis(10));
Expand All @@ -374,12 +374,12 @@ mod test {
false,
PacketNumberSpace::ApplicationData,
);
assert_eq!(rtt_estimator.min_rtt, Duration::from_millis(1));
assert_eq!(rtt_estimator.latest_rtt(), Duration::from_millis(1));
assert_eq!(rtt_estimator.min_rtt, Duration::from_micros(1));
assert_eq!(rtt_estimator.latest_rtt(), Duration::from_micros(1));
assert_eq!(rtt_estimator.first_rtt_sample(), Some(now));
assert_eq!(
rtt_estimator.pto_period(INITIAL_PTO_BACKOFF, PacketNumberSpace::Initial),
Duration::from_millis(3)
Duration::from_millis(1)
);
}

Expand Down