net/SocketDescriptor: SO_REUSEADDR is portable
This commit is contained in:
parent
d84dae488e
commit
d2cdaa041c
@ -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:
|
|||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user