Skip to content

Commit

Permalink
fix(mdns): don't suspend task forever upon reading non-mDNS packet
Browse files Browse the repository at this point in the history
Fixes: #4860.

Pull-Request: #4861.
  • Loading branch information
stormshield-frb authored Nov 22, 2023
1 parent bb2b798 commit c718835
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions protocols/mdns/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- Ensure `Multiaddr` handled and returned by `Behaviour` are `/p2p` terminated.
See [PR 4596](https://github.com/libp2p/rust-libp2p/pull/4596).
- Fix a bug in the `Behaviour::poll` method causing missed mdns packets.
See [PR 4861](https://github.com/libp2p/rust-libp2p/pull/4861).

## 0.45.0

Expand Down
6 changes: 5 additions & 1 deletion protocols/mdns/src/behaviour/iface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,18 @@ where
}
Poll::Ready(Err(err)) if err.kind() == std::io::ErrorKind::WouldBlock => {
// No more bytes available on the socket to read
continue;
}
Poll::Ready(Err(err)) => {
tracing::error!("failed reading datagram: {}", err);
return Poll::Ready(());
}
Poll::Ready(Ok(Err(err))) => {
tracing::debug!("Parsing mdns packet failed: {:?}", err);
continue;
}
Poll::Ready(Ok(Ok(None))) | Poll::Pending => {}
Poll::Ready(Ok(Ok(None))) => continue,
Poll::Pending => {}
}

return Poll::Pending;
Expand Down

0 comments on commit c718835

Please sign in to comment.