Merge pull request #547 from arvidn/no-read-cache-1.1

fix use_read_cache=false
This commit is contained in:
Arvid Norberg 2016-03-16 08:14:15 -04:00
commit a1d60db706
2 changed files with 13 additions and 0 deletions

View File

@ -466,6 +466,7 @@ namespace libtorrent
void dec_block_refcount(cached_piece_entry* pe, int block, int reason);
int pinned_blocks() const { return m_pinned_blocks; }
int read_cache_size() const { return m_read_cache_size; }
#if TORRENT_USE_ASSERTS
void mark_deleted(file_storage const& fs);

View File

@ -1070,6 +1070,14 @@ namespace libtorrent
// a disk job is executed
void disk_io_thread::check_cache_level(mutex::scoped_lock& l, jobqueue_t& completed_jobs)
{
// when the read cache is disabled, always try to evict all read cache
// blocks
if (!m_settings.get_bool(settings_pack::use_read_cache))
{
int const evict = m_disk_cache.read_cache_size();
m_disk_cache.try_evict_blocks(evict);
}
int evict = m_disk_cache.num_to_evict(0);
if (evict > 0)
{
@ -2312,6 +2320,10 @@ namespace libtorrent
return 0;
}
}
else if (m_settings.get_bool(settings_pack::use_read_cache) == false)
{
return do_uncached_hash(j);
}
if (pe == NULL)
{