mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 17:41:22 +00:00
[ping] Refactor the ping protocol for conformity. (#1692)
* Refactor the ping protocol. Such that pings are sent over a single substream, as it is done in other libp2p implementations. Note that, since each peer sends its pings over a single, dedicated substream, every peer that participates in the protocol has effectively two open substreams. * Cleanup * Update ping changelog. * Update protocols/ping/src/protocol.rs Co-authored-by: Max Inden <mail@max-inden.de> Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -28,15 +28,14 @@
|
||||
//!
|
||||
//! The [`Ping`] struct implements the [`NetworkBehaviour`] trait. When used with a [`Swarm`],
|
||||
//! it will respond to inbound ping requests and as necessary periodically send outbound
|
||||
//! ping requests on every established connection. If a configurable number of pings fail,
|
||||
//! the connection will be closed.
|
||||
//! ping requests on every established connection. If a configurable number of consecutive
|
||||
//! pings fail, the connection will be closed.
|
||||
//!
|
||||
//! The `Ping` network behaviour produces [`PingEvent`]s, which may be consumed from the `Swarm`
|
||||
//! by an application, e.g. to collect statistics.
|
||||
//!
|
||||
//! > **Note**: The ping protocol does not keep otherwise idle connections alive,
|
||||
//! > it only adds an additional condition for terminating the connection, namely
|
||||
//! > a certain number of failed ping requests.
|
||||
//! > **Note**: The ping protocol does not keep otherwise idle connections alive
|
||||
//! > by default, see [`PingConfig::with_keep_alive`] for changing this behaviour.
|
||||
//!
|
||||
//! [`Swarm`]: libp2p_swarm::Swarm
|
||||
//! [`Transport`]: libp2p_core::Transport
|
||||
|
Reference in New Issue
Block a user