From cb06ecfbcf479b8f6b52ec24f5bd6176930aecfc Mon Sep 17 00:00:00 2001 From: Radu Racariu Date: Mon, 11 Feb 2019 15:42:42 +0200 Subject: [PATCH] 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. --- source/eventcore/drivers/posix/sockets.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/eventcore/drivers/posix/sockets.d b/source/eventcore/drivers/posix/sockets.d index c647975..76d93f1 100644 --- a/source/eventcore/drivers/posix/sockets.d +++ b/source/eventcore/drivers/posix/sockets.d @@ -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; }