Struct ipfs_embed::PingConfig [−]
pub struct PingConfig { /* fields omitted */ }Expand description
The configuration for outbound pings.
Implementations
impl PingConfig
impl PingConfigpub fn new() -> PingConfig
pub fn new() -> PingConfigCreates a new PingConfig with the following default settings:
PingConfig::with_interval15sPingConfig::with_timeout20sPingConfig::with_max_failures1PingConfig::with_keep_alivefalse
These settings have the following effect:
- A ping is sent every 15 seconds on a healthy connection.
- Every ping sent must yield a response within 20 seconds in order to be successful.
- A single ping failure is sufficient for the connection to be subject to being closed.
- The connection may be closed at any time as far as the ping protocol is concerned, i.e. the ping protocol itself does not keep the connection alive.
pub fn with_timeout(self, d: Duration) -> PingConfig
pub fn with_timeout(self, d: Duration) -> PingConfigSets the ping timeout.
pub fn with_interval(self, d: Duration) -> PingConfig
pub fn with_interval(self, d: Duration) -> PingConfigSets the ping interval.
pub fn with_max_failures(self, n: NonZeroU32) -> PingConfig
pub fn with_max_failures(self, n: NonZeroU32) -> PingConfigSets the maximum number of consecutive ping failures upon which the remote peer is considered unreachable and the connection closed.
pub fn with_keep_alive(self, b: bool) -> PingConfig
pub fn with_keep_alive(self, b: bool) -> PingConfigSets whether the ping protocol itself should keep the connection alive, apart from the maximum allowed failures.
By default, the ping protocol itself allows the connection to be closed at any time, i.e. in the absence of ping failures the connection lifetime is determined by other protocol handlers.
If the maximum number of allowed ping failures is reached, the
connection is always terminated as a result of [ProtocolsHandler::poll]
returning an error, regardless of the keep-alive setting.
Trait Implementations
impl Clone for PingConfig
impl Clone for PingConfigpub fn clone(&self) -> PingConfig
pub fn clone(&self) -> PingConfigReturns a copy of the value. Read more
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl RefUnwindSafe for PingConfigimpl Send for PingConfigimpl Sync for PingConfigimpl Unpin for PingConfigimpl UnwindSafe for PingConfigBlanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()The archived version of the pointer metadata for this type.
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::MetadataConverts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more
pub fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
pub fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>Deserializes using the given deserializer
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
type Output = T
type Output = TShould always be Self
pub fn vzip(self) -> V