diff --git a/docs/manual.html b/docs/manual.html index c2929db9e..5ec003705 100755 --- a/docs/manual.html +++ b/docs/manual.html @@ -56,70 +56,69 @@
Returns true if the torrent is in seed mode (i.e. if it has finished downloading).
---int num_complete() const; -int num_incomplete() const; --
These members returns the optional scrape data returned by the tracker in the announce response. -If the tracker did not return any scrape data the return value of these functions are -1. Note -that in some cases the tracker can return some scrape data, so there is no guarantee that all -functions returns -1 just because one of them do. num_complete() is the total number of -seeds in the swarm and num_incomplete() is the number of downloaders in the swarm.
-@@ -1221,6 +1206,9 @@ struct torrent_status int num_peers; + int num_complete; + int num_incomplete; + const std::vector<bool>* pieces; size_type total_done; @@ -1289,6 +1277,11 @@ total transfer rate of payload only, not counting protocol chatter. This might be slightly smaller than the other rates, but if projected over a long time (e.g. when calculating ETA:s) the difference may be noticable.num_peers is the number of peers this torrent currently is connected to.
+num_complete and num_incomplete are set to -1 if the tracker did not +send any scrape data in its announce reply. This data is optional and may +not be available from all trackers. If these are not -1, they are the total +number of peers that are seeding (complete) and the total number of peers +that are still downloading (incomplete) this torrent.
total_done is the total number of bytes of the file(s) that we have. All this does not necessarily has to be downloaded during this session (that's total_download_payload).
diff --git a/docs/manual.rst b/docs/manual.rst index 0fe5fede8..385a99d51 100755 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -931,21 +931,6 @@ is_seed() Returns true if the torrent is in seed mode (i.e. if it has finished downloading). -num_complete() num_incomplete() -------------------------------- - - :: - - int num_complete() const; - int num_incomplete() const; - -These members returns the optional scrape data returned by the tracker in the announce response. -If the tracker did not return any scrape data the return value of these functions are -1. Note -that in some cases the tracker can return some scrape data, so there is no guarantee that all -functions returns -1 just because one of them do. ``num_complete()`` is the total number of -seeds in the swarm and ``num_incomplete()`` is the number of downloaders in the swarm. - - has_metadata() -------------- @@ -1179,6 +1164,9 @@ It contains the following fields:: int num_peers; + int num_complete; + int num_incomplete; + const std::vector* pieces; size_type total_done; @@ -1251,6 +1239,12 @@ be slightly smaller than the other rates, but if projected over a long time ``num_peers`` is the number of peers this torrent currently is connected to. +``num_complete`` and ``num_incomplete`` are set to -1 if the tracker did not +send any scrape data in its announce reply. This data is optional and may +not be available from all trackers. If these are not -1, they are the total +number of peers that are seeding (complete) and the total number of peers +that are still downloading (incomplete) this torrent. + ``total_done`` is the total number of bytes of the file(s) that we have. All this does not necessarily has to be downloaded during this session (that's ``total_download_payload``). diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index eab0512d9..a10086ddb 100755 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -150,12 +150,6 @@ namespace libtorrent float ratio() const { return m_ratio; } - int num_complete() const - { return m_complete; } - - int num_incomplete() const - { return m_incomplete; } - // -------------------------------------------- // PEER MANAGEMENT diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index bc51acd2d..8f3541d3f 100755 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -85,6 +85,8 @@ namespace libtorrent , download_payload_rate(0) , upload_payload_rate(0) , num_peers(0) + , num_complete(-1) + , num_incomplete(-1) , pieces(0) , total_done(0) , num_seeds(0) @@ -137,6 +139,14 @@ namespace libtorrent // is connected to. int num_peers; + // if the tracker sends scrape info in its + // announce reply, these fields will be + // set to the total number of peers that + // have the whole file and the total number + // of peers that are still downloading + int num_complete; + int num_incomplete; + const std::vector * pieces; // the number of bytes of the file we have @@ -197,12 +207,6 @@ namespace libtorrent void pause(); void resume(); - // interface for requesting tracker scrape data - // from tha last tracker announce response - // (optional, only sent by some trackers) - int num_complete() const; - int num_incomplete() const; - // set the interface to bind outgoing connections // to. void use_interface(const char* net_interface); diff --git a/src/identify_client.cpp b/src/identify_client.cpp index 7108ab46a..9e3297ca8 100755 --- a/src/identify_client.cpp +++ b/src/identify_client.cpp @@ -158,6 +158,7 @@ namespace , map_entry("AR", "Arctic Torrent") , map_entry("AZ", "Azureus") , map_entry("BB", "BitBuddy") + , map_entry("BS", "BTSlave") , map_entry("BX", "BittorrentX") , map_entry("CT", "CTorrent") , map_entry("LT", "libtorrent") @@ -170,6 +171,7 @@ namespace , map_entry("TS", "TorrentStorm") , map_entry("U", "UPnP") , map_entry("XT", "XanTorrent") + , map_entry("ZT", "ZipTorrent") , map_entry("eX", "eXeem") }; diff --git a/src/torrent.cpp b/src/torrent.cpp index d804ad4fa..ed8720803 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -978,6 +978,8 @@ namespace libtorrent st.block_size = block_size(); st.num_peers = num_peers(); + st.num_complete = m_complete; + st.num_incomplete = m_incomplete; st.paused = m_paused; st.total_done = bytes_done(); diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index 368d96236..6c90efe61 100755 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -271,21 +271,6 @@ namespace libtorrent , bind(&torrent::resume, _1)); } - - int torrent_handle::num_complete() const - { - INVARIANT_CHECK; - return call_member (m_ses, m_chk, m_info_hash - , bind(&torrent::num_complete, _1)); - } - - int torrent_handle::num_incomplete() const - { - INVARIANT_CHECK; - return call_member (m_ses, m_chk, m_info_hash - , bind(&torrent::num_incomplete, _1)); - } - void torrent_handle::set_tracker_login(std::string const& name, std::string const& password) { INVARIANT_CHECK;