mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-20 13:26:34 +00:00
chore(ping): remove deprecated items
Related https://github.com/libp2p/rust-libp2p/issues/3647. Pull-Request: #3702.
This commit is contained in:
@ -2,8 +2,10 @@
|
||||
|
||||
- Raise MSRV to 1.65.
|
||||
See [PR 3715].
|
||||
- Remove deprecated items. See [PR 3702].
|
||||
|
||||
[PR 3715]: https://github.com/libp2p/rust-libp2p/pull/3715
|
||||
[PR 3702]: https://github.com/libp2p/rust-libp2p/pull/3702
|
||||
|
||||
## 0.42.0
|
||||
|
||||
|
@ -52,9 +52,6 @@ pub struct Config {
|
||||
/// connection is deemed unhealthy, indicating to the `Swarm` that it
|
||||
/// should be closed.
|
||||
max_failures: NonZeroU32,
|
||||
/// Whether the connection should generally be kept alive unless
|
||||
/// `max_failures` occur.
|
||||
keep_alive: bool,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@ -63,7 +60,6 @@ impl Config {
|
||||
/// * [`Config::with_interval`] 15s
|
||||
/// * [`Config::with_timeout`] 20s
|
||||
/// * [`Config::with_max_failures`] 1
|
||||
/// * [`Config::with_keep_alive`] false
|
||||
///
|
||||
/// These settings have the following effect:
|
||||
///
|
||||
@ -80,7 +76,6 @@ impl Config {
|
||||
timeout: Duration::from_secs(20),
|
||||
interval: Duration::from_secs(15),
|
||||
max_failures: NonZeroU32::new(1).expect("1 != 0"),
|
||||
keep_alive: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,25 +97,6 @@ impl Config {
|
||||
self.max_failures = n;
|
||||
self
|
||||
}
|
||||
|
||||
/// 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.
|
||||
#[deprecated(
|
||||
since = "0.40.0",
|
||||
note = "Use `libp2p::swarm::behaviour::KeepAlive` if you need to keep connections alive unconditionally."
|
||||
)]
|
||||
pub fn with_keep_alive(mut self, b: bool) -> Self {
|
||||
self.keep_alive = b;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@ -268,12 +244,8 @@ impl ConnectionHandler for Handler {
|
||||
fn on_behaviour_event(&mut self, _: Void) {}
|
||||
|
||||
fn connection_keep_alive(&self) -> KeepAlive {
|
||||
if self.config.keep_alive {
|
||||
KeepAlive::Yes
|
||||
} else {
|
||||
KeepAlive::No
|
||||
}
|
||||
}
|
||||
|
||||
fn poll(
|
||||
&mut self,
|
||||
|
@ -34,9 +34,6 @@
|
||||
//! The [`Behaviour`] network behaviour produces [`Event`]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
|
||||
//! > by default, see [`Config::with_keep_alive`] for changing this behaviour.
|
||||
//!
|
||||
//! [`Swarm`]: libp2p_swarm::Swarm
|
||||
//! [`Transport`]: libp2p_core::Transport
|
||||
|
||||
@ -58,24 +55,6 @@ use std::{
|
||||
task::{Context, Poll},
|
||||
};
|
||||
|
||||
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Config instead.")]
|
||||
pub type PingConfig = Config;
|
||||
|
||||
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Event instead.")]
|
||||
pub type PingEvent = Event;
|
||||
|
||||
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Success instead.")]
|
||||
pub type PingSuccess = Success;
|
||||
|
||||
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Failure instead.")]
|
||||
pub type PingFailure = Failure;
|
||||
|
||||
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Result instead.")]
|
||||
pub type PingResult = Result;
|
||||
|
||||
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Behaviour instead.")]
|
||||
pub type Ping = Behaviour;
|
||||
|
||||
pub use self::protocol::PROTOCOL_NAME;
|
||||
|
||||
/// The result of an inbound or outbound ping.
|
||||
|
Reference in New Issue
Block a user