From 5d57b3945add528c2dbe54d09136746d05d0f914 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Fri, 10 Jan 2025 09:44:18 +0100 Subject: [PATCH] tests(udp): use blocking socket to receive empty datagram The `handle_empty_datagram` unit tests sends and receives an empty datagram. To prevent a race condition where the receiver tries to receive the datagram before it is available (error `WouldBlock`), use a blocking socket via `socket()` instead. --- neqo-udp/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neqo-udp/src/lib.rs b/neqo-udp/src/lib.rs index ef57a996f8..a68367aa8f 100644 --- a/neqo-udp/src/lib.rs +++ b/neqo-udp/src/lib.rs @@ -233,7 +233,7 @@ mod tests { // platforms. Use `std` socket instead. See also // . let sender = std::net::UdpSocket::bind("127.0.0.1:0")?; - let receiver = Socket::new(std::net::UdpSocket::bind("127.0.0.1:0")?)?; + let receiver = socket()?; let receiver_addr: SocketAddr = "127.0.0.1:0".parse().unwrap(); sender.send_to(&[], receiver.inner.local_addr()?)?;