fix issue where torrents could 'get stuck' queued for checking (if they were paused)

This commit is contained in:
Arvid Norberg 2011-08-06 17:54:33 +00:00
parent 8f45fea7db
commit 3e505f01fc
1 changed files with 9 additions and 0 deletions

View File

@ -3621,7 +3621,10 @@ namespace aux {
// checking torrents are not subject to auto-management // checking torrents are not subject to auto-management
if (t->state() == torrent_status::checking_files if (t->state() == torrent_status::checking_files
|| t->state() == torrent_status::queued_for_checking) || t->state() == torrent_status::queued_for_checking)
{
if (t->is_auto_managed() && t->is_paused()) t->resume();
continue; continue;
}
if (t->is_auto_managed() && !t->has_error()) if (t->is_auto_managed() && !t->has_error())
{ {
TORRENT_ASSERT(t->m_resume_data_loaded || !t->valid_metadata()); TORRENT_ASSERT(t->m_resume_data_loaded || !t->valid_metadata());
@ -5338,14 +5341,20 @@ namespace aux {
TORRENT_ASSERT(is_network_thread()); TORRENT_ASSERT(is_network_thread());
int num_checking = 0; int num_checking = 0;
int num_queued_for_checking = 0;
for (check_queue_t::const_iterator i = m_queued_for_checking.begin() for (check_queue_t::const_iterator i = m_queued_for_checking.begin()
, end(m_queued_for_checking.end()); i != end; ++i) , end(m_queued_for_checking.end()); i != end; ++i)
{ {
if ((*i)->state() == torrent_status::checking_files) ++num_checking; if ((*i)->state() == torrent_status::checking_files) ++num_checking;
else if ((*i)->state() == torrent_status::queued_for_checking)
{
++num_queued_for_checking;
}
} }
// the queue is either empty, or it has exactly one checking torrent in it // the queue is either empty, or it has exactly one checking torrent in it
TORRENT_ASSERT(m_queued_for_checking.empty() || num_checking == 1 || (m_paused && num_checking == 0)); TORRENT_ASSERT(m_queued_for_checking.empty() || num_checking == 1 || (m_paused && num_checking == 0));
// TORRENT_ASSERT(m_queued_for_checking.size() == num_queued_for_checking);
std::set<int> unique; std::set<int> unique;
int total_downloaders = 0; int total_downloaders = 0;