Skip to content

p2p: no peer reconnect if explicitly disconnected#2115

Merged
zzzckck merged 1 commit intobnb-chain:developfrom
weiihann:develop/explicit-disc
Jan 8, 2024
Merged

p2p: no peer reconnect if explicitly disconnected#2115
zzzckck merged 1 commit intobnb-chain:developfrom
weiihann:develop/explicit-disc

Conversation

@weiihann
Copy link
Copy Markdown
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
Copy Markdown
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
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