From 7933132cd9b3852edb7c5b6f2488975c7e9e1b12 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 5 Aug 2009 19:02:51 +0000 Subject: [PATCH] fixed assert when built with disk stats --- include/libtorrent/disk_io_thread.hpp | 2 +- include/libtorrent/peer_connection.hpp | 3 ++- src/disk_io_thread.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) 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 {