-
Notifications
You must be signed in to change notification settings - Fork 163
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(iroh-net): Keep connection name, remove connection count #2779
Conversation
These are two cleanups in the relay client: - The `relay::Client` hands out a connection object when asked to connect. This `Conn` was imported with rename to `RelayClient` which was a bit confusing as this was already the relay client. It is now renamed to `RelayConn` which makes a lot more sense. The related builder struct etc are renamed to match. - The `relay::Client` had a counter for the number of connections made to the relay. That seems fun, but was entirely unused. If this is a useful thing to have it should probably be a counter metric instead but let's not add anything that no one is using. Removing this makes a lot of APIs a bit simpler and removes some state tracking.
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2779/docs/iroh/ Last updated: 2024-10-03T17:23:49Z |
Co-authored-by: Divma <26765164+divagant-martian@users.noreply.github.com>
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.
LGTM!
Don't want to get nitpicky so do as you wish: There are still many variables named client when doing relay_conn.method()
like take
, as_ref
etc. I find it understandable enough to leave it like that, just slightly cleaner to change it
Your nitpicking is totally right, might as well try and do this more consistent because it does make it more readable. But yeah, I was moving on as I wanted to get to the actual bugfix I was aiming for at the end of this chain of PRs. PTAL |
## Description The ActiveRelay actor keeps track of which remote nodes are present on the relay connection so that we can optimise relay connections to remote nodes. This does two main optimisations: - There were two sets of these nodes kept, they could easily be unified. - The set is best stored in a BTreeSet since they are simple NodeIds stored in them. - Bonus: rename peer to node to match our naming convention. - Bonus: identify nodes by NodeId since this is a routing key here. ## Breaking Changes Still none if all is well. ## Notes & open questions This targets #2779 as base. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - ~~[ ] Tests if relevant.~~ - ~~[ ] All breaking changes documented.~~ --------- Co-authored-by: Divma <26765164+divagant-martian@users.noreply.github.com>
Description
These are two cleanups in the relay client:
The
relay::Client
hands out a connection object when asked toconnect. This
Conn
was imported with rename toRelayClient
which was a bit confusing as this was already the relay client. It
is now left at it's original name which makes a lot more sense. The
related builder struct etc are renamed to match.
The
relay::Client
had a counter for the number of connections madeto the relay. That seems fun, but was entirely unused. If this is
a useful thing to have it should probably be a counter metric
instead but let's not add anything that no one is using. Removing
this makes a lot of APIs a bit simpler and removes some state
tracking.
Breaking Changes
None hopefully, please let this all be internal APIs.
Notes & open questions
Change checklist
[ ] All breaking changes documented.