From db6c08846c23076b0d2820f8a63d83aded1887f8 Mon Sep 17 00:00:00 2001 From: Stanimal Date: Wed, 9 Feb 2022 08:50:53 +0400 Subject: [PATCH] fix for case tested by it_gracefully_handles_connect_fail_reconnect --- .../wallet/src/connectivity_service/service.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/base_layer/wallet/src/connectivity_service/service.rs b/base_layer/wallet/src/connectivity_service/service.rs index 24cbf7ddd4..4122f9acea 100644 --- a/base_layer/wallet/src/connectivity_service/service.rs +++ b/base_layer/wallet/src/connectivity_service/service.rs @@ -116,12 +116,21 @@ impl WalletConnectivityService { } async fn check_connection(&mut self) { - if let Some(pool) = self.pools.as_ref() { - if !pool.base_node_wallet_rpc_client.is_connected().await { - debug!(target: LOG_TARGET, "Peer connection lost. Attempting to reconnect..."); + debug!(target: LOG_TARGET, "HERE1"); + match self.pools.as_ref() { + Some(pool) => { + debug!(target: LOG_TARGET, "HERE2"); + if !pool.base_node_wallet_rpc_client.is_connected().await { + debug!(target: LOG_TARGET, "Peer connection lost. Attempting to reconnect..."); + self.set_online_status(OnlineStatus::Offline); + self.setup_base_node_connection().await; + } + }, + None => { + debug!(target: LOG_TARGET, "No connection. Attempting to connect..."); self.set_online_status(OnlineStatus::Offline); self.setup_base_node_connection().await; - } + }, } }