added is_sequential_download to torrent_handle

This commit is contained in:
Arvid Norberg 2008-06-17 08:30:04 +00:00
parent b55670aa14
commit 0241bf78ce
5 changed files with 26 additions and 8 deletions

View File

@ -92,7 +92,7 @@
<li><a class="reference" href="#name" id="id76" name="id76">name()</a></li> <li><a class="reference" href="#name" id="id76" name="id76">name()</a></li>
<li><a class="reference" href="#set-ratio" id="id77" name="id77">set_ratio()</a></li> <li><a class="reference" href="#set-ratio" id="id77" name="id77">set_ratio()</a></li>
<li><a class="reference" href="#set-upload-limit-set-download-limit-upload-limit-download-limit" id="id78" name="id78">set_upload_limit() set_download_limit() upload_limit() download_limit()</a></li> <li><a class="reference" href="#set-upload-limit-set-download-limit-upload-limit-download-limit" id="id78" name="id78">set_upload_limit() set_download_limit() upload_limit() download_limit()</a></li>
<li><a class="reference" href="#set-sequential-download" id="id79" name="id79">set_sequential_download()</a></li> <li><a class="reference" href="#set-sequential-download-is-sequential-download" id="id79" name="id79">set_sequential_download() is_sequential_download()</a></li>
<li><a class="reference" href="#set-peer-upload-limit-set-peer-download-limit" id="id80" name="id80">set_peer_upload_limit() set_peer_download_limit()</a></li> <li><a class="reference" href="#set-peer-upload-limit-set-peer-download-limit" id="id80" name="id80">set_peer_upload_limit() set_peer_download_limit()</a></li>
<li><a class="reference" href="#pause-resume-is-paused" id="id81" name="id81">pause() resume() is_paused()</a></li> <li><a class="reference" href="#pause-resume-is-paused" id="id81" name="id81">pause() resume() is_paused()</a></li>
<li><a class="reference" href="#force-recheck" id="id82" name="id82">force_recheck()</a></li> <li><a class="reference" href="#force-recheck" id="id82" name="id82">force_recheck()</a></li>
@ -1596,6 +1596,7 @@ struct torrent_handle
void set_download_limit(int limit) const; void set_download_limit(int limit) const;
int download_limit() const; int download_limit() const;
void set_sequential_download(bool sd) const; void set_sequential_download(bool sd) const;
bool is_sequential_download() 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;
void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const; void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const;
@ -1819,16 +1820,19 @@ limit.</p>
download, respectively.</p> download, respectively.</p>
</div> </div>
<div class="section"> <div class="section">
<h2><a id="set-sequential-download" name="set-sequential-download">set_sequential_download()</a></h2> <h2><a id="set-sequential-download-is-sequential-download" name="set-sequential-download-is-sequential-download">set_sequential_download() is_sequential_download()</a></h2>
<blockquote> <blockquote>
<pre class="literal-block"> <pre class="literal-block">
void set_sequential_download(bool sd); void set_sequential_download(bool sd);
bool is_sequential_download() const;
</pre> </pre>
</blockquote> </blockquote>
<p>Enables or disables <em>sequential download</em>. When enabled, the piece picker will pick pieces in sequence <p><tt class="docutils literal"><span class="pre">set_sequential_download()</span></tt> enables or disables <em>sequential download</em>. When enabled, the piece
instead of rarest first.</p> picker will pick pieces in sequence instead of rarest first.</p>
<p>Enabling sequential download will affect the piece distribution negatively in the swarm. It should be <p>Enabling sequential download will affect the piece distribution negatively in the swarm. It should be
used sparingly.</p> used sparingly.</p>
<p><tt class="docutils literal"><span class="pre">is_sequential_download()</span></tt> returns true if this torrent is downloading in sequence, and false
otherwise.</p>
</div> </div>
<div class="section"> <div class="section">
<h2><a id="set-peer-upload-limit-set-peer-download-limit" name="set-peer-upload-limit-set-peer-download-limit">set_peer_upload_limit() set_peer_download_limit()</a></h2> <h2><a id="set-peer-upload-limit-set-peer-download-limit" name="set-peer-upload-limit-set-peer-download-limit">set_peer_upload_limit() set_peer_download_limit()</a></h2>

View File

@ -1516,6 +1516,7 @@ Its declaration looks like this::
void set_download_limit(int limit) const; void set_download_limit(int limit) const;
int download_limit() const; int download_limit() const;
void set_sequential_download(bool sd) const; void set_sequential_download(bool sd) const;
bool is_sequential_download() 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;
void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const; void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const;
@ -1749,19 +1750,23 @@ limit.
download, respectively. download, respectively.
set_sequential_download() set_sequential_download() is_sequential_download()
------------------------- --------------------------------------------------
:: ::
void set_sequential_download(bool sd); void set_sequential_download(bool sd);
bool is_sequential_download() const;
Enables or disables *sequential download*. When enabled, the piece picker will pick pieces in sequence ``set_sequential_download()`` enables or disables *sequential download*. When enabled, the piece
instead of rarest first. 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.
``is_sequential_download()`` returns true if this torrent is downloading in sequence, and false
otherwise.
set_peer_upload_limit() set_peer_download_limit() set_peer_upload_limit() set_peer_download_limit()
------------------------------------------------- -------------------------------------------------

View File

@ -171,6 +171,8 @@ namespace libtorrent
aux::session_impl& session() { return m_ses; } aux::session_impl& session() { return m_ses; }
void set_sequential_download(bool sd); void set_sequential_download(bool sd);
bool is_sequential_download() const
{ return m_sequential_download; }
void set_queue_position(int p); void set_queue_position(int p);
int queue_position() const { return m_sequence_number; } int queue_position() const { return m_sequence_number; }

View File

@ -429,6 +429,7 @@ namespace libtorrent
int download_limit() const; int download_limit() const;
void set_sequential_download(bool sd) const; void set_sequential_download(bool sd) const;
bool is_sequential_download() const;
void set_peer_upload_limit(tcp::endpoint ip, int limit) const; void set_peer_upload_limit(tcp::endpoint ip, int limit) const;
void set_peer_download_limit(tcp::endpoint ip, int limit) const; void set_peer_download_limit(tcp::endpoint ip, int limit) const;

View File

@ -344,6 +344,12 @@ namespace libtorrent
TORRENT_FORWARD(set_sequential_download(sd)); TORRENT_FORWARD(set_sequential_download(sd));
} }
bool torrent_handle::is_sequential_download() const
{
INVARIANT_CHECK;
TORRENT_FORWARD_RETURN(is_sequential_download(), false);
}
std::string torrent_handle::name() const std::string torrent_handle::name() const
{ {
INVARIANT_CHECK; INVARIANT_CHECK;