mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-13 10:01:25 +00:00
swarm/src: Remove ConnectionHandler (#2519)
The `ConnectionHandler` trait is not exposed to users. The only implementor of `ConnectionHandler` is `NodeHandlerWrapper`. Thus `ConnectionHandler` is a superfluous abstraction. This commit removes `ConnectionHandler`. Next to this large change, this commit removes the `Tmuxer` trait parameter. `Swarm` enforces dynamic dispatching via `StreamMuxerBox` anyways, thus the trait parameter is useless. As a follow up to this commit one could rename `ProtocolsHandler` to `ConnectionHandler` and `NodeHandlerWrapper` to `ConnectionHandlerWrapper` or just `Wrapper`.
This commit is contained in:
@ -79,8 +79,8 @@ use crate::connection::IncomingInfo;
|
||||
use crate::connection::{pool::PoolEvent, ListenersEvent, ListenersStream};
|
||||
use connection::pool::{ConnectionCounters, ConnectionLimits, Pool, PoolConfig};
|
||||
use connection::{
|
||||
ConnectionError, ConnectionHandler, ConnectionLimit, EstablishedConnection,
|
||||
IntoConnectionHandler, PendingOutboundConnectionError, Substream,
|
||||
ConnectionError, ConnectionLimit, EstablishedConnection, PendingOutboundConnectionError,
|
||||
Substream,
|
||||
};
|
||||
use dial_opts::{DialOpts, PeerCondition};
|
||||
use either::Either;
|
||||
@ -95,7 +95,7 @@ use libp2p_core::{
|
||||
upgrade::ProtocolName,
|
||||
Executor, Multiaddr, Negotiated, PeerId, Transport,
|
||||
};
|
||||
use protocols_handler::{NodeHandlerWrapperBuilder, NodeHandlerWrapperError};
|
||||
use protocols_handler::NodeHandlerWrapperError;
|
||||
use registry::{AddressIntoIter, Addresses};
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::HashSet;
|
||||
@ -264,10 +264,7 @@ where
|
||||
listeners: ListenersStream<transport::Boxed<(PeerId, StreamMuxerBox)>>,
|
||||
|
||||
/// The nodes currently active.
|
||||
pool: Pool<
|
||||
NodeHandlerWrapperBuilder<THandler<TBehaviour>>,
|
||||
transport::Boxed<(PeerId, StreamMuxerBox)>,
|
||||
>,
|
||||
pool: Pool<THandler<TBehaviour>, transport::Boxed<(PeerId, StreamMuxerBox)>>,
|
||||
|
||||
/// The local peer ID.
|
||||
local_peer_id: PeerId,
|
||||
@ -1147,8 +1144,8 @@ where
|
||||
TTrans: Transport,
|
||||
TTrans::Error: Send + 'static,
|
||||
TBehaviour: NetworkBehaviour,
|
||||
THandler: IntoConnectionHandler,
|
||||
THandler::Handler: ConnectionHandler<
|
||||
THandler: IntoProtocolsHandler,
|
||||
THandler::Handler: ProtocolsHandler<
|
||||
InEvent = THandlerInEvent<TBehaviour>,
|
||||
OutEvent = THandlerOutEvent<TBehaviour>,
|
||||
>,
|
||||
|
Reference in New Issue
Block a user