mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-31 08:51:57 +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:
@@ -30,9 +30,8 @@ use libp2p_core::PeerId;
|
||||
use libp2p_swarm::behaviour::{ConnectionClosed, ConnectionEstablished, FromSwarm};
|
||||
use libp2p_swarm::{
|
||||
dial_opts::DialOpts, ConnectionId, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler,
|
||||
OneShotHandler, PollParameters,
|
||||
OneShotHandler, PollParameters, THandlerOutEvent,
|
||||
};
|
||||
use libp2p_swarm::{ConnectionHandler, IntoConnectionHandler};
|
||||
use log::warn;
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::hash_map::{DefaultHasher, HashMap};
|
||||
@@ -352,8 +351,7 @@ impl NetworkBehaviour for Floodsub {
|
||||
&mut self,
|
||||
propagation_source: PeerId,
|
||||
_connection_id: ConnectionId,
|
||||
event: <<Self::ConnectionHandler as IntoConnectionHandler>::Handler as
|
||||
ConnectionHandler>::OutEvent,
|
||||
event: THandlerOutEvent<Self>,
|
||||
) {
|
||||
// We ignore successful sends or timeouts.
|
||||
let event = match event {
|
||||
|
Reference in New Issue
Block a user