forked from premiere/premiere-libtorrent
cleaned up i2p_category to encapsulate it in i2p_stream.cpp, as well as the socks5 erro_category. added some documentation to torrent_handle and session. fixed reference documentation mapping of get_*_category() functions. regenerate documentation
This commit is contained in:
parent
15e2019332
commit
9612ef193e
|
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <libtorrent/error_code.hpp>
|
||||
#include <libtorrent/lazy_entry.hpp>
|
||||
#include <libtorrent/upnp.hpp>
|
||||
#include <libtorrent/socks5_stream.hpp>
|
||||
|
||||
using namespace boost::python;
|
||||
using namespace libtorrent;
|
||||
|
@ -68,6 +69,14 @@ void bind_error_code()
|
|||
def("get_http_category", &get_http_category
|
||||
, return_internal_reference<>());
|
||||
|
||||
def("get_socks_category", &get_socks_category
|
||||
, return_internal_reference<>());
|
||||
|
||||
#if TORRENT_USE_I2P
|
||||
def("get_i2p_category", &get_i2p_category
|
||||
, return_internal_reference<>());
|
||||
#endif
|
||||
|
||||
def("get_bdecode_category", &get_bdecode_category
|
||||
, return_internal_reference<>());
|
||||
|
||||
|
|
|
@ -105,10 +105,8 @@ category_fun_mapping = {
|
|||
|
||||
def categorize_symbol(name, filename):
|
||||
f = os.path.split(filename)[1]
|
||||
if f in category_mapping:
|
||||
return category_mapping[f]
|
||||
|
||||
if name.endswith('_category') \
|
||||
if name.endswith('_category()') \
|
||||
or name.endswith('_error_code') \
|
||||
or name.endswith('error_code_enum'):
|
||||
return 'Error Codes'
|
||||
|
@ -116,6 +114,9 @@ def categorize_symbol(name, filename):
|
|||
if name in category_fun_mapping:
|
||||
return category_fun_mapping[name]
|
||||
|
||||
if f in category_mapping:
|
||||
return category_mapping[f]
|
||||
|
||||
return 'Core'
|
||||
|
||||
def suppress_warning(filename, name):
|
||||
|
|
|
@ -55,11 +55,11 @@
|
|||
<div class="contents topic" id="table-of-contents">
|
||||
<p class="topic-title first">Table of contents</p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#invalid-encoding" id="id55">invalid_encoding</a></li>
|
||||
<li><a class="reference internal" href="#type-error" id="id56">type_error</a></li>
|
||||
<li><a class="reference internal" href="#entry" id="id57">entry</a></li>
|
||||
<li><a class="reference internal" href="#pascal-string" id="id58">pascal_string</a></li>
|
||||
<li><a class="reference internal" href="#lazy-entry" id="id59">lazy_entry</a></li>
|
||||
<li><a class="reference internal" href="#invalid-encoding" id="id53">invalid_encoding</a></li>
|
||||
<li><a class="reference internal" href="#type-error" id="id54">type_error</a></li>
|
||||
<li><a class="reference internal" href="#entry" id="id55">entry</a></li>
|
||||
<li><a class="reference internal" href="#pascal-string" id="id56">pascal_string</a></li>
|
||||
<li><a class="reference internal" href="#lazy-entry" id="id57">lazy_entry</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<p>Bencoding is a common representation in bittorrent used for
|
||||
|
@ -767,65 +767,6 @@ is a reference to an <tt class="docutils literal">error_code</tt> which is set t
|
|||
in case the function fails. <tt class="docutils literal">error_pos</tt> is an optional pointer to an int,
|
||||
which will be set to the byte offset into the buffer where an error occurred,
|
||||
in case the function fails.</p>
|
||||
<a name="get_bdecode_category()"></a></div>
|
||||
<div class="section" id="get-bdecode-category">
|
||||
<h2>get_bdecode_category()</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/lazy_entry.hpp">libtorrent/lazy_entry.hpp</a>"</p>
|
||||
<pre class="literal-block">
|
||||
boost::system::error_category& <strong>get_bdecode_category</strong> ();
|
||||
</pre>
|
||||
<p>get the <tt class="docutils literal">error_category</tt> for bdecode errors</p>
|
||||
<a name="error_code_enum"></a></div>
|
||||
<div class="section" id="enum-error-code-enum">
|
||||
<h2>enum error_code_enum</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/lazy_entry.hpp">libtorrent/lazy_entry.hpp</a>"</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="20%" />
|
||||
<col width="8%" />
|
||||
<col width="72%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th class="head">name</th>
|
||||
<th class="head">value</th>
|
||||
<th class="head">description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td>no_error</td>
|
||||
<td>0</td>
|
||||
<td>Not an error</td>
|
||||
</tr>
|
||||
<tr><td>expected_string</td>
|
||||
<td>1</td>
|
||||
<td>expected string in bencoded string</td>
|
||||
</tr>
|
||||
<tr><td>expected_colon</td>
|
||||
<td>2</td>
|
||||
<td>expected colon in bencoded string</td>
|
||||
</tr>
|
||||
<tr><td>unexpected_eof</td>
|
||||
<td>3</td>
|
||||
<td>unexpected end of file in bencoded string</td>
|
||||
</tr>
|
||||
<tr><td>expected_value</td>
|
||||
<td>4</td>
|
||||
<td>expected value (list, dict, int or string) in bencoded string</td>
|
||||
</tr>
|
||||
<tr><td>depth_exceeded</td>
|
||||
<td>5</td>
|
||||
<td>bencoded recursion depth limit exceeded</td>
|
||||
</tr>
|
||||
<tr><td>limit_exceeded</td>
|
||||
<td>6</td>
|
||||
<td>bencoded item count limit exceeded</td>
|
||||
</tr>
|
||||
<tr><td>error_code_max</td>
|
||||
<td>7</td>
|
||||
<td>the number of error codes</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -55,17 +55,17 @@
|
|||
<div class="contents topic" id="table-of-contents">
|
||||
<p class="topic-title first">Table of contents</p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#disk-buffer-holder" id="id167">disk_buffer_holder</a></li>
|
||||
<li><a class="reference internal" href="#peer-info" id="id168">peer_info</a></li>
|
||||
<li><a class="reference internal" href="#peer-list-entry" id="id169">peer_list_entry</a></li>
|
||||
<li><a class="reference internal" href="#peer-request" id="id170">peer_request</a></li>
|
||||
<li><a class="reference internal" href="#piece-block-progress" id="id171">piece_block_progress</a></li>
|
||||
<li><a class="reference internal" href="#block-info" id="id172">block_info</a></li>
|
||||
<li><a class="reference internal" href="#partial-piece-info" id="id173">partial_piece_info</a></li>
|
||||
<li><a class="reference internal" href="#torrent-handle" id="id174">torrent_handle</a></li>
|
||||
<li><a class="reference internal" href="#torrent-status" id="id175">torrent_status</a></li>
|
||||
<li><a class="reference internal" href="#announce-entry" id="id176">announce_entry</a></li>
|
||||
<li><a class="reference internal" href="#torrent-info" id="id177">torrent_info</a></li>
|
||||
<li><a class="reference internal" href="#disk-buffer-holder" id="id169">disk_buffer_holder</a></li>
|
||||
<li><a class="reference internal" href="#peer-info" id="id170">peer_info</a></li>
|
||||
<li><a class="reference internal" href="#peer-list-entry" id="id171">peer_list_entry</a></li>
|
||||
<li><a class="reference internal" href="#peer-request" id="id172">peer_request</a></li>
|
||||
<li><a class="reference internal" href="#piece-block-progress" id="id173">piece_block_progress</a></li>
|
||||
<li><a class="reference internal" href="#block-info" id="id174">block_info</a></li>
|
||||
<li><a class="reference internal" href="#partial-piece-info" id="id175">partial_piece_info</a></li>
|
||||
<li><a class="reference internal" href="#torrent-handle" id="id176">torrent_handle</a></li>
|
||||
<li><a class="reference internal" href="#torrent-status" id="id177">torrent_status</a></li>
|
||||
<li><a class="reference internal" href="#announce-entry" id="id178">announce_entry</a></li>
|
||||
<li><a class="reference internal" href="#torrent-info" id="id179">torrent_info</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<a name="disk_buffer_holder"></a><div class="section" id="disk-buffer-holder">
|
||||
|
@ -1072,7 +1072,6 @@ struct torrent_handle
|
|||
void <strong>add_piece</strong> (int piece, char const* data, int flags = 0) const;
|
||||
void <strong>read_piece</strong> (int piece) const;
|
||||
bool <strong>have_piece</strong> (int piece) const;
|
||||
void <strong>get_full_peer_list</strong> (std::vector<peer_list_entry>& v) const;
|
||||
void <strong>get_peer_info</strong> (std::vector<peer_info>& v) const;
|
||||
torrent_status <strong>status</strong> (boost::uint32_t flags = 0xffffffff) const;
|
||||
void <strong>get_download_queue</strong> (std::vector<partial_piece_info>& queue) const;
|
||||
|
@ -2182,9 +2181,9 @@ torrent are saved to.</td>
|
|||
<p>Declared in "<a class="reference external" href="../include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>"</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="49%" />
|
||||
<col width="18%" />
|
||||
<col width="33%" />
|
||||
<col width="20%" />
|
||||
<col width="7%" />
|
||||
<col width="73%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th class="head">name</th>
|
||||
|
@ -2195,7 +2194,10 @@ torrent are saved to.</td>
|
|||
<tbody valign="top">
|
||||
<tr><td>piece_granularity</td>
|
||||
<td>1</td>
|
||||
<td> </td>
|
||||
<td>only calculate file progress at piece granularity. This makes
|
||||
the <a class="reference external" href="reference-Core.html#file_progress()">file_progress()</a> call cheaper and also only takes bytes that
|
||||
have passed the hash check into account, so progress cannot
|
||||
regress in this mode.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -2353,7 +2355,15 @@ struct torrent_status
|
|||
sha1_hash info_hash;
|
||||
};
|
||||
</pre>
|
||||
<a name="state_t"></a><div class="section" id="id106">
|
||||
<a name="operator==()"></a><div class="section" id="operator">
|
||||
<h2>operator==()</h2>
|
||||
<pre class="literal-block">
|
||||
bool <strong>operator==</strong> (torrent_status const& st) const;
|
||||
</pre>
|
||||
<p>compres if the torrent status objects come from the same torrent. i.e.
|
||||
only the <a class="reference external" href="reference-Core.html#torrent_handle">torrent_handle</a> field is compared.</p>
|
||||
<a name="state_t"></a></div>
|
||||
<div class="section" id="id108">
|
||||
<h2>enum state_t</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>"</p>
|
||||
<table border="1" class="docutils">
|
||||
|
@ -2903,7 +2913,7 @@ allowed to force another tracker update with this tracker.</p>
|
|||
<p>If the last time this tracker was contacted failed, <tt class="docutils literal">last_error</tt> is the error
|
||||
code describing what error occurred.</p>
|
||||
<a name="reset()"></a></div>
|
||||
<div class="section" id="id126">
|
||||
<div class="section" id="id128">
|
||||
<h2>reset()</h2>
|
||||
<pre class="literal-block">
|
||||
void <strong>reset</strong> ();
|
||||
|
@ -3119,7 +3129,7 @@ class torrent_info : public intrusive_ptr_base<torrent_info>
|
|||
bool <strong>is_merkle_torrent</strong> () const;
|
||||
};
|
||||
</pre>
|
||||
<a name="torrent_info()"></a><div class="section" id="id130">
|
||||
<a name="torrent_info()"></a><div class="section" id="id132">
|
||||
<h2>torrent_info()</h2>
|
||||
<pre class="literal-block">
|
||||
<strong>torrent_info</strong> (std::string const& filename, int flags = 0);
|
||||
|
@ -3151,7 +3161,7 @@ always throw if an error occurs. These overloads are not available when building
|
|||
exception support.</p>
|
||||
<p>The <tt class="docutils literal">flags</tt> argument is currently unused.</p>
|
||||
<a name="~torrent_info()"></a></div>
|
||||
<div class="section" id="id138">
|
||||
<div class="section" id="id140">
|
||||
<h2>~torrent_info()</h2>
|
||||
<pre class="literal-block">
|
||||
<strong>~torrent_info</strong> ();
|
||||
|
@ -3176,7 +3186,7 @@ names. Filename may be chaged using <tt class="docutils literal"><span class="pr
|
|||
<p>For more information on the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object, see the separate document on how
|
||||
to create torrents.</p>
|
||||
<a name="rename_file()"></a></div>
|
||||
<div class="section" id="id144">
|
||||
<div class="section" id="id146">
|
||||
<h2>rename_file()</h2>
|
||||
<pre class="literal-block">
|
||||
void <strong>rename_file</strong> (int index, std::string const& new_filename);
|
||||
|
@ -3261,7 +3271,7 @@ the piece index as argument and gives you the exact size of that piece. It will
|
|||
be the same as <tt class="docutils literal">piece_length()</tt> except in the case of the last piece, which may
|
||||
be smaller.</p>
|
||||
<a name="info_hash()"></a></div>
|
||||
<div class="section" id="id151">
|
||||
<div class="section" id="id153">
|
||||
<h2>info_hash()</h2>
|
||||
<pre class="literal-block">
|
||||
const sha1_hash& <strong>info_hash</strong> () const;
|
||||
|
@ -3308,7 +3318,7 @@ std::string <strong>ssl_cert</strong> () const;
|
|||
torrent. Otherwise returns an empty string. The certificate is
|
||||
the the public certificate in x509 format.</p>
|
||||
<a name="is_valid()"></a></div>
|
||||
<div class="section" id="id154">
|
||||
<div class="section" id="id156">
|
||||
<h2>is_valid()</h2>
|
||||
<pre class="literal-block">
|
||||
bool <strong>is_valid</strong> () const;
|
||||
|
@ -3421,7 +3431,7 @@ lazy_entry const* <strong>info</strong> (char const* key) const;
|
|||
It can be used to access extension values put in the .torrent file. If the specified
|
||||
key cannot be found, it returns NULL.</p>
|
||||
<a name="swap()"></a></div>
|
||||
<div class="section" id="id159">
|
||||
<div class="section" id="id161">
|
||||
<h2>swap()</h2>
|
||||
<pre class="literal-block">
|
||||
void <strong>swap</strong> (torrent_info& ti);
|
||||
|
|
|
@ -55,24 +55,10 @@
|
|||
<div class="contents topic" id="table-of-contents">
|
||||
<p class="topic-title first">Table of contents</p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#http-error-category" id="id33">http_error_category</a></li>
|
||||
<li><a class="reference internal" href="#libtorrent-exception" id="id34">libtorrent_exception</a></li>
|
||||
<li><a class="reference internal" href="#i2p-error-category" id="id35">i2p_error_category</a></li>
|
||||
<li><a class="reference internal" href="#libtorrent-exception" id="id36">libtorrent_exception</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<a name="http_error_category"></a><div class="section" id="http-error-category">
|
||||
<h1>http_error_category</h1>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>"</p>
|
||||
<pre class="literal-block">
|
||||
struct http_error_category : boost::system::error_category
|
||||
{
|
||||
virtual boost::system::error_condition <strong>default_error_condition</strong> (int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual const char* <strong>name</strong> () const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual std::string <strong>message</strong> (int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
};
|
||||
</pre>
|
||||
<a name="libtorrent_exception"></a></div>
|
||||
<div class="section" id="libtorrent-exception">
|
||||
<a name="libtorrent_exception"></a><div class="section" id="libtorrent-exception">
|
||||
<h1>libtorrent_exception</h1>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>"</p>
|
||||
<pre class="literal-block">
|
||||
|
@ -84,18 +70,6 @@ struct libtorrent_exception: std::exception
|
|||
virtual const char* <strong>what</strong> () const throw();
|
||||
};
|
||||
</pre>
|
||||
<a name="i2p_error_category"></a></div>
|
||||
<div class="section" id="i2p-error-category">
|
||||
<h1>i2p_error_category</h1>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/i2p_stream.hpp">libtorrent/i2p_stream.hpp</a>"</p>
|
||||
<pre class="literal-block">
|
||||
struct i2p_error_category : boost::system::error_category
|
||||
{
|
||||
virtual boost::system::error_condition <strong>default_error_condition</strong> (int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual const char* <strong>name</strong> () const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual std::string <strong>message</strong> (int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
};
|
||||
</pre>
|
||||
<a name="get_libtorrent_category()"></a><div class="section" id="get-libtorrent-category">
|
||||
<h2>get_libtorrent_category()</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>"</p>
|
||||
|
@ -112,6 +86,30 @@ maps libtorrent error codes to human readable error messages.</p>
|
|||
boost::system::error_category& <strong>get_http_category</strong> ();
|
||||
</pre>
|
||||
<p>returns the error_category for HTTP errors</p>
|
||||
<a name="get_i2p_category()"></a></div>
|
||||
<div class="section" id="get-i2p-category">
|
||||
<h2>get_i2p_category()</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/i2p_stream.hpp">libtorrent/i2p_stream.hpp</a>"</p>
|
||||
<pre class="literal-block">
|
||||
boost::system::error_category& <strong>get_i2p_category</strong> ();
|
||||
</pre>
|
||||
<p>returns the error category for I2P errors</p>
|
||||
<a name="get_bdecode_category()"></a></div>
|
||||
<div class="section" id="get-bdecode-category">
|
||||
<h2>get_bdecode_category()</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/lazy_entry.hpp">libtorrent/lazy_entry.hpp</a>"</p>
|
||||
<pre class="literal-block">
|
||||
boost::system::error_category& <strong>get_bdecode_category</strong> ();
|
||||
</pre>
|
||||
<p>get the <tt class="docutils literal">error_category</tt> for bdecode errors</p>
|
||||
<a name="get_socks_category()"></a></div>
|
||||
<div class="section" id="get-socks-category">
|
||||
<h2>get_socks_category()</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/socks5_stream.hpp">libtorrent/socks5_stream.hpp</a>"</p>
|
||||
<pre class="literal-block">
|
||||
boost::system::error_category& <strong>get_socks_category</strong> ();
|
||||
</pre>
|
||||
<p>returns the error_category for SOCKS5 errors</p>
|
||||
<a name="error_code_enum"></a></div>
|
||||
<div class="section" id="enum-error-code-enum">
|
||||
<h2>enum error_code_enum</h2>
|
||||
|
@ -912,6 +910,57 @@ URL. i.e. it doesn't contain "announce.</td>
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<a name="error_code_enum"></a></div>
|
||||
<div class="section" id="id30">
|
||||
<h2>enum error_code_enum</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/lazy_entry.hpp">libtorrent/lazy_entry.hpp</a>"</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="20%" />
|
||||
<col width="8%" />
|
||||
<col width="72%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th class="head">name</th>
|
||||
<th class="head">value</th>
|
||||
<th class="head">description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td>no_error</td>
|
||||
<td>0</td>
|
||||
<td>Not an error</td>
|
||||
</tr>
|
||||
<tr><td>expected_string</td>
|
||||
<td>1</td>
|
||||
<td>expected string in bencoded string</td>
|
||||
</tr>
|
||||
<tr><td>expected_colon</td>
|
||||
<td>2</td>
|
||||
<td>expected colon in bencoded string</td>
|
||||
</tr>
|
||||
<tr><td>unexpected_eof</td>
|
||||
<td>3</td>
|
||||
<td>unexpected end of file in bencoded string</td>
|
||||
</tr>
|
||||
<tr><td>expected_value</td>
|
||||
<td>4</td>
|
||||
<td>expected value (list, dict, int or string) in bencoded string</td>
|
||||
</tr>
|
||||
<tr><td>depth_exceeded</td>
|
||||
<td>5</td>
|
||||
<td>bencoded recursion depth limit exceeded</td>
|
||||
</tr>
|
||||
<tr><td>limit_exceeded</td>
|
||||
<td>6</td>
|
||||
<td>bencoded item count limit exceeded</td>
|
||||
</tr>
|
||||
<tr><td>error_code_max</td>
|
||||
<td>7</td>
|
||||
<td>the number of error codes</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<a name="socks_error_code"></a></div>
|
||||
<div class="section" id="enum-socks-error-code">
|
||||
<h2>enum socks_error_code</h2>
|
||||
|
@ -976,7 +1025,7 @@ URL. i.e. it doesn't contain "announce.</td>
|
|||
</tbody>
|
||||
</table>
|
||||
<a name="error_code_enum"></a></div>
|
||||
<div class="section" id="id30">
|
||||
<div class="section" id="id33">
|
||||
<h2>enum error_code_enum</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/upnp.hpp">libtorrent/upnp.hpp</a>"</p>
|
||||
<table border="1" class="docutils">
|
||||
|
|
|
@ -617,7 +617,6 @@ class session: public boost::noncopyable
|
|||
void <strong>set_pe_settings</strong> (pe_settings const& settings);
|
||||
void <strong>set_proxy</strong> (proxy_settings const& s);
|
||||
proxy_settings <strong>proxy</strong> () const;
|
||||
void <strong>enable_stats_logging</strong> (bool s);
|
||||
proxy_settings <strong>i2p_proxy</strong> () const;
|
||||
void <strong>set_i2p_proxy</strong> (proxy_settings const& s);
|
||||
void <strong>pop_alerts</strong> (std::deque<alert*>* alerts);
|
||||
|
@ -625,7 +624,6 @@ class session: public boost::noncopyable
|
|||
alert const* <strong>wait_for_alert</strong> (time_duration max_wait);
|
||||
void <strong>set_alert_mask</strong> (boost::uint32_t m);
|
||||
void <strong>set_alert_dispatch</strong> (boost::function<void(std::auto_ptr<alert>)> const& fun);
|
||||
connection_queue& <strong>get_connection_queue</strong> ();
|
||||
void <strong>stop_lsd</strong> ();
|
||||
void <strong>start_lsd</strong> ();
|
||||
void <strong>stop_upnp</strong> ();
|
||||
|
@ -643,7 +641,6 @@ class session: public boost::noncopyable
|
|||
save_proxy,
|
||||
save_i2p_proxy,
|
||||
save_encryption_settings,
|
||||
save_as_map,
|
||||
save_feeds,
|
||||
};
|
||||
|
||||
|
@ -1308,9 +1305,9 @@ arbitrary port mappings. Mapping status is returned through the
|
|||
<p>Declared in "<a class="reference external" href="../include/libtorrent/session.hpp">libtorrent/session.hpp</a>"</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="57%" />
|
||||
<col width="15%" />
|
||||
<col width="28%" />
|
||||
<col width="26%" />
|
||||
<col width="7%" />
|
||||
<col width="67%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th class="head">name</th>
|
||||
|
@ -1321,35 +1318,32 @@ arbitrary port mappings. Mapping status is returned through the
|
|||
<tbody valign="top">
|
||||
<tr><td>save_settings</td>
|
||||
<td>1</td>
|
||||
<td> </td>
|
||||
<td>saves settings (i.e. the <a class="reference external" href="reference-Settings.html#session_settings">session_settings</a>)</td>
|
||||
</tr>
|
||||
<tr><td>save_dht_settings</td>
|
||||
<td>2</td>
|
||||
<td> </td>
|
||||
<td>saves dht_settings</td>
|
||||
</tr>
|
||||
<tr><td>save_dht_state</td>
|
||||
<td>4</td>
|
||||
<td> </td>
|
||||
<td>saves dht state such as nodes and node-id, possibly accelerating
|
||||
joining the DHT if provided at next <a class="reference external" href="reference-Session.html#session">session</a> startup.</td>
|
||||
</tr>
|
||||
<tr><td>save_proxy</td>
|
||||
<td>8</td>
|
||||
<td> </td>
|
||||
<td>save <a class="reference external" href="reference-Settings.html#proxy_settings">proxy_settings</a></td>
|
||||
</tr>
|
||||
<tr><td>save_i2p_proxy</td>
|
||||
<td>16</td>
|
||||
<td> </td>
|
||||
<td>save i2p_proxy settings</td>
|
||||
</tr>
|
||||
<tr><td>save_encryption_settings</td>
|
||||
<td>32</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr><td>save_as_map</td>
|
||||
<td>64</td>
|
||||
<td> </td>
|
||||
<td>save pe_settings</td>
|
||||
</tr>
|
||||
<tr><td>save_feeds</td>
|
||||
<td>128</td>
|
||||
<td> </td>
|
||||
<td>saves RSS feeds</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -1382,9 +1376,9 @@ arbitrary port mappings. Mapping status is returned through the
|
|||
<p>Declared in "<a class="reference external" href="../include/libtorrent/session.hpp">libtorrent/session.hpp</a>"</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="41%" />
|
||||
<col width="21%" />
|
||||
<col width="38%" />
|
||||
<col width="19%" />
|
||||
<col width="9%" />
|
||||
<col width="72%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th class="head">name</th>
|
||||
|
@ -1395,7 +1389,7 @@ arbitrary port mappings. Mapping status is returned through the
|
|||
<tbody valign="top">
|
||||
<tr><td>delete_files</td>
|
||||
<td>1</td>
|
||||
<td> </td>
|
||||
<td>delete the files belonging to the torrent from disk.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -1405,9 +1399,9 @@ arbitrary port mappings. Mapping status is returned through the
|
|||
<p>Declared in "<a class="reference external" href="../include/libtorrent/session.hpp">libtorrent/session.hpp</a>"</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="55%" />
|
||||
<col width="16%" />
|
||||
<col width="30%" />
|
||||
<col width="25%" />
|
||||
<col width="7%" />
|
||||
<col width="68%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th class="head">name</th>
|
||||
|
@ -1418,11 +1412,13 @@ arbitrary port mappings. Mapping status is returned through the
|
|||
<tbody valign="top">
|
||||
<tr><td>add_default_plugins</td>
|
||||
<td>1</td>
|
||||
<td> </td>
|
||||
<td>this will add common extensions like ut_pex, ut_metadata, lt_tex
|
||||
smart_ban and possibly others.</td>
|
||||
</tr>
|
||||
<tr><td>start_default_features</td>
|
||||
<td>2</td>
|
||||
<td> </td>
|
||||
<td>this will start features like DHT, local service discovery, UPnP
|
||||
and NAT-PMP.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -1803,31 +1799,6 @@ by the DHT.</dd>
|
|||
<dd>the number of known peers across all torrents. These are not necessarily
|
||||
connected peers, just peers we know of.</dd>
|
||||
</dl>
|
||||
<a name="min_memory_usage()"></a>
|
||||
<a name="high_performance_seed()"></a><div class="section" id="min-memory-usage-high-performance-seed">
|
||||
<h2>min_memory_usage() high_performance_seed()</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/session.hpp">libtorrent/session.hpp</a>"</p>
|
||||
<pre class="literal-block">
|
||||
session_settings <strong>min_memory_usage</strong> ();
|
||||
session_settings <strong>high_performance_seed</strong> ();
|
||||
</pre>
|
||||
<p>The default values of the <a class="reference external" href="reference-Session.html#session">session</a> settings are set for a regular bittorrent client running
|
||||
on a desktop system. There are functions that can set the <a class="reference external" href="reference-Session.html#session">session</a> settings to pre set
|
||||
settings for other environments. These can be used for the basis, and should be tweaked to
|
||||
fit your needs better.</p>
|
||||
<p><tt class="docutils literal">min_memory_usage</tt> returns settings that will use the minimal amount of RAM, at the
|
||||
potential expense of upload and download performance. It adjusts the socket buffer sizes,
|
||||
disables the disk cache, lowers the send buffer watermarks so that each connection only has
|
||||
at most one block in use at any one time. It lowers the outstanding blocks send to the disk
|
||||
I/O thread so that connections only have one block waiting to be flushed to disk at any given
|
||||
time. It lowers the max number of peers in the peer list for torrents. It performs multiple
|
||||
smaller reads when it hashes pieces, instead of reading it all into memory before hashing.</p>
|
||||
<p>This configuration is inteded to be the starting point for embedded devices. It will
|
||||
significantly reduce memory usage.</p>
|
||||
<p><tt class="docutils literal">high_performance_seed</tt> returns settings optimized for a seed box, serving many peers
|
||||
and that doesn't do any downloading. It has a 128 MB disk cache and has a limit of 400 files
|
||||
in its file pool. It support fast upload rates by allowing large send buffers.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
<div class="contents topic" id="table-of-contents">
|
||||
<p class="topic-title first">Table of contents</p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#proxy-settings" id="id30">proxy_settings</a></li>
|
||||
<li><a class="reference internal" href="#session-settings" id="id31">session_settings</a></li>
|
||||
<li><a class="reference internal" href="#proxy-settings" id="id33">proxy_settings</a></li>
|
||||
<li><a class="reference internal" href="#session-settings" id="id34">session_settings</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<a name="proxy_settings"></a><div class="section" id="proxy-settings">
|
||||
|
@ -1895,6 +1895,31 @@ that the disk cache is less likely and slower at
|
|||
returning memory to the kernel when cache pressure
|
||||
is low.</dd>
|
||||
</dl>
|
||||
<a name="min_memory_usage()"></a>
|
||||
<a name="high_performance_seed()"></a></div>
|
||||
<div class="section" id="min-memory-usage-high-performance-seed">
|
||||
<h2>min_memory_usage() high_performance_seed()</h2>
|
||||
<p>Declared in "<a class="reference external" href="../include/libtorrent/session.hpp">libtorrent/session.hpp</a>"</p>
|
||||
<pre class="literal-block">
|
||||
session_settings <strong>min_memory_usage</strong> ();
|
||||
session_settings <strong>high_performance_seed</strong> ();
|
||||
</pre>
|
||||
<p>The default values of the <a class="reference external" href="reference-Session.html#session">session</a> settings are set for a regular bittorrent client running
|
||||
on a desktop system. There are functions that can set the <a class="reference external" href="reference-Session.html#session">session</a> settings to pre set
|
||||
settings for other environments. These can be used for the basis, and should be tweaked to
|
||||
fit your needs better.</p>
|
||||
<p><tt class="docutils literal">min_memory_usage</tt> returns settings that will use the minimal amount of RAM, at the
|
||||
potential expense of upload and download performance. It adjusts the socket buffer sizes,
|
||||
disables the disk cache, lowers the send buffer watermarks so that each connection only has
|
||||
at most one block in use at any one time. It lowers the outstanding blocks send to the disk
|
||||
I/O thread so that connections only have one block waiting to be flushed to disk at any given
|
||||
time. It lowers the max number of peers in the peer list for torrents. It performs multiple
|
||||
smaller reads when it hashes pieces, instead of reading it all into memory before hashing.</p>
|
||||
<p>This configuration is inteded to be the starting point for embedded devices. It will
|
||||
significantly reduce memory usage.</p>
|
||||
<p><tt class="docutils literal">high_performance_seed</tt> returns settings optimized for a seed box, serving many peers
|
||||
and that doesn't do any downloading. It has a 128 MB disk cache and has a limit of 400 files
|
||||
in its file pool. It support fast upload rates by allowing large send buffers.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -107,8 +107,6 @@
|
|||
<div class="line"><a class="reference external" href="reference-Bencoding.html#bencode()">bencode()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Utility.html#operator<<()">operator<<()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Bencoding.html#lazy_bdecode()">lazy_bdecode()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Bencoding.html#get_bdecode_category()">get_bdecode_category()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#error_code_enum">error_code_enum</a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="string">
|
||||
|
@ -128,6 +126,8 @@
|
|||
<div class="line-block">
|
||||
<div class="line"><a class="reference external" href="reference-Settings.html#proxy_settings">proxy_settings</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Settings.html#session_settings">session_settings</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Settings.html#min_memory_usage()">min_memory_usage()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Settings.html#high_performance_seed()">high_performance_seed()</a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="plugins">
|
||||
|
@ -251,8 +251,6 @@
|
|||
<div class="line"><a class="reference external" href="reference-Session.html#dht_routing_bucket">dht_routing_bucket</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Session.html#utp_status">utp_status</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Session.html#session_status">session_status</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Session.html#min_memory_usage()">min_memory_usage()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Session.html#high_performance_seed()">high_performance_seed()</a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="create-torrents">
|
||||
|
@ -267,14 +265,16 @@
|
|||
<div class="section" id="error-codes">
|
||||
<h1>Error Codes</h1>
|
||||
<div class="line-block">
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#http_error_category">http_error_category</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#libtorrent_exception">libtorrent_exception</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#i2p_error_category">i2p_error_category</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#get_libtorrent_category()">get_libtorrent_category()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#get_http_category()">get_http_category()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#get_i2p_category()">get_i2p_category()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#get_bdecode_category()">get_bdecode_category()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#get_socks_category()">get_socks_category()</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#error_code_enum">error_code_enum</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#http_errors">http_errors</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#i2p_error_code">i2p_error_code</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#error_code_enum">error_code_enum</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#socks_error_code">socks_error_code</a></div>
|
||||
<div class="line"><a class="reference external" href="reference-Error_Codes.html#error_code_enum">error_code_enum</a></div>
|
||||
</div>
|
||||
|
|
|
@ -1355,7 +1355,7 @@ remove all payload ranges that has been sent</h2><h4>../src/bt_peer_connection.c
|
|||
if (arguments_start != std::string::npos)
|
||||
url += "&";
|
||||
else
|
||||
</pre></td></tr><tr style="background: #ccc"><td>relevance 0</td><td><a href="javascript:expand(26)">../src/i2p_stream.cpp:204</a></td><td>move this to proxy_base and use it in all proxies</td></tr><tr id="26" style="display: none;" colspan="3"><td colspan="3"><h2>move this to proxy_base and use it in all proxies</h2><h4>../src/i2p_stream.cpp:204</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
|
||||
</pre></td></tr><tr style="background: #ccc"><td>relevance 0</td><td><a href="javascript:expand(26)">../src/i2p_stream.cpp:210</a></td><td>move this to proxy_base and use it in all proxies</td></tr><tr id="26" style="display: none;" colspan="3"><td colspan="3"><h2>move this to proxy_base and use it in all proxies</h2><h4>../src/i2p_stream.cpp:210</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
|
||||
i2p_stream::i2p_stream(io_service& io_service)
|
||||
: proxy_base(io_service)
|
||||
, m_id(0)
|
||||
|
@ -3003,15 +3003,15 @@ m_sock.bind(endpoint, ec);</h2><h4>../include/libtorrent/proxy_base.hpp:166</h4>
|
|||
// flags for the source bitmask, each indicating where
|
||||
// we heard about this tracker
|
||||
enum tracker_source
|
||||
</pre></td></tr><tr style="background: #ccc"><td>relevance 0</td><td><a href="javascript:expand(59)">../include/libtorrent/upnp.hpp:112</a></td><td>support using the windows API for UPnP operations as well</td></tr><tr id="59" style="display: none;" colspan="3"><td colspan="3"><h2>support using the windows API for UPnP operations as well</h2><h4>../include/libtorrent/upnp.hpp:112</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"> external_port_must_be_wildcard = 727
|
||||
</pre></td></tr><tr style="background: #ccc"><td>relevance 0</td><td><a href="javascript:expand(59)">../include/libtorrent/upnp.hpp:108</a></td><td>support using the windows API for UPnP operations as well</td></tr><tr id="59" style="display: none;" colspan="3"><td colspan="3"><h2>support using the windows API for UPnP operations as well</h2><h4>../include/libtorrent/upnp.hpp:108</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"> // specific IP addres or DNS name
|
||||
remote_host_must_be_wildcard = 726,
|
||||
// ExternalPort must be a wildcard and cannot be a
|
||||
// specific port
|
||||
external_port_must_be_wildcard = 727
|
||||
};
|
||||
}
|
||||
|
||||
#if BOOST_VERSION < 103500
|
||||
extern asio::error::error_category upnp_category;
|
||||
#else
|
||||
boost::system::error_category& get_upnp_category();
|
||||
#endif
|
||||
|
||||
// int: port-mapping index
|
||||
// address: external address as queried from router
|
||||
|
|
|
@ -501,14 +501,6 @@ namespace libtorrent
|
|||
|
||||
#else
|
||||
|
||||
struct TORRENT_EXPORT http_error_category : boost::system::error_category
|
||||
{
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
// return the instance of the libtorrent_error_category which
|
||||
// maps libtorrent error codes to human readable error messages.
|
||||
TORRENT_EXPORT boost::system::error_category& get_libtorrent_category();
|
||||
|
|
|
@ -66,15 +66,8 @@ namespace libtorrent {
|
|||
};
|
||||
}
|
||||
|
||||
struct TORRENT_EXPORT i2p_error_category : boost::system::error_category
|
||||
{
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
extern i2p_error_category i2p_category;
|
||||
// returns the error category for I2P errors
|
||||
TORRENT_EXPORT boost::system::error_category& get_i2p_category();
|
||||
|
||||
class i2p_stream : public proxy_base
|
||||
{
|
||||
|
|
|
@ -200,15 +200,33 @@ namespace libtorrent
|
|||
// timeout can be set with ``set_settings()``.
|
||||
~session();
|
||||
|
||||
// flags that determines which aspects of the session should be
|
||||
// saved when calling save_state().
|
||||
enum save_state_flags_t
|
||||
{
|
||||
// saves settings (i.e. the session_settings)
|
||||
save_settings = 0x001,
|
||||
|
||||
// saves dht_settings
|
||||
save_dht_settings = 0x002,
|
||||
|
||||
// saves dht state such as nodes and node-id, possibly accelerating
|
||||
// joining the DHT if provided at next session startup.
|
||||
save_dht_state = 0x004,
|
||||
|
||||
// save proxy_settings
|
||||
save_proxy = 0x008,
|
||||
|
||||
// save i2p_proxy settings
|
||||
save_i2p_proxy = 0x010,
|
||||
|
||||
// save pe_settings
|
||||
save_encryption_settings = 0x020,
|
||||
|
||||
// internal
|
||||
save_as_map = 0x040,
|
||||
|
||||
// saves RSS feeds
|
||||
save_feeds = 0x080
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
|
@ -676,14 +694,22 @@ namespace libtorrent
|
|||
, int flags = 0) TORRENT_DEPRECATED;
|
||||
#endif
|
||||
|
||||
// flags to be passed in to remove_torrent().
|
||||
enum options_t
|
||||
{
|
||||
// delete the files belonging to the torrent from disk.
|
||||
delete_files = 1
|
||||
};
|
||||
|
||||
// flags to be passed in to the session constructor
|
||||
enum session_flags_t
|
||||
{
|
||||
// this will add common extensions like ut_pex, ut_metadata, lt_tex
|
||||
// smart_ban and possibly others.
|
||||
add_default_plugins = 1,
|
||||
|
||||
// this will start features like DHT, local service discovery, UPnP
|
||||
// and NAT-PMP.
|
||||
start_default_features = 2
|
||||
};
|
||||
|
||||
|
@ -717,6 +743,7 @@ namespace libtorrent
|
|||
proxy_settings proxy() const;
|
||||
|
||||
#ifdef TORRENT_STATS
|
||||
// internal
|
||||
void enable_stats_logging(bool s);
|
||||
#endif
|
||||
|
||||
|
@ -857,6 +884,7 @@ namespace libtorrent
|
|||
// on linux, write to a pipe or an eventfd.
|
||||
void set_alert_dispatch(boost::function<void(std::auto_ptr<alert>)> const& fun);
|
||||
|
||||
// internal
|
||||
connection_queue& get_connection_queue();
|
||||
|
||||
// Starts and stops Local Service Discovery. This service will broadcast
|
||||
|
@ -879,6 +907,7 @@ namespace libtorrent
|
|||
void start_upnp();
|
||||
void stop_upnp();
|
||||
|
||||
// protocols used by add_port_mapping()
|
||||
enum protocol_type { udp = 1, tcp = 2 };
|
||||
|
||||
// add_port_mapping adds a port forwarding on UPnP and/or NAT-PMP,
|
||||
|
|
|
@ -45,6 +45,9 @@ namespace libtorrent {
|
|||
|
||||
namespace socks_error {
|
||||
|
||||
// SOCKS5 error values. If an error_code has the
|
||||
// socks error category (get_socks_category()), these
|
||||
// are the error values.
|
||||
enum socks_error_code
|
||||
{
|
||||
no_error = 0,
|
||||
|
@ -62,21 +65,8 @@ namespace libtorrent {
|
|||
};
|
||||
}
|
||||
|
||||
#if BOOST_VERSION < 103500
|
||||
typedef asio::error::error_category socks_error_category;
|
||||
#else
|
||||
|
||||
struct TORRENT_EXTRA_EXPORT socks_error_category : boost::system::error_category
|
||||
{
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
extern socks_error_category socks_category;
|
||||
// returns the error_category for SOCKS5 errors
|
||||
TORRENT_EXPORT boost::system::error_category& get_socks_category();
|
||||
|
||||
class socks5_stream : public proxy_base
|
||||
{
|
||||
|
|
|
@ -278,6 +278,7 @@ namespace libtorrent
|
|||
// otherwise.
|
||||
bool have_piece(int piece) const;
|
||||
|
||||
// internal
|
||||
void get_full_peer_list(std::vector<peer_list_entry>& v) const;
|
||||
|
||||
// takes a reference to a vector that will be cleared and filled with one
|
||||
|
@ -287,6 +288,8 @@ namespace libtorrent
|
|||
// information about that particular peer. See peer_info.
|
||||
void get_peer_info(std::vector<peer_info>& v) const;
|
||||
|
||||
// flags to pass in to status() to specify which properties of the
|
||||
// torrent to query for. By default all flags are set.
|
||||
enum status_flags_t
|
||||
{
|
||||
// calculates ``distributed_copies``, ``distributed_full_copies`` and
|
||||
|
@ -393,8 +396,14 @@ namespace libtorrent
|
|||
void file_progress(std::vector<float>& progress) const TORRENT_DEPRECATED;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// flags to be passed in file_progress().
|
||||
enum file_progress_flags_t
|
||||
{
|
||||
// only calculate file progress at piece granularity. This makes
|
||||
// the file_progress() call cheaper and also only takes bytes that
|
||||
// have passed the hash check into account, so progress cannot
|
||||
// regress in this mode.
|
||||
piece_granularity = 1
|
||||
};
|
||||
|
||||
|
@ -1138,6 +1147,8 @@ namespace libtorrent
|
|||
torrent_status();
|
||||
~torrent_status();
|
||||
|
||||
// compres if the torrent status objects come from the same torrent. i.e.
|
||||
// only the torrent_handle field is compared.
|
||||
bool operator==(torrent_status const& st) const
|
||||
{ return handle == st.handle; }
|
||||
|
||||
|
|
|
@ -279,45 +279,48 @@ namespace libtorrent
|
|||
return libtorrent_category;
|
||||
}
|
||||
|
||||
struct TORRENT_EXPORT http_error_category : boost::system::error_category
|
||||
{
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return "http error"; }
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
std::string ret;
|
||||
ret += to_string(ev).elems;
|
||||
ret += " ";
|
||||
switch (ev)
|
||||
{
|
||||
case errors::cont: ret += "Continue"; break;
|
||||
case errors::ok: ret += "OK"; break;
|
||||
case errors::created: ret += "Created"; break;
|
||||
case errors::accepted: ret += "Accepted"; break;
|
||||
case errors::no_content: ret += "No Content"; break;
|
||||
case errors::multiple_choices: ret += "Multiple Choices"; break;
|
||||
case errors::moved_permanently: ret += "Moved Permanently"; break;
|
||||
case errors::moved_temporarily: ret += "Moved Temporarily"; break;
|
||||
case errors::not_modified: ret += "Not Modified"; break;
|
||||
case errors::bad_request: ret += "Bad Request"; break;
|
||||
case errors::unauthorized: ret += "Unauthorized"; break;
|
||||
case errors::forbidden: ret += "Forbidden"; break;
|
||||
case errors::not_found: ret += "Not Found"; break;
|
||||
case errors::internal_server_error: ret += "Internal Server Error"; break;
|
||||
case errors::not_implemented: ret += "Not Implemented"; break;
|
||||
case errors::bad_gateway: ret += "Bad Gateway"; break;
|
||||
case errors::service_unavailable: ret += "Service Unavailable"; break;
|
||||
default: ret += "(unknown HTTP error)"; break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
virtual boost::system::error_condition default_error_condition(
|
||||
int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
boost::system::error_category& get_http_category()
|
||||
{
|
||||
static http_error_category http_category;
|
||||
return http_category;
|
||||
}
|
||||
|
||||
const char* http_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
return "http error";
|
||||
}
|
||||
|
||||
std::string http_error_category::message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
std::string ret;
|
||||
ret += to_string(ev).elems;
|
||||
ret += " ";
|
||||
switch (ev)
|
||||
{
|
||||
case errors::cont: ret += "Continue"; break;
|
||||
case errors::ok: ret += "OK"; break;
|
||||
case errors::created: ret += "Created"; break;
|
||||
case errors::accepted: ret += "Accepted"; break;
|
||||
case errors::no_content: ret += "No Content"; break;
|
||||
case errors::multiple_choices: ret += "Multiple Choices"; break;
|
||||
case errors::moved_permanently: ret += "Moved Permanently"; break;
|
||||
case errors::moved_temporarily: ret += "Moved Temporarily"; break;
|
||||
case errors::not_modified: ret += "Not Modified"; break;
|
||||
case errors::bad_request: ret += "Bad Request"; break;
|
||||
case errors::unauthorized: ret += "Unauthorized"; break;
|
||||
case errors::forbidden: ret += "Forbidden"; break;
|
||||
case errors::not_found: ret += "Not Found"; break;
|
||||
case errors::internal_server_error: ret += "Internal Server Error"; break;
|
||||
case errors::not_implemented: ret += "Not Implemented"; break;
|
||||
case errors::bad_gateway: ret += "Bad Gateway"; break;
|
||||
case errors::service_unavailable: ret += "Service Unavailable"; break;
|
||||
default: ret += "(unknown HTTP error)"; break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
|
|
|
@ -46,37 +46,43 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace libtorrent
|
||||
{
|
||||
|
||||
i2p_error_category i2p_category;
|
||||
|
||||
const char* i2p_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
||||
struct i2p_error_category : boost::system::error_category
|
||||
{
|
||||
return "i2p error";
|
||||
}
|
||||
|
||||
std::string i2p_error_category::message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
static char const* messages[] =
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return "i2p error"; }
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
"no error",
|
||||
"parse failed",
|
||||
"cannot reach peer",
|
||||
"i2p error",
|
||||
"invalid key",
|
||||
"invalid id",
|
||||
"timeout",
|
||||
"key not found",
|
||||
"duplicated id"
|
||||
};
|
||||
static char const* messages[] =
|
||||
{
|
||||
"no error",
|
||||
"parse failed",
|
||||
"cannot reach peer",
|
||||
"i2p error",
|
||||
"invalid key",
|
||||
"invalid id",
|
||||
"timeout",
|
||||
"key not found",
|
||||
"duplicated id"
|
||||
};
|
||||
|
||||
if (ev < 0 || ev >= i2p_error::num_errors) return "unknown error";
|
||||
return messages[ev];
|
||||
if (ev < 0 || ev >= i2p_error::num_errors) return "unknown error";
|
||||
return messages[ev];
|
||||
}
|
||||
virtual boost::system::error_condition default_error_condition(
|
||||
int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
|
||||
TORRENT_EXPORT boost::system::error_category& get_i2p_category()
|
||||
{
|
||||
static i2p_error_category i2p_category;
|
||||
return i2p_category;
|
||||
}
|
||||
|
||||
i2p_connection::i2p_connection(io_service& ios)
|
||||
: m_state(sam_idle)
|
||||
, m_io_service(ios)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
i2p_connection::~i2p_connection()
|
||||
{}
|
||||
|
@ -322,7 +328,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
error_code invalid_response(i2p_error::parse_failed
|
||||
, i2p_category);
|
||||
, get_i2p_category());
|
||||
|
||||
// null-terminate the string and parse it
|
||||
m_buffer.push_back(0);
|
||||
|
@ -413,7 +419,7 @@ namespace libtorrent
|
|||
|
||||
if (result != i2p_error::no_error)
|
||||
{
|
||||
error_code ec(result, i2p_category);
|
||||
error_code ec(result, get_i2p_category());
|
||||
handle_error(ec, h);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3631,7 +3631,7 @@ namespace libtorrent
|
|||
|
||||
if (ec)
|
||||
{
|
||||
if ((error > 1 || ec.category() == socks_category)
|
||||
if ((error > 1 || ec.category() == get_socks_category())
|
||||
&& m_ses.m_alerts.should_post<peer_error_alert>())
|
||||
{
|
||||
m_ses.m_alerts.post_alert(
|
||||
|
|
|
@ -39,34 +39,39 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace libtorrent
|
||||
{
|
||||
|
||||
socks_error_category socks_category;
|
||||
|
||||
#if BOOST_VERSION >= 103500
|
||||
const char* socks_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
||||
struct socks_error_category : boost::system::error_category
|
||||
{
|
||||
return "socks error";
|
||||
}
|
||||
|
||||
std::string socks_error_category::message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
static char const* messages[] =
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return "socks error"; }
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
"SOCKS no error",
|
||||
"SOCKS unsupported version",
|
||||
"SOCKS unsupported authentication method",
|
||||
"SOCKS unsupported authentication version",
|
||||
"SOCKS authentication error",
|
||||
"SOCKS username required",
|
||||
"SOCKS general failure",
|
||||
"SOCKS command not supported",
|
||||
"SOCKS no identd running",
|
||||
"SOCKS identd could not identify username"
|
||||
};
|
||||
static char const* messages[] =
|
||||
{
|
||||
"SOCKS no error",
|
||||
"SOCKS unsupported version",
|
||||
"SOCKS unsupported authentication method",
|
||||
"SOCKS unsupported authentication version",
|
||||
"SOCKS authentication error",
|
||||
"SOCKS username required",
|
||||
"SOCKS general failure",
|
||||
"SOCKS command not supported",
|
||||
"SOCKS no identd running",
|
||||
"SOCKS identd could not identify username"
|
||||
};
|
||||
|
||||
if (ev < 0 || ev >= socks_error::num_errors) return "unknown error";
|
||||
return messages[ev];
|
||||
if (ev < 0 || ev >= socks_error::num_errors) return "unknown error";
|
||||
return messages[ev];
|
||||
}
|
||||
virtual boost::system::error_condition default_error_condition(
|
||||
int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
TORRENT_EXPORT boost::system::error_category& get_socks_category()
|
||||
{
|
||||
static socks_error_category socks_category;
|
||||
return socks_category;
|
||||
}
|
||||
#endif
|
||||
|
||||
void socks5_stream::name_lookup(error_code const& e, tcp::resolver::iterator i
|
||||
, boost::shared_ptr<handler_type> h)
|
||||
|
@ -146,7 +151,7 @@ namespace libtorrent
|
|||
}
|
||||
else
|
||||
{
|
||||
(*h)(error_code(socks_error::unsupported_version, socks_category));
|
||||
(*h)(error_code(socks_error::unsupported_version, get_socks_category()));
|
||||
error_code ec;
|
||||
close(ec);
|
||||
}
|
||||
|
@ -194,7 +199,7 @@ namespace libtorrent
|
|||
|
||||
if (version < m_version)
|
||||
{
|
||||
(*h)(error_code(socks_error::unsupported_version, socks_category));
|
||||
(*h)(error_code(socks_error::unsupported_version, get_socks_category()));
|
||||
error_code ec;
|
||||
close(ec);
|
||||
return;
|
||||
|
@ -208,7 +213,7 @@ namespace libtorrent
|
|||
{
|
||||
if (m_user.empty())
|
||||
{
|
||||
(*h)(error_code(socks_error::username_required, socks_category));
|
||||
(*h)(error_code(socks_error::username_required, get_socks_category()));
|
||||
error_code ec;
|
||||
close(ec);
|
||||
return;
|
||||
|
@ -231,7 +236,7 @@ namespace libtorrent
|
|||
}
|
||||
else
|
||||
{
|
||||
(*h)(error_code(socks_error::unsupported_authentication_method, socks_category));
|
||||
(*h)(error_code(socks_error::unsupported_authentication_method, get_socks_category()));
|
||||
error_code ec;
|
||||
close(ec);
|
||||
return;
|
||||
|
@ -282,7 +287,7 @@ namespace libtorrent
|
|||
|
||||
if (version != 1)
|
||||
{
|
||||
(*h)(error_code(socks_error::unsupported_authentication_version, socks_category));
|
||||
(*h)(error_code(socks_error::unsupported_authentication_version, get_socks_category()));
|
||||
error_code ec;
|
||||
close(ec);
|
||||
return;
|
||||
|
@ -290,7 +295,7 @@ namespace libtorrent
|
|||
|
||||
if (status != 0)
|
||||
{
|
||||
(*h)(error_code(socks_error::authentication_error, socks_category));
|
||||
(*h)(error_code(socks_error::authentication_error, get_socks_category()));
|
||||
error_code ec;
|
||||
close(ec);
|
||||
return;
|
||||
|
@ -343,7 +348,7 @@ namespace libtorrent
|
|||
}
|
||||
else
|
||||
{
|
||||
(*h)(error_code(socks_error::unsupported_version, socks_category));
|
||||
(*h)(error_code(socks_error::unsupported_version, get_socks_category()));
|
||||
error_code ec;
|
||||
close(ec);
|
||||
return;
|
||||
|
@ -405,14 +410,14 @@ namespace libtorrent
|
|||
{
|
||||
if (version < m_version)
|
||||
{
|
||||
(*h)(error_code(socks_error::unsupported_version, socks_category));
|
||||
(*h)(error_code(socks_error::unsupported_version, get_socks_category()));
|
||||
error_code ec;
|
||||
close(ec);
|
||||
return;
|
||||
}
|
||||
if (response != 0)
|
||||
{
|
||||
error_code ec(socks_error::general_failure, socks_category);
|
||||
error_code ec(socks_error::general_failure, get_socks_category());
|
||||
switch (response)
|
||||
{
|
||||
case 2: ec = asio::error::no_permission; break;
|
||||
|
@ -420,7 +425,7 @@ namespace libtorrent
|
|||
case 4: ec = asio::error::host_unreachable; break;
|
||||
case 5: ec = asio::error::connection_refused; break;
|
||||
case 6: ec = asio::error::timed_out; break;
|
||||
case 7: ec = error_code(socks_error::command_not_supported, socks_category); break;
|
||||
case 7: ec = error_code(socks_error::command_not_supported, get_socks_category()); break;
|
||||
case 8: ec = asio::error::address_family_not_supported; break;
|
||||
}
|
||||
(*h)(ec);
|
||||
|
@ -484,7 +489,7 @@ namespace libtorrent
|
|||
{
|
||||
if (version != 0)
|
||||
{
|
||||
(*h)(error_code(socks_error::general_failure, socks_category));
|
||||
(*h)(error_code(socks_error::general_failure, get_socks_category()));
|
||||
error_code ec;
|
||||
close(ec);
|
||||
return;
|
||||
|
@ -524,7 +529,7 @@ namespace libtorrent
|
|||
case 92: code = socks_error::no_identd; break;
|
||||
case 93: code = socks_error::identd_error; break;
|
||||
}
|
||||
error_code ec(code, socks_category);
|
||||
error_code ec(code, get_socks_category());
|
||||
(*h)(ec);
|
||||
close(ec);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue