From 54aa76f940a7000d2cbcacb82b0b9072b8222294 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 1 Aug 2007 06:11:11 +0000 Subject: [PATCH] exposed queued disk bytes in peer_info --- examples/client_test.cpp | 5 +++-- include/libtorrent/peer_info.hpp | 4 ++++ src/peer_connection.cpp | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/client_test.cpp b/examples/client_test.cpp index 0f9cd08fb..790ffde47 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -303,7 +303,7 @@ int peer_index(libtorrent::tcp::endpoint addr, std::vector const& peers) { using namespace libtorrent; - out << " down (total) up (total) que req flags source fail hshf sndb inactive wait block-progress " + out << " down (total) up (total) que req flags source fail hshf sndb inactive wait disk block-progress " #ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES "country " #endif @@ -347,7 +347,8 @@ void print_peer_info(std::ostream& out, std::vector const << to_string(i->num_hashfails, 4) << " " << to_string(i->send_buffer_size, 4) << " " << to_string(total_seconds(i->last_active), 8) << " " - << to_string(total_seconds(i->last_request), 4) << " "; + << to_string(total_seconds(i->last_request), 4) << " " + << to_string(i->pending_disk_bytes, 4) << " "; if (i->downloading_piece_index >= 0) { diff --git a/include/libtorrent/peer_info.hpp b/include/libtorrent/peer_info.hpp index f8ee2feb6..15ad34a7a 100755 --- a/include/libtorrent/peer_info.hpp +++ b/include/libtorrent/peer_info.hpp @@ -144,6 +144,10 @@ namespace libtorrent // approximate peer download rate int remote_dl_rate; + + // number of bytes this peer has in + // the disk write queue + int pending_disk_bytes; }; } diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 3ff3f59f5..a2564601f 100755 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -1652,6 +1652,7 @@ namespace libtorrent p.payload_up_speed = statistics().upload_payload_rate(); p.pid = pid(); p.ip = remote(); + p.pending_disk_bytes = m_outstanding_writing_bytes; #ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES p.country[0] = m_country[0];