fix outstanding bytes issue when receiving redundant bytes

This commit is contained in:
Arvid Norberg 2014-06-17 08:07:03 +00:00
parent 10aec85e3f
commit 5642a0bd59
1 changed files with 10 additions and 0 deletions

View File

@ -2387,6 +2387,16 @@ namespace libtorrent
m_received_in_piece = 0;
#endif
t->add_redundant_bytes(p.length, torrent::piece_unknown);
// the bytes of the piece we just completed have been deducted from
// m_outstanding_bytes as we received it, in incoming_piece_fragment.
// however, it now turns out the piece we received wasn't in the
// download queue, so we still have the same number of pieces in the
// download queue, which is why we need to add the bytes back.
m_outstanding_bytes += p.length;
#if TORRENT_USE_INVARIANT_CHECKS
check_invariant();
#endif
return;
}