Merge pull request #7952 from Icinga/fix/SO_REUSEPORT-optional

apilistener: Make SO_REUSEPORT optional
This commit is contained in:
Alexander Aleksandrovič Klimov 2020-10-29 15:56:56 +01:00 committed by GitHub
commit 1e281b060a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -386,9 +386,9 @@ bool ApiListener::AddListener(const String& node, const String& service)
const int optTrue = 1;
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));
#endif /* _WIN32 */
#endif /* SO_REUSEPORT */
}
acceptor->bind(current->endpoint());