From: Alexander A. Klimov Date: Thu, 17 Jan 2019 11:13:44 +0000 (+0100) Subject: TcpSocket#Bind(): also set SO_REUSEPORT X-Git-Tag: v2.10.3~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=362c7eb28a99b5a482fa3df393bc82970e795d4e;p=icinga2 TcpSocket#Bind(): also set SO_REUSEPORT refs #6898 (cherry picked from commit 984f7be03060f89235ccee1a1ef3e5fba652a9df) --- diff --git a/lib/base/tcpsocket.cpp b/lib/base/tcpsocket.cpp index 7ac935bf8..2c3f6c7c3 100644 --- a/lib/base/tcpsocket.cpp +++ b/lib/base/tcpsocket.cpp @@ -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(&optTrue), sizeof(optTrue)); +#ifndef _WIN32 + setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, reinterpret_cast(&optTrue), sizeof(optTrue)); +#endif /* _WIN32 */ int rc = bind(fd, info->ai_addr, info->ai_addrlen);