From 089a843abd7ef0b5b6a4d0af6ca6ad305dee5c16 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 10 Jan 2022 18:05:45 +0100 Subject: [PATCH] net/SocketDescriptor: add method SetIntOption() --- src/net/SocketDescriptor.hxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/net/SocketDescriptor.hxx b/src/net/SocketDescriptor.hxx index 960a621af..e1bbea5c6 100644 --- a/src/net/SocketDescriptor.hxx +++ b/src/net/SocketDescriptor.hxx @@ -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;