merged IPV6_V6ONLY fix from RC_0_16
This commit is contained in:
parent
77a1090104
commit
d2f72f50cc
|
@ -98,6 +98,7 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
|
#ifdef IPV6_V6ONLY
|
||||||
struct v6only
|
struct v6only
|
||||||
{
|
{
|
||||||
v6only(bool enable): m_value(enable) {}
|
v6only(bool enable): m_value(enable) {}
|
||||||
|
@ -112,6 +113,7 @@ namespace libtorrent
|
||||||
int m_value;
|
int m_value;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -2133,7 +2133,9 @@ namespace aux {
|
||||||
if (ep.protocol() == tcp::v6())
|
if (ep.protocol() == tcp::v6())
|
||||||
{
|
{
|
||||||
error_code err; // ignore errors here
|
error_code err; // ignore errors here
|
||||||
|
#ifdef IPV6_V6ONLY
|
||||||
s->sock->set_option(v6only(v6_only), err);
|
s->sock->set_option(v6only(v6_only), err);
|
||||||
|
#endif
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
|
|
||||||
#ifndef PROTECTION_LEVEL_UNRESTRICTED
|
#ifndef PROTECTION_LEVEL_UNRESTRICTED
|
||||||
|
|
|
@ -683,8 +683,10 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec)
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef IPV6_V6ONLY
|
||||||
m_ipv6_sock.set_option(v6only(true), ec);
|
m_ipv6_sock.set_option(v6only(true), ec);
|
||||||
if (ec) return;
|
if (ec) return;
|
||||||
|
#endif
|
||||||
m_ipv6_sock.bind(ep, ec);
|
m_ipv6_sock.bind(ep, ec);
|
||||||
if (ec) return;
|
if (ec) return;
|
||||||
udp::socket::non_blocking_io ioc(true);
|
udp::socket::non_blocking_io ioc(true);
|
||||||
|
@ -726,7 +728,9 @@ void udp_socket::bind(int port)
|
||||||
m_ipv6_sock.open(udp::v6(), ec);
|
m_ipv6_sock.open(udp::v6(), ec);
|
||||||
if (!ec)
|
if (!ec)
|
||||||
{
|
{
|
||||||
|
#ifdef IPV6_V6ONLY
|
||||||
m_ipv6_sock.set_option(v6only(true), ec);
|
m_ipv6_sock.set_option(v6only(true), ec);
|
||||||
|
#endif
|
||||||
m_ipv6_sock.bind(udp::endpoint(address_v6::any(), port), ec);
|
m_ipv6_sock.bind(udp::endpoint(address_v6::any(), port), ec);
|
||||||
|
|
||||||
setup_read(&m_ipv6_sock);
|
setup_read(&m_ipv6_sock);
|
||||||
|
|
Loading…
Reference in New Issue