Skip to content

Commit 5a867c8

Browse files
authored
chore(ping): remove deprecated items
Related #3647. Pull-Request: #3702.
1 parent 3ee1856 commit 5a867c8

File tree

3 files changed

+3
-50
lines changed

3 files changed

+3
-50
lines changed

protocols/ping/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
- Raise MSRV to 1.65.
44
See [PR 3715].
5+
- Remove deprecated items. See [PR 3702].
56

67
[PR 3715]: https://github.com/libp2p/rust-libp2p/pull/3715
8+
[PR 3702]: https://github.com/libp2p/rust-libp2p/pull/3702
79

810
## 0.42.0
911

protocols/ping/src/handler.rs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ pub struct Config {
5252
/// connection is deemed unhealthy, indicating to the `Swarm` that it
5353
/// should be closed.
5454
max_failures: NonZeroU32,
55-
/// Whether the connection should generally be kept alive unless
56-
/// `max_failures` occur.
57-
keep_alive: bool,
5855
}
5956

6057
impl Config {
@@ -63,7 +60,6 @@ impl Config {
6360
/// * [`Config::with_interval`] 15s
6461
/// * [`Config::with_timeout`] 20s
6562
/// * [`Config::with_max_failures`] 1
66-
/// * [`Config::with_keep_alive`] false
6763
///
6864
/// These settings have the following effect:
6965
///
@@ -80,7 +76,6 @@ impl Config {
8076
timeout: Duration::from_secs(20),
8177
interval: Duration::from_secs(15),
8278
max_failures: NonZeroU32::new(1).expect("1 != 0"),
83-
keep_alive: false,
8479
}
8580
}
8681

@@ -102,25 +97,6 @@ impl Config {
10297
self.max_failures = n;
10398
self
10499
}
105-
106-
/// Sets whether the ping protocol itself should keep the connection alive,
107-
/// apart from the maximum allowed failures.
108-
///
109-
/// By default, the ping protocol itself allows the connection to be closed
110-
/// at any time, i.e. in the absence of ping failures the connection lifetime
111-
/// is determined by other protocol handlers.
112-
///
113-
/// If the maximum number of allowed ping failures is reached, the
114-
/// connection is always terminated as a result of [`ConnectionHandler::poll`]
115-
/// returning an error, regardless of the keep-alive setting.
116-
#[deprecated(
117-
since = "0.40.0",
118-
note = "Use `libp2p::swarm::behaviour::KeepAlive` if you need to keep connections alive unconditionally."
119-
)]
120-
pub fn with_keep_alive(mut self, b: bool) -> Self {
121-
self.keep_alive = b;
122-
self
123-
}
124100
}
125101

126102
impl Default for Config {
@@ -268,11 +244,7 @@ impl ConnectionHandler for Handler {
268244
fn on_behaviour_event(&mut self, _: Void) {}
269245

270246
fn connection_keep_alive(&self) -> KeepAlive {
271-
if self.config.keep_alive {
272-
KeepAlive::Yes
273-
} else {
274-
KeepAlive::No
275-
}
247+
KeepAlive::No
276248
}
277249

278250
fn poll(

protocols/ping/src/lib.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
//! The [`Behaviour`] network behaviour produces [`Event`]s, which may be consumed from the [`Swarm`]
3535
//! by an application, e.g. to collect statistics.
3636
//!
37-
//! > **Note**: The ping protocol does not keep otherwise idle connections alive
38-
//! > by default, see [`Config::with_keep_alive`] for changing this behaviour.
39-
//!
4037
//! [`Swarm`]: libp2p_swarm::Swarm
4138
//! [`Transport`]: libp2p_core::Transport
4239
@@ -58,24 +55,6 @@ use std::{
5855
task::{Context, Poll},
5956
};
6057

61-
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Config instead.")]
62-
pub type PingConfig = Config;
63-
64-
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Event instead.")]
65-
pub type PingEvent = Event;
66-
67-
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Success instead.")]
68-
pub type PingSuccess = Success;
69-
70-
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Failure instead.")]
71-
pub type PingFailure = Failure;
72-
73-
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Result instead.")]
74-
pub type PingResult = Result;
75-
76-
#[deprecated(since = "0.39.1", note = "Use libp2p::ping::Behaviour instead.")]
77-
pub type Ping = Behaviour;
78-
7958
pub use self::protocol::PROTOCOL_NAME;
8059

8160
/// The result of an inbound or outbound ping.

0 commit comments

Comments
 (0)