mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-13 18:11:22 +00:00
chore(ping): remove deprecated items
Related https://github.com/libp2p/rust-libp2p/issues/3647. Pull-Request: #3702.
This commit is contained in:
@ -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,11 +244,7 @@ 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
|
||||
}
|
||||
KeepAlive::No
|
||||
}
|
||||
|
||||
fn poll(
|
||||
|
Reference in New Issue
Block a user