diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index f0f6782ad..2d5acfffd 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -228,9 +228,10 @@ namespace libtorrent std::vector::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::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); }