diff --git a/docs/manual.html b/docs/manual.html index 2fbe3c9a9..f2f0ff795 100755 --- a/docs/manual.html +++ b/docs/manual.html @@ -135,7 +135,7 @@ boost.filesystem, boost.date_time and various other boost libraries as well as z

To build libtorrent you need boost and bjam installed. Then you can use bjam to build libtorrent.

To make bjam work, you need to set the environment variable BOOST_ROOT to the -path where boost is installed (e.g. c:boost_1_30_2 on windows). Then you can just run +path where boost is installed (e.g. c:\boost_1_30_2 on windows). Then you can just run bjam in the libtorrent directory.

The Jamfile doesn't work yet. On unix-systems you can use the makefile however. You first have to build boost.thread and boost.filesystem. You do this by, in the directory @@ -546,6 +546,8 @@ struct torrent_status float download_rate; float upload_rate; + int num_peers; + std::vector<bool> pieces; std::size_t total_done; }; @@ -595,6 +597,7 @@ the pieces we don't have.

download_rate and upload_rate are the total rates for all peers for this torrent. These will usually have better precision than summing the rates from all peers. The rates are given as the number of bytes per second.

+

num_peers is the number of peers this torrent currently is connected to.

total_done is the total number of bytes of the file(s) that we have.

@@ -661,6 +664,7 @@ struct peer_info int load_balancing; int download_queue_length; + int upload_queue_length; int downloading_piece_index; int downloading_block_index; @@ -724,8 +728,10 @@ and free upload that we give. Every peer gets a certain amount of free upload, b this member says how much extra free upload this peer has got. If it is a negative number it means that this was a peer from which we have got this amount of free download.

-

download_queue_length is the number of block-requests we have sent to this peer +

download_queue_length is the number of piece-requests we have sent to this peer that hasn't been answered with a piece yet.

+

upload_queue_length is the number of piece-requests we have received from this peer +that we haven't answered with a piece yet.

You can know which piece, and which part of that piece, that is currently being downloaded from a specific peer by looking at the next four members. downloading_piece_index is the index of the piece that is currently being downloaded. diff --git a/docs/manual.rst b/docs/manual.rst index 4146e9341..9cf7c6b56 100755 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -557,6 +557,8 @@ It contains the following fields:: float download_rate; float upload_rate; + int num_peers; + std::vector pieces; std::size_t total_done; }; @@ -606,6 +608,8 @@ the pieces we don't have. torrent. These will usually have better precision than summing the rates from all peers. The rates are given as the number of bytes per second. +``num_peers`` is the number of peers this torrent currently is connected to. + ``total_done`` is the total number of bytes of the file(s) that we have. get_download_queue() diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 90d90cdab..042edb1d5 100755 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -72,6 +72,7 @@ namespace libtorrent , total_payload_upload(0) , download_rate(0) , upload_rate(0) + , num_peers(0) , total_done(0) {} @@ -102,6 +103,10 @@ namespace libtorrent float download_rate; float upload_rate; + // the number of peers this torrent + // is connected to. + int num_peers; + std::vector pieces; // the number of bytes of the file we have diff --git a/src/torrent.cpp b/src/torrent.cpp index 92f69af90..d34861b62 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -793,6 +793,8 @@ namespace libtorrent st.next_announce = next_announce() - boost::posix_time::second_clock::local_time(); + st.num_peers = m_connections.size(); + // TODO: this is not accurate because it assumes the last // block is m_block_size bytes // TODO: st.pieces could be a const pointer maybe?