make clear_read_cache() code less confusing

This commit is contained in:
Arvid Norberg 2015-04-29 05:11:55 +00:00
parent 00e0c7be9c
commit a1dbba7cf4
1 changed files with 5 additions and 3 deletions

View File

@ -2048,11 +2048,13 @@ namespace libtorrent
tailqueue jobs; tailqueue jobs;
boost::unordered_set<cached_piece_entry*> const& cache = storage->cached_pieces(); boost::unordered_set<cached_piece_entry*> const& cache = storage->cached_pieces();
// note that i is incremented in the body!
for (boost::unordered_set<cached_piece_entry*>::const_iterator i = cache.begin() for (boost::unordered_set<cached_piece_entry*>::const_iterator i = cache.begin()
, end(cache.end()); i != end; ++i) , end(cache.end()); i != end; )
{ {
tailqueue temp; tailqueue temp;
m_disk_cache.evict_piece(*(i++), temp); if (m_disk_cache.evict_piece(*(i++), temp))
jobs.append(temp); jobs.append(temp);
} }
fail_jobs(storage_error(boost::asio::error::operation_aborted), jobs); fail_jobs(storage_error(boost::asio::error::operation_aborted), jobs);