forked from premiere/premiere-libtorrent
Include &ipv4= for private trackers
This commit is contained in:
parent
25a1f12991
commit
3406f12ab3
|
@ -161,6 +161,8 @@ namespace libtorrent
|
|||
|
||||
boost::uint32_t key;
|
||||
int num_want;
|
||||
|
||||
address_v4 ipv4;
|
||||
#if TORRENT_USE_IPV6
|
||||
address_v6 ipv6;
|
||||
#endif
|
||||
|
|
|
@ -183,6 +183,17 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
|
||||
if (tracker_req().ipv4 != address_v4() && !i2p)
|
||||
{
|
||||
error_code err;
|
||||
std::string const ip = tracker_req().ipv4.to_string(err);
|
||||
if (!err)
|
||||
{
|
||||
url += "&ipv4=";
|
||||
url += escape_string(ip.c_str(), ip.size());
|
||||
}
|
||||
}
|
||||
|
||||
#if TORRENT_USE_IPV6
|
||||
if (tracker_req().ipv6 != address_v6() && !i2p)
|
||||
{
|
||||
|
|
|
@ -3246,17 +3246,19 @@ namespace {
|
|||
|
||||
req.event = e;
|
||||
|
||||
#if TORRENT_USE_IPV6
|
||||
// since sending our IPv6 address to the tracker may be sensitive. Only
|
||||
// since sending our IPv4/v6 address to the tracker may be sensitive. Only
|
||||
// do that if we're not in anonymous mode and if it's a private torrent
|
||||
if (!settings().get_bool(settings_pack::anonymous_mode)
|
||||
&& m_torrent_file
|
||||
&& m_torrent_file->priv())
|
||||
{
|
||||
boost::optional<tcp::endpoint> ep = m_ses.get_ipv6_interface();
|
||||
if (ep) req.ipv6 = ep->address().to_v6();
|
||||
}
|
||||
boost::optional<tcp::endpoint> ep4 = m_ses.get_ipv4_interface();
|
||||
if (ep4) req.ipv4 = ep4->address().to_v4();
|
||||
#if TORRENT_USE_IPV6
|
||||
boost::optional<tcp::endpoint> ep6 = m_ses.get_ipv6_interface();
|
||||
if (ep6) req.ipv6 = ep6->address().to_v6();
|
||||
#endif
|
||||
}
|
||||
|
||||
// if we are aborting. we don't want any new peers
|
||||
req.num_want = (req.event == tracker_request::stopped)
|
||||
|
|
Loading…
Reference in New Issue