-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
core: Apply SO_REUSEPORT to UDP sockets #5725
Merged
Merged
Commits on Aug 9, 2023
-
core: Apply SO_REUSEPORT to UDP sockets
For some reason, 10 months ago when I implemented SO_REUSEPORT for TCP, I didn't realize, or forgot, that it can be used for UDP too. It is a much better solution than using deadline hacks to reuse a socket, at least for TCP. Then mholt/caddy-l4#132 was posted, in which we see that UDP servers never actually stopped when the L4 app was stopped. I verified this using this command: $ nc -u 127.0.0.1 55353 combined with POSTing configs to the /load admin endpoint (which alternated between an echo server and a proxy server so I could tell which config was being used). I refactored the code to use SO_REUSEPORT for UDP, but of course we still need graceful reloads on all platforms, not just Unix, so I also implemented a deadline hack similar to what we used for TCP before. That implementation for TCP was not perfect, possibly having a logical (not data) race condition; but for UDP so far it seems to be working. Verified the same way I verified that SO_REUSEPORT works. I think this code is slightly cleaner and I'm fairly confident this code is effective.
Configuration menu - View commit details
-
Copy full SHA for 06b24ed - Browse repository at this point
Copy the full SHA 06b24edView commit details -
Configuration menu - View commit details
-
Copy full SHA for 665e389 - Browse repository at this point
Copy the full SHA 665e389View commit details -
Configuration menu - View commit details
-
Copy full SHA for 056eb19 - Browse repository at this point
Copy the full SHA 056eb19View commit details -
Configuration menu - View commit details
-
Copy full SHA for ebd092c - Browse repository at this point
Copy the full SHA ebd092cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 30d3a2e - Browse repository at this point
Copy the full SHA 30d3a2eView commit details
Commits on Oct 12, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 4a88af4 - Browse repository at this point
Copy the full SHA 4a88af4View commit details
Commits on Oct 13, 2023
-
Configuration menu - View commit details
-
Copy full SHA for ea27801 - Browse repository at this point
Copy the full SHA ea27801View commit details -
Configuration menu - View commit details
-
Copy full SHA for 324d1a6 - Browse repository at this point
Copy the full SHA 324d1a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for d967980 - Browse repository at this point
Copy the full SHA d967980View commit details
Commits on Oct 16, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 80b3ce0 - Browse repository at this point
Copy the full SHA 80b3ce0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8162f5a - Browse repository at this point
Copy the full SHA 8162f5aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 348067c - Browse repository at this point
Copy the full SHA 348067cView commit details
Commits on Oct 17, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 3cd28ed - Browse repository at this point
Copy the full SHA 3cd28edView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7f96635 - Browse repository at this point
Copy the full SHA 7f96635View commit details
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.