don't combine reuseaddr and exclusive addruse on windows

This commit is contained in:
arvidn 2017-05-10 07:53:07 -04:00 committed by Arvid Norberg
parent bfa455c5bd
commit f8bda070be
2 changed files with 8 additions and 4 deletions

View File

@ -1743,8 +1743,9 @@ namespace aux {
error_code err;
#ifdef TORRENT_WINDOWS
ret.sock->set_option(exclusive_address_use(true), err);
#endif
#else
ret.sock->set_option(tcp::acceptor::reuse_address(true), err);
#endif
}
#if TORRENT_USE_IPV6
@ -5066,8 +5067,9 @@ retry:
{
#ifdef TORRENT_WINDOWS
s.set_option(exclusive_address_use(true), ec);
#endif
#else
s.set_option(tcp::acceptor::reuse_address(true), ec);
#endif
// ignore errors because the underlying socket may not
// be opened yet. This happens when we're routing through
// a proxy. In that case, we don't yet know the address of

View File

@ -799,8 +799,9 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec)
error_code err;
#ifdef TORRENT_WINDOWS
m_ipv4_sock.set_option(exclusive_address_use(true), err);
#endif
#else
m_ipv4_sock.set_option(boost::asio::socket_base::reuse_address(true), err);
#endif
m_ipv4_sock.bind(ep, ec);
if (ec) return;
@ -825,8 +826,9 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec)
error_code err;
#ifdef TORRENT_WINDOWS
m_ipv6_sock.set_option(exclusive_address_use(true), err);
#endif
#else
m_ipv6_sock.set_option(boost::asio::socket_base::reuse_address(true), err);
#endif
m_ipv6_sock.set_option(boost::asio::ip::v6_only(true), err);
m_ipv6_sock.bind(ep6, ec);