From e47ab419f26a45eb2f6f9cbd6964203322d681a3 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 1 Sep 2020 16:54:22 -0400 Subject: [PATCH] -Fixed broadcast storm when entire packet is sent and poll_send_to returns Ready --- Cargo.toml | 2 +- src/fsm.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 51ddcd5..72df441 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libmdns" -version = "0.4.0" +version = "0.4.1" authors = ["Will Stott "] description = "mDNS Responder library for building discoverable LAN services in Rust" diff --git a/src/fsm.rs b/src/fsm.rs index f1cee4e..4c41365 100644 --- a/src/fsm.rs +++ b/src/fsm.rs @@ -265,7 +265,8 @@ impl Future for FSM { trace!("sending packet to {:?}", addr); match pinned.socket.poll_send_to(cx, response, addr) { - Poll::Ready(Ok(_)) => (), + Poll::Ready(Ok(bytes_sent)) if bytes_sent == response.len() => break, + Poll::Ready(Ok(_)) => warn!("failed to send entire packet"), Poll::Ready(Err(ref ioerr)) if ioerr.kind() == WouldBlock => break, Poll::Ready(Err(err)) => warn!("error sending packet {:?}", err), Poll::Pending => (break),