From 4cc2e879c4f6327cac220a479a69b0a97f4f43c5 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 10 Jan 2016 11:50:56 -0500 Subject: [PATCH] comment out verbose pex logging. fix bug in disabled_storage and an error reporting issue on short reads in default_storage --- src/disk_io_thread.cpp | 4 +++- src/storage.cpp | 12 ++++++------ src/ut_pex.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index efa3323b3..76151c1cb 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -2341,7 +2341,7 @@ namespace libtorrent return 0; } } - + if (pe == NULL && !m_settings.get_bool(settings_pack::use_read_cache)) { l.unlock(); @@ -2468,6 +2468,7 @@ namespace libtorrent if (ret < 0) { + TORRENT_ASSERT(j->error.ec && j->error.operation != 0); m_disk_cache.free_buffer(static_cast(iov.iov_base)); l.lock(); break; @@ -2481,6 +2482,7 @@ namespace libtorrent ret = -1; j->error.ec.assign(boost::asio::error::eof , boost::asio::error::get_misc_category()); + j->error.operation = storage_error::read; m_disk_cache.free_buffer(static_cast(iov.iov_base)); l.lock(); break; diff --git a/src/storage.cpp b/src/storage.cpp index 7261f1a9a..e315c454c 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -1520,16 +1520,16 @@ namespace libtorrent return new default_storage(params); } - int disabled_storage::readv(file::iovec_t const* - , int, int, int, int, storage_error&) + int disabled_storage::readv(file::iovec_t const* bufs + , int num_bufs, int, int, int, storage_error&) { - return 0; + return bufs_size(bufs, num_bufs); } - int disabled_storage::writev(file::iovec_t const* - , int, int, int, int, storage_error&) + int disabled_storage::writev(file::iovec_t const* bufs + , int num_bufs, int, int, int, storage_error&) { - return 0; + return bufs_size(bufs, num_bufs); } storage_interface* disabled_storage_constructor(storage_params const& params) diff --git a/src/ut_pex.cpp b/src/ut_pex.cpp index 3a0216f27..5bcd0506a 100644 --- a/src/ut_pex.cpp +++ b/src/ut_pex.cpp @@ -439,8 +439,8 @@ namespace libtorrent { namespace if (now - seconds(60) < m_last_msg) { #ifndef TORRENT_DISABLE_LOGGING - m_pc.peer_log(peer_log_alert::info, "PEX", "waiting: %d seconds to next msg" - , int(total_seconds(seconds(60) - (now - m_last_msg)))); +// m_pc.peer_log(peer_log_alert::info, "PEX", "waiting: %d seconds to next msg" +// , int(total_seconds(seconds(60) - (now - m_last_msg)))); #endif return; } @@ -457,8 +457,8 @@ namespace libtorrent { namespace if (now - milliseconds(delay) < global_last) { #ifndef TORRENT_DISABLE_LOGGING - m_pc.peer_log(peer_log_alert::info, "PEX", "global-wait: %d" - , int(total_seconds(milliseconds(delay) - (now - global_last)))); +// m_pc.peer_log(peer_log_alert::info, "PEX", "global-wait: %d" +// , int(total_seconds(milliseconds(delay) - (now - global_last)))); #endif return; }