deprecated per-peer rate limits (and removed them from libtorrent_aio)

This commit is contained in:
Arvid Norberg 2011-12-18 12:52:09 +00:00
parent 78f16cedd9
commit ef724014aa
7 changed files with 39 additions and 83 deletions

View File

@ -1,4 +1,4 @@
* deprecate set_ratio() * deprecate set_ratio(), and per-peer rate limits
* add web seed support for torrents with pad files * add web seed support for torrents with pad files
* introduced a more scalable API for torrent status updates (post_torrent_updates()) * 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 * updated the API to add_torrent_params turning all bools into flags of a flags field

View File

@ -2298,11 +2298,6 @@ Its declaration looks like this::
void set_sequential_download(bool sd) const; void set_sequential_download(bool sd) const;
bool is_sequential_download() 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; int queue_position() const;
void queue_position_up() const; void queue_position_up() const;
void queue_position_down() 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 Enabling sequential download will affect the piece distribution negatively in the swarm. It should be
used sparingly. 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() pause() resume()
---------------- ----------------
@ -4498,8 +4479,6 @@ session_settings
bool report_true_downloaded; bool report_true_downloaded;
bool strict_end_game_mode; bool strict_end_game_mode;
int default_peer_upload_rate;
int default_peer_download_rate;
bool broadcast_lsd; bool broadcast_lsd;
bool enable_outgoing_utp; 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 to its max, by always requesting something, even if it means requesting
something that has been requested from another peer already. 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 if ``broadcast_lsd`` is set to true, the local peer discovery
(or Local Service Discovery) will not only use IP multicast, but also (or Local Service Discovery) will not only use IP multicast, but also
broadcast its messages. This can be useful when running on networks broadcast its messages. This can be useful when running on networks

View File

@ -224,8 +224,6 @@ namespace libtorrent
, incoming_starts_queued_torrents(false) , incoming_starts_queued_torrents(false)
, report_true_downloaded(false) , report_true_downloaded(false)
, strict_end_game_mode(true) , strict_end_game_mode(true)
, default_peer_upload_rate(0)
, default_peer_download_rate(0)
, broadcast_lsd(true) , broadcast_lsd(true)
, enable_outgoing_utp(true) , enable_outgoing_utp(true)
, enable_incoming_utp(true) , enable_incoming_utp(true)
@ -887,10 +885,6 @@ namespace libtorrent
// until every piece is requested // until every piece is requested
bool strict_end_game_mode; 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 // 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 // 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 // default in order to avoid flooding networks for no good reason. If

View File

@ -266,6 +266,16 @@ namespace libtorrent
// ================ start deprecation ============ // ================ start deprecation ============
#ifndef TORRENT_NO_DEPRECATE #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 // deprecated in 0.16, feature will be removed
TORRENT_DEPRECATED_PREFIX TORRENT_DEPRECATED_PREFIX
void set_ratio(float up_down_ratio) const TORRENT_DEPRECATED; void set_ratio(float up_down_ratio) const TORRENT_DEPRECATED;
@ -364,11 +374,6 @@ namespace libtorrent
void set_sequential_download(bool sd) const; 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 // manually connect a peer
void connect_peer(tcp::endpoint const& adr, int source = 0) const; void connect_peer(tcp::endpoint const& adr, int source = 0) const;

View File

@ -398,8 +398,6 @@ namespace aux {
TORRENT_SETTING(boolean, incoming_starts_queued_torrents) TORRENT_SETTING(boolean, incoming_starts_queued_torrents)
TORRENT_SETTING(boolean, report_true_downloaded) TORRENT_SETTING(boolean, report_true_downloaded)
TORRENT_SETTING(boolean, strict_end_game_mode) 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, broadcast_lsd)
TORRENT_SETTING(boolean, enable_outgoing_utp) TORRENT_SETTING(boolean, enable_outgoing_utp)
TORRENT_SETTING(boolean, enable_incoming_utp) TORRENT_SETTING(boolean, enable_incoming_utp)
@ -2532,10 +2530,6 @@ namespace aux {
{ {
m_connections.insert(c); m_connections.insert(c);
c->start(); 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 // update the next disk peer round-robin cursor
if (m_next_disk_peer == m_connections.end()) m_next_disk_peer = m_connections.begin(); if (m_next_disk_peer == m_connections.end()) m_next_disk_peer = m_connections.begin();
} }

View File

@ -1565,10 +1565,6 @@ ctx->set_verify_callback(verify_function, ec);
m_connections.insert(boost::get_pointer(c)); m_connections.insert(boost::get_pointer(c));
m_ses.m_connections.insert(c); m_ses.m_connections.insert(c);
c->start(); 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 #endif
@ -5538,11 +5534,6 @@ ctx->set_verify_callback(verify_function, ec);
c->m_in_constructor = false; c->m_in_constructor = false;
#endif #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 c->add_stat(size_type(peerinfo->prev_amount_download) << 10
, size_type(peerinfo->prev_amount_upload) << 10); , size_type(peerinfo->prev_amount_upload) << 10);
peerinfo->prev_amount_download = 0; peerinfo->prev_amount_download = 0;

View File

@ -246,34 +246,6 @@ namespace libtorrent
TORRENT_ASYNC_CALL1(set_max_connections, max_connections); 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 void torrent_handle::set_upload_limit(int limit) const
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
@ -573,6 +545,34 @@ namespace libtorrent
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
// ============ start deprecation =============== // ============ 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 void torrent_handle::set_ratio(float ratio) const
{ {
INVARIANT_CHECK; INVARIANT_CHECK;