Struct libp2p_ping::dial_handler::PeriodicPingHandler
source · pub struct PeriodicPingHandler<TSubstream> { /* private fields */ }
Expand description
Protocol handler that handles pinging the remote at a regular period.
If the remote doesn’t respond, produces an error that closes the connection.
Implementations§
source§impl<TSubstream> PeriodicPingHandler<TSubstream>
impl<TSubstream> PeriodicPingHandler<TSubstream>
sourcepub fn new() -> PeriodicPingHandler<TSubstream>
pub fn new() -> PeriodicPingHandler<TSubstream>
Builds a new PeriodicPingHandler
.
Trait Implementations§
source§impl<TSubstream> Default for PeriodicPingHandler<TSubstream>
impl<TSubstream> Default for PeriodicPingHandler<TSubstream>
source§impl<TSubstream> ProtocolsHandler for PeriodicPingHandler<TSubstream>where
TSubstream: AsyncRead + AsyncWrite,
impl<TSubstream> ProtocolsHandler for PeriodicPingHandler<TSubstream>where
TSubstream: AsyncRead + AsyncWrite,
§type OutEvent = OutEvent
type OutEvent = OutEvent
Custom event that can be produced by the handler and that will be returned to the outside.
§type InboundProtocol = DeniedUpgrade
type InboundProtocol = DeniedUpgrade
The upgrade for the protocol or protocols handled by this handler.
§type OutboundProtocol = Ping<Instant>
type OutboundProtocol = Ping<Instant>
The upgrade for the protocol or protocols handled by this handler.
§type OutboundOpenInfo = ()
type OutboundOpenInfo = ()
Information about a substream. Can be sent to the handler through a
NodeHandlerEndpoint
,
and will be passed back in inject_substream
or inject_outbound_closed
. Read moresource§fn listen_protocol(&self) -> Self::InboundProtocol
fn listen_protocol(&self) -> Self::InboundProtocol
Produces a
ConnectionUpgrade
for the protocol or protocols to accept when listening. Read moresource§fn inject_fully_negotiated_inbound(&mut self, protocol: Void)
fn inject_fully_negotiated_inbound(&mut self, protocol: Void)
Injects a fully-negotiated substream in the handler. Read more
fn inject_fully_negotiated_outbound(
&mut self,
substream: <Self::OutboundProtocol as OutboundUpgrade<TSubstream>>::Output,
_info: Self::OutboundOpenInfo
)
source§fn inject_event(&mut self, _: Self::InEvent)
fn inject_event(&mut self, _: Self::InEvent)
Injects an event coming from the outside in the handler.
source§fn inject_inbound_closed(&mut self)
fn inject_inbound_closed(&mut self)
Indicates to the handler that the inbound part of the muxer has been closed, and that
therefore no more inbound substreams will be produced. Read more
source§fn inject_dial_upgrade_error(
&mut self,
_: Self::OutboundOpenInfo,
_: ProtocolsHandlerUpgrErr<<Self::OutboundProtocol as OutboundUpgrade<Self::Substream>>::Error>
)
fn inject_dial_upgrade_error(
&mut self,
_: Self::OutboundOpenInfo,
_: ProtocolsHandlerUpgrErr<<Self::OutboundProtocol as OutboundUpgrade<Self::Substream>>::Error>
)
Indicates to the handler that upgrading a substream to the given protocol has failed.
source§fn connection_keep_alive(&self) -> bool
fn connection_keep_alive(&self) -> bool
Returns whether the connection should be kept alive. Read more
source§fn shutdown(&mut self)
fn shutdown(&mut self)
Indicates to the node that it should shut down. After that, it is expected that
poll()
returns Ready(ProtocolsHandlerEvent::Shutdown)
as soon as possible. Read moresource§fn poll(
&mut self
) -> Poll<ProtocolsHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::OutEvent>, Error>
fn poll(
&mut self
) -> Poll<ProtocolsHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::OutEvent>, Error>
Should behave like
Stream::poll()
. Should close if no more event can be produced and the
node should be closed. Read moresource§fn map_in_event<TNewIn, TMap>(self, map: TMap) -> MapInEvent<Self, TNewIn, TMap>where
Self: Sized,
TMap: Fn(&TNewIn) -> Option<&Self::InEvent>,
fn map_in_event<TNewIn, TMap>(self, map: TMap) -> MapInEvent<Self, TNewIn, TMap>where
Self: Sized,
TMap: Fn(&TNewIn) -> Option<&Self::InEvent>,
Adds a closure that turns the input event into something else.
source§fn map_out_event<TMap, TNewOut>(self, map: TMap) -> MapOutEvent<Self, TMap>where
Self: Sized,
TMap: FnMut(Self::OutEvent) -> TNewOut,
fn map_out_event<TMap, TNewOut>(self, map: TMap) -> MapOutEvent<Self, TMap>where
Self: Sized,
TMap: FnMut(Self::OutEvent) -> TNewOut,
Adds a closure that turns the output event into something else.
source§fn select<TProto2>(self, other: TProto2) -> ProtocolsHandlerSelect<Self, TProto2>where
Self: Sized,
fn select<TProto2>(self, other: TProto2) -> ProtocolsHandlerSelect<Self, TProto2>where
Self: Sized,
Builds an implementation of
ProtocolsHandler
that handles both this protocol and the
other one together. Read moresource§fn into_node_handler_builder(self) -> NodeHandlerWrapperBuilder<Self>where
Self: Sized,
fn into_node_handler_builder(self) -> NodeHandlerWrapperBuilder<Self>where
Self: Sized,
Creates a builder that will allow creating a
NodeHandler
that handles this protocol
exclusively. Read moresource§fn into_node_handler(self) -> NodeHandlerWrapper<Self>where
Self: Sized,
fn into_node_handler(self) -> NodeHandlerWrapper<Self>where
Self: Sized,
👎Deprecated: Use into_node_handler_builder instead
Builds an implementation of
NodeHandler
that handles this protocol exclusively. Read moreAuto Trait Implementations§
impl<TSubstream> !RefUnwindSafe for PeriodicPingHandler<TSubstream>
impl<TSubstream> Send for PeriodicPingHandler<TSubstream>where
TSubstream: Send,
impl<TSubstream> Sync for PeriodicPingHandler<TSubstream>where
TSubstream: Sync,
impl<TSubstream> Unpin for PeriodicPingHandler<TSubstream>where
TSubstream: Unpin,
impl<TSubstream> !UnwindSafe for PeriodicPingHandler<TSubstream>
Blanket Implementations§
source§impl<T> IntoProtocolsHandler for Twhere
T: ProtocolsHandler,
impl<T> IntoProtocolsHandler for Twhere
T: ProtocolsHandler,
source§fn into_handler(self, _: &PeerId) -> T
fn into_handler(self, _: &PeerId) -> T
Builds the protocols handler. Read more
source§fn select<TProto2>(
self,
other: TProto2
) -> IntoProtocolsHandlerSelect<Self, TProto2>where
Self: Sized,
fn select<TProto2>(
self,
other: TProto2
) -> IntoProtocolsHandlerSelect<Self, TProto2>where
Self: Sized,
Builds an implementation of
IntoProtocolsHandler
that handles both this protocol and the
other one together. Read moresource§fn into_node_handler_builder(self) -> NodeHandlerWrapperBuilder<Self>where
Self: Sized,
fn into_node_handler_builder(self) -> NodeHandlerWrapperBuilder<Self>where
Self: Sized,
Creates a builder that will allow creating a
NodeHandler
that handles this protocol
exclusively. Read more