Skip to content

Commit

Permalink
fix peer_id not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
hansieodendaal committed Nov 7, 2024
1 parent 3b2d010 commit 946e864
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions base_layer/wallet/src/connectivity_service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ impl WalletConnectivityService {

async fn setup_base_node_connection(&mut self, mut peer_manager: BaseNodePeerManager) {
let mut peer = peer_manager.select_next_peer_if_attempted().clone();
let peer_id = peer.peer_id();

loop {
self.set_online_status(OnlineStatus::Connecting);
Expand Down Expand Up @@ -340,26 +339,26 @@ impl WalletConnectivityService {
return;
},
};
self.disconnect_base_node(peer_id).await;
self.disconnect_base_node(peer.peer_id()).await;
self.set_online_status(OnlineStatus::Offline);
continue;
},
Err(WalletConnectivityError::DialError(DialError::Aborted)) => {
debug!(target: LOG_TARGET, "Dial was cancelled.");
self.disconnect_base_node(peer_id).await;
self.disconnect_base_node(peer.peer_id()).await;
self.set_online_status(OnlineStatus::Offline);
},
Err(e) => {
warn!(target: LOG_TARGET, "{}", e);
self.disconnect_base_node(peer_id).await;
self.disconnect_base_node(peer.peer_id()).await;
self.set_online_status(OnlineStatus::Offline);
},
}

// Select the next peer (if available)
let next_peer = peer_manager.select_next_peer().clone();
// If we only have one peer in the list, wait a bit before retrying
if peer_id == next_peer.peer_id() {
if peer.peer_id() == next_peer.peer_id() {
debug!(target: LOG_TARGET,
"Only single peer in base node peer list. Waiting {}s before retrying again ...",
CONNECTIVITY_WAIT.as_secs()
Expand Down

0 comments on commit 946e864

Please sign in to comment.