[][src]Struct libp2p_ping::handler::PingConfig

pub struct PingConfig { /* fields omitted */ }

The configuration for outbound pings.

Implementations

impl PingConfig[src]

pub fn new() -> Self[src]

Creates a new PingConfig with the following default settings:

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) -> Self[src]

Sets the ping timeout.

pub fn with_interval(self, d: Duration) -> Self[src]

Sets the ping interval.

pub fn with_max_failures(self, n: NonZeroU32) -> Self[src]

Sets 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) -> Self[src]

Sets 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[src]

impl Debug for PingConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,