forked from premiere/premiere-libtorrent
Merge pull request #547 from arvidn/no-read-cache-1.1
fix use_read_cache=false
This commit is contained in:
commit
a1d60db706
|
@ -466,6 +466,7 @@ namespace libtorrent
|
||||||
void dec_block_refcount(cached_piece_entry* pe, int block, int reason);
|
void dec_block_refcount(cached_piece_entry* pe, int block, int reason);
|
||||||
|
|
||||||
int pinned_blocks() const { return m_pinned_blocks; }
|
int pinned_blocks() const { return m_pinned_blocks; }
|
||||||
|
int read_cache_size() const { return m_read_cache_size; }
|
||||||
|
|
||||||
#if TORRENT_USE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
void mark_deleted(file_storage const& fs);
|
void mark_deleted(file_storage const& fs);
|
||||||
|
|
|
@ -1070,6 +1070,14 @@ namespace libtorrent
|
||||||
// a disk job is executed
|
// a disk job is executed
|
||||||
void disk_io_thread::check_cache_level(mutex::scoped_lock& l, jobqueue_t& completed_jobs)
|
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);
|
int evict = m_disk_cache.num_to_evict(0);
|
||||||
if (evict > 0)
|
if (evict > 0)
|
||||||
{
|
{
|
||||||
|
@ -2312,6 +2320,10 @@ namespace libtorrent
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (m_settings.get_bool(settings_pack::use_read_cache) == false)
|
||||||
|
{
|
||||||
|
return do_uncached_hash(j);
|
||||||
|
}
|
||||||
|
|
||||||
if (pe == NULL)
|
if (pe == NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue