don't try to set the SO_REUSEPORT flag

On Linux this option was always set, regardless if the `StreamListenOptions` specifies it.

On some systems setting that option will result in a failure.
This commit is contained in:
Radu Racariu 2019-02-11 15:42:42 +02:00 committed by GitHub
parent 36f43690c6
commit cb06ecfbcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -220,7 +220,7 @@ final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets
() @trusted {
int tmp_reuse = 1;
// FIXME: error handling!
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &tmp_reuse, tmp_reuse.sizeof) != 0) {
if ((options & StreamListenOptions.reusePort) && setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &tmp_reuse, tmp_reuse.sizeof) != 0) {
invalidateSocket();
return;
}