Merge pull request #581 from ssiloti/sockopt-levels-1.1

apply {get,set}_option to the appropriate socket based on the option'…
This commit is contained in:
Arvid Norberg 2016-04-04 23:10:21 -04:00
commit f5c3c6addc
2 changed files with 15 additions and 6 deletions

View File

@ -114,17 +114,21 @@ 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
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)
{
if (opt.level(udp::v4()) != IPPROTO_IPV6)
m_ipv4_sock.set_option(opt, ec);
#if TORRENT_USE_IPV6
if (opt.level(udp::v6()) != IPPROTO_IP)
m_ipv6_sock.set_option(opt, ec);
#endif
}
@ -132,6 +136,11 @@ namespace libtorrent
template <class SocketOption>
void get_option(SocketOption& opt, error_code& 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);
}

@ -1 +1 @@
Subproject commit 66356b0ce99cd126c7c99df50609b3050ba44e5d
Subproject commit 0151d5c17fa3f4cf0ce518d0b8f90a23792c9b24