mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-21 05:41:33 +00:00
swarm/: Provide additional default impls on NetworkBehaviour
(#2150)
Not all implementations of `NetworkBehaviour` need all callbacks. We've have been adding new callbacks with default implementations for a while now. There is no reason the initial ones cannot also be defaulted, thus making it easier create new implementations. Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -26,7 +26,7 @@ use if_watch::{IfEvent, IfWatcher};
|
||||
use lazy_static::lazy_static;
|
||||
use libp2p_core::connection::ListenerId;
|
||||
use libp2p_core::{
|
||||
address_translation, connection::ConnectionId, multiaddr::Protocol, Multiaddr, PeerId,
|
||||
address_translation, multiaddr::Protocol, Multiaddr, PeerId,
|
||||
};
|
||||
use libp2p_swarm::{
|
||||
protocols_handler::DummyProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction,
|
||||
@ -254,14 +254,10 @@ impl NetworkBehaviour for Mdns {
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn inject_connected(&mut self, _: &PeerId) {}
|
||||
|
||||
fn inject_disconnected(&mut self, _: &PeerId) {}
|
||||
|
||||
fn inject_event(
|
||||
&mut self,
|
||||
_: PeerId,
|
||||
_: ConnectionId,
|
||||
_: libp2p_core::connection::ConnectionId,
|
||||
ev: <Self::ProtocolsHandler as ProtocolsHandler>::OutEvent,
|
||||
) {
|
||||
void::unreachable(ev)
|
||||
|
Reference in New Issue
Block a user