mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-02 11:11:36 +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:
@ -21,12 +21,12 @@
|
||||
use crate::handler::{self, InEvent, Proto};
|
||||
use crate::protocol::{Info, Protocol, UpgradeError};
|
||||
use libp2p_core::{multiaddr, ConnectedPoint, Multiaddr, PeerId, PublicKey};
|
||||
use libp2p_swarm::behaviour::{ConnectionClosed, ConnectionEstablished, DialFailure, FromSwarm};
|
||||
use libp2p_swarm::ConnectionId;
|
||||
use libp2p_swarm::{
|
||||
dial_opts::DialOpts, AddressScore, ConnectionHandler, ConnectionHandlerUpgrErr, DialError,
|
||||
ExternalAddresses, IntoConnectionHandler, ListenAddresses, NetworkBehaviour,
|
||||
NetworkBehaviourAction, NotifyHandler, PollParameters,
|
||||
behaviour::{ConnectionClosed, ConnectionEstablished, DialFailure, FromSwarm},
|
||||
dial_opts::DialOpts,
|
||||
AddressScore, ConnectionHandlerUpgrErr, ConnectionId, DialError, ExternalAddresses,
|
||||
ListenAddresses, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters,
|
||||
THandlerOutEvent,
|
||||
};
|
||||
use lru::LruCache;
|
||||
use std::num::NonZeroUsize;
|
||||
@ -253,7 +253,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>,
|
||||
) {
|
||||
match event {
|
||||
handler::Event::Identified(mut info) => {
|
||||
|
Reference in New Issue
Block a user