diff options
author | sfan5 <sfan5@live.de> | 2018-06-22 20:54:23 +0200 |
---|---|---|
committer | SmallJoker <SmallJoker@users.noreply.github.com> | 2018-06-22 20:54:23 +0200 |
commit | c66d97726931aa8dde7d8a1ffa5b8e41234f4660 (patch) | |
tree | b48ff71ed39c1c8a8a127c61193b712fe73f2d10 | |
parent | b308cb676dfd615f552811956f445c0385e1ebd4 (diff) | |
download | minetest-c66d97726931aa8dde7d8a1ffa5b8e41234f4660.tar.gz minetest-c66d97726931aa8dde7d8a1ffa5b8e41234f4660.tar.bz2 minetest-c66d97726931aa8dde7d8a1ffa5b8e41234f4660.zip |
Fix ipv6_server=true not accepting IPv4 connections on Windows (#7471)
-rw-r--r-- | src/network/socket.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/network/socket.cpp b/src/network/socket.cpp index 053013606..94a9f4180 100644 --- a/src/network/socket.cpp +++ b/src/network/socket.cpp @@ -118,6 +118,15 @@ bool UDPSocket::init(bool ipv6, bool noExceptions) setTimeoutMs(0); + if (m_addr_family == AF_INET6) { + // Allow our socket to accept both IPv4 and IPv6 connections + // required on Windows: + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb513665(v=vs.85).aspx + int value = 0; + setsockopt(m_handle, IPPROTO_IPV6, IPV6_V6ONLY, + reinterpret_cast<char *>(&value), sizeof(value)); + } + return true; } |