mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-29 17:51:35 +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:
@ -23,9 +23,9 @@ use either::Either;
|
||||
use libp2p_core::connection::ConnectionId;
|
||||
use libp2p_core::upgrade::{self, DeniedUpgrade};
|
||||
use libp2p_core::{ConnectedPoint, PeerId};
|
||||
use libp2p_swarm::protocols_handler::DummyProtocolsHandler;
|
||||
use libp2p_swarm::protocols_handler::SendWrapper;
|
||||
use libp2p_swarm::{IntoProtocolsHandler, ProtocolsHandler};
|
||||
use libp2p_swarm::handler::DummyConnectionHandler;
|
||||
use libp2p_swarm::handler::SendWrapper;
|
||||
use libp2p_swarm::{ConnectionHandler, IntoConnectionHandler};
|
||||
|
||||
pub mod direct;
|
||||
pub mod relayed;
|
||||
@ -43,8 +43,8 @@ pub enum Role {
|
||||
Listener,
|
||||
}
|
||||
|
||||
impl IntoProtocolsHandler for Prototype {
|
||||
type Handler = Either<relayed::Handler, Either<direct::Handler, DummyProtocolsHandler>>;
|
||||
impl IntoConnectionHandler for Prototype {
|
||||
type Handler = Either<relayed::Handler, Either<direct::Handler, DummyConnectionHandler>>;
|
||||
|
||||
fn into_handler(self, _remote_peer_id: &PeerId, endpoint: &ConnectedPoint) -> Self::Handler {
|
||||
match self {
|
||||
@ -52,7 +52,7 @@ impl IntoProtocolsHandler for Prototype {
|
||||
if endpoint.is_relayed() {
|
||||
Either::Left(relayed::Handler::new(endpoint.clone()))
|
||||
} else {
|
||||
Either::Right(Either::Right(DummyProtocolsHandler::default()))
|
||||
Either::Right(Either::Right(DummyConnectionHandler::default()))
|
||||
}
|
||||
}
|
||||
Self::DirectConnection {
|
||||
@ -68,7 +68,7 @@ impl IntoProtocolsHandler for Prototype {
|
||||
}
|
||||
}
|
||||
|
||||
fn inbound_protocol(&self) -> <Self::Handler as ProtocolsHandler>::InboundProtocol {
|
||||
fn inbound_protocol(&self) -> <Self::Handler as ConnectionHandler>::InboundProtocol {
|
||||
match self {
|
||||
Prototype::UnknownConnection => upgrade::EitherUpgrade::A(SendWrapper(
|
||||
upgrade::EitherUpgrade::A(protocol::inbound::Upgrade {}),
|
||||
|
Reference in New Issue
Block a user