mirror of
https://github.com/3proxy/3proxy.git
synced 2026-09-03 13:25:48 +08:00
Let a Windows UDP service bind the socket it answers from
A UDP service on Windows binds a second socket to the address it listens on, so a reply leaves the port the client sent to. Windows only allows that when both sockets ask for it, and the listening socket was never asked, so the bind failed and dnspr answered nothing at all on Windows. Ask for it on the listening socket of a UDP service, and there only: the reason it is withheld otherwise, that another local process could take a listening port, is unchanged for everything else.
This commit is contained in:
parent
36979639b7
commit
0df93bfab7
@ -830,6 +830,14 @@ int MODULEMAINFUNC (int argc, char** argv){
|
|||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
opt = 1;
|
opt = 1;
|
||||||
if(srv.so._setsockopt(srv.so.state, sock, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int)))perror("setsockopt()");
|
if(srv.so._setsockopt(srv.so.state, sock, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int)))perror("setsockopt()");
|
||||||
|
#else
|
||||||
|
/* A UDP service on Windows answers from a second socket bound to
|
||||||
|
the address it listens on, and Windows only allows that bind
|
||||||
|
when both sockets ask for it. */
|
||||||
|
if(isudp){
|
||||||
|
opt = 1;
|
||||||
|
if(srv.so._setsockopt(srv.so.state, sock, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int)))perror("setsockopt()");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef SO_REUSEPORT
|
#ifdef SO_REUSEPORT
|
||||||
opt = 1;
|
opt = 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user