From ca132efeb155e5a348170d9f027cd6b60c5fe15c Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 21 Jan 2014 01:52:01 +0000 Subject: [PATCH] fix issue in torrent::bytes_left --- src/torrent.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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) {