mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 09:31:20 +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:
@ -31,9 +31,12 @@ use libp2p_core::{
|
||||
use std::{task::Context, task::Poll};
|
||||
|
||||
/// Custom event that can be received by the [`ProtocolsHandler`].
|
||||
type THandlerInEvent<THandler> =
|
||||
pub(crate) type THandlerInEvent<THandler> =
|
||||
<<THandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::InEvent;
|
||||
|
||||
pub(crate) type THandlerOutEvent<THandler> =
|
||||
<<THandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::OutEvent;
|
||||
|
||||
/// A [`NetworkBehaviour`] defines the behaviour of the local node on the network.
|
||||
///
|
||||
/// In contrast to [`Transport`](libp2p_core::Transport) which defines **how** to send bytes on the
|
||||
|
Reference in New Issue
Block a user