fix msvc build
This commit is contained in:
@@ -502,7 +502,11 @@ public:
|
|||||||
throw std::runtime_error("Could not create server socket");
|
throw std::runtime_error("Could not create server socket");
|
||||||
}
|
}
|
||||||
int opt = 1;
|
int opt = 1;
|
||||||
if (setsockopt(descriptor, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt))) {
|
int flags = SO_REUSEADDR;
|
||||||
|
# ifndef _WIN32
|
||||||
|
flags |= SO_REUSEPORT;
|
||||||
|
# endif
|
||||||
|
if (setsockopt(descriptor, SOL_SOCKET, flags, &opt, sizeof(opt))) {
|
||||||
closesocket(descriptor);
|
closesocket(descriptor);
|
||||||
throw std::runtime_error("setsockopt");
|
throw std::runtime_error("setsockopt");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user