TcpSocket#Bind(): also set SO_REUSEPORT

refs #6898

(cherry picked from commit 984f7be030)
This commit is contained in:
Alexander A. Klimov 2019-01-17 12:13:44 +01:00 committed by Michael Friedrich
parent f6a62e71d8
commit 362c7eb28a
1 changed files with 3 additions and 0 deletions

View 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);