mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 18:45:40 +08:00
Do not use SO_REUSEADDR by default
to avoid misbehavior in some glibc versions
This commit is contained in:
parent
d6f29ac6df
commit
1ed5229a54
14
src/socks.c
14
src/socks.c
@ -179,6 +179,20 @@ void * sockschild(struct clientparam* param) {
|
|||||||
#endif
|
#endif
|
||||||
if ((param->remsock=so._socket(SASOCK(¶m->req), command == 2? SOCK_STREAM:SOCK_DGRAM, command == 2?IPPROTO_TCP:IPPROTO_UDP)) == INVALID_SOCKET) {RETURN (11);}
|
if ((param->remsock=so._socket(SASOCK(¶m->req), command == 2? SOCK_STREAM:SOCK_DGRAM, command == 2?IPPROTO_TCP:IPPROTO_UDP)) == INVALID_SOCKET) {RETURN (11);}
|
||||||
param->operation = command == 2?BIND:UDPASSOC;
|
param->operation = command == 2?BIND:UDPASSOC;
|
||||||
|
#ifdef REUSE
|
||||||
|
if (command == 2){
|
||||||
|
int opt;
|
||||||
|
|
||||||
|
#ifdef SO_REUSEADDR
|
||||||
|
opt = 1;
|
||||||
|
so._setsockopt(param->remsock, SOL_SOCKET, SO_REUSEADDR, (unsigned char *)&opt, sizeof(int));
|
||||||
|
#endif
|
||||||
|
#ifdef SO_REUSEPORT
|
||||||
|
opt = 1;
|
||||||
|
so._setsockopt(param->remsock, SOL_SOCKET, SO_REUSEPORT, (unsigned char *)&opt, sizeof(int));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user