net/SocketDescriptor: SO_REUSEADDR is portable

This commit is contained in:
Max Kellermann 2017-08-10 13:23:14 +02:00
parent d84dae488e
commit d2cdaa041c
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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);