fix ip filter exemption for trackers. also add a global setting to always exempt trackers
This commit is contained in:
@@ -163,21 +163,25 @@ namespace libtorrent
|
||||
std::transform(i, tcp::resolver::iterator(), std::back_inserter(m_endpoints)
|
||||
, boost::bind(&tcp::resolver::iterator::value_type::endpoint, _1));
|
||||
|
||||
// remove endpoints that are filtered by the IP filter
|
||||
for (std::list<tcp::endpoint>::iterator k = m_endpoints.begin();
|
||||
k != m_endpoints.end();)
|
||||
if (tracker_req().apply_ip_filter)
|
||||
{
|
||||
if (m_ses.m_ip_filter.access(k->address()) == ip_filter::blocked)
|
||||
// remove endpoints that are filtered by the IP filter
|
||||
for (std::list<tcp::endpoint>::iterator k = m_endpoints.begin();
|
||||
k != m_endpoints.end();)
|
||||
{
|
||||
if (m_ses.m_ip_filter.access(k->address()) == ip_filter::blocked)
|
||||
{
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
|
||||
if (cb) cb->debug_log("*** UDP_TRACKER [ IP blocked by filter: " + print_address(k->address()) + " ]");
|
||||
if (cb) cb->debug_log("*** UDP_TRACKER [ IP blocked by filter: " + print_address(k->address()) + " ]");
|
||||
#endif
|
||||
k = m_endpoints.erase(k);
|
||||
k = m_endpoints.erase(k);
|
||||
}
|
||||
else
|
||||
++k;
|
||||
}
|
||||
else
|
||||
++k;
|
||||
}
|
||||
|
||||
// if all endpoints were filtered by the IP filter, we can't connect
|
||||
if (m_endpoints.empty())
|
||||
{
|
||||
fail(error_code(errors::banned_by_ip_filter));
|
||||
|
Reference in New Issue
Block a user