Merge pull request #6976 from Icinga/bugfix/so_reuseport-missing

Don't require OS headers to provide SO_REUSEPORT
This commit is contained in:
Michael Friedrich 2019-03-13 10:30:08 +01:00 committed by GitHub
commit 026ed837ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -74,9 +74,9 @@ void TcpSocket::Bind(const String& node, const String& service, int family)
const int optTrue = 1; const int optTrue = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<const char *>(&optTrue), sizeof(optTrue)); setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<const char *>(&optTrue), sizeof(optTrue));
#ifndef _WIN32 #ifdef SO_REUSEPORT
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, reinterpret_cast<const char *>(&optTrue), sizeof(optTrue)); setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, reinterpret_cast<const char *>(&optTrue), sizeof(optTrue));
#endif /* _WIN32 */ #endif /* SO_REUSEPORT */
int rc = bind(fd, info->ai_addr, info->ai_addrlen); int rc = bind(fd, info->ai_addr, info->ai_addrlen);