merged IPv6 fix from RC_0_16

This commit is contained in:
Arvid Norberg 2013-09-25 06:50:08 +00:00
parent 4f6f383e8b
commit 97c69cb041
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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 <stdlib.h>
#include <boost/bind.hpp>
#include <boost/array.hpp>
@ -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);