Skip to content

Commit

Permalink
fix(networking): don't report ConnectionIssues during initial bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuef committed Apr 2, 2024
1 parent 3e6be4d commit 430dfcd
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions sn_networking/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,29 @@ impl SwarmDriver {
"HostUnreachable",
"HandshakeTimedOut",
];
// It is really difficult to match this error, due to being eg:
// Custom { kind: Other, error: Left(Left(Os { code: 61, kind: ConnectionRefused, message: "Connection refused" })) }
// if we can match that, let's. But meanwhile we'll check the message
let error_msg = format!("{err:?}");
if problematic_errors.iter().any(|err| error_msg.contains(err))

let is_bootstrap_peer = self
.bootstrap_peers
.iter()
.any(|(_ilog2, peers)| peers.contains(&failed_peer_id));

if is_bootstrap_peer
&& self.connected_peers < self.bootstrap_peers.len()
{
warn!("Problematic error encountered: {error_msg}");
there_is_a_serious_issue = true;
warn!("OutgoingConnectionError: On bootstrap peer {failed_peer_id:?}, while still in bootstrap mode, ignoring");
there_is_a_serious_issue = false;
} else {
// It is really difficult to match this error, due to being eg:
// Custom { kind: Other, error: Left(Left(Os { code: 61, kind: ConnectionRefused, message: "Connection refused" })) }
// if we can match that, let's. But meanwhile we'll check the message
let error_msg = format!("{err:?}");
if problematic_errors
.iter()
.any(|err| error_msg.contains(err))
{
warn!("Problematic error encountered: {error_msg}");
there_is_a_serious_issue = true;
}
}
}
}
Expand Down

0 comments on commit 430dfcd

Please sign in to comment.