]> granicus.if.org Git - icinga2/commitdiff
TcpSocket#Bind(): also set SO_REUSEPORT 6901/head
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Thu, 17 Jan 2019 11:13:44 +0000 (12:13 +0100)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Thu, 17 Jan 2019 11:13:44 +0000 (12:13 +0100)
refs #6898

lib/base/tcpsocket.cpp

index 7ac935bf8a6716be047c7eeae11cc914fc3e0dc6..2c3f6c7c3a84c0f75fd8cbb1e912b4c93d49f6e1 100644 (file)
@@ -91,6 +91,9 @@ void TcpSocket::Bind(const String& node, const String& service, int family)
 
                const int optTrue = 1;
                setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<const char *>(&optTrue), sizeof(optTrue));
+#ifndef _WIN32
+               setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, reinterpret_cast<const char *>(&optTrue), sizeof(optTrue));
+#endif /* _WIN32 */
 
                int rc = bind(fd, info->ai_addr, info->ai_addrlen);