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

p2p: no peer reconnect if explicitly disconnected #2115

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

weiihann
Copy link
Contributor

@weiihann weiihann commented Dec 27, 2023

Description

This PR adds a feature to stop reconnecting to peers that were explicitly disconnected (i.e. using admin_removePeer).

Rationale

In some cases when we run a cluster of nodes, we would want to avoid those nodes connecting to the same peers. Hence, we would do admin_removePeer) to disconnect the connections. However, the reality is that peers get reconnected almost immediately after executing admin_removePeer, as shown in the graph below:

image

Hence, this feature will put a restriction on the explicitly removed peers such that their connections are not accepted unless the node is restarted.

Changes

Notable changes:

  • add disconnectEnodeSet in the Server struct
  • add new condition check in Server.addPeerChecks

Copy link
Collaborator

@zzzckck zzzckck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zzzckck zzzckck merged commit 5853329 into bnb-chain:develop Jan 8, 2024
5 checks passed
weiihann added a commit to weiihann/bsc that referenced this pull request Jan 10, 2024
sysvm pushed a commit to sysvm/bsc that referenced this pull request Jan 22, 2024
@zzzckck zzzckck mentioned this pull request Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants