@@ -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
6057impl 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
126102impl 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 (
0 commit comments