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)!: Make netcheck::Client !Clone #2716

Merged
merged 3 commits into from
Sep 9, 2024

Conversation

flub
Copy link
Contributor

@flub flub commented Sep 6, 2024

Description

netcheck::Client owns the actor task and when dropped it will abort
the actor task. Making a struct owning a task Clone means it is easy
to lose track of who should be owning a task like this. I now believe
each task should have a clear supervisor/owner in charge of it.

This cleans up the multiple-ownership of the netcheck::Client, which
is just a small step into this direction. Later on, for e.g. #2647,
more supervision will be added. But small changes are good.

Breaking Changes

  • iroh_net::netcheck::Client::receive_stun_packet is no longer available.
  • iroh_net::netcheck::Client is not longer Clone.

Notes & open questions

I don't want to make Addr public, in fact I'd like all of netcheck to be
private. So I made some docs not links to avoid the warnings resulting to
linking to private items from public docs.

Removing Client::receive_stun_packet is a bit harsh. I'd like to make all
of netcheck private, but the cli uses it for the doctor so I'm a bit stuck.
In any case, the way that uses it does not need receive_stun_packet.

Change checklist

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

netcheck::Client owns the actor task and when dropped it will abort
the actor task.  Making a struct owning a task Clone means it is easy
to lose track of who should be owning a task like this.  I now believe
each task should have a clear supervisor/owner in charge of it.

This cleans up the multiple-ownership of the netcheck::Client, which
is just a small step into this direction.  Later on, for e.g. #2647,
more supervision will be added.  But small changes are good.
Copy link

github-actions bot commented Sep 6, 2024

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2716/docs/iroh/

Last updated: 2024-09-09T10:25:23Z

@flub flub changed the title refactor(iroh-net): Make netcheck::Client !Clone refactor(iroh-net)!: Make netcheck::Client !Clone Sep 6, 2024
inc!(NetcheckMetrics, stun_packets_dropped);
warn!("dropping stun packet from {}", src);
}
/// Unlike the client itself this does own the actor task, only allows sending messages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this reads odd

@flub flub enabled auto-merge September 9, 2024 10:25
@flub flub added this pull request to the merge queue Sep 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 9, 2024
@flub flub added this pull request to the merge queue Sep 9, 2024
Merged via the queue into main with commit ce2cfee Sep 9, 2024
27 of 28 checks passed
@flub flub deleted the flub/netcheck-client-no-clone branch September 9, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants