You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
instead of setting (or trying to) both options, it should be a try/fail-safe scenario. We should try to set SO_REUSEPORT and if that fails, try to set SO_REUSEADDR. The current approach seems a bit redundant. Imo, it should look something like this,
The TLDR is set both to ensure everything works as expected. A relevant snippet from that answer is:
There is not much more to say about SO_REUSEPORT other than that it was added later than SO_REUSEADDR, that's why you will not find it in many socket implementations of other systems, which "forked" the BSD code before this option was added, and that there was no way to bind two sockets to exactly the same socket address in BSD prior to this option.
I do understand that SO_REUSEPORT doesn't exist on some systems, which is why I suggested trying to set it and then setting SO_REUSEADDR if it errors out.
If my understanding is correct, SO_REUSEPORT will be the desired behaviour 99.9% of the time. In
control_unix.go
, for the following codeinstead of setting (or trying to) both options, it should be a try/fail-safe scenario. We should try to set
SO_REUSEPORT
and if that fails, try to setSO_REUSEADDR
. The current approach seems a bit redundant. Imo, it should look something like this,The text was updated successfully, but these errors were encountered: