diff --git a/common/client-libs/multi-tcp-client/src/connection_manager/mod.rs b/common/client-libs/multi-tcp-client/src/connection_manager/mod.rs index c1728bad74..0cb5cd3951 100644 --- a/common/client-libs/multi-tcp-client/src/connection_manager/mod.rs +++ b/common/client-libs/multi-tcp-client/src/connection_manager/mod.rs @@ -121,7 +121,7 @@ impl<'a> ConnectionManager<'static> { async fn handle_new_message(&mut self, msg: Vec) -> io::Result<()> { if let ConnectionState::Reconnecting(conn_reconnector) = &mut self.state { // do a single poll rather than await for future to completely resolve - let new_connection = match futures::poll!(conn_reconnector) { + let new_connection = match futures::poll(conn_reconnector).await { Poll::Pending => { return Err(io::Error::new( io::ErrorKind::BrokenPipe, diff --git a/common/client-libs/multi-tcp-client/src/connection_manager/reconnector.rs b/common/client-libs/multi-tcp-client/src/connection_manager/reconnector.rs index f3a14fc6ce..32dd5ad373 100644 --- a/common/client-libs/multi-tcp-client/src/connection_manager/reconnector.rs +++ b/common/client-libs/multi-tcp-client/src/connection_manager/reconnector.rs @@ -71,7 +71,6 @@ impl<'a> Future for ConnectionReconnector<'a> { "we failed to re-establish connection to {} - {:?} (attempt {})", self.address, e, self.current_retry_attempt ); - self.current_retry_attempt += 1; // we failed to re-establish connection - continue exponential backoff @@ -95,6 +94,7 @@ impl<'a> Future for ConnectionReconnector<'a> { self.current_backoff_delay.reset(next); self.connection = tokio::net::TcpStream::connect(self.address).boxed(); + self.current_retry_attempt += 1; Poll::Pending } diff --git a/common/client-libs/multi-tcp-client/src/lib.rs b/common/client-libs/multi-tcp-client/src/lib.rs index 30a4c6da90..4d967f1431 100644 --- a/common/client-libs/multi-tcp-client/src/lib.rs +++ b/common/client-libs/multi-tcp-client/src/lib.rs @@ -60,8 +60,8 @@ impl Client { runtime_handle: Handle::try_current() .expect("The client MUST BE used within tokio runtime context"), connections_managers: HashMap::new(), - initial_reconnection_backoff: config.maximum_reconnection_backoff, - maximum_reconnection_backoff: config.initial_reconnection_backoff, + initial_reconnection_backoff: config.initial_reconnection_backoff, + maximum_reconnection_backoff: config.maximum_reconnection_backoff, initial_connection_timeout: config.initial_connection_timeout, } }