This commit is contained in:
yhirose 2019-06-28 12:08:47 -04:00
parent 0b2c506ca4
commit 2aa35d5f53

View file

@ -659,6 +659,9 @@ socket_t create_socket(const char *host, int port, Fn fn,
// Make 'reuse address' option available
int yes = 1;
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes));
#ifdef SO_REUSEPORT
setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char *)&yes, sizeof(yes));
#endif
// bind or connect
if (fn(sock, *rp)) {