1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00

Set SO_REUSEPORT only if it's defined.

This commit is contained in:
Rolf Ahrenberg 2016-05-07 21:43:49 +03:00
parent 8222d05f5d
commit 793aab17d7

View File

@ -51,8 +51,10 @@ bool cSatipSocket::Open(const int portP, const bool reuseP)
ERROR_IF_FUNC(setsockopt(socketDescM, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0, ERROR_IF_FUNC(setsockopt(socketDescM, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0,
"setsockopt(SO_REUSEADDR)", Close(), return false); "setsockopt(SO_REUSEADDR)", Close(), return false);
yes = reuseP; yes = reuseP;
#ifdef SO_REUSEPORT
ERROR_IF_FUNC(setsockopt(socketDescM, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)) < 0 && errno != ENOPROTOOPT, ERROR_IF_FUNC(setsockopt(socketDescM, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)) < 0 && errno != ENOPROTOOPT,
"setsockopt(SO_REUSEPORT)", Close(), return false); "setsockopt(SO_REUSEPORT)", Close(), return false);
#endif
// Bind socket // Bind socket
memset(&sockAddrM, 0, sizeof(sockAddrM)); memset(&sockAddrM, 0, sizeof(sockAddrM));
sockAddrM.sin_family = AF_INET; sockAddrM.sin_family = AF_INET;