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

Temporarily ban peers after failing to connect to them #2747

Merged
merged 5 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions bin/full-node/src/run/network_service/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ pub(super) async fn opening_connection_task(
let mut guarded = inner.guarded.lock().await;
guarded.num_pending_out_attempts -= 1;
guarded.network.pending_outcome_err(start_connect.id, true);
for chain_index in 0..guarded.network.num_chains() {
guarded.unassign_slot_and_ban(chain_index, start_connect.expected_peer_id.clone());
}
inner.wake_up_main_background_task.notify(1);
return;
}
Expand Down
4 changes: 4 additions & 0 deletions bin/light-base/src/network_service/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ pub(super) async fn connection_task<TPlat: Platform>(
err.map_or(false, |err| err.is_bad_addr),
); // TODO: should pass a proper value for `is_unreachable`, but an error is sometimes returned despite a timeout https://github.com/paritytech/smoldot/issues/1531

for chain_index in 0..guarded.network.num_chains() {
guarded.unassign_slot_and_ban(chain_index, start_connect.expected_peer_id.clone());
}

// We wake up the background task so that the slot can potentially be
// assigned to a different peer.
shared.wake_up_main_background_task.notify(1);
Expand Down
4 changes: 4 additions & 0 deletions bin/wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Changed

- No longer try to connect to a peer for 20 seconds after failing to connect to it.

## 0.6.33 - 2022-09-13

### Added
Expand Down