fixed incorrect flushing of disk cache

This commit is contained in:
Arvid Norberg 2008-03-16 10:51:25 +00:00
parent 537f21d1b9
commit 4e9ed2dc96
1 changed files with 12 additions and 6 deletions

View File

@ -879,12 +879,18 @@ namespace libtorrent
INVARIANT_CHECK; INVARIANT_CHECK;
cache_t::iterator i = std::remove_if( for (cache_t::iterator i = m_pieces.begin(); i != m_pieces.end();)
m_pieces.begin(), m_pieces.end(), bind(&cached_piece_entry::storage, _1) == j.storage); {
if (i->storage == j.storage)
for (cache_t::iterator k = i; k != m_pieces.end(); ++k) {
flush(k, l); flush(i, l);
m_pieces.erase(i, m_pieces.end()); i = m_pieces.erase(i);
}
else
{
++i;
}
}
m_pool.release_memory(); m_pool.release_memory();
l.unlock(); l.unlock();
ret = j.storage->release_files_impl(); ret = j.storage->release_files_impl();