Struct libp2p_ping::Config

source ·
pub struct Config { /* private fields */ }
Expand description

The configuration for outbound pings.

Implementations§

Creates a new Config 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.

Sets the ping timeout.

Sets the ping interval.

Sets the maximum number of consecutive ping failures upon which the remote peer is considered unreachable and the connection closed.

👎Deprecated since 0.40.0: Use libp2p::swarm::behaviour::KeepAlive if you need to keep connections alive unconditionally.

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 ConnectionHandler::poll returning an error, regardless of the keep-alive setting.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.