diff --git a/ChangeLog b/ChangeLog index d94d95eb6..a8f2a3121 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP + * fix IPv6 support in UDP socket (uTP) * fix mingw build issues * increase max allowed outstanding piece requests from peers * uTP performance improvement. only fast retransmit one packet at a time diff --git a/src/udp_socket.cpp b/src/udp_socket.cpp index 18876c8cf..f32abe458 100644 --- a/src/udp_socket.cpp +++ b/src/udp_socket.cpp @@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/socket_io.hpp" #include "libtorrent/error.hpp" #include "libtorrent/string_util.hpp" // for allocate_string_copy +#include "libtorrent/broadcast_socket.hpp" // for is_any #include #include #include @@ -707,14 +708,19 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec) if (ec) return; setup_read(&m_ipv4_sock); } + #if TORRENT_USE_IPV6 - else + if (ep.address().is_v6() || is_any(ep.address())) { + udp::endpoint ep6 = ep; + if (is_any(ep.address())) ep6.address(address_v6::any()); + m_ipv6_sock.open(udp::v6(), ec); + if (ec) return; #ifdef IPV6_V6ONLY m_ipv6_sock.set_option(v6only(true), ec); if (ec) return; #endif - m_ipv6_sock.bind(ep, ec); + m_ipv6_sock.bind(ep6, ec); if (ec) return; udp::socket::non_blocking_io ioc(true); m_ipv6_sock.io_control(ioc, ec);