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

feat(net): disconnect from inactive nodes if necessary #5917

Closed

Conversation

317787106
Copy link
Contributor

@317787106 317787106 commented Jul 18, 2024

What does this PR do?

To maintain the stability of the network and prevent node isolation, the node needs to be disconnected from inactive nodes on a regular basis. Three strategies are adopted:

  1. If the node is in a LAN and the number of peers is greater than or equal to minConnection, disconnect from the earliest inactive peer that has been inactive for more than the threshold time.
  2. If the node is isolated, disconnect from one active peer if the active number is greater than or equal to minActiveConnection. At the same time, disconnect from some passive peers but ensure that the retention percentage of peers is greater than or equal to 80%.
  3. Optimize the random disconnect policy and only disconnect from the peer that has remained inactive for too long.

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@317787106 317787106 changed the base branch from develop to release_v4.7.6 July 18, 2024 07:54
@317787106 317787106 changed the base branch from release_v4.7.6 to develop July 18, 2024 08:02
@317787106 317787106 closed this Jul 18, 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