forked from premiere/premiere-libtorrent
apply {get,set}_option to the appropriate socket based on the option's level
This avoids spurious errors being returned when trying to apply IPv4 options to the IPv6 socket and vice-versa.
This commit is contained in:
parent
55c35332ba
commit
4949721389
|
@ -114,25 +114,34 @@ namespace libtorrent
|
|||
template <class SocketOption>
|
||||
void get_option(SocketOption const& opt, error_code& ec)
|
||||
{
|
||||
m_ipv4_sock.get_option(opt, ec);
|
||||
#if TORRENT_USE_IPV6
|
||||
m_ipv6_sock.get_option(opt, ec);
|
||||
if (opt.level(udp::v6()) == IPPROTO_IPV6)
|
||||
m_ipv6_sock.get_option(opt, ec);
|
||||
else
|
||||
#endif
|
||||
m_ipv4_sock.get_option(opt, ec);
|
||||
}
|
||||
|
||||
template <class SocketOption>
|
||||
void set_option(SocketOption const& opt, error_code& ec)
|
||||
{
|
||||
m_ipv4_sock.set_option(opt, ec);
|
||||
if (opt.level(udp::v4()) != IPPROTO_IPV6)
|
||||
m_ipv4_sock.set_option(opt, ec);
|
||||
#if TORRENT_USE_IPV6
|
||||
m_ipv6_sock.set_option(opt, ec);
|
||||
if (opt.level(udp::v6()) != IPPROTO_IP)
|
||||
m_ipv6_sock.set_option(opt, ec);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class SocketOption>
|
||||
void get_option(SocketOption& opt, error_code& ec)
|
||||
{
|
||||
m_ipv4_sock.get_option(opt, ec);
|
||||
#if TORRENT_USE_IPV6
|
||||
if (opt.level(udp::v6()) == IPPROTO_IPV6)
|
||||
m_ipv6_sock.get_option(opt, ec);
|
||||
else
|
||||
#endif
|
||||
m_ipv4_sock.get_option(opt, ec);
|
||||
}
|
||||
|
||||
udp::endpoint proxy_addr() const { return m_proxy_addr; }
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 66356b0ce99cd126c7c99df50609b3050ba44e5d
|
||||
Subproject commit 0151d5c17fa3f4cf0ce518d0b8f90a23792c9b24
|
Loading…
Reference in New Issue