From 971f437b41ea93e72c5ff81386cd173494ec301d Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 24 Oct 2008 00:15:39 +0000 Subject: [PATCH] added num_pieces to peer_info. Fixes #385 --- docs/manual.html | 3 +++ docs/manual.rst | 4 ++++ include/libtorrent/peer_info.hpp | 3 +++ src/peer_connection.cpp | 1 + 4 files changed, 11 insertions(+) diff --git a/docs/manual.html b/docs/manual.html index 9e2ec34ca..2a5990641 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -2749,6 +2749,8 @@ struct peer_info int rtt; + int num_pieces; + int download_rate_peak; int upload_rate_peak; @@ -2968,6 +2970,7 @@ assigned to be allowed to send and receive until it has to request more quota from the bandwidth manager.

rtt is an estimated round trip time to this peer, in milliseconds. It is estimated by timing the the tcp connect(). It may be 0 for incoming connections.

+

num_pieces is the number of pieces this peer has.

download_rate_peak and upload_rate_peak are the highest download and upload rates seen on this connection. They are given in bytes per second. This number is reset to 0 on reconnect.

diff --git a/docs/manual.rst b/docs/manual.rst index 7f8351304..edd8efebe 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -2708,6 +2708,8 @@ It contains the following fields:: int rtt; + int num_pieces; + int download_rate_peak; int upload_rate_peak; @@ -2927,6 +2929,8 @@ from the bandwidth manager. ``rtt`` is an estimated round trip time to this peer, in milliseconds. It is estimated by timing the the tcp ``connect()``. It may be 0 for incoming connections. +``num_pieces`` is the number of pieces this peer has. + ``download_rate_peak`` and ``upload_rate_peak`` are the highest download and upload rates seen on this connection. They are given in bytes per second. This number is reset to 0 on reconnect. diff --git a/include/libtorrent/peer_info.hpp b/include/libtorrent/peer_info.hpp index e28216ce0..6bf57e9da 100644 --- a/include/libtorrent/peer_info.hpp +++ b/include/libtorrent/peer_info.hpp @@ -193,6 +193,9 @@ namespace libtorrent // estimated rtt to peer, in milliseconds int rtt; + // the number of pieces this peer has + int num_pieces; + // the highest transfer rates seen for this peer int download_rate_peak; int upload_rate_peak; diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 47165a132..51fb5679d 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -2593,6 +2593,7 @@ namespace libtorrent p.pending_disk_bytes = m_outstanding_writing_bytes; p.send_quota = m_bandwidth_limit[upload_channel].quota_left(); p.receive_quota = m_bandwidth_limit[download_channel].quota_left(); + p.num_pieces = m_num_pieces; if (m_download_queue.empty()) p.request_timeout = -1; else p.request_timeout = total_seconds(m_requested - now) + m_ses.settings().request_timeout + m_timeout_extend;