Loading src/posix/tcp.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,14 @@ tcp::tcp(const std::string& addr, int port, int maxconnections, int sockopts) ::setsockopt(_Socket, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)); } #endif // For an IPv6 listening socket, disable IPV6_V6ONLY so the socket accepts // both IPv6 and IPv4-mapped connections (dual-stack). This makes binding to // "::" serve IPv4 clients too, regardless of the system bindv6only sysctl. if (reinterpret_cast<sockaddr*>(&_Addr)->sa_family == AF_INET6) { int v6only = 0; ::setsockopt(_Socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only, sizeof(v6only)); } } void tcp::bind() { Loading src/posix/udp.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,13 @@ udp::udp(const std::string& addr, int port, int maxconnections, int sockopts) ::setsockopt(_Socket, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)); #endif // For an IPv6 socket, disable IPV6_V6ONLY so it accepts both IPv6 and // IPv4-mapped traffic (dual-stack), matching the TCP/SSL listener behaviour. if (reinterpret_cast<sockaddr*>(&_Addr)->sa_family == AF_INET6) { int v6only = 0; ::setsockopt(_Socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only, sizeof(v6only)); } } udp::udp(const std::string& uxsocket, int maxconnections, int sockopts) Loading Loading
src/posix/tcp.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,14 @@ tcp::tcp(const std::string& addr, int port, int maxconnections, int sockopts) ::setsockopt(_Socket, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)); } #endif // For an IPv6 listening socket, disable IPV6_V6ONLY so the socket accepts // both IPv6 and IPv4-mapped connections (dual-stack). This makes binding to // "::" serve IPv4 clients too, regardless of the system bindv6only sysctl. if (reinterpret_cast<sockaddr*>(&_Addr)->sa_family == AF_INET6) { int v6only = 0; ::setsockopt(_Socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only, sizeof(v6only)); } } void tcp::bind() { Loading
src/posix/udp.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,13 @@ udp::udp(const std::string& addr, int port, int maxconnections, int sockopts) ::setsockopt(_Socket, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)); #endif // For an IPv6 socket, disable IPV6_V6ONLY so it accepts both IPv6 and // IPv4-mapped traffic (dual-stack), matching the TCP/SSL listener behaviour. if (reinterpret_cast<sockaddr*>(&_Addr)->sa_family == AF_INET6) { int v6only = 0; ::setsockopt(_Socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only, sizeof(v6only)); } } udp::udp(const std::string& uxsocket, int maxconnections, int sockopts) Loading