use SO_REUSEPORT
This commit is contained in:
parent
6bfaee9e98
commit
3636c04609
@ -8,5 +8,8 @@
|
|||||||
int socket_bind4_reuse(int s,const char *ip,uint16 port) {
|
int socket_bind4_reuse(int s,const char *ip,uint16 port) {
|
||||||
int one=1;
|
int one=1;
|
||||||
setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&one,sizeof one);
|
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));
|
return winsock2errno(socket_bind4(s,ip,port));
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,8 @@
|
|||||||
int socket_bind6_reuse(int s,const char *ip,uint16 port,uint32 scope_id) {
|
int socket_bind6_reuse(int s,const char *ip,uint16 port,uint32 scope_id) {
|
||||||
int one=1;
|
int one=1;
|
||||||
setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&one,sizeof one);
|
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));
|
return winsock2errno(socket_bind6(s,ip,port,scope_id));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user