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): remove rebinding #2083

Merged
merged 9 commits into from
Mar 18, 2024
Merged

refactor(iroh-net): remove rebinding #2083

merged 9 commits into from
Mar 18, 2024

Conversation

flub
Copy link
Contributor

@flub flub commented Mar 14, 2024

Description

This removes the rebinding functionality of the magicsocket. We did not use this functionality, it was incoherently implemented and thus very confusing what of it was still relevant or not. While there is some theoretical need for rebinding, it is cleaner to remove it all. The main casualty of this is the ability to set a preferred port, to this the answer is to ask to bind to the preferred port to start with, in the EndpointBuilder. The other casualties are some test which now can not be used anymore, they're not a great loss.

We still keep the behaviour of reacting to major network changes by resetting node path state and by pruning derp connections.

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates if relevant.
  • Tests if relevant.

When the network has changed we used to close all the derp connections
unconditionally.  This passes in the local endpoints information so
that the derp http actor will only close those derp connections for
which we no longer have the local endpoint.  That's a lot less
disruptive than always closing them.
We still handle major network changes, but we do not pretend to handle
rebinding anymore.

There are a few reasons and implications that I'll write up properly
tomorrow.
@flub flub marked this pull request as ready for review March 15, 2024 11:27
Base automatically changed from flub/local-endpoints-for-derp-rebind to main March 15, 2024 11:45
@@ -1869,15 +1826,6 @@ impl Actor {
inc!(MagicsockMetrics, update_endpoints);

debug!("starting endpoint update ({})", why);
if self.no_v4_send && !self.inner.is_closed() {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we error out here? seems in this case we are quite dead in the water

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe, yes. Probably should be done on receiving the netcheck report in that case to error if there's neither ipv4 or ipv6.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure there's anything for us to do really. Trying to send and receive data will result in an error at which point the application code has to give up on the magicsock like it would have with a normal socket.

The other option is to short-cut this into a fatal error that's propagated in .poll_send() or .poll_recv(), but it achieves just the same.

This keeps the logic more readable instead of having to get concerned
with the how.
@flub flub added this pull request to the merge queue Mar 18, 2024
Merged via the queue into main with commit 484e5e8 Mar 18, 2024
20 checks passed
@flub flub deleted the flub/remove-rebind branch October 4, 2024 08:50
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