From 3636c0460918eaddf81cea8bc4d9f1772770e5c6 Mon Sep 17 00:00:00 2001 From: leitner Date: Wed, 17 Sep 2008 00:06:23 +0000 Subject: [PATCH] use SO_REUSEPORT --- socket/socket_bind4_reuse.c | 3 +++ socket/socket_bind6_reuse.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/socket/socket_bind4_reuse.c b/socket/socket_bind4_reuse.c index 7e1b8c1..1fb39f2 100644 --- a/socket/socket_bind4_reuse.c +++ b/socket/socket_bind4_reuse.c @@ -8,5 +8,8 @@ int socket_bind4_reuse(int s,const char *ip,uint16 port) { int one=1; setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&one,sizeof one); +#ifdef SO_REUSEPORT + setsockopt(s,SOL_SOCKET,SO_REUSEPORT,&one,sizeof one); +#endif return winsock2errno(socket_bind4(s,ip,port)); } diff --git a/socket/socket_bind6_reuse.c b/socket/socket_bind6_reuse.c index 439c798..6d23941 100644 --- a/socket/socket_bind6_reuse.c +++ b/socket/socket_bind6_reuse.c @@ -8,5 +8,8 @@ int socket_bind6_reuse(int s,const char *ip,uint16 port,uint32 scope_id) { int one=1; setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&one,sizeof one); +#ifdef SO_REUSEPORT + setsockopt(s,SOL_SOCKET,SO_REUSEPORT,&one,sizeof one); +#endif return winsock2errno(socket_bind6(s,ip,port,scope_id)); }