diff --git a/streamer/src/packet.rs b/streamer/src/packet.rs index b0f43d3df0a01c..aa8212f3d9b776 100644 --- a/streamer/src/packet.rs +++ b/streamer/src/packet.rs @@ -18,6 +18,14 @@ pub use { }, }; +/** Receive multiple messages from `sock` into buffer provided in `batch`. +This is a wrapper around recvmmsg(7) call. + + This function is *supposed to* timeout in 1 second and *may* block forever + due to a bug in the linux kernel. + You may want to call `sock.set_read_timeout(Some(Duration::from_secs(1)));` or similar + prior to calling this function if you require this to actually time out after 1 second. +*/ pub(crate) fn recv_from( batch: &mut PinnedPacketBatch, socket: &UdpSocket, diff --git a/streamer/src/recvmmsg.rs b/streamer/src/recvmmsg.rs index 4f7190b572625d..238e57583eb7a0 100644 --- a/streamer/src/recvmmsg.rs +++ b/streamer/src/recvmmsg.rs @@ -78,6 +78,18 @@ fn cast_socket_addr(addr: &sockaddr_storage, hdr: &mmsghdr) -> Option io::Result { // Should never hit this, but bail if the caller didn't provide any Packets