fix issue in torrent::bytes_left

This commit is contained in:
Arvid Norberg 2014-01-21 01:52:01 +00:00
parent 65a847fd43
commit ca132efeb1
1 changed files with 5 additions and 5 deletions

View File

@ -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<piece_picker::downloading_piece>& 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<piece_picker::downloading_piece>::const_iterator j = boost::next(i);
j != dl_queue.end(); ++j)
{