diff --git a/neqo-bin/src/client/mod.rs b/neqo-bin/src/client/mod.rs index 8bfac59703..ad5407e2cc 100644 --- a/neqo-bin/src/client/mod.rs +++ b/neqo-bin/src/client/mod.rs @@ -457,7 +457,7 @@ impl<'a, H: Handler> Runner<'a, H> { async fn process_multiple_input(&mut self) -> Res<()> { loop { - let dgrams = self.socket.recv(&self.local_addr)?; + let dgrams = self.socket.recv(self.local_addr)?; if dgrams.is_empty() { break; } diff --git a/neqo-bin/src/server/mod.rs b/neqo-bin/src/server/mod.rs index abf614f1f8..a6104daa5f 100644 --- a/neqo-bin/src/server/mod.rs +++ b/neqo-bin/src/server/mod.rs @@ -289,7 +289,7 @@ impl ServerRunner { match self.ready().await? { Ready::Socket(inx) => loop { let (host, socket) = self.sockets.get_mut(inx).unwrap(); - let dgrams = socket.recv(host)?; + let dgrams = socket.recv(*host)?; if dgrams.is_empty() { break; } diff --git a/neqo-bin/src/udp.rs b/neqo-bin/src/udp.rs index 148ff43175..bc14aadcf3 100644 --- a/neqo-bin/src/udp.rs +++ b/neqo-bin/src/udp.rs @@ -55,7 +55,7 @@ impl Socket { /// Receive a batch of [`Datagram`]s on the given [`Socket`], each set with /// the provided local address. - pub fn recv(&self, local_address: &SocketAddr) -> Result, io::Error> { + pub fn recv(&self, local_address: SocketAddr) -> Result, io::Error> { self.inner .try_io(tokio::io::Interest::READABLE, || { neqo_udp::recv_inner(local_address, &self.state, &self.inner) diff --git a/neqo-udp/src/lib.rs b/neqo-udp/src/lib.rs index 5f1fb3dbe6..dea2b26721 100644 --- a/neqo-udp/src/lib.rs +++ b/neqo-udp/src/lib.rs @@ -58,7 +58,7 @@ use std::os::fd::AsFd as SocketRef; use std::os::windows::io::AsSocket as SocketRef; pub fn recv_inner( - local_address: &SocketAddr, + local_address: SocketAddr, state: &UdpSocketState, socket: impl SocketRef, ) -> Result, io::Error> { @@ -99,7 +99,7 @@ pub fn recv_inner( ); Datagram::new( meta.addr, - *local_address, + local_address, meta.ecn.map(|n| IpTos::from(n as u8)).unwrap_or_default(), d, ) @@ -138,7 +138,7 @@ impl Socket { /// Receive a batch of [`Datagram`]s on the given [`Socket`], each /// set with the provided local address. - pub fn recv(&self, local_address: &SocketAddr) -> Result, io::Error> { + pub fn recv(&self, local_address: SocketAddr) -> Result, io::Error> { recv_inner(local_address, &self.state, &self.inner) } } @@ -170,7 +170,7 @@ mod tests { ); sender.send(&datagram)?; - let res = receiver.recv(&receiver_addr); + let res = receiver.recv(receiver_addr); assert_eq!(res.unwrap_err().kind(), std::io::ErrorKind::WouldBlock); Ok(()) @@ -192,7 +192,7 @@ mod tests { sender.send(&datagram)?; let received_datagram = receiver - .recv(&receiver_addr) + .recv(receiver_addr) .expect("receive to succeed") .into_iter() .next() @@ -238,7 +238,7 @@ mod tests { let mut num_received = 0; while num_received < max_gso_segments { receiver - .recv(&receiver_addr) + .recv(receiver_addr) .expect("receive to succeed") .into_iter() .for_each(|d| {