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,12 +2048,14 @@ namespace libtorrent
tailqueue jobs;
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()
, end(cache.end()); i != end; ++i)
, end(cache.end()); i != end; )
{
tailqueue temp;
m_disk_cache.evict_piece(*(i++), temp);
jobs.append(temp);
if (m_disk_cache.evict_piece(*(i++), temp))
jobs.append(temp);
}
fail_jobs(storage_error(boost::asio::error::operation_aborted), jobs);
}