mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-05 04:31: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:
@ -22,7 +22,7 @@ use crate::codec::{Cookie, ErrorCode, Namespace, NewRegistration, Registration,
|
||||
use crate::handler;
|
||||
use crate::handler::outbound;
|
||||
use crate::handler::outbound::OpenInfo;
|
||||
use crate::substream_handler::SubstreamProtocolsHandler;
|
||||
use crate::substream_handler::SubstreamConnectionHandler;
|
||||
use futures::future::BoxFuture;
|
||||
use futures::future::FutureExt;
|
||||
use futures::stream::FuturesUnordered;
|
||||
@ -43,7 +43,7 @@ pub struct Behaviour {
|
||||
events: VecDeque<
|
||||
NetworkBehaviourAction<
|
||||
Event,
|
||||
SubstreamProtocolsHandler<void::Void, outbound::Stream, outbound::OpenInfo>,
|
||||
SubstreamConnectionHandler<void::Void, outbound::Stream, outbound::OpenInfo>,
|
||||
>,
|
||||
>,
|
||||
keypair: Keypair,
|
||||
@ -164,14 +164,14 @@ pub enum Event {
|
||||
}
|
||||
|
||||
impl NetworkBehaviour for Behaviour {
|
||||
type ProtocolsHandler =
|
||||
SubstreamProtocolsHandler<void::Void, outbound::Stream, outbound::OpenInfo>;
|
||||
type ConnectionHandler =
|
||||
SubstreamConnectionHandler<void::Void, outbound::Stream, outbound::OpenInfo>;
|
||||
type OutEvent = Event;
|
||||
|
||||
fn new_handler(&mut self) -> Self::ProtocolsHandler {
|
||||
fn new_handler(&mut self) -> Self::ConnectionHandler {
|
||||
let initial_keep_alive = Duration::from_secs(30);
|
||||
|
||||
SubstreamProtocolsHandler::new_outbound_only(initial_keep_alive)
|
||||
SubstreamConnectionHandler::new_outbound_only(initial_keep_alive)
|
||||
}
|
||||
|
||||
fn addresses_of_peer(&mut self, peer: &PeerId) -> Vec<Multiaddr> {
|
||||
@ -215,7 +215,7 @@ impl NetworkBehaviour for Behaviour {
|
||||
&mut self,
|
||||
cx: &mut Context<'_>,
|
||||
poll_params: &mut impl PollParameters,
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ProtocolsHandler>> {
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ConnectionHandler>> {
|
||||
if let Some(event) = self.events.pop_front() {
|
||||
return Poll::Ready(event);
|
||||
}
|
||||
@ -275,7 +275,7 @@ fn handle_outbound_event(
|
||||
) -> Vec<
|
||||
NetworkBehaviourAction<
|
||||
Event,
|
||||
SubstreamProtocolsHandler<void::Void, outbound::Stream, outbound::OpenInfo>,
|
||||
SubstreamConnectionHandler<void::Void, outbound::Stream, outbound::OpenInfo>,
|
||||
>,
|
||||
> {
|
||||
match event {
|
||||
|
Reference in New Issue
Block a user