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(iroh-net): Keep connection name, remove connection count #2779

Merged
merged 7 commits into from
Oct 3, 2024

Conversation

flub
Copy link
Contributor

@flub flub commented Oct 3, 2024

Description

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 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 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.

Breaking Changes

None hopefully, please let this all be internal APIs.

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • [ ] All breaking changes documented.

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.
Copy link

github-actions bot commented Oct 3, 2024

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

Copy link

github-actions bot commented Oct 3, 2024

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: e1e94a8

@flub flub requested a review from ramfox October 3, 2024 10:40
iroh-net/src/relay/client.rs Outdated Show resolved Hide resolved
iroh-net/src/relay/client.rs Outdated Show resolved Hide resolved
iroh-net/src/relay/client.rs Outdated Show resolved Hide resolved
iroh-net/src/relay/client.rs Outdated Show resolved Hide resolved
iroh-net/src/relay/client.rs Outdated Show resolved Hide resolved
iroh-net/src/relay/client.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@divagant-martian divagant-martian left a 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

@flub
Copy link
Contributor Author

flub commented Oct 3, 2024

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

@divagant-martian divagant-martian added this pull request to the merge queue Oct 3, 2024
Merged via the queue into main with commit 6b1186f Oct 3, 2024
28 checks passed
@flub flub deleted the flub/relay-client-cleanup-1 branch October 3, 2024 17:57
github-merge-queue bot pushed a commit that referenced this pull request Oct 3, 2024
## 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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants