mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-24 06:59:36 -05:00
fix: review comments from binarybaron
This commit is contained in:
parent
dc68344b62
commit
7838442947
@ -43,6 +43,7 @@ pub async fn list_sellers(
|
|||||||
.behaviour_mut()
|
.behaviour_mut()
|
||||||
.quote
|
.quote
|
||||||
.add_address(&rendezvous_node_peer_id, rendezvous_node_addr.clone());
|
.add_address(&rendezvous_node_peer_id, rendezvous_node_addr.clone());
|
||||||
|
|
||||||
swarm
|
swarm
|
||||||
.dial(DialOpts::from(rendezvous_node_peer_id))
|
.dial(DialOpts::from(rendezvous_node_peer_id))
|
||||||
.context("Failed to dial rendezvous node")?;
|
.context("Failed to dial rendezvous node")?;
|
||||||
@ -162,15 +163,17 @@ impl EventLoop {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
let address = endpoint.get_remote_address();
|
let address = endpoint.get_remote_address();
|
||||||
|
tracing::debug!(%peer_id, %address, "Connection established to peer");
|
||||||
self.reachable_asb_address.insert(peer_id, address.clone());
|
self.reachable_asb_address.insert(peer_id, address.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SwarmEvent::OutgoingConnectionError { peer_id, error } => {
|
SwarmEvent::OutgoingConnectionError { peer_id, error } => {
|
||||||
if let Some(peer_id_from_error) = peer_id {
|
if let Some(peer_id) = peer_id {
|
||||||
if peer_id_from_error == self.rendezvous_peer_id {
|
if peer_id == self.rendezvous_peer_id {
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
"Failed to connect to rendezvous point at {}: {}",
|
%peer_id,
|
||||||
&self.rendezvous_addr,
|
%self.rendezvous_addr,
|
||||||
|
"Failed to connect to rendezvous point: {}",
|
||||||
error
|
error
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -178,30 +181,23 @@ impl EventLoop {
|
|||||||
return Vec::new();
|
return Vec::new();
|
||||||
} else {
|
} else {
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
"You connected to the wrong Peer: {} Error: {}",
|
%peer_id,
|
||||||
&peer_id_from_error,
|
"Failed to connect to peer: {}",
|
||||||
error
|
error
|
||||||
);
|
);
|
||||||
// if for some reason the peer is not the same it will return empty too.
|
self.unreachable_asb_address.insert(peer_id, Multiaddr::empty());
|
||||||
// this is just for the CLI to not get stuck
|
|
||||||
return Vec::new();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tracing::debug!(
|
|
||||||
"Failed to connect to peer at {}: {}",
|
|
||||||
&self.rendezvous_addr,
|
|
||||||
error
|
|
||||||
);
|
|
||||||
self.unreachable_asb_address.insert(self.rendezvous_peer_id, self.rendezvous_addr.clone());
|
|
||||||
|
|
||||||
match self.asb_quote_status.entry(self.rendezvous_peer_id) {
|
match self.asb_quote_status.entry(peer_id) {
|
||||||
Entry::Occupied(mut entry) => {
|
Entry::Occupied(mut entry) => {
|
||||||
entry.insert(QuoteStatus::Received(Status::Unreachable));
|
entry.insert(QuoteStatus::Received(Status::Unreachable));
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
tracing::debug!(%self.rendezvous_peer_id, %error, "Connection error with unexpected peer")
|
tracing::debug!(%peer_id, %error, "Connection error with unexpected peer");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
tracing::debug!("Failed to connect (no peer id): {}", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SwarmEvent::Behaviour(OutEvent::Rendezvous(
|
SwarmEvent::Behaviour(OutEvent::Rendezvous(
|
||||||
|
Loading…
Reference in New Issue
Block a user