From b7f9c65fa86be784597615e8077fd933258bf1f2 Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Sun, 24 Sep 2023 13:46:29 -0700 Subject: [PATCH 1/4] Fix ACK frequency extension corner case Reflects the logic change in https://github.com/quicwg/ack-frequency/pull/222. See also discussion in https://github.com/quicwg/ack-frequency/issues/183. --- quinn-proto/src/connection/spaces.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/quinn-proto/src/connection/spaces.rs b/quinn-proto/src/connection/spaces.rs index 00b58807d..d98b97fbe 100644 --- a/quinn-proto/src/connection/spaces.rs +++ b/quinn-proto/src/connection/spaces.rs @@ -631,12 +631,19 @@ impl PendingAcks { || dedup.missing_in_interval(prev_largest_ack_eliciting, packet_number) } _ => { - // From acknowledgement frequency draft, section 6.1 + // From acknowledgement frequency draft, section 6.1: send an ACK immediately if + // doing so would cause the sender to detect a new packet loss if let Some((largest_acked, largest_unacked)) = self.largest_acked.zip(self.largest_ack_eliciting_packet) { + if self.reordering_threshold > largest_acked { + return false; + } + // The largest packet number that could be declared lost without a new ACK being + // sent + let largest_reported = largest_acked - self.reordering_threshold + 1; dedup - .smallest_missing_in_interval(largest_acked, largest_unacked) + .smallest_missing_in_interval(largest_reported, largest_unacked) .map_or(false, |smallest_missing| { largest_unacked - smallest_missing >= self.reordering_threshold }) From ab5bd330135906ef9267eb006ce5c3aeadd108df Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Sun, 24 Sep 2023 14:11:50 -0700 Subject: [PATCH 2/4] Bump MSRV to 1.65 for let-else --- .github/workflows/rust.yml | 2 +- README.md | 2 +- bench/Cargo.toml | 2 +- perf/Cargo.toml | 2 +- quinn-proto/Cargo.toml | 2 +- quinn-udp/Cargo.toml | 2 +- quinn/Cargo.toml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index fdbfbaae7..b878744d8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -58,7 +58,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.63.0 + - uses: dtolnay/rust-toolchain@1.65.0 - uses: Swatinem/rust-cache@v2 - run: cargo check --lib --all-features -p quinn-udp -p quinn-proto -p quinn diff --git a/README.md b/README.md index c00d93bc1..ac80fb223 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Quinn is a pure-rust, async-compatible implementation of the IETF [QUIC][quic] t [rustls][rustls] and [*ring*][ring] - Application-layer datagrams for small, unreliable messages - Future-based async API -- Minimum supported Rust version of 1.63.0 +- Minimum supported Rust version of 1.65.0 ## Overview diff --git a/bench/Cargo.toml b/bench/Cargo.toml index 81b3430f7..7a950a5c3 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -2,7 +2,7 @@ name = "bench" version = "0.1.0" edition = "2021" -rust-version = "1.63" +rust-version = "1.65" license = "MIT OR Apache-2.0" publish = false diff --git a/perf/Cargo.toml b/perf/Cargo.toml index 4f4f68df6..55e203acb 100644 --- a/perf/Cargo.toml +++ b/perf/Cargo.toml @@ -2,7 +2,7 @@ name = "perf" version = "0.1.0" edition = "2021" -rust-version = "1.63" +rust-version = "1.65" license = "MIT OR Apache-2.0" publish = false diff --git a/quinn-proto/Cargo.toml b/quinn-proto/Cargo.toml index 3ef0376c7..04baa3a4d 100644 --- a/quinn-proto/Cargo.toml +++ b/quinn-proto/Cargo.toml @@ -2,7 +2,7 @@ name = "quinn-proto" version = "0.11.0" edition = "2021" -rust-version = "1.63" +rust-version = "1.65" license = "MIT OR Apache-2.0" repository = "https://github.com/quinn-rs/quinn" description = "State machine for the QUIC transport protocol" diff --git a/quinn-udp/Cargo.toml b/quinn-udp/Cargo.toml index 4258d9e1a..e80e1f29f 100644 --- a/quinn-udp/Cargo.toml +++ b/quinn-udp/Cargo.toml @@ -2,7 +2,7 @@ name = "quinn-udp" version = "0.5.0" edition = "2021" -rust-version = "1.63" +rust-version = "1.65" license = "MIT OR Apache-2.0" repository = "https://github.com/quinn-rs/quinn" description = "UDP sockets with ECN information for the QUIC transport protocol" diff --git a/quinn/Cargo.toml b/quinn/Cargo.toml index 784e5e292..02117bd72 100644 --- a/quinn/Cargo.toml +++ b/quinn/Cargo.toml @@ -9,7 +9,7 @@ keywords = ["quic"] categories = [ "network-programming", "asynchronous" ] workspace = ".." edition = "2021" -rust-version = "1.63" +rust-version = "1.65" [package.metadata.docs.rs] all-features = true From e2dd8b7beaef55d12cd92e11dfc63064fe6a6c0c Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Sun, 24 Sep 2023 13:52:48 -0700 Subject: [PATCH 3/4] Reduce rightward drift --- quinn-proto/src/connection/spaces.rs | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/quinn-proto/src/connection/spaces.rs b/quinn-proto/src/connection/spaces.rs index d98b97fbe..6120ce465 100644 --- a/quinn-proto/src/connection/spaces.rs +++ b/quinn-proto/src/connection/spaces.rs @@ -633,23 +633,23 @@ impl PendingAcks { _ => { // From acknowledgement frequency draft, section 6.1: send an ACK immediately if // doing so would cause the sender to detect a new packet loss - if let Some((largest_acked, largest_unacked)) = + let Some((largest_acked, largest_unacked)) = self.largest_acked.zip(self.largest_ack_eliciting_packet) - { - if self.reordering_threshold > largest_acked { - return false; - } - // The largest packet number that could be declared lost without a new ACK being - // sent - let largest_reported = largest_acked - self.reordering_threshold + 1; - dedup - .smallest_missing_in_interval(largest_reported, largest_unacked) - .map_or(false, |smallest_missing| { - largest_unacked - smallest_missing >= self.reordering_threshold - }) - } else { - false + else { + return false; + }; + if self.reordering_threshold > largest_acked { + return false; } + // The largest packet number that could be declared lost without a new ACK being + // sent + let largest_reported = largest_acked - self.reordering_threshold + 1; + let Some(smallest_missing_unreported) = + dedup.smallest_missing_in_interval(largest_reported, largest_unacked) + else { + return false; + }; + largest_unacked - smallest_missing_unreported >= self.reordering_threshold } } } From d4b667a721a98ee73f9974c3cd7f9773e29e6bdf Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Sun, 24 Sep 2023 14:13:13 -0700 Subject: [PATCH 4/4] Remove explicit rust-version requirement from unpublished crates --- bench/Cargo.toml | 1 - perf/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/bench/Cargo.toml b/bench/Cargo.toml index 7a950a5c3..11ca13c6b 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -2,7 +2,6 @@ name = "bench" version = "0.1.0" edition = "2021" -rust-version = "1.65" license = "MIT OR Apache-2.0" publish = false diff --git a/perf/Cargo.toml b/perf/Cargo.toml index 55e203acb..fff63784a 100644 --- a/perf/Cargo.toml +++ b/perf/Cargo.toml @@ -2,7 +2,6 @@ name = "perf" version = "0.1.0" edition = "2021" -rust-version = "1.65" license = "MIT OR Apache-2.0" publish = false