hide the block_cache_reference from disk_buffer_holder

This commit is contained in:
arvidn 2016-12-29 14:54:16 -08:00 committed by Arvid Norberg
parent 03aa3467f3
commit 23a7e8d40a
4 changed files with 3 additions and 5 deletions

View File

@ -102,7 +102,8 @@ namespace libtorrent
std::swap(h.m_ref, m_ref); std::swap(h.m_ref, m_ref);
} }
aux::block_cache_reference ref() const noexcept { return m_ref; } // if this returns true, the buffer may not be modified in place
bool is_mutable() const noexcept { return m_ref.storage == nullptr; }
// implicitly convertible to true if the object is currently holding a // implicitly convertible to true if the object is currently holding a
// buffer // buffer

View File

@ -521,8 +521,6 @@ namespace libtorrent
// the last time we expired write blocks from the cache // the last time we expired write blocks from the cache
time_point m_last_cache_expiry = min_time(); time_point m_last_cache_expiry = min_time();
time_point m_last_file_check;
// LRU cache of open files // LRU cache of open files
file_pool m_file_pool{40}; file_pool m_file_pool{40};

View File

@ -2463,7 +2463,7 @@ namespace libtorrent
send_buffer(msg, 13); send_buffer(msg, 13);
} }
if (buffer.ref().storage == nullptr) if (buffer.is_mutable())
{ {
append_send_buffer(std::move(buffer), r.length); append_send_buffer(std::move(buffer), r.length);
} }

View File

@ -194,7 +194,6 @@ namespace libtorrent
, m_generic_threads(m_generic_io_jobs, ios) , m_generic_threads(m_generic_io_jobs, ios)
, m_hash_io_jobs(*this, thread_type_t::hasher) , m_hash_io_jobs(*this, thread_type_t::hasher)
, m_hash_threads(m_hash_io_jobs, ios) , m_hash_threads(m_hash_io_jobs, ios)
, m_last_file_check(clock_type::now())
, m_disk_cache(block_size, ios, std::bind(&disk_io_thread::trigger_cache_trim, this)) , m_disk_cache(block_size, ios, std::bind(&disk_io_thread::trigger_cache_trim, this))
, m_stats_counters(cnt) , m_stats_counters(cnt)
, m_ios(ios) , m_ios(ios)