mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-22 06:11:34 +00:00
swarm/: Rename ProtocolsHandler to ConnectionHandler (#2527)
A `ProtocolsHandler`, now `ConnectionHandler`, handels a connection, not a protocol. Thus the name `CONNECTIONHandler` is more appropriate. Next to the rename of `ProtocolsHandler` this commit renames the `mod protocols_handler` to `mod handler`. Finally all combinators (e.g. `ProtocolsHandlerSelect`) are renamed appropriately.
This commit is contained in:
@ -34,7 +34,7 @@ pub use pool::{ConnectionCounters, ConnectionLimits};
|
||||
pub use pool::{EstablishedConnection, PendingConnection};
|
||||
pub use substream::{Close, Substream, SubstreamEndpoint};
|
||||
|
||||
use crate::protocols_handler::ProtocolsHandler;
|
||||
use crate::handler::ConnectionHandler;
|
||||
use handler_wrapper::HandlerWrapper;
|
||||
use libp2p_core::connection::ConnectedPoint;
|
||||
use libp2p_core::multiaddr::Multiaddr;
|
||||
@ -56,16 +56,16 @@ pub struct Connected {
|
||||
/// Event generated by a [`Connection`].
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Event<T> {
|
||||
/// Event generated by the [`ProtocolsHandler`].
|
||||
/// Event generated by the [`ConnectionHandler`].
|
||||
Handler(T),
|
||||
/// Address of the remote has changed.
|
||||
AddressChange(Multiaddr),
|
||||
}
|
||||
|
||||
/// A multiplexed connection to a peer with an associated [`ProtocolsHandler`].
|
||||
/// A multiplexed connection to a peer with an associated [`ConnectionHandler`].
|
||||
pub struct Connection<THandler>
|
||||
where
|
||||
THandler: ProtocolsHandler,
|
||||
THandler: ConnectionHandler,
|
||||
{
|
||||
/// Node that handles the muxing.
|
||||
muxing: substream::Muxing<StreamMuxerBox, handler_wrapper::OutboundOpenInfo<THandler>>,
|
||||
@ -75,7 +75,7 @@ where
|
||||
|
||||
impl<THandler> fmt::Debug for Connection<THandler>
|
||||
where
|
||||
THandler: ProtocolsHandler + fmt::Debug,
|
||||
THandler: ConnectionHandler + fmt::Debug,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Connection")
|
||||
@ -85,11 +85,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<THandler> Unpin for Connection<THandler> where THandler: ProtocolsHandler {}
|
||||
impl<THandler> Unpin for Connection<THandler> where THandler: ConnectionHandler {}
|
||||
|
||||
impl<THandler> Connection<THandler>
|
||||
where
|
||||
THandler: ProtocolsHandler,
|
||||
THandler: ConnectionHandler,
|
||||
{
|
||||
/// Builds a new `Connection` from the given substream multiplexer
|
||||
/// and connection handler.
|
||||
|
Reference in New Issue
Block a user