Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unexpected Marking peer disconnected in DHT #6140

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion beacon_node/lighthouse_network/src/discovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,8 +1156,19 @@ impl<E: EthSpec> Discovery<E> {
fn on_dial_failure(&mut self, peer_id: Option<PeerId>, error: &DialError) {
if let Some(peer_id) = peer_id {
match error {
DialError::Denied { .. } => {
if self.network_globals.peers.read().is_connected(&peer_id) {
// There's an active connection, so we don’t disconnect the peer.
// Lighthouse dials to a peer twice using TCP and QUIC (if QUIC is not
// disabled). Usually, one establishes a connection, and the other fails
// because the peer allows only one connection per peer.
return;
}
// set peer as disconnected in discovery DHT
debug!(self.log, "Marking peer disconnected in DHT"; "peer_id" => %peer_id, "error" => %ClearDialError(error));
self.disconnect_peer(&peer_id);
jxs marked this conversation as resolved.
Show resolved Hide resolved
}
DialError::LocalPeerId { .. }
| DialError::Denied { .. }
| DialError::NoAddresses
| DialError::Transport(_)
| DialError::WrongPeerId { .. } => {
Expand Down
Loading