Skip to content

Commit 29d969b

Browse files
dvc94chmxinden
andauthored
protocols/mdns: Fix timely discovery after listening on new address (#2053)
If you start listening after mdns joined a multicast group, the peers may not discover eachother until the 5min timeout expires. Co-authored-by: Max Inden <[email protected]>
1 parent 40c4287 commit 29d969b

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

protocols/mdns/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.30.1 [2021-04-21]
2+
3+
- Fix timely discovery of peers after listening on a new address.
4+
[PR 2053](https://github.com/libp2p/rust-libp2p/pull/2053/)
5+
16
# 0.30.0 [2021-04-13]
27

38
- Derive `Debug` and `Clone` for `MdnsConfig`.

protocols/mdns/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "libp2p-mdns"
33
edition = "2018"
4-
version = "0.30.0"
4+
version = "0.30.1"
55
description = "Implementation of the libp2p mDNS discovery method"
66
authors = ["Parity Technologies <[email protected]>"]
77
license = "MIT"

protocols/mdns/src/behaviour.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use lazy_static::lazy_static;
2727
use libp2p_core::{
2828
address_translation, connection::ConnectionId, multiaddr::Protocol, Multiaddr, PeerId,
2929
};
30+
use libp2p_core::connection::ListenerId;
3031
use libp2p_swarm::{
3132
protocols_handler::DummyProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction,
3233
PollParameters, ProtocolsHandler,
@@ -269,6 +270,10 @@ impl NetworkBehaviour for Mdns {
269270
void::unreachable(ev)
270271
}
271272

273+
fn inject_new_listen_addr(&mut self, _id: ListenerId, _addr: &Multiaddr) {
274+
self.send_buffer.push_back(build_query());
275+
}
276+
272277
fn poll(
273278
&mut self,
274279
cx: &mut Context<'_>,

0 commit comments

Comments
 (0)