merged minor IPv6 fix from libtorrent_aio

This commit is contained in:
Arvid Norberg 2012-12-02 17:58:32 +00:00
parent 73a7e9f03b
commit fae3d23e27
2 changed files with 12 additions and 1 deletions

View File

@ -66,7 +66,10 @@ namespace libtorrent
{
TORRENT_TRY {
#if TORRENT_USE_IPV6
if (a.is_v6()) return a.to_v6().is_link_local();
if (a.is_v6())
{
return a.to_v6() == address_v6::loopback();
}
#endif
address_v4 a4 = a.to_v4();
unsigned long ip = a4.to_ulong();

View File

@ -1360,6 +1360,14 @@ namespace libtorrent
if (remote.address() == address() || remote.port() == 0)
return 0;
#if TORRENT_USE_IPV6
// don't allow link-local IPv6 addresses since they
// can't be used like normal addresses, they require an interface
// and will just cause connect() to fail with EINVAL
if (remote.address().is_v6() && remote.address().to_v6().is_link_local())
return 0;
#endif
aux::session_impl& ses = m_torrent->session();
// if this is an i2p torrent, and we don't allow mixed mode