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

Refactor connection management #990

Open
youngjoon-lee opened this issue Jan 21, 2025 · 0 comments · May be fixed by #989
Open

Refactor connection management #990

youngjoon-lee opened this issue Jan 21, 2025 · 0 comments · May be fixed by #989
Assignees
Labels
Milestone

Comments

@youngjoon-lee
Copy link
Contributor

The current implementation of connection maintenance in Blend protocol is cumbersome.

  • We actually don't need to handle the connection monitoring result of 'all' connected peers in bulk. It's hard to deal with bulk results and the code is not readable. Each peer can be monitored individually in the ConnectionHandler level (not Behaviour level as the current), and the result can be reported to the Behaviour individually.
  • We shouldn't close connections proactively by the Behaviour, because the connections are shared by all Behaviours that share a Swarm (though we have only one Behaviour in the blend service). Instead, the ConnectionHandler drops a stream from memory if necessary. Then, the Swarm will close the connection eventually if there is no active stream. It makes more sense because we planned to move the connection monitoring into the ConnectionHandler as I mentioned at the first bullet point above. The ConnectionHandler can make a right decision to drop the stream if the peer is detected as malicious.
  • The Behaviour doesn't need to hold a Membership. Instead, it can just notify the Backend how many new connections it needs. Then, the Backend can choose random peers and request the Swarm to dial them. Since we don't clearly know how to handle membership updates in the future, it would be better to keep membership inside the Backend where we have more control.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant