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