Skip to content

Commit

Permalink
Merge pull request #2719 from maqi/fix_incomingconnectionerror_handling
Browse files Browse the repository at this point in the history
fix(node): avoid duplicate handling of IncomingConnectionError
  • Loading branch information
maqi authored Feb 7, 2025
2 parents c966fb2 + 27caa1f commit f941eed
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ant-networking/src/event/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ impl SwarmDriver {
// And since we don't do anything critical with this event, the order and time of processing is
// not critical.
if self.is_incoming_connection_error_valid(connection_id, &send_back_addr) {
error!("IncomingConnectionError from local_addr:?{local_addr:?}, send_back_addr {send_back_addr:?} on {connection_id:?} with error {error:?}");
error!("IncomingConnectionError Valid from local_addr:?{local_addr:?}, send_back_addr {send_back_addr:?} on {connection_id:?} with error {error:?}");

// This is best approximation that we can do to prevent harmless errors from affecting the external
// address health.
Expand All @@ -422,16 +422,14 @@ impl SwarmDriver {
.on_incoming_connection_error(local_addr.clone(), &mut self.swarm);
}
} else {
debug!("IncomingConnectionError from local_addr:?{local_addr:?}, send_back_addr {send_back_addr:?} on {connection_id:?} with error {error:?}");
}
if let Some(external_addr_manager) = self.external_address_manager.as_mut() {
external_addr_manager
.on_incoming_connection_error(local_addr.clone(), &mut self.swarm);
debug!("IncomingConnectionError InValid from local_addr:?{local_addr:?}, send_back_addr {send_back_addr:?} on {connection_id:?} with error {error:?}");
}

#[cfg(feature = "open-metrics")]
if let Some(relay_manager) = self.relay_manager.as_mut() {
relay_manager.on_incomming_connection_error(&send_back_addr, &connection_id);
}

let _ = self.live_connected_peers.remove(&connection_id);
self.record_connection_metrics();
}
Expand Down

0 comments on commit f941eed

Please sign in to comment.