fixed incorrect flushing of disk cache
This commit is contained in:
parent
537f21d1b9
commit
4e9ed2dc96
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue