Skip to content

Commit

Permalink
fix for case tested by it_gracefully_handles_connect_fail_reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Feb 9, 2022
1 parent b1a6b5f commit db6c088
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions base_layer/wallet/src/connectivity_service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
},
}
}

Expand Down

0 comments on commit db6c088

Please sign in to comment.