diff --git a/docs/manual.html b/docs/manual.html index 389864d2f..c2929db9e 100755 --- a/docs/manual.html +++ b/docs/manual.html @@ -56,7 +56,7 @@
  • set_upload_limit() set_download_limit()
  • pause() resume() is_paused()
  • is_seed()
  • -
  • num_complete() num_incomplete() num_downloaded()
  • +
  • num_complete() num_incomplete()
  • has_metadata()
  • set_tracker_login()
  • use_interface()
  • @@ -869,7 +869,6 @@ struct torrent_handle int num_complete() const; int num_incomplete() const; - int num_downloaded() const; bool has_metadata() const; @@ -989,21 +988,19 @@ bool is_seed() const;

    Returns true if the torrent is in seed mode (i.e. if it has finished downloading).

    -
    -

    num_complete() num_incomplete() num_downloaded()

    +
    +

    num_complete() num_incomplete()

     int num_complete() const;
     int num_incomplete() const;
    -int num_downloaded() 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. num_incomplete() is the number of downloaders in the swarm and -num_downloaded() is the number of times this torrent has been downloaded.

    +seeds in the swarm and num_incomplete() is the number of downloaders in the swarm.

    has_metadata()

    diff --git a/docs/manual.rst b/docs/manual.rst index bc043e1f5..0fe5fede8 100755 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -803,7 +803,6 @@ Its declaration looks like this:: int num_complete() const; int num_incomplete() const; - int num_downloaded() const; bool has_metadata() const; @@ -931,21 +930,20 @@ is_seed() Returns true if the torrent is in seed mode (i.e. if it has finished downloading). -num_complete() num_incomplete() num_downloaded() ------------------------------------------------- + +num_complete() num_incomplete() +------------------------------- :: int num_complete() const; int num_incomplete() const; - int num_downloaded() 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. ``num_incomplete()`` is the number of downloaders in the swarm and -``num_downloaded()`` is the number of times this torrent has been downloaded. +seeds in the swarm and ``num_incomplete()`` is the number of downloaders in the swarm. has_metadata() diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 34948602e..eab0512d9 100755 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -156,9 +156,6 @@ namespace libtorrent int num_incomplete() const { return m_incomplete; } - int num_downloaded() const - { return m_downloaded; } - // -------------------------------------------- // PEER MANAGEMENT @@ -202,7 +199,7 @@ namespace libtorrent // when this torrent got a response from its tracker request // or when a failure occured virtual void tracker_response(std::vector& e, int interval - , int complete, int incomplete, int downloaded); + , int complete, int incomplete); virtual void tracker_request_timed_out(); virtual void tracker_request_error(int response_code, const std::string& str); @@ -407,7 +404,6 @@ namespace libtorrent // is optional and may be -1. int m_complete; int m_incomplete; - int m_downloaded; std::map m_connections; diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 64069cc51..bc51acd2d 100755 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -202,7 +202,6 @@ namespace libtorrent // (optional, only sent by some trackers) int num_complete() const; int num_incomplete() const; - int num_downloaded() const; // set the interface to bind outgoing connections // to. diff --git a/include/libtorrent/tracker_manager.hpp b/include/libtorrent/tracker_manager.hpp index d92923581..86f87d2e1 100755 --- a/include/libtorrent/tracker_manager.hpp +++ b/include/libtorrent/tracker_manager.hpp @@ -106,8 +106,7 @@ namespace libtorrent std::vector& peers , int interval , int complete - , int incomplete - , int downloaded) = 0; + , int incomplete) = 0; virtual void tracker_request_timed_out() = 0; virtual void tracker_request_error( int response_code diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp index df9578937..6a1f9cfb3 100755 --- a/src/http_tracker_connection.cpp +++ b/src/http_tracker_connection.cpp @@ -598,20 +598,15 @@ namespace libtorrent // look for optional crape info int complete = -1; int incomplete = -1; - int downloaded = -1; - try - { - entry const& f = e["files"]; - entry const& sd = f[std::string(m_req.info_hash.begin() - , m_req.info_hash.end())]; - complete = sd["complete"].integer(); - incomplete = sd["incomplete"].integer(); - downloaded = sd["downloaded"].integer(); - } + + try { complete = e["complete"].integer(); } + catch(type_error& e) {} + + try { incomplete = e["incomplete"].integer(); } catch(type_error& e) {} requester().tracker_response(peer_list, interval, complete - , incomplete, downloaded); + , incomplete); } catch(type_error& e) { diff --git a/src/torrent.cpp b/src/torrent.cpp index 26c8eae40..d804ad4fa 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -162,7 +162,6 @@ namespace libtorrent , m_duration(1800) , m_complete(-1) , m_incomplete(-1) - , m_downloaded(-1) , m_policy() , m_ses(ses) , m_picker(0) @@ -208,7 +207,6 @@ namespace libtorrent , m_duration(1800) , m_complete(-1) , m_incomplete(-1) - , m_downloaded(-1) , m_policy() , m_ses(ses) , m_picker(0) @@ -279,8 +277,7 @@ namespace libtorrent std::vector& peer_list , int interval , int complete - , int incomplete - , int downloaded) + , int incomplete) { m_failed_trackers = 0; // less than 5 minutes announce intervals @@ -305,7 +302,6 @@ namespace libtorrent if (complete >= 0) m_complete = complete; if (incomplete >= 0) m_incomplete = incomplete; - if (downloaded >= 0) m_downloaded = downloaded; // connect to random peers from the list std::random_shuffle(peer_list.begin(), peer_list.end()); @@ -943,7 +939,7 @@ namespace libtorrent assert(m_storage.get()); assert(piece_index >= 0); assert(piece_index < m_torrent_file.num_pieces()); - assert(piece_index < m_have_pieces.size()); + assert(piece_index < (int)m_have_pieces.size()); int size = static_cast(m_torrent_file.piece_size(piece_index)); std::vector buffer(size); @@ -1123,7 +1119,7 @@ namespace libtorrent std::pair req = offset_to_req(std::make_pair(offset, size) , total_size); - assert(req.first + req.second <= m_have_metadata.size()); + assert(req.first + req.second <= (int)m_have_metadata.size()); std::fill( m_have_metadata.begin() + req.first diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index 3b16b0b62..368d96236 100755 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -286,13 +286,6 @@ namespace libtorrent , bind(&torrent::num_incomplete, _1)); } - int torrent_handle::num_downloaded() const - { - INVARIANT_CHECK; - return call_member(m_ses, m_chk, m_info_hash - , bind(&torrent::num_downloaded, _1)); - } - void torrent_handle::set_tracker_login(std::string const& name, std::string const& password) { INVARIANT_CHECK; diff --git a/src/udp_tracker_connection.cpp b/src/udp_tracker_connection.cpp index aa76efd6b..f6a2a4d4b 100755 --- a/src/udp_tracker_connection.cpp +++ b/src/udp_tracker_connection.cpp @@ -278,7 +278,7 @@ namespace libtorrent peer_list.push_back(e); } - requester().tracker_response(peer_list, interval, complete, incomplete, -1); + requester().tracker_response(peer_list, interval, complete, incomplete); return true; }