diff --git a/src/session_impl.cpp b/src/session_impl.cpp index ee1579c53..dc7741015 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1382,7 +1382,7 @@ namespace aux { , end(m_torrents.end()); i != end; ++i) { torrent& t = *i->second; - if (!t.is_torrent_paused()) t.do_pause(); + t.do_pause(); } } @@ -1398,6 +1398,7 @@ namespace aux { torrent& t = *i->second; t.do_resume(); } + if (!m_queued_for_checking.empty()) m_queued_for_checking.front()->start_checking(); } void session_impl::abort() @@ -5229,7 +5230,7 @@ namespace aux { } // the queue is either empty, or it has exactly one checking torrent in it - TORRENT_ASSERT(m_queued_for_checking.empty() || num_checking == 1); + TORRENT_ASSERT(m_queued_for_checking.empty() || num_checking == 1 || (m_paused && num_checking == 0)); std::set unique; int total_downloaders = 0; diff --git a/src/torrent.cpp b/src/torrent.cpp index b87f802cf..70ace44a2 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -5661,11 +5661,21 @@ namespace libtorrent ++found; if (i->second->should_check_files()) ++found_active; } - // the case of 2 is in the special case where one switches over from - // checking to complete. - TORRENT_ASSERT(found_active >= 1); - TORRENT_ASSERT(found_active <= 2); - TORRENT_ASSERT(found >= 1); + + // if the session is paused, there might still be some torrents + // in the checking_files state that haven't been dequeued yet + if (m_ses.is_paused()) + { + TORRENT_ASSERT(found_active == 0); + } + else + { + // the case of 2 is in the special case where one switches over from + // checking to complete. + TORRENT_ASSERT(found_active >= 1); + TORRENT_ASSERT(found_active <= 2); + TORRENT_ASSERT(found >= 1); + } } TORRENT_ASSERT(m_resume_entry.type() == lazy_entry::dict_t @@ -6309,6 +6319,7 @@ namespace libtorrent m_storage->abort_disk_io(); dequeue_torrent_check(); set_state(torrent_status::queued_for_checking); + TORRENT_ASSERT(!m_queued_for_checking); } // if this torrent was just paused