fix for systems where IPv6 sockets bound to INADDR_ANY also listens on IPv4 connections

This commit is contained in:
Arvid Norberg
2007-11-23 22:14:33 +00:00
parent 88e69d0edc
commit c929f4fb69
3 changed files with 20 additions and 3 deletions

View File

@@ -473,7 +473,7 @@ namespace libtorrent
// we might need more than one listen socket
std::list<listen_socket_t> m_listen_sockets;
listen_socket_t setup_listener(tcp::endpoint ep, int retries);
listen_socket_t setup_listener(tcp::endpoint ep, int retries, bool v6_only = false);
// the settings for the client
session_settings m_settings;

View File

@@ -171,6 +171,21 @@ namespace libtorrent
return Endpoint(addr, port);
}
}
struct v6only
{
v6only(bool enable): m_value(enable) {}
template<class Protocol>
int level(Protocol const&) const { return IPPROTO_IPV6; }
template<class Protocol>
int name(Protocol const&) const { return IPV6_V6ONLY; }
template<class Protocol>
int const* data(Protocol const&) const { return &m_value; }
template<class Protocol>
size_t size(Protocol const&) const { return sizeof(m_value); }
int m_value;
};
}
#endif // TORRENT_SOCKET_HPP_INCLUDED