diff --git a/ChangeLog b/ChangeLog index 2100ba82f..9bde90910 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ - * deprecate set_ratio() + * deprecate set_ratio(), and per-peer rate limits * add web seed support for torrents with pad files * introduced a more scalable API for torrent status updates (post_torrent_updates()) * updated the API to add_torrent_params turning all bools into flags of a flags field diff --git a/docs/manual.rst b/docs/manual.rst index f96f5fdea..6f34cd020 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -2298,11 +2298,6 @@ Its declaration looks like this:: void set_sequential_download(bool sd) const; bool is_sequential_download() const; - int get_peer_upload_limit(tcp::endpoint ip); - int get_peer_download_limit(tcp::endpoint ip); - void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const; - void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const; - int queue_position() const; void queue_position_up() const; void queue_position_down() const; @@ -2733,20 +2728,6 @@ picker will pick pieces in sequence instead of rarest first. Enabling sequential download will affect the piece distribution negatively in the swarm. It should be used sparingly. -get_peer_download_limit() get_peer_upload_limit() set_peer_upload_limit() set_peer_download_limit() ---------------------------------------------------------------------------------------------------- - - :: - - int get_peer_upload_limit(tcp::endpoint ip); - int get_peer_download_limit(tcp::endpoint ip); - void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const; - void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const; - -Works like ``get_upload_limit``, ``get_download_limit``, ``set_upload_limit`` and -``set_download_limit`` respectively, but controls individual peer instead of the -whole torrent. - pause() resume() ---------------- @@ -4498,8 +4479,6 @@ session_settings bool report_true_downloaded; bool strict_end_game_mode; - int default_peer_upload_rate; - int default_peer_download_rate; bool broadcast_lsd; bool enable_outgoing_utp; @@ -5213,13 +5192,6 @@ If this is ``false``, libtorrent attempts to use each peer connection to its max, by always requesting something, even if it means requesting something that has been requested from another peer already. -``default_peer_upload_rate`` and ``default_peer_download_rate`` specifies -the default upload and download rate limits for peers, respectively. These -default to 0, which means unlimited. These settings affect the rate limits -set on new peer connections (not existing ones). The peer rate limits can -be changed individually later using -`get_peer_download_limit() get_peer_upload_limit() set_peer_upload_limit() set_peer_download_limit()`_. - if ``broadcast_lsd`` is set to true, the local peer discovery (or Local Service Discovery) will not only use IP multicast, but also broadcast its messages. This can be useful when running on networks diff --git a/include/libtorrent/session_settings.hpp b/include/libtorrent/session_settings.hpp index 595693eda..2c4323e18 100644 --- a/include/libtorrent/session_settings.hpp +++ b/include/libtorrent/session_settings.hpp @@ -224,8 +224,6 @@ namespace libtorrent , incoming_starts_queued_torrents(false) , report_true_downloaded(false) , strict_end_game_mode(true) - , default_peer_upload_rate(0) - , default_peer_download_rate(0) , broadcast_lsd(true) , enable_outgoing_utp(true) , enable_incoming_utp(true) @@ -887,10 +885,6 @@ namespace libtorrent // until every piece is requested bool strict_end_game_mode; - // each peer will have these limits set on it - int default_peer_upload_rate; - int default_peer_download_rate; - // if this is true, the broadcast socket will not only use IP multicast // but also send the messages on the broadcast address. This is false by // default in order to avoid flooding networks for no good reason. If diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index cbc77ae45..578f575f6 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -266,6 +266,16 @@ namespace libtorrent // ================ start deprecation ============ #ifndef TORRENT_NO_DEPRECATE + // deprecated in 0.16, feature will be removed + TORRENT_DEPRECATED_PREFIX + int get_peer_upload_limit(tcp::endpoint ip) const TORRENT_DEPRECATED; + TORRENT_DEPRECATED_PREFIX + int get_peer_download_limit(tcp::endpoint ip) const TORRENT_DEPRECATED; + TORRENT_DEPRECATED_PREFIX + void set_peer_upload_limit(tcp::endpoint ip, int limit) const TORRENT_DEPRECATED; + TORRENT_DEPRECATED_PREFIX + void set_peer_download_limit(tcp::endpoint ip, int limit) const TORRENT_DEPRECATED; + // deprecated in 0.16, feature will be removed TORRENT_DEPRECATED_PREFIX void set_ratio(float up_down_ratio) const TORRENT_DEPRECATED; @@ -364,11 +374,6 @@ namespace libtorrent void set_sequential_download(bool sd) const; - int get_peer_upload_limit(tcp::endpoint ip) const; - int get_peer_download_limit(tcp::endpoint ip) const; - void set_peer_upload_limit(tcp::endpoint ip, int limit) const; - void set_peer_download_limit(tcp::endpoint ip, int limit) const; - // manually connect a peer void connect_peer(tcp::endpoint const& adr, int source = 0) const; diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 536c2047d..7b22f3a70 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -398,8 +398,6 @@ namespace aux { TORRENT_SETTING(boolean, incoming_starts_queued_torrents) TORRENT_SETTING(boolean, report_true_downloaded) TORRENT_SETTING(boolean, strict_end_game_mode) - TORRENT_SETTING(integer, default_peer_upload_rate) - TORRENT_SETTING(integer, default_peer_download_rate) TORRENT_SETTING(boolean, broadcast_lsd) TORRENT_SETTING(boolean, enable_outgoing_utp) TORRENT_SETTING(boolean, enable_incoming_utp) @@ -2532,10 +2530,6 @@ namespace aux { { m_connections.insert(c); c->start(); - if (m_settings.default_peer_upload_rate) - c->set_upload_limit(m_settings.default_peer_upload_rate); - if (m_settings.default_peer_download_rate) - c->set_download_limit(m_settings.default_peer_download_rate); // update the next disk peer round-robin cursor if (m_next_disk_peer == m_connections.end()) m_next_disk_peer = m_connections.begin(); } diff --git a/src/torrent.cpp b/src/torrent.cpp index 1232fa8d7..b51f03eac 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1565,10 +1565,6 @@ ctx->set_verify_callback(verify_function, ec); m_connections.insert(boost::get_pointer(c)); m_ses.m_connections.insert(c); c->start(); - if (settings().default_peer_upload_rate) - c->set_upload_limit(settings().default_peer_upload_rate); - if (settings().default_peer_download_rate) - c->set_download_limit(settings().default_peer_download_rate); } #endif @@ -5538,11 +5534,6 @@ ctx->set_verify_callback(verify_function, ec); c->m_in_constructor = false; #endif - if (settings().default_peer_upload_rate) - c->set_upload_limit(settings().default_peer_upload_rate); - if (settings().default_peer_download_rate) - c->set_download_limit(settings().default_peer_download_rate); - c->add_stat(size_type(peerinfo->prev_amount_download) << 10 , size_type(peerinfo->prev_amount_upload) << 10); peerinfo->prev_amount_download = 0; diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index 03367259d..42be22823 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -246,34 +246,6 @@ namespace libtorrent TORRENT_ASYNC_CALL1(set_max_connections, max_connections); } - int torrent_handle::get_peer_upload_limit(tcp::endpoint ip) const - { - INVARIANT_CHECK; - TORRENT_SYNC_CALL_RET1(int, -1, get_peer_upload_limit, ip); - return r; - } - - int torrent_handle::get_peer_download_limit(tcp::endpoint ip) const - { - INVARIANT_CHECK; - TORRENT_SYNC_CALL_RET1(int, -1, get_peer_download_limit, ip); - return r; - } - - void torrent_handle::set_peer_upload_limit(tcp::endpoint ip, int limit) const - { - INVARIANT_CHECK; - TORRENT_ASSERT(limit >= -1); - TORRENT_ASYNC_CALL2(set_peer_upload_limit, ip, limit); - } - - void torrent_handle::set_peer_download_limit(tcp::endpoint ip, int limit) const - { - INVARIANT_CHECK; - TORRENT_ASSERT(limit >= -1); - TORRENT_ASYNC_CALL2(set_peer_download_limit, ip, limit); - } - void torrent_handle::set_upload_limit(int limit) const { INVARIANT_CHECK; @@ -573,6 +545,34 @@ namespace libtorrent #ifndef TORRENT_NO_DEPRECATE // ============ start deprecation =============== + int torrent_handle::get_peer_upload_limit(tcp::endpoint ip) const + { + INVARIANT_CHECK; + TORRENT_SYNC_CALL_RET1(int, -1, get_peer_upload_limit, ip); + return r; + } + + int torrent_handle::get_peer_download_limit(tcp::endpoint ip) const + { + INVARIANT_CHECK; + TORRENT_SYNC_CALL_RET1(int, -1, get_peer_download_limit, ip); + return r; + } + + void torrent_handle::set_peer_upload_limit(tcp::endpoint ip, int limit) const + { + INVARIANT_CHECK; + TORRENT_ASSERT(limit >= -1); + TORRENT_ASYNC_CALL2(set_peer_upload_limit, ip, limit); + } + + void torrent_handle::set_peer_download_limit(tcp::endpoint ip, int limit) const + { + INVARIANT_CHECK; + TORRENT_ASSERT(limit >= -1); + TORRENT_ASYNC_CALL2(set_peer_download_limit, ip, limit); + } + void torrent_handle::set_ratio(float ratio) const { INVARIANT_CHECK;