Make use of SO_REUSEPORT conditional
Fixes: #244 SO_RESUEPORT was introduced in Linux 3.9 and later. This change allows NCCL to compile against older releases. The functionality is only required if the user is specifying a NCCL bootstrap address via an environment variable.
This commit is contained in:
parent
bfb3921519
commit
7f2b337e70
@ -327,7 +327,11 @@ static ncclResult_t createListenSocket(int *fd, union socketAddress *localAddr)
|
|||||||
if (socketToPort(&localAddr->sa)) {
|
if (socketToPort(&localAddr->sa)) {
|
||||||
// Port is forced by env. Make sure we get the port.
|
// Port is forced by env. Make sure we get the port.
|
||||||
int opt = 1;
|
int opt = 1;
|
||||||
|
#if defined(SO_REUSEPORT)
|
||||||
SYSCHECK(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt)), "setsockopt");
|
SYSCHECK(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt)), "setsockopt");
|
||||||
|
#else
|
||||||
|
SYSCHECK(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)), "setsockopt");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// localAddr port should be 0 (Any port)
|
// localAddr port should be 0 (Any port)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user