From 54a5dd4af46f6c65b31403fee9ce5f8ca866324d Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 10 Aug 2008 09:34:39 +0000 Subject: [PATCH] added invariant check for file-checking queue consistency --- src/torrent.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/torrent.cpp b/src/torrent.cpp index a7eb485e3..3d1308f77 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -3393,6 +3393,18 @@ namespace libtorrent { session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); + if (!m_ses.m_queued_for_checking.empty()) + { + // if there are torrents waiting to be checked + // assert that there's a torrent that is being + // processed right now + bool found = false; + for (aux::session_impl::torrent_map::iterator i = m_ses.m_torrents.begin() + , end(m_ses.m_torrents.end()); i != end; ++i) + if (i->second->m_state == torrent_status::checking_files) found = true; + TORRENT_ASSERT(found); + } + TORRENT_ASSERT(m_resume_entry.type() == lazy_entry::dict_t || m_resume_entry.type() == lazy_entry::none_t);