Commit d2cdaa04 authored by Max Kellermann's avatar Max Kellermann

net/SocketDescriptor: SO_REUSEADDR is portable

parent d84dae48
...@@ -206,14 +206,14 @@ SocketDescriptor::SetOption(int level, int name, ...@@ -206,14 +206,14 @@ SocketDescriptor::SetOption(int level, int name,
return setsockopt(fd, level, name, (const char *)value, size) == 0; return setsockopt(fd, level, name, (const char *)value, size) == 0;
} }
#ifdef __linux__
bool bool
SocketDescriptor::SetReuseAddress(bool value) SocketDescriptor::SetReuseAddress(bool value)
{ {
return SetBoolOption(SOL_SOCKET, SO_REUSEADDR, value); return SetBoolOption(SOL_SOCKET, SO_REUSEADDR, value);
} }
#ifdef __linux__
#ifdef SO_REUSEPORT #ifdef SO_REUSEPORT
bool bool
......
...@@ -141,8 +141,9 @@ public: ...@@ -141,8 +141,9 @@ public:
return SetOption(level, name, &value, sizeof(value)); return SetOption(level, name, &value, sizeof(value));
} }
#ifdef __linux__
bool SetReuseAddress(bool value=true); bool SetReuseAddress(bool value=true);
#ifdef __linux__
bool SetReusePort(bool value=true); bool SetReusePort(bool value=true);
bool SetFreeBind(bool value=true); bool SetFreeBind(bool value=true);
bool SetNoDelay(bool value=true); bool SetNoDelay(bool value=true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment