mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-15 11:01:21 +00:00
swarm/behaviour: Replace inject_*
with on_event
(#3011)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use crate::behaviour::{NetworkBehaviour, NetworkBehaviourAction, PollParameters};
|
||||
use crate::behaviour::{FromSwarm, NetworkBehaviour, NetworkBehaviourAction, PollParameters};
|
||||
use crate::handler::{
|
||||
ConnectionHandlerEvent, ConnectionHandlerUpgrErr, KeepAlive, SubstreamProtocol,
|
||||
};
|
||||
@ -29,7 +29,7 @@ impl NetworkBehaviour for Behaviour {
|
||||
ConnectionHandler
|
||||
}
|
||||
|
||||
fn inject_event(&mut self, _: PeerId, _: ConnectionId, event: Void) {
|
||||
fn on_connection_handler_event(&mut self, _: PeerId, _: ConnectionId, event: Void) {
|
||||
void::unreachable(event)
|
||||
}
|
||||
|
||||
@ -40,6 +40,23 @@ impl NetworkBehaviour for Behaviour {
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ConnectionHandler>> {
|
||||
Poll::Pending
|
||||
}
|
||||
|
||||
fn on_swarm_event(&mut self, event: FromSwarm<Self::ConnectionHandler>) {
|
||||
match event {
|
||||
FromSwarm::ConnectionEstablished(_)
|
||||
| FromSwarm::ConnectionClosed(_)
|
||||
| FromSwarm::AddressChange(_)
|
||||
| FromSwarm::DialFailure(_)
|
||||
| FromSwarm::ListenFailure(_)
|
||||
| FromSwarm::NewListener(_)
|
||||
| FromSwarm::NewListenAddr(_)
|
||||
| FromSwarm::ExpiredListenAddr(_)
|
||||
| FromSwarm::ListenerError(_)
|
||||
| FromSwarm::ListenerClosed(_)
|
||||
| FromSwarm::NewExternalAddr(_)
|
||||
| FromSwarm::ExpiredExternalAddr(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Implementation of [`ConnectionHandler`] that doesn't handle anything but keeps the connection alive.
|
||||
|
Reference in New Issue
Block a user