From d2cdaa041cf9759f7e133663beab505ccee8e05a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 10 Aug 2017 13:23:14 +0200 Subject: [PATCH] net/SocketDescriptor: SO_REUSEADDR is portable --- src/net/SocketDescriptor.cxx | 4 ++-- src/net/SocketDescriptor.hxx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/net/SocketDescriptor.cxx b/src/net/SocketDescriptor.cxx index e0cf9d56a..9a3b97c9d 100644 --- a/src/net/SocketDescriptor.cxx +++ b/src/net/SocketDescriptor.cxx @@ -206,14 +206,14 @@ SocketDescriptor::SetOption(int level, int name, return setsockopt(fd, level, name, (const char *)value, size) == 0; } -#ifdef __linux__ - bool SocketDescriptor::SetReuseAddress(bool value) { return SetBoolOption(SOL_SOCKET, SO_REUSEADDR, value); } +#ifdef __linux__ + #ifdef SO_REUSEPORT bool diff --git a/src/net/SocketDescriptor.hxx b/src/net/SocketDescriptor.hxx index d439e7068..33785cd8c 100644 --- a/src/net/SocketDescriptor.hxx +++ b/src/net/SocketDescriptor.hxx @@ -141,8 +141,9 @@ public: return SetOption(level, name, &value, sizeof(value)); } -#ifdef __linux__ bool SetReuseAddress(bool value=true); + +#ifdef __linux__ bool SetReusePort(bool value=true); bool SetFreeBind(bool value=true); bool SetNoDelay(bool value=true);