-
Notifications
You must be signed in to change notification settings - Fork 161
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
Conversation
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.
@@ -1869,15 +1826,6 @@ impl Actor { | |||
inc!(MagicsockMetrics, update_endpoints); | |||
|
|||
debug!("starting endpoint update ({})", why); | |||
if self.no_v4_send && !self.inner.is_closed() { |
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.
should we error out here? seems in this case we are quite dead in the water
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.
Maybe, yes. Probably should be done on receiving the netcheck report in that case to error if there's neither ipv4 or ipv6.
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.
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.
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