diff --git a/src/torrent.cpp b/src/torrent.cpp index d165f5a85..b4e97d74d 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -2897,8 +2897,11 @@ namespace libtorrent } TORRENT_ASSERT(st.total_wanted >= st.total_wanted_done); + // this is expensive, we might not want to do it all the time + if (!accurate) return; + // subtract padding files - if (m_padding > 0 && accurate) + if (m_padding > 0) { file_storage const& files = m_torrent_file->files(); for (int i = 0; i < files.num_files(); ++i) @@ -2928,9 +2931,6 @@ namespace libtorrent TORRENT_ASSERT(st.total_wanted_done >= 0); TORRENT_ASSERT(st.total_done >= st.total_wanted_done); - // this is expensive, we might not want to do it all the time - if (!accurate) return; - const std::vector& dl_queue = m_picker->get_download_queue(); @@ -2947,7 +2947,7 @@ namespace libtorrent if (m_picker->have_piece(index)) continue; TORRENT_ASSERT(i->finished <= m_picker->blocks_in_piece(index)); -#ifdef TORRENT_DEBUG +#if TORRENT_USE_ASSERTS for (std::vector::const_iterator j = boost::next(i); j != dl_queue.end(); ++j) {