diff --git a/include/libtorrent/disk_io_thread.hpp b/include/libtorrent/disk_io_thread.hpp index f706502af..cacfd484e 100644 --- a/include/libtorrent/disk_io_thread.hpp +++ b/include/libtorrent/disk_io_thread.hpp @@ -172,7 +172,7 @@ namespace libtorrent ~disk_buffer_pool(); #endif -#ifdef TORRENT_DEBUG +#if defined TORRENT_DEBUG || defined TORRENT_DISK_STATS bool is_disk_buffer(char* buffer , boost::mutex::scoped_lock& l) const; bool is_disk_buffer(char* buffer) const; diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index 1c0174c24..29607405e 100644 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -481,7 +481,8 @@ namespace libtorrent void append_send_buffer(char* buffer, int size, Destructor const& destructor) { #if TORRENT_DISK_STATS - m_ses.m_disk_thread.rename_buffer(buffer, "queued send buffer"); + if (m_ses.m_disk_thread.is_disk_buffer(buffer)) + m_ses.m_disk_thread.rename_buffer(buffer, "queued send buffer"); #endif m_send_buffer.append_buffer(buffer, size, size, destructor); #ifdef TORRENT_STATS diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 318a55bbb..9faac22ad 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -78,7 +78,7 @@ namespace libtorrent } #endif -#ifdef TORRENT_DEBUG +#if defined TORRENT_DEBUG || defined TORRENT_DISK_STATS bool disk_buffer_pool::is_disk_buffer(char* buffer ,boost::mutex::scoped_lock& l) const {