diff --git a/neqo-bin/Cargo.toml b/neqo-bin/Cargo.toml index e776acafdf..99b5ff3fda 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/client/mod.rs b/neqo-bin/src/client/mod.rs index f196a5e32e..9558bf7998 100644 --- a/neqo-bin/src/client/mod.rs +++ b/neqo-bin/src/client/mod.rs @@ -418,7 +418,7 @@ impl<'a, H: Handler> Runner<'a, H> { match self.client.process_output(Instant::now()) { Output::Datagram(dgram) => { self.socket.writable().await?; - self.socket.send(dgram)?; + self.socket.send(&dgram)?; } Output::Callback(new_timeout) => { qdebug!("Setting timeout of {:?}", new_timeout); diff --git a/neqo-bin/src/server/mod.rs b/neqo-bin/src/server/mod.rs index 9d35328ea1..14ac06e5bf 100644 --- a/neqo-bin/src/server/mod.rs +++ b/neqo-bin/src/server/mod.rs @@ -232,7 +232,7 @@ impl ServerRunner { Output::Datagram(dgram) => { let socket = self.find_socket(dgram.source()); socket.writable().await?; - socket.send(dgram)?; + socket.send(&dgram)?; } Output::Callback(new_timeout) => { qdebug!("Setting timeout of {:?}", new_timeout); diff --git a/neqo-bin/src/udp.rs b/neqo-bin/src/udp.rs index 7ccfa1f36f..0c4b034dc8 100644 --- a/neqo-bin/src/udp.rs +++ b/neqo-bin/src/udp.rs @@ -58,22 +58,19 @@ impl Socket { } /// Send the UDP datagram on the specified socket. - pub fn send(&self, d: Datagram) -> io::Result<()> { + pub fn send(&self, d: &Datagram) -> io::Result<()> { 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(()) } @@ -149,7 +146,7 @@ mod tests { ); sender.writable().await?; - sender.send(datagram.clone())?; + sender.send(&datagram)?; receiver.readable().await?; let received_datagram = receiver @@ -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;