|
|
|
|
|
by qhwudbebd
563 days ago
|
|
Confusingly, on FreeBSD this option is SO_REUSEPORT_LB; SO_REUSEPORT is something different. So I find myself writing #if defined SO_REUSEPORT_LB
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT_LB, &(int) { 1 }, sizeof(int));
#elif defined SO_REUSEPORT
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &(int) { 1 }, sizeof(int));
#else
[do something to avoid reusing sockets]
#endif
when I want to use this feature. |
|
The LB variant was added in only 2017:
* https://reviews.freebsd.org/D11003
SO_REUSEPORT has been around since 4.4BSD:
* https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion...
SO_REUSEPORT was added to Linux in ~2013:
* https://lwn.net/Articles/542629/