From a4d108387d10f72a8bb7968a9a3c24c3b93e046e Mon Sep 17 00:00:00 2001 From: Max Inden Date: Mon, 13 May 2024 11:47:28 +0200 Subject: [PATCH] feat(bin): use quinn-udp crates.io release instead of git ref `neqo-bin` has been importing `quinn-udp` as a git reference, in order to include https://github.com/quinn-rs/quinn/pull/1765. The quinn project has since released `quinn-udp` `v0.5.0`. This commit upgrades `neqo-bin` to use `quinn-udp` `v0.5.0`. `quinn-udp` has dropped `sendmmsg` support in the `v0.5.0` release (https://github.com/quinn-rs/quinn/commit/ee0882657a16a8ffd7ff5844f355caca519e63ce). `neqo-bin` does not (yet) use `sendmmsg`. This might change in the future (https://github.com/mozilla/neqo/issues/1693). --- neqo-bin/Cargo.toml | 2 +- neqo-bin/src/udp.rs | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/neqo-bin/Cargo.toml b/neqo-bin/Cargo.toml index e776acafd..99b5ff3fd 100644 --- a/neqo-bin/Cargo.toml +++ b/neqo-bin/Cargo.toml @@ -35,7 +35,7 @@ neqo-http3 = { path = "./../neqo-http3" } neqo-qpack = { path = "./../neqo-qpack" } neqo-transport = { path = "./../neqo-transport" } qlog = { workspace = true } -quinn-udp = { git = "https://github.com/quinn-rs/quinn/", rev = "a947962131aba8a6521253d03cc948b20098a2d6" } +quinn-udp = { version = "0.5.0", default-features = false } regex = { version = "1.9", default-features = false, features = ["unicode-perl"] } tokio = { version = "1", default-features = false, features = ["net", "time", "macros", "rt", "rt-multi-thread"] } url = { version = "2.5", default-features = false } diff --git a/neqo-bin/src/udp.rs b/neqo-bin/src/udp.rs index 7ccfa1f36..ccdc25aa4 100644 --- a/neqo-bin/src/udp.rs +++ b/neqo-bin/src/udp.rs @@ -62,18 +62,15 @@ impl Socket { let transmit = Transmit { destination: d.destination(), ecn: EcnCodepoint::from_bits(Into::::into(d.tos())), - contents: Vec::from(d).into(), + contents: &d, segment_size: None, src_ip: None, }; - let n = self.socket.try_io(Interest::WRITABLE, || { - self.state - .send((&self.socket).into(), slice::from_ref(&transmit)) + self.socket.try_io(Interest::WRITABLE, || { + self.state.send((&self.socket).into(), &transmit) })?; - assert_eq!(n, 1, "only passed one slice"); - Ok(()) } @@ -189,17 +186,14 @@ mod tests { IpTosDscp::Le, IpTosEcn::Ect1, )))), - contents: msg.clone().into(), + contents: &msg, segment_size: Some(SEGMENT_SIZE), src_ip: None, }; sender.writable().await?; - let n = sender.socket.try_io(Interest::WRITABLE, || { - sender - .state - .send((&sender.socket).into(), slice::from_ref(&transmit)) + sender.socket.try_io(Interest::WRITABLE, || { + sender.state.send((&sender.socket).into(), &transmit) })?; - assert_eq!(n, 1, "only passed one slice"); // Allow for one GSO sendmmsg to result in multiple GRO recvmmsg. let mut num_received = 0;