mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 14:51:34 +00:00
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 <mail@max-inden.de>
This commit is contained in:
@ -27,6 +27,7 @@ use lazy_static::lazy_static;
|
||||
use libp2p_core::{
|
||||
address_translation, connection::ConnectionId, multiaddr::Protocol, Multiaddr, PeerId,
|
||||
};
|
||||
use libp2p_core::connection::ListenerId;
|
||||
use libp2p_swarm::{
|
||||
protocols_handler::DummyProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction,
|
||||
PollParameters, ProtocolsHandler,
|
||||
@ -269,6 +270,10 @@ impl NetworkBehaviour for Mdns {
|
||||
void::unreachable(ev)
|
||||
}
|
||||
|
||||
fn inject_new_listen_addr(&mut self, _id: ListenerId, _addr: &Multiaddr) {
|
||||
self.send_buffer.push_back(build_query());
|
||||
}
|
||||
|
||||
fn poll(
|
||||
&mut self,
|
||||
cx: &mut Context<'_>,
|
||||
|
Reference in New Issue
Block a user