diff --git a/docs/extension_protocol.html b/docs/extension_protocol.html index cbea09cfa..52fae31d5 100644 --- a/docs/extension_protocol.html +++ b/docs/extension_protocol.html @@ -116,8 +116,8 @@ i.e. The IDs are local to this particular peer.
Here are some other items that an implementation may choose to support:
name | @@ -133,10 +133,17 @@ this extension message, since its port number is already known.||
---|---|---|
v | -Client name and version (as an utf-8 string). + | Client name and version (as a utf-8 string). This is a much more reliable way of identifying the client than relying on the peer id encoding. |
yourip | +A string containing the compact representation of the ip +address this peer sees you as. i.e. this is the +receiver's external ip address (no port is included). +This may be both an IPv4 (4 bytes) or an IPv6 (16 bytes) +address. | +|
reqq | An integer, the number of outstanding request messages
this client supports without dropping any. The default in
diff --git a/docs/manual.html b/docs/manual.html
index 438b8ac5c..0a7316655 100644
--- a/docs/manual.html
+++ b/docs/manual.html
@@ -62,7 +62,7 @@
|
attempt. This may happen if there is a limit set on
the number of half-open TCP connections.
|
on_parole | +The peer has participated in a piece that failed the +hash check, and is now "on parole", which means we're +only requesting whole pieces from this peer until +it either fails that piece or proves that it doesn't +send bad data. | +|
seed | +This peer is a seed (it has all the pieces). | +|
optimistic_unchoke | +This peer is subject to an optimistic unchoke. It has +been unchoked for a while to see if it might unchoke +us in return an earn an upload/unchoke slot. If it +doesn't within some period of time, it will be choked +and another peer will be optimistically unchoked. | +
source is a combination of flags describing from which sources this peer @@ -3134,6 +3165,32 @@ struct peer_blocked_alert: alert
The storage_moved_alert is generated when all the disk IO has completed and the +files have been moved, as an effect of a call to torrent_handle::move_storage. This +is useful to synchronize with the actual disk.
++struct storage_moved_alert: torrent_alert +{ + storage_moved_alert(torrent_handle const& h, std::string const& path); + virtual std::auto_ptr<alert> clone() const; +}; ++
This alert is generated as a response to a torrent_handle::pause request. It is +generated once all disk IO is complete and the files in the torrent have been closed. +This is useful for synchronizing with the disk.
++struct torrent_paused_alert: torrent_alert +{ + torrent_paused_alert(torrent_handle const& h, std::string const& msg); + virtual std::auto_ptr<alert> clone() const; +}; ++
The handle_alert class is defined in <libtorrent/alert.hpp>.
Examples usage:
diff --git a/docs/manual.rst b/docs/manual.rst index e9b32aad1..40314773b 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -75,7 +75,7 @@ The ``session`` class has the following synopsis:: , boost::filesystem::path const& save_path , entry const& resume_data = entry() , bool compact_mode = true - , int block_size = 16 * 1024); + , bool paused = false); torrent_handle add_torrent( char const* tracker_url @@ -84,7 +84,7 @@ The ``session`` class has the following synopsis:: , boost::filesystem::path const& save_path , entry const& resume_data = entry() , bool compact_mode = true - , int block_size = 16 * 1024); + , bool paused = true); session_proxy abort(); @@ -208,7 +208,7 @@ add_torrent() , boost::filesystem::path const& save_path , entry const& resume_data = entry() , bool compact_mode = true - , int block_size = 16 * 1024); + , bool paused = false); torrent_handle add_torrent( char const* tracker_url @@ -217,7 +217,7 @@ add_torrent() , boost::filesystem::path const& save_path , entry const& resume_data = entry() , bool compact_mode = true - , int block_size = 16 * 1024); + , bool paused = false); You add torrents through the ``add_torrent()`` function where you give an object representing the information found in the torrent file and the path where you @@ -239,10 +239,10 @@ downloaded. If it is false, the entire storage is allocated before download begi the files contained in the torrent are filled with zeros, and each downloaded piece is put in its final place directly when downloaded. For more info, see `storage allocation`_. -``block_size`` sets the preferred request size, i.e. the number of bytes to request from -a peer at a time. This block size must be a divisor of the piece size, and since the piece -size is an even power of 2, so must the block size be. If the block size given here turns -out to be greater than the piece size, it will simply be clamped to the piece size. +``paused`` is a boolean that specifies whether or not the torrent is to be started in +a paused state. I.e. it won't connect to the tracker or any of the peers until it's +resumed. This is typically a good way of avoiding race conditions when setting +configuration options on torrents before starting them. The torrent_handle_ returned by ``add_torrent()`` can be used to retrieve information about the torrent's progress, its peers etc. It is also used to abort a torrent. @@ -2009,8 +2009,9 @@ It contains the following fields:: queued = 0x100, on_parole = 0x200, seed = 0x400, - rc4_encrypted = 0x800, - plaintext_encrypted = 0x1000 + optimistic_unchoke = 0x800, + rc4_encrypted = 0x100000, + plaintext_encrypted = 0x200000 }; unsigned int flags; @@ -2091,6 +2092,20 @@ any combination of the enums above. The following table describes each flag: | | attempt. This may happen if there is a limit set on | | | the number of half-open TCP connections. | +-------------------------+-------------------------------------------------------+ +| ``on_parole`` | The peer has participated in a piece that failed the | +| | hash check, and is now "on parole", which means we're | +| | only requesting whole pieces from this peer until | +| | it either fails that piece or proves that it doesn't | +| | send bad data. | ++-------------------------+-------------------------------------------------------+ +| ``seed`` | This peer is a seed (it has all the pieces). | ++-------------------------+-------------------------------------------------------+ +| ``optimistic_unchoke`` | This peer is subject to an optimistic unchoke. It has | +| | been unchoked for a while to see if it might unchoke | +| | us in return an earn an upload/unchoke slot. If it | +| | doesn't within some period of time, it will be choked | +| | and another peer will be optimistically unchoked. | ++-------------------------+-------------------------------------------------------+ __ extension_protocol.html diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index e30a07c0b..606a38930 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -244,8 +244,8 @@ namespace libtorrent , fs::path const& save_path , entry const& resume_data , bool compact_mode - , int block_size - , storage_constructor_type sc); + , storage_constructor_type sc + , bool paused); torrent_handle add_torrent( char const* tracker_url @@ -254,8 +254,8 @@ namespace libtorrent , fs::path const& save_path , entry const& resume_data , bool compact_mode - , int block_size - , storage_constructor_type sc); + , storage_constructor_type sc + , bool paused); void remove_torrent(torrent_handle const& h); diff --git a/include/libtorrent/session.hpp b/include/libtorrent/session.hpp index a123314ed..7b54c1ad5 100755 --- a/include/libtorrent/session.hpp +++ b/include/libtorrent/session.hpp @@ -141,23 +141,9 @@ namespace libtorrent , fs::path const& save_path , entry const& resume_data = entry() , bool compact_mode = true - , int block_size = 16 * 1024 + , bool paused = false , storage_constructor_type sc = default_storage_constructor); - // ==== deprecated, this is for backwards compatibility only - // instead, use one of the other add_torrent overloads - torrent_handle add_torrent( - entry const& e - , fs::path const& save_path - , entry const& resume_data = entry() - , bool compact_mode = true - , int block_size = 16 * 1024 - , storage_constructor_type sc = default_storage_constructor) TORRENT_DEPRECATED - { - return add_torrent(torrent_info(e), save_path, resume_data - , compact_mode, block_size, sc); - } - torrent_handle add_torrent( char const* tracker_url , sha1_hash const& info_hash @@ -165,7 +151,7 @@ namespace libtorrent , fs::path const& save_path , entry const& resume_data = entry() , bool compact_mode = true - , int block_size = 16 * 1024 + , bool paused = true , storage_constructor_type sc = default_storage_constructor); session_proxy abort() { return session_proxy(m_impl); } diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 6781465c0..dabc34141 100755 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -102,8 +102,8 @@ namespace libtorrent , tcp::endpoint const& net_interface , bool compact_mode , int block_size - , session_settings const& s - , storage_constructor_type sc); + , storage_constructor_type sc + , bool paused); // used with metadata-less torrents // (the metadata is downloaded from the peers) @@ -117,8 +117,8 @@ namespace libtorrent , tcp::endpoint const& net_interface , bool compact_mode , int block_size - , session_settings const& s - , storage_constructor_type sc); + , storage_constructor_type sc + , bool paused); ~torrent(); diff --git a/src/session.cpp b/src/session.cpp index 6d6fa55b2..8175cbdfe 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -179,11 +179,11 @@ namespace libtorrent , fs::path const& save_path , entry const& resume_data , bool compact_mode - , int block_size + , bool paused , storage_constructor_type sc) { return m_impl->add_torrent(ti, save_path, resume_data - , compact_mode, block_size, sc); + , compact_mode, sc, paused); } torrent_handle session::add_torrent( @@ -193,11 +193,11 @@ namespace libtorrent , fs::path const& save_path , entry const& e , bool compact_mode - , int block_size + , bool paused , storage_constructor_type sc) { return m_impl->add_torrent(tracker_url, info_hash, name, save_path, e - , compact_mode, block_size, sc); + , compact_mode, sc, paused); } void session::remove_torrent(const torrent_handle& h) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 2b069ba65..d20cf9668 100755 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1447,25 +1447,12 @@ namespace detail , fs::path const& save_path , entry const& resume_data , bool compact_mode - , int block_size - , storage_constructor_type sc) + , storage_constructor_type sc + , bool paused) { // if you get this assert, you haven't managed to // open a listen port. call listen_on() first. assert(m_external_listen_port > 0); - - // make sure the block_size is an even power of 2 -#ifndef NDEBUG - for (int i = 0; i < 32; ++i) - { - if (block_size & (1 << i)) - { - assert((block_size & ~(1 << i)) == 0); - break; - } - } -#endif - assert(!save_path.empty()); if (ti.begin_files() == ti.end_files()) @@ -1493,8 +1480,8 @@ namespace detail // the thread boost::shared_ptr