forked from premiere/premiere-libtorrent
added download_limit and upload_limit functions to torrent_handle
This commit is contained in:
parent
4710a073a1
commit
4ceb6a02ea
|
@ -79,7 +79,7 @@
|
||||||
<li><a class="reference" href="#connect-peer" id="id62" name="id62">connect_peer()</a></li>
|
<li><a class="reference" href="#connect-peer" id="id62" name="id62">connect_peer()</a></li>
|
||||||
<li><a class="reference" href="#name" id="id63" name="id63">name()</a></li>
|
<li><a class="reference" href="#name" id="id63" name="id63">name()</a></li>
|
||||||
<li><a class="reference" href="#set-ratio" id="id64" name="id64">set_ratio()</a></li>
|
<li><a class="reference" href="#set-ratio" id="id64" name="id64">set_ratio()</a></li>
|
||||||
<li><a class="reference" href="#set-upload-limit-set-download-limit" id="id65" name="id65">set_upload_limit() set_download_limit()</a></li>
|
<li><a class="reference" href="#set-upload-limit-set-download-limit-upload-limit-download-limit" id="id65" name="id65">set_upload_limit() set_download_limit() upload_limit() download_limit()</a></li>
|
||||||
<li><a class="reference" href="#set-sequenced-download-threshold" id="id66" name="id66">set_sequenced_download_threshold()</a></li>
|
<li><a class="reference" href="#set-sequenced-download-threshold" id="id66" name="id66">set_sequenced_download_threshold()</a></li>
|
||||||
<li><a class="reference" href="#set-peer-upload-limit-set-peer-download-limit" id="id67" name="id67">set_peer_upload_limit() set_peer_download_limit()</a></li>
|
<li><a class="reference" href="#set-peer-upload-limit-set-peer-download-limit" id="id67" name="id67">set_peer_upload_limit() set_peer_download_limit()</a></li>
|
||||||
<li><a class="reference" href="#pause-resume-is-paused" id="id68" name="id68">pause() resume() is_paused()</a></li>
|
<li><a class="reference" href="#pause-resume-is-paused" id="id68" name="id68">pause() resume() is_paused()</a></li>
|
||||||
|
@ -1258,7 +1258,9 @@ struct torrent_handle
|
||||||
void set_max_uploads(int max_uploads) const;
|
void set_max_uploads(int max_uploads) const;
|
||||||
void set_max_connections(int max_connections) const;
|
void set_max_connections(int max_connections) const;
|
||||||
void set_upload_limit(int limit) const;
|
void set_upload_limit(int limit) const;
|
||||||
|
int upload_limit() const;
|
||||||
void set_download_limit(int limit) const;
|
void set_download_limit(int limit) const;
|
||||||
|
int download_limit() const;
|
||||||
void set_sequenced_download_threshold(int threshold) const;
|
void set_sequenced_download_threshold(int threshold) const;
|
||||||
|
|
||||||
void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const;
|
void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const;
|
||||||
|
@ -1442,11 +1444,13 @@ attempt to upload in return for each download. e.g. if set to 2, the client will
|
||||||
as a standard client.</p>
|
as a standard client.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h2><a id="set-upload-limit-set-download-limit" name="set-upload-limit-set-download-limit">set_upload_limit() set_download_limit()</a></h2>
|
<h2><a id="set-upload-limit-set-download-limit-upload-limit-download-limit" name="set-upload-limit-set-download-limit-upload-limit-download-limit">set_upload_limit() set_download_limit() upload_limit() download_limit()</a></h2>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
void set_upload_limit(int limit) const;
|
void set_upload_limit(int limit) const;
|
||||||
void set_download_limit(int limit) const;
|
void set_download_limit(int limit) const;
|
||||||
|
int upload_limit() const;
|
||||||
|
int download_limit() const;
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<p><tt class="docutils literal"><span class="pre">set_upload_limit</span></tt> will limit the upload bandwidth used by this particular torrent to the
|
<p><tt class="docutils literal"><span class="pre">set_upload_limit</span></tt> will limit the upload bandwidth used by this particular torrent to the
|
||||||
|
@ -1455,6 +1459,8 @@ limit you set. It is given as the number of bytes per second the torrent is allo
|
||||||
Note that setting a higher limit on a torrent then the global limit (<tt class="docutils literal"><span class="pre">session::set_upload_rate_limit</span></tt>)
|
Note that setting a higher limit on a torrent then the global limit (<tt class="docutils literal"><span class="pre">session::set_upload_rate_limit</span></tt>)
|
||||||
will not override the global rate limit. The torrent can never upload more than the global rate
|
will not override the global rate limit. The torrent can never upload more than the global rate
|
||||||
limit.</p>
|
limit.</p>
|
||||||
|
<p><tt class="docutils literal"><span class="pre">upload_limit</span></tt> and <tt class="docutils literal"><span class="pre">download_limit</span></tt> will return the current limit setting, for upload and
|
||||||
|
download, respectively.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h2><a id="set-sequenced-download-threshold" name="set-sequenced-download-threshold">set_sequenced_download_threshold()</a></h2>
|
<h2><a id="set-sequenced-download-threshold" name="set-sequenced-download-threshold">set_sequenced_download_threshold()</a></h2>
|
||||||
|
|
|
@ -1202,7 +1202,9 @@ Its declaration looks like this::
|
||||||
void set_max_uploads(int max_uploads) const;
|
void set_max_uploads(int max_uploads) const;
|
||||||
void set_max_connections(int max_connections) const;
|
void set_max_connections(int max_connections) const;
|
||||||
void set_upload_limit(int limit) const;
|
void set_upload_limit(int limit) const;
|
||||||
|
int upload_limit() const;
|
||||||
void set_download_limit(int limit) const;
|
void set_download_limit(int limit) const;
|
||||||
|
int download_limit() const;
|
||||||
void set_sequenced_download_threshold(int threshold) const;
|
void set_sequenced_download_threshold(int threshold) const;
|
||||||
|
|
||||||
void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const;
|
void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const;
|
||||||
|
@ -1397,13 +1399,15 @@ attempt to upload in return for each download. e.g. if set to 2, the client will
|
||||||
as a standard client.
|
as a standard client.
|
||||||
|
|
||||||
|
|
||||||
set_upload_limit() set_download_limit()
|
set_upload_limit() set_download_limit() upload_limit() download_limit()
|
||||||
---------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
void set_upload_limit(int limit) const;
|
void set_upload_limit(int limit) const;
|
||||||
void set_download_limit(int limit) const;
|
void set_download_limit(int limit) const;
|
||||||
|
int upload_limit() const;
|
||||||
|
int download_limit() const;
|
||||||
|
|
||||||
``set_upload_limit`` will limit the upload bandwidth used by this particular torrent to the
|
``set_upload_limit`` will limit the upload bandwidth used by this particular torrent to the
|
||||||
limit you set. It is given as the number of bytes per second the torrent is allowed to upload.
|
limit you set. It is given as the number of bytes per second the torrent is allowed to upload.
|
||||||
|
@ -1412,6 +1416,9 @@ Note that setting a higher limit on a torrent then the global limit (``session::
|
||||||
will not override the global rate limit. The torrent can never upload more than the global rate
|
will not override the global rate limit. The torrent can never upload more than the global rate
|
||||||
limit.
|
limit.
|
||||||
|
|
||||||
|
``upload_limit`` and ``download_limit`` will return the current limit setting, for upload and
|
||||||
|
download, respectively.
|
||||||
|
|
||||||
|
|
||||||
set_sequenced_download_threshold()
|
set_sequenced_download_threshold()
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
|
@ -467,7 +467,10 @@ namespace libtorrent
|
||||||
void set_peer_download_limit(tcp::endpoint ip, int limit);
|
void set_peer_download_limit(tcp::endpoint ip, int limit);
|
||||||
|
|
||||||
void set_upload_limit(int limit);
|
void set_upload_limit(int limit);
|
||||||
|
int upload_limit() const;
|
||||||
void set_download_limit(int limit);
|
void set_download_limit(int limit);
|
||||||
|
int download_limit() const;
|
||||||
|
|
||||||
void set_max_uploads(int limit);
|
void set_max_uploads(int limit);
|
||||||
void set_max_connections(int limit);
|
void set_max_connections(int limit);
|
||||||
bool move_storage(boost::filesystem::path const& save_path);
|
bool move_storage(boost::filesystem::path const& save_path);
|
||||||
|
|
|
@ -301,7 +301,10 @@ namespace libtorrent
|
||||||
// abort the torrent.
|
// abort the torrent.
|
||||||
|
|
||||||
void set_upload_limit(int limit) const;
|
void set_upload_limit(int limit) const;
|
||||||
|
int upload_limit() const;
|
||||||
void set_download_limit(int limit) const;
|
void set_download_limit(int limit) const;
|
||||||
|
int download_limit() const;
|
||||||
|
|
||||||
void set_sequenced_download_threshold(int threshold) const;
|
void set_sequenced_download_threshold(int threshold) const;
|
||||||
|
|
||||||
void set_peer_upload_limit(tcp::endpoint ip, int limit) const;
|
void set_peer_upload_limit(tcp::endpoint ip, int limit) const;
|
||||||
|
|
|
@ -2406,6 +2406,13 @@ namespace libtorrent
|
||||||
m_bandwidth_limit[peer_connection::upload_channel].throttle(limit);
|
m_bandwidth_limit[peer_connection::upload_channel].throttle(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int torrent::upload_limit() const
|
||||||
|
{
|
||||||
|
int limit = m_bandwidth_limit[peer_connection::upload_channel].throttle();
|
||||||
|
if (limit == std::numeric_limits<int>::max()) limit = -1;
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
void torrent::set_download_limit(int limit)
|
void torrent::set_download_limit(int limit)
|
||||||
{
|
{
|
||||||
assert(limit >= -1);
|
assert(limit >= -1);
|
||||||
|
@ -2414,6 +2421,13 @@ namespace libtorrent
|
||||||
m_bandwidth_limit[peer_connection::download_channel].throttle(limit);
|
m_bandwidth_limit[peer_connection::download_channel].throttle(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int torrent::download_limit() const
|
||||||
|
{
|
||||||
|
int limit = m_bandwidth_limit[peer_connection::download_channel].throttle();
|
||||||
|
if (limit == std::numeric_limits<int>::max()) limit = -1;
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
void torrent::pause()
|
void torrent::pause()
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
|
@ -181,6 +181,13 @@ namespace libtorrent
|
||||||
, bind(&torrent::set_upload_limit, _1, limit));
|
, bind(&torrent::set_upload_limit, _1, limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int torrent_handle::upload_limit() const
|
||||||
|
{
|
||||||
|
INVARIANT_CHECK;
|
||||||
|
return call_member<int>(m_ses, m_chk, m_info_hash
|
||||||
|
, bind(&torrent::upload_limit, _1));
|
||||||
|
}
|
||||||
|
|
||||||
void torrent_handle::set_download_limit(int limit) const
|
void torrent_handle::set_download_limit(int limit) const
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
@ -191,6 +198,13 @@ namespace libtorrent
|
||||||
, bind(&torrent::set_download_limit, _1, limit));
|
, bind(&torrent::set_download_limit, _1, limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int torrent_handle::download_limit() const
|
||||||
|
{
|
||||||
|
INVARIANT_CHECK;
|
||||||
|
return call_member<int>(m_ses, m_chk, m_info_hash
|
||||||
|
, bind(&torrent::download_limit, _1));
|
||||||
|
}
|
||||||
|
|
||||||
bool torrent_handle::move_storage(
|
bool torrent_handle::move_storage(
|
||||||
boost::filesystem::path const& save_path) const
|
boost::filesystem::path const& save_path) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue