mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-27 16:51:34 +00:00
refactor: expose and use THandlerOutEvent
type alias (#3368)
Previously, we used the full reference to the `OutEvent` of the `ConnectionHandler` in all implementations of `NetworkBehaviour`. Not only is this very verbose, it is also more brittle to changes. With the current implementation plan for #2824, we will be removing the `IntoConnectionHandler` abstraction. Using a type-alias to refer to the `OutEvent` makes the migration much easier.
This commit is contained in:
@ -37,8 +37,8 @@ use libp2p_swarm::{
|
||||
AddressChange, ConnectionClosed, ConnectionEstablished, DialFailure, ExpiredExternalAddr,
|
||||
ExpiredListenAddr, FromSwarm,
|
||||
},
|
||||
ConnectionHandler, ConnectionId, ExternalAddresses, IntoConnectionHandler, ListenAddresses,
|
||||
NetworkBehaviour, NetworkBehaviourAction, PollParameters,
|
||||
ConnectionId, ExternalAddresses, ListenAddresses, NetworkBehaviour, NetworkBehaviourAction,
|
||||
PollParameters, THandlerOutEvent,
|
||||
};
|
||||
use std::{
|
||||
collections::{HashMap, VecDeque},
|
||||
@ -553,8 +553,7 @@ impl NetworkBehaviour for Behaviour {
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
connection_id: ConnectionId,
|
||||
event: <<Self::ConnectionHandler as IntoConnectionHandler>::Handler as
|
||||
ConnectionHandler>::OutEvent,
|
||||
event: THandlerOutEvent<Self>,
|
||||
) {
|
||||
self.inner
|
||||
.on_connection_handler_event(peer_id, connection_id, event)
|
||||
|
Reference in New Issue
Block a user