fixed connection limit to take web seeds into account as well

This commit is contained in:
Arvid Norberg 2011-04-30 20:05:23 +00:00
parent 0eb7505ad9
commit e07e8b2f98
2 changed files with 18 additions and 1 deletions

View File

@ -86,6 +86,7 @@
incoming connection
* added more detailed instrumentation of the disk I/O thread
* fixed connection limit to take web seeds into account as well
* fixed bug when receiving a have message before having the metadata
* fixed python bindings build with disabled DHT support
* fixed BSD file allocation issue

View File

@ -3861,6 +3861,10 @@ namespace libtorrent
TORRENT_ASSERT(!web->resolving);
if (web->resolving) return;
if (int(m_connections.size()) >= m_max_connections
|| m_ses.num_connections() >= m_ses.max_connections())
return;
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
(*m_ses.m_logger) << time_now_string() << " resolving web seed: " << web->url << "\n";
#endif
@ -4003,6 +4007,10 @@ namespace libtorrent
if (m_ses.is_aborted()) return;
if (int(m_connections.size()) >= m_max_connections
|| m_ses.num_connections() >= m_ses.max_connections())
return;
tcp::endpoint a(host->endpoint());
using boost::tuples::ignore;
@ -4074,6 +4082,10 @@ namespace libtorrent
return;
}
if (int(m_connections.size()) >= m_max_connections
|| m_ses.num_connections() >= m_ses.max_connections())
return;
tcp::endpoint a(host->endpoint());
connect_web_seed(web, a);
}
@ -6596,7 +6608,11 @@ namespace libtorrent
// ---- WEB SEEDS ----
// if we have everything we want we don't need to connect to any web-seed
if (!is_finished() && !m_web_seeds.empty() && m_files_checked)
if (!is_finished() && !m_web_seeds.empty() && m_files_checked
&& int(m_connections.size()) < m_max_connections
&& int(m_ses.m_connections.size()) < m_ses.max_connections())
return;
{
// keep trying web-seeds if there are any
// first find out which web seeds we are connected to