improved IPv6 support (skips unsupported tests on windows)

This commit is contained in:
Arvid Norberg
2009-04-13 05:11:44 +00:00
parent 9b226daede
commit 189d618261
4 changed files with 44 additions and 19 deletions

View File

@@ -737,27 +737,19 @@ namespace aux {
}
#if TORRENT_USE_IPV6
#ifdef TORRENT_WINDOWS
// only try to open the IPv6 port if IPv6 is installed
SOCKADDR_STORAGE storage;
int len = sizeof(storage);
if (WSAStringToAddressA("::1", AF_INET6, 0,
(sockaddr*)&storage, &len) != SOCKET_ERROR)
if (supports_ipv6())
{
#endif
s = setup_listener(
tcp::endpoint(address_v6::any(), m_listen_interface.port())
, m_listen_port_retries, true);
s = setup_listener(
tcp::endpoint(address_v6::any(), m_listen_interface.port())
, m_listen_port_retries, true);
if (s.sock)
{
m_listen_sockets.push_back(s);
async_accept(s.sock);
if (s.sock)
{
m_listen_sockets.push_back(s);
async_accept(s.sock);
}
}
#ifdef TORRENT_WINDOWS
}
#endif
#endif // TORRENT_USE_IPV6
// set our main IPv4 and IPv6 interfaces