mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r15944) -Codechange: disable IPv4 over IPv6 sockets as there is no default value and not all OSes actually support IPv4 over IPv6 so making it the same on all OSes eases debugging and such
This commit is contained in:
parent
4e74ba63f9
commit
1a0249f9d8
@ -172,12 +172,15 @@ static SOCKET ListenLoopProc(addrinfo *runp)
|
|||||||
|
|
||||||
if (!SetNoDelay(sock)) DEBUG(net, 1, "Setting TCP_NODELAY failed");
|
if (!SetNoDelay(sock)) DEBUG(net, 1, "Setting TCP_NODELAY failed");
|
||||||
|
|
||||||
int reuse = 1;
|
int on = 1;
|
||||||
/* The (const char*) cast is needed for windows!! */
|
/* The (const char*) cast is needed for windows!! */
|
||||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse, sizeof(reuse)) == -1) {
|
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on)) == -1) {
|
||||||
DEBUG(net, 1, "Could not bind, setsockopt() failed:", strerror(errno));
|
DEBUG(net, 1, "Could not set reusable sockets: %s", strerror(errno));
|
||||||
closesocket(sock);
|
}
|
||||||
return INVALID_SOCKET;
|
|
||||||
|
if (runp->ai_family == AF_INET6 &&
|
||||||
|
setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&on, sizeof(on)) == -1) {
|
||||||
|
DEBUG(net, 1, "Could not disable IPv4 over IPv6: %s", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bind(sock, runp->ai_addr, runp->ai_addrlen) != 0) {
|
if (bind(sock, runp->ai_addr, runp->ai_addrlen) != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user