Skip to content

Commit

Permalink
protocols/mdns: Ensure to set non_blocking on tokio udp socket
Browse files Browse the repository at this point in the history
See tokio-rs/tokio#3016 for details.
  • Loading branch information
mxinden committed Nov 2, 2020
1 parent cdfb8df commit 6f51985
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion protocols/mdns/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,9 @@ impl fmt::Debug for $service_name {
#[cfg(feature = "async-std")]
codegen!("async-std", MdnsService, async_std::net::UdpSocket, (|socket| Ok::<_, std::io::Error>(async_std::net::UdpSocket::from(socket))));

// Note: Tokio's UdpSocket::from_std does not set the socket into non-blocking mode.
#[cfg(feature = "tokio")]
codegen!("tokio", TokioMdnsService, tokio::net::UdpSocket, (|socket| tokio::net::UdpSocket::from_std(socket)));
codegen!("tokio", TokioMdnsService, tokio::net::UdpSocket, (|socket: std::net::UdpSocket| { socket.set_nonblocking(true); tokio::net::UdpSocket::from_std(socket) }));


/// A valid mDNS packet received by the service.
Expand Down

0 comments on commit 6f51985

Please sign in to comment.