fixed bug in write cache flush logic

This commit is contained in:
Arvid Norberg 2008-02-10 20:36:48 +00:00
parent af6c0a73c5
commit 752149e341
1 changed files with 4 additions and 3 deletions

View File

@ -228,9 +228,10 @@ namespace libtorrent
std::vector<cached_piece_entry>::iterator i = std::min_element(
m_pieces.begin(), m_pieces.end()
, bind(&cached_piece_entry::last_write, _1)
< bind(&cached_piece_entry::last_write, _1));
< bind(&cached_piece_entry::last_write, _2));
if (i == m_pieces.end()) return;
if (total_seconds(now - i->last_write) < m_cache_expiry) return;
int age = total_seconds(now - i->last_write);
if (age < m_cache_expiry) return;
flush_and_remove(i, l);
}
}
@ -241,7 +242,7 @@ namespace libtorrent
std::vector<cached_piece_entry>::iterator i = std::min_element(
m_pieces.begin(), m_pieces.end()
, bind(&cached_piece_entry::last_write, _1)
< bind(&cached_piece_entry::last_write, _1));
< bind(&cached_piece_entry::last_write, _2));
if (i == m_pieces.end()) return;
flush_and_remove(i, l);
}