removed redundant code in disk_io_thread
This commit is contained in:
parent
11d89dd121
commit
ecdd7231b8
|
@ -152,6 +152,8 @@ namespace libtorrent
|
|||
// the number of read operations used
|
||||
size_type reads;
|
||||
|
||||
mutable size_type queued_bytes;
|
||||
|
||||
// the number of blocks in the cache (both read and write)
|
||||
int cache_size;
|
||||
|
||||
|
@ -253,14 +255,11 @@ namespace libtorrent
|
|||
, boost::function<void(int, disk_io_job const&)> const& f
|
||||
= boost::function<void(int, disk_io_job const&)>());
|
||||
|
||||
int queued_write_bytes() const;
|
||||
|
||||
// keep track of the number of bytes in the job queue
|
||||
// at any given time. i.e. the sum of all buffer_size.
|
||||
// this is used to slow down the download global download
|
||||
// speed when the queue buffer size is too big.
|
||||
size_type queue_buffer_size() const
|
||||
{ return m_queue_buffer_size; }
|
||||
size_type queue_buffer_size() const;
|
||||
|
||||
void get_cache_info(sha1_hash const& ih
|
||||
, std::vector<cached_piece_info>& ret) const;
|
||||
|
@ -362,8 +361,6 @@ namespace libtorrent
|
|||
// exceed m_cache_size
|
||||
cache_status m_cache_stats;
|
||||
|
||||
int m_queued_write_bytes;
|
||||
|
||||
#ifdef TORRENT_DISK_STATS
|
||||
std::ofstream m_log;
|
||||
#endif
|
||||
|
|
|
@ -279,7 +279,6 @@ namespace libtorrent
|
|||
, m_waiting_to_shutdown(false)
|
||||
, m_queue_buffer_size(0)
|
||||
, m_last_file_check(time_now_hires())
|
||||
, m_queued_write_bytes(0)
|
||||
, m_ios(ios)
|
||||
, m_queue_callback(queue_callback)
|
||||
, m_work(io_service::work(m_ios))
|
||||
|
@ -349,6 +348,7 @@ namespace libtorrent
|
|||
{
|
||||
mutex_t::scoped_lock l(m_piece_mutex);
|
||||
m_cache_stats.total_used_buffers = in_use();
|
||||
m_cache_stats.queued_bytes = m_queue_buffer_size;
|
||||
return m_cache_stats;
|
||||
}
|
||||
|
||||
|
@ -1194,10 +1194,10 @@ namespace libtorrent
|
|||
return ret;
|
||||
}
|
||||
|
||||
int disk_io_thread::queued_write_bytes() const
|
||||
size_type disk_io_thread::queue_buffer_size() const
|
||||
{
|
||||
mutex_t::scoped_lock l(m_queue_mutex);
|
||||
return m_queued_write_bytes;
|
||||
return m_queue_buffer_size;
|
||||
}
|
||||
|
||||
void disk_io_thread::add_job(disk_io_job const& j
|
||||
|
@ -1235,7 +1235,6 @@ namespace libtorrent
|
|||
}
|
||||
else if (j.action == disk_io_job::write)
|
||||
{
|
||||
m_queued_write_bytes += j.buffer_size;
|
||||
for (; i != m_jobs.rend(); ++i)
|
||||
{
|
||||
if (*i < j)
|
||||
|
@ -1347,7 +1346,8 @@ namespace libtorrent
|
|||
|
||||
if (m_queue_buffer_size + j.buffer_size >= m_settings.max_queued_disk_bytes
|
||||
&& m_queue_buffer_size < m_settings.max_queued_disk_bytes
|
||||
&& m_queue_callback)
|
||||
&& m_queue_callback
|
||||
&& m_settings.max_queued_disk_bytes > 0)
|
||||
{
|
||||
// we just dropped below the high watermark of number of bytes
|
||||
// queued for writing to the disk. Notify the session so that it
|
||||
|
@ -1568,7 +1568,6 @@ namespace libtorrent
|
|||
}
|
||||
case disk_io_job::write:
|
||||
{
|
||||
m_queued_write_bytes -= j.buffer_size;
|
||||
#ifdef TORRENT_DISK_STATS
|
||||
m_log << log_time() << " write " << j.buffer_size << std::endl;
|
||||
#endif
|
||||
|
|
|
@ -1614,7 +1614,7 @@ ret:
|
|||
|
||||
int piece_manager::queued_bytes() const
|
||||
{
|
||||
return m_io_thread.queued_write_bytes();
|
||||
return m_io_thread.queue_buffer_size();
|
||||
}
|
||||
|
||||
void piece_manager::async_write(
|
||||
|
|
Loading…
Reference in New Issue