net/SocketDescriptor: add method SetIntOption()

This commit is contained in:
Max Kellermann 2022-01-10 18:05:45 +01:00
parent aea4d3c4b0
commit 089a843abd

View File

@ -174,11 +174,14 @@ public:
bool SetOption(int level, int name,
const void *value, std::size_t size) noexcept;
bool SetBoolOption(int level, int name, bool _value) noexcept {
const int value = _value;
bool SetIntOption(int level, int name, const int &value) noexcept {
return SetOption(level, name, &value, sizeof(value));
}
bool SetBoolOption(int level, int name, bool value) noexcept {
return SetIntOption(level, name, value);
}
bool SetKeepAlive(bool value=true) noexcept;
bool SetReuseAddress(bool value=true) noexcept;