-
Notifications
You must be signed in to change notification settings - Fork 999
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
fix(swarm): keep connections alive while active streams exist #4595
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial thoughts, thank you for getting this started!
Before we keep on going with the implementation for too long, I'd like us to update the docs on ConnectionHandler::connection_keep_alive
to reflect what we are changing here. If you give that a start, it will show up in the diff and I can help out with some comments :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great progress!
Now, to check that this actually works, we need to go through all implementations of ConnectionHandler
and remove any code that currently duplicates this kind of stream tracking.
For example here:
rust-libp2p/protocols/identify/src/handler.rs
Lines 317 to 323 in 7d1d67c
fn connection_keep_alive(&self) -> KeepAlive { | |
if !self.active_streams.is_empty() { | |
return KeepAlive::Yes; | |
} | |
KeepAlive::No | |
} |
This is now unnecessary and can just return KeepAlive::No
.
This pull request has merge conflicts. Could you please resolve them @leonzchang? 🙏 |
8f26fed
to
b98be2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great progress!
This pull request has merge conflicts. Could you please resolve them @leonzchang? 🙏 |
c931771
to
67750db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the follow-up changes!
Whilst I think we can overall merge these changes (modulo new comments), it would be much cleaner if we'd get rid of KeepAlive::Until
first. See #3844. Are you interested in helping out on that front too? :)
Do you mean remove |
This pull request has merge conflicts. Could you please resolve them @leonzchang? 🙏 |
@mxinden Would be great to get your opinion here. We can merge this early by only removing the conditions for stream checks in the protocols where we no longer use I am tempted to do that because it just means that we are doing the bookkeeping twice but it doesn't hurt. We can always remove it at a later stage. |
78394dc
to
71f3bc1
Compare
This pull request has merge conflicts. Could you please resolve them @leonzchang? 🙏 |
5c272d8
to
5bf6f0d
Compare
rebase master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great progress!
I've left a few more comments. Hope you don't mind :)
Also, if you are interested, we maintainers will meet later today: #4713. If you want, you can present your work here or also just listen in :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the docs a bit. This is ready from my end, thank you so much for helping out with this! I am super stoked to land this 🎉
@mxinden Please have a look!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of simplifications! Well done. Thanks. Also great work on the documentation.
I have a couple of comments. I am sorry in case these have been discussed before.
This pull request has merge conflicts. Could you please resolve them @leonzchang? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done!
@romanb you might enjoy seeing your proposal from a couple of years ago finally implemented. |
Description
Resolves: #4520.
Related: #4306.
Notes & open questions
Much thanks to @thomaseizinger for the advices!
Change checklist