From 0241bf78ce9e22cffb5f64a12c7583e675334dbf Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 17 Jun 2008 08:30:04 +0000 Subject: [PATCH] added is_sequential_download to torrent_handle --- docs/manual.html | 12 ++++++++---- docs/manual.rst | 13 +++++++++---- include/libtorrent/torrent.hpp | 2 ++ include/libtorrent/torrent_handle.hpp | 1 + src/torrent_handle.cpp | 6 ++++++ 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/docs/manual.html b/docs/manual.html index ef1748e00..c7e43cb25 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -92,7 +92,7 @@
  • name()
  • set_ratio()
  • set_upload_limit() set_download_limit() upload_limit() download_limit()
  • -
  • set_sequential_download()
  • +
  • set_sequential_download() is_sequential_download()
  • set_peer_upload_limit() set_peer_download_limit()
  • pause() resume() is_paused()
  • force_recheck()
  • @@ -1596,6 +1596,7 @@ struct torrent_handle void set_download_limit(int limit) const; int download_limit() 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_download_limit(asio::ip::tcp::endpoint ip, int limit) const; @@ -1819,16 +1820,19 @@ limit.

    download, respectively.

    -

    set_sequential_download()

    +

    set_sequential_download() is_sequential_download()

     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 -instead of rarest first.

    +

    set_sequential_download() enables or disables sequential download. When enabled, the piece +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.

    +

    is_sequential_download() returns true if this torrent is downloading in sequence, and false +otherwise.

    set_peer_upload_limit() set_peer_download_limit()

    diff --git a/docs/manual.rst b/docs/manual.rst index c9537554c..f6e02006e 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -1516,6 +1516,7 @@ Its declaration looks like this:: void set_download_limit(int limit) const; int download_limit() 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_download_limit(asio::ip::tcp::endpoint ip, int limit) const; @@ -1749,19 +1750,23 @@ limit. download, respectively. -set_sequential_download() -------------------------- +set_sequential_download() is_sequential_download() +-------------------------------------------------- :: 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 -instead of rarest first. +``set_sequential_download()`` enables or disables *sequential download*. When enabled, the piece +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. +``is_sequential_download()`` returns true if this torrent is downloading in sequence, and false +otherwise. + set_peer_upload_limit() set_peer_download_limit() ------------------------------------------------- diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index d08ee8b89..7f1e5f944 100755 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -171,6 +171,8 @@ namespace libtorrent aux::session_impl& session() { return m_ses; } void set_sequential_download(bool sd); + bool is_sequential_download() const + { return m_sequential_download; } void set_queue_position(int p); int queue_position() const { return m_sequence_number; } diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 636e842f0..25e9bbf21 100755 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -429,6 +429,7 @@ namespace libtorrent int download_limit() 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_download_limit(tcp::endpoint ip, int limit) const; diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index fe70c4b92..31e28e3a6 100755 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -344,6 +344,12 @@ namespace libtorrent 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 { INVARIANT_CHECK;