refactor(iroh-net)!: Make netcheck::Client !Clone #2716
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 longerClone
.Notes & open questions
I don't want to make
Addr
public, in fact I'd like all of netcheck to beprivate. 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 allof 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
[ ] Tests if relevant.[ ] All breaking changes documented.