Struct libp2p::ping::PingConfig[][src]

pub struct PingConfig { /* fields omitted */ }
Expand description

The configuration for outbound pings.

Implementations

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.

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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. 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

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.