enables teredo support on windows
This commit is contained in:
parent
8d6c1527ae
commit
9a9f08f70f
|
@ -213,6 +213,22 @@ namespace libtorrent
|
|||
int m_value;
|
||||
};
|
||||
|
||||
#ifdef TORRENT_WINDOWS
|
||||
struct v6_protection_level
|
||||
{
|
||||
v6_protection_level(int level): m_value(level) {}
|
||||
template<class Protocol>
|
||||
int level(Protocol const&) const { return IPPROTO_IPV6; }
|
||||
template<class Protocol>
|
||||
int name(Protocol const&) const { return IPV6_PROTECTION_LEVEL; }
|
||||
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
|
||||
|
||||
struct type_of_service
|
||||
{
|
||||
type_of_service(char val): m_value(val) {}
|
||||
|
|
|
@ -632,7 +632,14 @@ namespace aux {
|
|||
s.sock.reset(new socket_acceptor(m_io_service));
|
||||
s.sock->open(ep.protocol(), ec);
|
||||
s.sock->set_option(socket_acceptor::reuse_address(true), ec);
|
||||
if (ep.protocol() == tcp::v6()) s.sock->set_option(v6only(v6_only), ec);
|
||||
if (ep.protocol() == tcp::v6())
|
||||
{
|
||||
s.sock->set_option(v6only(v6_only), ec);
|
||||
#ifdef TORRENT_WINDOWS
|
||||
// enable Teredo on windows
|
||||
s.sock->set_option(v6_protection_level(PROTECTION_LEVEL_UNRESTRICTED), ec);
|
||||
#endif
|
||||
}
|
||||
s.sock->bind(ep, ec);
|
||||
while (ec && retries > 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue