--- /srv/reproducible-results/rbuild-debian/r-b-build.N2sRGGSe/b1/libtorrent-rasterbar_2.0.11-1_amd64.changes
+++ /srv/reproducible-results/rbuild-debian/r-b-build.N2sRGGSe/b2/libtorrent-rasterbar_2.0.11-1_amd64.changes
├── Files
│ @@ -1,7 +1,7 @@
│  
│   1e537d9298a8b265e97c6e12e4bbe431 366364 libdevel optional libtorrent-rasterbar-dev_2.0.11-1_amd64.deb
│ - 99755b6129d04397015d589e76a93dbb 1669868 doc optional libtorrent-rasterbar-doc_2.0.11-1_all.deb
│ + 15551be28e691e7f14365f9d015e2bd7 1672624 doc optional libtorrent-rasterbar-doc_2.0.11-1_all.deb
│   d03e085a33b5d6cb9d6ab0feb33da92f 51336924 debug optional libtorrent-rasterbar2.0t64-dbgsym_2.0.11-1_amd64.deb
│   4f12effee624959a605933367d3a11d3 1671540 libs optional libtorrent-rasterbar2.0t64_2.0.11-1_amd64.deb
│   cb002f5518a59f3628f4b30ad4b79ed3 13345528 debug optional python3-libtorrent-dbgsym_2.0.11-1_amd64.deb
│   3a3d17a931722c987571a92e69305146 710292 python optional python3-libtorrent_2.0.11-1_amd64.deb
├── libtorrent-rasterbar-doc_2.0.11-1_all.deb
│ ├── file list
│ │ @@ -1,3 +1,3 @@
│ │  -rw-r--r--   0        0        0        4 2025-01-28 14:33:12.000000 debian-binary
│ │  -rw-r--r--   0        0        0     3628 2025-01-28 14:33:12.000000 control.tar.xz
│ │ --rw-r--r--   0        0        0  1666048 2025-01-28 14:33:12.000000 data.tar.xz
│ │ +-rw-r--r--   0        0        0  1668804 2025-01-28 14:33:12.000000 data.tar.xz
│ ├── control.tar.xz
│ │ ├── control.tar
│ │ │ ├── ./control
│ │ │ │ @@ -1,13 +1,13 @@
│ │ │ │  Package: libtorrent-rasterbar-doc
│ │ │ │  Source: libtorrent-rasterbar
│ │ │ │  Version: 2.0.11-1
│ │ │ │  Architecture: all
│ │ │ │  Maintainer: Christian Marillat <marillat@debian.org>
│ │ │ │ -Installed-Size: 5773
│ │ │ │ +Installed-Size: 5941
│ │ │ │  Section: doc
│ │ │ │  Priority: optional
│ │ │ │  Multi-Arch: foreign
│ │ │ │  Homepage: https://libtorrent.org/
│ │ │ │  Description: Documentation for libtorrent-rasterbar
│ │ │ │   Bittorrent library by Rasterbar Software (Arvid Norberg).
│ │ │ │   libtorrent-rasterbar is a C++ library that aims to be a good alternative to
│ │ │ ├── ./md5sums
│ │ │ │ ├── ./md5sums
│ │ │ │ │┄ Files differ
│ ├── data.tar.xz
│ │ ├── data.tar
│ │ │ ├── file list
│ │ │ │ @@ -73,43 +73,43 @@
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)   428298 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/img/troubleshooting.png
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    46281 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/img/troubleshooting_thumb.png
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)      243 2025-01-28 10:57:42.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/img/utp_stack.diagram
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)     2007 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/img/utp_stack.png
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)     1156 2025-01-28 10:57:42.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/img/write_disk_buffers.diagram
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)     9631 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/img/write_disk_buffers.png
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)     9768 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/index.html
│ │ │ │ --rw-r--r--   0 root         (0) root         (0)   144610 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/manual-ref.html
│ │ │ │ +-rw-r--r--   0 root         (0) root         (0)   144603 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/manual-ref.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)     9650 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/projects.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    22814 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/python_binding.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    33687 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Add_Torrent.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)   256772 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Alerts.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    27437 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Bdecoding.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    25856 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Bencoding.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    88949 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Core.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    43859 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Create_Torrents.html
│ │ │ │ --rw-r--r--   0 root         (0) root         (0)    50915 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Custom_Storage.html
│ │ │ │ +-rw-r--r--   0 root         (0) root         (0)   137008 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Custom_Storage.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    24960 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-DHT.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    48763 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Error_Codes.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    13261 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Filter.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    12804 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-PeerClass.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    68487 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Plugins.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)     9618 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Resume_Data.html
│ │ │ │ --rw-r--r--   0 root         (0) root         (0)   102476 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Session.html
│ │ │ │ +-rw-r--r--   0 root         (0) root         (0)   102455 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Session.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)   169276 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Settings.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)     9742 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Stats.html
│ │ │ │ --rw-r--r--   0 root         (0) root         (0)    56856 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Storage.html
│ │ │ │ --rw-r--r--   0 root         (0) root         (0)   129808 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Handle.html
│ │ │ │ --rw-r--r--   0 root         (0) root         (0)    55640 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Info.html
│ │ │ │ --rw-r--r--   0 root         (0) root         (0)    48385 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Status.html
│ │ │ │ --rw-r--r--   0 root         (0) root         (0)    16462 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Trackers.html
│ │ │ │ +-rw-r--r--   0 root         (0) root         (0)    56848 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Storage.html
│ │ │ │ +-rw-r--r--   0 root         (0) root         (0)   129801 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Handle.html
│ │ │ │ +-rw-r--r--   0 root         (0) root         (0)    55629 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Info.html
│ │ │ │ +-rw-r--r--   0 root         (0) root         (0)    48392 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Status.html
│ │ │ │ +-rw-r--r--   0 root         (0) root         (0)    16461 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Trackers.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    25530 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Utility.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)     9129 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-ed25519.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    34353 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    29242 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/security-audit.html
│ │ │ │ --rw-r--r--   0 root         (0) root         (0)  1274792 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/single-page-ref.html
│ │ │ │ +-rw-r--r--   0 root         (0) root         (0)  1360844 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/single-page-ref.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    10121 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/streaming.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)     8807 2025-01-28 10:57:42.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/style.css
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)   522888 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/todo.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)     3023 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/troubleshooting.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    25162 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/tuning-ref.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)   132630 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/tutorial-ref.html
│ │ │ │  -rw-r--r--   0 root         (0) root         (0)    16383 2025-01-28 14:33:12.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/udp_tracker_protocol.html
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/manual-ref.html
│ │ │ │ @@ -115,15 +115,15 @@
│ │ │ │  <li><p class="first">main loop (see <a class="reference external" href="reference-Session.html#session">session</a>)</p>
│ │ │ │  <blockquote>
│ │ │ │  <ul class="simple">
│ │ │ │  <li>poll for alerts (see <a class="reference external" href="reference-Session.html#wait_for_alert()">wait_for_alert()</a>, <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a>)</li>
│ │ │ │  <li>handle updates to torrents, (see <a class="reference external" href="reference-Alerts.html#state_update_alert">state_update_alert</a>).</li>
│ │ │ │  <li>handle other alerts, (see <a class="reference external" href="reference-Alerts.html#alert">alert</a>).</li>
│ │ │ │  <li>query the <a class="reference external" href="reference-Session.html#session">session</a> for information (see session::status()).</li>
│ │ │ │ -<li>add and remove torrents from the <a class="reference external" href="reference-Session.html#session">session</a> (<a class="reference external" href="reference-Custom_Storage.html#remove_torrent()">remove_torrent()</a>)</li>
│ │ │ │ +<li>add and remove torrents from the <a class="reference external" href="reference-Session.html#session">session</a> (<a class="reference external" href="reference-Session.html#remove_torrent()">remove_torrent()</a>)</li>
│ │ │ │  </ul>
│ │ │ │  </blockquote>
│ │ │ │  </li>
│ │ │ │  <li><p class="first">save resume data for all torrent_handles (optional, see
│ │ │ │  <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a>)</p>
│ │ │ │  </li>
│ │ │ │  <li><p class="first">save <a class="reference external" href="reference-Session.html#session">session</a> state (see <a class="reference external" href="reference-Session.html#session_state()">session_state()</a> and <a class="reference external" href="reference-Session.html#write_session_params()">write_session_params()</a>)</p>
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Add_Torrent.html
│ │ │ │ @@ -28,65 +28,23 @@
│ │ │ │  <td>2.0.11</td></tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │ -<li><a class="reference internal" href="#client-data-t" id="toc-entry-1">client_data_t</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#client-data-t-1" id="toc-entry-2">client_data_t()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#void-operator-const" id="toc-entry-3">void*() operator=() const*()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-torrent-params" id="toc-entry-1">add_torrent_params</a></li>
│ │ │ │ +<li><a class="reference internal" href="#client-data-t" id="toc-entry-2">client_data_t</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#client-data-t-1" id="toc-entry-3">client_data_t()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#void-operator-const" id="toc-entry-4">void*() operator=() const*()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#add-torrent-params" id="toc-entry-4">add_torrent_params</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │ -<a name="client_data_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+client_data_t&labels=documentation&body=Documentation+under+heading+%22class+client_data_t%22+could+be+improved">report issue</a>]</span><div class="section" id="client-data-t">
│ │ │ │ -<h1>client_data_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/client_data.hpp">libtorrent/client_data.hpp</a>&quot;</p>
│ │ │ │ -<p>A thin wrapper around a void pointer used as &quot;user data&quot;. i.e. an opaque
│ │ │ │ -cookie passed in to libtorrent and returned on demand. It adds type-safety by
│ │ │ │ -requiring the same type be requested out of it as was assigned to it.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct client_data_t
│ │ │ │ -{
│ │ │ │ -   <strong>client_data_t</strong> () = default;
│ │ │ │ -   explicit <strong>client_data_t</strong> (T* v);
│ │ │ │ -   client_data_t&amp; <strong>operator=</strong> (T* v);
│ │ │ │ -   T* <strong>get</strong> () const;
│ │ │ │ -   explicit operator <strong>T</strong> () const;
│ │ │ │ -   client_data_t&amp; <strong>operator=</strong> (void*) = delete;
│ │ │ │ -   client_data_t&amp; <strong>operator=</strong> (void const*) = delete;
│ │ │ │ -   operator <strong>void*</strong> () const = delete;
│ │ │ │ -   operator void <strong>const*</strong> () const = delete;
│ │ │ │ -
│ │ │ │ -   template &lt;typename T, typename <strong>U</strong>  = typename std::enable_if&lt;std::is_pointer&lt;T&gt;::value&gt;::type&gt;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="client_data_t()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:client_data_t%3A%3A%5Bclient_data_t%28%29%5D&labels=documentation&body=Documentation+under+heading+%22client_data_t%3A%3A%5Bclient_data_t%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="client-data-t-1">
│ │ │ │ -<h2>client_data_t()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>client_data_t</strong> () = default;
│ │ │ │ -</pre>
│ │ │ │ -<p>construct a nullptr client data</p>
│ │ │ │ -<a name="void*()"></a>
│ │ │ │ -<a name="operator=()"></a>
│ │ │ │ -<a name="const*()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:client_data_t%3A%3A%5Bvoid%2A%28%29+operator%3D%28%29+const%2A%28%29%5D&labels=documentation&body=Documentation+under+heading+%22client_data_t%3A%3A%5Bvoid%2A%28%29+operator%3D%28%29+const%2A%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="void-operator-const">
│ │ │ │ -<h2>void*() operator=() const*()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -client_data_t&amp; <strong>operator=</strong> (void*) = delete;
│ │ │ │ -client_data_t&amp; <strong>operator=</strong> (void const*) = delete;
│ │ │ │ -operator <strong>void*</strong> () const = delete;
│ │ │ │ -operator void <strong>const*</strong> () const = delete;
│ │ │ │ -</pre>
│ │ │ │ -<p>we don't allow type-unsafe operations</p>
│ │ │ │ -<a name="add_torrent_params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+add_torrent_params&labels=documentation&body=Documentation+under+heading+%22class+add_torrent_params%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="add-torrent-params">
│ │ │ │ +<a name="add_torrent_params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+add_torrent_params&labels=documentation&body=Documentation+under+heading+%22class+add_torrent_params%22+could+be+improved">report issue</a>]</span><div class="section" id="add-torrent-params">
│ │ │ │  <h1>add_torrent_params</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/add_torrent_params.hpp">libtorrent/add_torrent_params.hpp</a>&quot;</p>
│ │ │ │  <p>The <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> contains all the information in a .torrent file
│ │ │ │  along with all information necessary to add that torrent to a <a class="reference external" href="reference-Session.html#session">session</a>.
│ │ │ │  The key fields when adding a torrent are:</p>
│ │ │ │  <ul class="simple">
│ │ │ │  <li>ti - the immutable info-dict part of the torrent</li>
│ │ │ │ @@ -399,14 +357,56 @@
│ │ │ │  <a name="last_upload"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Blast_download+last_upload%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Blast_download+last_upload%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>last_download last_upload</dt>
│ │ │ │  <dd>the posix time of the last time payload was received or sent for this
│ │ │ │  torrent, respectively. A value of 0 means we don't know when we last
│ │ │ │  uploaded or downloaded, or we have never uploaded or downloaded any
│ │ │ │  payload for this torrent.</dd>
│ │ │ │  </dl>
│ │ │ │ +<a name="client_data_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+client_data_t&labels=documentation&body=Documentation+under+heading+%22class+client_data_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="client-data-t">
│ │ │ │ +<h1>client_data_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/client_data.hpp">libtorrent/client_data.hpp</a>&quot;</p>
│ │ │ │ +<p>A thin wrapper around a void pointer used as &quot;user data&quot;. i.e. an opaque
│ │ │ │ +cookie passed in to libtorrent and returned on demand. It adds type-safety by
│ │ │ │ +requiring the same type be requested out of it as was assigned to it.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct client_data_t
│ │ │ │ +{
│ │ │ │ +   <strong>client_data_t</strong> () = default;
│ │ │ │ +   explicit <strong>client_data_t</strong> (T* v);
│ │ │ │ +   client_data_t&amp; <strong>operator=</strong> (T* v);
│ │ │ │ +   T* <strong>get</strong> () const;
│ │ │ │ +   explicit operator <strong>T</strong> () const;
│ │ │ │ +   operator void <strong>const*</strong> () const = delete;
│ │ │ │ +   operator <strong>void*</strong> () const = delete;
│ │ │ │ +   client_data_t&amp; <strong>operator=</strong> (void const*) = delete;
│ │ │ │ +   client_data_t&amp; <strong>operator=</strong> (void*) = delete;
│ │ │ │ +
│ │ │ │ +   template &lt;typename T, typename <strong>U</strong>  = typename std::enable_if&lt;std::is_pointer&lt;T&gt;::value&gt;::type&gt;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="client_data_t()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:client_data_t%3A%3A%5Bclient_data_t%28%29%5D&labels=documentation&body=Documentation+under+heading+%22client_data_t%3A%3A%5Bclient_data_t%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="client-data-t-1">
│ │ │ │ +<h2>client_data_t()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>client_data_t</strong> () = default;
│ │ │ │ +</pre>
│ │ │ │ +<p>construct a nullptr client data</p>
│ │ │ │ +<a name="void*()"></a>
│ │ │ │ +<a name="operator=()"></a>
│ │ │ │ +<a name="const*()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:client_data_t%3A%3A%5Bvoid%2A%28%29+operator%3D%28%29+const%2A%28%29%5D&labels=documentation&body=Documentation+under+heading+%22client_data_t%3A%3A%5Bvoid%2A%28%29+operator%3D%28%29+const%2A%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="void-operator-const">
│ │ │ │ +<h2>void*() operator=() const*()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +operator void <strong>const*</strong> () const = delete;
│ │ │ │ +operator <strong>void*</strong> () const = delete;
│ │ │ │ +client_data_t&amp; <strong>operator=</strong> (void const*) = delete;
│ │ │ │ +client_data_t&amp; <strong>operator=</strong> (void*) = delete;
│ │ │ │ +</pre>
│ │ │ │ +<p>we don't allow type-unsafe operations</p>
│ │ │ │ +</div>
│ │ │ │  </div>
│ │ │ │  
│ │ │ │      </div>
│ │ │ │      </div>
│ │ │ │      <div id="gradient"></div>
│ │ │ │      <div id="filler">
│ │ │ │      <div id="footer">
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,48 +1,16 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │ +    * _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s
│ │ │ │ │      * _c_l_i_e_n_t___d_a_t_a___t
│ │ │ │ │            o _c_l_i_e_n_t___d_a_t_a___t_(_)
│ │ │ │ │            o _v_o_i_d_*_(_)_ _o_p_e_r_a_t_o_r_=_(_)_ _c_o_n_s_t_*_(_)
│ │ │ │ │ -    * _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ cclliieenntt__ddaattaa__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_l_i_e_n_t___d_a_t_a_._h_p_p"
│ │ │ │ │ -A thin wrapper around a void pointer used as "user data". i.e. an opaque cookie
│ │ │ │ │ -passed in to libtorrent and returned on demand. It adds type-safety by
│ │ │ │ │ -requiring the same type be requested out of it as was assigned to it.
│ │ │ │ │ -struct client_data_t
│ │ │ │ │ -{
│ │ │ │ │ -   cclliieenntt__ddaattaa__tt () = default;
│ │ │ │ │ -   explicit cclliieenntt__ddaattaa__tt (T* v);
│ │ │ │ │ -   client_data_t& ooppeerraattoorr== (T* v);
│ │ │ │ │ -   T* ggeett () const;
│ │ │ │ │ -   explicit operator TT () const;
│ │ │ │ │ -   client_data_t& ooppeerraattoorr== (void*) = delete;
│ │ │ │ │ -   client_data_t& ooppeerraattoorr== (void const*) = delete;
│ │ │ │ │ -   operator vvooiidd** () const = delete;
│ │ │ │ │ -   operator void ccoonnsstt** () const = delete;
│ │ │ │ │ -
│ │ │ │ │ -   template <typename T, typename UU  = typename std::enable_if<std::
│ │ │ │ │ -is_pointer<T>::value>::type>
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** cclliieenntt__ddaattaa__tt(()) **********
│ │ │ │ │ -cclliieenntt__ddaattaa__tt () = default;
│ │ │ │ │ -construct a nullptr client data
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** vvooiidd**(()) ooppeerraattoorr==(()) ccoonnsstt**(()) **********
│ │ │ │ │ -client_data_t& ooppeerraattoorr== (void*) = delete;
│ │ │ │ │ -client_data_t& ooppeerraattoorr== (void const*) = delete;
│ │ │ │ │ -operator vvooiidd** () const = delete;
│ │ │ │ │ -operator void ccoonnsstt** () const = delete;
│ │ │ │ │ -we don't allow type-unsafe operations
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ aadddd__ttoorrrreenntt__ppaarraammss ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_._h_p_p"
│ │ │ │ │  The _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s contains all the information in a .torrent file along
│ │ │ │ │  with all information necessary to add that torrent to a _s_e_s_s_i_o_n. The key fields
│ │ │ │ │  when adding a torrent are:
│ │ │ │ │      * ti - the immutable info-dict part of the torrent
│ │ │ │ │ @@ -291,14 +259,46 @@
│ │ │ │ │        applied before the torrent is added.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    last_download last_upload
│ │ │ │ │        the posix time of the last time payload was received or sent for this
│ │ │ │ │        torrent, respectively. A value of 0 means we don't know when we last
│ │ │ │ │        uploaded or downloaded, or we have never uploaded or downloaded any
│ │ │ │ │        payload for this torrent.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ cclliieenntt__ddaattaa__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_l_i_e_n_t___d_a_t_a_._h_p_p"
│ │ │ │ │ +A thin wrapper around a void pointer used as "user data". i.e. an opaque cookie
│ │ │ │ │ +passed in to libtorrent and returned on demand. It adds type-safety by
│ │ │ │ │ +requiring the same type be requested out of it as was assigned to it.
│ │ │ │ │ +struct client_data_t
│ │ │ │ │ +{
│ │ │ │ │ +   cclliieenntt__ddaattaa__tt () = default;
│ │ │ │ │ +   explicit cclliieenntt__ddaattaa__tt (T* v);
│ │ │ │ │ +   client_data_t& ooppeerraattoorr== (T* v);
│ │ │ │ │ +   T* ggeett () const;
│ │ │ │ │ +   explicit operator TT () const;
│ │ │ │ │ +   operator void ccoonnsstt** () const = delete;
│ │ │ │ │ +   operator vvooiidd** () const = delete;
│ │ │ │ │ +   client_data_t& ooppeerraattoorr== (void const*) = delete;
│ │ │ │ │ +   client_data_t& ooppeerraattoorr== (void*) = delete;
│ │ │ │ │ +
│ │ │ │ │ +   template <typename T, typename UU  = typename std::enable_if<std::
│ │ │ │ │ +is_pointer<T>::value>::type>
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** cclliieenntt__ddaattaa__tt(()) **********
│ │ │ │ │ +cclliieenntt__ddaattaa__tt () = default;
│ │ │ │ │ +construct a nullptr client data
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** vvooiidd**(()) ooppeerraattoorr==(()) ccoonnsstt**(()) **********
│ │ │ │ │ +operator void ccoonnsstt** () const = delete;
│ │ │ │ │ +operator vvooiidd** () const = delete;
│ │ │ │ │ +client_data_t& ooppeerraattoorr== (void const*) = delete;
│ │ │ │ │ +client_data_t& ooppeerraattoorr== (void*) = delete;
│ │ │ │ │ +we don't allow type-unsafe operations
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  _b_l_o_g
│ │ │ │ │  _u_T_P
│ │ │ │ │  _d_o_w_n_l_o_a_d
│ │ │ │ │  _d_o_c_u_m_e_n_t_a_t_i_o_n
│ │ │ │ │  _D_H_T_ _p_u_t_ _e_x_t_e_n_s_i_o_n
│ │ │ │ │  _p_y_t_h_o_n_ _b_i_n_d_i_n_g_s
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Alerts.html
│ │ │ │ @@ -28,211 +28,211 @@
│ │ │ │  <td>2.0.11</td></tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │ -<li><a class="reference internal" href="#alert" id="toc-entry-1">alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#timestamp" id="toc-entry-2">timestamp()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#type" id="toc-entry-3">type()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#what" id="toc-entry-4">what()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#message" id="toc-entry-5">message()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#category" id="toc-entry-6">category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-routing-bucket" id="toc-entry-1">dht_routing_bucket</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-alert" id="toc-entry-2">torrent_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#message" id="toc-entry-3">message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-routing-bucket" id="toc-entry-7">dht_routing_bucket</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-alert" id="toc-entry-8">torrent_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#message-1" id="toc-entry-9">message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-alert" id="toc-entry-4">peer_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-alert" id="toc-entry-5">tracker_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#tracker-url" id="toc-entry-6">tracker_url()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-alert" id="toc-entry-10">peer_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-alert" id="toc-entry-11">tracker_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#tracker-url" id="toc-entry-12">tracker_url()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-removed-alert" id="toc-entry-7">torrent_removed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#read-piece-alert" id="toc-entry-8">read_piece_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-completed-alert" id="toc-entry-9">file_completed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-renamed-alert" id="toc-entry-10">file_renamed_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#new-name-old-name" id="toc-entry-11">new_name() old_name()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-removed-alert" id="toc-entry-13">torrent_removed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#read-piece-alert" id="toc-entry-14">read_piece_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-completed-alert" id="toc-entry-15">file_completed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-renamed-alert" id="toc-entry-16">file_renamed_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#new-name-old-name" id="toc-entry-17">new_name() old_name()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-rename-failed-alert" id="toc-entry-12">file_rename_failed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#performance-alert" id="toc-entry-13">performance_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#enum-performance-warning-t" id="toc-entry-14">enum performance_warning_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#file-rename-failed-alert" id="toc-entry-18">file_rename_failed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#performance-alert" id="toc-entry-19">performance_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#enum-performance-warning-t" id="toc-entry-20">enum performance_warning_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#state-changed-alert" id="toc-entry-15">state_changed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-error-alert" id="toc-entry-16">tracker_error_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#failure-reason" id="toc-entry-17">failure_reason()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#state-changed-alert" id="toc-entry-21">state_changed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-error-alert" id="toc-entry-22">tracker_error_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#failure-reason" id="toc-entry-23">failure_reason()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-warning-alert" id="toc-entry-18">tracker_warning_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#warning-message" id="toc-entry-19">warning_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-warning-alert" id="toc-entry-24">tracker_warning_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#warning-message" id="toc-entry-25">warning_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#scrape-reply-alert" id="toc-entry-20">scrape_reply_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#scrape-failed-alert" id="toc-entry-21">scrape_failed_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#error-message" id="toc-entry-22">error_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#scrape-reply-alert" id="toc-entry-26">scrape_reply_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#scrape-failed-alert" id="toc-entry-27">scrape_failed_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#error-message" id="toc-entry-28">error_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-reply-alert" id="toc-entry-23">tracker_reply_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-reply-alert" id="toc-entry-24">dht_reply_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-announce-alert" id="toc-entry-25">tracker_announce_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#hash-failed-alert" id="toc-entry-26">hash_failed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-ban-alert" id="toc-entry-27">peer_ban_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-unsnubbed-alert" id="toc-entry-28">peer_unsnubbed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-snubbed-alert" id="toc-entry-29">peer_snubbed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-error-alert" id="toc-entry-30">peer_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-connect-alert" id="toc-entry-31">peer_connect_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#enum-direction-t" id="toc-entry-32">enum direction_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-reply-alert" id="toc-entry-29">tracker_reply_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-reply-alert" id="toc-entry-30">dht_reply_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-announce-alert" id="toc-entry-31">tracker_announce_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#hash-failed-alert" id="toc-entry-32">hash_failed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-ban-alert" id="toc-entry-33">peer_ban_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-unsnubbed-alert" id="toc-entry-34">peer_unsnubbed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-snubbed-alert" id="toc-entry-35">peer_snubbed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-error-alert" id="toc-entry-36">peer_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-connect-alert" id="toc-entry-37">peer_connect_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#enum-direction-t" id="toc-entry-38">enum direction_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-disconnected-alert" id="toc-entry-33">peer_disconnected_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#invalid-request-alert" id="toc-entry-34">invalid_request_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-finished-alert" id="toc-entry-35">torrent_finished_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-finished-alert" id="toc-entry-36">piece_finished_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#request-dropped-alert" id="toc-entry-37">request_dropped_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#block-timeout-alert" id="toc-entry-38">block_timeout_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#block-finished-alert" id="toc-entry-39">block_finished_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#block-downloading-alert" id="toc-entry-40">block_downloading_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#unwanted-block-alert" id="toc-entry-41">unwanted_block_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#storage-moved-alert" id="toc-entry-42">storage_moved_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#old-path-storage-path" id="toc-entry-43">old_path() storage_path()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-disconnected-alert" id="toc-entry-39">peer_disconnected_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#invalid-request-alert" id="toc-entry-40">invalid_request_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-finished-alert" id="toc-entry-41">torrent_finished_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-finished-alert" id="toc-entry-42">piece_finished_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#request-dropped-alert" id="toc-entry-43">request_dropped_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#block-timeout-alert" id="toc-entry-44">block_timeout_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#block-finished-alert" id="toc-entry-45">block_finished_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#block-downloading-alert" id="toc-entry-46">block_downloading_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#unwanted-block-alert" id="toc-entry-47">unwanted_block_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#storage-moved-alert" id="toc-entry-48">storage_moved_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#old-path-storage-path" id="toc-entry-49">old_path() storage_path()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#storage-moved-failed-alert" id="toc-entry-44">storage_moved_failed_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#file-path" id="toc-entry-45">file_path()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#storage-moved-failed-alert" id="toc-entry-50">storage_moved_failed_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#file-path" id="toc-entry-51">file_path()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-deleted-alert" id="toc-entry-46">torrent_deleted_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-delete-failed-alert" id="toc-entry-47">torrent_delete_failed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#save-resume-data-alert" id="toc-entry-48">save_resume_data_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#save-resume-data-failed-alert" id="toc-entry-49">save_resume_data_failed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-paused-alert" id="toc-entry-50">torrent_paused_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-resumed-alert" id="toc-entry-51">torrent_resumed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-checked-alert" id="toc-entry-52">torrent_checked_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#url-seed-alert" id="toc-entry-53">url_seed_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#server-url" id="toc-entry-54">server_url()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#error-message-1" id="toc-entry-55">error_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-deleted-alert" id="toc-entry-52">torrent_deleted_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-delete-failed-alert" id="toc-entry-53">torrent_delete_failed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#save-resume-data-alert" id="toc-entry-54">save_resume_data_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#save-resume-data-failed-alert" id="toc-entry-55">save_resume_data_failed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-paused-alert" id="toc-entry-56">torrent_paused_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-resumed-alert" id="toc-entry-57">torrent_resumed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-checked-alert" id="toc-entry-58">torrent_checked_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#url-seed-alert" id="toc-entry-59">url_seed_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#server-url" id="toc-entry-60">server_url()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#error-message-1" id="toc-entry-61">error_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-error-alert" id="toc-entry-56">file_error_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#filename" id="toc-entry-57">filename()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#file-error-alert" id="toc-entry-62">file_error_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#filename" id="toc-entry-63">filename()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#metadata-failed-alert" id="toc-entry-58">metadata_failed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#metadata-received-alert" id="toc-entry-59">metadata_received_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#udp-error-alert" id="toc-entry-60">udp_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#external-ip-alert" id="toc-entry-61">external_ip_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#listen-failed-alert" id="toc-entry-62">listen_failed_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#listen-interface" id="toc-entry-63">listen_interface()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#metadata-failed-alert" id="toc-entry-64">metadata_failed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#metadata-received-alert" id="toc-entry-65">metadata_received_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#udp-error-alert" id="toc-entry-66">udp_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#external-ip-alert" id="toc-entry-67">external_ip_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#listen-failed-alert" id="toc-entry-68">listen_failed_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#listen-interface" id="toc-entry-69">listen_interface()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#listen-succeeded-alert" id="toc-entry-64">listen_succeeded_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#portmap-error-alert" id="toc-entry-65">portmap_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#portmap-alert" id="toc-entry-66">portmap_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#portmap-log-alert" id="toc-entry-67">portmap_log_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#log-message" id="toc-entry-68">log_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#listen-succeeded-alert" id="toc-entry-70">listen_succeeded_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#portmap-error-alert" id="toc-entry-71">portmap_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#portmap-alert" id="toc-entry-72">portmap_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#portmap-log-alert" id="toc-entry-73">portmap_log_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#log-message" id="toc-entry-74">log_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#fastresume-rejected-alert" id="toc-entry-69">fastresume_rejected_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#file-path-1" id="toc-entry-70">file_path()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#fastresume-rejected-alert" id="toc-entry-75">fastresume_rejected_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#file-path-1" id="toc-entry-76">file_path()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-blocked-alert" id="toc-entry-71">peer_blocked_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#enum-reason-t" id="toc-entry-72">enum reason_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-blocked-alert" id="toc-entry-77">peer_blocked_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#enum-reason-t" id="toc-entry-78">enum reason_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-announce-alert" id="toc-entry-73">dht_announce_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-get-peers-alert" id="toc-entry-74">dht_get_peers_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#cache-flushed-alert" id="toc-entry-75">cache_flushed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#lsd-peer-alert" id="toc-entry-76">lsd_peer_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#trackerid-alert" id="toc-entry-77">trackerid_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#tracker-id" id="toc-entry-78">tracker_id()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-announce-alert" id="toc-entry-79">dht_announce_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-get-peers-alert" id="toc-entry-80">dht_get_peers_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#cache-flushed-alert" id="toc-entry-81">cache_flushed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#lsd-peer-alert" id="toc-entry-82">lsd_peer_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#trackerid-alert" id="toc-entry-83">trackerid_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#tracker-id" id="toc-entry-84">tracker_id()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-bootstrap-alert" id="toc-entry-79">dht_bootstrap_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-error-alert" id="toc-entry-80">torrent_error_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#filename-1" id="toc-entry-81">filename()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-bootstrap-alert" id="toc-entry-85">dht_bootstrap_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-error-alert" id="toc-entry-86">torrent_error_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#filename-1" id="toc-entry-87">filename()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-need-cert-alert" id="toc-entry-82">torrent_need_cert_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#incoming-connection-alert" id="toc-entry-83">incoming_connection_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-torrent-alert" id="toc-entry-84">add_torrent_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#state-update-alert" id="toc-entry-85">state_update_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-stats-alert" id="toc-entry-86">session_stats_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#counters" id="toc-entry-87">counters()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-need-cert-alert" id="toc-entry-88">torrent_need_cert_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#incoming-connection-alert" id="toc-entry-89">incoming_connection_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-torrent-alert" id="toc-entry-90">add_torrent_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#state-update-alert" id="toc-entry-91">state_update_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#session-stats-alert" id="toc-entry-92">session_stats_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#counters" id="toc-entry-93">counters()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-error-alert" id="toc-entry-88">dht_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-immutable-item-alert" id="toc-entry-89">dht_immutable_item_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-mutable-item-alert" id="toc-entry-90">dht_mutable_item_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-put-alert" id="toc-entry-91">dht_put_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#i2p-alert" id="toc-entry-92">i2p_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-outgoing-get-peers-alert" id="toc-entry-93">dht_outgoing_get_peers_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#log-alert" id="toc-entry-94">log_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#log-message-1" id="toc-entry-95">log_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-error-alert" id="toc-entry-94">dht_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-immutable-item-alert" id="toc-entry-95">dht_immutable_item_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-mutable-item-alert" id="toc-entry-96">dht_mutable_item_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-put-alert" id="toc-entry-97">dht_put_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#i2p-alert" id="toc-entry-98">i2p_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-outgoing-get-peers-alert" id="toc-entry-99">dht_outgoing_get_peers_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#log-alert" id="toc-entry-100">log_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#log-message-1" id="toc-entry-101">log_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-log-alert" id="toc-entry-96">torrent_log_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#log-message-2" id="toc-entry-97">log_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-log-alert" id="toc-entry-102">torrent_log_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#log-message-2" id="toc-entry-103">log_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-log-alert" id="toc-entry-98">peer_log_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#log-message-3" id="toc-entry-99">log_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-direction-t-1" id="toc-entry-100">enum direction_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-log-alert" id="toc-entry-104">peer_log_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#log-message-3" id="toc-entry-105">log_message()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-direction-t-1" id="toc-entry-106">enum direction_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#lsd-error-alert" id="toc-entry-101">lsd_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-lookup" id="toc-entry-102">dht_lookup</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-stats-alert" id="toc-entry-103">dht_stats_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#incoming-request-alert" id="toc-entry-104">incoming_request_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-log-alert" id="toc-entry-105">dht_log_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#log-message-4" id="toc-entry-106">log_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-dht-module-t" id="toc-entry-107">enum dht_module_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#lsd-error-alert" id="toc-entry-107">lsd_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-lookup" id="toc-entry-108">dht_lookup</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-stats-alert" id="toc-entry-109">dht_stats_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#incoming-request-alert" id="toc-entry-110">incoming_request_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-log-alert" id="toc-entry-111">dht_log_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#log-message-4" id="toc-entry-112">log_message()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-dht-module-t" id="toc-entry-113">enum dht_module_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-pkt-alert" id="toc-entry-108">dht_pkt_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#pkt-buf" id="toc-entry-109">pkt_buf()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-direction-t-2" id="toc-entry-110">enum direction_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-pkt-alert" id="toc-entry-114">dht_pkt_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#pkt-buf" id="toc-entry-115">pkt_buf()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-direction-t-2" id="toc-entry-116">enum direction_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-get-peers-reply-alert" id="toc-entry-111">dht_get_peers_reply_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-direct-response-alert" id="toc-entry-112">dht_direct_response_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#picker-log-alert" id="toc-entry-113">picker_log_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-error-alert" id="toc-entry-114">session_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-live-nodes-alert" id="toc-entry-115">dht_live_nodes_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#nodes-num-nodes" id="toc-entry-116">nodes() num_nodes()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-get-peers-reply-alert" id="toc-entry-117">dht_get_peers_reply_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-direct-response-alert" id="toc-entry-118">dht_direct_response_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#picker-log-alert" id="toc-entry-119">picker_log_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#session-error-alert" id="toc-entry-120">session_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-live-nodes-alert" id="toc-entry-121">dht_live_nodes_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#nodes-num-nodes" id="toc-entry-122">nodes() num_nodes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-stats-header-alert" id="toc-entry-117">session_stats_header_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-sample-infohashes-alert" id="toc-entry-118">dht_sample_infohashes_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#num-samples-samples" id="toc-entry-119">num_samples() samples()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#num-nodes" id="toc-entry-120">num_nodes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#nodes" id="toc-entry-121">nodes()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#session-stats-header-alert" id="toc-entry-123">session_stats_header_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-sample-infohashes-alert" id="toc-entry-124">dht_sample_infohashes_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#samples-num-samples" id="toc-entry-125">samples() num_samples()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#num-nodes" id="toc-entry-126">num_nodes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#nodes" id="toc-entry-127">nodes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#block-uploaded-alert" id="toc-entry-122">block_uploaded_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#alerts-dropped-alert" id="toc-entry-123">alerts_dropped_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#socks5-alert" id="toc-entry-124">socks5_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-prio-alert" id="toc-entry-125">file_prio_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#oversized-file-alert" id="toc-entry-126">oversized_file_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-conflict-alert" id="toc-entry-127">torrent_conflict_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-info-alert" id="toc-entry-128">peer_info_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-progress-alert" id="toc-entry-129">file_progress_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-info-alert" id="toc-entry-130">piece_info_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-availability-alert" id="toc-entry-131">piece_availability_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-list-alert" id="toc-entry-132">tracker_list_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#alert" id="toc-entry-133">alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#timestamp" id="toc-entry-134">timestamp()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#type" id="toc-entry-135">type()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#what" id="toc-entry-136">what()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#message-1" id="toc-entry-137">message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#category" id="toc-entry-138">category()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#block-uploaded-alert" id="toc-entry-128">block_uploaded_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#alerts-dropped-alert" id="toc-entry-129">alerts_dropped_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#socks5-alert" id="toc-entry-130">socks5_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-prio-alert" id="toc-entry-131">file_prio_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#oversized-file-alert" id="toc-entry-132">oversized_file_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-conflict-alert" id="toc-entry-133">torrent_conflict_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-info-alert" id="toc-entry-134">peer_info_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-progress-alert" id="toc-entry-135">file_progress_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-info-alert" id="toc-entry-136">piece_info_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-availability-alert" id="toc-entry-137">piece_availability_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-list-alert" id="toc-entry-138">tracker_list_alert</a></li>
│ │ │ │  <li><a class="reference internal" href="#alert-cast" id="toc-entry-139">alert_cast()</a></li>
│ │ │ │  <li><a class="reference internal" href="#operation-name" id="toc-entry-140">operation_name()</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-operation-t" id="toc-entry-141">enum operation_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#alert-category-t" id="toc-entry-142">alert_category_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#int" id="toc-entry-143">int</a></li>
│ │ │ │ +<li><a class="reference internal" href="#int" id="toc-entry-142">int</a></li>
│ │ │ │ +<li><a class="reference internal" href="#alert-category-t" id="toc-entry-143">alert_category_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │  <p>The <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> function on <a class="reference external" href="reference-Session.html#session">session</a> is the main interface for retrieving
│ │ │ │  alerts (warnings, messages and errors from libtorrent). If no alerts have
│ │ │ │  been posted by libtorrent <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> will return an empty list.</p>
│ │ │ │  <p>By default, only errors are reported. <a class="reference external" href="reference-Settings.html#alert_mask">settings_pack::alert_mask</a> can be
│ │ │ │  used to specify which kinds of events should be reported. The <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask is
│ │ │ │ @@ -246,124 +246,15 @@
│ │ │ │  <p>There are other <a class="reference external" href="reference-Alerts.html#alert">alert</a> base classes that some alerts derive from, all the
│ │ │ │  alerts that are generated for a specific torrent are derived from
│ │ │ │  <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a>, and tracker events derive from <a class="reference external" href="reference-Alerts.html#tracker_alert">tracker_alert</a>.</p>
│ │ │ │  <p>Alerts returned by <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> are only valid until the next call to
│ │ │ │  <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a>. You may not copy an <a class="reference external" href="reference-Alerts.html#alert">alert</a> object to access it after the next
│ │ │ │  call to <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a>. Internal members of alerts also become invalid once
│ │ │ │  <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> is called again.</p>
│ │ │ │ -<a name="alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+alert&labels=documentation&body=Documentation+under+heading+%22class+alert%22+could+be+improved">report issue</a>]</span><div class="section" id="alert">
│ │ │ │ -<h1>alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
│ │ │ │ -<p>The <tt class="docutils literal">alert</tt> class is the base class that specific messages are derived from.
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#alert">alert</a> types are not copyable, and cannot be constructed by the client. The
│ │ │ │ -pointers returned by libtorrent are short lived (the details are described
│ │ │ │ -under <a class="reference external" href="reference-Session.html#pop_alerts()">session_handle::pop_alerts()</a>)</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct alert
│ │ │ │ -{
│ │ │ │ -   time_point <strong>timestamp</strong> () const;
│ │ │ │ -   virtual int <strong>type</strong> () const noexcept = 0;
│ │ │ │ -   virtual char const* <strong>what</strong> () const noexcept = 0;
│ │ │ │ -   virtual std::string <strong>message</strong> () const = 0;
│ │ │ │ -   virtual alert_category_t <strong>category</strong> () const noexcept = 0;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>error_notification</strong>  = 0_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>peer_notification</strong>  = 1_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>port_mapping_notification</strong>  = 2_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>storage_notification</strong>  = 3_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>tracker_notification</strong>  = 4_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>connect_notification</strong>  = 5_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>status_notification</strong>  = 6_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>ip_block_notification</strong>  = 8_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>performance_warning</strong>  = 9_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>dht_notification</strong>  = 10_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>session_log_notification</strong>  = 13_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>torrent_log_notification</strong>  = 14_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>peer_log_notification</strong>  = 15_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>incoming_request_notification</strong>  = 16_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>dht_log_notification</strong>  = 17_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>dht_operation_notification</strong>  = 18_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>port_mapping_log_notification</strong>  = 19_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>picker_log_notification</strong>  = 20_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>file_progress_notification</strong>  = 21_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>piece_progress_notification</strong>  = 22_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>upload_notification</strong>  = 23_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>block_progress_notification</strong>  = 24_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>all_categories</strong>  = alert_category_t::all();
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="timestamp()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Btimestamp%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Btimestamp%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="timestamp">
│ │ │ │ -<h2>timestamp()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -time_point <strong>timestamp</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>a timestamp is automatically created in the constructor</p>
│ │ │ │ -<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="type">
│ │ │ │ -<h2>type()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual int <strong>type</strong> () const noexcept = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns an integer that is unique to this <a class="reference external" href="reference-Alerts.html#alert">alert</a> type. It can be
│ │ │ │ -compared against a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> by querying a static constant called <tt class="docutils literal">alert_type</tt>
│ │ │ │ -in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>. It can be used to determine the run-time type of an alert* in
│ │ │ │ -order to cast to that <a class="reference external" href="reference-Alerts.html#alert">alert</a> type and access specific members.</p>
│ │ │ │ -<p>e.g:</p>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">alert</span><span class="operator">*&gt;</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">pop_alerts</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">alerts</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">alert</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">a</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -        </span><span class="keyword">switch</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">a</span><span class="operator">-&gt;</span><span class="name">type</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -
│ │ │ │ -                </span><span class="keyword">case</span><span class="whitespace"> </span><span class="name constant">read_piece_alert</span><span class="operator">::</span><span class="name constant">alert_type</span><span class="punctuation">:</span><span class="whitespace">
│ │ │ │ -                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -                        </span><span class="keyword">auto</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">p</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="name">read_piece_alert</span><span class="operator">*&gt;</span><span class="punctuation">(</span><span class="name">a</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -                        </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">p</span><span class="operator">-&gt;</span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -                                </span><span class="comment single">// read_piece failed
│ │ │ │ -</span><span class="whitespace">                                </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -                        </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ -                        </span><span class="comment single">// use p
│ │ │ │ -</span><span class="whitespace">                        </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ -                </span><span class="keyword">case</span><span class="whitespace"> </span><span class="name constant">file_renamed_alert</span><span class="operator">::</span><span class="name constant">alert_type</span><span class="punctuation">:</span><span class="whitespace">
│ │ │ │ -                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -                        </span><span class="comment single">// etc...
│ │ │ │ -</span><span class="whitespace">                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ -        </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ -</span><span class="punctuation">}</span>
│ │ │ │ -</pre>
│ │ │ │ -<a name="what()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bwhat%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bwhat%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="what">
│ │ │ │ -<h2>what()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual char const* <strong>what</strong> () const noexcept = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a string literal describing the type of the <a class="reference external" href="reference-Alerts.html#alert">alert</a>. It does
│ │ │ │ -not include any information that might be bundled with the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ -<a name="message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bmessage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bmessage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="message">
│ │ │ │ -<h2>message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual std::string <strong>message</strong> () const = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>generate a string describing the <a class="reference external" href="reference-Alerts.html#alert">alert</a> and the information bundled
│ │ │ │ -with it. This is mainly intended for debug and development use. It is not suitable
│ │ │ │ -to use this for applications that may be localized. Instead, handle each <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -type individually and extract and render the information from the <a class="reference external" href="reference-Alerts.html#alert">alert</a> depending
│ │ │ │ -on the locale.</p>
│ │ │ │ -<a name="category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bcategory%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bcategory%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="category">
│ │ │ │ -<h2>category()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual alert_category_t <strong>category</strong> () const noexcept = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a bitmask specifying which categories this <a class="reference external" href="reference-Alerts.html#alert">alert</a> belong to.</p>
│ │ │ │ -<a name="dht_routing_bucket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_routing_bucket&labels=documentation&body=Documentation+under+heading+%22class+dht_routing_bucket%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="dht-routing-bucket">
│ │ │ │ +<a name="dht_routing_bucket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_routing_bucket&labels=documentation&body=Documentation+under+heading+%22class+dht_routing_bucket%22+could+be+improved">report issue</a>]</span><div class="section" id="dht-routing-bucket">
│ │ │ │  <h1>dht_routing_bucket</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │  <p>struct to hold information about a single DHT routing table bucket</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct dht_routing_bucket
│ │ │ │  {
│ │ │ │     int num_nodes;
│ │ │ │ @@ -394,15 +285,15 @@
│ │ │ │  {
│ │ │ │     std::string <strong>message</strong> () const override;
│ │ │ │     char const* <strong>torrent_name</strong> () const;
│ │ │ │  
│ │ │ │     torrent_handle handle;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_alert%3A%3A%5Bmessage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_alert%3A%3A%5Bmessage%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="message-1">
│ │ │ │ +<a name="message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_alert%3A%3A%5Bmessage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_alert%3A%3A%5Bmessage%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="message">
│ │ │ │  <h2>message()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::string <strong>message</strong> () const override;
│ │ │ │  </pre>
│ │ │ │  <p>returns the message associated with this <a class="reference external" href="reference-Alerts.html#alert">alert</a></p>
│ │ │ │  <a name="handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_alert%3A%3A%5Bhandle%5D&labels=documentation&body=Documentation+under+heading+%22torrent_alert%3A%3A%5Bhandle%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>handle</dt>
│ │ │ │ @@ -544,27 +435,27 @@
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │  <p>This is posted as a response to a <a class="reference external" href="reference-Torrent_Handle.html#rename_file()">torrent_handle::rename_file()</a> call, if the rename
│ │ │ │  operation succeeds.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct file_renamed_alert final : torrent_alert
│ │ │ │  {
│ │ │ │     std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>new_name</strong> () const;
│ │ │ │     char const* <strong>old_name</strong> () const;
│ │ │ │ +   char const* <strong>new_name</strong> () const;
│ │ │ │  
│ │ │ │     static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │     file_index_t const index;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="new_name()"></a>
│ │ │ │  <a name="old_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_renamed_alert%3A%3A%5Bnew_name%28%29+old_name%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_renamed_alert%3A%3A%5Bnew_name%28%29+old_name%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="new-name-old-name">
│ │ │ │  <h2>new_name() old_name()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -char const* <strong>new_name</strong> () const;
│ │ │ │  char const* <strong>old_name</strong> () const;
│ │ │ │ +char const* <strong>new_name</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>returns the new and previous file name, respectively.</p>
│ │ │ │  <a name="index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_renamed_alert%3A%3A%5Bindex%5D&labels=documentation&body=Documentation+under+heading+%22file_renamed_alert%3A%3A%5Bindex%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>index</dt>
│ │ │ │  <dd>refers to the index of the file that was renamed,</dd>
│ │ │ │  </dl>
│ │ │ │  <a name="file_rename_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_rename_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+file_rename_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ @@ -3005,17 +2896,17 @@
│ │ │ │     static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_operation;
│ │ │ │     sha1_hash node_id;
│ │ │ │     aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
│ │ │ │     time_duration const interval;
│ │ │ │     int const num_infohashes;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="samples()"></a>
│ │ │ │ -<a name="num_samples()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bsamples%28%29+num_samples%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bsamples%28%29+num_samples%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="samples-num-samples">
│ │ │ │ -<h2>samples() num_samples()</h2>
│ │ │ │ +<a name="num_samples()"></a>
│ │ │ │ +<a name="samples()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnum_samples%28%29+samples%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnum_samples%28%29+samples%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="num-samples-samples">
│ │ │ │ +<h2>num_samples() samples()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  int <strong>num_samples</strong> () const;
│ │ │ │  std::vector&lt;sha1_hash&gt; <strong>samples</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>returns the number of info-hashes returned by the node, as well as the
│ │ │ │  actual info-hashes. <tt class="docutils literal">num_samples()</tt> is more efficient than
│ │ │ │  <tt class="docutils literal"><span class="pre">samples().size()</span></tt>.</p>
│ │ │ │ @@ -3079,16 +2970,16 @@
│ │ │ │  <p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted to indicate to the client that some alerts were
│ │ │ │  dropped. Dropped meaning that the <a class="reference external" href="reference-Alerts.html#alert">alert</a> failed to be delivered to the
│ │ │ │  client. The most common cause of such failure is that the internal <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │  queue grew too big (controlled by alert_queue_size).</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct alerts_dropped_alert final : alert
│ │ │ │  {
│ │ │ │ -   <strong>static_assert</strong> (num_alert_types &lt;= abi_alert_count, &quot;need to increase bitset. This is an ABI break&quot;);
│ │ │ │     std::string <strong>message</strong> () const override;
│ │ │ │ +   <strong>static_assert</strong> (num_alert_types &lt;= abi_alert_count, &quot;need to increase bitset. This is an ABI break&quot;);
│ │ │ │  
│ │ │ │     static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │     std::bitset&lt;abi_alert_count&gt; dropped_alerts;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="dropped_alerts"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alerts_dropped_alert%3A%3A%5Bdropped_alerts%5D&labels=documentation&body=Documentation+under+heading+%22alerts_dropped_alert%3A%3A%5Bdropped_alerts%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>dropped_alerts</dt>
│ │ │ │ @@ -3294,21 +3185,130 @@
│ │ │ │     std::vector&lt;announce_entry&gt; trackers;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="trackers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_list_alert%3A%3A%5Btrackers%5D&labels=documentation&body=Documentation+under+heading+%22tracker_list_alert%3A%3A%5Btrackers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>trackers</dt>
│ │ │ │  <dd>list of trackers and their status for the torrent</dd>
│ │ │ │  </dl>
│ │ │ │ +<a name="alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+alert&labels=documentation&body=Documentation+under+heading+%22class+alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="alert">
│ │ │ │ +<h1>alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
│ │ │ │ +<p>The <tt class="docutils literal">alert</tt> class is the base class that specific messages are derived from.
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#alert">alert</a> types are not copyable, and cannot be constructed by the client. The
│ │ │ │ +pointers returned by libtorrent are short lived (the details are described
│ │ │ │ +under <a class="reference external" href="reference-Session.html#pop_alerts()">session_handle::pop_alerts()</a>)</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct alert
│ │ │ │ +{
│ │ │ │ +   time_point <strong>timestamp</strong> () const;
│ │ │ │ +   virtual int <strong>type</strong> () const noexcept = 0;
│ │ │ │ +   virtual char const* <strong>what</strong> () const noexcept = 0;
│ │ │ │ +   virtual std::string <strong>message</strong> () const = 0;
│ │ │ │ +   virtual alert_category_t <strong>category</strong> () const noexcept = 0;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>error_notification</strong>  = 0_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>peer_notification</strong>  = 1_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>port_mapping_notification</strong>  = 2_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>storage_notification</strong>  = 3_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>tracker_notification</strong>  = 4_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>connect_notification</strong>  = 5_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>status_notification</strong>  = 6_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>ip_block_notification</strong>  = 8_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>performance_warning</strong>  = 9_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>dht_notification</strong>  = 10_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>session_log_notification</strong>  = 13_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>torrent_log_notification</strong>  = 14_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>peer_log_notification</strong>  = 15_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>incoming_request_notification</strong>  = 16_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>dht_log_notification</strong>  = 17_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>dht_operation_notification</strong>  = 18_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>port_mapping_log_notification</strong>  = 19_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>picker_log_notification</strong>  = 20_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>file_progress_notification</strong>  = 21_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>piece_progress_notification</strong>  = 22_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>upload_notification</strong>  = 23_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>block_progress_notification</strong>  = 24_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>all_categories</strong>  = alert_category_t::all();
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="timestamp()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Btimestamp%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Btimestamp%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="timestamp">
│ │ │ │ +<h2>timestamp()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +time_point <strong>timestamp</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>a timestamp is automatically created in the constructor</p>
│ │ │ │ +<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="type">
│ │ │ │ +<h2>type()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual int <strong>type</strong> () const noexcept = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns an integer that is unique to this <a class="reference external" href="reference-Alerts.html#alert">alert</a> type. It can be
│ │ │ │ +compared against a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> by querying a static constant called <tt class="docutils literal">alert_type</tt>
│ │ │ │ +in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>. It can be used to determine the run-time type of an alert* in
│ │ │ │ +order to cast to that <a class="reference external" href="reference-Alerts.html#alert">alert</a> type and access specific members.</p>
│ │ │ │ +<p>e.g:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">alert</span><span class="operator">*&gt;</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">pop_alerts</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">alerts</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">alert</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">a</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +        </span><span class="keyword">switch</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">a</span><span class="operator">-&gt;</span><span class="name">type</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +                </span><span class="keyword">case</span><span class="whitespace"> </span><span class="name constant">read_piece_alert</span><span class="operator">::</span><span class="name constant">alert_type</span><span class="punctuation">:</span><span class="whitespace">
│ │ │ │ +                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +                        </span><span class="keyword">auto</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">p</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="name">read_piece_alert</span><span class="operator">*&gt;</span><span class="punctuation">(</span><span class="name">a</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +                        </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">p</span><span class="operator">-&gt;</span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +                                </span><span class="comment single">// read_piece failed
│ │ │ │ +</span><span class="whitespace">                                </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +                        </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +                        </span><span class="comment single">// use p
│ │ │ │ +</span><span class="whitespace">                        </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +                </span><span class="keyword">case</span><span class="whitespace"> </span><span class="name constant">file_renamed_alert</span><span class="operator">::</span><span class="name constant">alert_type</span><span class="punctuation">:</span><span class="whitespace">
│ │ │ │ +                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +                        </span><span class="comment single">// etc...
│ │ │ │ +</span><span class="whitespace">                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +        </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">}</span>
│ │ │ │ +</pre>
│ │ │ │ +<a name="what()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bwhat%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bwhat%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="what">
│ │ │ │ +<h2>what()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual char const* <strong>what</strong> () const noexcept = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a string literal describing the type of the <a class="reference external" href="reference-Alerts.html#alert">alert</a>. It does
│ │ │ │ +not include any information that might be bundled with the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ +<a name="message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bmessage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bmessage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="message-1">
│ │ │ │ +<h2>message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual std::string <strong>message</strong> () const = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>generate a string describing the <a class="reference external" href="reference-Alerts.html#alert">alert</a> and the information bundled
│ │ │ │ +with it. This is mainly intended for debug and development use. It is not suitable
│ │ │ │ +to use this for applications that may be localized. Instead, handle each <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +type individually and extract and render the information from the <a class="reference external" href="reference-Alerts.html#alert">alert</a> depending
│ │ │ │ +on the locale.</p>
│ │ │ │ +<a name="category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bcategory%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bcategory%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="category">
│ │ │ │ +<h2>category()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual alert_category_t <strong>category</strong> () const noexcept = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a bitmask specifying which categories this <a class="reference external" href="reference-Alerts.html#alert">alert</a> belong to.</p>
│ │ │ │  <a name="alert_cast()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert_cast%28%29&labels=documentation&body=Documentation+under+heading+%22alert_cast%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │  <div class="section" id="alert-cast">
│ │ │ │  <h1>alert_cast()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -template &lt;typename T&gt; T const* <strong>alert_cast</strong> (alert const* a);
│ │ │ │  template &lt;typename T&gt; T* <strong>alert_cast</strong> (alert* a);
│ │ │ │ +template &lt;typename T&gt; T const* <strong>alert_cast</strong> (alert const* a);
│ │ │ │  </pre>
│ │ │ │  <p>When you get an <a class="reference external" href="reference-Alerts.html#alert">alert</a>, you can use <tt class="docutils literal">alert_cast&lt;&gt;</tt> to attempt to cast the
│ │ │ │  pointer to a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> type, in order to query it for more
│ │ │ │  information.</p>
│ │ │ │  <div class="admonition note">
│ │ │ │  <p class="first admonition-title">Note</p>
│ │ │ │  <p class="last"><tt class="docutils literal">alert_cast&lt;&gt;</tt> can only cast to an exact <a class="reference external" href="reference-Alerts.html#alert">alert</a> type, not a base class</p>
│ │ │ │ @@ -3530,14 +3530,26 @@
│ │ │ │  </tr>
│ │ │ │  <tr><td>file_truncate</td>
│ │ │ │  <td>46</td>
│ │ │ │  <td>call to ftruncate() (or SetEndOfFile() on windows)</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ +<a name="int"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:int&labels=documentation&body=Documentation+under+heading+%22int%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="int">
│ │ │ │ +<h1>int</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<a name="int::user_alert_id"></a><dl class="docutils">
│ │ │ │ +<dt>user_alert_id</dt>
│ │ │ │ +<dd>user defined alerts should use IDs greater than this</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="int::num_alert_types"></a><dl class="docutils">
│ │ │ │ +<dt>num_alert_types</dt>
│ │ │ │ +<dd>this constant represents &quot;max_alert_index&quot; + 1</dd>
│ │ │ │ +</dl>
│ │ │ │  <a name="alert_category_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert_category_t&labels=documentation&body=Documentation+under+heading+%22alert_category_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="alert-category-t">
│ │ │ │  <h1>alert_category_t</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
│ │ │ │  <a name="alert_category_t::error"></a><dl class="docutils">
│ │ │ │  <dt>error</dt>
│ │ │ │  <dd><p class="first">Enables alerts that report an error. This includes:</p>
│ │ │ │ @@ -3665,26 +3677,14 @@
│ │ │ │  <dd><p class="first">The full bitmask, representing all available categories.</p>
│ │ │ │  <p class="last">since the enum is signed, make sure this isn't
│ │ │ │  interpreted as -1. For instance, boost.python
│ │ │ │  does that and fails when assigning it to an
│ │ │ │  unsigned parameter.</p>
│ │ │ │  </dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="int"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:int&labels=documentation&body=Documentation+under+heading+%22int%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="int">
│ │ │ │ -<h1>int</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<a name="int::user_alert_id"></a><dl class="docutils">
│ │ │ │ -<dt>user_alert_id</dt>
│ │ │ │ -<dd>user defined alerts should use IDs greater than this</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="int::num_alert_types"></a><dl class="docutils">
│ │ │ │ -<dt>num_alert_types</dt>
│ │ │ │ -<dd>this constant represents &quot;max_alert_index&quot; + 1</dd>
│ │ │ │ -</dl>
│ │ │ │  </div>
│ │ │ │  
│ │ │ │      </div>
│ │ │ │      </div>
│ │ │ │      <div id="gradient"></div>
│ │ │ │      <div id="filler">
│ │ │ │      <div id="footer">
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,18 +1,12 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │ -    * _a_l_e_r_t
│ │ │ │ │ -          o _t_i_m_e_s_t_a_m_p_(_)
│ │ │ │ │ -          o _t_y_p_e_(_)
│ │ │ │ │ -          o _w_h_a_t_(_)
│ │ │ │ │ -          o _m_e_s_s_a_g_e_(_)
│ │ │ │ │ -          o _c_a_t_e_g_o_r_y_(_)
│ │ │ │ │      * _d_h_t___r_o_u_t_i_n_g___b_u_c_k_e_t
│ │ │ │ │      * _t_o_r_r_e_n_t___a_l_e_r_t
│ │ │ │ │            o _m_e_s_s_a_g_e_(_)
│ │ │ │ │      * _p_e_e_r___a_l_e_r_t
│ │ │ │ │      * _t_r_a_c_k_e_r___a_l_e_r_t
│ │ │ │ │            o _t_r_a_c_k_e_r___u_r_l_(_)
│ │ │ │ │      * _t_o_r_r_e_n_t___r_e_m_o_v_e_d___a_l_e_r_t
│ │ │ │ │ @@ -123,33 +117,39 @@
│ │ │ │ │      * _d_h_t___d_i_r_e_c_t___r_e_s_p_o_n_s_e___a_l_e_r_t
│ │ │ │ │      * _p_i_c_k_e_r___l_o_g___a_l_e_r_t
│ │ │ │ │      * _s_e_s_s_i_o_n___e_r_r_o_r___a_l_e_r_t
│ │ │ │ │      * _d_h_t___l_i_v_e___n_o_d_e_s___a_l_e_r_t
│ │ │ │ │            o _n_o_d_e_s_(_)_ _n_u_m___n_o_d_e_s_(_)
│ │ │ │ │      * _s_e_s_s_i_o_n___s_t_a_t_s___h_e_a_d_e_r___a_l_e_r_t
│ │ │ │ │      * _d_h_t___s_a_m_p_l_e___i_n_f_o_h_a_s_h_e_s___a_l_e_r_t
│ │ │ │ │ -          o _s_a_m_p_l_e_s_(_)_ _n_u_m___s_a_m_p_l_e_s_(_)
│ │ │ │ │ +          o _n_u_m___s_a_m_p_l_e_s_(_)_ _s_a_m_p_l_e_s_(_)
│ │ │ │ │            o _n_u_m___n_o_d_e_s_(_)
│ │ │ │ │            o _n_o_d_e_s_(_)
│ │ │ │ │      * _b_l_o_c_k___u_p_l_o_a_d_e_d___a_l_e_r_t
│ │ │ │ │      * _a_l_e_r_t_s___d_r_o_p_p_e_d___a_l_e_r_t
│ │ │ │ │      * _s_o_c_k_s_5___a_l_e_r_t
│ │ │ │ │      * _f_i_l_e___p_r_i_o___a_l_e_r_t
│ │ │ │ │      * _o_v_e_r_s_i_z_e_d___f_i_l_e___a_l_e_r_t
│ │ │ │ │      * _t_o_r_r_e_n_t___c_o_n_f_l_i_c_t___a_l_e_r_t
│ │ │ │ │      * _p_e_e_r___i_n_f_o___a_l_e_r_t
│ │ │ │ │      * _f_i_l_e___p_r_o_g_r_e_s_s___a_l_e_r_t
│ │ │ │ │      * _p_i_e_c_e___i_n_f_o___a_l_e_r_t
│ │ │ │ │      * _p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y___a_l_e_r_t
│ │ │ │ │      * _t_r_a_c_k_e_r___l_i_s_t___a_l_e_r_t
│ │ │ │ │ +    * _a_l_e_r_t
│ │ │ │ │ +          o _t_i_m_e_s_t_a_m_p_(_)
│ │ │ │ │ +          o _t_y_p_e_(_)
│ │ │ │ │ +          o _w_h_a_t_(_)
│ │ │ │ │ +          o _m_e_s_s_a_g_e_(_)
│ │ │ │ │ +          o _c_a_t_e_g_o_r_y_(_)
│ │ │ │ │      * _a_l_e_r_t___c_a_s_t_(_)
│ │ │ │ │      * _o_p_e_r_a_t_i_o_n___n_a_m_e_(_)
│ │ │ │ │      * _e_n_u_m_ _o_p_e_r_a_t_i_o_n___t
│ │ │ │ │ -    * _a_l_e_r_t___c_a_t_e_g_o_r_y___t
│ │ │ │ │      * _i_n_t
│ │ │ │ │ +    * _a_l_e_r_t___c_a_t_e_g_o_r_y___t
│ │ │ │ │  The _p_o_p___a_l_e_r_t_s_(_) function on _s_e_s_s_i_o_n is the main interface for retrieving
│ │ │ │ │  alerts (warnings, messages and errors from libtorrent). If no alerts have been
│ │ │ │ │  posted by libtorrent _p_o_p___a_l_e_r_t_s_(_) will return an empty list.
│ │ │ │ │  By default, only errors are reported. _s_e_t_t_i_n_g_s___p_a_c_k_:_:_a_l_e_r_t___m_a_s_k can be used to
│ │ │ │ │  specify which kinds of events should be reported. The _a_l_e_r_t mask is a
│ │ │ │ │  combination of the _a_l_e_r_t___c_a_t_e_g_o_r_y___t flags in the _a_l_e_r_t class.
│ │ │ │ │  Every _a_l_e_r_t belongs to one or more category. There is a cost associated with
│ │ │ │ │ @@ -162,103 +162,14 @@
│ │ │ │ │  that are generated for a specific torrent are derived from _t_o_r_r_e_n_t___a_l_e_r_t, and
│ │ │ │ │  tracker events derive from _t_r_a_c_k_e_r___a_l_e_r_t.
│ │ │ │ │  Alerts returned by _p_o_p___a_l_e_r_t_s_(_) are only valid until the next call to
│ │ │ │ │  _p_o_p___a_l_e_r_t_s_(_). You may not copy an _a_l_e_r_t object to access it after the next call
│ │ │ │ │  to _p_o_p___a_l_e_r_t_s_(_). Internal members of alerts also become invalid once _p_o_p___a_l_e_r_t_s
│ │ │ │ │  _(_) is called again.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ aalleerrtt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t_._h_p_p"
│ │ │ │ │ -The alert class is the base class that specific messages are derived from.
│ │ │ │ │ -_a_l_e_r_t types are not copyable, and cannot be constructed by the client. The
│ │ │ │ │ -pointers returned by libtorrent are short lived (the details are described
│ │ │ │ │ -under _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_p_o_p___a_l_e_r_t_s_(_))
│ │ │ │ │ -struct alert
│ │ │ │ │ -{
│ │ │ │ │ -   time_point ttiimmeessttaammpp () const;
│ │ │ │ │ -   virtual int ttyyppee () const noexcept = 0;
│ │ │ │ │ -   virtual char const* wwhhaatt () const noexcept = 0;
│ │ │ │ │ -   virtual std::string mmeessssaaggee () const = 0;
│ │ │ │ │ -   virtual alert_category_t ccaatteeggoorryy () const noexcept = 0;
│ │ │ │ │ -
│ │ │ │ │ -   static constexpr alert_category_t eerrrroorr__nnoottiiffiiccaattiioonn  = 0_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppeeeerr__nnoottiiffiiccaattiioonn  = 1_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppoorrtt__mmaappppiinngg__nnoottiiffiiccaattiioonn  = 2_bit;
│ │ │ │ │ -   static constexpr alert_category_t ssttoorraaggee__nnoottiiffiiccaattiioonn  = 3_bit;
│ │ │ │ │ -   static constexpr alert_category_t ttrraacckkeerr__nnoottiiffiiccaattiioonn  = 4_bit;
│ │ │ │ │ -   static constexpr alert_category_t ccoonnnneecctt__nnoottiiffiiccaattiioonn  = 5_bit;
│ │ │ │ │ -   static constexpr alert_category_t ssttaattuuss__nnoottiiffiiccaattiioonn  = 6_bit;
│ │ │ │ │ -   static constexpr alert_category_t iipp__bblloocckk__nnoottiiffiiccaattiioonn  = 8_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppeerrffoorrmmaannccee__wwaarrnniinngg  = 9_bit;
│ │ │ │ │ -   static constexpr alert_category_t ddhhtt__nnoottiiffiiccaattiioonn  = 10_bit;
│ │ │ │ │ -   static constexpr alert_category_t sseessssiioonn__lloogg__nnoottiiffiiccaattiioonn  = 13_bit;
│ │ │ │ │ -   static constexpr alert_category_t ttoorrrreenntt__lloogg__nnoottiiffiiccaattiioonn  = 14_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppeeeerr__lloogg__nnoottiiffiiccaattiioonn  = 15_bit;
│ │ │ │ │ -   static constexpr alert_category_t iinnccoommiinngg__rreeqquueesstt__nnoottiiffiiccaattiioonn  = 16_bit;
│ │ │ │ │ -   static constexpr alert_category_t ddhhtt__lloogg__nnoottiiffiiccaattiioonn  = 17_bit;
│ │ │ │ │ -   static constexpr alert_category_t ddhhtt__ooppeerraattiioonn__nnoottiiffiiccaattiioonn  = 18_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppoorrtt__mmaappppiinngg__lloogg__nnoottiiffiiccaattiioonn  = 19_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppiicckkeerr__lloogg__nnoottiiffiiccaattiioonn  = 20_bit;
│ │ │ │ │ -   static constexpr alert_category_t ffiillee__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 21_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppiieeccee__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 22_bit;
│ │ │ │ │ -   static constexpr alert_category_t uuppllooaadd__nnoottiiffiiccaattiioonn  = 23_bit;
│ │ │ │ │ -   static constexpr alert_category_t bblloocckk__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 24_bit;
│ │ │ │ │ -   static constexpr alert_category_t aallll__ccaatteeggoorriieess  = alert_category_t::all();
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttiimmeessttaammpp(()) **********
│ │ │ │ │ -time_point ttiimmeessttaammpp () const;
│ │ │ │ │ -a timestamp is automatically created in the constructor
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttyyppee(()) **********
│ │ │ │ │ -virtual int ttyyppee () const noexcept = 0;
│ │ │ │ │ -returns an integer that is unique to this _a_l_e_r_t type. It can be compared
│ │ │ │ │ -against a specific _a_l_e_r_t by querying a static constant called alert_type in the
│ │ │ │ │ -_a_l_e_r_t. It can be used to determine the run-time type of an alert* in order to
│ │ │ │ │ -cast to that _a_l_e_r_t type and access specific members.
│ │ │ │ │ -e.g:
│ │ │ │ │ -std::vector<alert*> alerts;
│ │ │ │ │ -ses.pop_alerts(&alerts);
│ │ │ │ │ -for (alert* a : alerts) {
│ │ │ │ │ -        switch (a->type()) {
│ │ │ │ │ -
│ │ │ │ │ -                case read_piece_alert::alert_type:
│ │ │ │ │ -                {
│ │ │ │ │ -                        auto* p = static_cast<read_piece_alert*>(a);
│ │ │ │ │ -                        if (p->ec) {
│ │ │ │ │ -                                // read_piece failed
│ │ │ │ │ -                                break;
│ │ │ │ │ -                        }
│ │ │ │ │ -                        // use p
│ │ │ │ │ -                        break;
│ │ │ │ │ -                }
│ │ │ │ │ -                case file_renamed_alert::alert_type:
│ │ │ │ │ -                {
│ │ │ │ │ -                        // etc...
│ │ │ │ │ -                }
│ │ │ │ │ -        }
│ │ │ │ │ -}
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** wwhhaatt(()) **********
│ │ │ │ │ -virtual char const* wwhhaatt () const noexcept = 0;
│ │ │ │ │ -returns a string literal describing the type of the _a_l_e_r_t. It does not include
│ │ │ │ │ -any information that might be bundled with the _a_l_e_r_t.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** mmeessssaaggee(()) **********
│ │ │ │ │ -virtual std::string mmeessssaaggee () const = 0;
│ │ │ │ │ -generate a string describing the _a_l_e_r_t and the information bundled with it.
│ │ │ │ │ -This is mainly intended for debug and development use. It is not suitable to
│ │ │ │ │ -use this for applications that may be localized. Instead, handle each _a_l_e_r_t
│ │ │ │ │ -type individually and extract and render the information from the _a_l_e_r_t
│ │ │ │ │ -depending on the locale.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccaatteeggoorryy(()) **********
│ │ │ │ │ -virtual alert_category_t ccaatteeggoorryy () const noexcept = 0;
│ │ │ │ │ -returns a bitmask specifying which categories this _a_l_e_r_t belong to.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ddhhtt__rroouuttiinngg__bbuucckkeett ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │  struct to hold information about a single DHT routing table bucket
│ │ │ │ │  struct dht_routing_bucket
│ │ │ │ │  {
│ │ │ │ │     int num_nodes;
│ │ │ │ │     int num_replacements;
│ │ │ │ │ @@ -400,25 +311,25 @@
│ │ │ │ │  ************ ffiillee__rreennaammeedd__aalleerrtt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │  This is posted as a response to a _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_r_e_n_a_m_e___f_i_l_e_(_) call, if the
│ │ │ │ │  rename operation succeeds.
│ │ │ │ │  struct file_renamed_alert final : torrent_alert
│ │ │ │ │  {
│ │ │ │ │     std::string mmeessssaaggee () const override;
│ │ │ │ │ -   char const* nneeww__nnaammee () const;
│ │ │ │ │     char const* oolldd__nnaammee () const;
│ │ │ │ │ +   char const* nneeww__nnaammee () const;
│ │ │ │ │  
│ │ │ │ │     static constexpr alert_category_t ssttaattiicc__ccaatteeggoorryy  = alert_category::
│ │ │ │ │  storage;
│ │ │ │ │     file_index_t const index;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** nneeww__nnaammee(()) oolldd__nnaammee(()) **********
│ │ │ │ │ -char const* nneeww__nnaammee () const;
│ │ │ │ │  char const* oolldd__nnaammee () const;
│ │ │ │ │ +char const* nneeww__nnaammee () const;
│ │ │ │ │  returns the new and previous file name, respectively.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    index
│ │ │ │ │        refers to the index of the file that was renamed,
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ffiillee__rreennaammee__ffaaiilleedd__aalleerrtt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │ @@ -2339,15 +2250,15 @@
│ │ │ │ │  dht_operation;
│ │ │ │ │     sha1_hash node_id;
│ │ │ │ │     aux::noexcept_movable<udp::endpoint> endpoint;
│ │ │ │ │     time_duration const interval;
│ │ │ │ │     int const num_infohashes;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ssaammpplleess(()) nnuumm__ssaammpplleess(()) **********
│ │ │ │ │ +********** nnuumm__ssaammpplleess(()) ssaammpplleess(()) **********
│ │ │ │ │  int nnuumm__ssaammpplleess () const;
│ │ │ │ │  std::vector<sha1_hash> ssaammpplleess () const;
│ │ │ │ │  returns the number of info-hashes returned by the node, as well as the actual
│ │ │ │ │  info-hashes. num_samples() is more efficient than samples().size().
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** nnuumm__nnooddeess(()) **********
│ │ │ │ │  int nnuumm__nnooddeess () const;
│ │ │ │ │ @@ -2394,17 +2305,17 @@
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │  this _a_l_e_r_t is posted to indicate to the client that some alerts were dropped.
│ │ │ │ │  Dropped meaning that the _a_l_e_r_t failed to be delivered to the client. The most
│ │ │ │ │  common cause of such failure is that the internal _a_l_e_r_t queue grew too big
│ │ │ │ │  (controlled by alert_queue_size).
│ │ │ │ │  struct alerts_dropped_alert final : alert
│ │ │ │ │  {
│ │ │ │ │ +   std::string mmeessssaaggee () const override;
│ │ │ │ │     ssttaattiicc__aasssseerrtt (num_alert_types <= abi_alert_count, "need to increase bitset.
│ │ │ │ │  This is an ABI break");
│ │ │ │ │ -   std::string mmeessssaaggee () const override;
│ │ │ │ │  
│ │ │ │ │     static constexpr alert_category_t ssttaattiicc__ccaatteeggoorryy  = alert_category::error;
│ │ │ │ │     std::bitset<abi_alert_count> dropped_alerts;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    dropped_alerts
│ │ │ │ │        a bitmask indicating which alerts were dropped. Each bit represents the
│ │ │ │ │ @@ -2572,18 +2483,107 @@
│ │ │ │ │     static constexpr alert_category_t ssttaattiicc__ccaatteeggoorryy  = alert_category::status;
│ │ │ │ │     std::vector<announce_entry> trackers;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    trackers
│ │ │ │ │        list of trackers and their status for the torrent
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ aalleerrtt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t_._h_p_p"
│ │ │ │ │ +The alert class is the base class that specific messages are derived from.
│ │ │ │ │ +_a_l_e_r_t types are not copyable, and cannot be constructed by the client. The
│ │ │ │ │ +pointers returned by libtorrent are short lived (the details are described
│ │ │ │ │ +under _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_p_o_p___a_l_e_r_t_s_(_))
│ │ │ │ │ +struct alert
│ │ │ │ │ +{
│ │ │ │ │ +   time_point ttiimmeessttaammpp () const;
│ │ │ │ │ +   virtual int ttyyppee () const noexcept = 0;
│ │ │ │ │ +   virtual char const* wwhhaatt () const noexcept = 0;
│ │ │ │ │ +   virtual std::string mmeessssaaggee () const = 0;
│ │ │ │ │ +   virtual alert_category_t ccaatteeggoorryy () const noexcept = 0;
│ │ │ │ │ +
│ │ │ │ │ +   static constexpr alert_category_t eerrrroorr__nnoottiiffiiccaattiioonn  = 0_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppeeeerr__nnoottiiffiiccaattiioonn  = 1_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppoorrtt__mmaappppiinngg__nnoottiiffiiccaattiioonn  = 2_bit;
│ │ │ │ │ +   static constexpr alert_category_t ssttoorraaggee__nnoottiiffiiccaattiioonn  = 3_bit;
│ │ │ │ │ +   static constexpr alert_category_t ttrraacckkeerr__nnoottiiffiiccaattiioonn  = 4_bit;
│ │ │ │ │ +   static constexpr alert_category_t ccoonnnneecctt__nnoottiiffiiccaattiioonn  = 5_bit;
│ │ │ │ │ +   static constexpr alert_category_t ssttaattuuss__nnoottiiffiiccaattiioonn  = 6_bit;
│ │ │ │ │ +   static constexpr alert_category_t iipp__bblloocckk__nnoottiiffiiccaattiioonn  = 8_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppeerrffoorrmmaannccee__wwaarrnniinngg  = 9_bit;
│ │ │ │ │ +   static constexpr alert_category_t ddhhtt__nnoottiiffiiccaattiioonn  = 10_bit;
│ │ │ │ │ +   static constexpr alert_category_t sseessssiioonn__lloogg__nnoottiiffiiccaattiioonn  = 13_bit;
│ │ │ │ │ +   static constexpr alert_category_t ttoorrrreenntt__lloogg__nnoottiiffiiccaattiioonn  = 14_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppeeeerr__lloogg__nnoottiiffiiccaattiioonn  = 15_bit;
│ │ │ │ │ +   static constexpr alert_category_t iinnccoommiinngg__rreeqquueesstt__nnoottiiffiiccaattiioonn  = 16_bit;
│ │ │ │ │ +   static constexpr alert_category_t ddhhtt__lloogg__nnoottiiffiiccaattiioonn  = 17_bit;
│ │ │ │ │ +   static constexpr alert_category_t ddhhtt__ooppeerraattiioonn__nnoottiiffiiccaattiioonn  = 18_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppoorrtt__mmaappppiinngg__lloogg__nnoottiiffiiccaattiioonn  = 19_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppiicckkeerr__lloogg__nnoottiiffiiccaattiioonn  = 20_bit;
│ │ │ │ │ +   static constexpr alert_category_t ffiillee__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 21_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppiieeccee__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 22_bit;
│ │ │ │ │ +   static constexpr alert_category_t uuppllooaadd__nnoottiiffiiccaattiioonn  = 23_bit;
│ │ │ │ │ +   static constexpr alert_category_t bblloocckk__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 24_bit;
│ │ │ │ │ +   static constexpr alert_category_t aallll__ccaatteeggoorriieess  = alert_category_t::all();
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ttiimmeessttaammpp(()) **********
│ │ │ │ │ +time_point ttiimmeessttaammpp () const;
│ │ │ │ │ +a timestamp is automatically created in the constructor
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ttyyppee(()) **********
│ │ │ │ │ +virtual int ttyyppee () const noexcept = 0;
│ │ │ │ │ +returns an integer that is unique to this _a_l_e_r_t type. It can be compared
│ │ │ │ │ +against a specific _a_l_e_r_t by querying a static constant called alert_type in the
│ │ │ │ │ +_a_l_e_r_t. It can be used to determine the run-time type of an alert* in order to
│ │ │ │ │ +cast to that _a_l_e_r_t type and access specific members.
│ │ │ │ │ +e.g:
│ │ │ │ │ +std::vector<alert*> alerts;
│ │ │ │ │ +ses.pop_alerts(&alerts);
│ │ │ │ │ +for (alert* a : alerts) {
│ │ │ │ │ +        switch (a->type()) {
│ │ │ │ │ +
│ │ │ │ │ +                case read_piece_alert::alert_type:
│ │ │ │ │ +                {
│ │ │ │ │ +                        auto* p = static_cast<read_piece_alert*>(a);
│ │ │ │ │ +                        if (p->ec) {
│ │ │ │ │ +                                // read_piece failed
│ │ │ │ │ +                                break;
│ │ │ │ │ +                        }
│ │ │ │ │ +                        // use p
│ │ │ │ │ +                        break;
│ │ │ │ │ +                }
│ │ │ │ │ +                case file_renamed_alert::alert_type:
│ │ │ │ │ +                {
│ │ │ │ │ +                        // etc...
│ │ │ │ │ +                }
│ │ │ │ │ +        }
│ │ │ │ │ +}
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** wwhhaatt(()) **********
│ │ │ │ │ +virtual char const* wwhhaatt () const noexcept = 0;
│ │ │ │ │ +returns a string literal describing the type of the _a_l_e_r_t. It does not include
│ │ │ │ │ +any information that might be bundled with the _a_l_e_r_t.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** mmeessssaaggee(()) **********
│ │ │ │ │ +virtual std::string mmeessssaaggee () const = 0;
│ │ │ │ │ +generate a string describing the _a_l_e_r_t and the information bundled with it.
│ │ │ │ │ +This is mainly intended for debug and development use. It is not suitable to
│ │ │ │ │ +use this for applications that may be localized. Instead, handle each _a_l_e_r_t
│ │ │ │ │ +type individually and extract and render the information from the _a_l_e_r_t
│ │ │ │ │ +depending on the locale.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ccaatteeggoorryy(()) **********
│ │ │ │ │ +virtual alert_category_t ccaatteeggoorryy () const noexcept = 0;
│ │ │ │ │ +returns a bitmask specifying which categories this _a_l_e_r_t belong to.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ aalleerrtt__ccaasstt(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t_._h_p_p"
│ │ │ │ │ -template <typename T> T const* aalleerrtt__ccaasstt (alert const* a);
│ │ │ │ │  template <typename T> T* aalleerrtt__ccaasstt (alert* a);
│ │ │ │ │ +template <typename T> T const* aalleerrtt__ccaasstt (alert const* a);
│ │ │ │ │  When you get an _a_l_e_r_t, you can use alert_cast<> to attempt to cast the pointer
│ │ │ │ │  to a specific _a_l_e_r_t type, in order to query it for more information.
│ │ │ │ │  Note
│ │ │ │ │  alert_cast<> can only cast to an exact _a_l_e_r_t type, not a base class
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ooppeerraattiioonn__nnaammee(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_o_p_e_r_a_t_i_o_n_s_._h_p_p"
│ │ │ │ │ @@ -2648,14 +2648,21 @@
│ │ │ │ │  |_e_n_u_m___r_o_u_t_e_ _ _ _ _ _ _ _ _ _|_4_2_ _ _ _|_e_n_u_m_e_r_a_t_i_o_n_ _o_f_ _n_e_t_w_o_r_k_ _r_o_u_t_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |file_seek          |43   |moving read/write position in a file, _o_p_e_r_a_t_i_o_n___t_:_:|
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_o_s_t_n_a_m_e___l_o_o_k_u_p_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_t_i_m_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_4_4_ _ _ _|_a_n_ _a_s_y_n_c_ _w_a_i_t_ _o_p_e_r_a_t_i_o_n_ _o_n_ _a_ _t_i_m_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_f_i_l_e___m_m_a_p_ _ _ _ _ _ _ _ _ _ _|_4_5_ _ _ _|_c_a_l_l_ _t_o_ _m_m_a_p_(_)_ _(_o_r_ _w_i_n_d_o_w_s_ _c_o_u_n_t_e_r_p_a_r_t_)_ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_f_i_l_e___t_r_u_n_c_a_t_e_ _ _ _ _ _ _|_4_6_ _ _ _|_c_a_l_l_ _t_o_ _f_t_r_u_n_c_a_t_e_(_)_ _(_o_r_ _S_e_t_E_n_d_O_f_F_i_l_e_(_)_ _o_n_ _w_i_n_d_o_w_s_)_ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ iinntt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │ +  user_alert_id
│ │ │ │ │ +      user defined alerts should use IDs greater than this
│ │ │ │ │ +  num_alert_types
│ │ │ │ │ +      this constant represents "max_alert_index" + 1
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ aalleerrtt__ccaatteeggoorryy__tt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t_._h_p_p"
│ │ │ │ │    error
│ │ │ │ │        Enables alerts that report an error. This includes:
│ │ │ │ │            * tracker errors
│ │ │ │ │            * tracker warnings
│ │ │ │ │            * file errors
│ │ │ │ │ @@ -2726,21 +2733,14 @@
│ │ │ │ │        rejected, time-out and cancelled. This is likely to post alerts at a high
│ │ │ │ │        rate.
│ │ │ │ │    all
│ │ │ │ │        The full bitmask, representing all available categories.
│ │ │ │ │        since the enum is signed, make sure this isn't interpreted as -1. For
│ │ │ │ │        instance, boost.python does that and fails when assigning it to an
│ │ │ │ │        unsigned parameter.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ iinntt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │ -  user_alert_id
│ │ │ │ │ -      user defined alerts should use IDs greater than this
│ │ │ │ │ -  num_alert_types
│ │ │ │ │ -      this constant represents "max_alert_index" + 1
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  _b_l_o_g
│ │ │ │ │  _u_T_P
│ │ │ │ │  _d_o_w_n_l_o_a_d
│ │ │ │ │  _d_o_c_u_m_e_n_t_a_t_i_o_n
│ │ │ │ │  _D_H_T_ _p_u_t_ _e_x_t_e_n_s_i_o_n
│ │ │ │ │  _p_y_t_h_o_n_ _b_i_n_d_i_n_g_s
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Bdecoding.html
│ │ │ │ @@ -35,18 +35,18 @@
│ │ │ │  <li><a class="reference internal" href="#bdecode-node" id="toc-entry-1">bdecode_node</a><ul>
│ │ │ │  <li><a class="reference internal" href="#bdecode-node-1" id="toc-entry-2">bdecode_node()</a></li>
│ │ │ │  <li><a class="reference internal" href="#bdecode-node-operator" id="toc-entry-3">bdecode_node() operator=()</a></li>
│ │ │ │  <li><a class="reference internal" href="#type" id="toc-entry-4">type()</a></li>
│ │ │ │  <li><a class="reference internal" href="#bool" id="toc-entry-5">bool()</a></li>
│ │ │ │  <li><a class="reference internal" href="#non-owning" id="toc-entry-6">non_owning()</a></li>
│ │ │ │  <li><a class="reference internal" href="#data-section-data-offset" id="toc-entry-7">data_section() data_offset()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#list-int-value-at-list-size-list-at-list-string-value-at" id="toc-entry-8">list_int_value_at() list_size() list_at() list_string_value_at()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dict-find-string-dict-at-dict-size-dict-find-dict-find-list-dict-find-dict-dict-at-node-dict-find-int-dict-find-string-value-dict-find-int-value" id="toc-entry-9">dict_find_string() dict_at() dict_size() dict_find() dict_find_list() dict_find_dict() dict_at_node() dict_find_int() dict_find_string_value() dict_find_int_value()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#list-at-list-string-value-at-list-size-list-int-value-at" id="toc-entry-8">list_at() list_string_value_at() list_size() list_int_value_at()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dict-at-node-dict-at-dict-find-dict-dict-find-int-dict-find-string-value-dict-find-list-dict-find-string-dict-find-int-value-dict-size-dict-find" id="toc-entry-9">dict_at_node() dict_at() dict_find_dict() dict_find_int() dict_find_string_value() dict_find_list() dict_find_string() dict_find_int_value() dict_size() dict_find()</a></li>
│ │ │ │  <li><a class="reference internal" href="#int-value" id="toc-entry-10">int_value()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#string-value-string-length-string-ptr-string-offset" id="toc-entry-11">string_value() string_length() string_ptr() string_offset()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#string-offset-string-length-string-ptr-string-value" id="toc-entry-11">string_offset() string_length() string_ptr() string_value()</a></li>
│ │ │ │  <li><a class="reference internal" href="#clear" id="toc-entry-12">clear()</a></li>
│ │ │ │  <li><a class="reference internal" href="#swap" id="toc-entry-13">swap()</a></li>
│ │ │ │  <li><a class="reference internal" href="#reserve" id="toc-entry-14">reserve()</a></li>
│ │ │ │  <li><a class="reference internal" href="#switch-underlying-buffer" id="toc-entry-15">switch_underlying_buffer()</a></li>
│ │ │ │  <li><a class="reference internal" href="#has-soft-error" id="toc-entry-16">has_soft_error()</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-type-t" id="toc-entry-17">enum type_t</a></li>
│ │ │ │  </ul>
│ │ │ │ @@ -62,46 +62,46 @@
│ │ │ │  to be able to copy it as a reference for instance). For that, use the
│ │ │ │  <a class="reference external" href="reference-Bdecoding.html#non_owning()">non_owning()</a> member function.</p>
│ │ │ │  <p>There are 5 different types of nodes, see <a class="reference external" href="reference-Bdecoding.html#type_t">type_t</a>.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct bdecode_node
│ │ │ │  {
│ │ │ │     <strong>bdecode_node</strong> () = default;
│ │ │ │ +   <strong>bdecode_node</strong> (bdecode_node const&amp;);
│ │ │ │     <strong>bdecode_node</strong> (bdecode_node&amp;&amp;) noexcept;
│ │ │ │ -   bdecode_node&amp; <strong>operator=</strong> (bdecode_node&amp;&amp;) &amp; = default;
│ │ │ │     bdecode_node&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │ -   <strong>bdecode_node</strong> (bdecode_node const&amp;);
│ │ │ │ +   bdecode_node&amp; <strong>operator=</strong> (bdecode_node&amp;&amp;) &amp; = default;
│ │ │ │     type_t <strong>type</strong> () const noexcept;
│ │ │ │     explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │     bdecode_node <strong>non_owning</strong> () const;
│ │ │ │     std::ptrdiff_t <strong>data_offset</strong> () const noexcept;
│ │ │ │     span&lt;char const&gt; <strong>data_section</strong> () const noexcept;
│ │ │ │ -   string_view <strong>list_string_value_at</strong> (int i
│ │ │ │ -      , string_view default_val = string_view()) const;
│ │ │ │     std::int64_t <strong>list_int_value_at</strong> (int i
│ │ │ │        , std::int64_t default_val = 0) const;
│ │ │ │ -   bdecode_node <strong>list_at</strong> (int i) const;
│ │ │ │     int <strong>list_size</strong> () const;
│ │ │ │ +   string_view <strong>list_string_value_at</strong> (int i
│ │ │ │ +      , string_view default_val = string_view()) const;
│ │ │ │ +   bdecode_node <strong>list_at</strong> (int i) const;
│ │ │ │ +   bdecode_node <strong>dict_find</strong> (string_view key) const;
│ │ │ │ +   std::pair&lt;string_view, bdecode_node&gt; <strong>dict_at</strong> (int i) const;
│ │ │ │     bdecode_node <strong>dict_find_dict</strong> (string_view key) const;
│ │ │ │ -   bdecode_node <strong>dict_find_list</strong> (string_view key) const;
│ │ │ │     string_view <strong>dict_find_string_value</strong> (string_view key
│ │ │ │        , string_view default_value = string_view()) const;
│ │ │ │ -   bdecode_node <strong>dict_find</strong> (string_view key) const;
│ │ │ │ -   std::pair&lt;bdecode_node, bdecode_node&gt; <strong>dict_at_node</strong> (int i) const;
│ │ │ │     bdecode_node <strong>dict_find_string</strong> (string_view key) const;
│ │ │ │ -   bdecode_node <strong>dict_find_int</strong> (string_view key) const;
│ │ │ │     std::int64_t <strong>dict_find_int_value</strong> (string_view key
│ │ │ │        , std::int64_t default_val = 0) const;
│ │ │ │ -   std::pair&lt;string_view, bdecode_node&gt; <strong>dict_at</strong> (int i) const;
│ │ │ │ +   bdecode_node <strong>dict_find_int</strong> (string_view key) const;
│ │ │ │     int <strong>dict_size</strong> () const;
│ │ │ │ +   bdecode_node <strong>dict_find_list</strong> (string_view key) const;
│ │ │ │ +   std::pair&lt;bdecode_node, bdecode_node&gt; <strong>dict_at_node</strong> (int i) const;
│ │ │ │     std::int64_t <strong>int_value</strong> () const;
│ │ │ │ -   char const* <strong>string_ptr</strong> () const;
│ │ │ │ -   std::ptrdiff_t <strong>string_offset</strong> () const;
│ │ │ │     int <strong>string_length</strong> () const;
│ │ │ │     string_view <strong>string_value</strong> () const;
│ │ │ │ +   char const* <strong>string_ptr</strong> () const;
│ │ │ │ +   std::ptrdiff_t <strong>string_offset</strong> () const;
│ │ │ │     void <strong>clear</strong> ();
│ │ │ │     void <strong>swap</strong> (bdecode_node&amp; n);
│ │ │ │     void <strong>reserve</strong> (int tokens);
│ │ │ │     void <strong>switch_underlying_buffer</strong> (char const* buf) noexcept;
│ │ │ │     bool <strong>has_soft_error</strong> (span&lt;char&gt; error) const;
│ │ │ │  
│ │ │ │     enum type_t
│ │ │ │ @@ -121,18 +121,18 @@
│ │ │ │  </pre>
│ │ │ │  <p>creates a default constructed node, it will have the type <tt class="docutils literal">none_t</tt>.</p>
│ │ │ │  <a name="bdecode_node()"></a>
│ │ │ │  <a name="operator=()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bbdecode_node%28%29+operator%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bbdecode_node%28%29+operator%3D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="bdecode-node-operator">
│ │ │ │  <h2>bdecode_node() operator=()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +<strong>bdecode_node</strong> (bdecode_node const&amp;);
│ │ │ │  <strong>bdecode_node</strong> (bdecode_node&amp;&amp;) noexcept;
│ │ │ │ -bdecode_node&amp; <strong>operator=</strong> (bdecode_node&amp;&amp;) &amp; = default;
│ │ │ │  bdecode_node&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │ -<strong>bdecode_node</strong> (bdecode_node const&amp;);
│ │ │ │ +bdecode_node&amp; <strong>operator=</strong> (bdecode_node&amp;&amp;) &amp; = default;
│ │ │ │  </pre>
│ │ │ │  <p>For owning nodes, the copy will create a copy of the tree, but the
│ │ │ │  underlying buffer remains the same.</p>
│ │ │ │  <a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="type">
│ │ │ │  <h2>type()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ @@ -164,57 +164,57 @@
│ │ │ │  </pre>
│ │ │ │  <p>returns the buffer and length of the section in the original bencoded
│ │ │ │  buffer where this node is defined. For a dictionary for instance, this
│ │ │ │  starts with <tt class="docutils literal">d</tt> and ends with <tt class="docutils literal">e</tt>, and has all the content of the
│ │ │ │  dictionary in between.
│ │ │ │  the <tt class="docutils literal">data_offset()</tt> function returns the byte-offset to this node in,
│ │ │ │  starting from the beginning of the buffer that was parsed.</p>
│ │ │ │ -<a name="list_int_value_at()"></a>
│ │ │ │ -<a name="list_size()"></a>
│ │ │ │  <a name="list_at()"></a>
│ │ │ │ -<a name="list_string_value_at()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Blist_int_value_at%28%29+list_size%28%29+list_at%28%29+list_string_value_at%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Blist_int_value_at%28%29+list_size%28%29+list_at%28%29+list_string_value_at%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="list-int-value-at-list-size-list-at-list-string-value-at">
│ │ │ │ -<h2>list_int_value_at() list_size() list_at() list_string_value_at()</h2>
│ │ │ │ +<a name="list_string_value_at()"></a>
│ │ │ │ +<a name="list_size()"></a>
│ │ │ │ +<a name="list_int_value_at()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Blist_at%28%29+list_string_value_at%28%29+list_size%28%29+list_int_value_at%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Blist_at%28%29+list_string_value_at%28%29+list_size%28%29+list_int_value_at%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="list-at-list-string-value-at-list-size-list-int-value-at">
│ │ │ │ +<h2>list_at() list_string_value_at() list_size() list_int_value_at()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -string_view <strong>list_string_value_at</strong> (int i
│ │ │ │ -      , string_view default_val = string_view()) const;
│ │ │ │  std::int64_t <strong>list_int_value_at</strong> (int i
│ │ │ │        , std::int64_t default_val = 0) const;
│ │ │ │ -bdecode_node <strong>list_at</strong> (int i) const;
│ │ │ │  int <strong>list_size</strong> () const;
│ │ │ │ +string_view <strong>list_string_value_at</strong> (int i
│ │ │ │ +      , string_view default_val = string_view()) const;
│ │ │ │ +bdecode_node <strong>list_at</strong> (int i) const;
│ │ │ │  </pre>
│ │ │ │  <p>functions with the <tt class="docutils literal">list_</tt> prefix operate on lists. These functions are
│ │ │ │  only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">list_t</tt>. <tt class="docutils literal">list_at()</tt> returns the item
│ │ │ │  in the list at index <tt class="docutils literal">i</tt>. <tt class="docutils literal">i</tt> may not be greater than or equal to the
│ │ │ │  size of the list. <tt class="docutils literal">size()</tt> returns the size of the list.</p>
│ │ │ │ -<a name="dict_find_string()"></a>
│ │ │ │ +<a name="dict_at_node()"></a>
│ │ │ │  <a name="dict_at()"></a>
│ │ │ │ -<a name="dict_size()"></a>
│ │ │ │ -<a name="dict_find()"></a>
│ │ │ │ -<a name="dict_find_list()"></a>
│ │ │ │  <a name="dict_find_dict()"></a>
│ │ │ │ -<a name="dict_at_node()"></a>
│ │ │ │  <a name="dict_find_int()"></a>
│ │ │ │  <a name="dict_find_string_value()"></a>
│ │ │ │ -<a name="dict_find_int_value()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bdict_find_string%28%29+dict_at%28%29+dict_size%28%29+dict_find%28%29+dict_find_list%28%29+dict_find_dict%28%29+dict_at_node%28%29+dict_find_int%28%29+dict_find_string_value%28%29+dict_find_int_value%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bdict_find_string%28%29+dict_at%28%29+dict_size%28%29+dict_find%28%29+dict_find_list%28%29+dict_find_dict%28%29+dict_at_node%28%29+dict_find_int%28%29+dict_find_string_value%28%29+dict_find_int_value%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dict-find-string-dict-at-dict-size-dict-find-dict-find-list-dict-find-dict-dict-at-node-dict-find-int-dict-find-string-value-dict-find-int-value">
│ │ │ │ -<h2>dict_find_string() dict_at() dict_size() dict_find() dict_find_list() dict_find_dict() dict_at_node() dict_find_int() dict_find_string_value() dict_find_int_value()</h2>
│ │ │ │ +<a name="dict_find_list()"></a>
│ │ │ │ +<a name="dict_find_string()"></a>
│ │ │ │ +<a name="dict_find_int_value()"></a>
│ │ │ │ +<a name="dict_size()"></a>
│ │ │ │ +<a name="dict_find()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bdict_at_node%28%29+dict_at%28%29+dict_find_dict%28%29+dict_find_int%28%29+dict_find_string_value%28%29+dict_find_list%28%29+dict_find_string%28%29+dict_find_int_value%28%29+dict_size%28%29+dict_find%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bdict_at_node%28%29+dict_at%28%29+dict_find_dict%28%29+dict_find_int%28%29+dict_find_string_value%28%29+dict_find_list%28%29+dict_find_string%28%29+dict_find_int_value%28%29+dict_size%28%29+dict_find%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dict-at-node-dict-at-dict-find-dict-dict-find-int-dict-find-string-value-dict-find-list-dict-find-string-dict-find-int-value-dict-size-dict-find">
│ │ │ │ +<h2>dict_at_node() dict_at() dict_find_dict() dict_find_int() dict_find_string_value() dict_find_list() dict_find_string() dict_find_int_value() dict_size() dict_find()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +bdecode_node <strong>dict_find</strong> (string_view key) const;
│ │ │ │ +std::pair&lt;string_view, bdecode_node&gt; <strong>dict_at</strong> (int i) const;
│ │ │ │  bdecode_node <strong>dict_find_dict</strong> (string_view key) const;
│ │ │ │ -bdecode_node <strong>dict_find_list</strong> (string_view key) const;
│ │ │ │  string_view <strong>dict_find_string_value</strong> (string_view key
│ │ │ │        , string_view default_value = string_view()) const;
│ │ │ │ -bdecode_node <strong>dict_find</strong> (string_view key) const;
│ │ │ │ -std::pair&lt;bdecode_node, bdecode_node&gt; <strong>dict_at_node</strong> (int i) const;
│ │ │ │  bdecode_node <strong>dict_find_string</strong> (string_view key) const;
│ │ │ │ -bdecode_node <strong>dict_find_int</strong> (string_view key) const;
│ │ │ │  std::int64_t <strong>dict_find_int_value</strong> (string_view key
│ │ │ │        , std::int64_t default_val = 0) const;
│ │ │ │ -std::pair&lt;string_view, bdecode_node&gt; <strong>dict_at</strong> (int i) const;
│ │ │ │ +bdecode_node <strong>dict_find_int</strong> (string_view key) const;
│ │ │ │  int <strong>dict_size</strong> () const;
│ │ │ │ +bdecode_node <strong>dict_find_list</strong> (string_view key) const;
│ │ │ │ +std::pair&lt;bdecode_node, bdecode_node&gt; <strong>dict_at_node</strong> (int i) const;
│ │ │ │  </pre>
│ │ │ │  <p>Functions with the <tt class="docutils literal">dict_</tt> prefix operates on dictionaries. They are
│ │ │ │  only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">dict_t</tt>. In case a key you're looking up
│ │ │ │  contains a 0 byte, you cannot use the 0-terminated string overloads,
│ │ │ │  but have to use <tt class="docutils literal">string_view</tt> instead. <tt class="docutils literal">dict_find_list</tt> will return a
│ │ │ │  valid <tt class="docutils literal">bdecode_node</tt> if the key is found _and_ it is a list. Otherwise
│ │ │ │  it will return a default-constructed <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>.</p>
│ │ │ │ @@ -229,25 +229,25 @@
│ │ │ │  <div class="section" id="int-value">
│ │ │ │  <h2>int_value()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::int64_t <strong>int_value</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>this function is only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">int_t</tt>. It returns the
│ │ │ │  value of the integer.</p>
│ │ │ │ -<a name="string_value()"></a>
│ │ │ │ +<a name="string_offset()"></a>
│ │ │ │  <a name="string_length()"></a>
│ │ │ │  <a name="string_ptr()"></a>
│ │ │ │ -<a name="string_offset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bstring_value%28%29+string_length%28%29+string_ptr%28%29+string_offset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bstring_value%28%29+string_length%28%29+string_ptr%28%29+string_offset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="string-value-string-length-string-ptr-string-offset">
│ │ │ │ -<h2>string_value() string_length() string_ptr() string_offset()</h2>
│ │ │ │ +<a name="string_value()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bstring_offset%28%29+string_length%28%29+string_ptr%28%29+string_value%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bstring_offset%28%29+string_length%28%29+string_ptr%28%29+string_value%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="string-offset-string-length-string-ptr-string-value">
│ │ │ │ +<h2>string_offset() string_length() string_ptr() string_value()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -char const* <strong>string_ptr</strong> () const;
│ │ │ │ -std::ptrdiff_t <strong>string_offset</strong> () const;
│ │ │ │  int <strong>string_length</strong> () const;
│ │ │ │  string_view <strong>string_value</strong> () const;
│ │ │ │ +char const* <strong>string_ptr</strong> () const;
│ │ │ │ +std::ptrdiff_t <strong>string_offset</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>these functions are only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">string_t</tt>. They return
│ │ │ │  the string values. Note that <tt class="docutils literal">string_ptr()</tt> is <em>not</em> 0-terminated.
│ │ │ │  <tt class="docutils literal">string_length()</tt> returns the number of bytes in the string.
│ │ │ │  <tt class="docutils literal">string_offset()</tt> returns the byte offset from the start of the parsed
│ │ │ │  bencoded buffer this string can be found.</p>
│ │ │ │  <a name="clear()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bclear%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bclear%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ @@ -345,22 +345,22 @@
│ │ │ │  <p>print the bencoded structure in a human-readable format to a string
│ │ │ │  that's returned.</p>
│ │ │ │  <a name="bdecode()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode%28%29&labels=documentation&body=Documentation+under+heading+%22bdecode%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="bdecode">
│ │ │ │  <h1>bdecode()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -int <strong>bdecode</strong> (char const* start, char const* end, bdecode_node&amp; ret
│ │ │ │ -   , error_code&amp; ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ -   , int token_limit = 2000000);
│ │ │ │  bdecode_node <strong>bdecode</strong> (span&lt;char const&gt; buffer
│ │ │ │     , error_code&amp; ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │     , int token_limit = 2000000);
│ │ │ │  bdecode_node <strong>bdecode</strong> (span&lt;char const&gt; buffer
│ │ │ │     , int depth_limit = 100, int token_limit = 2000000);
│ │ │ │ +int <strong>bdecode</strong> (char const* start, char const* end, bdecode_node&amp; ret
│ │ │ │ +   , error_code&amp; ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ +   , int token_limit = 2000000);
│ │ │ │  </pre>
│ │ │ │  <p>This function decodes/parses bdecoded data (for example a .torrent file).
│ │ │ │  The data structure is returned in the <tt class="docutils literal">ret</tt> argument. the buffer to parse
│ │ │ │  is specified by the <tt class="docutils literal">start</tt> of the buffer as well as the <tt class="docutils literal">end</tt>, i.e. one
│ │ │ │  byte past the end. If the buffer fails to parse, the function returns a
│ │ │ │  non-zero value and fills in <tt class="docutils literal">ec</tt> with the error code. The optional
│ │ │ │  argument <tt class="docutils literal">error_pos</tt>, if set to non-nullptr, will be set to the byte offset
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -6,20 +6,20 @@
│ │ │ │ │      * _b_d_e_c_o_d_e___n_o_d_e
│ │ │ │ │            o _b_d_e_c_o_d_e___n_o_d_e_(_)
│ │ │ │ │            o _b_d_e_c_o_d_e___n_o_d_e_(_)_ _o_p_e_r_a_t_o_r_=_(_)
│ │ │ │ │            o _t_y_p_e_(_)
│ │ │ │ │            o _b_o_o_l_(_)
│ │ │ │ │            o _n_o_n___o_w_n_i_n_g_(_)
│ │ │ │ │            o _d_a_t_a___s_e_c_t_i_o_n_(_)_ _d_a_t_a___o_f_f_s_e_t_(_)
│ │ │ │ │ -          o _l_i_s_t___i_n_t___v_a_l_u_e___a_t_(_)_ _l_i_s_t___s_i_z_e_(_)_ _l_i_s_t___a_t_(_)_ _l_i_s_t___s_t_r_i_n_g___v_a_l_u_e___a_t_(_)
│ │ │ │ │ -          o _d_i_c_t___f_i_n_d___s_t_r_i_n_g_(_)_ _d_i_c_t___a_t_(_)_ _d_i_c_t___s_i_z_e_(_)_ _d_i_c_t___f_i_n_d_(_)_ _d_i_c_t___f_i_n_d___l_i_s_t
│ │ │ │ │ -            _(_)_ _d_i_c_t___f_i_n_d___d_i_c_t_(_)_ _d_i_c_t___a_t___n_o_d_e_(_)_ _d_i_c_t___f_i_n_d___i_n_t_(_)
│ │ │ │ │ -            _d_i_c_t___f_i_n_d___s_t_r_i_n_g___v_a_l_u_e_(_)_ _d_i_c_t___f_i_n_d___i_n_t___v_a_l_u_e_(_)
│ │ │ │ │ +          o _l_i_s_t___a_t_(_)_ _l_i_s_t___s_t_r_i_n_g___v_a_l_u_e___a_t_(_)_ _l_i_s_t___s_i_z_e_(_)_ _l_i_s_t___i_n_t___v_a_l_u_e___a_t_(_)
│ │ │ │ │ +          o _d_i_c_t___a_t___n_o_d_e_(_)_ _d_i_c_t___a_t_(_)_ _d_i_c_t___f_i_n_d___d_i_c_t_(_)_ _d_i_c_t___f_i_n_d___i_n_t_(_)
│ │ │ │ │ +            _d_i_c_t___f_i_n_d___s_t_r_i_n_g___v_a_l_u_e_(_)_ _d_i_c_t___f_i_n_d___l_i_s_t_(_)_ _d_i_c_t___f_i_n_d___s_t_r_i_n_g_(_)
│ │ │ │ │ +            _d_i_c_t___f_i_n_d___i_n_t___v_a_l_u_e_(_)_ _d_i_c_t___s_i_z_e_(_)_ _d_i_c_t___f_i_n_d_(_)
│ │ │ │ │            o _i_n_t___v_a_l_u_e_(_)
│ │ │ │ │ -          o _s_t_r_i_n_g___v_a_l_u_e_(_)_ _s_t_r_i_n_g___l_e_n_g_t_h_(_)_ _s_t_r_i_n_g___p_t_r_(_)_ _s_t_r_i_n_g___o_f_f_s_e_t_(_)
│ │ │ │ │ +          o _s_t_r_i_n_g___o_f_f_s_e_t_(_)_ _s_t_r_i_n_g___l_e_n_g_t_h_(_)_ _s_t_r_i_n_g___p_t_r_(_)_ _s_t_r_i_n_g___v_a_l_u_e_(_)
│ │ │ │ │            o _c_l_e_a_r_(_)
│ │ │ │ │            o _s_w_a_p_(_)
│ │ │ │ │            o _r_e_s_e_r_v_e_(_)
│ │ │ │ │            o _s_w_i_t_c_h___u_n_d_e_r_l_y_i_n_g___b_u_f_f_e_r_(_)
│ │ │ │ │            o _h_a_s___s_o_f_t___e_r_r_o_r_(_)
│ │ │ │ │            o _e_n_u_m_ _t_y_p_e___t
│ │ │ │ │      * _p_r_i_n_t___e_n_t_r_y_(_)
│ │ │ │ │ @@ -30,46 +30,46 @@
│ │ │ │ │  Sometimes it's important to get a non-owning reference to the root node ( to be
│ │ │ │ │  able to copy it as a reference for instance). For that, use the _n_o_n___o_w_n_i_n_g_(_)
│ │ │ │ │  member function.
│ │ │ │ │  There are 5 different types of nodes, see _t_y_p_e___t.
│ │ │ │ │  struct bdecode_node
│ │ │ │ │  {
│ │ │ │ │     bbddeeccooddee__nnooddee () = default;
│ │ │ │ │ +   bbddeeccooddee__nnooddee (bdecode_node const&);
│ │ │ │ │     bbddeeccooddee__nnooddee (bdecode_node&&) noexcept;
│ │ │ │ │ -   bdecode_node& ooppeerraattoorr== (bdecode_node&&) & = default;
│ │ │ │ │     bdecode_node& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │ -   bbddeeccooddee__nnooddee (bdecode_node const&);
│ │ │ │ │ +   bdecode_node& ooppeerraattoorr== (bdecode_node&&) & = default;
│ │ │ │ │     type_t ttyyppee () const noexcept;
│ │ │ │ │     explicit operator bbooooll () const noexcept;
│ │ │ │ │     bdecode_node nnoonn__oowwnniinngg () const;
│ │ │ │ │     std::ptrdiff_t ddaattaa__ooffffsseett () const noexcept;
│ │ │ │ │     span<char const> ddaattaa__sseeccttiioonn () const noexcept;
│ │ │ │ │ -   string_view lliisstt__ssttrriinngg__vvaalluuee__aatt (int i
│ │ │ │ │ -      , string_view default_val = string_view()) const;
│ │ │ │ │     std::int64_t lliisstt__iinntt__vvaalluuee__aatt (int i
│ │ │ │ │        , std::int64_t default_val = 0) const;
│ │ │ │ │ -   bdecode_node lliisstt__aatt (int i) const;
│ │ │ │ │     int lliisstt__ssiizzee () const;
│ │ │ │ │ +   string_view lliisstt__ssttrriinngg__vvaalluuee__aatt (int i
│ │ │ │ │ +      , string_view default_val = string_view()) const;
│ │ │ │ │ +   bdecode_node lliisstt__aatt (int i) const;
│ │ │ │ │ +   bdecode_node ddiicctt__ffiinndd (string_view key) const;
│ │ │ │ │ +   std::pair<string_view, bdecode_node> ddiicctt__aatt (int i) const;
│ │ │ │ │     bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const;
│ │ │ │ │ -   bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const;
│ │ │ │ │     string_view ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee (string_view key
│ │ │ │ │        , string_view default_value = string_view()) const;
│ │ │ │ │ -   bdecode_node ddiicctt__ffiinndd (string_view key) const;
│ │ │ │ │ -   std::pair<bdecode_node, bdecode_node> ddiicctt__aatt__nnooddee (int i) const;
│ │ │ │ │     bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const;
│ │ │ │ │ -   bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const;
│ │ │ │ │     std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key
│ │ │ │ │        , std::int64_t default_val = 0) const;
│ │ │ │ │ -   std::pair<string_view, bdecode_node> ddiicctt__aatt (int i) const;
│ │ │ │ │ +   bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const;
│ │ │ │ │     int ddiicctt__ssiizzee () const;
│ │ │ │ │ +   bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const;
│ │ │ │ │ +   std::pair<bdecode_node, bdecode_node> ddiicctt__aatt__nnooddee (int i) const;
│ │ │ │ │     std::int64_t iinntt__vvaalluuee () const;
│ │ │ │ │ -   char const* ssttrriinngg__ppttrr () const;
│ │ │ │ │ -   std::ptrdiff_t ssttrriinngg__ooffffsseett () const;
│ │ │ │ │     int ssttrriinngg__lleennggtthh () const;
│ │ │ │ │     string_view ssttrriinngg__vvaalluuee () const;
│ │ │ │ │ +   char const* ssttrriinngg__ppttrr () const;
│ │ │ │ │ +   std::ptrdiff_t ssttrriinngg__ooffffsseett () const;
│ │ │ │ │     void cclleeaarr ();
│ │ │ │ │     void sswwaapp (bdecode_node& n);
│ │ │ │ │     void rreesseerrvvee (int tokens);
│ │ │ │ │     void sswwiittcchh__uunnddeerrllyyiinngg__bbuuffffeerr (char const* buf) noexcept;
│ │ │ │ │     bool hhaass__ssoofftt__eerrrroorr (span<char> error) const;
│ │ │ │ │  
│ │ │ │ │     enum type_t
│ │ │ │ │ @@ -83,18 +83,18 @@
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** bbddeeccooddee__nnooddee(()) **********
│ │ │ │ │  bbddeeccooddee__nnooddee () = default;
│ │ │ │ │  creates a default constructed node, it will have the type none_t.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** bbddeeccooddee__nnooddee(()) ooppeerraattoorr==(()) **********
│ │ │ │ │ +bbddeeccooddee__nnooddee (bdecode_node const&);
│ │ │ │ │  bbddeeccooddee__nnooddee (bdecode_node&&) noexcept;
│ │ │ │ │ -bdecode_node& ooppeerraattoorr== (bdecode_node&&) & = default;
│ │ │ │ │  bdecode_node& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │ -bbddeeccooddee__nnooddee (bdecode_node const&);
│ │ │ │ │ +bdecode_node& ooppeerraattoorr== (bdecode_node&&) & = default;
│ │ │ │ │  For owning nodes, the copy will create a copy of the tree, but the underlying
│ │ │ │ │  buffer remains the same.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ttyyppee(()) **********
│ │ │ │ │  type_t ttyyppee () const noexcept;
│ │ │ │ │  the type of this node. See _t_y_p_e___t.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ @@ -112,41 +112,41 @@
│ │ │ │ │  span<char const> ddaattaa__sseeccttiioonn () const noexcept;
│ │ │ │ │  returns the buffer and length of the section in the original bencoded buffer
│ │ │ │ │  where this node is defined. For a dictionary for instance, this starts with d
│ │ │ │ │  and ends with e, and has all the content of the dictionary in between. the
│ │ │ │ │  data_offset() function returns the byte-offset to this node in, starting from
│ │ │ │ │  the beginning of the buffer that was parsed.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** lliisstt__iinntt__vvaalluuee__aatt(()) lliisstt__ssiizzee(()) lliisstt__aatt(()) lliisstt__ssttrriinngg__vvaalluuee__aatt(()) **********
│ │ │ │ │ -string_view lliisstt__ssttrriinngg__vvaalluuee__aatt (int i
│ │ │ │ │ -      , string_view default_val = string_view()) const;
│ │ │ │ │ +********** lliisstt__aatt(()) lliisstt__ssttrriinngg__vvaalluuee__aatt(()) lliisstt__ssiizzee(()) lliisstt__iinntt__vvaalluuee__aatt(()) **********
│ │ │ │ │  std::int64_t lliisstt__iinntt__vvaalluuee__aatt (int i
│ │ │ │ │        , std::int64_t default_val = 0) const;
│ │ │ │ │ -bdecode_node lliisstt__aatt (int i) const;
│ │ │ │ │  int lliisstt__ssiizzee () const;
│ │ │ │ │ +string_view lliisstt__ssttrriinngg__vvaalluuee__aatt (int i
│ │ │ │ │ +      , string_view default_val = string_view()) const;
│ │ │ │ │ +bdecode_node lliisstt__aatt (int i) const;
│ │ │ │ │  functions with the list_ prefix operate on lists. These functions are only
│ │ │ │ │  valid if type() == list_t. list_at() returns the item in the list at index i. i
│ │ │ │ │  may not be greater than or equal to the size of the list. size() returns the
│ │ │ │ │  size of the list.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddiicctt__ffiinndd__ssttrriinngg(()) ddiicctt__aatt(()) ddiicctt__ssiizzee(()) ddiicctt__ffiinndd(()) ddiicctt__ffiinndd__lliisstt(())
│ │ │ │ │ -ddiicctt__ffiinndd__ddiicctt(()) ddiicctt__aatt__nnooddee(()) ddiicctt__ffiinndd__iinntt(()) ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee(())
│ │ │ │ │ -ddiicctt__ffiinndd__iinntt__vvaalluuee(()) **********
│ │ │ │ │ +********** ddiicctt__aatt__nnooddee(()) ddiicctt__aatt(()) ddiicctt__ffiinndd__ddiicctt(()) ddiicctt__ffiinndd__iinntt(())
│ │ │ │ │ +ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee(()) ddiicctt__ffiinndd__lliisstt(()) ddiicctt__ffiinndd__ssttrriinngg(())
│ │ │ │ │ +ddiicctt__ffiinndd__iinntt__vvaalluuee(()) ddiicctt__ssiizzee(()) ddiicctt__ffiinndd(()) **********
│ │ │ │ │ +bdecode_node ddiicctt__ffiinndd (string_view key) const;
│ │ │ │ │ +std::pair<string_view, bdecode_node> ddiicctt__aatt (int i) const;
│ │ │ │ │  bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const;
│ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const;
│ │ │ │ │  string_view ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee (string_view key
│ │ │ │ │        , string_view default_value = string_view()) const;
│ │ │ │ │ -bdecode_node ddiicctt__ffiinndd (string_view key) const;
│ │ │ │ │ -std::pair<bdecode_node, bdecode_node> ddiicctt__aatt__nnooddee (int i) const;
│ │ │ │ │  bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const;
│ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const;
│ │ │ │ │  std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key
│ │ │ │ │        , std::int64_t default_val = 0) const;
│ │ │ │ │ -std::pair<string_view, bdecode_node> ddiicctt__aatt (int i) const;
│ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const;
│ │ │ │ │  int ddiicctt__ssiizzee () const;
│ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const;
│ │ │ │ │ +std::pair<bdecode_node, bdecode_node> ddiicctt__aatt__nnooddee (int i) const;
│ │ │ │ │  Functions with the dict_ prefix operates on dictionaries. They are only valid
│ │ │ │ │  if type() == dict_t. In case a key you're looking up contains a 0 byte, you
│ │ │ │ │  cannot use the 0-terminated string overloads, but have to use string_view
│ │ │ │ │  instead. dict_find_list will return a valid bdecode_node if the key is found
│ │ │ │ │  _and_ it is a list. Otherwise it will return a default-constructed
│ │ │ │ │  _b_d_e_c_o_d_e___n_o_d_e.
│ │ │ │ │  Functions with the _value suffix return the value of the node directly, rather
│ │ │ │ │ @@ -158,19 +158,19 @@
│ │ │ │ │  string).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** iinntt__vvaalluuee(()) **********
│ │ │ │ │  std::int64_t iinntt__vvaalluuee () const;
│ │ │ │ │  this function is only valid if type() == int_t. It returns the value of the
│ │ │ │ │  integer.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ssttrriinngg__vvaalluuee(()) ssttrriinngg__lleennggtthh(()) ssttrriinngg__ppttrr(()) ssttrriinngg__ooffffsseett(()) **********
│ │ │ │ │ -char const* ssttrriinngg__ppttrr () const;
│ │ │ │ │ -std::ptrdiff_t ssttrriinngg__ooffffsseett () const;
│ │ │ │ │ +********** ssttrriinngg__ooffffsseett(()) ssttrriinngg__lleennggtthh(()) ssttrriinngg__ppttrr(()) ssttrriinngg__vvaalluuee(()) **********
│ │ │ │ │  int ssttrriinngg__lleennggtthh () const;
│ │ │ │ │  string_view ssttrriinngg__vvaalluuee () const;
│ │ │ │ │ +char const* ssttrriinngg__ppttrr () const;
│ │ │ │ │ +std::ptrdiff_t ssttrriinngg__ooffffsseett () const;
│ │ │ │ │  these functions are only valid if type() == string_t. They return the string
│ │ │ │ │  values. Note that string_ptr() is nnoott 0-terminated. string_length() returns the
│ │ │ │ │  number of bytes in the string. string_offset() returns the byte offset from the
│ │ │ │ │  start of the parsed bencoded buffer this string can be found.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** cclleeaarr(()) **********
│ │ │ │ │  void cclleeaarr ();
│ │ │ │ │ @@ -214,22 +214,22 @@
│ │ │ │ │  std::string pprriinntt__eennttrryy (bdecode_node const& e
│ │ │ │ │     , bool single_line = false, int indent = 0);
│ │ │ │ │  print the bencoded structure in a human-readable format to a string that's
│ │ │ │ │  returned.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ bbddeeccooddee(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ -int bbddeeccooddee (char const* start, char const* end, bdecode_node& ret
│ │ │ │ │ -   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ │ -   , int token_limit = 2000000);
│ │ │ │ │  bdecode_node bbddeeccooddee (span<char const> buffer
│ │ │ │ │     , error_code& ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ │     , int token_limit = 2000000);
│ │ │ │ │  bdecode_node bbddeeccooddee (span<char const> buffer
│ │ │ │ │     , int depth_limit = 100, int token_limit = 2000000);
│ │ │ │ │ +int bbddeeccooddee (char const* start, char const* end, bdecode_node& ret
│ │ │ │ │ +   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ │ +   , int token_limit = 2000000);
│ │ │ │ │  This function decodes/parses bdecoded data (for example a .torrent file). The
│ │ │ │ │  data structure is returned in the ret argument. the buffer to parse is
│ │ │ │ │  specified by the start of the buffer as well as the end, i.e. one byte past the
│ │ │ │ │  end. If the buffer fails to parse, the function returns a non-zero value and
│ │ │ │ │  fills in ec with the error code. The optional argument error_pos, if set to
│ │ │ │ │  non-nullptr, will be set to the byte offset into the buffer where the parse
│ │ │ │ │  failure occurred.
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Bencoding.html
│ │ │ │ @@ -34,15 +34,15 @@
│ │ │ │  <ul class="simple">
│ │ │ │  <li><a class="reference internal" href="#entry" id="toc-entry-1">entry</a><ul>
│ │ │ │  <li><a class="reference internal" href="#type" id="toc-entry-2">type()</a></li>
│ │ │ │  <li><a class="reference internal" href="#entry-1" id="toc-entry-3">entry()</a></li>
│ │ │ │  <li><a class="reference internal" href="#entry-2" id="toc-entry-4">entry()</a></li>
│ │ │ │  <li><a class="reference internal" href="#entry-3" id="toc-entry-5">entry()</a></li>
│ │ │ │  <li><a class="reference internal" href="#operator" id="toc-entry-6">operator=()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dict-integer-preformatted-string-list" id="toc-entry-7">dict() integer() preformatted() string() list()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#preformatted-dict-integer-list-string" id="toc-entry-7">preformatted() dict() integer() list() string()</a></li>
│ │ │ │  <li><a class="reference internal" href="#swap" id="toc-entry-8">swap()</a></li>
│ │ │ │  <li><a class="reference internal" href="#operator-1" id="toc-entry-9">operator[]()</a></li>
│ │ │ │  <li><a class="reference internal" href="#find-key" id="toc-entry-10">find_key()</a></li>
│ │ │ │  <li><a class="reference internal" href="#to-string" id="toc-entry-11">to_string()</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-data-type" id="toc-entry-12">enum data_type</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ @@ -71,39 +71,39 @@
│ │ │ │  or a string.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  class entry
│ │ │ │  {
│ │ │ │     data_type <strong>type</strong> () const;
│ │ │ │     <strong>entry</strong> (integer_type);
│ │ │ │     <strong>entry</strong> (preformatted_type);
│ │ │ │ -   <strong>entry</strong> (list_type);
│ │ │ │     <strong>entry</strong> (span&lt;char const&gt;);
│ │ │ │     <strong>entry</strong> (dictionary_type);
│ │ │ │ +   <strong>entry</strong> (list_type);
│ │ │ │     <strong>entry</strong> (U v);
│ │ │ │     <strong>entry</strong> (data_type t);
│ │ │ │     <strong>entry</strong> (bdecode_node const&amp; n);
│ │ │ │ -   entry&amp; <strong>operator=</strong> (span&lt;char const&gt;) &amp;;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (list_type) &amp;;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (entry const&amp;) &amp;;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (dictionary_type) &amp;;
│ │ │ │     entry&amp; <strong>operator=</strong> (preformatted_type) &amp;;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (span&lt;char const&gt;) &amp;;
│ │ │ │     entry&amp; <strong>operator=</strong> (integer_type) &amp;;
│ │ │ │     entry&amp; <strong>operator=</strong> (entry&amp;&amp;) &amp; noexcept;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (list_type) &amp;;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (dictionary_type) &amp;;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (entry const&amp;) &amp;;
│ │ │ │     entry&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │     entry&amp; <strong>operator=</strong> (U v) &amp;;
│ │ │ │ -   list_type const&amp; <strong>list</strong> () const;
│ │ │ │ -   dictionary_type const&amp; <strong>dict</strong> () const;
│ │ │ │     integer_type const&amp; <strong>integer</strong> () const;
│ │ │ │ -   list_type&amp; <strong>list</strong> ();
│ │ │ │ +   dictionary_type&amp; <strong>dict</strong> ();
│ │ │ │     string_type&amp; <strong>string</strong> ();
│ │ │ │ -   string_type const&amp; <strong>string</strong> () const;
│ │ │ │ +   list_type const&amp; <strong>list</strong> () const;
│ │ │ │ +   integer_type&amp; <strong>integer</strong> ();
│ │ │ │     preformatted_type&amp; <strong>preformatted</strong> ();
│ │ │ │ +   list_type&amp; <strong>list</strong> ();
│ │ │ │ +   dictionary_type const&amp; <strong>dict</strong> () const;
│ │ │ │     preformatted_type const&amp; <strong>preformatted</strong> () const;
│ │ │ │ -   dictionary_type&amp; <strong>dict</strong> ();
│ │ │ │ -   integer_type&amp; <strong>integer</strong> ();
│ │ │ │ +   string_type const&amp; <strong>string</strong> () const;
│ │ │ │     void <strong>swap</strong> (entry&amp; e);
│ │ │ │     entry const&amp; <strong>operator[]</strong> (string_view key) const;
│ │ │ │     entry&amp; <strong>operator[]</strong> (string_view key);
│ │ │ │     entry const* <strong>find_key</strong> (string_view key) const;
│ │ │ │     entry* <strong>find_key</strong> (string_view key);
│ │ │ │     std::string <strong>to_string</strong> (bool single_line = false) const;
│ │ │ │  
│ │ │ │ @@ -126,17 +126,17 @@
│ │ │ │  <p>returns the concrete type of the <a class="reference external" href="reference-Bencoding.html#entry">entry</a></p>
│ │ │ │  <a name="entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bentry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bentry%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="entry-1">
│ │ │ │  <h2>entry()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  <strong>entry</strong> (integer_type);
│ │ │ │  <strong>entry</strong> (preformatted_type);
│ │ │ │ -<strong>entry</strong> (list_type);
│ │ │ │  <strong>entry</strong> (span&lt;char const&gt;);
│ │ │ │  <strong>entry</strong> (dictionary_type);
│ │ │ │ +<strong>entry</strong> (list_type);
│ │ │ │  </pre>
│ │ │ │  <p>constructors directly from a specific type.
│ │ │ │  The content of the argument is copied into the
│ │ │ │  newly constructed <a class="reference external" href="reference-Bencoding.html#entry">entry</a></p>
│ │ │ │  <a name="entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bentry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bentry%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="entry-2">
│ │ │ │  <h2>entry()</h2>
│ │ │ │ @@ -152,43 +152,43 @@
│ │ │ │  <strong>entry</strong> (bdecode_node const&amp; n);
│ │ │ │  </pre>
│ │ │ │  <p>construct from <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> parsed form (see <a class="reference external" href="reference-Bdecoding.html#bdecode()">bdecode()</a>)</p>
│ │ │ │  <a name="operator=()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Boperator%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Boperator%3D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="operator">
│ │ │ │  <h2>operator=()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -entry&amp; <strong>operator=</strong> (span&lt;char const&gt;) &amp;;
│ │ │ │ -entry&amp; <strong>operator=</strong> (list_type) &amp;;
│ │ │ │ -entry&amp; <strong>operator=</strong> (entry const&amp;) &amp;;
│ │ │ │ -entry&amp; <strong>operator=</strong> (dictionary_type) &amp;;
│ │ │ │  entry&amp; <strong>operator=</strong> (preformatted_type) &amp;;
│ │ │ │ +entry&amp; <strong>operator=</strong> (span&lt;char const&gt;) &amp;;
│ │ │ │  entry&amp; <strong>operator=</strong> (integer_type) &amp;;
│ │ │ │  entry&amp; <strong>operator=</strong> (entry&amp;&amp;) &amp; noexcept;
│ │ │ │ +entry&amp; <strong>operator=</strong> (list_type) &amp;;
│ │ │ │ +entry&amp; <strong>operator=</strong> (dictionary_type) &amp;;
│ │ │ │ +entry&amp; <strong>operator=</strong> (entry const&amp;) &amp;;
│ │ │ │  entry&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │  </pre>
│ │ │ │  <p>copies the structure of the right hand side into this
│ │ │ │  <a class="reference external" href="reference-Bencoding.html#entry">entry</a>.</p>
│ │ │ │ +<a name="preformatted()"></a>
│ │ │ │  <a name="dict()"></a>
│ │ │ │  <a name="integer()"></a>
│ │ │ │ -<a name="preformatted()"></a>
│ │ │ │ -<a name="string()"></a>
│ │ │ │ -<a name="list()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bdict%28%29+integer%28%29+preformatted%28%29+string%28%29+list%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bdict%28%29+integer%28%29+preformatted%28%29+string%28%29+list%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dict-integer-preformatted-string-list">
│ │ │ │ -<h2>dict() integer() preformatted() string() list()</h2>
│ │ │ │ +<a name="list()"></a>
│ │ │ │ +<a name="string()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bpreformatted%28%29+dict%28%29+integer%28%29+list%28%29+string%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bpreformatted%28%29+dict%28%29+integer%28%29+list%28%29+string%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="preformatted-dict-integer-list-string">
│ │ │ │ +<h2>preformatted() dict() integer() list() string()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -list_type const&amp; <strong>list</strong> () const;
│ │ │ │ -dictionary_type const&amp; <strong>dict</strong> () const;
│ │ │ │  integer_type const&amp; <strong>integer</strong> () const;
│ │ │ │ -list_type&amp; <strong>list</strong> ();
│ │ │ │ +dictionary_type&amp; <strong>dict</strong> ();
│ │ │ │  string_type&amp; <strong>string</strong> ();
│ │ │ │ -string_type const&amp; <strong>string</strong> () const;
│ │ │ │ +list_type const&amp; <strong>list</strong> () const;
│ │ │ │ +integer_type&amp; <strong>integer</strong> ();
│ │ │ │  preformatted_type&amp; <strong>preformatted</strong> ();
│ │ │ │ +list_type&amp; <strong>list</strong> ();
│ │ │ │ +dictionary_type const&amp; <strong>dict</strong> () const;
│ │ │ │  preformatted_type const&amp; <strong>preformatted</strong> () const;
│ │ │ │ -dictionary_type&amp; <strong>dict</strong> ();
│ │ │ │ -integer_type&amp; <strong>integer</strong> ();
│ │ │ │ +string_type const&amp; <strong>string</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>The <tt class="docutils literal">integer()</tt>, <tt class="docutils literal">string()</tt>, <tt class="docutils literal">list()</tt> and <tt class="docutils literal">dict()</tt> functions
│ │ │ │  are accessors that return the respective type. If the <tt class="docutils literal">entry</tt> object
│ │ │ │  isn't of the type you request, the accessor will throw
│ │ │ │  system_error. You can ask an <tt class="docutils literal">entry</tt> for its type through the
│ │ │ │  <tt class="docutils literal">type()</tt> function.</p>
│ │ │ │  <p>If you want to create an <tt class="docutils literal">entry</tt> you give it the type you want it to
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -5,15 +5,15 @@
│ │ │ │ │  Table of contents
│ │ │ │ │      * _e_n_t_r_y
│ │ │ │ │            o _t_y_p_e_(_)
│ │ │ │ │            o _e_n_t_r_y_(_)
│ │ │ │ │            o _e_n_t_r_y_(_)
│ │ │ │ │            o _e_n_t_r_y_(_)
│ │ │ │ │            o _o_p_e_r_a_t_o_r_=_(_)
│ │ │ │ │ -          o _d_i_c_t_(_)_ _i_n_t_e_g_e_r_(_)_ _p_r_e_f_o_r_m_a_t_t_e_d_(_)_ _s_t_r_i_n_g_(_)_ _l_i_s_t_(_)
│ │ │ │ │ +          o _p_r_e_f_o_r_m_a_t_t_e_d_(_)_ _d_i_c_t_(_)_ _i_n_t_e_g_e_r_(_)_ _l_i_s_t_(_)_ _s_t_r_i_n_g_(_)
│ │ │ │ │            o _s_w_a_p_(_)
│ │ │ │ │            o _o_p_e_r_a_t_o_r_[_]_(_)
│ │ │ │ │            o _f_i_n_d___k_e_y_(_)
│ │ │ │ │            o _t_o___s_t_r_i_n_g_(_)
│ │ │ │ │            o _e_n_u_m_ _d_a_t_a___t_y_p_e
│ │ │ │ │      * _b_e_n_c_o_d_e_(_)
│ │ │ │ │      * _o_p_e_r_a_t_o_r_<_<_(_)
│ │ │ │ │ @@ -37,39 +37,39 @@
│ │ │ │ │  variant type, it can be either a list, a dictionary (std::map), an integer or a
│ │ │ │ │  string.
│ │ │ │ │  class entry
│ │ │ │ │  {
│ │ │ │ │     data_type ttyyppee () const;
│ │ │ │ │     eennttrryy (integer_type);
│ │ │ │ │     eennttrryy (preformatted_type);
│ │ │ │ │ -   eennttrryy (list_type);
│ │ │ │ │     eennttrryy (span<char const>);
│ │ │ │ │     eennttrryy (dictionary_type);
│ │ │ │ │ +   eennttrryy (list_type);
│ │ │ │ │     eennttrryy (U v);
│ │ │ │ │     eennttrryy (data_type t);
│ │ │ │ │     eennttrryy (bdecode_node const& n);
│ │ │ │ │ -   entry& ooppeerraattoorr== (span<char const>) &;
│ │ │ │ │ -   entry& ooppeerraattoorr== (list_type) &;
│ │ │ │ │ -   entry& ooppeerraattoorr== (entry const&) &;
│ │ │ │ │ -   entry& ooppeerraattoorr== (dictionary_type) &;
│ │ │ │ │     entry& ooppeerraattoorr== (preformatted_type) &;
│ │ │ │ │ +   entry& ooppeerraattoorr== (span<char const>) &;
│ │ │ │ │     entry& ooppeerraattoorr== (integer_type) &;
│ │ │ │ │     entry& ooppeerraattoorr== (entry&&) & noexcept;
│ │ │ │ │ +   entry& ooppeerraattoorr== (list_type) &;
│ │ │ │ │ +   entry& ooppeerraattoorr== (dictionary_type) &;
│ │ │ │ │ +   entry& ooppeerraattoorr== (entry const&) &;
│ │ │ │ │     entry& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │     entry& ooppeerraattoorr== (U v) &;
│ │ │ │ │ -   list_type const& lliisstt () const;
│ │ │ │ │ -   dictionary_type const& ddiicctt () const;
│ │ │ │ │     integer_type const& iinntteeggeerr () const;
│ │ │ │ │ -   list_type& lliisstt ();
│ │ │ │ │ +   dictionary_type& ddiicctt ();
│ │ │ │ │     string_type& ssttrriinngg ();
│ │ │ │ │ -   string_type const& ssttrriinngg () const;
│ │ │ │ │ +   list_type const& lliisstt () const;
│ │ │ │ │ +   integer_type& iinntteeggeerr ();
│ │ │ │ │     preformatted_type& pprreeffoorrmmaatttteedd ();
│ │ │ │ │ +   list_type& lliisstt ();
│ │ │ │ │ +   dictionary_type const& ddiicctt () const;
│ │ │ │ │     preformatted_type const& pprreeffoorrmmaatttteedd () const;
│ │ │ │ │ -   dictionary_type& ddiicctt ();
│ │ │ │ │ -   integer_type& iinntteeggeerr ();
│ │ │ │ │ +   string_type const& ssttrriinngg () const;
│ │ │ │ │     void sswwaapp (entry& e);
│ │ │ │ │     entry const& ooppeerraattoorr[[]] (string_view key) const;
│ │ │ │ │     entry& ooppeerraattoorr[[]] (string_view key);
│ │ │ │ │     entry const* ffiinndd__kkeeyy (string_view key) const;
│ │ │ │ │     entry* ffiinndd__kkeeyy (string_view key);
│ │ │ │ │     std::string ttoo__ssttrriinngg (bool single_line = false) const;
│ │ │ │ │  
│ │ │ │ │ @@ -87,50 +87,50 @@
│ │ │ │ │  ********** ttyyppee(()) **********
│ │ │ │ │  data_type ttyyppee () const;
│ │ │ │ │  returns the concrete type of the _e_n_t_r_y
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** eennttrryy(()) **********
│ │ │ │ │  eennttrryy (integer_type);
│ │ │ │ │  eennttrryy (preformatted_type);
│ │ │ │ │ -eennttrryy (list_type);
│ │ │ │ │  eennttrryy (span<char const>);
│ │ │ │ │  eennttrryy (dictionary_type);
│ │ │ │ │ +eennttrryy (list_type);
│ │ │ │ │  constructors directly from a specific type. The content of the argument is
│ │ │ │ │  copied into the newly constructed _e_n_t_r_y
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** eennttrryy(()) **********
│ │ │ │ │  eennttrryy (data_type t);
│ │ │ │ │  construct an empty _e_n_t_r_y of the specified type. see _d_a_t_a___t_y_p_e enum.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** eennttrryy(()) **********
│ │ │ │ │  eennttrryy (bdecode_node const& n);
│ │ │ │ │  construct from _b_d_e_c_o_d_e___n_o_d_e parsed form (see _b_d_e_c_o_d_e_(_))
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ooppeerraattoorr==(()) **********
│ │ │ │ │ -entry& ooppeerraattoorr== (span<char const>) &;
│ │ │ │ │ -entry& ooppeerraattoorr== (list_type) &;
│ │ │ │ │ -entry& ooppeerraattoorr== (entry const&) &;
│ │ │ │ │ -entry& ooppeerraattoorr== (dictionary_type) &;
│ │ │ │ │  entry& ooppeerraattoorr== (preformatted_type) &;
│ │ │ │ │ +entry& ooppeerraattoorr== (span<char const>) &;
│ │ │ │ │  entry& ooppeerraattoorr== (integer_type) &;
│ │ │ │ │  entry& ooppeerraattoorr== (entry&&) & noexcept;
│ │ │ │ │ +entry& ooppeerraattoorr== (list_type) &;
│ │ │ │ │ +entry& ooppeerraattoorr== (dictionary_type) &;
│ │ │ │ │ +entry& ooppeerraattoorr== (entry const&) &;
│ │ │ │ │  entry& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │  copies the structure of the right hand side into this _e_n_t_r_y.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddiicctt(()) iinntteeggeerr(()) pprreeffoorrmmaatttteedd(()) ssttrriinngg(()) lliisstt(()) **********
│ │ │ │ │ -list_type const& lliisstt () const;
│ │ │ │ │ -dictionary_type const& ddiicctt () const;
│ │ │ │ │ +********** pprreeffoorrmmaatttteedd(()) ddiicctt(()) iinntteeggeerr(()) lliisstt(()) ssttrriinngg(()) **********
│ │ │ │ │  integer_type const& iinntteeggeerr () const;
│ │ │ │ │ -list_type& lliisstt ();
│ │ │ │ │ +dictionary_type& ddiicctt ();
│ │ │ │ │  string_type& ssttrriinngg ();
│ │ │ │ │ -string_type const& ssttrriinngg () const;
│ │ │ │ │ +list_type const& lliisstt () const;
│ │ │ │ │ +integer_type& iinntteeggeerr ();
│ │ │ │ │  preformatted_type& pprreeffoorrmmaatttteedd ();
│ │ │ │ │ +list_type& lliisstt ();
│ │ │ │ │ +dictionary_type const& ddiicctt () const;
│ │ │ │ │  preformatted_type const& pprreeffoorrmmaatttteedd () const;
│ │ │ │ │ -dictionary_type& ddiicctt ();
│ │ │ │ │ -integer_type& iinntteeggeerr ();
│ │ │ │ │ +string_type const& ssttrriinngg () const;
│ │ │ │ │  The integer(), string(), list() and dict() functions are accessors that return
│ │ │ │ │  the respective type. If the entry object isn't of the type you request, the
│ │ │ │ │  accessor will throw system_error. You can ask an entry for its type through the
│ │ │ │ │  type() function.
│ │ │ │ │  If you want to create an entry you give it the type you want it to have in its
│ │ │ │ │  constructor, and then use one of the non-const accessors to get a reference
│ │ │ │ │  which you then can assign the value you want it to have.
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Core.html
│ │ │ │ @@ -28,52 +28,88 @@
│ │ │ │  <td>2.0.11</td></tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │ -<li><a class="reference internal" href="#piece-block" id="toc-entry-1">piece_block</a></li>
│ │ │ │ -<li><a class="reference internal" href="#info-hash-t" id="toc-entry-2">info_hash_t</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#info-hash-t-1" id="toc-entry-3">info_hash_t()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#has-v2-has-has-v1" id="toc-entry-4">has_v2() has() has_v1()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get" id="toc-entry-5">get()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-best" id="toc-entry-6">get_best()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#for-each" id="toc-entry-7">for_each()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-request" id="toc-entry-1">peer_request</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#operator" id="toc-entry-2">operator==()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-info" id="toc-entry-8">peer_info</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#i2p-destination" id="toc-entry-9">i2p_destination()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-block" id="toc-entry-3">piece_block</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-info" id="toc-entry-4">peer_info</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#i2p-destination" id="toc-entry-5">i2p_destination()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-request" id="toc-entry-10">peer_request</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#operator" id="toc-entry-11">operator==()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#info-hash-t" id="toc-entry-6">info_hash_t</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#info-hash-t-1" id="toc-entry-7">info_hash_t()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#has-has-v2-has-v1" id="toc-entry-8">has() has_v2() has_v1()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get" id="toc-entry-9">get()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-best" id="toc-entry-10">get_best()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#for-each" id="toc-entry-11">for_each()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-peer-equal" id="toc-entry-12">torrent_peer_equal()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#make-magnet-uri" id="toc-entry-13">make_magnet_uri()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#parse-magnet-uri" id="toc-entry-14">parse_magnet_uri()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#truncate-files" id="toc-entry-15">truncate_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#version" id="toc-entry-16">version()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#load-torrent-parsed-load-torrent-buffer-load-torrent-file" id="toc-entry-17">load_torrent_parsed() load_torrent_buffer() load_torrent_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-protocol-version" id="toc-entry-18">enum protocol_version</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-socket-type-t" id="toc-entry-19">enum socket_type_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-portmap-transport" id="toc-entry-20">enum portmap_transport</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-portmap-protocol" id="toc-entry-21">enum portmap_protocol</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-event-t" id="toc-entry-22">enum event_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#load-torrent-file-load-torrent-parsed-load-torrent-buffer" id="toc-entry-12">load_torrent_file() load_torrent_parsed() load_torrent_buffer()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#truncate-files" id="toc-entry-13">truncate_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#make-magnet-uri" id="toc-entry-14">make_magnet_uri()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#parse-magnet-uri" id="toc-entry-15">parse_magnet_uri()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-peer-equal" id="toc-entry-16">torrent_peer_equal()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#version" id="toc-entry-17">version()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-event-t" id="toc-entry-18">enum event_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-portmap-transport" id="toc-entry-19">enum portmap_transport</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-portmap-protocol" id="toc-entry-20">enum portmap_protocol</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-protocol-version" id="toc-entry-21">enum protocol_version</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-socket-type-t" id="toc-entry-22">enum socket_type_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-connection-type" id="toc-entry-23">enum connection_type</a></li>
│ │ │ │  <li><a class="reference internal" href="#torrent-flags-t" id="toc-entry-24">torrent_flags_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#pex-flags-t" id="toc-entry-25">pex_flags_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#download-priority-t" id="toc-entry-26">download_priority_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#int" id="toc-entry-27">int</a></li>
│ │ │ │ -<li><a class="reference internal" href="#char-const" id="toc-entry-28">char const*</a></li>
│ │ │ │ -<li><a class="reference internal" href="#std-uint64-t" id="toc-entry-29">std::uint64_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#int" id="toc-entry-25">int</a></li>
│ │ │ │ +<li><a class="reference internal" href="#pex-flags-t" id="toc-entry-26">pex_flags_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#char-const" id="toc-entry-27">char const*</a></li>
│ │ │ │ +<li><a class="reference internal" href="#std-uint64-t" id="toc-entry-28">std::uint64_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#download-priority-t" id="toc-entry-29">download_priority_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │ -<a name="piece_block"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_block&labels=documentation&body=Documentation+under+heading+%22class+piece_block%22+could+be+improved">report issue</a>]</span><div class="section" id="piece-block">
│ │ │ │ +<a name="peer_request"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_request&labels=documentation&body=Documentation+under+heading+%22class+peer_request%22+could+be+improved">report issue</a>]</span><div class="section" id="peer-request">
│ │ │ │ +<h1>peer_request</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_request.hpp">libtorrent/peer_request.hpp</a>&quot;</p>
│ │ │ │ +<p>represents a byte range within a piece. Internally this is is used for
│ │ │ │ +incoming piece requests.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_request
│ │ │ │ +{
│ │ │ │ +   bool <strong>operator==</strong> (peer_request const&amp; r) const;
│ │ │ │ +
│ │ │ │ +   piece_index_t piece;
│ │ │ │ +   int start;
│ │ │ │ +   int length;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="operator==()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Boperator%3D%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Boperator%3D%3D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator">
│ │ │ │ +<h2>operator==()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>operator==</strong> (peer_request const&amp; r) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if the right hand side <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> refers to the same
│ │ │ │ +range as this does.</p>
│ │ │ │ +<a name="piece"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Bpiece%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Bpiece%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>piece</dt>
│ │ │ │ +<dd>The index of the piece in which the range starts.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="start"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Bstart%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Bstart%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>start</dt>
│ │ │ │ +<dd>The byte offset within that piece where the range starts.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="length"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Blength%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Blength%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>length</dt>
│ │ │ │ +<dd>The size of the range, in bytes.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="piece_block"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_block&labels=documentation&body=Documentation+under+heading+%22class+piece_block%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="piece-block">
│ │ │ │  <h1>piece_block</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/piece_block.hpp">libtorrent/piece_block.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct piece_block
│ │ │ │  {
│ │ │ │     <strong>piece_block</strong> () = default;
│ │ │ │     <strong>piece_block</strong> (piece_index_t p_index, int b_index);
│ │ │ │ @@ -82,100 +118,15 @@
│ │ │ │     bool <strong>operator!=</strong> (piece_block const&amp; b) const;
│ │ │ │  
│ │ │ │     static const piece_block invalid;
│ │ │ │     piece_index_t piece_index {0};
│ │ │ │     int <strong>block_index</strong>  = 0;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="info_hash_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+info_hash_t&labels=documentation&body=Documentation+under+heading+%22class+info_hash_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="info-hash-t">
│ │ │ │ -<h1>info_hash_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/info_hash.hpp">libtorrent/info_hash.hpp</a>&quot;</p>
│ │ │ │ -<p>class holding the info-hash of a torrent. It can hold a v1 info-hash
│ │ │ │ -(SHA-1) or a v2 info-hash (SHA-256) or both.</p>
│ │ │ │ -<div class="admonition note">
│ │ │ │ -<p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">If <tt class="docutils literal">has_v2()</tt> is false then the v1 hash might actually be a truncated
│ │ │ │ -v2 hash</p>
│ │ │ │ -</div>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct info_hash_t
│ │ │ │ -{
│ │ │ │ -   <strong>info_hash_t</strong> () noexcept = default;
│ │ │ │ -   <strong>info_hash_t</strong> (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ -   explicit <strong>info_hash_t</strong> (sha256_hash h2) noexcept;
│ │ │ │ -   explicit <strong>info_hash_t</strong> (sha1_hash h1) noexcept;
│ │ │ │ -   bool <strong>has_v2</strong> () const;
│ │ │ │ -   bool <strong>has</strong> (protocol_version v) const;
│ │ │ │ -   bool <strong>has_v1</strong> () const;
│ │ │ │ -   sha1_hash <strong>get</strong> (protocol_version v) const;
│ │ │ │ -   sha1_hash <strong>get_best</strong> () const;
│ │ │ │ -   friend bool <strong>operator!=</strong> (info_hash_t const&amp; lhs, info_hash_t const&amp; rhs);
│ │ │ │ -   friend bool <strong>operator==</strong> (info_hash_t const&amp; lhs, info_hash_t const&amp; rhs) noexcept;
│ │ │ │ -   template &lt;typename F&gt; void <strong>for_each</strong> (F f) const;
│ │ │ │ -   bool <strong>operator&lt;</strong> (info_hash_t const&amp; o) const;
│ │ │ │ -   friend std::ostream&amp; <strong>operator&lt;&lt;</strong> (std::ostream&amp; os, info_hash_t const&amp; ih);
│ │ │ │ -
│ │ │ │ -   sha1_hash v1;
│ │ │ │ -   sha256_hash v2;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="info_hash_t()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Binfo_hash_t%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Binfo_hash_t%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="info-hash-t-1">
│ │ │ │ -<h2>info_hash_t()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>info_hash_t</strong> () noexcept = default;
│ │ │ │ -<strong>info_hash_t</strong> (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ -explicit <strong>info_hash_t</strong> (sha256_hash h2) noexcept;
│ │ │ │ -explicit <strong>info_hash_t</strong> (sha1_hash h1) noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>The default constructor creates an object that has neither a v1 or v2
│ │ │ │ -hash.</p>
│ │ │ │ -<p>For backwards compatibility, make it possible to construct directly
│ │ │ │ -from a v1 hash. This constructor allows <em>implicit</em> conversion from a
│ │ │ │ -v1 hash, but the implicitness is deprecated.</p>
│ │ │ │ -<a name="has_v2()"></a>
│ │ │ │ -<a name="has()"></a>
│ │ │ │ -<a name="has_v1()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bhas_v2%28%29+has%28%29+has_v1%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bhas_v2%28%29+has%28%29+has_v1%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="has-v2-has-has-v1">
│ │ │ │ -<h2>has_v2() has() has_v1()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>has_v2</strong> () const;
│ │ │ │ -bool <strong>has</strong> (protocol_version v) const;
│ │ │ │ -bool <strong>has_v1</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if the corresponding info hash is present in this
│ │ │ │ -object.</p>
│ │ │ │ -<a name="get()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bget%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bget%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get">
│ │ │ │ -<h2>get()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -sha1_hash <strong>get</strong> (protocol_version v) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the has for the specified protocol version</p>
│ │ │ │ -<a name="get_best()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bget_best%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bget_best%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-best">
│ │ │ │ -<h2>get_best()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -sha1_hash <strong>get_best</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the v2 (truncated) info-hash, if there is one, otherwise
│ │ │ │ -returns the v1 info-hash</p>
│ │ │ │ -<a name="for_each()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bfor_each%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bfor_each%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="for-each">
│ │ │ │ -<h2>for_each()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -template &lt;typename F&gt; void <strong>for_each</strong> (F f) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>calls the function object <tt class="docutils literal">f</tt> for each hash that is available.
│ │ │ │ -starting with v1. The signature of <tt class="docutils literal">F</tt> is:</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void(sha1_hash const&amp;, protocol_version);
│ │ │ │ -</pre>
│ │ │ │  <a name="peer_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_info&labels=documentation&body=Documentation+under+heading+%22class+peer_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │  <div class="section" id="peer-info">
│ │ │ │  <h1>peer_info</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_info.hpp">libtorrent/peer_info.hpp</a>&quot;</p>
│ │ │ │  <p>holds information and statistics about one peer
│ │ │ │  that libtorrent is connected to</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct peer_info
│ │ │ │ @@ -653,66 +604,150 @@
│ │ │ │  <a name="write_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bread_state+write_state%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bread_state+write_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>read_state write_state</dt>
│ │ │ │  <dd>bitmasks indicating what state this peer
│ │ │ │  is in with regards to sending and receiving data. The states are
│ │ │ │  defined as independent flags of type bandwidth_state_flags_t, in this
│ │ │ │  class.</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="peer_request"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_request&labels=documentation&body=Documentation+under+heading+%22class+peer_request%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<a name="info_hash_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+info_hash_t&labels=documentation&body=Documentation+under+heading+%22class+info_hash_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="info-hash-t">
│ │ │ │ +<h1>info_hash_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/info_hash.hpp">libtorrent/info_hash.hpp</a>&quot;</p>
│ │ │ │ +<p>class holding the info-hash of a torrent. It can hold a v1 info-hash
│ │ │ │ +(SHA-1) or a v2 info-hash (SHA-256) or both.</p>
│ │ │ │ +<div class="admonition note">
│ │ │ │ +<p class="first admonition-title">Note</p>
│ │ │ │ +<p class="last">If <tt class="docutils literal">has_v2()</tt> is false then the v1 hash might actually be a truncated
│ │ │ │ +v2 hash</p>
│ │ │ │  </div>
│ │ │ │ -<div class="section" id="peer-request">
│ │ │ │ -<h1>peer_request</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_request.hpp">libtorrent/peer_request.hpp</a>&quot;</p>
│ │ │ │ -<p>represents a byte range within a piece. Internally this is is used for
│ │ │ │ -incoming piece requests.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct peer_request
│ │ │ │ +struct info_hash_t
│ │ │ │  {
│ │ │ │ -   bool <strong>operator==</strong> (peer_request const&amp; r) const;
│ │ │ │ +   explicit <strong>info_hash_t</strong> (sha256_hash h2) noexcept;
│ │ │ │ +   <strong>info_hash_t</strong> () noexcept = default;
│ │ │ │ +   explicit <strong>info_hash_t</strong> (sha1_hash h1) noexcept;
│ │ │ │ +   <strong>info_hash_t</strong> (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ +   bool <strong>has_v2</strong> () const;
│ │ │ │ +   bool <strong>has</strong> (protocol_version v) const;
│ │ │ │ +   bool <strong>has_v1</strong> () const;
│ │ │ │ +   sha1_hash <strong>get</strong> (protocol_version v) const;
│ │ │ │ +   sha1_hash <strong>get_best</strong> () const;
│ │ │ │ +   friend bool <strong>operator!=</strong> (info_hash_t const&amp; lhs, info_hash_t const&amp; rhs);
│ │ │ │ +   friend bool <strong>operator==</strong> (info_hash_t const&amp; lhs, info_hash_t const&amp; rhs) noexcept;
│ │ │ │ +   template &lt;typename F&gt; void <strong>for_each</strong> (F f) const;
│ │ │ │ +   bool <strong>operator&lt;</strong> (info_hash_t const&amp; o) const;
│ │ │ │ +   friend std::ostream&amp; <strong>operator&lt;&lt;</strong> (std::ostream&amp; os, info_hash_t const&amp; ih);
│ │ │ │  
│ │ │ │ -   piece_index_t piece;
│ │ │ │ -   int start;
│ │ │ │ -   int length;
│ │ │ │ +   sha1_hash v1;
│ │ │ │ +   sha256_hash v2;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="operator==()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Boperator%3D%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Boperator%3D%3D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator">
│ │ │ │ -<h2>operator==()</h2>
│ │ │ │ +<a name="info_hash_t()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Binfo_hash_t%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Binfo_hash_t%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="info-hash-t-1">
│ │ │ │ +<h2>info_hash_t()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>operator==</strong> (peer_request const&amp; r) const;
│ │ │ │ +explicit <strong>info_hash_t</strong> (sha256_hash h2) noexcept;
│ │ │ │ +<strong>info_hash_t</strong> () noexcept = default;
│ │ │ │ +explicit <strong>info_hash_t</strong> (sha1_hash h1) noexcept;
│ │ │ │ +<strong>info_hash_t</strong> (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │  </pre>
│ │ │ │ -<p>returns true if the right hand side <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> refers to the same
│ │ │ │ -range as this does.</p>
│ │ │ │ -<a name="piece"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Bpiece%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Bpiece%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>piece</dt>
│ │ │ │ -<dd>The index of the piece in which the range starts.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="start"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Bstart%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Bstart%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>start</dt>
│ │ │ │ -<dd>The byte offset within that piece where the range starts.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="length"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Blength%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Blength%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>length</dt>
│ │ │ │ -<dd>The size of the range, in bytes.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_peer_equal()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_peer_equal%28%29&labels=documentation&body=Documentation+under+heading+%22torrent_peer_equal%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<p>The default constructor creates an object that has neither a v1 or v2
│ │ │ │ +hash.</p>
│ │ │ │ +<p>For backwards compatibility, make it possible to construct directly
│ │ │ │ +from a v1 hash. This constructor allows <em>implicit</em> conversion from a
│ │ │ │ +v1 hash, but the implicitness is deprecated.</p>
│ │ │ │ +<a name="has()"></a>
│ │ │ │ +<a name="has_v2()"></a>
│ │ │ │ +<a name="has_v1()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bhas%28%29+has_v2%28%29+has_v1%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bhas%28%29+has_v2%28%29+has_v1%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="has-has-v2-has-v1">
│ │ │ │ +<h2>has() has_v2() has_v1()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>has_v2</strong> () const;
│ │ │ │ +bool <strong>has</strong> (protocol_version v) const;
│ │ │ │ +bool <strong>has_v1</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if the corresponding info hash is present in this
│ │ │ │ +object.</p>
│ │ │ │ +<a name="get()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bget%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bget%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get">
│ │ │ │ +<h2>get()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +sha1_hash <strong>get</strong> (protocol_version v) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the has for the specified protocol version</p>
│ │ │ │ +<a name="get_best()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bget_best%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bget_best%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-best">
│ │ │ │ +<h2>get_best()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +sha1_hash <strong>get_best</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the v2 (truncated) info-hash, if there is one, otherwise
│ │ │ │ +returns the v1 info-hash</p>
│ │ │ │ +<a name="for_each()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bfor_each%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bfor_each%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="for-each">
│ │ │ │ +<h2>for_each()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +template &lt;typename F&gt; void <strong>for_each</strong> (F f) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>calls the function object <tt class="docutils literal">f</tt> for each hash that is available.
│ │ │ │ +starting with v1. The signature of <tt class="docutils literal">F</tt> is:</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void(sha1_hash const&amp;, protocol_version);
│ │ │ │ +</pre>
│ │ │ │ +<a name="load_torrent_file()"></a>
│ │ │ │ +<a name="load_torrent_parsed()"></a>
│ │ │ │ +<a name="load_torrent_buffer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_file%28%29+load_torrent_parsed%28%29+load_torrent_buffer%28%29&labels=documentation&body=Documentation+under+heading+%22load_torrent_file%28%29+load_torrent_parsed%28%29+load_torrent_buffer%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │ -<div class="section" id="torrent-peer-equal">
│ │ │ │ -<h1>torrent_peer_equal()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_peer.hpp">libtorrent/torrent_peer.hpp</a>&quot;</p>
│ │ │ │ +<div class="section" id="load-torrent-file-load-torrent-parsed-load-torrent-buffer">
│ │ │ │ +<h1>load_torrent_file() load_torrent_parsed() load_torrent_buffer()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/load_torrent.hpp">libtorrent/load_torrent.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -inline bool <strong>torrent_peer_equal</strong> (torrent_peer const* lhs, torrent_peer const* rhs);
│ │ │ │ +add_torrent_params <strong>load_torrent_buffer</strong> (
│ │ │ │ +   span&lt;char const&gt; buffer);
│ │ │ │ +add_torrent_params <strong>load_torrent_file</strong> (
│ │ │ │ +   std::string const&amp; filename);
│ │ │ │ +add_torrent_params <strong>load_torrent_file</strong> (
│ │ │ │ +   std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ +add_torrent_params <strong>load_torrent_parsed</strong> (
│ │ │ │ +   bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg);
│ │ │ │ +add_torrent_params <strong>load_torrent_parsed</strong> (
│ │ │ │ +   bdecode_node const&amp; torrent_file);
│ │ │ │ +add_torrent_params <strong>load_torrent_buffer</strong> (
│ │ │ │ +   span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg);
│ │ │ │ +</pre>
│ │ │ │ +<p>These functions load the content of a .torrent file into an
│ │ │ │ +<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object.
│ │ │ │ +The immutable part of a torrent file (the info-dictionary) is stored in
│ │ │ │ +the <tt class="docutils literal">ti</tt> field in the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object (as a <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>
│ │ │ │ +object).
│ │ │ │ +The returned object is suitable to be:</p>
│ │ │ │ +<blockquote>
│ │ │ │ +<ul class="simple">
│ │ │ │ +<li>added to a <a class="reference external" href="reference-Session.html#session">session</a> via <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> or <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a></li>
│ │ │ │ +<li>saved as a .torrent_file via <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a></li>
│ │ │ │ +<li>turned into a magnet link via <a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a></li>
│ │ │ │ +</ul>
│ │ │ │ +</blockquote>
│ │ │ │ +<a name="truncate_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:truncate_files%28%29&labels=documentation&body=Documentation+under+heading+%22truncate_files%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="truncate-files">
│ │ │ │ +<h1>truncate_files()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/truncate.hpp">libtorrent/truncate.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>truncate_files</strong> (file_storage const&amp; fs, std::string const&amp; save_path, storage_error&amp; ec);
│ │ │ │  </pre>
│ │ │ │ +<p>Truncates files larger than specified in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>, saved under
│ │ │ │ +the specified save_path.</p>
│ │ │ │  <a name="make_magnet_uri()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:make_magnet_uri%28%29&labels=documentation&body=Documentation+under+heading+%22make_magnet_uri%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="make-magnet-uri">
│ │ │ │  <h1>make_magnet_uri()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/magnet_uri.hpp">libtorrent/magnet_uri.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::string <strong>make_magnet_uri</strong> (add_torrent_params const&amp; atp);
│ │ │ │  std::string <strong>make_magnet_uri</strong> (torrent_info const&amp; info);
│ │ │ │  std::string <strong>make_magnet_uri</strong> (torrent_handle const&amp; handle);
│ │ │ │ +std::string <strong>make_magnet_uri</strong> (add_torrent_params const&amp; atp);
│ │ │ │  </pre>
│ │ │ │  <p>Generates a magnet URI from the specified torrent.</p>
│ │ │ │  <p>Several fields from the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> objects are recorded in the
│ │ │ │  magnet link. In order to not include them, they have to be cleared before
│ │ │ │  calling <a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a>. These fields are used:</p>
│ │ │ │  <blockquote>
│ │ │ │  <tt class="docutils literal">ti</tt>, <tt class="docutils literal">info_hashes</tt>, <tt class="docutils literal">url_seeds</tt>, <tt class="docutils literal">dht_nodes</tt>,
│ │ │ │ @@ -733,157 +768,75 @@
│ │ │ │  <p>For more information about magnet links, see <a class="reference external" href="manual-ref.html#magnet-links">magnet links</a>.</p>
│ │ │ │  <a name="parse_magnet_uri()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:parse_magnet_uri%28%29&labels=documentation&body=Documentation+under+heading+%22parse_magnet_uri%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="parse-magnet-uri">
│ │ │ │  <h1>parse_magnet_uri()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/magnet_uri.hpp">libtorrent/magnet_uri.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  add_torrent_params <strong>parse_magnet_uri</strong> (string_view uri, error_code&amp; ec);
│ │ │ │ -void <strong>parse_magnet_uri</strong> (string_view uri, add_torrent_params&amp; p, error_code&amp; ec);
│ │ │ │  add_torrent_params <strong>parse_magnet_uri</strong> (string_view uri);
│ │ │ │ +void <strong>parse_magnet_uri</strong> (string_view uri, add_torrent_params&amp; p, error_code&amp; ec);
│ │ │ │  </pre>
│ │ │ │  <p>This function parses out information from the magnet link and populates the
│ │ │ │  <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object. The overload that does not take an
│ │ │ │  <tt class="docutils literal">error_code</tt> reference will throw a system_error on error
│ │ │ │  The overload taking an <tt class="docutils literal">add_torrent_params</tt> reference will fill in the
│ │ │ │  fields specified in the magnet URI.</p>
│ │ │ │ -<a name="truncate_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:truncate_files%28%29&labels=documentation&body=Documentation+under+heading+%22truncate_files%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="truncate-files">
│ │ │ │ -<h1>truncate_files()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/truncate.hpp">libtorrent/truncate.hpp</a>&quot;</p>
│ │ │ │ +<a name="torrent_peer_equal()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_peer_equal%28%29&labels=documentation&body=Documentation+under+heading+%22torrent_peer_equal%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-peer-equal">
│ │ │ │ +<h1>torrent_peer_equal()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_peer.hpp">libtorrent/torrent_peer.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>truncate_files</strong> (file_storage const&amp; fs, std::string const&amp; save_path, storage_error&amp; ec);
│ │ │ │ +inline bool <strong>torrent_peer_equal</strong> (torrent_peer const* lhs, torrent_peer const* rhs);
│ │ │ │  </pre>
│ │ │ │ -<p>Truncates files larger than specified in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>, saved under
│ │ │ │ -the specified save_path.</p>
│ │ │ │  <a name="version()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:version%28%29&labels=documentation&body=Documentation+under+heading+%22version%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="version">
│ │ │ │  <h1>version()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  char const* <strong>version</strong> ();
│ │ │ │  </pre>
│ │ │ │  <p>returns the libtorrent version as string form in this format:
│ │ │ │  &quot;&lt;major&gt;.&lt;minor&gt;.&lt;tiny&gt;.&lt;tag&gt;&quot;</p>
│ │ │ │ -<a name="load_torrent_parsed()"></a>
│ │ │ │ -<a name="load_torrent_buffer()"></a>
│ │ │ │ -<a name="load_torrent_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_parsed%28%29+load_torrent_buffer%28%29+load_torrent_file%28%29&labels=documentation&body=Documentation+under+heading+%22load_torrent_parsed%28%29+load_torrent_buffer%28%29+load_torrent_file%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="load-torrent-parsed-load-torrent-buffer-load-torrent-file">
│ │ │ │ -<h1>load_torrent_parsed() load_torrent_buffer() load_torrent_file()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/load_torrent.hpp">libtorrent/load_torrent.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -add_torrent_params <strong>load_torrent_file</strong> (
│ │ │ │ -   std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ -add_torrent_params <strong>load_torrent_buffer</strong> (
│ │ │ │ -   span&lt;char const&gt; buffer);
│ │ │ │ -add_torrent_params <strong>load_torrent_parsed</strong> (
│ │ │ │ -   bdecode_node const&amp; torrent_file);
│ │ │ │ -add_torrent_params <strong>load_torrent_file</strong> (
│ │ │ │ -   std::string const&amp; filename);
│ │ │ │ -add_torrent_params <strong>load_torrent_parsed</strong> (
│ │ │ │ -   bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg);
│ │ │ │ -add_torrent_params <strong>load_torrent_buffer</strong> (
│ │ │ │ -   span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg);
│ │ │ │ -</pre>
│ │ │ │ -<p>These functions load the content of a .torrent file into an
│ │ │ │ -<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object.
│ │ │ │ -The immutable part of a torrent file (the info-dictionary) is stored in
│ │ │ │ -the <tt class="docutils literal">ti</tt> field in the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object (as a <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>
│ │ │ │ -object).
│ │ │ │ -The returned object is suitable to be:</p>
│ │ │ │ -<blockquote>
│ │ │ │ -<ul class="simple">
│ │ │ │ -<li>added to a <a class="reference external" href="reference-Session.html#session">session</a> via <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> or <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a></li>
│ │ │ │ -<li>saved as a .torrent_file via <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a></li>
│ │ │ │ -<li>turned into a magnet link via <a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a></li>
│ │ │ │ -</ul>
│ │ │ │ -</blockquote>
│ │ │ │ -<a name="protocol_version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+protocol_version&labels=documentation&body=Documentation+under+heading+%22enum+protocol_version%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-protocol-version">
│ │ │ │ -<h1>enum protocol_version</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/info_hash.hpp">libtorrent/info_hash.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="8%" />
│ │ │ │ -<col width="10%" />
│ │ │ │ -<col width="82%" />
│ │ │ │ -</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>V1</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>The original BitTorrent version, using SHA-1 hashes</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>V2</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>Version 2 of the BitTorrent protocol, using SHA-256 hashes</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>NUM</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="socket_type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+socket_type_t&labels=documentation&body=Documentation+under+heading+%22enum+socket_type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-socket-type-t">
│ │ │ │ -<h1>enum socket_type_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/socket_type.hpp">libtorrent/socket_type.hpp</a>&quot;</p>
│ │ │ │ +<a name="event_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+event_t&labels=documentation&body=Documentation+under+heading+%22enum+event_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-event-t">
│ │ │ │ +<h1>enum event_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/tracker_manager.hpp">libtorrent/tracker_manager.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="38%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="41%" />
│ │ │ │ +<col width="35%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +<col width="42%" />
│ │ │ │  </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>tcp</td>
│ │ │ │ +<tr><td>none</td>
│ │ │ │  <td>0</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>socks5</td>
│ │ │ │ +<tr><td>completed</td>
│ │ │ │  <td>1</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>http</td>
│ │ │ │ +<tr><td>started</td>
│ │ │ │  <td>2</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>utp</td>
│ │ │ │ +<tr><td>stopped</td>
│ │ │ │  <td>3</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>i2p</td>
│ │ │ │ +<tr><td>paused</td>
│ │ │ │  <td>4</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>tcp_ssl</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>socks5_ssl</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>http_ssl</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>utp_ssl</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <a name="portmap_transport"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+portmap_transport&labels=documentation&body=Documentation+under+heading+%22enum+portmap_transport%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="enum-portmap-transport">
│ │ │ │  <h1>enum portmap_transport</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/portmap.hpp">libtorrent/portmap.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │ @@ -936,51 +889,98 @@
│ │ │ │  </tr>
│ │ │ │  <tr><td>udp</td>
│ │ │ │  <td>2</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="event_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+event_t&labels=documentation&body=Documentation+under+heading+%22enum+event_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-event-t">
│ │ │ │ -<h1>enum event_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/tracker_manager.hpp">libtorrent/tracker_manager.hpp</a>&quot;</p>
│ │ │ │ +<a name="protocol_version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+protocol_version&labels=documentation&body=Documentation+under+heading+%22enum+protocol_version%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-protocol-version">
│ │ │ │ +<h1>enum protocol_version</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/info_hash.hpp">libtorrent/info_hash.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="35%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ -<col width="42%" />
│ │ │ │ +<col width="8%" />
│ │ │ │ +<col width="10%" />
│ │ │ │ +<col width="82%" />
│ │ │ │  </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>none</td>
│ │ │ │ +<tr><td>V1</td>
│ │ │ │  <td>0</td>
│ │ │ │ +<td>The original BitTorrent version, using SHA-1 hashes</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>V2</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>Version 2 of the BitTorrent protocol, using SHA-256 hashes</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>NUM</td>
│ │ │ │ +<td>2</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>completed</td>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<a name="socket_type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+socket_type_t&labels=documentation&body=Documentation+under+heading+%22enum+socket_type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-socket-type-t">
│ │ │ │ +<h1>enum socket_type_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/socket_type.hpp">libtorrent/socket_type.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="38%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +<col width="41%" />
│ │ │ │ +</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>tcp</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>socks5</td>
│ │ │ │  <td>1</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>started</td>
│ │ │ │ +<tr><td>http</td>
│ │ │ │  <td>2</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>stopped</td>
│ │ │ │ +<tr><td>utp</td>
│ │ │ │  <td>3</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>paused</td>
│ │ │ │ +<tr><td>i2p</td>
│ │ │ │  <td>4</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ +<tr><td>tcp_ssl</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>socks5_ssl</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>http_ssl</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>utp_ssl</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <a name="connection_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+connection_type&labels=documentation&body=Documentation+under+heading+%22enum+connection_type%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="enum-connection-type">
│ │ │ │  <h1>enum connection_type</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_connection.hpp">libtorrent/peer_connection.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │ @@ -1240,14 +1240,30 @@
│ │ │ │  URL.</dd>
│ │ │ │  </dl>
│ │ │ │  <a name="torrent_flags_t::all"></a><dl class="docutils">
│ │ │ │  <dt>all</dt>
│ │ │ │  <dd>all torrent flags combined. Can conveniently be used when creating masks
│ │ │ │  for flags</dd>
│ │ │ │  </dl>
│ │ │ │ +<a name="int"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:int&labels=documentation&body=Documentation+under+heading+%22int%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="int">
│ │ │ │ +<h1>int</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ +<a name="int::version_major"></a><dl class="docutils">
│ │ │ │ +<dt>version_major</dt>
│ │ │ │ +<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="int::version_minor"></a><dl class="docutils">
│ │ │ │ +<dt>version_minor</dt>
│ │ │ │ +<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="int::version_tiny"></a><dl class="docutils">
│ │ │ │ +<dt>version_tiny</dt>
│ │ │ │ +<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ +</dl>
│ │ │ │  <a name="pex_flags_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:pex_flags_t&labels=documentation&body=Documentation+under+heading+%22pex_flags_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="pex-flags-t">
│ │ │ │  <h1>pex_flags_t</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/pex_flags.hpp">libtorrent/pex_flags.hpp</a>&quot;</p>
│ │ │ │  <a name="pex_flags_t::pex_encryption"></a><dl class="docutils">
│ │ │ │  <dt>pex_encryption</dt>
│ │ │ │  <dd>the peer supports protocol encryption</dd>
│ │ │ │ @@ -1267,14 +1283,30 @@
│ │ │ │  the peer fail</dd>
│ │ │ │  </dl>
│ │ │ │  <a name="pex_flags_t::pex_lt_v2"></a><dl class="docutils">
│ │ │ │  <dt>pex_lt_v2</dt>
│ │ │ │  <dd>protocol v2
│ │ │ │  this is not a standard flag, it is only used internally</dd>
│ │ │ │  </dl>
│ │ │ │ +<a name="char const*"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:char+const%2A&labels=documentation&body=Documentation+under+heading+%22char+const%2A%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="char-const">
│ │ │ │ +<h1>char const*</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ +<a name="char const*::version_str"></a><dl class="docutils">
│ │ │ │ +<dt>version_str</dt>
│ │ │ │ +<dd>the libtorrent version in string form</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="std::uint64_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:std%3A%3Auint64_t&labels=documentation&body=Documentation+under+heading+%22std%3A%3Auint64_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="std-uint64-t">
│ │ │ │ +<h1>std::uint64_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ +<a name="std::uint64_t::version_revision"></a><dl class="docutils">
│ │ │ │ +<dt>version_revision</dt>
│ │ │ │ +<dd>the git commit of this libtorrent version</dd>
│ │ │ │ +</dl>
│ │ │ │  <a name="download_priority_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:download_priority_t&labels=documentation&body=Documentation+under+heading+%22download_priority_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="download-priority-t">
│ │ │ │  <h1>download_priority_t</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/download_priority.hpp">libtorrent/download_priority.hpp</a>&quot;</p>
│ │ │ │  <a name="download_priority_t::dont_download"></a><dl class="docutils">
│ │ │ │  <dt>dont_download</dt>
│ │ │ │  <dd>Don't download the file or piece. Partial pieces may still be downloaded when
│ │ │ │ @@ -1288,46 +1320,14 @@
│ │ │ │  <dt>low_priority</dt>
│ │ │ │  <dd>The lowest priority for files and pieces.</dd>
│ │ │ │  </dl>
│ │ │ │  <a name="download_priority_t::top_priority"></a><dl class="docutils">
│ │ │ │  <dt>top_priority</dt>
│ │ │ │  <dd>The highest priority for files and pieces.</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="int"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:int&labels=documentation&body=Documentation+under+heading+%22int%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="int">
│ │ │ │ -<h1>int</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ -<a name="int::version_major"></a><dl class="docutils">
│ │ │ │ -<dt>version_major</dt>
│ │ │ │ -<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="int::version_minor"></a><dl class="docutils">
│ │ │ │ -<dt>version_minor</dt>
│ │ │ │ -<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="int::version_tiny"></a><dl class="docutils">
│ │ │ │ -<dt>version_tiny</dt>
│ │ │ │ -<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="char const*"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:char+const%2A&labels=documentation&body=Documentation+under+heading+%22char+const%2A%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="char-const">
│ │ │ │ -<h1>char const*</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ -<a name="char const*::version_str"></a><dl class="docutils">
│ │ │ │ -<dt>version_str</dt>
│ │ │ │ -<dd>the libtorrent version in string form</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="std::uint64_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:std%3A%3Auint64_t&labels=documentation&body=Documentation+under+heading+%22std%3A%3Auint64_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="std-uint64-t">
│ │ │ │ -<h1>std::uint64_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ -<a name="std::uint64_t::version_revision"></a><dl class="docutils">
│ │ │ │ -<dt>version_revision</dt>
│ │ │ │ -<dd>the git commit of this libtorrent version</dd>
│ │ │ │ -</dl>
│ │ │ │  </div>
│ │ │ │  
│ │ │ │      </div>
│ │ │ │      </div>
│ │ │ │      <div id="gradient"></div>
│ │ │ │      <div id="filler">
│ │ │ │      <div id="footer">
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,41 +1,68 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │ +    * _p_e_e_r___r_e_q_u_e_s_t
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_=_=_(_)
│ │ │ │ │      * _p_i_e_c_e___b_l_o_c_k
│ │ │ │ │ +    * _p_e_e_r___i_n_f_o
│ │ │ │ │ +          o _i_2_p___d_e_s_t_i_n_a_t_i_o_n_(_)
│ │ │ │ │      * _i_n_f_o___h_a_s_h___t
│ │ │ │ │            o _i_n_f_o___h_a_s_h___t_(_)
│ │ │ │ │ -          o _h_a_s___v_2_(_)_ _h_a_s_(_)_ _h_a_s___v_1_(_)
│ │ │ │ │ +          o _h_a_s_(_)_ _h_a_s___v_2_(_)_ _h_a_s___v_1_(_)
│ │ │ │ │            o _g_e_t_(_)
│ │ │ │ │            o _g_e_t___b_e_s_t_(_)
│ │ │ │ │            o _f_o_r___e_a_c_h_(_)
│ │ │ │ │ -    * _p_e_e_r___i_n_f_o
│ │ │ │ │ -          o _i_2_p___d_e_s_t_i_n_a_t_i_o_n_(_)
│ │ │ │ │ -    * _p_e_e_r___r_e_q_u_e_s_t
│ │ │ │ │ -          o _o_p_e_r_a_t_o_r_=_=_(_)
│ │ │ │ │ -    * _t_o_r_r_e_n_t___p_e_e_r___e_q_u_a_l_(_)
│ │ │ │ │ +    * _l_o_a_d___t_o_r_r_e_n_t___f_i_l_e_(_)_ _l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_)_ _l_o_a_d___t_o_r_r_e_n_t___b_u_f_f_e_r_(_)
│ │ │ │ │ +    * _t_r_u_n_c_a_t_e___f_i_l_e_s_(_)
│ │ │ │ │      * _m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │      * _p_a_r_s_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ -    * _t_r_u_n_c_a_t_e___f_i_l_e_s_(_)
│ │ │ │ │ +    * _t_o_r_r_e_n_t___p_e_e_r___e_q_u_a_l_(_)
│ │ │ │ │      * _v_e_r_s_i_o_n_(_)
│ │ │ │ │ -    * _l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_)_ _l_o_a_d___t_o_r_r_e_n_t___b_u_f_f_e_r_(_)_ _l_o_a_d___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │ -    * _e_n_u_m_ _p_r_o_t_o_c_o_l___v_e_r_s_i_o_n
│ │ │ │ │ -    * _e_n_u_m_ _s_o_c_k_e_t___t_y_p_e___t
│ │ │ │ │ +    * _e_n_u_m_ _e_v_e_n_t___t
│ │ │ │ │      * _e_n_u_m_ _p_o_r_t_m_a_p___t_r_a_n_s_p_o_r_t
│ │ │ │ │      * _e_n_u_m_ _p_o_r_t_m_a_p___p_r_o_t_o_c_o_l
│ │ │ │ │ -    * _e_n_u_m_ _e_v_e_n_t___t
│ │ │ │ │ +    * _e_n_u_m_ _p_r_o_t_o_c_o_l___v_e_r_s_i_o_n
│ │ │ │ │ +    * _e_n_u_m_ _s_o_c_k_e_t___t_y_p_e___t
│ │ │ │ │      * _e_n_u_m_ _c_o_n_n_e_c_t_i_o_n___t_y_p_e
│ │ │ │ │      * _t_o_r_r_e_n_t___f_l_a_g_s___t
│ │ │ │ │ -    * _p_e_x___f_l_a_g_s___t
│ │ │ │ │ -    * _d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t
│ │ │ │ │      * _i_n_t
│ │ │ │ │ +    * _p_e_x___f_l_a_g_s___t
│ │ │ │ │      * _c_h_a_r_ _c_o_n_s_t_*
│ │ │ │ │      * _s_t_d_:_:_u_i_n_t_6_4___t
│ │ │ │ │ +    * _d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ppeeeerr__rreeqquueesstt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___r_e_q_u_e_s_t_._h_p_p"
│ │ │ │ │ +represents a byte range within a piece. Internally this is is used for incoming
│ │ │ │ │ +piece requests.
│ │ │ │ │ +struct peer_request
│ │ │ │ │ +{
│ │ │ │ │ +   bool ooppeerraattoorr==== (peer_request const& r) const;
│ │ │ │ │ +
│ │ │ │ │ +   piece_index_t piece;
│ │ │ │ │ +   int start;
│ │ │ │ │ +   int length;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ooppeerraattoorr====(()) **********
│ │ │ │ │ +bool ooppeerraattoorr==== (peer_request const& r) const;
│ │ │ │ │ +returns true if the right hand side _p_e_e_r___r_e_q_u_e_s_t refers to the same range as
│ │ │ │ │ +this does.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  piece
│ │ │ │ │ +      The index of the piece in which the range starts.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  start
│ │ │ │ │ +      The byte offset within that piece where the range starts.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  length
│ │ │ │ │ +      The size of the range, in bytes.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ppiieeccee__bblloocckk ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_i_e_c_e___b_l_o_c_k_._h_p_p"
│ │ │ │ │  struct piece_block
│ │ │ │ │  {
│ │ │ │ │     ppiieeccee__bblloocckk () = default;
│ │ │ │ │     ppiieeccee__bblloocckk (piece_index_t p_index, int b_index);
│ │ │ │ │ @@ -44,73 +71,14 @@
│ │ │ │ │     bool ooppeerraattoorr!!== (piece_block const& b) const;
│ │ │ │ │  
│ │ │ │ │     static const piece_block invalid;
│ │ │ │ │     piece_index_t piece_index {0};
│ │ │ │ │     int bblloocckk__iinnddeexx  = 0;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ iinnffoo__hhaasshh__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_n_f_o___h_a_s_h_._h_p_p"
│ │ │ │ │ -class holding the info-hash of a torrent. It can hold a v1 info-hash (SHA-1) or
│ │ │ │ │ -a v2 info-hash (SHA-256) or both.
│ │ │ │ │ -Note
│ │ │ │ │ -If has_v2() is false then the v1 hash might actually be a truncated v2 hash
│ │ │ │ │ -struct info_hash_t
│ │ │ │ │ -{
│ │ │ │ │ -   iinnffoo__hhaasshh__tt () noexcept = default;
│ │ │ │ │ -   iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ │ -   explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept;
│ │ │ │ │ -   explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept;
│ │ │ │ │ -   bool hhaass__vv22 () const;
│ │ │ │ │ -   bool hhaass (protocol_version v) const;
│ │ │ │ │ -   bool hhaass__vv11 () const;
│ │ │ │ │ -   sha1_hash ggeett (protocol_version v) const;
│ │ │ │ │ -   sha1_hash ggeett__bbeesstt () const;
│ │ │ │ │ -   friend bool ooppeerraattoorr!!== (info_hash_t const& lhs, info_hash_t const& rhs);
│ │ │ │ │ -   friend bool ooppeerraattoorr==== (info_hash_t const& lhs, info_hash_t const& rhs)
│ │ │ │ │ -noexcept;
│ │ │ │ │ -   template <typename F> void ffoorr__eeaacchh (F f) const;
│ │ │ │ │ -   bool ooppeerraattoorr<< (info_hash_t const& o) const;
│ │ │ │ │ -   friend std::ostream& ooppeerraattoorr<<<< (std::ostream& os, info_hash_t const& ih);
│ │ │ │ │ -
│ │ │ │ │ -   sha1_hash v1;
│ │ │ │ │ -   sha256_hash v2;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iinnffoo__hhaasshh__tt(()) **********
│ │ │ │ │ -iinnffoo__hhaasshh__tt () noexcept = default;
│ │ │ │ │ -iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ │ -explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept;
│ │ │ │ │ -explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept;
│ │ │ │ │ -The default constructor creates an object that has neither a v1 or v2 hash.
│ │ │ │ │ -For backwards compatibility, make it possible to construct directly from a v1
│ │ │ │ │ -hash. This constructor allows iimmpplliicciitt conversion from a v1 hash, but the
│ │ │ │ │ -implicitness is deprecated.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** hhaass__vv22(()) hhaass(()) hhaass__vv11(()) **********
│ │ │ │ │ -bool hhaass__vv22 () const;
│ │ │ │ │ -bool hhaass (protocol_version v) const;
│ │ │ │ │ -bool hhaass__vv11 () const;
│ │ │ │ │ -returns true if the corresponding info hash is present in this object.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett(()) **********
│ │ │ │ │ -sha1_hash ggeett (protocol_version v) const;
│ │ │ │ │ -returns the has for the specified protocol version
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett__bbeesstt(()) **********
│ │ │ │ │ -sha1_hash ggeett__bbeesstt () const;
│ │ │ │ │ -returns the v2 (truncated) info-hash, if there is one, otherwise returns the v1
│ │ │ │ │ -info-hash
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffoorr__eeaacchh(()) **********
│ │ │ │ │ -template <typename F> void ffoorr__eeaacchh (F f) const;
│ │ │ │ │ -calls the function object f for each hash that is available. starting with v1.
│ │ │ │ │ -The signature of F is:
│ │ │ │ │ -void(sha1_hash const&, protocol_version);
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ppeeeerr__iinnffoo ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___i_n_f_o_._h_p_p"
│ │ │ │ │  holds information and statistics about one peer that libtorrent is connected to
│ │ │ │ │  struct peer_info
│ │ │ │ │  {
│ │ │ │ │     sha256_hash ii22pp__ddeessttiinnaattiioonn () const;
│ │ │ │ │  
│ │ │ │ │ @@ -479,51 +447,107 @@
│ │ │ │ │        to disk before downloading more.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    read_state write_state
│ │ │ │ │        bitmasks indicating what state this peer is in with regards to sending
│ │ │ │ │        and receiving data. The states are defined as independent flags of type
│ │ │ │ │        bandwidth_state_flags_t, in this class.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppeeeerr__rreeqquueesstt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___r_e_q_u_e_s_t_._h_p_p"
│ │ │ │ │ -represents a byte range within a piece. Internally this is is used for incoming
│ │ │ │ │ -piece requests.
│ │ │ │ │ -struct peer_request
│ │ │ │ │ +************ iinnffoo__hhaasshh__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_n_f_o___h_a_s_h_._h_p_p"
│ │ │ │ │ +class holding the info-hash of a torrent. It can hold a v1 info-hash (SHA-1) or
│ │ │ │ │ +a v2 info-hash (SHA-256) or both.
│ │ │ │ │ +Note
│ │ │ │ │ +If has_v2() is false then the v1 hash might actually be a truncated v2 hash
│ │ │ │ │ +struct info_hash_t
│ │ │ │ │  {
│ │ │ │ │ -   bool ooppeerraattoorr==== (peer_request const& r) const;
│ │ │ │ │ +   explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept;
│ │ │ │ │ +   iinnffoo__hhaasshh__tt () noexcept = default;
│ │ │ │ │ +   explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept;
│ │ │ │ │ +   iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ │ +   bool hhaass__vv22 () const;
│ │ │ │ │ +   bool hhaass (protocol_version v) const;
│ │ │ │ │ +   bool hhaass__vv11 () const;
│ │ │ │ │ +   sha1_hash ggeett (protocol_version v) const;
│ │ │ │ │ +   sha1_hash ggeett__bbeesstt () const;
│ │ │ │ │ +   friend bool ooppeerraattoorr!!== (info_hash_t const& lhs, info_hash_t const& rhs);
│ │ │ │ │ +   friend bool ooppeerraattoorr==== (info_hash_t const& lhs, info_hash_t const& rhs)
│ │ │ │ │ +noexcept;
│ │ │ │ │ +   template <typename F> void ffoorr__eeaacchh (F f) const;
│ │ │ │ │ +   bool ooppeerraattoorr<< (info_hash_t const& o) const;
│ │ │ │ │ +   friend std::ostream& ooppeerraattoorr<<<< (std::ostream& os, info_hash_t const& ih);
│ │ │ │ │  
│ │ │ │ │ -   piece_index_t piece;
│ │ │ │ │ -   int start;
│ │ │ │ │ -   int length;
│ │ │ │ │ +   sha1_hash v1;
│ │ │ │ │ +   sha256_hash v2;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr====(()) **********
│ │ │ │ │ -bool ooppeerraattoorr==== (peer_request const& r) const;
│ │ │ │ │ -returns true if the right hand side _p_e_e_r___r_e_q_u_e_s_t refers to the same range as
│ │ │ │ │ -this does.
│ │ │ │ │ +********** iinnffoo__hhaasshh__tt(()) **********
│ │ │ │ │ +explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept;
│ │ │ │ │ +iinnffoo__hhaasshh__tt () noexcept = default;
│ │ │ │ │ +explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept;
│ │ │ │ │ +iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ │ +The default constructor creates an object that has neither a v1 or v2 hash.
│ │ │ │ │ +For backwards compatibility, make it possible to construct directly from a v1
│ │ │ │ │ +hash. This constructor allows iimmpplliicciitt conversion from a v1 hash, but the
│ │ │ │ │ +implicitness is deprecated.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  piece
│ │ │ │ │ -      The index of the piece in which the range starts.
│ │ │ │ │ +********** hhaass(()) hhaass__vv22(()) hhaass__vv11(()) **********
│ │ │ │ │ +bool hhaass__vv22 () const;
│ │ │ │ │ +bool hhaass (protocol_version v) const;
│ │ │ │ │ +bool hhaass__vv11 () const;
│ │ │ │ │ +returns true if the corresponding info hash is present in this object.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  start
│ │ │ │ │ -      The byte offset within that piece where the range starts.
│ │ │ │ │ +********** ggeett(()) **********
│ │ │ │ │ +sha1_hash ggeett (protocol_version v) const;
│ │ │ │ │ +returns the has for the specified protocol version
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  length
│ │ │ │ │ -      The size of the range, in bytes.
│ │ │ │ │ +********** ggeett__bbeesstt(()) **********
│ │ │ │ │ +sha1_hash ggeett__bbeesstt () const;
│ │ │ │ │ +returns the v2 (truncated) info-hash, if there is one, otherwise returns the v1
│ │ │ │ │ +info-hash
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ttoorrrreenntt__ppeeeerr__eeqquuaall(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___p_e_e_r_._h_p_p"
│ │ │ │ │ -inline bool ttoorrrreenntt__ppeeeerr__eeqquuaall (torrent_peer const* lhs, torrent_peer const*
│ │ │ │ │ -rhs);
│ │ │ │ │ +********** ffoorr__eeaacchh(()) **********
│ │ │ │ │ +template <typename F> void ffoorr__eeaacchh (F f) const;
│ │ │ │ │ +calls the function object f for each hash that is available. starting with v1.
│ │ │ │ │ +The signature of F is:
│ │ │ │ │ +void(sha1_hash const&, protocol_version);
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ llooaadd__ttoorrrreenntt__ffiillee(()) llooaadd__ttoorrrreenntt__ppaarrsseedd(()) llooaadd__ttoorrrreenntt__bbuuffffeerr(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_l_o_a_d___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr (
│ │ │ │ │ +   span<char const> buffer);
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__ffiillee (
│ │ │ │ │ +   std::string const& filename);
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__ffiillee (
│ │ │ │ │ +   std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__ppaarrsseedd (
│ │ │ │ │ +   bdecode_node const& torrent_file, load_torrent_limits const& cfg);
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__ppaarrsseedd (
│ │ │ │ │ +   bdecode_node const& torrent_file);
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr (
│ │ │ │ │ +   span<char const> buffer, load_torrent_limits const& cfg);
│ │ │ │ │ +These functions load the content of a .torrent file into an _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s
│ │ │ │ │ +object. The immutable part of a torrent file (the info-dictionary) is stored in
│ │ │ │ │ +the ti field in the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object (as a _t_o_r_r_e_n_t___i_n_f_o object). The
│ │ │ │ │ +returned object is suitable to be:
│ │ │ │ │ +         * added to a _s_e_s_s_i_o_n via _a_d_d___t_o_r_r_e_n_t_(_) or _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_)
│ │ │ │ │ +         * saved as a .torrent_file via _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │ +         * turned into a magnet link via _m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ttrruunnccaattee__ffiilleess(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_r_u_n_c_a_t_e_._h_p_p"
│ │ │ │ │ +void ttrruunnccaattee__ffiilleess (file_storage const& fs, std::string const& save_path,
│ │ │ │ │ +storage_error& ec);
│ │ │ │ │ +Truncates files larger than specified in the _f_i_l_e___s_t_o_r_a_g_e, saved under the
│ │ │ │ │ +specified save_path.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ mmaakkee__mmaaggnneett__uurrii(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_m_a_g_n_e_t___u_r_i_._h_p_p"
│ │ │ │ │ -std::string mmaakkee__mmaaggnneett__uurrii (add_torrent_params const& atp);
│ │ │ │ │  std::string mmaakkee__mmaaggnneett__uurrii (torrent_info const& info);
│ │ │ │ │  std::string mmaakkee__mmaaggnneett__uurrii (torrent_handle const& handle);
│ │ │ │ │ +std::string mmaakkee__mmaaggnneett__uurrii (add_torrent_params const& atp);
│ │ │ │ │  Generates a magnet URI from the specified torrent.
│ │ │ │ │  Several fields from the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s objects are recorded in the magnet
│ │ │ │ │  link. In order to not include them, they have to be cleared before calling
│ │ │ │ │  _m_a_k_e___m_a_g_n_e_t___u_r_i_(_). These fields are used:
│ │ │ │ │       ti, info_hashes, url_seeds, dht_nodes, file_priorities, trackers,
│ │ │ │ │       name, peers.
│ │ │ │ │  Depending on what the use case for the resulting magnet link is, clearing peers
│ │ │ │ │ @@ -539,56 +563,57 @@
│ │ │ │ │  information about the torrent. If the torrent handle is invalid, an empty
│ │ │ │ │  string is returned.
│ │ │ │ │  For more information about magnet links, see _m_a_g_n_e_t_ _l_i_n_k_s.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ppaarrssee__mmaaggnneett__uurrii(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_m_a_g_n_e_t___u_r_i_._h_p_p"
│ │ │ │ │  add_torrent_params ppaarrssee__mmaaggnneett__uurrii (string_view uri, error_code& ec);
│ │ │ │ │ -void ppaarrssee__mmaaggnneett__uurrii (string_view uri, add_torrent_params& p, error_code& ec);
│ │ │ │ │  add_torrent_params ppaarrssee__mmaaggnneett__uurrii (string_view uri);
│ │ │ │ │ +void ppaarrssee__mmaaggnneett__uurrii (string_view uri, add_torrent_params& p, error_code& ec);
│ │ │ │ │  This function parses out information from the magnet link and populates the
│ │ │ │ │  _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object. The overload that does not take an error_code
│ │ │ │ │  reference will throw a system_error on error The overload taking an
│ │ │ │ │  add_torrent_params reference will fill in the fields specified in the magnet
│ │ │ │ │  URI.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ttrruunnccaattee__ffiilleess(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_r_u_n_c_a_t_e_._h_p_p"
│ │ │ │ │ -void ttrruunnccaattee__ffiilleess (file_storage const& fs, std::string const& save_path,
│ │ │ │ │ -storage_error& ec);
│ │ │ │ │ -Truncates files larger than specified in the _f_i_l_e___s_t_o_r_a_g_e, saved under the
│ │ │ │ │ -specified save_path.
│ │ │ │ │ +************ ttoorrrreenntt__ppeeeerr__eeqquuaall(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___p_e_e_r_._h_p_p"
│ │ │ │ │ +inline bool ttoorrrreenntt__ppeeeerr__eeqquuaall (torrent_peer const* lhs, torrent_peer const*
│ │ │ │ │ +rhs);
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ vveerrssiioonn(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │  char const* vveerrssiioonn ();
│ │ │ │ │  returns the libtorrent version as string form in this format:
│ │ │ │ │  "<major>.<minor>.<tiny>.<tag>"
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ llooaadd__ttoorrrreenntt__ppaarrsseedd(()) llooaadd__ttoorrrreenntt__bbuuffffeerr(()) llooaadd__ttoorrrreenntt__ffiillee(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_l_o_a_d___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ffiillee (
│ │ │ │ │ -   std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr (
│ │ │ │ │ -   span<char const> buffer);
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ppaarrsseedd (
│ │ │ │ │ -   bdecode_node const& torrent_file);
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ffiillee (
│ │ │ │ │ -   std::string const& filename);
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ppaarrsseedd (
│ │ │ │ │ -   bdecode_node const& torrent_file, load_torrent_limits const& cfg);
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr (
│ │ │ │ │ -   span<char const> buffer, load_torrent_limits const& cfg);
│ │ │ │ │ -These functions load the content of a .torrent file into an _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s
│ │ │ │ │ -object. The immutable part of a torrent file (the info-dictionary) is stored in
│ │ │ │ │ -the ti field in the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object (as a _t_o_r_r_e_n_t___i_n_f_o object). The
│ │ │ │ │ -returned object is suitable to be:
│ │ │ │ │ -         * added to a _s_e_s_s_i_o_n via _a_d_d___t_o_r_r_e_n_t_(_) or _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -         * saved as a .torrent_file via _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │ -         * turned into a magnet link via _m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ +************ eennuumm eevveenntt__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_r_a_c_k_e_r___m_a_n_a_g_e_r_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_n_o_n_e_ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_c_o_m_p_l_e_t_e_d_|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_t_a_r_t_e_d_ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_t_o_p_p_e_d_ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_a_u_s_e_d_ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ppoorrttmmaapp__ttrraannssppoorrtt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_r_t_m_a_p_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_a_t_p_m_p_|_0_ _ _ _ _|_n_a_t_p_m_p_ _c_a_n_ _b_e_ _N_A_T_-_P_M_P_ _o_r_ _P_C_P|
│ │ │ │ │ +|_u_p_n_p_ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ppoorrttmmaapp__pprroottooccooll ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_r_t_m_a_p_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_n_o_n_e_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_t_c_p_ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_u_d_p_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ eennuumm pprroottooccooll__vveerrssiioonn ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_n_f_o___h_a_s_h_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_V_1_ _ _|_0_ _ _ _ _|_T_h_e_ _o_r_i_g_i_n_a_l_ _B_i_t_T_o_r_r_e_n_t_ _v_e_r_s_i_o_n_,_ _u_s_i_n_g_ _S_H_A_-_1_ _h_a_s_h_e_s_ _ _ _ _ _ _ |
│ │ │ │ │  |_V_2_ _ _|_1_ _ _ _ _|_V_e_r_s_i_o_n_ _2_ _o_f_ _t_h_e_ _B_i_t_T_o_r_r_e_n_t_ _p_r_o_t_o_c_o_l_,_ _u_s_i_n_g_ _S_H_A_-_2_5_6_ _h_a_s_h_e_s|
│ │ │ │ │ @@ -604,39 +629,14 @@
│ │ │ │ │  |_u_t_p_ _ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_i_2_p_ _ _ _ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_t_c_p___s_s_l_ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_s_o_c_k_s_5___s_s_l_|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_h_t_t_p___s_s_l_ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_u_t_p___s_s_l_ _ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ppoorrttmmaapp__ttrraannssppoorrtt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_r_t_m_a_p_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_a_t_p_m_p_|_0_ _ _ _ _|_n_a_t_p_m_p_ _c_a_n_ _b_e_ _N_A_T_-_P_M_P_ _o_r_ _P_C_P|
│ │ │ │ │ -|_u_p_n_p_ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ppoorrttmmaapp__pprroottooccooll ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_r_t_m_a_p_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_n_o_n_e_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_t_c_p_ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_u_d_p_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm eevveenntt__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_r_a_c_k_e_r___m_a_n_a_g_e_r_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_n_o_n_e_ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_c_o_m_p_l_e_t_e_d_|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_t_a_r_t_e_d_ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_t_o_p_p_e_d_ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_a_u_s_e_d_ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ eennuumm ccoonnnneeccttiioonn__ttyyppee ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │  |_b_i_t_t_o_r_r_e_n_t_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_u_r_l___s_e_e_d_ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_h_t_t_p___s_e_e_d_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ @@ -813,14 +813,23 @@
│ │ │ │ │        This flag is set automatically when adding a torrent that has at least
│ │ │ │ │        one tracker whose hostname ends with .i2p. It's also set by
│ │ │ │ │        _p_a_r_s_e___m_a_g_n_e_t___u_r_i_(_) if the tracker list contains such URL.
│ │ │ │ │    all
│ │ │ │ │        all torrent flags combined. Can conveniently be used when creating masks
│ │ │ │ │        for flags
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ iinntt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ +  version_major
│ │ │ │ │ +      the major, minor and tiny versions of libtorrent
│ │ │ │ │ +  version_minor
│ │ │ │ │ +      the major, minor and tiny versions of libtorrent
│ │ │ │ │ +  version_tiny
│ │ │ │ │ +      the major, minor and tiny versions of libtorrent
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ppeexx__ffllaaggss__tt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_x___f_l_a_g_s_._h_p_p"
│ │ │ │ │    pex_encryption
│ │ │ │ │        the peer supports protocol encryption
│ │ │ │ │    pex_seed
│ │ │ │ │        the peer is a seed
│ │ │ │ │    pex_utp
│ │ │ │ │ @@ -828,44 +837,35 @@
│ │ │ │ │    pex_holepunch
│ │ │ │ │        the peer supports the holepunch extension If this flag is received from a
│ │ │ │ │        peer, it can be used as a rendezvous point in case direct connections to
│ │ │ │ │        the peer fail
│ │ │ │ │    pex_lt_v2
│ │ │ │ │        protocol v2 this is not a standard flag, it is only used internally
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ cchhaarr ccoonnsstt** ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ +  version_str
│ │ │ │ │ +      the libtorrent version in string form
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ssttdd::::uuiinntt6644__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ +  version_revision
│ │ │ │ │ +      the git commit of this libtorrent version
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ddoowwnnllooaadd__pprriioorriittyy__tt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y_._h_p_p"
│ │ │ │ │    dont_download
│ │ │ │ │        Don't download the file or piece. Partial pieces may still be downloaded
│ │ │ │ │        when setting file priorities.
│ │ │ │ │    default_priority
│ │ │ │ │        The default priority for files and pieces.
│ │ │ │ │    low_priority
│ │ │ │ │        The lowest priority for files and pieces.
│ │ │ │ │    top_priority
│ │ │ │ │        The highest priority for files and pieces.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ iinntt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ -  version_major
│ │ │ │ │ -      the major, minor and tiny versions of libtorrent
│ │ │ │ │ -  version_minor
│ │ │ │ │ -      the major, minor and tiny versions of libtorrent
│ │ │ │ │ -  version_tiny
│ │ │ │ │ -      the major, minor and tiny versions of libtorrent
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ cchhaarr ccoonnsstt** ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ -  version_str
│ │ │ │ │ -      the libtorrent version in string form
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ssttdd::::uuiinntt6644__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ -  version_revision
│ │ │ │ │ -      the git commit of this libtorrent version
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  _b_l_o_g
│ │ │ │ │  _u_T_P
│ │ │ │ │  _d_o_w_n_l_o_a_d
│ │ │ │ │  _d_o_c_u_m_e_n_t_a_t_i_o_n
│ │ │ │ │  _D_H_T_ _p_u_t_ _e_x_t_e_n_s_i_o_n
│ │ │ │ │  _p_y_t_h_o_n_ _b_i_n_d_i_n_g_s
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Create_Torrents.html
│ │ │ │ @@ -30,32 +30,32 @@
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │  <li><a class="reference internal" href="#create-torrent" id="toc-entry-1">create_torrent</a><ul>
│ │ │ │  <li><a class="reference internal" href="#create-torrent-1" id="toc-entry-2">create_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#generate-buf-generate" id="toc-entry-3">generate_buf() generate()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#generate-generate-buf" id="toc-entry-3">generate() generate_buf()</a></li>
│ │ │ │  <li><a class="reference internal" href="#files" id="toc-entry-4">files()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-comment" id="toc-entry-5">set_comment()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-creator" id="toc-entry-6">set_creator()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-creation-date" id="toc-entry-7">set_creation_date()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-hash" id="toc-entry-8">set_hash()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-hash2" id="toc-entry-9">set_hash2()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-url-seed-add-http-seed" id="toc-entry-10">add_url_seed() add_http_seed()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-http-seed-add-url-seed" id="toc-entry-10">add_http_seed() add_url_seed()</a></li>
│ │ │ │  <li><a class="reference internal" href="#add-node" id="toc-entry-11">add_node()</a></li>
│ │ │ │  <li><a class="reference internal" href="#add-tracker" id="toc-entry-12">add_tracker()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-root-cert" id="toc-entry-13">set_root_cert()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#priv-set-priv" id="toc-entry-14">priv() set_priv()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-priv-priv" id="toc-entry-14">set_priv() priv()</a></li>
│ │ │ │  <li><a class="reference internal" href="#num-pieces" id="toc-entry-15">num_pieces()</a></li>
│ │ │ │  <li><a class="reference internal" href="#piece-range" id="toc-entry-16">piece_range()</a></li>
│ │ │ │  <li><a class="reference internal" href="#file-range" id="toc-entry-17">file_range()</a></li>
│ │ │ │  <li><a class="reference internal" href="#file-piece-range" id="toc-entry-18">file_piece_range()</a></li>
│ │ │ │  <li><a class="reference internal" href="#total-size" id="toc-entry-19">total_size()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-size-piece-length" id="toc-entry-20">piece_size() piece_length()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-length-piece-size" id="toc-entry-20">piece_length() piece_size()</a></li>
│ │ │ │  <li><a class="reference internal" href="#add-similar-torrent-add-collection" id="toc-entry-21">add_similar_torrent() add_collection()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  <li><a class="reference internal" href="#add-files" id="toc-entry-22">add_files()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-piece-hashes" id="toc-entry-23">set_piece_hashes()</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │ @@ -105,61 +105,61 @@
│ │ │ │  <p>This class holds state for creating a torrent. After having added
│ │ │ │  all information to it, call <a class="reference external" href="reference-Create_Torrents.html#generate()">create_torrent::generate()</a> to generate
│ │ │ │  the torrent. The <a class="reference external" href="reference-Bencoding.html#entry">entry</a> that's returned can then be bencoded into a
│ │ │ │  .torrent file using <a class="reference external" href="reference-Bencoding.html#bencode()">bencode()</a>.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct create_torrent
│ │ │ │  {
│ │ │ │ +   explicit <strong>create_torrent</strong> (torrent_info const&amp; ti);
│ │ │ │     explicit <strong>create_torrent</strong> (file_storage&amp; fs, int piece_size = 0
│ │ │ │        , create_flags_t flags = {});
│ │ │ │ -   explicit <strong>create_torrent</strong> (torrent_info const&amp; ti);
│ │ │ │ -   std::vector&lt;char&gt; <strong>generate_buf</strong> () const;
│ │ │ │     entry <strong>generate</strong> () const;
│ │ │ │ +   std::vector&lt;char&gt; <strong>generate_buf</strong> () const;
│ │ │ │     file_storage const&amp; <strong>files</strong> () const;
│ │ │ │     void <strong>set_comment</strong> (char const* str);
│ │ │ │     void <strong>set_creator</strong> (char const* str);
│ │ │ │     void <strong>set_creation_date</strong> (std::time_t timestamp);
│ │ │ │     void <strong>set_hash</strong> (piece_index_t index, sha1_hash const&amp; h);
│ │ │ │     void <strong>set_hash2</strong> (file_index_t file, piece_index_t::diff_type piece, sha256_hash const&amp; h);
│ │ │ │     void <strong>add_url_seed</strong> (string_view url);
│ │ │ │     void <strong>add_http_seed</strong> (string_view url);
│ │ │ │     void <strong>add_node</strong> (std::pair&lt;std::string, int&gt; node);
│ │ │ │     void <strong>add_tracker</strong> (string_view url, int tier = 0);
│ │ │ │     void <strong>set_root_cert</strong> (string_view cert);
│ │ │ │     bool <strong>priv</strong> () const;
│ │ │ │     void <strong>set_priv</strong> (bool p);
│ │ │ │ -   bool <strong>is_v1_only</strong> () const;
│ │ │ │     bool <strong>is_v2_only</strong> () const;
│ │ │ │ +   bool <strong>is_v1_only</strong> () const;
│ │ │ │     int <strong>num_pieces</strong> () const;
│ │ │ │     piece_index_t <strong>end_piece</strong> () const;
│ │ │ │     index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │     file_index_t <strong>end_file</strong> () const;
│ │ │ │     index_range&lt;file_index_t&gt; <strong>file_range</strong> () const noexcept;
│ │ │ │     index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t f);
│ │ │ │     std::int64_t <strong>total_size</strong> () const;
│ │ │ │ -   int <strong>piece_length</strong> () const;
│ │ │ │     int <strong>piece_size</strong> (piece_index_t i) const;
│ │ │ │ -   void <strong>add_similar_torrent</strong> (sha1_hash ih);
│ │ │ │ +   int <strong>piece_length</strong> () const;
│ │ │ │     void <strong>add_collection</strong> (string_view c);
│ │ │ │ +   void <strong>add_similar_torrent</strong> (sha1_hash ih);
│ │ │ │  
│ │ │ │     static constexpr create_flags_t <strong>modification_time</strong>  = 2_bit;
│ │ │ │     static constexpr create_flags_t <strong>symlinks</strong>  = 3_bit;
│ │ │ │     static constexpr create_flags_t <strong>v2_only</strong>  = 5_bit;
│ │ │ │     static constexpr create_flags_t <strong>v1_only</strong>  = 6_bit;
│ │ │ │     static constexpr create_flags_t <strong>canonical_files</strong>  = 7_bit;
│ │ │ │     static constexpr create_flags_t <strong>no_attributes</strong>  = 8_bit;
│ │ │ │     static constexpr create_flags_t <strong>canonical_files_no_tail_padding</strong>  = 9_bit;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="create_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bcreate_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bcreate_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="create-torrent-1">
│ │ │ │  <h2>create_torrent()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +explicit <strong>create_torrent</strong> (torrent_info const&amp; ti);
│ │ │ │  explicit <strong>create_torrent</strong> (file_storage&amp; fs, int piece_size = 0
│ │ │ │        , create_flags_t flags = {});
│ │ │ │ -explicit <strong>create_torrent</strong> (torrent_info const&amp; ti);
│ │ │ │  </pre>
│ │ │ │  <p>The <tt class="docutils literal">piece_size</tt> is the size of each piece in bytes. It must be a
│ │ │ │  power of 2 and a minimum of 16 kiB. If a piece size of 0 is
│ │ │ │  specified, a piece_size will be set automatically.
│ │ │ │  Piece sizes greater than 128 MiB are considered unreasonable and will
│ │ │ │  be rejected (with an lt::system_error exception).</p>
│ │ │ │  <p>The <tt class="docutils literal">flags</tt> arguments specifies options for the torrent creation. It can
│ │ │ │ @@ -175,21 +175,21 @@
│ │ │ │  have any affect. Instead of using this overload, consider using
│ │ │ │  <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a> instead.</p>
│ │ │ │  <div class="admonition warning">
│ │ │ │  <p class="first admonition-title">Warning</p>
│ │ │ │  <p class="last">The <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> and <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> objects must stay alive for the
│ │ │ │  entire duration of the <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> object.</p>
│ │ │ │  </div>
│ │ │ │ -<a name="generate_buf()"></a>
│ │ │ │ -<a name="generate()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bgenerate_buf%28%29+generate%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bgenerate_buf%28%29+generate%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="generate-buf-generate">
│ │ │ │ -<h2>generate_buf() generate()</h2>
│ │ │ │ +<a name="generate()"></a>
│ │ │ │ +<a name="generate_buf()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bgenerate%28%29+generate_buf%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bgenerate%28%29+generate_buf%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="generate-generate-buf">
│ │ │ │ +<h2>generate() generate_buf()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::vector&lt;char&gt; <strong>generate_buf</strong> () const;
│ │ │ │  entry <strong>generate</strong> () const;
│ │ │ │ +std::vector&lt;char&gt; <strong>generate_buf</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>This function will generate the .torrent file as a bencode tree, or a
│ │ │ │  bencoded into a buffer.
│ │ │ │  In order to encode the <a class="reference external" href="reference-Bencoding.html#entry">entry</a> into a flat file, use the <a class="reference external" href="reference-Bencoding.html#bencode()">bencode()</a> function.</p>
│ │ │ │  <p>The function returning an <a class="reference external" href="reference-Bencoding.html#entry">entry</a> may be useful to add custom entries
│ │ │ │  to the torrent file before bencoding it and saving it to disk.</p>
│ │ │ │  <p>Whether the resulting torrent object is v1, v2 or hybrid depends on
│ │ │ │ @@ -272,18 +272,18 @@
│ │ │ │  16 kiB blocks. Note that piece sizes must be powers-of-2, so all
│ │ │ │  per-piece merkle trees are complete.
│ │ │ │  A SHA-256 hash of all zeros is internally used to indicate a hash
│ │ │ │  that has not been set. Setting such hash will not be considered set
│ │ │ │  when calling <a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>.
│ │ │ │  This function will throw <tt class="docutils literal"><span class="pre">std::system_error</span></tt> if it is called on an
│ │ │ │  object constructed with the v1_only flag.</p>
│ │ │ │ -<a name="add_url_seed()"></a>
│ │ │ │ -<a name="add_http_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_url_seed%28%29+add_http_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_url_seed%28%29+add_http_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-url-seed-add-http-seed">
│ │ │ │ -<h2>add_url_seed() add_http_seed()</h2>
│ │ │ │ +<a name="add_http_seed()"></a>
│ │ │ │ +<a name="add_url_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_http_seed%28%29+add_url_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_http_seed%28%29+add_url_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-http-seed-add-url-seed">
│ │ │ │ +<h2>add_http_seed() add_url_seed()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>add_url_seed</strong> (string_view url);
│ │ │ │  void <strong>add_http_seed</strong> (string_view url);
│ │ │ │  </pre>
│ │ │ │  <p>This adds a url seed to the torrent. You can have any number of url seeds. For a
│ │ │ │  single file torrent, this should be an HTTP url, pointing to a file with identical
│ │ │ │  content as the file of the torrent. For a multi-file torrent, it should point to
│ │ │ │ @@ -320,18 +320,18 @@
│ │ │ │  </pre>
│ │ │ │  <p>This function sets an X.509 certificate in PEM format to the torrent. This makes the
│ │ │ │  torrent an <em>SSL torrent</em>. An SSL torrent requires that each peer has a valid certificate
│ │ │ │  signed by this root certificate. For SSL torrents, all peers are connecting over SSL
│ │ │ │  connections. For more information, see the section on <a class="reference external" href="manual-ref.html#ssl-torrents">ssl torrents</a>.</p>
│ │ │ │  <p>The string is not the path to the cert, it's the actual content of the
│ │ │ │  certificate.</p>
│ │ │ │ -<a name="priv()"></a>
│ │ │ │ -<a name="set_priv()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bpriv%28%29+set_priv%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bpriv%28%29+set_priv%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="priv-set-priv">
│ │ │ │ -<h2>priv() set_priv()</h2>
│ │ │ │ +<a name="set_priv()"></a>
│ │ │ │ +<a name="priv()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_priv%28%29+priv%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_priv%28%29+priv%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-priv-priv">
│ │ │ │ +<h2>set_priv() priv()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  bool <strong>priv</strong> () const;
│ │ │ │  void <strong>set_priv</strong> (bool p);
│ │ │ │  </pre>
│ │ │ │  <p>Sets and queries the private flag of the torrent.
│ │ │ │  Torrents with the private flag set ask the client to not use any other
│ │ │ │  sources than the tracker for peers, and to not use DHT to advertise itself publicly,
│ │ │ │ @@ -369,32 +369,32 @@
│ │ │ │  <a name="total_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Btotal_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Btotal_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="total-size">
│ │ │ │  <h2>total_size()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::int64_t <strong>total_size</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>the total number of bytes of all files and pad files</p>
│ │ │ │ -<a name="piece_size()"></a>
│ │ │ │ -<a name="piece_length()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bpiece_size%28%29+piece_length%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bpiece_size%28%29+piece_length%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-size-piece-length">
│ │ │ │ -<h2>piece_size() piece_length()</h2>
│ │ │ │ +<a name="piece_length()"></a>
│ │ │ │ +<a name="piece_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bpiece_length%28%29+piece_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bpiece_length%28%29+piece_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-length-piece-size">
│ │ │ │ +<h2>piece_length() piece_size()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -int <strong>piece_length</strong> () const;
│ │ │ │  int <strong>piece_size</strong> (piece_index_t i) const;
│ │ │ │ +int <strong>piece_length</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">piece_length()</tt> returns the piece size of all pieces but the
│ │ │ │  last one. <tt class="docutils literal">piece_size()</tt> returns the size of the specified piece.
│ │ │ │  these functions are just forwarding to the associated <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │  <a name="add_similar_torrent()"></a>
│ │ │ │  <a name="add_collection()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_similar_torrent%28%29+add_collection%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_similar_torrent%28%29+add_collection%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="add-similar-torrent-add-collection">
│ │ │ │  <h2>add_similar_torrent() add_collection()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>add_similar_torrent</strong> (sha1_hash ih);
│ │ │ │  void <strong>add_collection</strong> (string_view c);
│ │ │ │ +void <strong>add_similar_torrent</strong> (sha1_hash ih);
│ │ │ │  </pre>
│ │ │ │  <p>Add similar torrents (by info-hash) or collections of similar torrents.
│ │ │ │  Similar torrents are expected to share some files with this torrent.
│ │ │ │  Torrents sharing a collection name with this torrent are also expected
│ │ │ │  to share files with this torrent. A torrent may have more than one
│ │ │ │  collection and more than one similar torrents. For more information,
│ │ │ │  see <a class="reference external" href="https://www.bittorrent.org/beps/bep_0038.html">BEP 38</a>.</p>
│ │ │ │ @@ -483,28 +483,28 @@
│ │ │ │  constructor.</p>
│ │ │ │  <a name="set_piece_hashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:set_piece_hashes%28%29&labels=documentation&body=Documentation+under+heading+%22set_piece_hashes%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="set-piece-hashes">
│ │ │ │  <h1>set_piece_hashes()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/create_torrent.hpp">libtorrent/create_torrent.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ -   , settings_interface const&amp; settings
│ │ │ │     , std::function&lt;void(piece_index_t)&gt; const&amp; f, error_code&amp; ec);
│ │ │ │ +inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p, error_code&amp; ec);
│ │ │ │  void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ +   , settings_interface const&amp; settings, disk_io_constructor_type disk_io
│ │ │ │     , std::function&lt;void(piece_index_t)&gt; const&amp; f, error_code&amp; ec);
│ │ │ │  inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p);
│ │ │ │ +void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ +   , settings_interface const&amp; settings
│ │ │ │ +   , std::function&lt;void(piece_index_t)&gt; const&amp; f, error_code&amp; ec);
│ │ │ │  inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ +   , settings_interface const&amp; settings
│ │ │ │     , std::function&lt;void(piece_index_t)&gt; const&amp; f);
│ │ │ │  inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ -   , settings_interface const&amp; settings
│ │ │ │     , std::function&lt;void(piece_index_t)&gt; const&amp; f);
│ │ │ │ -inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p, error_code&amp; ec);
│ │ │ │ -void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ -   , settings_interface const&amp; settings, disk_io_constructor_type disk_io
│ │ │ │ -   , std::function&lt;void(piece_index_t)&gt; const&amp; f, error_code&amp; ec);
│ │ │ │  </pre>
│ │ │ │  <p>This function will assume that the files added to the torrent file exists at path
│ │ │ │  <tt class="docutils literal">p</tt>, read those files and hash the content and set the hashes in the <tt class="docutils literal">create_torrent</tt>
│ │ │ │  object. The optional function <tt class="docutils literal">f</tt> is called in between every hash that is set. <tt class="docutils literal">f</tt>
│ │ │ │  must have the following signature:</p>
│ │ │ │  <pre class="code c++ literal-block">
│ │ │ │  <span class="keyword type">void</span><span class="whitespace"> </span><span class="name function">Fun</span><span class="punctuation">(</span><span class="name">piece_index_t</span><span class="punctuation">);</span>
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,32 +1,32 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │      * _c_r_e_a_t_e___t_o_r_r_e_n_t
│ │ │ │ │            o _c_r_e_a_t_e___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -          o _g_e_n_e_r_a_t_e___b_u_f_(_)_ _g_e_n_e_r_a_t_e_(_)
│ │ │ │ │ +          o _g_e_n_e_r_a_t_e_(_)_ _g_e_n_e_r_a_t_e___b_u_f_(_)
│ │ │ │ │            o _f_i_l_e_s_(_)
│ │ │ │ │            o _s_e_t___c_o_m_m_e_n_t_(_)
│ │ │ │ │            o _s_e_t___c_r_e_a_t_o_r_(_)
│ │ │ │ │            o _s_e_t___c_r_e_a_t_i_o_n___d_a_t_e_(_)
│ │ │ │ │            o _s_e_t___h_a_s_h_(_)
│ │ │ │ │            o _s_e_t___h_a_s_h_2_(_)
│ │ │ │ │ -          o _a_d_d___u_r_l___s_e_e_d_(_)_ _a_d_d___h_t_t_p___s_e_e_d_(_)
│ │ │ │ │ +          o _a_d_d___h_t_t_p___s_e_e_d_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)
│ │ │ │ │            o _a_d_d___n_o_d_e_(_)
│ │ │ │ │            o _a_d_d___t_r_a_c_k_e_r_(_)
│ │ │ │ │            o _s_e_t___r_o_o_t___c_e_r_t_(_)
│ │ │ │ │ -          o _p_r_i_v_(_)_ _s_e_t___p_r_i_v_(_)
│ │ │ │ │ +          o _s_e_t___p_r_i_v_(_)_ _p_r_i_v_(_)
│ │ │ │ │            o _n_u_m___p_i_e_c_e_s_(_)
│ │ │ │ │            o _p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │            o _f_i_l_e___r_a_n_g_e_(_)
│ │ │ │ │            o _f_i_l_e___p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │            o _t_o_t_a_l___s_i_z_e_(_)
│ │ │ │ │ -          o _p_i_e_c_e___s_i_z_e_(_)_ _p_i_e_c_e___l_e_n_g_t_h_(_)
│ │ │ │ │ +          o _p_i_e_c_e___l_e_n_g_t_h_(_)_ _p_i_e_c_e___s_i_z_e_(_)
│ │ │ │ │            o _a_d_d___s_i_m_i_l_a_r___t_o_r_r_e_n_t_(_)_ _a_d_d___c_o_l_l_e_c_t_i_o_n_(_)
│ │ │ │ │      * _a_d_d___f_i_l_e_s_(_)
│ │ │ │ │      * _s_e_t___p_i_e_c_e___h_a_s_h_e_s_(_)
│ │ │ │ │  This section describes the functions and classes that are used to create
│ │ │ │ │  torrent files. It is a layered API with low level classes and higher level
│ │ │ │ │  convenience functions. A torrent is created in 4 steps:
│ │ │ │ │     1. first the files that will be part of the torrent are determined.
│ │ │ │ │ @@ -66,60 +66,60 @@
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_r_e_a_t_e___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │  This class holds state for creating a torrent. After having added all
│ │ │ │ │  information to it, call _c_r_e_a_t_e___t_o_r_r_e_n_t_:_:_g_e_n_e_r_a_t_e_(_) to generate the torrent. The
│ │ │ │ │  _e_n_t_r_y that's returned can then be bencoded into a .torrent file using _b_e_n_c_o_d_e
│ │ │ │ │  _(_).
│ │ │ │ │  struct create_torrent
│ │ │ │ │  {
│ │ │ │ │ +   explicit ccrreeaattee__ttoorrrreenntt (torrent_info const& ti);
│ │ │ │ │     explicit ccrreeaattee__ttoorrrreenntt (file_storage& fs, int piece_size = 0
│ │ │ │ │        , create_flags_t flags = {});
│ │ │ │ │ -   explicit ccrreeaattee__ttoorrrreenntt (torrent_info const& ti);
│ │ │ │ │ -   std::vector<char> ggeenneerraattee__bbuuff () const;
│ │ │ │ │     entry ggeenneerraattee () const;
│ │ │ │ │ +   std::vector<char> ggeenneerraattee__bbuuff () const;
│ │ │ │ │     file_storage const& ffiilleess () const;
│ │ │ │ │     void sseett__ccoommmmeenntt (char const* str);
│ │ │ │ │     void sseett__ccrreeaattoorr (char const* str);
│ │ │ │ │     void sseett__ccrreeaattiioonn__ddaattee (std::time_t timestamp);
│ │ │ │ │     void sseett__hhaasshh (piece_index_t index, sha1_hash const& h);
│ │ │ │ │     void sseett__hhaasshh22 (file_index_t file, piece_index_t::diff_type piece,
│ │ │ │ │  sha256_hash const& h);
│ │ │ │ │     void aadddd__uurrll__sseeeedd (string_view url);
│ │ │ │ │     void aadddd__hhttttpp__sseeeedd (string_view url);
│ │ │ │ │     void aadddd__nnooddee (std::pair<std::string, int> node);
│ │ │ │ │     void aadddd__ttrraacckkeerr (string_view url, int tier = 0);
│ │ │ │ │     void sseett__rroooott__cceerrtt (string_view cert);
│ │ │ │ │     bool pprriivv () const;
│ │ │ │ │     void sseett__pprriivv (bool p);
│ │ │ │ │ -   bool iiss__vv11__oonnllyy () const;
│ │ │ │ │     bool iiss__vv22__oonnllyy () const;
│ │ │ │ │ +   bool iiss__vv11__oonnllyy () const;
│ │ │ │ │     int nnuumm__ppiieecceess () const;
│ │ │ │ │     piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │     index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │     file_index_t eenndd__ffiillee () const;
│ │ │ │ │     index_range<file_index_t> ffiillee__rraannggee () const noexcept;
│ │ │ │ │     index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t f);
│ │ │ │ │     std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ -   int ppiieeccee__lleennggtthh () const;
│ │ │ │ │     int ppiieeccee__ssiizzee (piece_index_t i) const;
│ │ │ │ │ -   void aadddd__ssiimmiillaarr__ttoorrrreenntt (sha1_hash ih);
│ │ │ │ │ +   int ppiieeccee__lleennggtthh () const;
│ │ │ │ │     void aadddd__ccoolllleeccttiioonn (string_view c);
│ │ │ │ │ +   void aadddd__ssiimmiillaarr__ttoorrrreenntt (sha1_hash ih);
│ │ │ │ │  
│ │ │ │ │     static constexpr create_flags_t mmooddiiffiiccaattiioonn__ttiimmee  = 2_bit;
│ │ │ │ │     static constexpr create_flags_t ssyymmlliinnkkss  = 3_bit;
│ │ │ │ │     static constexpr create_flags_t vv22__oonnllyy  = 5_bit;
│ │ │ │ │     static constexpr create_flags_t vv11__oonnllyy  = 6_bit;
│ │ │ │ │     static constexpr create_flags_t ccaannoonniiccaall__ffiilleess  = 7_bit;
│ │ │ │ │     static constexpr create_flags_t nnoo__aattttrriibbuutteess  = 8_bit;
│ │ │ │ │     static constexpr create_flags_t ccaannoonniiccaall__ffiilleess__nnoo__ttaaiill__ppaaddddiinngg  = 9_bit;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ccrreeaattee__ttoorrrreenntt(()) **********
│ │ │ │ │ +explicit ccrreeaattee__ttoorrrreenntt (torrent_info const& ti);
│ │ │ │ │  explicit ccrreeaattee__ttoorrrreenntt (file_storage& fs, int piece_size = 0
│ │ │ │ │        , create_flags_t flags = {});
│ │ │ │ │ -explicit ccrreeaattee__ttoorrrreenntt (torrent_info const& ti);
│ │ │ │ │  The piece_size is the size of each piece in bytes. It must be a power of 2 and
│ │ │ │ │  a minimum of 16 kiB. If a piece size of 0 is specified, a piece_size will be
│ │ │ │ │  set automatically. Piece sizes greater than 128 MiB are considered unreasonable
│ │ │ │ │  and will be rejected (with an lt::system_error exception).
│ │ │ │ │  The flags arguments specifies options for the torrent creation. It can be any
│ │ │ │ │  combination of the flags defined by create_flags_t.
│ │ │ │ │  The _f_i_l_e___s_t_o_r_a_g_e (fs) parameter defines the files, sizes and their properties
│ │ │ │ │ @@ -131,17 +131,17 @@
│ │ │ │ │  functions of _c_r_e_a_t_e___t_o_r_r_e_n_t that affects the content of the info dictionary
│ │ │ │ │  (such as _s_e_t___h_a_s_h_(_)), will have any affect. Instead of using this overload,
│ │ │ │ │  consider using _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_) instead.
│ │ │ │ │  Warning
│ │ │ │ │  The _f_i_l_e___s_t_o_r_a_g_e and _t_o_r_r_e_n_t___i_n_f_o objects must stay alive for the entire
│ │ │ │ │  duration of the _c_r_e_a_t_e___t_o_r_r_e_n_t object.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeenneerraattee__bbuuff(()) ggeenneerraattee(()) **********
│ │ │ │ │ -std::vector<char> ggeenneerraattee__bbuuff () const;
│ │ │ │ │ +********** ggeenneerraattee(()) ggeenneerraattee__bbuuff(()) **********
│ │ │ │ │  entry ggeenneerraattee () const;
│ │ │ │ │ +std::vector<char> ggeenneerraattee__bbuuff () const;
│ │ │ │ │  This function will generate the .torrent file as a bencode tree, or a bencoded
│ │ │ │ │  into a buffer. In order to encode the _e_n_t_r_y into a flat file, use the _b_e_n_c_o_d_e_(_)
│ │ │ │ │  function.
│ │ │ │ │  The function returning an _e_n_t_r_y may be useful to add custom entries to the
│ │ │ │ │  torrent file before bencoding it and saving it to disk.
│ │ │ │ │  Whether the resulting torrent object is v1, v2 or hybrid depends on whether any
│ │ │ │ │  of the v1_only or v2_only flags were set on the constructor. If neither were
│ │ │ │ │ @@ -198,15 +198,15 @@
│ │ │ │ │  the merkle tree formed by the piece's 16 kiB blocks. Note that piece sizes must
│ │ │ │ │  be powers-of-2, so all per-piece merkle trees are complete. A SHA-256 hash of
│ │ │ │ │  all zeros is internally used to indicate a hash that has not been set. Setting
│ │ │ │ │  such hash will not be considered set when calling _g_e_n_e_r_a_t_e_(_). This function
│ │ │ │ │  will throw std::system_error if it is called on an object constructed with the
│ │ │ │ │  v1_only flag.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__uurrll__sseeeedd(()) aadddd__hhttttpp__sseeeedd(()) **********
│ │ │ │ │ +********** aadddd__hhttttpp__sseeeedd(()) aadddd__uurrll__sseeeedd(()) **********
│ │ │ │ │  void aadddd__uurrll__sseeeedd (string_view url);
│ │ │ │ │  void aadddd__hhttttpp__sseeeedd (string_view url);
│ │ │ │ │  This adds a url seed to the torrent. You can have any number of url seeds. For
│ │ │ │ │  a single file torrent, this should be an HTTP url, pointing to a file with
│ │ │ │ │  identical content as the file of the torrent. For a multi-file torrent, it
│ │ │ │ │  should point to a directory containing a directory with the same name as this
│ │ │ │ │  torrent, and all the files of the torrent in it.
│ │ │ │ │ @@ -235,15 +235,15 @@
│ │ │ │ │  makes the torrent an SSSSLL ttoorrrreenntt. An SSL torrent requires that each peer has a
│ │ │ │ │  valid certificate signed by this root certificate. For SSL torrents, all peers
│ │ │ │ │  are connecting over SSL connections. For more information, see the section on
│ │ │ │ │  _s_s_l_ _t_o_r_r_e_n_t_s.
│ │ │ │ │  The string is not the path to the cert, it's the actual content of the
│ │ │ │ │  certificate.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** pprriivv(()) sseett__pprriivv(()) **********
│ │ │ │ │ +********** sseett__pprriivv(()) pprriivv(()) **********
│ │ │ │ │  bool pprriivv () const;
│ │ │ │ │  void sseett__pprriivv (bool p);
│ │ │ │ │  Sets and queries the private flag of the torrent. Torrents with the private
│ │ │ │ │  flag set ask the client to not use any other sources than the tracker for
│ │ │ │ │  peers, and to not use DHT to advertise itself publicly, only the tracker.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** nnuumm__ppiieecceess(()) **********
│ │ │ │ │ @@ -263,24 +263,24 @@
│ │ │ │ │  for v2 and hybrid torrents only, the pieces in the specified file, specified as
│ │ │ │ │  delta from the first piece in the file. i.e. the first index is 0.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ttoottaall__ssiizzee(()) **********
│ │ │ │ │  std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │  the total number of bytes of all files and pad files
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__ssiizzee(()) ppiieeccee__lleennggtthh(()) **********
│ │ │ │ │ -int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ +********** ppiieeccee__lleennggtthh(()) ppiieeccee__ssiizzee(()) **********
│ │ │ │ │  int ppiieeccee__ssiizzee (piece_index_t i) const;
│ │ │ │ │ +int ppiieeccee__lleennggtthh () const;
│ │ │ │ │  piece_length() returns the piece size of all pieces but the last one.
│ │ │ │ │  piece_size() returns the size of the specified piece. these functions are just
│ │ │ │ │  forwarding to the associated _f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aadddd__ssiimmiillaarr__ttoorrrreenntt(()) aadddd__ccoolllleeccttiioonn(()) **********
│ │ │ │ │ -void aadddd__ssiimmiillaarr__ttoorrrreenntt (sha1_hash ih);
│ │ │ │ │  void aadddd__ccoolllleeccttiioonn (string_view c);
│ │ │ │ │ +void aadddd__ssiimmiillaarr__ttoorrrreenntt (sha1_hash ih);
│ │ │ │ │  Add similar torrents (by info-hash) or collections of similar torrents. Similar
│ │ │ │ │  torrents are expected to share some files with this torrent. Torrents sharing a
│ │ │ │ │  collection name with this torrent are also expected to share files with this
│ │ │ │ │  torrent. A torrent may have more than one collection and more than one similar
│ │ │ │ │  torrents. For more information, see _B_E_P_ _3_8.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    modification_time
│ │ │ │ │ @@ -349,29 +349,29 @@
│ │ │ │ │  The ".." directory is never traversed.
│ │ │ │ │  The flags argument should be the same as the flags passed to the _c_r_e_a_t_e___t_o_r_r_e_n_t
│ │ │ │ │  constructor.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ sseett__ppiieeccee__hhaasshheess(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_r_e_a_t_e___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │  void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ -   , settings_interface const& settings
│ │ │ │ │     , std::function<void(piece_index_t)> const& f, error_code& ec);
│ │ │ │ │ +inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p,
│ │ │ │ │ +error_code& ec);
│ │ │ │ │  void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ +   , settings_interface const& settings, disk_io_constructor_type disk_io
│ │ │ │ │     , std::function<void(piece_index_t)> const& f, error_code& ec);
│ │ │ │ │  inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p);
│ │ │ │ │ +void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ +   , settings_interface const& settings
│ │ │ │ │ +   , std::function<void(piece_index_t)> const& f, error_code& ec);
│ │ │ │ │  inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ +   , settings_interface const& settings
│ │ │ │ │     , std::function<void(piece_index_t)> const& f);
│ │ │ │ │  inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ -   , settings_interface const& settings
│ │ │ │ │     , std::function<void(piece_index_t)> const& f);
│ │ │ │ │ -inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p,
│ │ │ │ │ -error_code& ec);
│ │ │ │ │ -void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ -   , settings_interface const& settings, disk_io_constructor_type disk_io
│ │ │ │ │ -   , std::function<void(piece_index_t)> const& f, error_code& ec);
│ │ │ │ │  This function will assume that the files added to the torrent file exists at
│ │ │ │ │  path p, read those files and hash the content and set the hashes in the
│ │ │ │ │  create_torrent object. The optional function f is called in between every hash
│ │ │ │ │  that is set. f must have the following signature:
│ │ │ │ │  void Fun(piece_index_t);
│ │ │ │ │  The overloads taking a _s_e_t_t_i_n_g_s___p_a_c_k may be used to configure the underlying
│ │ │ │ │  disk access. Such as settings_pack::aio_threads.
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Custom_Storage.html
│ │ │ │ @@ -28,85 +28,443 @@
│ │ │ │  <td>2.0.11</td></tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │ -<li><a class="reference internal" href="#disk-observer" id="toc-entry-1">disk_observer</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#on-disk" id="toc-entry-2">on_disk()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#settings-interface" id="toc-entry-1">settings_interface</a></li>
│ │ │ │ +<li><a class="reference internal" href="#buffer-allocator-interface" id="toc-entry-2">buffer_allocator_interface</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disk-buffer-holder" id="toc-entry-3">disk_buffer_holder</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#disk-buffer-holder-1" id="toc-entry-4">disk_buffer_holder()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disk-buffer-holder-2" id="toc-entry-5">disk_buffer_holder()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disk-buffer-holder-3" id="toc-entry-6">~disk_buffer_holder()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#data" id="toc-entry-7">data()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#reset" id="toc-entry-8">reset()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#swap" id="toc-entry-9">swap()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#is-mutable" id="toc-entry-10">is_mutable()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bool" id="toc-entry-11">bool()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#open-file-state" id="toc-entry-3">open_file_state</a></li>
│ │ │ │ -<li><a class="reference internal" href="#disk-interface" id="toc-entry-4">disk_interface</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#new-torrent" id="toc-entry-5">new_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#remove-torrent" id="toc-entry-6">remove_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-read-async-write" id="toc-entry-7">async_read() async_write()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-hash" id="toc-entry-8">async_hash()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-hash2" id="toc-entry-9">async_hash2()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-move-storage" id="toc-entry-10">async_move_storage()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-release-files" id="toc-entry-11">async_release_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-check-files" id="toc-entry-12">async_check_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-stop-torrent" id="toc-entry-13">async_stop_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-rename-file" id="toc-entry-14">async_rename_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-delete-files" id="toc-entry-15">async_delete_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-set-file-priority" id="toc-entry-16">async_set_file_priority()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-clear-piece" id="toc-entry-17">async_clear_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#update-stats-counters" id="toc-entry-18">update_stats_counters()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-status" id="toc-entry-19">get_status()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#abort" id="toc-entry-20">abort()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#submit-jobs" id="toc-entry-21">submit_jobs()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#settings-updated" id="toc-entry-22">settings_updated()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#open-file-state" id="toc-entry-12">open_file_state</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disk-interface" id="toc-entry-13">disk_interface</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#new-torrent" id="toc-entry-14">new_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#remove-torrent" id="toc-entry-15">remove_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-read-async-write" id="toc-entry-16">async_read() async_write()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-hash" id="toc-entry-17">async_hash()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-hash2" id="toc-entry-18">async_hash2()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-move-storage" id="toc-entry-19">async_move_storage()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-release-files" id="toc-entry-20">async_release_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-check-files" id="toc-entry-21">async_check_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-stop-torrent" id="toc-entry-22">async_stop_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-rename-file" id="toc-entry-23">async_rename_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-delete-files" id="toc-entry-24">async_delete_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-set-file-priority" id="toc-entry-25">async_set_file_priority()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-clear-piece" id="toc-entry-26">async_clear_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#update-stats-counters" id="toc-entry-27">update_stats_counters()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-status" id="toc-entry-28">get_status()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#abort" id="toc-entry-29">abort()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#submit-jobs" id="toc-entry-30">submit_jobs()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#settings-updated" id="toc-entry-31">settings_updated()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#storage-holder" id="toc-entry-23">storage_holder</a></li>
│ │ │ │ -<li><a class="reference internal" href="#settings-interface" id="toc-entry-24">settings_interface</a></li>
│ │ │ │ -<li><a class="reference internal" href="#buffer-allocator-interface" id="toc-entry-25">buffer_allocator_interface</a></li>
│ │ │ │ -<li><a class="reference internal" href="#disk-buffer-holder" id="toc-entry-26">disk_buffer_holder</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#disk-buffer-holder-1" id="toc-entry-27">disk_buffer_holder()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#disk-buffer-holder-2" id="toc-entry-28">disk_buffer_holder()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#disk-buffer-holder-3" id="toc-entry-29">~disk_buffer_holder()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#data" id="toc-entry-30">data()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#reset" id="toc-entry-31">reset()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#swap" id="toc-entry-32">swap()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#is-mutable" id="toc-entry-33">is_mutable()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#bool" id="toc-entry-34">bool()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#storage-holder" id="toc-entry-32">storage_holder</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disk-observer" id="toc-entry-33">disk_observer</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#on-disk" id="toc-entry-34">on_disk()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  <li><a class="reference internal" href="#file-open-mode-t" id="toc-entry-35">file_open_mode_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │ -<p>You have some control over <a class="reference external" href="reference-Session.html#session">session</a> configuration through the session::apply_settings()
│ │ │ │ -member function. To change one or more configuration options, create a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>
│ │ │ │ -object and fill it with the settings to be set and pass it in to session::apply_settings().</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> object is a collection of settings updates that are applied
│ │ │ │ -to the <a class="reference external" href="reference-Session.html#session">session</a> when passed to session::apply_settings(). It's empty when
│ │ │ │ -constructed.</p>
│ │ │ │ -<p>You have control over proxy and authorization settings and also the user-agent
│ │ │ │ -that will be sent to the tracker. The user-agent will also be used to identify the
│ │ │ │ -client with other peers.</p>
│ │ │ │ -<p>Each configuration option is named with an enum value inside the
│ │ │ │ -<a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> class. These are the available settings:</p>
│ │ │ │ -<a name="disk_observer"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+disk_observer&labels=documentation&body=Documentation+under+heading+%22class+disk_observer%22+could+be+improved">report issue</a>]</span><div class="section" id="disk-observer">
│ │ │ │ -<h1>disk_observer</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_observer.hpp">libtorrent/disk_observer.hpp</a>&quot;</p>
│ │ │ │ +<p>The disk I/O can be customized in libtorrent. In previous versions, the
│ │ │ │ +customization was at the level of each torrent. Now, the customization point
│ │ │ │ +is at the <a class="reference external" href="reference-Session.html#session">session</a> level. All torrents added to a <a class="reference external" href="reference-Session.html#session">session</a> will use the same
│ │ │ │ +disk I/O subsystem, as determined by the disk_io_constructor (in
│ │ │ │ +<a class="reference external" href="reference-Session.html#session_params">session_params</a>).</p>
│ │ │ │ +<p>This allows the disk subsystem to also customize threading and disk job
│ │ │ │ +management.</p>
│ │ │ │ +<p>To customize the disk subsystem, implement <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a> and provide a
│ │ │ │ +factory function to the <a class="reference external" href="reference-Session.html#session">session</a> constructor (via <a class="reference external" href="reference-Session.html#session_params">session_params</a>).</p>
│ │ │ │ +<p>Example use:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="keyword">struct</span><span class="whitespace"> </span><span class="name class">temp_storage</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword">explicit</span><span class="whitespace"> </span><span class="name">temp_storage</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">file_storage</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">fs</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">(</span><span class="name">fs</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">readv</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">peer_request</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">auto</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">i</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">find</span><span class="punctuation">(</span><span class="name">r</span><span class="punctuation">.</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">i</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">end</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">operation</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">operation_t</span><span class="operator">::</span><span class="name">file_read</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">ec</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">boost</span><span class="operator">::</span><span class="name">asio</span><span class="operator">::</span><span class="name">error</span><span class="operator">::</span><span class="name">eof</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{};</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="keyword type">int</span><span class="punctuation">(</span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="operator">&lt;=</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">start</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">operation</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">operation_t</span><span class="operator">::</span><span class="name">file_read</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">ec</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">boost</span><span class="operator">::</span><span class="name">asio</span><span class="operator">::</span><span class="name">error</span><span class="operator">::</span><span class="name">eof</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{};</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace"> </span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">start</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">min</span><span class="punctuation">(</span><span class="name">r</span><span class="punctuation">.</span><span class="name">length</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="punctuation">(</span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">start</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">};</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">writev</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">b</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">auto</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">data</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">[</span><span class="name">piece</span><span class="punctuation">];</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">data</span><span class="punctuation">.</span><span class="name">empty</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="comment single">// allocate the whole piece, otherwise we'll invalidate the pointers
│ │ │ │ +</span><span class="whitespace">      </span><span class="comment single">// we have returned back to libtorrent
│ │ │ │ +</span><span class="whitespace">      </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">size</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">piece_size</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">data</span><span class="punctuation">.</span><span class="name">resize</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="keyword type">size_t</span><span class="punctuation">(</span><span class="name">size</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">TORRENT_ASSERT</span><span class="punctuation">(</span><span class="name">offset</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">b</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">&lt;=</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="punctuation">(</span><span class="name">data</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">()));</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">std</span><span class="operator">::</span><span class="name">memcpy</span><span class="punctuation">(</span><span class="name">data</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">b</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="keyword type">size_t</span><span class="punctuation">(</span><span class="name">b</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">()));</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha1_hash</span><span class="whitespace"> </span><span class="name">hash</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">sha256_hash</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">block_hashes</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">auto</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">i</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">find</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">i</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">end</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">operation</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">operation_t</span><span class="operator">::</span><span class="name">file_read</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">ec</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">boost</span><span class="operator">::</span><span class="name">asio</span><span class="operator">::</span><span class="name">error</span><span class="operator">::</span><span class="name">eof</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{};</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="operator">!</span><span class="name">block_hashes</span><span class="punctuation">.</span><span class="name">empty</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece_size2</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_size2</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">blocks_in_piece2</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">blocks_in_piece2</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">buf</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">std</span><span class="operator">::</span><span class="keyword type">int64_t</span><span class="whitespace"> </span><span class="name">offset</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="literal number integer">0</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="keyword type">int</span><span class="whitespace"> </span><span class="name">k</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="literal number integer">0</span><span class="punctuation">;</span><span class="whitespace"> </span><span class="name">k</span><span class="whitespace"> </span><span class="operator">&lt;</span><span class="whitespace"> </span><span class="name">blocks_in_piece2</span><span class="punctuation">;</span><span class="whitespace"> </span><span class="operator">++</span><span class="name">k</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +      </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">lt</span><span class="operator">::</span><span class="name">hasher256</span><span class="whitespace"> </span><span class="name">h2</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">std</span><span class="operator">::</span><span class="keyword type">ptrdiff_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">len2</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">min</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">default_block_size</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="punctuation">(</span><span class="name">piece_size2</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">h2</span><span class="punctuation">.</span><span class="name">update</span><span class="punctuation">({</span><span class="whitespace"> </span><span class="name">buf</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">len2</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">buf</span><span class="whitespace"> </span><span class="operator">+=</span><span class="whitespace"> </span><span class="name">len2</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">offset</span><span class="whitespace"> </span><span class="operator">+=</span><span class="whitespace"> </span><span class="name">len2</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">block_hashes</span><span class="punctuation">[</span><span class="name">k</span><span class="punctuation">]</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">h2</span><span class="punctuation">.</span><span class="keyword">final</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +      </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">hasher</span><span class="punctuation">(</span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">).</span><span class="keyword">final</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha256_hash</span><span class="whitespace"> </span><span class="name">hash2</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">auto</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">i</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">find</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">i</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">end</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">operation</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">operation_t</span><span class="operator">::</span><span class="name">file_read</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">ec</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">boost</span><span class="operator">::</span><span class="name">asio</span><span class="operator">::</span><span class="name">error</span><span class="operator">::</span><span class="name">eof</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{};</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece_size</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_size2</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="name">std</span><span class="operator">::</span><span class="keyword type">ptrdiff_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">len</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">min</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">default_block_size</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">piece_size</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">b</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">len</span><span class="punctuation">};</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">hasher256</span><span class="punctuation">(</span><span class="name">b</span><span class="punctuation">).</span><span class="keyword">final</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="keyword">private</span><span class="operator">:</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="name">piece_size</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="name">piece</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">num_pieces</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="keyword type">int</span><span class="operator">&gt;</span><span class="punctuation">((</span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">total_size</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_length</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="operator">/</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_length</span><span class="punctuation">());</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="keyword type">int</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="operator">&lt;</span><span class="whitespace"> </span><span class="name">num_pieces</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="whitespace">
│ │ │ │ +      </span><span class="operator">?</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_length</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="keyword type">int</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">total_size</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="keyword type">int64_t</span><span class="punctuation">(</span><span class="name">num_pieces</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="operator">*</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_length</span><span class="punctuation">());</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_storage</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">std</span><span class="operator">::</span><span class="name">map</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;&gt;</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">};</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="name function">pop</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="operator">&gt;&amp;</span><span class="whitespace"> </span><span class="name">q</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">TORRENT_ASSERT</span><span class="punctuation">(</span><span class="operator">!</span><span class="name">q</span><span class="punctuation">.</span><span class="name">empty</span><span class="punctuation">());</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">ret</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">q</span><span class="punctuation">.</span><span class="name">back</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">q</span><span class="punctuation">.</span><span class="name">pop_back</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name">ret</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="keyword">struct</span><span class="whitespace"> </span><span class="name class">temp_disk_io</span><span class="whitespace"> </span><span class="keyword">final</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_interface</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">buffer_allocator_interface</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword">explicit</span><span class="whitespace"> </span><span class="name">temp_disk_io</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">io_context</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">ioc</span><span class="punctuation">)</span><span class="operator">:</span><span class="whitespace"> </span><span class="name">m_ioc</span><span class="punctuation">(</span><span class="name">ioc</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">settings_updated</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_holder</span><span class="whitespace"> </span><span class="name">new_torrent</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_params</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">params</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">idx</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_free_slots</span><span class="punctuation">.</span><span class="name">empty</span><span class="punctuation">()</span><span class="whitespace">
│ │ │ │ +      </span><span class="operator">?</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">.</span><span class="name">end_index</span><span class="punctuation">()</span><span class="whitespace">
│ │ │ │ +      </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">pop</span><span class="punctuation">(</span><span class="name">m_free_slots</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">auto</span><span class="whitespace"> </span><span class="name">storage</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">make_unique</span><span class="operator">&lt;</span><span class="name">temp_storage</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">params</span><span class="punctuation">.</span><span class="name">files</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">idx</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">.</span><span class="name">end_index</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">.</span><span class="name">emplace_back</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">move</span><span class="punctuation">(</span><span class="name">storage</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">else</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">idx</span><span class="punctuation">]</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">move</span><span class="punctuation">(</span><span class="name">storage</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_holder</span><span class="punctuation">(</span><span class="name">idx</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="operator">*</span><span class="keyword">this</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">remove_torrent</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">idx</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">idx</span><span class="punctuation">].</span><span class="name">reset</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">m_free_slots</span><span class="punctuation">.</span><span class="name">push_back</span><span class="punctuation">(</span><span class="name">idx</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">abort</span><span class="punctuation">(</span><span class="keyword type">bool</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_read</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="name">storage</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">peer_request</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">r</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_buffer_holder</span><span class="whitespace"> </span><span class="name">block</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">se</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_job_flags_t</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="comment single">// this buffer is owned by the storage. It will remain valid for as
│ │ │ │ +</span><span class="whitespace">    </span><span class="comment single">// long as the torrent remains in the session. We don't need any lifetime
│ │ │ │ +</span><span class="whitespace">    </span><span class="comment single">// management of it.
│ │ │ │ +</span><span class="whitespace">    </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">b</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">storage</span><span class="punctuation">]</span><span class="operator">-&gt;</span><span class="name">readv</span><span class="punctuation">(</span><span class="name">r</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="name">handler</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">b</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword">this</span><span class="punctuation">]</span><span class="whitespace">
│ │ │ │ +      </span><span class="punctuation">{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_buffer_holder</span><span class="punctuation">(</span><span class="operator">*</span><span class="keyword">this</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword">const_cast</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">*&gt;</span><span class="punctuation">(</span><span class="name">b</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">()),</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="punctuation">(</span><span class="name">b</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">())),</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">bool</span><span class="whitespace"> </span><span class="name">async_write</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="name">storage</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">peer_request</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">r</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">buf</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_observer</span><span class="operator">&gt;</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_job_flags_t</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">b</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace"> </span><span class="name">buf</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">length</span><span class="whitespace"> </span><span class="punctuation">};</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">storage</span><span class="punctuation">]</span><span class="operator">-&gt;</span><span class="name">writev</span><span class="punctuation">(</span><span class="name">b</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">start</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">());</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name builtin">false</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_hash</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="name">storage</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">sha256_hash</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">block_hashes</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_job_flags_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha1_hash</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha1_hash</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">hash</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">storage</span><span class="punctuation">]</span><span class="operator">-&gt;</span><span class="name">hash</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">block_hashes</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">hash</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_hash2</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="name">storage</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_job_flags_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha256_hash</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha256_hash</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">hash</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">storage</span><span class="punctuation">]</span><span class="operator">-&gt;</span><span class="name">hash2</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">hash</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_move_storage</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="name">p</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">move_flags_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">status_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">status_t</span><span class="operator">::</span><span class="name">fatal_disk_error</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">p</span><span class="whitespace">
│ │ │ │ +        </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">error_code</span><span class="punctuation">(</span><span class="name">boost</span><span class="operator">::</span><span class="name">system</span><span class="operator">::</span><span class="name">errc</span><span class="operator">::</span><span class="name">operation_not_supported</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">system_category</span><span class="punctuation">())));</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_release_files</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">()</span><span class="operator">&gt;</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_delete_files</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">remove_flags_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">());</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_check_files</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">add_torrent_params</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">*</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">aux</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_index_t</span><span class="operator">&gt;</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">status_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">status_t</span><span class="operator">::</span><span class="name">no_error</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">());</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_rename_file</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">idx</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">name</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">name</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">idx</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">());</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_stop_torrent</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">()</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_set_file_priority</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">aux</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">download_priority_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_index_t</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">prio</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace">
│ │ │ │ +      </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">aux</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">download_priority_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_index_t</span><span class="operator">&gt;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">error_code</span><span class="punctuation">(</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">boost</span><span class="operator">::</span><span class="name">system</span><span class="operator">::</span><span class="name">errc</span><span class="operator">::</span><span class="name">operation_not_supported</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">system_category</span><span class="punctuation">())),</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">move</span><span class="punctuation">(</span><span class="name">prio</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_clear_piece</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="name">index</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">index</span><span class="punctuation">);</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="comment single">// implements buffer_allocator_interface
│ │ │ │ +</span><span class="whitespace">  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">free_disk_buffer</span><span class="punctuation">(</span><span class="keyword type">char</span><span class="operator">*</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="comment single">// never free any buffer. We only return buffers owned by the storage
│ │ │ │ +</span><span class="whitespace">    </span><span class="comment single">// object
│ │ │ │ +</span><span class="whitespace">  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">update_stats_counters</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">counters</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">open_file_state</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">get_status</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace"> </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{};</span><span class="whitespace"> </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">submit_jobs</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="keyword">private</span><span class="operator">:</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">aux</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="name">temp_storage</span><span class="operator">&gt;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="comment single">// slots that are unused in the m_torrents vector
│ │ │ │ +</span><span class="whitespace">  </span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">m_free_slots</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="comment single">// callbacks are posted on this
│ │ │ │ +</span><span class="whitespace">  </span><span class="name">lt</span><span class="operator">::</span><span class="name">io_context</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">m_ioc</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">};</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="name">std</span><span class="operator">::</span><span class="name">unique_ptr</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_interface</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">temp_disk_constructor</span><span class="punctuation">(</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">io_context</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">settings_interface</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">counters</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">make_unique</span><span class="operator">&lt;</span><span class="name">temp_disk_io</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">ioc</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">}</span>
│ │ │ │ +</pre>
│ │ │ │ +<a name="settings_interface"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+settings_interface&labels=documentation&body=Documentation+under+heading+%22class+settings_interface%22+could+be+improved">report issue</a>]</span><div class="section" id="settings-interface">
│ │ │ │ +<h1>settings_interface</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<p>the common interface to <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> and the internal representation of
│ │ │ │ +settings.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct disk_observer
│ │ │ │ +struct settings_interface
│ │ │ │  {
│ │ │ │ -   virtual void <strong>on_disk</strong> () = 0;
│ │ │ │ +   virtual void <strong>set_str</strong> (int name, std::string val) = 0;
│ │ │ │ +   virtual void <strong>set_int</strong> (int name, int val) = 0;
│ │ │ │ +   virtual void <strong>set_bool</strong> (int name, bool val) = 0;
│ │ │ │ +   virtual bool <strong>has_val</strong> (int name) const = 0;
│ │ │ │ +   virtual int <strong>get_int</strong> (int name) const = 0;
│ │ │ │ +   virtual bool <strong>get_bool</strong> (int name) const = 0;
│ │ │ │ +   virtual std::string const&amp; <strong>get_str</strong> (int name) const = 0;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="on_disk()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_observer%3A%3A%5Bon_disk%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_observer%3A%3A%5Bon_disk%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="on-disk">
│ │ │ │ -<h2>on_disk()</h2>
│ │ │ │ +<a name="buffer_allocator_interface"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+buffer_allocator_interface&labels=documentation&body=Documentation+under+heading+%22class+buffer_allocator_interface%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="buffer-allocator-interface">
│ │ │ │ +<h1>buffer_allocator_interface</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_buffer_holder.hpp">libtorrent/disk_buffer_holder.hpp</a>&quot;</p>
│ │ │ │ +<p>the interface for freeing disk buffers, used by the <a class="reference external" href="reference-Custom_Storage.html#disk_buffer_holder">disk_buffer_holder</a>.
│ │ │ │ +when implementing <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a>, this must also be implemented in order
│ │ │ │ +to return disk buffers back to libtorrent</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -virtual void <strong>on_disk</strong> () = 0;
│ │ │ │ +struct buffer_allocator_interface
│ │ │ │ +{
│ │ │ │ +   virtual void <strong>free_disk_buffer</strong> (char* b) = 0;
│ │ │ │ +};
│ │ │ │  </pre>
│ │ │ │ -<p>called when the disk cache size has dropped
│ │ │ │ -below the low watermark again and we can
│ │ │ │ -resume downloading from peers</p>
│ │ │ │ +<a name="disk_buffer_holder"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+disk_buffer_holder&labels=documentation&body=Documentation+under+heading+%22class+disk_buffer_holder%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="disk-buffer-holder">
│ │ │ │ +<h1>disk_buffer_holder</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_buffer_holder.hpp">libtorrent/disk_buffer_holder.hpp</a>&quot;</p>
│ │ │ │ +<p>The disk buffer holder acts like a <tt class="docutils literal">unique_ptr</tt> that frees a disk buffer
│ │ │ │ +when it's destructed</p>
│ │ │ │ +<p>If this buffer holder is moved-from, default constructed or reset,
│ │ │ │ +<tt class="docutils literal">data()</tt> will return nullptr.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct disk_buffer_holder
│ │ │ │ +{
│ │ │ │ +   <strong>disk_buffer_holder</strong> (disk_buffer_holder&amp;&amp;) noexcept;
│ │ │ │ +   disk_buffer_holder&amp; <strong>operator=</strong> (disk_buffer_holder&amp;&amp;) &amp; noexcept;
│ │ │ │ +   <strong>disk_buffer_holder</strong> (disk_buffer_holder const&amp;) = delete;
│ │ │ │ +   disk_buffer_holder&amp; <strong>operator=</strong> (disk_buffer_holder const&amp;) = delete;
│ │ │ │ +   <strong>disk_buffer_holder</strong> (buffer_allocator_interface&amp; alloc
│ │ │ │ +      , char* buf, int sz) noexcept;
│ │ │ │ +   <strong>disk_buffer_holder</strong> () noexcept = default;
│ │ │ │ +   <strong>~disk_buffer_holder</strong> ();
│ │ │ │ +   char* <strong>data</strong> () const noexcept;
│ │ │ │ +   void <strong>reset</strong> ();
│ │ │ │ +   void <strong>swap</strong> (disk_buffer_holder&amp; h) noexcept;
│ │ │ │ +   bool <strong>is_mutable</strong> () const noexcept;
│ │ │ │ +   explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ +   std::ptrdiff_t <strong>size</strong> () const;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="disk-buffer-holder-1">
│ │ │ │ +<h2>disk_buffer_holder()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>disk_buffer_holder</strong> (buffer_allocator_interface&amp; alloc
│ │ │ │ +      , char* buf, int sz) noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>construct a buffer holder that will free the held buffer
│ │ │ │ +using a disk buffer pool directly (there's only one
│ │ │ │ +disk_buffer_pool per <a class="reference external" href="reference-Session.html#session">session</a>)</p>
│ │ │ │ +<a name="disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="disk-buffer-holder-2">
│ │ │ │ +<h2>disk_buffer_holder()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>disk_buffer_holder</strong> () noexcept = default;
│ │ │ │ +</pre>
│ │ │ │ +<p>default construct a holder that does not own any buffer</p>
│ │ │ │ +<a name="~disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5B~disk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5B~disk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="disk-buffer-holder-3">
│ │ │ │ +<h2>~disk_buffer_holder()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>~disk_buffer_holder</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>frees disk buffer held by this object</p>
│ │ │ │ +<a name="data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdata%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdata%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="data">
│ │ │ │ +<h2>data()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char* <strong>data</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>return a pointer to the held buffer, if any. Otherwise returns nullptr.</p>
│ │ │ │ +<a name="reset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Breset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Breset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="reset">
│ │ │ │ +<h2>reset()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>reset</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>free the held disk buffer, if any, and clear the holder. This sets the
│ │ │ │ +holder object to a default-constructed state</p>
│ │ │ │ +<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="swap">
│ │ │ │ +<h2>swap()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>swap</strong> (disk_buffer_holder&amp; h) noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>swap pointers of two disk buffer holders.</p>
│ │ │ │ +<a name="is_mutable()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bis_mutable%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bis_mutable%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="is-mutable">
│ │ │ │ +<h2>is_mutable()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>is_mutable</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>if this returns true, the buffer may not be modified in place</p>
│ │ │ │ +<a name="bool()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bbool%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bbool%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="bool">
│ │ │ │ +<h2>bool()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>implicitly convertible to true if the object is currently holding a
│ │ │ │ +buffer</p>
│ │ │ │  <a name="open_file_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+open_file_state&labels=documentation&body=Documentation+under+heading+%22class+open_file_state%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │  <div class="section" id="open-file-state">
│ │ │ │  <h1>open_file_state</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_interface.hpp">libtorrent/disk_interface.hpp</a>&quot;</p>
│ │ │ │  <p>this contains information about a file that's currently open by the
│ │ │ │  libtorrent disk I/O subsystem. It's associated with a single torrent.</p>
│ │ │ │ @@ -152,21 +510,21 @@
│ │ │ │  the constructor. The callbacks will be run in the network thread.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct disk_interface
│ │ │ │  {
│ │ │ │     virtual storage_holder <strong>new_torrent</strong> (storage_params const&amp; p
│ │ │ │        , std::shared_ptr&lt;void&gt; const&amp; torrent) = 0;
│ │ │ │     virtual void <strong>remove_torrent</strong> (storage_index_t) = 0;
│ │ │ │ +   virtual void <strong>async_read</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ +      , std::function&lt;void(disk_buffer_holder, storage_error const&amp;)&gt; handler
│ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │     virtual bool <strong>async_write</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │        , char const* buf, std::shared_ptr&lt;disk_observer&gt; o
│ │ │ │        , std::function&lt;void(storage_error const&amp;)&gt; handler
│ │ │ │        , disk_job_flags_t flags = {}) = 0;
│ │ │ │ -   virtual void <strong>async_read</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ -      , std::function&lt;void(disk_buffer_holder, storage_error const&amp;)&gt; handler
│ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │     virtual void <strong>async_hash</strong> (storage_index_t storage, piece_index_t piece, span&lt;sha256_hash&gt; v2
│ │ │ │        , disk_job_flags_t flags
│ │ │ │        , std::function&lt;void(piece_index_t, sha1_hash const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │     virtual void <strong>async_hash2</strong> (storage_index_t storage, piece_index_t piece, int offset, disk_job_flags_t flags
│ │ │ │        , std::function&lt;void(piece_index_t, sha256_hash const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │     virtual void <strong>async_move_storage</strong> (storage_index_t storage, std::string p, move_flags_t flags
│ │ │ │        , std::function&lt;void(status_t, std::string const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ @@ -223,21 +581,21 @@
│ │ │ │  delete any files from disk, just to clean up any resources associated
│ │ │ │  with the specified storage.</p>
│ │ │ │  <a name="async_read()"></a>
│ │ │ │  <a name="async_write()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_read%28%29+async_write%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_read%28%29+async_write%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="async-read-async-write">
│ │ │ │  <h2>async_read() async_write()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +virtual void <strong>async_read</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ +      , std::function&lt;void(disk_buffer_holder, storage_error const&amp;)&gt; handler
│ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │  virtual bool <strong>async_write</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │        , char const* buf, std::shared_ptr&lt;disk_observer&gt; o
│ │ │ │        , std::function&lt;void(storage_error const&amp;)&gt; handler
│ │ │ │        , disk_job_flags_t flags = {}) = 0;
│ │ │ │ -virtual void <strong>async_read</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ -      , std::function&lt;void(disk_buffer_holder, storage_error const&amp;)&gt; handler
│ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │  </pre>
│ │ │ │  <p>perform a read or write operation from/to the specified storage
│ │ │ │  index and the specified request. When the operation completes, call
│ │ │ │  handler possibly with a <a class="reference external" href="reference-Custom_Storage.html#disk_buffer_holder">disk_buffer_holder</a>, holding the buffer with
│ │ │ │  the result. Flags may be set to affect the read operation. See
│ │ │ │  disk_job_flags_t.</p>
│ │ │ │  <p>The <a class="reference external" href="reference-Custom_Storage.html#disk_observer">disk_observer</a> is a callback to indicate that
│ │ │ │ @@ -489,143 +847,43 @@
│ │ │ │  for a torrent to the lifetime of the internal torrent object. When a
│ │ │ │  torrent is removed from the <a class="reference external" href="reference-Session.html#session">session</a>, this holder is destructed and will
│ │ │ │  inform the disk object.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct storage_holder
│ │ │ │  {
│ │ │ │     <strong>storage_holder</strong> (storage_index_t idx, disk_interface&amp; disk_io);
│ │ │ │ -   <strong>~storage_holder</strong> ();
│ │ │ │     <strong>storage_holder</strong> () = default;
│ │ │ │ +   <strong>~storage_holder</strong> ();
│ │ │ │     explicit operator <strong>bool</strong> () const;
│ │ │ │     operator <strong>storage_index_t</strong> () const;
│ │ │ │     void <strong>reset</strong> ();
│ │ │ │ -   storage_holder&amp; <strong>operator=</strong> (storage_holder const&amp;) = delete;
│ │ │ │     <strong>storage_holder</strong> (storage_holder const&amp;) = delete;
│ │ │ │ +   storage_holder&amp; <strong>operator=</strong> (storage_holder const&amp;) = delete;
│ │ │ │     <strong>storage_holder</strong> (storage_holder&amp;&amp; rhs) noexcept;
│ │ │ │     storage_holder&amp; <strong>operator=</strong> (storage_holder&amp;&amp; rhs) noexcept;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="settings_interface"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+settings_interface&labels=documentation&body=Documentation+under+heading+%22class+settings_interface%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="settings-interface">
│ │ │ │ -<h1>settings_interface</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ -<p>the common interface to <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> and the internal representation of
│ │ │ │ -settings.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct settings_interface
│ │ │ │ -{
│ │ │ │ -   virtual void <strong>set_int</strong> (int name, int val) = 0;
│ │ │ │ -   virtual bool <strong>has_val</strong> (int name) const = 0;
│ │ │ │ -   virtual void <strong>set_bool</strong> (int name, bool val) = 0;
│ │ │ │ -   virtual void <strong>set_str</strong> (int name, std::string val) = 0;
│ │ │ │ -   virtual bool <strong>get_bool</strong> (int name) const = 0;
│ │ │ │ -   virtual std::string const&amp; <strong>get_str</strong> (int name) const = 0;
│ │ │ │ -   virtual int <strong>get_int</strong> (int name) const = 0;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="buffer_allocator_interface"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+buffer_allocator_interface&labels=documentation&body=Documentation+under+heading+%22class+buffer_allocator_interface%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="buffer-allocator-interface">
│ │ │ │ -<h1>buffer_allocator_interface</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_buffer_holder.hpp">libtorrent/disk_buffer_holder.hpp</a>&quot;</p>
│ │ │ │ -<p>the interface for freeing disk buffers, used by the <a class="reference external" href="reference-Custom_Storage.html#disk_buffer_holder">disk_buffer_holder</a>.
│ │ │ │ -when implementing <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a>, this must also be implemented in order
│ │ │ │ -to return disk buffers back to libtorrent</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct buffer_allocator_interface
│ │ │ │ -{
│ │ │ │ -   virtual void <strong>free_disk_buffer</strong> (char* b) = 0;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="disk_buffer_holder"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+disk_buffer_holder&labels=documentation&body=Documentation+under+heading+%22class+disk_buffer_holder%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="disk-buffer-holder">
│ │ │ │ -<h1>disk_buffer_holder</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_buffer_holder.hpp">libtorrent/disk_buffer_holder.hpp</a>&quot;</p>
│ │ │ │ -<p>The disk buffer holder acts like a <tt class="docutils literal">unique_ptr</tt> that frees a disk buffer
│ │ │ │ -when it's destructed</p>
│ │ │ │ -<p>If this buffer holder is moved-from, default constructed or reset,
│ │ │ │ -<tt class="docutils literal">data()</tt> will return nullptr.</p>
│ │ │ │ +<a name="disk_observer"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+disk_observer&labels=documentation&body=Documentation+under+heading+%22class+disk_observer%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="disk-observer">
│ │ │ │ +<h1>disk_observer</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_observer.hpp">libtorrent/disk_observer.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct disk_buffer_holder
│ │ │ │ +struct disk_observer
│ │ │ │  {
│ │ │ │ -   disk_buffer_holder&amp; <strong>operator=</strong> (disk_buffer_holder&amp;&amp;) &amp; noexcept;
│ │ │ │ -   <strong>disk_buffer_holder</strong> (disk_buffer_holder&amp;&amp;) noexcept;
│ │ │ │ -   <strong>disk_buffer_holder</strong> (disk_buffer_holder const&amp;) = delete;
│ │ │ │ -   disk_buffer_holder&amp; <strong>operator=</strong> (disk_buffer_holder const&amp;) = delete;
│ │ │ │ -   <strong>disk_buffer_holder</strong> (buffer_allocator_interface&amp; alloc
│ │ │ │ -      , char* buf, int sz) noexcept;
│ │ │ │ -   <strong>disk_buffer_holder</strong> () noexcept = default;
│ │ │ │ -   <strong>~disk_buffer_holder</strong> ();
│ │ │ │ -   char* <strong>data</strong> () const noexcept;
│ │ │ │ -   void <strong>reset</strong> ();
│ │ │ │ -   void <strong>swap</strong> (disk_buffer_holder&amp; h) noexcept;
│ │ │ │ -   bool <strong>is_mutable</strong> () const noexcept;
│ │ │ │ -   explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ -   std::ptrdiff_t <strong>size</strong> () const;
│ │ │ │ +   virtual void <strong>on_disk</strong> () = 0;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="disk-buffer-holder-1">
│ │ │ │ -<h2>disk_buffer_holder()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>disk_buffer_holder</strong> (buffer_allocator_interface&amp; alloc
│ │ │ │ -      , char* buf, int sz) noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>construct a buffer holder that will free the held buffer
│ │ │ │ -using a disk buffer pool directly (there's only one
│ │ │ │ -disk_buffer_pool per <a class="reference external" href="reference-Session.html#session">session</a>)</p>
│ │ │ │ -<a name="disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="disk-buffer-holder-2">
│ │ │ │ -<h2>disk_buffer_holder()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>disk_buffer_holder</strong> () noexcept = default;
│ │ │ │ -</pre>
│ │ │ │ -<p>default construct a holder that does not own any buffer</p>
│ │ │ │ -<a name="~disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5B~disk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5B~disk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="disk-buffer-holder-3">
│ │ │ │ -<h2>~disk_buffer_holder()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>~disk_buffer_holder</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>frees disk buffer held by this object</p>
│ │ │ │ -<a name="data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdata%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdata%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="data">
│ │ │ │ -<h2>data()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char* <strong>data</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>return a pointer to the held buffer, if any. Otherwise returns nullptr.</p>
│ │ │ │ -<a name="reset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Breset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Breset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="reset">
│ │ │ │ -<h2>reset()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>reset</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>free the held disk buffer, if any, and clear the holder. This sets the
│ │ │ │ -holder object to a default-constructed state</p>
│ │ │ │ -<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="swap">
│ │ │ │ -<h2>swap()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>swap</strong> (disk_buffer_holder&amp; h) noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>swap pointers of two disk buffer holders.</p>
│ │ │ │ -<a name="is_mutable()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bis_mutable%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bis_mutable%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="is-mutable">
│ │ │ │ -<h2>is_mutable()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>is_mutable</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>if this returns true, the buffer may not be modified in place</p>
│ │ │ │ -<a name="bool()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bbool%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bbool%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="bool">
│ │ │ │ -<h2>bool()</h2>
│ │ │ │ +<a name="on_disk()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_observer%3A%3A%5Bon_disk%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_observer%3A%3A%5Bon_disk%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="on-disk">
│ │ │ │ +<h2>on_disk()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ +virtual void <strong>on_disk</strong> () = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>implicitly convertible to true if the object is currently holding a
│ │ │ │ -buffer</p>
│ │ │ │ +<p>called when the disk cache size has dropped
│ │ │ │ +below the low watermark again and we can
│ │ │ │ +resume downloading from peers</p>
│ │ │ │  <a name="file_open_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_open_mode_t&labels=documentation&body=Documentation+under+heading+%22file_open_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │  <div class="section" id="file-open-mode-t">
│ │ │ │  <h1>file_open_mode_t</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_interface.hpp">libtorrent/disk_interface.hpp</a>&quot;</p>
│ │ │ │  <a name="file_open_mode_t::read_only"></a><dl class="docutils">
│ │ │ │  <dt>read_only</dt>
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,14 +1,23 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │ -    * _d_i_s_k___o_b_s_e_r_v_e_r
│ │ │ │ │ -          o _o_n___d_i_s_k_(_)
│ │ │ │ │ +    * _s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e
│ │ │ │ │ +    * _b_u_f_f_e_r___a_l_l_o_c_a_t_o_r___i_n_t_e_r_f_a_c_e
│ │ │ │ │ +    * _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r
│ │ │ │ │ +          o _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ +          o _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ +          o _~_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ +          o _d_a_t_a_(_)
│ │ │ │ │ +          o _r_e_s_e_t_(_)
│ │ │ │ │ +          o _s_w_a_p_(_)
│ │ │ │ │ +          o _i_s___m_u_t_a_b_l_e_(_)
│ │ │ │ │ +          o _b_o_o_l_(_)
│ │ │ │ │      * _o_p_e_n___f_i_l_e___s_t_a_t_e
│ │ │ │ │      * _d_i_s_k___i_n_t_e_r_f_a_c_e
│ │ │ │ │            o _n_e_w___t_o_r_r_e_n_t_(_)
│ │ │ │ │            o _r_e_m_o_v_e___t_o_r_r_e_n_t_(_)
│ │ │ │ │            o _a_s_y_n_c___r_e_a_d_(_)_ _a_s_y_n_c___w_r_i_t_e_(_)
│ │ │ │ │            o _a_s_y_n_c___h_a_s_h_(_)
│ │ │ │ │            o _a_s_y_n_c___h_a_s_h_2_(_)
│ │ │ │ │ @@ -22,50 +31,393 @@
│ │ │ │ │            o _a_s_y_n_c___c_l_e_a_r___p_i_e_c_e_(_)
│ │ │ │ │            o _u_p_d_a_t_e___s_t_a_t_s___c_o_u_n_t_e_r_s_(_)
│ │ │ │ │            o _g_e_t___s_t_a_t_u_s_(_)
│ │ │ │ │            o _a_b_o_r_t_(_)
│ │ │ │ │            o _s_u_b_m_i_t___j_o_b_s_(_)
│ │ │ │ │            o _s_e_t_t_i_n_g_s___u_p_d_a_t_e_d_(_)
│ │ │ │ │      * _s_t_o_r_a_g_e___h_o_l_d_e_r
│ │ │ │ │ -    * _s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e
│ │ │ │ │ -    * _b_u_f_f_e_r___a_l_l_o_c_a_t_o_r___i_n_t_e_r_f_a_c_e
│ │ │ │ │ -    * _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r
│ │ │ │ │ -          o _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ -          o _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ -          o _~_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ -          o _d_a_t_a_(_)
│ │ │ │ │ -          o _r_e_s_e_t_(_)
│ │ │ │ │ -          o _s_w_a_p_(_)
│ │ │ │ │ -          o _i_s___m_u_t_a_b_l_e_(_)
│ │ │ │ │ -          o _b_o_o_l_(_)
│ │ │ │ │ +    * _d_i_s_k___o_b_s_e_r_v_e_r
│ │ │ │ │ +          o _o_n___d_i_s_k_(_)
│ │ │ │ │      * _f_i_l_e___o_p_e_n___m_o_d_e___t
│ │ │ │ │ -You have some control over _s_e_s_s_i_o_n configuration through the session::
│ │ │ │ │ -apply_settings() member function. To change one or more configuration options,
│ │ │ │ │ -create a _s_e_t_t_i_n_g_s___p_a_c_k object and fill it with the settings to be set and pass
│ │ │ │ │ -it in to session::apply_settings().
│ │ │ │ │ -The _s_e_t_t_i_n_g_s___p_a_c_k object is a collection of settings updates that are applied
│ │ │ │ │ -to the _s_e_s_s_i_o_n when passed to session::apply_settings(). It's empty when
│ │ │ │ │ -constructed.
│ │ │ │ │ -You have control over proxy and authorization settings and also the user-agent
│ │ │ │ │ -that will be sent to the tracker. The user-agent will also be used to identify
│ │ │ │ │ -the client with other peers.
│ │ │ │ │ -Each configuration option is named with an enum value inside the _s_e_t_t_i_n_g_s___p_a_c_k
│ │ │ │ │ -class. These are the available settings:
│ │ │ │ │ +The disk I/O can be customized in libtorrent. In previous versions, the
│ │ │ │ │ +customization was at the level of each torrent. Now, the customization point is
│ │ │ │ │ +at the _s_e_s_s_i_o_n level. All torrents added to a _s_e_s_s_i_o_n will use the same disk I/
│ │ │ │ │ +O subsystem, as determined by the disk_io_constructor (in _s_e_s_s_i_o_n___p_a_r_a_m_s).
│ │ │ │ │ +This allows the disk subsystem to also customize threading and disk job
│ │ │ │ │ +management.
│ │ │ │ │ +To customize the disk subsystem, implement _d_i_s_k___i_n_t_e_r_f_a_c_e and provide a factory
│ │ │ │ │ +function to the _s_e_s_s_i_o_n constructor (via _s_e_s_s_i_o_n___p_a_r_a_m_s).
│ │ │ │ │ +Example use:
│ │ │ │ │ +struct temp_storage
│ │ │ │ │ +{
│ │ │ │ │ +  explicit temp_storage(lt::file_storage const& fs) : m_files(fs) {}
│ │ │ │ │ +
│ │ │ │ │ +  lt::span<char const> readv(lt::peer_request const r, lt::storage_error& ec)
│ │ │ │ │ +const
│ │ │ │ │ +  {
│ │ │ │ │ +    auto const i = m_file_data.find(r.piece);
│ │ │ │ │ +    if (i == m_file_data.end())
│ │ │ │ │ +    {
│ │ │ │ │ +      ec.operation = lt::operation_t::file_read;
│ │ │ │ │ +      ec.ec = boost::asio::error::eof;
│ │ │ │ │ +      return {};
│ │ │ │ │ +    }
│ │ │ │ │ +    if (int(i->second.size()) <= r.start)
│ │ │ │ │ +    {
│ │ │ │ │ +      ec.operation = lt::operation_t::file_read;
│ │ │ │ │ +      ec.ec = boost::asio::error::eof;
│ │ │ │ │ +      return {};
│ │ │ │ │ +    }
│ │ │ │ │ +    return { i->second.data() + r.start, std::min(r.length, int(i->second.size
│ │ │ │ │ +()) - r.start) };
│ │ │ │ │ +  }
│ │ │ │ │ +  void writev(lt::span<char const> const b, lt::piece_index_t const piece, int
│ │ │ │ │ +const offset)
│ │ │ │ │ +  {
│ │ │ │ │ +    auto& data = m_file_data[piece];
│ │ │ │ │ +    if (data.empty())
│ │ │ │ │ +    {
│ │ │ │ │ +      // allocate the whole piece, otherwise we'll invalidate the pointers
│ │ │ │ │ +      // we have returned back to libtorrent
│ │ │ │ │ +      int const size = piece_size(piece);
│ │ │ │ │ +      data.resize(std::size_t(size));
│ │ │ │ │ +    }
│ │ │ │ │ +    TORRENT_ASSERT(offset + b.size() <= int(data.size()));
│ │ │ │ │ +    std::memcpy(data.data() + offset, b.data(), std::size_t(b.size()));
│ │ │ │ │ +  }
│ │ │ │ │ +  lt::sha1_hash hash(lt::piece_index_t const piece
│ │ │ │ │ +    , lt::span<lt::sha256_hash> const block_hashes, lt::storage_error& ec)
│ │ │ │ │ +const
│ │ │ │ │ +  {
│ │ │ │ │ +    auto const i = m_file_data.find(piece);
│ │ │ │ │ +    if (i == m_file_data.end())
│ │ │ │ │ +    {
│ │ │ │ │ +      ec.operation = lt::operation_t::file_read;
│ │ │ │ │ +      ec.ec = boost::asio::error::eof;
│ │ │ │ │ +      return {};
│ │ │ │ │ +    }
│ │ │ │ │ +    if (!block_hashes.empty())
│ │ │ │ │ +    {
│ │ │ │ │ +      int const piece_size2 = m_files.piece_size2(piece);
│ │ │ │ │ +      int const blocks_in_piece2 = m_files.blocks_in_piece2(piece);
│ │ │ │ │ +      char const* buf = i->second.data();
│ │ │ │ │ +      std::int64_t offset = 0;
│ │ │ │ │ +      for (int k = 0; k < blocks_in_piece2; ++k)
│ │ │ │ │ +      {
│ │ │ │ │ +        lt::hasher256 h2;
│ │ │ │ │ +        std::ptrdiff_t const len2 = std::min(lt::default_block_size, int
│ │ │ │ │ +(piece_size2 - offset));
│ │ │ │ │ +        h2.update({ buf, len2 });
│ │ │ │ │ +        buf += len2;
│ │ │ │ │ +        offset += len2;
│ │ │ │ │ +        block_hashes[k] = h2.final();
│ │ │ │ │ +      }
│ │ │ │ │ +    }
│ │ │ │ │ +    return lt::hasher(i->second).final();
│ │ │ │ │ +  }
│ │ │ │ │ +  lt::sha256_hash hash2(lt::piece_index_t const piece, int const offset, lt::
│ │ │ │ │ +storage_error& ec)
│ │ │ │ │ +  {
│ │ │ │ │ +    auto const i = m_file_data.find(piece);
│ │ │ │ │ +    if (i == m_file_data.end())
│ │ │ │ │ +    {
│ │ │ │ │ +      ec.operation = lt::operation_t::file_read;
│ │ │ │ │ +      ec.ec = boost::asio::error::eof;
│ │ │ │ │ +      return {};
│ │ │ │ │ +    }
│ │ │ │ │ +
│ │ │ │ │ +    int const piece_size = m_files.piece_size2(piece);
│ │ │ │ │ +
│ │ │ │ │ +    std::ptrdiff_t const len = std::min(lt::default_block_size, piece_size -
│ │ │ │ │ +offset);
│ │ │ │ │ +
│ │ │ │ │ +    lt::span<char const> b = {i->second.data() + offset, len};
│ │ │ │ │ +    return lt::hasher256(b).final();
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +private:
│ │ │ │ │ +  int piece_size(lt::piece_index_t piece) const
│ │ │ │ │ +  {
│ │ │ │ │ +    int const num_pieces = static_cast<int>((m_files.total_size() +
│ │ │ │ │ +m_files.piece_length() - 1) / m_files.piece_length());
│ │ │ │ │ +    return static_cast<int>(piece) < num_pieces - 1
│ │ │ │ │ +      ? m_files.piece_length() : static_cast<int>(m_files.total_size() - std::
│ │ │ │ │ +int64_t(num_pieces - 1) * m_files.piece_length());
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  lt::file_storage const& m_files;
│ │ │ │ │ +  std::map<lt::piece_index_t, std::vector<char>> m_file_data;
│ │ │ │ │ +};
│ │ │ │ │ +
│ │ │ │ │ +lt::storage_index_t pop(std::vector<lt::storage_index_t>& q)
│ │ │ │ │ +{
│ │ │ │ │ +  TORRENT_ASSERT(!q.empty());
│ │ │ │ │ +  lt::storage_index_t const ret = q.back();
│ │ │ │ │ +  q.pop_back();
│ │ │ │ │ +  return ret;
│ │ │ │ │ +}
│ │ │ │ │ +
│ │ │ │ │ +struct temp_disk_io final : lt::disk_interface
│ │ │ │ │ +  , lt::buffer_allocator_interface
│ │ │ │ │ +{
│ │ │ │ │ +  explicit temp_disk_io(lt::io_context& ioc): m_ioc(ioc) {}
│ │ │ │ │ +
│ │ │ │ │ +  void settings_updated() override {}
│ │ │ │ │ +
│ │ │ │ │ +  lt::storage_holder new_torrent(lt::storage_params const& params
│ │ │ │ │ +    , std::shared_ptr<void> const&) override
│ │ │ │ │ +  {
│ │ │ │ │ +    lt::storage_index_t const idx = m_free_slots.empty()
│ │ │ │ │ +      ? m_torrents.end_index()
│ │ │ │ │ +      : pop(m_free_slots);
│ │ │ │ │ +    auto storage = std::make_unique<temp_storage>(params.files);
│ │ │ │ │ +    if (idx == m_torrents.end_index()) m_torrents.emplace_back(std::move
│ │ │ │ │ +(storage));
│ │ │ │ │ +    else m_torrents[idx] = std::move(storage);
│ │ │ │ │ +    return lt::storage_holder(idx, *this);
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void remove_torrent(lt::storage_index_t const idx) override
│ │ │ │ │ +  {
│ │ │ │ │ +    m_torrents[idx].reset();
│ │ │ │ │ +    m_free_slots.push_back(idx);
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void abort(bool) override {}
│ │ │ │ │ +
│ │ │ │ │ +  void async_read(lt::storage_index_t storage, lt::peer_request const& r
│ │ │ │ │ +    , std::function<void(lt::disk_buffer_holder block, lt::storage_error const&
│ │ │ │ │ +se)> handler
│ │ │ │ │ +    , lt::disk_job_flags_t) override
│ │ │ │ │ +  {
│ │ │ │ │ +    // this buffer is owned by the storage. It will remain valid for as
│ │ │ │ │ +    // long as the torrent remains in the session. We don't need any lifetime
│ │ │ │ │ +    // management of it.
│ │ │ │ │ +    lt::storage_error error;
│ │ │ │ │ +    lt::span<char const> b = m_torrents[storage]->readv(r, error);
│ │ │ │ │ +
│ │ │ │ │ +    post(m_ioc, [handler, error, b, this]
│ │ │ │ │ +      { handler(lt::disk_buffer_holder(*this, const_cast<char*>(b.data()), int
│ │ │ │ │ +(b.size())), error); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  bool async_write(lt::storage_index_t storage, lt::peer_request const& r
│ │ │ │ │ +    , char const* buf, std::shared_ptr<lt::disk_observer>
│ │ │ │ │ +    , std::function<void(lt::storage_error const&)> handler
│ │ │ │ │ +    , lt::disk_job_flags_t) override
│ │ │ │ │ +  {
│ │ │ │ │ +    lt::span<char const> const b = { buf, r.length };
│ │ │ │ │ +
│ │ │ │ │ +    m_torrents[storage]->writev(b, r.piece, r.start);
│ │ │ │ │ +
│ │ │ │ │ +    post(m_ioc, [=]{ handler(lt::storage_error()); });
│ │ │ │ │ +    return false;
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_hash(lt::storage_index_t storage, lt::piece_index_t const piece
│ │ │ │ │ +    , lt::span<lt::sha256_hash> block_hashes, lt::disk_job_flags_t
│ │ │ │ │ +    , std::function<void(lt::piece_index_t, lt::sha1_hash const&, lt::
│ │ │ │ │ +storage_error const&)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    lt::storage_error error;
│ │ │ │ │ +    lt::sha1_hash const hash = m_torrents[storage]->hash(piece, block_hashes,
│ │ │ │ │ +error);
│ │ │ │ │ +    post(m_ioc, [=]{ handler(piece, hash, error); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_hash2(lt::storage_index_t storage, lt::piece_index_t const piece
│ │ │ │ │ +    , int const offset, lt::disk_job_flags_t
│ │ │ │ │ +    , std::function<void(lt::piece_index_t, lt::sha256_hash const&, lt::
│ │ │ │ │ +storage_error const&)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    lt::storage_error error;
│ │ │ │ │ +    lt::sha256_hash const hash = m_torrents[storage]->hash2(piece, offset,
│ │ │ │ │ +error);
│ │ │ │ │ +    post(m_ioc, [=]{ handler(piece, hash, error); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_move_storage(lt::storage_index_t, std::string p, lt::move_flags_t
│ │ │ │ │ +    , std::function<void(lt::status_t, std::string const&, lt::storage_error
│ │ │ │ │ +const&)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{
│ │ │ │ │ +      handler(lt::status_t::fatal_disk_error, p
│ │ │ │ │ +        , lt::storage_error(lt::error_code(boost::system::errc::
│ │ │ │ │ +operation_not_supported, lt::system_category())));
│ │ │ │ │ +    });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_release_files(lt::storage_index_t, std::function<void()>) override
│ │ │ │ │ +{}
│ │ │ │ │ +
│ │ │ │ │ +  void async_delete_files(lt::storage_index_t, lt::remove_flags_t
│ │ │ │ │ +    , std::function<void(lt::storage_error const&)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{ handler(lt::storage_error()); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_check_files(lt::storage_index_t
│ │ │ │ │ +    , lt::add_torrent_params const*
│ │ │ │ │ +    , lt::aux::vector<std::string, lt::file_index_t>
│ │ │ │ │ +    , std::function<void(lt::status_t, lt::storage_error const&)> handler)
│ │ │ │ │ +override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{ handler(lt::status_t::no_error, lt::storage_error()); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_rename_file(lt::storage_index_t
│ │ │ │ │ +    , lt::file_index_t const idx
│ │ │ │ │ +    , std::string const name
│ │ │ │ │ +    , std::function<void(std::string const&, lt::file_index_t, lt::
│ │ │ │ │ +storage_error const&)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{ handler(name, idx, lt::storage_error()); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_stop_torrent(lt::storage_index_t, std::function<void()> handler)
│ │ │ │ │ +override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, handler);
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_set_file_priority(lt::storage_index_t
│ │ │ │ │ +    , lt::aux::vector<lt::download_priority_t, lt::file_index_t> prio
│ │ │ │ │ +    , std::function<void(lt::storage_error const&
│ │ │ │ │ +      , lt::aux::vector<lt::download_priority_t, lt::file_index_t>)> handler)
│ │ │ │ │ +override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{
│ │ │ │ │ +      handler(lt::storage_error(lt::error_code(
│ │ │ │ │ +        boost::system::errc::operation_not_supported, lt::system_category())),
│ │ │ │ │ +std::move(prio));
│ │ │ │ │ +    });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_clear_piece(lt::storage_index_t, lt::piece_index_t index
│ │ │ │ │ +    , std::function<void(lt::piece_index_t)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{ handler(index); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  // implements buffer_allocator_interface
│ │ │ │ │ +  void free_disk_buffer(char*) override
│ │ │ │ │ +  {
│ │ │ │ │ +    // never free any buffer. We only return buffers owned by the storage
│ │ │ │ │ +    // object
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void update_stats_counters(lt::counters&) const override {}
│ │ │ │ │ +
│ │ │ │ │ +  std::vector<lt::open_file_state> get_status(lt::storage_index_t) const
│ │ │ │ │ +override
│ │ │ │ │ +  { return {}; }
│ │ │ │ │ +
│ │ │ │ │ +  void submit_jobs() override {}
│ │ │ │ │ +
│ │ │ │ │ +private:
│ │ │ │ │ +
│ │ │ │ │ +  lt::aux::vector<std::shared_ptr<temp_storage>, lt::storage_index_t>
│ │ │ │ │ +m_torrents;
│ │ │ │ │ +
│ │ │ │ │ +  // slots that are unused in the m_torrents vector
│ │ │ │ │ +  std::vector<lt::storage_index_t> m_free_slots;
│ │ │ │ │ +
│ │ │ │ │ +  // callbacks are posted on this
│ │ │ │ │ +  lt::io_context& m_ioc;
│ │ │ │ │ +};
│ │ │ │ │ +
│ │ │ │ │ +std::unique_ptr<lt::disk_interface> temp_disk_constructor(
│ │ │ │ │ +  lt::io_context& ioc, lt::settings_interface const&, lt::counters&)
│ │ │ │ │ +{
│ │ │ │ │ +  return std::make_unique<temp_disk_io>(ioc);
│ │ │ │ │ +}
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddiisskk__oobbsseerrvveerr ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___o_b_s_e_r_v_e_r_._h_p_p"
│ │ │ │ │ -struct disk_observer
│ │ │ │ │ +************ sseettttiinnggss__iinntteerrffaaccee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ +the common interface to _s_e_t_t_i_n_g_s___p_a_c_k and the internal representation of
│ │ │ │ │ +settings.
│ │ │ │ │ +struct settings_interface
│ │ │ │ │  {
│ │ │ │ │ -   virtual void oonn__ddiisskk () = 0;
│ │ │ │ │ +   virtual void sseett__ssttrr (int name, std::string val) = 0;
│ │ │ │ │ +   virtual void sseett__iinntt (int name, int val) = 0;
│ │ │ │ │ +   virtual void sseett__bbooooll (int name, bool val) = 0;
│ │ │ │ │ +   virtual bool hhaass__vvaall (int name) const = 0;
│ │ │ │ │ +   virtual int ggeett__iinntt (int name) const = 0;
│ │ │ │ │ +   virtual bool ggeett__bbooooll (int name) const = 0;
│ │ │ │ │ +   virtual std::string const& ggeett__ssttrr (int name) const = 0;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ddiisskk(()) **********
│ │ │ │ │ -virtual void oonn__ddiisskk () = 0;
│ │ │ │ │ -called when the disk cache size has dropped below the low watermark again and
│ │ │ │ │ -we can resume downloading from peers
│ │ │ │ │ +************ bbuuffffeerr__aallllooccaattoorr__iinntteerrffaaccee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_._h_p_p"
│ │ │ │ │ +the interface for freeing disk buffers, used by the _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r. when
│ │ │ │ │ +implementing _d_i_s_k___i_n_t_e_r_f_a_c_e, this must also be implemented in order to return
│ │ │ │ │ +disk buffers back to libtorrent
│ │ │ │ │ +struct buffer_allocator_interface
│ │ │ │ │ +{
│ │ │ │ │ +   virtual void ffrreeee__ddiisskk__bbuuffffeerr (char* b) = 0;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ddiisskk__bbuuffffeerr__hhoollddeerr ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_._h_p_p"
│ │ │ │ │ +The disk buffer holder acts like a unique_ptr that frees a disk buffer when
│ │ │ │ │ +it's destructed
│ │ │ │ │ +If this buffer holder is moved-from, default constructed or reset, data() will
│ │ │ │ │ +return nullptr.
│ │ │ │ │ +struct disk_buffer_holder
│ │ │ │ │ +{
│ │ │ │ │ +   ddiisskk__bbuuffffeerr__hhoollddeerr (disk_buffer_holder&&) noexcept;
│ │ │ │ │ +   disk_buffer_holder& ooppeerraattoorr== (disk_buffer_holder&&) & noexcept;
│ │ │ │ │ +   ddiisskk__bbuuffffeerr__hhoollddeerr (disk_buffer_holder const&) = delete;
│ │ │ │ │ +   disk_buffer_holder& ooppeerraattoorr== (disk_buffer_holder const&) = delete;
│ │ │ │ │ +   ddiisskk__bbuuffffeerr__hhoollddeerr (buffer_allocator_interface& alloc
│ │ │ │ │ +      , char* buf, int sz) noexcept;
│ │ │ │ │ +   ddiisskk__bbuuffffeerr__hhoollddeerr () noexcept = default;
│ │ │ │ │ +   ~~ddiisskk__bbuuffffeerr__hhoollddeerr ();
│ │ │ │ │ +   char* ddaattaa () const noexcept;
│ │ │ │ │ +   void rreesseett ();
│ │ │ │ │ +   void sswwaapp (disk_buffer_holder& h) noexcept;
│ │ │ │ │ +   bool iiss__mmuuttaabbllee () const noexcept;
│ │ │ │ │ +   explicit operator bbooooll () const noexcept;
│ │ │ │ │ +   std::ptrdiff_t ssiizzee () const;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ +ddiisskk__bbuuffffeerr__hhoollddeerr (buffer_allocator_interface& alloc
│ │ │ │ │ +      , char* buf, int sz) noexcept;
│ │ │ │ │ +construct a buffer holder that will free the held buffer using a disk buffer
│ │ │ │ │ +pool directly (there's only one disk_buffer_pool per _s_e_s_s_i_o_n)
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ +ddiisskk__bbuuffffeerr__hhoollddeerr () noexcept = default;
│ │ │ │ │ +default construct a holder that does not own any buffer
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ~~ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ +~~ddiisskk__bbuuffffeerr__hhoollddeerr ();
│ │ │ │ │ +frees disk buffer held by this object
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ddaattaa(()) **********
│ │ │ │ │ +char* ddaattaa () const noexcept;
│ │ │ │ │ +return a pointer to the held buffer, if any. Otherwise returns nullptr.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** rreesseett(()) **********
│ │ │ │ │ +void rreesseett ();
│ │ │ │ │ +free the held disk buffer, if any, and clear the holder. This sets the holder
│ │ │ │ │ +object to a default-constructed state
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sswwaapp(()) **********
│ │ │ │ │ +void sswwaapp (disk_buffer_holder& h) noexcept;
│ │ │ │ │ +swap pointers of two disk buffer holders.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** iiss__mmuuttaabbllee(()) **********
│ │ │ │ │ +bool iiss__mmuuttaabbllee () const noexcept;
│ │ │ │ │ +if this returns true, the buffer may not be modified in place
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** bbooooll(()) **********
│ │ │ │ │ +explicit operator bbooooll () const noexcept;
│ │ │ │ │ +implicitly convertible to true if the object is currently holding a buffer
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ooppeenn__ffiillee__ssttaattee ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___i_n_t_e_r_f_a_c_e_._h_p_p"
│ │ │ │ │  this contains information about a file that's currently open by the libtorrent
│ │ │ │ │  disk I/O subsystem. It's associated with a single torrent.
│ │ │ │ │  struct open_file_state
│ │ │ │ │  {
│ │ │ │ │ @@ -102,21 +454,21 @@
│ │ │ │ │  thread via the io_context object passed into the constructor. The callbacks
│ │ │ │ │  will be run in the network thread.
│ │ │ │ │  struct disk_interface
│ │ │ │ │  {
│ │ │ │ │     virtual storage_holder nneeww__ttoorrrreenntt (storage_params const& p
│ │ │ │ │        , std::shared_ptr<void> const& torrent) = 0;
│ │ │ │ │     virtual void rreemmoovvee__ttoorrrreenntt (storage_index_t) = 0;
│ │ │ │ │ +   virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r
│ │ │ │ │ +      , std::function<void(disk_buffer_holder, storage_error const&)> handler
│ │ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │     virtual bool aassyynncc__wwrriittee (storage_index_t storage, peer_request const& r
│ │ │ │ │        , char const* buf, std::shared_ptr<disk_observer> o
│ │ │ │ │        , std::function<void(storage_error const&)> handler
│ │ │ │ │        , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │ -   virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r
│ │ │ │ │ -      , std::function<void(disk_buffer_holder, storage_error const&)> handler
│ │ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │     virtual void aassyynncc__hhaasshh (storage_index_t storage, piece_index_t piece,
│ │ │ │ │  span<sha256_hash> v2
│ │ │ │ │        , disk_job_flags_t flags
│ │ │ │ │        , std::function<void(piece_index_t, sha1_hash const&, storage_error
│ │ │ │ │  const&)> handler) = 0;
│ │ │ │ │     virtual void aassyynncc__hhaasshh22 (storage_index_t storage, piece_index_t piece, int
│ │ │ │ │  offset, disk_job_flags_t flags
│ │ │ │ │ @@ -172,21 +524,21 @@
│ │ │ │ │  ********** rreemmoovvee__ttoorrrreenntt(()) **********
│ │ │ │ │  virtual void rreemmoovvee__ttoorrrreenntt (storage_index_t) = 0;
│ │ │ │ │  remove the storage with the specified index. This is not expected to delete any
│ │ │ │ │  files from disk, just to clean up any resources associated with the specified
│ │ │ │ │  storage.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aassyynncc__rreeaadd(()) aassyynncc__wwrriittee(()) **********
│ │ │ │ │ +virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r
│ │ │ │ │ +      , std::function<void(disk_buffer_holder, storage_error const&)> handler
│ │ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │  virtual bool aassyynncc__wwrriittee (storage_index_t storage, peer_request const& r
│ │ │ │ │        , char const* buf, std::shared_ptr<disk_observer> o
│ │ │ │ │        , std::function<void(storage_error const&)> handler
│ │ │ │ │        , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │ -virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r
│ │ │ │ │ -      , std::function<void(disk_buffer_holder, storage_error const&)> handler
│ │ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │  perform a read or write operation from/to the specified storage index and the
│ │ │ │ │  specified request. When the operation completes, call handler possibly with a
│ │ │ │ │  _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r, holding the buffer with the result. Flags may be set to
│ │ │ │ │  affect the read operation. See disk_job_flags_t.
│ │ │ │ │  The _d_i_s_k___o_b_s_e_r_v_e_r is a callback to indicate that the store buffer/disk write
│ │ │ │ │  queue is below the watermark to let peers start writing buffers to disk again.
│ │ │ │ │  When async_write() returns true, indicating the write queue is full, the peer
│ │ │ │ │ @@ -374,108 +726,36 @@
│ │ │ │ │  (class that implements _d_i_s_k___i_n_t_e_r_f_a_c_e). This is held by the internal libtorrent
│ │ │ │ │  torrent object to tie the storage object allocated for a torrent to the
│ │ │ │ │  lifetime of the internal torrent object. When a torrent is removed from the
│ │ │ │ │  _s_e_s_s_i_o_n, this holder is destructed and will inform the disk object.
│ │ │ │ │  struct storage_holder
│ │ │ │ │  {
│ │ │ │ │     ssttoorraaggee__hhoollddeerr (storage_index_t idx, disk_interface& disk_io);
│ │ │ │ │ -   ~~ssttoorraaggee__hhoollddeerr ();
│ │ │ │ │     ssttoorraaggee__hhoollddeerr () = default;
│ │ │ │ │ +   ~~ssttoorraaggee__hhoollddeerr ();
│ │ │ │ │     explicit operator bbooooll () const;
│ │ │ │ │     operator ssttoorraaggee__iinnddeexx__tt () const;
│ │ │ │ │     void rreesseett ();
│ │ │ │ │ -   storage_holder& ooppeerraattoorr== (storage_holder const&) = delete;
│ │ │ │ │     ssttoorraaggee__hhoollddeerr (storage_holder const&) = delete;
│ │ │ │ │ +   storage_holder& ooppeerraattoorr== (storage_holder const&) = delete;
│ │ │ │ │     ssttoorraaggee__hhoollddeerr (storage_holder&& rhs) noexcept;
│ │ │ │ │     storage_holder& ooppeerraattoorr== (storage_holder&& rhs) noexcept;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ sseettttiinnggss__iinntteerrffaaccee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ -the common interface to _s_e_t_t_i_n_g_s___p_a_c_k and the internal representation of
│ │ │ │ │ -settings.
│ │ │ │ │ -struct settings_interface
│ │ │ │ │ -{
│ │ │ │ │ -   virtual void sseett__iinntt (int name, int val) = 0;
│ │ │ │ │ -   virtual bool hhaass__vvaall (int name) const = 0;
│ │ │ │ │ -   virtual void sseett__bbooooll (int name, bool val) = 0;
│ │ │ │ │ -   virtual void sseett__ssttrr (int name, std::string val) = 0;
│ │ │ │ │ -   virtual bool ggeett__bbooooll (int name) const = 0;
│ │ │ │ │ -   virtual std::string const& ggeett__ssttrr (int name) const = 0;
│ │ │ │ │ -   virtual int ggeett__iinntt (int name) const = 0;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ bbuuffffeerr__aallllooccaattoorr__iinntteerrffaaccee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_._h_p_p"
│ │ │ │ │ -the interface for freeing disk buffers, used by the _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r. when
│ │ │ │ │ -implementing _d_i_s_k___i_n_t_e_r_f_a_c_e, this must also be implemented in order to return
│ │ │ │ │ -disk buffers back to libtorrent
│ │ │ │ │ -struct buffer_allocator_interface
│ │ │ │ │ -{
│ │ │ │ │ -   virtual void ffrreeee__ddiisskk__bbuuffffeerr (char* b) = 0;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddiisskk__bbuuffffeerr__hhoollddeerr ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_._h_p_p"
│ │ │ │ │ -The disk buffer holder acts like a unique_ptr that frees a disk buffer when
│ │ │ │ │ -it's destructed
│ │ │ │ │ -If this buffer holder is moved-from, default constructed or reset, data() will
│ │ │ │ │ -return nullptr.
│ │ │ │ │ -struct disk_buffer_holder
│ │ │ │ │ +************ ddiisskk__oobbsseerrvveerr ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___o_b_s_e_r_v_e_r_._h_p_p"
│ │ │ │ │ +struct disk_observer
│ │ │ │ │  {
│ │ │ │ │ -   disk_buffer_holder& ooppeerraattoorr== (disk_buffer_holder&&) & noexcept;
│ │ │ │ │ -   ddiisskk__bbuuffffeerr__hhoollddeerr (disk_buffer_holder&&) noexcept;
│ │ │ │ │ -   ddiisskk__bbuuffffeerr__hhoollddeerr (disk_buffer_holder const&) = delete;
│ │ │ │ │ -   disk_buffer_holder& ooppeerraattoorr== (disk_buffer_holder const&) = delete;
│ │ │ │ │ -   ddiisskk__bbuuffffeerr__hhoollddeerr (buffer_allocator_interface& alloc
│ │ │ │ │ -      , char* buf, int sz) noexcept;
│ │ │ │ │ -   ddiisskk__bbuuffffeerr__hhoollddeerr () noexcept = default;
│ │ │ │ │ -   ~~ddiisskk__bbuuffffeerr__hhoollddeerr ();
│ │ │ │ │ -   char* ddaattaa () const noexcept;
│ │ │ │ │ -   void rreesseett ();
│ │ │ │ │ -   void sswwaapp (disk_buffer_holder& h) noexcept;
│ │ │ │ │ -   bool iiss__mmuuttaabbllee () const noexcept;
│ │ │ │ │ -   explicit operator bbooooll () const noexcept;
│ │ │ │ │ -   std::ptrdiff_t ssiizzee () const;
│ │ │ │ │ +   virtual void oonn__ddiisskk () = 0;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ -ddiisskk__bbuuffffeerr__hhoollddeerr (buffer_allocator_interface& alloc
│ │ │ │ │ -      , char* buf, int sz) noexcept;
│ │ │ │ │ -construct a buffer holder that will free the held buffer using a disk buffer
│ │ │ │ │ -pool directly (there's only one disk_buffer_pool per _s_e_s_s_i_o_n)
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ -ddiisskk__bbuuffffeerr__hhoollddeerr () noexcept = default;
│ │ │ │ │ -default construct a holder that does not own any buffer
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ~~ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ -~~ddiisskk__bbuuffffeerr__hhoollddeerr ();
│ │ │ │ │ -frees disk buffer held by this object
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddaattaa(()) **********
│ │ │ │ │ -char* ddaattaa () const noexcept;
│ │ │ │ │ -return a pointer to the held buffer, if any. Otherwise returns nullptr.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreesseett(()) **********
│ │ │ │ │ -void rreesseett ();
│ │ │ │ │ -free the held disk buffer, if any, and clear the holder. This sets the holder
│ │ │ │ │ -object to a default-constructed state
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sswwaapp(()) **********
│ │ │ │ │ -void sswwaapp (disk_buffer_holder& h) noexcept;
│ │ │ │ │ -swap pointers of two disk buffer holders.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iiss__mmuuttaabbllee(()) **********
│ │ │ │ │ -bool iiss__mmuuttaabbllee () const noexcept;
│ │ │ │ │ -if this returns true, the buffer may not be modified in place
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** bbooooll(()) **********
│ │ │ │ │ -explicit operator bbooooll () const noexcept;
│ │ │ │ │ -implicitly convertible to true if the object is currently holding a buffer
│ │ │ │ │ +********** oonn__ddiisskk(()) **********
│ │ │ │ │ +virtual void oonn__ddiisskk () = 0;
│ │ │ │ │ +called when the disk cache size has dropped below the low watermark again and
│ │ │ │ │ +we can resume downloading from peers
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ffiillee__ooppeenn__mmooddee__tt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___i_n_t_e_r_f_a_c_e_._h_p_p"
│ │ │ │ │    read_only
│ │ │ │ │        open the file for reading only
│ │ │ │ │    write_only
│ │ │ │ │        open the file for writing only
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-DHT.html
│ │ │ │ @@ -28,39 +28,65 @@
│ │ │ │  <td>2.0.11</td></tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │ -<li><a class="reference internal" href="#dht-storage-counters" id="toc-entry-1">dht_storage_counters</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#reset" id="toc-entry-2">reset()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-state" id="toc-entry-1">dht_state</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-storage-counters" id="toc-entry-2">dht_storage_counters</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#reset" id="toc-entry-3">reset()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-storage-interface" id="toc-entry-3">dht_storage_interface</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#update-node-ids" id="toc-entry-4">update_node_ids()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-peers" id="toc-entry-5">get_peers()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#announce-peer" id="toc-entry-6">announce_peer()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-immutable-item" id="toc-entry-7">get_immutable_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#put-immutable-item" id="toc-entry-8">put_immutable_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-mutable-item-seq" id="toc-entry-9">get_mutable_item_seq()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-mutable-item" id="toc-entry-10">get_mutable_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#put-mutable-item" id="toc-entry-11">put_mutable_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-infohashes-sample" id="toc-entry-12">get_infohashes_sample()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tick" id="toc-entry-13">tick()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#counters" id="toc-entry-14">counters()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-storage-interface" id="toc-entry-4">dht_storage_interface</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#update-node-ids" id="toc-entry-5">update_node_ids()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-peers" id="toc-entry-6">get_peers()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#announce-peer" id="toc-entry-7">announce_peer()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-immutable-item" id="toc-entry-8">get_immutable_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#put-immutable-item" id="toc-entry-9">put_immutable_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-mutable-item-seq" id="toc-entry-10">get_mutable_item_seq()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-mutable-item" id="toc-entry-11">get_mutable_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#put-mutable-item" id="toc-entry-12">put_mutable_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-infohashes-sample" id="toc-entry-13">get_infohashes_sample()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tick" id="toc-entry-14">tick()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#counters" id="toc-entry-15">counters()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-state" id="toc-entry-15">dht_state</a></li>
│ │ │ │  <li><a class="reference internal" href="#dht-default-storage-constructor" id="toc-entry-16">dht_default_storage_constructor()</a></li>
│ │ │ │  <li><a class="reference internal" href="#sign-mutable-item" id="toc-entry-17">sign_mutable_item()</a></li>
│ │ │ │  <li><a class="reference internal" href="#announce-flags-t" id="toc-entry-18">announce_flags_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │ -<a name="dht_storage_counters"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_storage_counters&labels=documentation&body=Documentation+under+heading+%22class+dht_storage_counters%22+could+be+improved">report issue</a>]</span><div class="section" id="dht-storage-counters">
│ │ │ │ +<a name="dht_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_state&labels=documentation&body=Documentation+under+heading+%22class+dht_state%22+could+be+improved">report issue</a>]</span><div class="section" id="dht-state">
│ │ │ │ +<h1>dht_state</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/kademlia/dht_state.hpp">libtorrent/kademlia/dht_state.hpp</a>&quot;</p>
│ │ │ │ +<p>This structure helps to store and load the state
│ │ │ │ +of the <tt class="docutils literal">dht_tracker</tt>.
│ │ │ │ +At this moment the library is only a dual stack
│ │ │ │ +implementation of the DHT. See <a class="reference external" href="https://www.bittorrent.org/beps/bep_0032.html">BEP 32</a></p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_state
│ │ │ │ +{
│ │ │ │ +   void <strong>clear</strong> ();
│ │ │ │ +
│ │ │ │ +   node_ids_t nids;
│ │ │ │ +   std::vector&lt;udp::endpoint&gt; nodes;
│ │ │ │ +   std::vector&lt;udp::endpoint&gt; nodes6;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="nodes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_state%3A%3A%5Bnodes%5D&labels=documentation&body=Documentation+under+heading+%22dht_state%3A%3A%5Bnodes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>nodes</dt>
│ │ │ │ +<dd>the bootstrap nodes saved from the buckets node</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="nodes6"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_state%3A%3A%5Bnodes6%5D&labels=documentation&body=Documentation+under+heading+%22dht_state%3A%3A%5Bnodes6%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>nodes6</dt>
│ │ │ │ +<dd>the bootstrap nodes saved from the IPv6 buckets node</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_storage_counters"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_storage_counters&labels=documentation&body=Documentation+under+heading+%22class+dht_storage_counters%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-storage-counters">
│ │ │ │  <h1>dht_storage_counters</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/kademlia/dht_storage.hpp">libtorrent/kademlia/dht_storage.hpp</a>&quot;</p>
│ │ │ │  <p>This structure hold the relevant <a class="reference external" href="reference-Stats.html#counters">counters</a> for the storage</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct dht_storage_counters
│ │ │ │  {
│ │ │ │     void <strong>reset</strong> ();
│ │ │ │ @@ -282,42 +308,16 @@
│ │ │ │  <a name="counters()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_storage_interface%3A%3A%5Bcounters%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_storage_interface%3A%3A%5Bcounters%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="counters">
│ │ │ │  <h2>counters()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  virtual dht_storage_counters <strong>counters</strong> () const = 0;
│ │ │ │  </pre>
│ │ │ │  <p>return stats <a class="reference external" href="reference-Stats.html#counters">counters</a> for the store</p>
│ │ │ │ -<a name="dht_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_state&labels=documentation&body=Documentation+under+heading+%22class+dht_state%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="dht-state">
│ │ │ │ -<h1>dht_state</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/kademlia/dht_state.hpp">libtorrent/kademlia/dht_state.hpp</a>&quot;</p>
│ │ │ │ -<p>This structure helps to store and load the state
│ │ │ │ -of the <tt class="docutils literal">dht_tracker</tt>.
│ │ │ │ -At this moment the library is only a dual stack
│ │ │ │ -implementation of the DHT. See <a class="reference external" href="https://www.bittorrent.org/beps/bep_0032.html">BEP 32</a></p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_state
│ │ │ │ -{
│ │ │ │ -   void <strong>clear</strong> ();
│ │ │ │ -
│ │ │ │ -   node_ids_t nids;
│ │ │ │ -   std::vector&lt;udp::endpoint&gt; nodes;
│ │ │ │ -   std::vector&lt;udp::endpoint&gt; nodes6;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="nodes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_state%3A%3A%5Bnodes%5D&labels=documentation&body=Documentation+under+heading+%22dht_state%3A%3A%5Bnodes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>nodes</dt>
│ │ │ │ -<dd>the bootstrap nodes saved from the buckets node</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="nodes6"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_state%3A%3A%5Bnodes6%5D&labels=documentation&body=Documentation+under+heading+%22dht_state%3A%3A%5Bnodes6%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>nodes6</dt>
│ │ │ │ -<dd>the bootstrap nodes saved from the IPv6 buckets node</dd>
│ │ │ │ -</dl>
│ │ │ │  <a name="dht_default_storage_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_default_storage_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22dht_default_storage_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │  <div class="section" id="dht-default-storage-constructor">
│ │ │ │  <h1>dht_default_storage_constructor()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/kademlia/dht_storage.hpp">libtorrent/kademlia/dht_storage.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::unique_ptr&lt;dht_storage_interface&gt; <strong>dht_default_storage_constructor</strong> (
│ │ │ │     settings_interface const&amp; settings);
│ │ │ │  </pre>
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,31 +1,50 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │ +    * _d_h_t___s_t_a_t_e
│ │ │ │ │      * _d_h_t___s_t_o_r_a_g_e___c_o_u_n_t_e_r_s
│ │ │ │ │            o _r_e_s_e_t_(_)
│ │ │ │ │      * _d_h_t___s_t_o_r_a_g_e___i_n_t_e_r_f_a_c_e
│ │ │ │ │            o _u_p_d_a_t_e___n_o_d_e___i_d_s_(_)
│ │ │ │ │            o _g_e_t___p_e_e_r_s_(_)
│ │ │ │ │            o _a_n_n_o_u_n_c_e___p_e_e_r_(_)
│ │ │ │ │            o _g_e_t___i_m_m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │            o _p_u_t___i_m_m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │            o _g_e_t___m_u_t_a_b_l_e___i_t_e_m___s_e_q_(_)
│ │ │ │ │            o _g_e_t___m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │            o _p_u_t___m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │            o _g_e_t___i_n_f_o_h_a_s_h_e_s___s_a_m_p_l_e_(_)
│ │ │ │ │            o _t_i_c_k_(_)
│ │ │ │ │            o _c_o_u_n_t_e_r_s_(_)
│ │ │ │ │ -    * _d_h_t___s_t_a_t_e
│ │ │ │ │      * _d_h_t___d_e_f_a_u_l_t___s_t_o_r_a_g_e___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │      * _s_i_g_n___m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │      * _a_n_n_o_u_n_c_e___f_l_a_g_s___t
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ddhhtt__ssttaattee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_d_h_t___s_t_a_t_e_._h_p_p"
│ │ │ │ │ +This structure helps to store and load the state of the dht_tracker. At this
│ │ │ │ │ +moment the library is only a dual stack implementation of the DHT. See _B_E_P_ _3_2
│ │ │ │ │ +struct dht_state
│ │ │ │ │ +{
│ │ │ │ │ +   void cclleeaarr ();
│ │ │ │ │ +
│ │ │ │ │ +   node_ids_t nids;
│ │ │ │ │ +   std::vector<udp::endpoint> nodes;
│ │ │ │ │ +   std::vector<udp::endpoint> nodes6;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  nodes
│ │ │ │ │ +      the bootstrap nodes saved from the buckets node
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  nodes6
│ │ │ │ │ +      the bootstrap nodes saved from the IPv6 buckets node
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ddhhtt__ssttoorraaggee__ccoouunntteerrss ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_d_h_t___s_t_o_r_a_g_e_._h_p_p"
│ │ │ │ │  This structure hold the relevant _c_o_u_n_t_e_r_s for the storage
│ │ │ │ │  struct dht_storage_counters
│ │ │ │ │  {
│ │ │ │ │     void rreesseett ();
│ │ │ │ │  
│ │ │ │ │ @@ -191,33 +210,14 @@
│ │ │ │ │  For implementers: Use this functions for expire peers or items or any other
│ │ │ │ │  storage cleanup.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ccoouunntteerrss(()) **********
│ │ │ │ │  virtual dht_storage_counters ccoouunntteerrss () const = 0;
│ │ │ │ │  return stats _c_o_u_n_t_e_r_s for the store
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddhhtt__ssttaattee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_d_h_t___s_t_a_t_e_._h_p_p"
│ │ │ │ │ -This structure helps to store and load the state of the dht_tracker. At this
│ │ │ │ │ -moment the library is only a dual stack implementation of the DHT. See _B_E_P_ _3_2
│ │ │ │ │ -struct dht_state
│ │ │ │ │ -{
│ │ │ │ │ -   void cclleeaarr ();
│ │ │ │ │ -
│ │ │ │ │ -   node_ids_t nids;
│ │ │ │ │ -   std::vector<udp::endpoint> nodes;
│ │ │ │ │ -   std::vector<udp::endpoint> nodes6;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  nodes
│ │ │ │ │ -      the bootstrap nodes saved from the buckets node
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  nodes6
│ │ │ │ │ -      the bootstrap nodes saved from the IPv6 buckets node
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ddhhtt__ddeeffaauulltt__ssttoorraaggee__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_d_h_t___s_t_o_r_a_g_e_._h_p_p"
│ │ │ │ │  std::unique_ptr<dht_storage_interface> ddhhtt__ddeeffaauulltt__ssttoorraaggee__ccoonnssttrruuccttoorr (
│ │ │ │ │     settings_interface const& settings);
│ │ │ │ │  constructor for the default DHT storage. The DHT storage is responsible for
│ │ │ │ │  maintaining peers and mutable and immutable items announced and stored/put to
│ │ │ │ │  the DHT node.
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Error_Codes.html
│ │ │ │ @@ -33,30 +33,30 @@
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │  <li><a class="reference internal" href="#storage-error" id="toc-entry-1">storage_error</a><ul>
│ │ │ │  <li><a class="reference internal" href="#bool" id="toc-entry-2">bool()</a></li>
│ │ │ │  <li><a class="reference internal" href="#file" id="toc-entry-3">file()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#libtorrent-category" id="toc-entry-4">libtorrent_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#http-category" id="toc-entry-5">http_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#i2p-category" id="toc-entry-6">i2p_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#bdecode-category" id="toc-entry-7">bdecode_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#pcp-category" id="toc-entry-8">pcp_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#socks-category" id="toc-entry-9">socks_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#gzip-category" id="toc-entry-10">gzip_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#upnp-category" id="toc-entry-11">upnp_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#gzip-category" id="toc-entry-4">gzip_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#upnp-category" id="toc-entry-5">upnp_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bdecode-category" id="toc-entry-6">bdecode_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#pcp-category" id="toc-entry-7">pcp_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#i2p-category" id="toc-entry-8">i2p_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#libtorrent-category" id="toc-entry-9">libtorrent_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#http-category" id="toc-entry-10">http_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#socks-category" id="toc-entry-11">socks_category()</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-error-code-enum" id="toc-entry-12">enum error_code_enum</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-http-errors" id="toc-entry-13">enum http_errors</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-i2p-error-code" id="toc-entry-14">enum i2p_error_code</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-error-code-enum-1" id="toc-entry-15">enum error_code_enum</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-pcp-errors" id="toc-entry-16">enum pcp_errors</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-socks-error-code" id="toc-entry-17">enum socks_error_code</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-error-code-enum-2" id="toc-entry-18">enum error_code_enum</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-error-code-enum-3" id="toc-entry-19">enum error_code_enum</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-error-code-enum-1" id="toc-entry-13">enum error_code_enum</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-error-code-enum-2" id="toc-entry-14">enum error_code_enum</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-pcp-errors" id="toc-entry-15">enum pcp_errors</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-i2p-error-code" id="toc-entry-16">enum i2p_error_code</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-error-code-enum-3" id="toc-entry-17">enum error_code_enum</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-http-errors" id="toc-entry-18">enum http_errors</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-socks-error-code" id="toc-entry-19">enum socks_error_code</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │  <a name="storage_error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_error&labels=documentation&body=Documentation+under+heading+%22class+storage_error%22+could+be+improved">report issue</a>]</span><div class="section" id="storage-error">
│ │ │ │  <h1>storage_error</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │  <p>used by storage to return errors
│ │ │ │  also includes which underlying file the
│ │ │ │ @@ -94,80 +94,426 @@
│ │ │ │  <dd>the error that occurred</dd>
│ │ │ │  </dl>
│ │ │ │  <a name="operation"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_error%3A%3A%5Boperation%5D&labels=documentation&body=Documentation+under+heading+%22storage_error%3A%3A%5Boperation%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>operation</dt>
│ │ │ │  <dd>A code from <a class="reference external" href="reference-Alerts.html#operation_t">operation_t</a> enum, indicating what
│ │ │ │  kind of operation failed.</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="libtorrent_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:libtorrent_category%28%29&labels=documentation&body=Documentation+under+heading+%22libtorrent_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<a name="gzip_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:gzip_category%28%29&labels=documentation&body=Documentation+under+heading+%22gzip_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │ -<div class="section" id="libtorrent-category">
│ │ │ │ -<h1>libtorrent_category()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -boost::system::error_category&amp; <strong>libtorrent_category</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>return the instance of the libtorrent_error_category which
│ │ │ │ -maps libtorrent error codes to human readable error messages.</p>
│ │ │ │ -<a name="http_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:http_category%28%29&labels=documentation&body=Documentation+under+heading+%22http_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="http-category">
│ │ │ │ -<h1>http_category()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │ +<div class="section" id="gzip-category">
│ │ │ │ +<h1>gzip_category()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/gzip.hpp">libtorrent/gzip.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -boost::system::error_category&amp; <strong>http_category</strong> ();
│ │ │ │ +boost::system::error_category&amp; <strong>gzip_category</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>returns the error_category for HTTP errors</p>
│ │ │ │ -<a name="i2p_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:i2p_category%28%29&labels=documentation&body=Documentation+under+heading+%22i2p_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="i2p-category">
│ │ │ │ -<h1>i2p_category()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/i2p_stream.hpp">libtorrent/i2p_stream.hpp</a>&quot;</p>
│ │ │ │ +<p>get the <tt class="docutils literal">error_category</tt> for zip errors</p>
│ │ │ │ +<a name="upnp_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:upnp_category%28%29&labels=documentation&body=Documentation+under+heading+%22upnp_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="upnp-category">
│ │ │ │ +<h1>upnp_category()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/upnp.hpp">libtorrent/upnp.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -boost::system::error_category&amp; <strong>i2p_category</strong> ();
│ │ │ │ +boost::system::error_category&amp; <strong>upnp_category</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>returns the error category for I2P errors</p>
│ │ │ │ +<p>the boost.system error category for UPnP errors</p>
│ │ │ │  <a name="bdecode_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_category%28%29&labels=documentation&body=Documentation+under+heading+%22bdecode_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="bdecode-category">
│ │ │ │  <h1>bdecode_category()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  boost::system::error_category&amp; <strong>bdecode_category</strong> ();
│ │ │ │  </pre>
│ │ │ │  <a name="pcp_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:pcp_category%28%29&labels=documentation&body=Documentation+under+heading+%22pcp_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="pcp-category">
│ │ │ │  <h1>pcp_category()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/natpmp.hpp">libtorrent/natpmp.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  boost::system::error_category&amp; <strong>pcp_category</strong> ();
│ │ │ │  </pre>
│ │ │ │ +<a name="i2p_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:i2p_category%28%29&labels=documentation&body=Documentation+under+heading+%22i2p_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="i2p-category">
│ │ │ │ +<h1>i2p_category()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/i2p_stream.hpp">libtorrent/i2p_stream.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +boost::system::error_category&amp; <strong>i2p_category</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the error category for I2P errors</p>
│ │ │ │ +<a name="libtorrent_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:libtorrent_category%28%29&labels=documentation&body=Documentation+under+heading+%22libtorrent_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="libtorrent-category">
│ │ │ │ +<h1>libtorrent_category()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +boost::system::error_category&amp; <strong>libtorrent_category</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>return the instance of the libtorrent_error_category which
│ │ │ │ +maps libtorrent error codes to human readable error messages.</p>
│ │ │ │ +<a name="http_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:http_category%28%29&labels=documentation&body=Documentation+under+heading+%22http_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="http-category">
│ │ │ │ +<h1>http_category()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +boost::system::error_category&amp; <strong>http_category</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the error_category for HTTP errors</p>
│ │ │ │  <a name="socks_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks_category%28%29&labels=documentation&body=Documentation+under+heading+%22socks_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="socks-category">
│ │ │ │  <h1>socks_category()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/socks5_stream.hpp">libtorrent/socks5_stream.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  boost::system::error_category&amp; <strong>socks_category</strong> ();
│ │ │ │  </pre>
│ │ │ │  <p>returns the error_category for SOCKS5 errors</p>
│ │ │ │ -<a name="gzip_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:gzip_category%28%29&labels=documentation&body=Documentation+under+heading+%22gzip_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="gzip-category">
│ │ │ │ -<h1>gzip_category()</h1>
│ │ │ │ +<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-error-code-enum">
│ │ │ │ +<h1>enum error_code_enum</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/gzip.hpp">libtorrent/gzip.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -boost::system::error_category&amp; <strong>gzip_category</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>get the <tt class="docutils literal">error_category</tt> for zip errors</p>
│ │ │ │ -<a name="upnp_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:upnp_category%28%29&labels=documentation&body=Documentation+under+heading+%22upnp_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="upnp-category">
│ │ │ │ -<h1>upnp_category()</h1>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="33%" />
│ │ │ │ +<col width="6%" />
│ │ │ │ +<col width="61%" />
│ │ │ │ +</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>invalid_gzip_header</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>the supplied gzip buffer has invalid header</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>inflated_data_too_large</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>the gzip buffer would inflate to more bytes than the specified
│ │ │ │ +maximum size, and was rejected.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>data_did_not_terminate</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>available inflate data did not terminate</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>space_exhausted</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>output space exhausted before completing inflate</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_block_type</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>invalid block type (type == 3)</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_stored_block_length</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>stored block length did not match one's complement</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>too_many_length_or_distance_codes</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>dynamic block code description: too many length or distance codes</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>code_lengths_codes_incomplete</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>dynamic block code description: code lengths codes incomplete</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>repeat_lengths_with_no_first_length</td>
│ │ │ │ +<td>9</td>
│ │ │ │ +<td>dynamic block code description: repeat lengths with no first length</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>repeat_more_than_specified_lengths</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +<td>dynamic block code description: repeat more than specified lengths</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_literal_length_code_lengths</td>
│ │ │ │ +<td>11</td>
│ │ │ │ +<td>dynamic block code description: invalid literal/length code lengths</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_distance_code_lengths</td>
│ │ │ │ +<td>12</td>
│ │ │ │ +<td>dynamic block code description: invalid distance code lengths</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_literal_code_in_block</td>
│ │ │ │ +<td>13</td>
│ │ │ │ +<td>invalid literal/length or distance code in fixed or dynamic block</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>distance_too_far_back_in_block</td>
│ │ │ │ +<td>14</td>
│ │ │ │ +<td>distance is too far back in fixed or dynamic block</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>unknown_gzip_error</td>
│ │ │ │ +<td>15</td>
│ │ │ │ +<td>an unknown error occurred during gzip inflation</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>error_code_max</td>
│ │ │ │ +<td>16</td>
│ │ │ │ +<td>the number of error codes</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-error-code-enum-1">
│ │ │ │ +<h1>enum error_code_enum</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/upnp.hpp">libtorrent/upnp.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -boost::system::error_category&amp; <strong>upnp_category</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>the boost.system error category for UPnP errors</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="37%" />
│ │ │ │ +<col width="7%" />
│ │ │ │ +<col width="56%" />
│ │ │ │ +</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>No error</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_argument</td>
│ │ │ │ +<td>402</td>
│ │ │ │ +<td>One of the arguments in the request is invalid</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>action_failed</td>
│ │ │ │ +<td>501</td>
│ │ │ │ +<td>The request failed</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>value_not_in_array</td>
│ │ │ │ +<td>714</td>
│ │ │ │ +<td>The specified value does not exist in the array</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>source_ip_cannot_be_wildcarded</td>
│ │ │ │ +<td>715</td>
│ │ │ │ +<td>The source IP address cannot be wild-carded, but
│ │ │ │ +must be fully specified</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>external_port_cannot_be_wildcarded</td>
│ │ │ │ +<td>716</td>
│ │ │ │ +<td>The external port cannot be a wildcard, but must
│ │ │ │ +be specified</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>port_mapping_conflict</td>
│ │ │ │ +<td>718</td>
│ │ │ │ +<td>The port mapping <a class="reference external" href="reference-Bencoding.html#entry">entry</a> specified conflicts with a
│ │ │ │ +mapping assigned previously to another client</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>internal_port_must_match_external</td>
│ │ │ │ +<td>724</td>
│ │ │ │ +<td>Internal and external port value must be the same</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>only_permanent_leases_supported</td>
│ │ │ │ +<td>725</td>
│ │ │ │ +<td>The NAT implementation only supports permanent
│ │ │ │ +lease times on port mappings</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>remote_host_must_be_wildcard</td>
│ │ │ │ +<td>726</td>
│ │ │ │ +<td>RemoteHost must be a wildcard and cannot be a
│ │ │ │ +specific IP address or DNS name</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>external_port_must_be_wildcard</td>
│ │ │ │ +<td>727</td>
│ │ │ │ +<td>ExternalPort must be a wildcard and cannot be a
│ │ │ │ +specific port</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │  <a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-error-code-enum">
│ │ │ │ +<div class="section" id="enum-error-code-enum-2">
│ │ │ │ +<h1>enum error_code_enum</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="8%" />
│ │ │ │ +<col width="74%" />
│ │ │ │ +</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_digit</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>expected digit 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, <a class="reference external" href="reference-Core.html#int">int</a> 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>overflow</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>integer overflow</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>error_code_max</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>the number of error codes</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<a name="pcp_errors"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+pcp_errors&labels=documentation&body=Documentation+under+heading+%22enum+pcp_errors%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-pcp-errors">
│ │ │ │ +<h1>enum pcp_errors</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/natpmp.hpp">libtorrent/natpmp.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="59%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="27%" />
│ │ │ │ +</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>pcp_success</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_unsupp_version</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_not_authorized</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_malformed_request</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_unsupp_opcode</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_unsupp_option</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_malformed_option</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_network_failure</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_no_resources</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_unsupp_protocol</td>
│ │ │ │ +<td>9</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_user_ex_quota</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_cannot_provide_external</td>
│ │ │ │ +<td>11</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_address_mismatch</td>
│ │ │ │ +<td>12</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_excessive_remote_peers</td>
│ │ │ │ +<td>13</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<a name="i2p_error_code"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+i2p_error_code&labels=documentation&body=Documentation+under+heading+%22enum+i2p_error_code%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-i2p-error-code">
│ │ │ │ +<h1>enum i2p_error_code</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/i2p_stream.hpp">libtorrent/i2p_stream.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="46%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="35%" />
│ │ │ │ +</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>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>parse_failed</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>cant_reach_peer</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>i2p_error</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_key</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_id</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>timeout</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>key_not_found</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>duplicated_id</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>num_errors</td>
│ │ │ │ +<td>9</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-error-code-enum-3">
│ │ │ │  <h1>enum error_code_enum</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │  <col width="32%" />
│ │ │ │  <col width="6%" />
│ │ │ │  <col width="63%" />
│ │ │ │ @@ -991,203 +1337,14 @@
│ │ │ │  </tr>
│ │ │ │  <tr><td>service_unavailable</td>
│ │ │ │  <td>503</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="i2p_error_code"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+i2p_error_code&labels=documentation&body=Documentation+under+heading+%22enum+i2p_error_code%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-i2p-error-code">
│ │ │ │ -<h1>enum i2p_error_code</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/i2p_stream.hpp">libtorrent/i2p_stream.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="46%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="35%" />
│ │ │ │ -</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>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>parse_failed</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>cant_reach_peer</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>i2p_error</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_key</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_id</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>timeout</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>key_not_found</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>duplicated_id</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>num_errors</td>
│ │ │ │ -<td>9</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-error-code-enum-1">
│ │ │ │ -<h1>enum error_code_enum</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="8%" />
│ │ │ │ -<col width="74%" />
│ │ │ │ -</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_digit</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>expected digit 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, <a class="reference external" href="reference-Core.html#int">int</a> 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>overflow</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>integer overflow</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>error_code_max</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>the number of error codes</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="pcp_errors"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+pcp_errors&labels=documentation&body=Documentation+under+heading+%22enum+pcp_errors%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-pcp-errors">
│ │ │ │ -<h1>enum pcp_errors</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/natpmp.hpp">libtorrent/natpmp.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="59%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="27%" />
│ │ │ │ -</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>pcp_success</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_unsupp_version</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_not_authorized</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_malformed_request</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_unsupp_opcode</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_unsupp_option</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_malformed_option</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_network_failure</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_no_resources</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_unsupp_protocol</td>
│ │ │ │ -<td>9</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_user_ex_quota</td>
│ │ │ │ -<td>10</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_cannot_provide_external</td>
│ │ │ │ -<td>11</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_address_mismatch</td>
│ │ │ │ -<td>12</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_excessive_remote_peers</td>
│ │ │ │ -<td>13</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │  <a name="socks_error_code"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+socks_error_code&labels=documentation&body=Documentation+under+heading+%22enum+socks_error_code%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="enum-socks-error-code">
│ │ │ │  <h1>enum socks_error_code</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/socks5_stream.hpp">libtorrent/socks5_stream.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │  <col width="64%" />
│ │ │ │ @@ -1243,171 +1400,14 @@
│ │ │ │  </tr>
│ │ │ │  <tr><td>num_errors</td>
│ │ │ │  <td>10</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-error-code-enum-2">
│ │ │ │ -<h1>enum error_code_enum</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/gzip.hpp">libtorrent/gzip.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="33%" />
│ │ │ │ -<col width="6%" />
│ │ │ │ -<col width="61%" />
│ │ │ │ -</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>invalid_gzip_header</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>the supplied gzip buffer has invalid header</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>inflated_data_too_large</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>the gzip buffer would inflate to more bytes than the specified
│ │ │ │ -maximum size, and was rejected.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>data_did_not_terminate</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>available inflate data did not terminate</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>space_exhausted</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>output space exhausted before completing inflate</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_block_type</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>invalid block type (type == 3)</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_stored_block_length</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>stored block length did not match one's complement</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>too_many_length_or_distance_codes</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>dynamic block code description: too many length or distance codes</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>code_lengths_codes_incomplete</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>dynamic block code description: code lengths codes incomplete</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>repeat_lengths_with_no_first_length</td>
│ │ │ │ -<td>9</td>
│ │ │ │ -<td>dynamic block code description: repeat lengths with no first length</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>repeat_more_than_specified_lengths</td>
│ │ │ │ -<td>10</td>
│ │ │ │ -<td>dynamic block code description: repeat more than specified lengths</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_literal_length_code_lengths</td>
│ │ │ │ -<td>11</td>
│ │ │ │ -<td>dynamic block code description: invalid literal/length code lengths</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_distance_code_lengths</td>
│ │ │ │ -<td>12</td>
│ │ │ │ -<td>dynamic block code description: invalid distance code lengths</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_literal_code_in_block</td>
│ │ │ │ -<td>13</td>
│ │ │ │ -<td>invalid literal/length or distance code in fixed or dynamic block</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>distance_too_far_back_in_block</td>
│ │ │ │ -<td>14</td>
│ │ │ │ -<td>distance is too far back in fixed or dynamic block</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>unknown_gzip_error</td>
│ │ │ │ -<td>15</td>
│ │ │ │ -<td>an unknown error occurred during gzip inflation</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>error_code_max</td>
│ │ │ │ -<td>16</td>
│ │ │ │ -<td>the number of error codes</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-error-code-enum-3">
│ │ │ │ -<h1>enum error_code_enum</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/upnp.hpp">libtorrent/upnp.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="37%" />
│ │ │ │ -<col width="7%" />
│ │ │ │ -<col width="56%" />
│ │ │ │ -</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>No error</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_argument</td>
│ │ │ │ -<td>402</td>
│ │ │ │ -<td>One of the arguments in the request is invalid</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>action_failed</td>
│ │ │ │ -<td>501</td>
│ │ │ │ -<td>The request failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>value_not_in_array</td>
│ │ │ │ -<td>714</td>
│ │ │ │ -<td>The specified value does not exist in the array</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>source_ip_cannot_be_wildcarded</td>
│ │ │ │ -<td>715</td>
│ │ │ │ -<td>The source IP address cannot be wild-carded, but
│ │ │ │ -must be fully specified</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>external_port_cannot_be_wildcarded</td>
│ │ │ │ -<td>716</td>
│ │ │ │ -<td>The external port cannot be a wildcard, but must
│ │ │ │ -be specified</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>port_mapping_conflict</td>
│ │ │ │ -<td>718</td>
│ │ │ │ -<td>The port mapping <a class="reference external" href="reference-Bencoding.html#entry">entry</a> specified conflicts with a
│ │ │ │ -mapping assigned previously to another client</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>internal_port_must_match_external</td>
│ │ │ │ -<td>724</td>
│ │ │ │ -<td>Internal and external port value must be the same</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>only_permanent_leases_supported</td>
│ │ │ │ -<td>725</td>
│ │ │ │ -<td>The NAT implementation only supports permanent
│ │ │ │ -lease times on port mappings</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>remote_host_must_be_wildcard</td>
│ │ │ │ -<td>726</td>
│ │ │ │ -<td>RemoteHost must be a wildcard and cannot be a
│ │ │ │ -specific IP address or DNS name</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>external_port_must_be_wildcard</td>
│ │ │ │ -<td>727</td>
│ │ │ │ -<td>ExternalPort must be a wildcard and cannot be a
│ │ │ │ -specific port</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │  </div>
│ │ │ │  
│ │ │ │      </div>
│ │ │ │      </div>
│ │ │ │      <div id="gradient"></div>
│ │ │ │      <div id="filler">
│ │ │ │      <div id="footer">
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -2,30 +2,30 @@
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │      * _s_t_o_r_a_g_e___e_r_r_o_r
│ │ │ │ │            o _b_o_o_l_(_)
│ │ │ │ │            o _f_i_l_e_(_)
│ │ │ │ │ -    * _l_i_b_t_o_r_r_e_n_t___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _h_t_t_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _i_2_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _g_z_i_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _u_p_n_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │      * _b_d_e_c_o_d_e___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │      * _p_c_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _i_2_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _l_i_b_t_o_r_r_e_n_t___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _h_t_t_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │      * _s_o_c_k_s___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _g_z_i_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _u_p_n_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │      * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ -    * _e_n_u_m_ _h_t_t_p___e_r_r_o_r_s
│ │ │ │ │ -    * _e_n_u_m_ _i_2_p___e_r_r_o_r___c_o_d_e
│ │ │ │ │      * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ -    * _e_n_u_m_ _p_c_p___e_r_r_o_r_s
│ │ │ │ │ -    * _e_n_u_m_ _s_o_c_k_s___e_r_r_o_r___c_o_d_e
│ │ │ │ │      * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +    * _e_n_u_m_ _p_c_p___e_r_r_o_r_s
│ │ │ │ │ +    * _e_n_u_m_ _i_2_p___e_r_r_o_r___c_o_d_e
│ │ │ │ │      * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +    * _e_n_u_m_ _h_t_t_p___e_r_r_o_r_s
│ │ │ │ │ +    * _e_n_u_m_ _s_o_c_k_s___e_r_r_o_r___c_o_d_e
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ssttoorraaggee__eerrrroorr ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_r_r_o_r___c_o_d_e_._h_p_p"
│ │ │ │ │  used by storage to return errors also includes which underlying file the error
│ │ │ │ │  happened on
│ │ │ │ │  struct storage_error
│ │ │ │ │  {
│ │ │ │ │ @@ -50,52 +50,167 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    ec
│ │ │ │ │        the error that occurred
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    operation
│ │ │ │ │        A code from _o_p_e_r_a_t_i_o_n___t enum, indicating what kind of operation failed.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ggzziipp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_g_z_i_p_._h_p_p"
│ │ │ │ │ +boost::system::error_category& ggzziipp__ccaatteeggoorryy ();
│ │ │ │ │ +get the error_category for zip errors
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ uuppnnpp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_u_p_n_p_._h_p_p"
│ │ │ │ │ +boost::system::error_category& uuppnnpp__ccaatteeggoorryy ();
│ │ │ │ │ +the boost.system error category for UPnP errors
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ bbddeeccooddee__ccaatteeggoorryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ +boost::system::error_category& bbddeeccooddee__ccaatteeggoorryy ();
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ppccpp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_n_a_t_p_m_p_._h_p_p"
│ │ │ │ │ +boost::system::error_category& ppccpp__ccaatteeggoorryy ();
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ii22pp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_2_p___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │ +boost::system::error_category& ii22pp__ccaatteeggoorryy ();
│ │ │ │ │ +returns the error category for I2P errors
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ lliibbttoorrrreenntt__ccaatteeggoorryy(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_r_r_o_r___c_o_d_e_._h_p_p"
│ │ │ │ │  boost::system::error_category& lliibbttoorrrreenntt__ccaatteeggoorryy ();
│ │ │ │ │  return the instance of the libtorrent_error_category which maps libtorrent
│ │ │ │ │  error codes to human readable error messages.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ hhttttpp__ccaatteeggoorryy(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_r_r_o_r___c_o_d_e_._h_p_p"
│ │ │ │ │  boost::system::error_category& hhttttpp__ccaatteeggoorryy ();
│ │ │ │ │  returns the error_category for HTTP errors
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ii22pp__ccaatteeggoorryy(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_2_p___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │ -boost::system::error_category& ii22pp__ccaatteeggoorryy ();
│ │ │ │ │ -returns the error category for I2P errors
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ bbddeeccooddee__ccaatteeggoorryy(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ -boost::system::error_category& bbddeeccooddee__ccaatteeggoorryy ();
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppccpp__ccaatteeggoorryy(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_n_a_t_p_m_p_._h_p_p"
│ │ │ │ │ -boost::system::error_category& ppccpp__ccaatteeggoorryy ();
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ssoocckkss__ccaatteeggoorryy(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_o_c_k_s_5___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │  boost::system::error_category& ssoocckkss__ccaatteeggoorryy ();
│ │ │ │ │  returns the error_category for SOCKS5 errors
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ggzziipp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_g_z_i_p_._h_p_p"
│ │ │ │ │ -boost::system::error_category& ggzziipp__ccaatteeggoorryy ();
│ │ │ │ │ -get the error_category for zip errors
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_t_ _a_n_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|invalid_gzip_header                |1    |the supplied gzip buffer has       |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _h_e_a_d_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                                   |     |the gzip buffer would inflate to   |
│ │ │ │ │ +|inflated_data_too_large            |2    |more bytes than the specified      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_x_i_m_u_m_ _s_i_z_e_,_ _a_n_d_ _w_a_s_ _r_e_j_e_c_t_e_d_._ _ _ _ |
│ │ │ │ │ +|data_did_not_terminate             |3    |available inflate data did not     |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_e_r_m_i_n_a_t_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|space_exhausted                    |4    |output space exhausted before      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_m_p_l_e_t_i_n_g_ _i_n_f_l_a_t_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_n_v_a_l_i_d___b_l_o_c_k___t_y_p_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_5_ _ _ _ _|_i_n_v_a_l_i_d_ _b_l_o_c_k_ _t_y_p_e_ _(_t_y_p_e_ _=_=_ _3_)_ _ _ _ _ |
│ │ │ │ │ +|invalid_stored_block_length        |6    |stored block length did not match  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_n_e_'_s_ _c_o_m_p_l_e_m_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|too_many_length_or_distance_codes  |7    |dynamic block code description: too|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_n_y_ _l_e_n_g_t_h_ _o_r_ _d_i_s_t_a_n_c_e_ _c_o_d_e_s_ _ _ _ _ _ |
│ │ │ │ │ +|code_lengths_codes_incomplete      |8    |dynamic block code description:    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_d_e_ _l_e_n_g_t_h_s_ _c_o_d_e_s_ _i_n_c_o_m_p_l_e_t_e_ _ _ _ _ _ |
│ │ │ │ │ +|repeat_lengths_with_no_first_length|9    |dynamic block code description:    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_p_e_a_t_ _l_e_n_g_t_h_s_ _w_i_t_h_ _n_o_ _f_i_r_s_t_ _l_e_n_g_t_h|
│ │ │ │ │ +|repeat_more_than_specified_lengths |10   |dynamic block code description:    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_p_e_a_t_ _m_o_r_e_ _t_h_a_n_ _s_p_e_c_i_f_i_e_d_ _l_e_n_g_t_h_s_ |
│ │ │ │ │ +|invalid_literal_length_code_lengths|11   |dynamic block code description:    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _l_i_t_e_r_a_l_/_l_e_n_g_t_h_ _c_o_d_e_ _l_e_n_g_t_h_s|
│ │ │ │ │ +|invalid_distance_code_lengths      |12   |dynamic block code description:    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _d_i_s_t_a_n_c_e_ _c_o_d_e_ _l_e_n_g_t_h_s_ _ _ _ _ _ |
│ │ │ │ │ +|invalid_literal_code_in_block      |13   |invalid literal/length or distance |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_d_e_ _i_n_ _f_i_x_e_d_ _o_r_ _d_y_n_a_m_i_c_ _b_l_o_c_k_ _ _ _ _ |
│ │ │ │ │ +|distance_too_far_back_in_block     |14   |distance is too far back in fixed  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_r_ _d_y_n_a_m_i_c_ _b_l_o_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|unknown_gzip_error                 |15   |an unknown error occurred during   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_g_z_i_p_ _i_n_f_l_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_e_r_r_o_r___c_o_d_e___m_a_x_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_6_ _ _ _|_t_h_e_ _n_u_m_b_e_r_ _o_f_ _e_r_r_o_r_ _c_o_d_e_s_ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ uuppnnpp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_u_p_n_p_._h_p_p"
│ │ │ │ │ -boost::system::error_category& uuppnnpp__ccaatteeggoorryy ();
│ │ │ │ │ -the boost.system error category for UPnP errors
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|invalid_argument                  |402  |One of the arguments in the request |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_s_ _i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_a_c_t_i_o_n___f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_5_0_1_ _ _|_T_h_e_ _r_e_q_u_e_s_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|value_not_in_array                |714  |The specified value does not exist  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_ _t_h_e_ _a_r_r_a_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                                  |     |The source IP address cannot be     |
│ │ │ │ │ +|source_ip_cannot_be_wildcarded    |715  |wild-carded, but must be fully      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_p_e_c_i_f_i_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|external_port_cannot_be_wildcarded|716  |The external port cannot be a       |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_i_l_d_c_a_r_d_,_ _b_u_t_ _m_u_s_t_ _b_e_ _s_p_e_c_i_f_i_e_d_ _ _ _ _ |
│ │ │ │ │ +|                                  |     |The port mapping _e_n_t_r_y specified    |
│ │ │ │ │ +|port_mapping_conflict             |718  |conflicts with a mapping assigned   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_r_e_v_i_o_u_s_l_y_ _t_o_ _a_n_o_t_h_e_r_ _c_l_i_e_n_t_ _ _ _ _ _ _ _ |
│ │ │ │ │ +|internal_port_must_match_external |724  |Internal and external port value    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_u_s_t_ _b_e_ _t_h_e_ _s_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                                  |     |The NAT implementation only supports|
│ │ │ │ │ +|only_permanent_leases_supported   |725  |permanent lease times on port       |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_p_p_i_n_g_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                                  |     |RemoteHost must be a wildcard and   |
│ │ │ │ │ +|remote_host_must_be_wildcard      |726  |cannot be a specific IP address or  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_D_N_S_ _n_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|external_port_must_be_wildcard    |727  |ExternalPort must be a wildcard and |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_a_n_n_o_t_ _b_e_ _a_ _s_p_e_c_i_f_i_c_ _p_o_r_t_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_o___e_r_r_o_r_ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_t_ _a_n_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_e_x_p_e_c_t_e_d___d_i_g_i_t_|_1_ _ _ _ _|_e_x_p_e_c_t_e_d_ _d_i_g_i_t_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_e_x_p_e_c_t_e_d___c_o_l_o_n_|_2_ _ _ _ _|_e_x_p_e_c_t_e_d_ _c_o_l_o_n_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_u_n_e_x_p_e_c_t_e_d___e_o_f_|_3_ _ _ _ _|_u_n_e_x_p_e_c_t_e_d_ _e_n_d_ _o_f_ _f_i_l_e_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|expected_value|4    |expected value (list, dict, _i_n_t or string) in bencoded|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_e_p_t_h___e_x_c_e_e_d_e_d_|_5_ _ _ _ _|_b_e_n_c_o_d_e_d_ _r_e_c_u_r_s_i_o_n_ _d_e_p_t_h_ _l_i_m_i_t_ _e_x_c_e_e_d_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_l_i_m_i_t___e_x_c_e_e_d_e_d_|_6_ _ _ _ _|_b_e_n_c_o_d_e_d_ _i_t_e_m_ _c_o_u_n_t_ _l_i_m_i_t_ _e_x_c_e_e_d_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_o_v_e_r_f_l_o_w_ _ _ _ _ _ _|_7_ _ _ _ _|_i_n_t_e_g_e_r_ _o_v_e_r_f_l_o_w_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_e_r_r_o_r___c_o_d_e___m_a_x_|_8_ _ _ _ _|_t_h_e_ _n_u_m_b_e_r_ _o_f_ _e_r_r_o_r_ _c_o_d_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ppccpp__eerrrroorrss ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_n_a_t_p_m_p_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_p_c_p___s_u_c_c_e_s_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___u_n_s_u_p_p___v_e_r_s_i_o_n_ _ _ _ _ _ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___n_o_t___a_u_t_h_o_r_i_z_e_d_ _ _ _ _ _ _ _ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___m_a_l_f_o_r_m_e_d___r_e_q_u_e_s_t_ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___u_n_s_u_p_p___o_p_c_o_d_e_ _ _ _ _ _ _ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___u_n_s_u_p_p___o_p_t_i_o_n_ _ _ _ _ _ _ _ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___m_a_l_f_o_r_m_e_d___o_p_t_i_o_n_ _ _ _ _ _ _ _|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___n_e_t_w_o_r_k___f_a_i_l_u_r_e_ _ _ _ _ _ _ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___n_o___r_e_s_o_u_r_c_e_s_ _ _ _ _ _ _ _ _ _ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___u_n_s_u_p_p___p_r_o_t_o_c_o_l_ _ _ _ _ _ _ _ _|_9_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___u_s_e_r___e_x___q_u_o_t_a_ _ _ _ _ _ _ _ _ _ _|_1_0_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___c_a_n_n_o_t___p_r_o_v_i_d_e___e_x_t_e_r_n_a_l_|_1_1_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___a_d_d_r_e_s_s___m_i_s_m_a_t_c_h_ _ _ _ _ _ _ _|_1_2_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___e_x_c_e_s_s_i_v_e___r_e_m_o_t_e___p_e_e_r_s_ _|_1_3_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ii22pp__eerrrroorr__ccooddee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_2_p___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_a_r_s_e___f_a_i_l_e_d_ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_c_a_n_t___r_e_a_c_h___p_e_e_r_|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_2_p___e_r_r_o_r_ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_n_v_a_l_i_d___k_e_y_ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_n_v_a_l_i_d___i_d_ _ _ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_t_i_m_e_o_u_t_ _ _ _ _ _ _ _ _|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_k_e_y___n_o_t___f_o_u_n_d_ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_u_p_l_i_c_a_t_e_d___i_d_ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_u_m___e_r_r_o_r_s_ _ _ _ _ _|_9_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_r_r_o_r___c_o_d_e_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_t_ _a_n_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |file_collision                      |1    |Two torrents has files which end  |
│ │ │ │ │ @@ -492,63 +607,14 @@
│ │ │ │ │  |_f_o_r_b_i_d_d_e_n_ _ _ _ _ _ _ _ _ _ _ _ _|_4_0_3_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_n_o_t___f_o_u_n_d_ _ _ _ _ _ _ _ _ _ _ _ _|_4_0_4_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_i_n_t_e_r_n_a_l___s_e_r_v_e_r___e_r_r_o_r_|_5_0_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_n_o_t___i_m_p_l_e_m_e_n_t_e_d_ _ _ _ _ _ _|_5_0_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_b_a_d___g_a_t_e_w_a_y_ _ _ _ _ _ _ _ _ _ _|_5_0_2_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_s_e_r_v_i_c_e___u_n_a_v_a_i_l_a_b_l_e_ _ _|_5_0_3_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ii22pp__eerrrroorr__ccooddee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_2_p___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_a_r_s_e___f_a_i_l_e_d_ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_c_a_n_t___r_e_a_c_h___p_e_e_r_|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_2_p___e_r_r_o_r_ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_n_v_a_l_i_d___k_e_y_ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_n_v_a_l_i_d___i_d_ _ _ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_t_i_m_e_o_u_t_ _ _ _ _ _ _ _ _|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_k_e_y___n_o_t___f_o_u_n_d_ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_u_p_l_i_c_a_t_e_d___i_d_ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_u_m___e_r_r_o_r_s_ _ _ _ _ _|_9_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_o___e_r_r_o_r_ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_t_ _a_n_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_e_x_p_e_c_t_e_d___d_i_g_i_t_|_1_ _ _ _ _|_e_x_p_e_c_t_e_d_ _d_i_g_i_t_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_e_x_p_e_c_t_e_d___c_o_l_o_n_|_2_ _ _ _ _|_e_x_p_e_c_t_e_d_ _c_o_l_o_n_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_u_n_e_x_p_e_c_t_e_d___e_o_f_|_3_ _ _ _ _|_u_n_e_x_p_e_c_t_e_d_ _e_n_d_ _o_f_ _f_i_l_e_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|expected_value|4    |expected value (list, dict, _i_n_t or string) in bencoded|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_e_p_t_h___e_x_c_e_e_d_e_d_|_5_ _ _ _ _|_b_e_n_c_o_d_e_d_ _r_e_c_u_r_s_i_o_n_ _d_e_p_t_h_ _l_i_m_i_t_ _e_x_c_e_e_d_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_l_i_m_i_t___e_x_c_e_e_d_e_d_|_6_ _ _ _ _|_b_e_n_c_o_d_e_d_ _i_t_e_m_ _c_o_u_n_t_ _l_i_m_i_t_ _e_x_c_e_e_d_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_o_v_e_r_f_l_o_w_ _ _ _ _ _ _|_7_ _ _ _ _|_i_n_t_e_g_e_r_ _o_v_e_r_f_l_o_w_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_e_r_r_o_r___c_o_d_e___m_a_x_|_8_ _ _ _ _|_t_h_e_ _n_u_m_b_e_r_ _o_f_ _e_r_r_o_r_ _c_o_d_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ppccpp__eerrrroorrss ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_n_a_t_p_m_p_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_p_c_p___s_u_c_c_e_s_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___u_n_s_u_p_p___v_e_r_s_i_o_n_ _ _ _ _ _ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___n_o_t___a_u_t_h_o_r_i_z_e_d_ _ _ _ _ _ _ _ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___m_a_l_f_o_r_m_e_d___r_e_q_u_e_s_t_ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___u_n_s_u_p_p___o_p_c_o_d_e_ _ _ _ _ _ _ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___u_n_s_u_p_p___o_p_t_i_o_n_ _ _ _ _ _ _ _ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___m_a_l_f_o_r_m_e_d___o_p_t_i_o_n_ _ _ _ _ _ _ _|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___n_e_t_w_o_r_k___f_a_i_l_u_r_e_ _ _ _ _ _ _ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___n_o___r_e_s_o_u_r_c_e_s_ _ _ _ _ _ _ _ _ _ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___u_n_s_u_p_p___p_r_o_t_o_c_o_l_ _ _ _ _ _ _ _ _|_9_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___u_s_e_r___e_x___q_u_o_t_a_ _ _ _ _ _ _ _ _ _ _|_1_0_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___c_a_n_n_o_t___p_r_o_v_i_d_e___e_x_t_e_r_n_a_l_|_1_1_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___a_d_d_r_e_s_s___m_i_s_m_a_t_c_h_ _ _ _ _ _ _ _|_1_2_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___e_x_c_e_s_s_i_v_e___r_e_m_o_t_e___p_e_e_r_s_ _|_1_3_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ eennuumm ssoocckkss__eerrrroorr__ccooddee ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_o_c_k_s_5___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │  |_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_u_n_s_u_p_p_o_r_t_e_d___v_e_r_s_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_u_n_s_u_p_p_o_r_t_e_d___a_u_t_h_e_n_t_i_c_a_t_i_o_n___m_e_t_h_o_d_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ @@ -556,80 +622,14 @@
│ │ │ │ │  |_a_u_t_h_e_n_t_i_c_a_t_i_o_n___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_u_s_e_r_n_a_m_e___r_e_q_u_i_r_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_g_e_n_e_r_a_l___f_a_i_l_u_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_c_o_m_m_a_n_d___n_o_t___s_u_p_p_o_r_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_n_o___i_d_e_n_t_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_i_d_e_n_t_d___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_n_u_m___e_r_r_o_r_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_0_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_g_z_i_p_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_t_ _a_n_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|invalid_gzip_header                |1    |the supplied gzip buffer has       |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _h_e_a_d_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                                   |     |the gzip buffer would inflate to   |
│ │ │ │ │ -|inflated_data_too_large            |2    |more bytes than the specified      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_x_i_m_u_m_ _s_i_z_e_,_ _a_n_d_ _w_a_s_ _r_e_j_e_c_t_e_d_._ _ _ _ |
│ │ │ │ │ -|data_did_not_terminate             |3    |available inflate data did not     |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_e_r_m_i_n_a_t_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|space_exhausted                    |4    |output space exhausted before      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_m_p_l_e_t_i_n_g_ _i_n_f_l_a_t_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_n_v_a_l_i_d___b_l_o_c_k___t_y_p_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_5_ _ _ _ _|_i_n_v_a_l_i_d_ _b_l_o_c_k_ _t_y_p_e_ _(_t_y_p_e_ _=_=_ _3_)_ _ _ _ _ |
│ │ │ │ │ -|invalid_stored_block_length        |6    |stored block length did not match  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_n_e_'_s_ _c_o_m_p_l_e_m_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|too_many_length_or_distance_codes  |7    |dynamic block code description: too|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_n_y_ _l_e_n_g_t_h_ _o_r_ _d_i_s_t_a_n_c_e_ _c_o_d_e_s_ _ _ _ _ _ |
│ │ │ │ │ -|code_lengths_codes_incomplete      |8    |dynamic block code description:    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_d_e_ _l_e_n_g_t_h_s_ _c_o_d_e_s_ _i_n_c_o_m_p_l_e_t_e_ _ _ _ _ _ |
│ │ │ │ │ -|repeat_lengths_with_no_first_length|9    |dynamic block code description:    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_p_e_a_t_ _l_e_n_g_t_h_s_ _w_i_t_h_ _n_o_ _f_i_r_s_t_ _l_e_n_g_t_h|
│ │ │ │ │ -|repeat_more_than_specified_lengths |10   |dynamic block code description:    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_p_e_a_t_ _m_o_r_e_ _t_h_a_n_ _s_p_e_c_i_f_i_e_d_ _l_e_n_g_t_h_s_ |
│ │ │ │ │ -|invalid_literal_length_code_lengths|11   |dynamic block code description:    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _l_i_t_e_r_a_l_/_l_e_n_g_t_h_ _c_o_d_e_ _l_e_n_g_t_h_s|
│ │ │ │ │ -|invalid_distance_code_lengths      |12   |dynamic block code description:    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _d_i_s_t_a_n_c_e_ _c_o_d_e_ _l_e_n_g_t_h_s_ _ _ _ _ _ |
│ │ │ │ │ -|invalid_literal_code_in_block      |13   |invalid literal/length or distance |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_d_e_ _i_n_ _f_i_x_e_d_ _o_r_ _d_y_n_a_m_i_c_ _b_l_o_c_k_ _ _ _ _ |
│ │ │ │ │ -|distance_too_far_back_in_block     |14   |distance is too far back in fixed  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_r_ _d_y_n_a_m_i_c_ _b_l_o_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|unknown_gzip_error                 |15   |an unknown error occurred during   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_g_z_i_p_ _i_n_f_l_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_e_r_r_o_r___c_o_d_e___m_a_x_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_6_ _ _ _|_t_h_e_ _n_u_m_b_e_r_ _o_f_ _e_r_r_o_r_ _c_o_d_e_s_ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_u_p_n_p_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|invalid_argument                  |402  |One of the arguments in the request |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_s_ _i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_a_c_t_i_o_n___f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_5_0_1_ _ _|_T_h_e_ _r_e_q_u_e_s_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|value_not_in_array                |714  |The specified value does not exist  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_ _t_h_e_ _a_r_r_a_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                                  |     |The source IP address cannot be     |
│ │ │ │ │ -|source_ip_cannot_be_wildcarded    |715  |wild-carded, but must be fully      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_p_e_c_i_f_i_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|external_port_cannot_be_wildcarded|716  |The external port cannot be a       |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_i_l_d_c_a_r_d_,_ _b_u_t_ _m_u_s_t_ _b_e_ _s_p_e_c_i_f_i_e_d_ _ _ _ _ |
│ │ │ │ │ -|                                  |     |The port mapping _e_n_t_r_y specified    |
│ │ │ │ │ -|port_mapping_conflict             |718  |conflicts with a mapping assigned   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_r_e_v_i_o_u_s_l_y_ _t_o_ _a_n_o_t_h_e_r_ _c_l_i_e_n_t_ _ _ _ _ _ _ _ |
│ │ │ │ │ -|internal_port_must_match_external |724  |Internal and external port value    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_u_s_t_ _b_e_ _t_h_e_ _s_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                                  |     |The NAT implementation only supports|
│ │ │ │ │ -|only_permanent_leases_supported   |725  |permanent lease times on port       |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_p_p_i_n_g_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                                  |     |RemoteHost must be a wildcard and   |
│ │ │ │ │ -|remote_host_must_be_wildcard      |726  |cannot be a specific IP address or  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_D_N_S_ _n_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|external_port_must_be_wildcard    |727  |ExternalPort must be a wildcard and |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_a_n_n_o_t_ _b_e_ _a_ _s_p_e_c_i_f_i_c_ _p_o_r_t_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  _b_l_o_g
│ │ │ │ │  _u_T_P
│ │ │ │ │  _d_o_w_n_l_o_a_d
│ │ │ │ │  _d_o_c_u_m_e_n_t_a_t_i_o_n
│ │ │ │ │  _D_H_T_ _p_u_t_ _e_x_t_e_n_s_i_o_n
│ │ │ │ │  _p_y_t_h_o_n_ _b_i_n_d_i_n_g_s
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Filter.html
│ │ │ │┄ Ordering differences only
│ │ │ │ @@ -56,19 +56,19 @@
│ │ │ │  a single rule that allows all addresses (0.0.0.0 - 255.255.255.255 for
│ │ │ │  the IPv4 range, and the equivalent range covering all addresses for the
│ │ │ │  IPv6 range).</p>
│ │ │ │  <p>A default constructed <a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a> does not filter any address.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct ip_filter
│ │ │ │  {
│ │ │ │ +   <strong>ip_filter</strong> (ip_filter const&amp;);
│ │ │ │     <strong>ip_filter</strong> (ip_filter&amp;&amp;);
│ │ │ │     <strong>~ip_filter</strong> ();
│ │ │ │ -   <strong>ip_filter</strong> (ip_filter const&amp;);
│ │ │ │ -   ip_filter&amp; <strong>operator=</strong> (ip_filter&amp;&amp;);
│ │ │ │     <strong>ip_filter</strong> ();
│ │ │ │ +   ip_filter&amp; <strong>operator=</strong> (ip_filter&amp;&amp;);
│ │ │ │     ip_filter&amp; <strong>operator=</strong> (ip_filter const&amp;);
│ │ │ │     bool <strong>empty</strong> () const;
│ │ │ │     void <strong>add_rule</strong> (address const&amp; first, address const&amp; last, std::uint32_t flags);
│ │ │ │     std::uint32_t <strong>access</strong> (address const&amp; addr) const;
│ │ │ │     filter_tuple_t <strong>export_filter</strong> () const;
│ │ │ │  
│ │ │ │     enum access_flags
│ │ │ │ @@ -153,20 +153,20 @@
│ │ │ │  <p>the port filter maps non-overlapping port ranges to flags. This
│ │ │ │  is primarily used to indicate whether a range of ports should
│ │ │ │  be connected to or not. The default is to have the full port
│ │ │ │  range (0-65535) set to flag 0.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  class port_filter
│ │ │ │  {
│ │ │ │ +   port_filter&amp; <strong>operator=</strong> (port_filter&amp;&amp;);
│ │ │ │ +   <strong>port_filter</strong> (port_filter&amp;&amp;);
│ │ │ │     <strong>port_filter</strong> (port_filter const&amp;);
│ │ │ │     port_filter&amp; <strong>operator=</strong> (port_filter const&amp;);
│ │ │ │     <strong>port_filter</strong> ();
│ │ │ │     <strong>~port_filter</strong> ();
│ │ │ │ -   <strong>port_filter</strong> (port_filter&amp;&amp;);
│ │ │ │ -   port_filter&amp; <strong>operator=</strong> (port_filter&amp;&amp;);
│ │ │ │     void <strong>add_rule</strong> (std::uint16_t first, std::uint16_t last, std::uint32_t flags);
│ │ │ │     std::uint32_t <strong>access</strong> (std::uint16_t port) const;
│ │ │ │  
│ │ │ │     enum access_flags
│ │ │ │     {
│ │ │ │        blocked,
│ │ │ │     };
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -19,19 +19,19 @@
│ │ │ │ │  The ip_filter class is a set of rules that uniquely categorizes all ip
│ │ │ │ │  addresses as allowed or disallowed. The default constructor creates a single
│ │ │ │ │  rule that allows all addresses (0.0.0.0 - 255.255.255.255 for the IPv4 range,
│ │ │ │ │  and the equivalent range covering all addresses for the IPv6 range).
│ │ │ │ │  A default constructed _i_p___f_i_l_t_e_r does not filter any address.
│ │ │ │ │  struct ip_filter
│ │ │ │ │  {
│ │ │ │ │ +   iipp__ffiilltteerr (ip_filter const&);
│ │ │ │ │     iipp__ffiilltteerr (ip_filter&&);
│ │ │ │ │     ~~iipp__ffiilltteerr ();
│ │ │ │ │ -   iipp__ffiilltteerr (ip_filter const&);
│ │ │ │ │ -   ip_filter& ooppeerraattoorr== (ip_filter&&);
│ │ │ │ │     iipp__ffiilltteerr ();
│ │ │ │ │ +   ip_filter& ooppeerraattoorr== (ip_filter&&);
│ │ │ │ │     ip_filter& ooppeerraattoorr== (ip_filter const&);
│ │ │ │ │     bool eemmppttyy () const;
│ │ │ │ │     void aadddd__rruullee (address const& first, address const& last, std::uint32_t
│ │ │ │ │  flags);
│ │ │ │ │     std::uint32_t aacccceessss (address const& addr) const;
│ │ │ │ │     filter_tuple_t eexxppoorrtt__ffiilltteerr () const;
│ │ │ │ │  
│ │ │ │ │ @@ -81,20 +81,20 @@
│ │ │ │ │  ************ ppoorrtt__ffiilltteerr ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_p___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │  the port filter maps non-overlapping port ranges to flags. This is primarily
│ │ │ │ │  used to indicate whether a range of ports should be connected to or not. The
│ │ │ │ │  default is to have the full port range (0-65535) set to flag 0.
│ │ │ │ │  class port_filter
│ │ │ │ │  {
│ │ │ │ │ +   port_filter& ooppeerraattoorr== (port_filter&&);
│ │ │ │ │ +   ppoorrtt__ffiilltteerr (port_filter&&);
│ │ │ │ │     ppoorrtt__ffiilltteerr (port_filter const&);
│ │ │ │ │     port_filter& ooppeerraattoorr== (port_filter const&);
│ │ │ │ │     ppoorrtt__ffiilltteerr ();
│ │ │ │ │     ~~ppoorrtt__ffiilltteerr ();
│ │ │ │ │ -   ppoorrtt__ffiilltteerr (port_filter&&);
│ │ │ │ │ -   port_filter& ooppeerraattoorr== (port_filter&&);
│ │ │ │ │     void aadddd__rruullee (std::uint16_t first, std::uint16_t last, std::uint32_t
│ │ │ │ │  flags);
│ │ │ │ │     std::uint32_t aacccceessss (std::uint16_t port) const;
│ │ │ │ │  
│ │ │ │ │     enum access_flags
│ │ │ │ │     {
│ │ │ │ │        blocked,
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-PeerClass.html
│ │ │ │ @@ -30,15 +30,15 @@
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │  <li><a class="reference internal" href="#peer-class-info" id="toc-entry-1">peer_class_info</a></li>
│ │ │ │  <li><a class="reference internal" href="#peer-class-type-filter" id="toc-entry-2">peer_class_type_filter</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#remove-add" id="toc-entry-3">remove() add()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-remove" id="toc-entry-3">add() remove()</a></li>
│ │ │ │  <li><a class="reference internal" href="#allow-disallow" id="toc-entry-4">allow() disallow()</a></li>
│ │ │ │  <li><a class="reference internal" href="#apply" id="toc-entry-5">apply()</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-socket-type-t" id="toc-entry-6">enum socket_type_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │ @@ -106,16 +106,16 @@
│ │ │ │  peer-classes from peers. It is applied <em>after</em> the peer class filter is applied (which
│ │ │ │  is based on the peer's IP address).</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct peer_class_type_filter
│ │ │ │  {
│ │ │ │     void <strong>add</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │     void <strong>remove</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ -   void <strong>allow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │     void <strong>disallow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ +   void <strong>allow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │     std::uint32_t <strong>apply</strong> (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ │     friend bool <strong>operator==</strong> (peer_class_type_filter const&amp; lhs
│ │ │ │        , peer_class_type_filter const&amp; rhs);
│ │ │ │  
│ │ │ │     enum socket_type_t
│ │ │ │     {
│ │ │ │        tcp_socket,
│ │ │ │ @@ -123,30 +123,30 @@
│ │ │ │        ssl_tcp_socket,
│ │ │ │        ssl_utp_socket,
│ │ │ │        i2p_socket,
│ │ │ │        num_socket_types,
│ │ │ │     };
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="remove()"></a>
│ │ │ │ -<a name="add()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_type_filter%3A%3A%5Bremove%28%29+add%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_type_filter%3A%3A%5Bremove%28%29+add%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="remove-add">
│ │ │ │ -<h2>remove() add()</h2>
│ │ │ │ +<a name="add()"></a>
│ │ │ │ +<a name="remove()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_type_filter%3A%3A%5Badd%28%29+remove%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_type_filter%3A%3A%5Badd%28%29+remove%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="add-remove">
│ │ │ │ +<h2>add() remove()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>add</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │  void <strong>remove</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">add()</tt> and <tt class="docutils literal">remove()</tt> adds and removes a peer class to be added
│ │ │ │  to new peers based on socket type.</p>
│ │ │ │  <a name="allow()"></a>
│ │ │ │  <a name="disallow()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_type_filter%3A%3A%5Ballow%28%29+disallow%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_type_filter%3A%3A%5Ballow%28%29+disallow%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="allow-disallow">
│ │ │ │  <h2>allow() disallow()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>allow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │  void <strong>disallow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ +void <strong>allow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">disallow()</tt> and <tt class="docutils literal">allow()</tt> adds and removes a peer class to be
│ │ │ │  removed from new peers based on socket type.</p>
│ │ │ │  <p>The <tt class="docutils literal">peer_class</tt> argument cannot be greater than 31. The bitmasks representing
│ │ │ │  peer classes in the <tt class="docutils literal">peer_class_type_filter</tt> are 32 bits.</p>
│ │ │ │  <a name="apply()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_type_filter%3A%3A%5Bapply%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_type_filter%3A%3A%5Bapply%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="apply">
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,15 +1,15 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │      * _p_e_e_r___c_l_a_s_s___i_n_f_o
│ │ │ │ │      * _p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r
│ │ │ │ │ -          o _r_e_m_o_v_e_(_)_ _a_d_d_(_)
│ │ │ │ │ +          o _a_d_d_(_)_ _r_e_m_o_v_e_(_)
│ │ │ │ │            o _a_l_l_o_w_(_)_ _d_i_s_a_l_l_o_w_(_)
│ │ │ │ │            o _a_p_p_l_y_(_)
│ │ │ │ │            o _e_n_u_m_ _s_o_c_k_e_t___t_y_p_e___t
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ppeeeerr__ccllaassss__iinnffoo ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_l_a_s_s_._h_p_p"
│ │ │ │ │  holds settings for a peer class. Used in _s_e_t___p_e_e_r___c_l_a_s_s_(_) and _g_e_t___p_e_e_r___c_l_a_s_s_(_)
│ │ │ │ │ @@ -61,16 +61,16 @@
│ │ │ │ │  peer_class_type_filter is a simple container for rules for adding and
│ │ │ │ │  subtracting peer-classes from peers. It is applied aafftteerr the peer class filter
│ │ │ │ │  is applied (which is based on the peer's IP address).
│ │ │ │ │  struct peer_class_type_filter
│ │ │ │ │  {
│ │ │ │ │     void aadddd (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │     void rreemmoovvee (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ -   void aallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │     void ddiissaallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ +   void aallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │     std::uint32_t aappppllyy (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ │ │     friend bool ooppeerraattoorr==== (peer_class_type_filter const& lhs
│ │ │ │ │        , peer_class_type_filter const& rhs);
│ │ │ │ │  
│ │ │ │ │     enum socket_type_t
│ │ │ │ │     {
│ │ │ │ │        tcp_socket,
│ │ │ │ │ @@ -78,23 +78,23 @@
│ │ │ │ │        ssl_tcp_socket,
│ │ │ │ │        ssl_utp_socket,
│ │ │ │ │        i2p_socket,
│ │ │ │ │        num_socket_types,
│ │ │ │ │     };
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreemmoovvee(()) aadddd(()) **********
│ │ │ │ │ +********** aadddd(()) rreemmoovvee(()) **********
│ │ │ │ │  void aadddd (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │  void rreemmoovvee (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │  add() and remove() adds and removes a peer class to be added to new peers based
│ │ │ │ │  on socket type.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aallllooww(()) ddiissaallllooww(()) **********
│ │ │ │ │ -void aallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │  void ddiissaallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ +void aallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │  disallow() and allow() adds and removes a peer class to be removed from new
│ │ │ │ │  peers based on socket type.
│ │ │ │ │  The peer_class argument cannot be greater than 31. The bitmasks representing
│ │ │ │ │  peer classes in the peer_class_type_filter are 32 bits.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aappppllyy(()) **********
│ │ │ │ │  std::uint32_t aappppllyy (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Plugins.html
│ │ │ │ @@ -48,47 +48,47 @@
│ │ │ │  <li><a class="reference internal" href="#on-tick" id="toc-entry-14">on_tick()</a></li>
│ │ │ │  <li><a class="reference internal" href="#get-unchoke-priority" id="toc-entry-15">get_unchoke_priority()</a></li>
│ │ │ │  <li><a class="reference internal" href="#load-state" id="toc-entry-16">load_state()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  <li><a class="reference internal" href="#torrent-plugin" id="toc-entry-17">torrent_plugin</a><ul>
│ │ │ │  <li><a class="reference internal" href="#new-connection" id="toc-entry-18">new_connection()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-piece-pass-on-piece-failed" id="toc-entry-19">on_piece_pass() on_piece_failed()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-piece-failed-on-piece-pass" id="toc-entry-19">on_piece_failed() on_piece_pass()</a></li>
│ │ │ │  <li><a class="reference internal" href="#tick" id="toc-entry-20">tick()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-resume-on-pause" id="toc-entry-21">on_resume() on_pause()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-pause-on-resume" id="toc-entry-21">on_pause() on_resume()</a></li>
│ │ │ │  <li><a class="reference internal" href="#on-files-checked" id="toc-entry-22">on_files_checked()</a></li>
│ │ │ │  <li><a class="reference internal" href="#on-state" id="toc-entry-23">on_state()</a></li>
│ │ │ │  <li><a class="reference internal" href="#on-add-peer" id="toc-entry-24">on_add_peer()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  <li><a class="reference internal" href="#peer-plugin" id="toc-entry-25">peer_plugin</a><ul>
│ │ │ │  <li><a class="reference internal" href="#type" id="toc-entry-26">type()</a></li>
│ │ │ │  <li><a class="reference internal" href="#add-handshake" id="toc-entry-27">add_handshake()</a></li>
│ │ │ │  <li><a class="reference internal" href="#on-disconnect" id="toc-entry-28">on_disconnect()</a></li>
│ │ │ │  <li><a class="reference internal" href="#on-connected" id="toc-entry-29">on_connected()</a></li>
│ │ │ │  <li><a class="reference internal" href="#on-handshake" id="toc-entry-30">on_handshake()</a></li>
│ │ │ │  <li><a class="reference internal" href="#on-extension-handshake" id="toc-entry-31">on_extension_handshake()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-request-on-bitfield-on-allowed-fast-on-unchoke-on-have-on-interested-on-have-none-on-not-interested-on-dont-have-on-choke-on-have-all" id="toc-entry-32">on_request() on_bitfield() on_allowed_fast() on_unchoke() on_have() on_interested() on_have_none() on_not_interested() on_dont_have() on_choke() on_have_all()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-unchoke-on-bitfield-on-not-interested-on-have-on-dont-have-on-have-none-on-request-on-allowed-fast-on-choke-on-have-all-on-interested" id="toc-entry-32">on_unchoke() on_bitfield() on_not_interested() on_have() on_dont_have() on_have_none() on_request() on_allowed_fast() on_choke() on_have_all() on_interested()</a></li>
│ │ │ │  <li><a class="reference internal" href="#on-piece" id="toc-entry-33">on_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#sent-interested-sent-not-interested-sent-piece-sent-unchoke-sent-have" id="toc-entry-34">sent_interested() sent_not_interested() sent_piece() sent_unchoke() sent_have()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#sent-unchoke-sent-interested-sent-not-interested-sent-have-sent-piece" id="toc-entry-34">sent_unchoke() sent_interested() sent_not_interested() sent_have() sent_piece()</a></li>
│ │ │ │  <li><a class="reference internal" href="#sent-payload" id="toc-entry-35">sent_payload()</a></li>
│ │ │ │  <li><a class="reference internal" href="#can-disconnect" id="toc-entry-36">can_disconnect()</a></li>
│ │ │ │  <li><a class="reference internal" href="#on-extended" id="toc-entry-37">on_extended()</a></li>
│ │ │ │  <li><a class="reference internal" href="#on-unknown-message" id="toc-entry-38">on_unknown_message()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-piece-pass-on-piece-failed-1" id="toc-entry-39">on_piece_pass() on_piece_failed()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-piece-failed-on-piece-pass-1" id="toc-entry-39">on_piece_failed() on_piece_pass()</a></li>
│ │ │ │  <li><a class="reference internal" href="#tick-1" id="toc-entry-40">tick()</a></li>
│ │ │ │  <li><a class="reference internal" href="#write-request" id="toc-entry-41">write_request()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  <li><a class="reference internal" href="#crypto-plugin" id="toc-entry-42">crypto_plugin</a><ul>
│ │ │ │  <li><a class="reference internal" href="#decrypt" id="toc-entry-43">decrypt()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#create-smart-ban-plugin" id="toc-entry-44">create_smart_ban_plugin()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#create-ut-pex-plugin" id="toc-entry-45">create_ut_pex_plugin()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#create-ut-pex-plugin" id="toc-entry-44">create_ut_pex_plugin()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#create-smart-ban-plugin" id="toc-entry-45">create_smart_ban_plugin()</a></li>
│ │ │ │  <li><a class="reference internal" href="#create-ut-metadata-plugin" id="toc-entry-46">create_ut_metadata_plugin()</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │  <p>libtorrent has a <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> interface for implementing extensions to the protocol.
│ │ │ │  These can be general extensions for transferring metadata or peer exchange
│ │ │ │  extensions, or it could be used to provide a way to customize the protocol
│ │ │ │  to fit a particular (closed) network.</p>
│ │ │ │ @@ -190,69 +190,69 @@
│ │ │ │  connection object, to be used by plugins. This is a low level interface that
│ │ │ │  may not be stable across libtorrent versions</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct peer_connection_handle
│ │ │ │  {
│ │ │ │     explicit <strong>peer_connection_handle</strong> (std::weak_ptr&lt;peer_connection&gt; impl);
│ │ │ │     connection_type <strong>type</strong> () const;
│ │ │ │ -   peer_plugin const* <strong>find_plugin</strong> (string_view type) const;
│ │ │ │     void <strong>add_extension</strong> (std::shared_ptr&lt;peer_plugin&gt;);
│ │ │ │ +   peer_plugin const* <strong>find_plugin</strong> (string_view type) const;
│ │ │ │     bool <strong>is_seed</strong> () const;
│ │ │ │     bool <strong>upload_only</strong> () const;
│ │ │ │ -   bool <strong>has_piece</strong> (piece_index_t i) const;
│ │ │ │     peer_id const&amp; <strong>pid</strong> () const;
│ │ │ │ -   bool <strong>is_choked</strong> () const;
│ │ │ │ +   bool <strong>has_piece</strong> (piece_index_t i) const;
│ │ │ │     bool <strong>is_interesting</strong> () const;
│ │ │ │ +   bool <strong>is_choked</strong> () const;
│ │ │ │     bool <strong>has_peer_choked</strong> () const;
│ │ │ │     bool <strong>is_peer_interested</strong> () const;
│ │ │ │     void <strong>choke_this_peer</strong> ();
│ │ │ │     void <strong>maybe_unchoke_this_peer</strong> ();
│ │ │ │     void <strong>get_peer_info</strong> (peer_info&amp; p) const;
│ │ │ │     torrent_handle <strong>associated_torrent</strong> () const;
│ │ │ │     <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> const&amp; <strong>remote</strong> () const;
│ │ │ │     <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>local_endpoint</strong> () const;
│ │ │ │ -   bool <strong>is_disconnecting</strong> () const;
│ │ │ │ -   bool <strong>is_outgoing</strong> () const;
│ │ │ │ -   bool <strong>is_connecting</strong> () const;
│ │ │ │     void <strong>disconnect</strong> (error_code const&amp; ec, operation_t op
│ │ │ │        , disconnect_severity_t = peer_connection_interface::normal);
│ │ │ │ +   bool <strong>is_connecting</strong> () const;
│ │ │ │ +   bool <strong>is_outgoing</strong> () const;
│ │ │ │ +   bool <strong>is_disconnecting</strong> () const;
│ │ │ │     bool <strong>ignore_unchoke_slots</strong> () const;
│ │ │ │     bool <strong>on_local_network</strong> () const;
│ │ │ │     bool <strong>failed</strong> () const;
│ │ │ │     bool <strong>should_log</strong> (peer_log_alert::direction_t direction) const;
│ │ │ │     void <strong>peer_log</strong> (peer_log_alert::direction_t direction
│ │ │ │        , char const* event, char const* fmt = &quot;&quot;, ...) const TORRENT_FORMAT(4,5);
│ │ │ │     bool <strong>can_disconnect</strong> (error_code const&amp; ec) const;
│ │ │ │     bool <strong>has_metadata</strong> () const;
│ │ │ │     bool <strong>in_handshake</strong> () const;
│ │ │ │     void <strong>send_buffer</strong> (char const* begin, int size);
│ │ │ │     time_point <strong>time_of_last_unchoke</strong> () const;
│ │ │ │     std::time_t <strong>last_seen_complete</strong> () const;
│ │ │ │ -   bool <strong>operator==</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │ -   bool <strong>operator&lt;</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │     bool <strong>operator!=</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │ +   bool <strong>operator&lt;</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │ +   bool <strong>operator==</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │     std::shared_ptr&lt;peer_connection&gt; <strong>native_handle</strong> () const;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="bt_peer_connection_handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+bt_peer_connection_handle&labels=documentation&body=Documentation+under+heading+%22class+bt_peer_connection_handle%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="bt-peer-connection-handle">
│ │ │ │  <h1>bt_peer_connection_handle</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_connection_handle.hpp">libtorrent/peer_connection_handle.hpp</a>&quot;</p>
│ │ │ │  <p>The <a class="reference external" href="reference-Plugins.html#bt_peer_connection_handle">bt_peer_connection_handle</a> provides a handle to the internal bittorrent
│ │ │ │  peer connection object to plugins. It's low level and may not be a stable API
│ │ │ │  across libtorrent versions.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct bt_peer_connection_handle : peer_connection_handle
│ │ │ │  {
│ │ │ │     explicit <strong>bt_peer_connection_handle</strong> (peer_connection_handle pc);
│ │ │ │ -   bool <strong>support_extensions</strong> () const;
│ │ │ │     bool <strong>packet_finished</strong> () const;
│ │ │ │ +   bool <strong>support_extensions</strong> () const;
│ │ │ │     bool <strong>supports_encryption</strong> () const;
│ │ │ │ -   void <strong>switch_send_crypto</strong> (std::shared_ptr&lt;crypto_plugin&gt; crypto);
│ │ │ │     void <strong>switch_recv_crypto</strong> (std::shared_ptr&lt;crypto_plugin&gt; crypto);
│ │ │ │ +   void <strong>switch_send_crypto</strong> (std::shared_ptr&lt;crypto_plugin&gt; crypto);
│ │ │ │     std::shared_ptr&lt;bt_peer_connection&gt; <strong>native_handle</strong> () const;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="plugin"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+plugin&labels=documentation&body=Documentation+under+heading+%22class+plugin%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="plugin">
│ │ │ │  <h1>plugin</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions.hpp">libtorrent/extensions.hpp</a>&quot;</p>
│ │ │ │ @@ -415,19 +415,19 @@
│ │ │ │  <p>Torrent plugins are associated with a single torrent and have a number
│ │ │ │  of functions called at certain events. Many of its functions have the
│ │ │ │  ability to change or override the default libtorrent behavior.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct torrent_plugin
│ │ │ │  {
│ │ │ │     virtual std::shared_ptr&lt;peer_plugin&gt; <strong>new_connection</strong> (peer_connection_handle const&amp;);
│ │ │ │ -   virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │     virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │ +   virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │     virtual void <strong>tick</strong> ();
│ │ │ │ -   virtual bool <strong>on_pause</strong> ();
│ │ │ │     virtual bool <strong>on_resume</strong> ();
│ │ │ │ +   virtual bool <strong>on_pause</strong> ();
│ │ │ │     virtual void <strong>on_files_checked</strong> ();
│ │ │ │     virtual void <strong>on_state</strong> (torrent_status::state_t);
│ │ │ │     virtual void <strong>on_add_peer</strong> (tcp::endpoint const&amp;,
│ │ │ │        peer_source_flags_t, add_peer_flags_t);
│ │ │ │  
│ │ │ │     static constexpr add_peer_flags_t <strong>first_time</strong>  = 1_bit;
│ │ │ │     static constexpr add_peer_flags_t <strong>filtered</strong>  = 2_bit;
│ │ │ │ @@ -446,41 +446,41 @@
│ │ │ │  are supposed to return an instance of your <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a> class. Which in
│ │ │ │  turn will have its hook functions called on event specific to that peer.</p>
│ │ │ │  <p>The <tt class="docutils literal">peer_connection_handle</tt> will be valid as long as the <tt class="docutils literal">shared_ptr</tt>
│ │ │ │  is being held by the torrent object. So, it is generally a good idea to not
│ │ │ │  keep a <tt class="docutils literal">shared_ptr</tt> to your own <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a>. If you want to keep references
│ │ │ │  to it, use <tt class="docutils literal">weak_ptr</tt>.</p>
│ │ │ │  <p>If this function throws an exception, the connection will be closed.</p>
│ │ │ │ -<a name="on_piece_pass()"></a>
│ │ │ │ -<a name="on_piece_failed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_piece_pass%28%29+on_piece_failed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_piece_pass%28%29+on_piece_failed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-piece-pass-on-piece-failed">
│ │ │ │ -<h2>on_piece_pass() on_piece_failed()</h2>
│ │ │ │ +<a name="on_piece_failed()"></a>
│ │ │ │ +<a name="on_piece_pass()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_piece_failed%28%29+on_piece_pass%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_piece_failed%28%29+on_piece_pass%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-piece-failed-on-piece-pass">
│ │ │ │ +<h2>on_piece_failed() on_piece_pass()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │  virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │ +virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │  </pre>
│ │ │ │  <p>These hooks are called when a piece passes the hash check or fails the hash
│ │ │ │  check, respectively. The <tt class="docutils literal">index</tt> is the piece index that was downloaded.
│ │ │ │  It is possible to access the list of peers that participated in sending the
│ │ │ │  piece through the <tt class="docutils literal">torrent</tt> and the <tt class="docutils literal">piece_picker</tt>.</p>
│ │ │ │  <a name="tick()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Btick%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Btick%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="tick">
│ │ │ │  <h2>tick()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  virtual void <strong>tick</strong> ();
│ │ │ │  </pre>
│ │ │ │  <p>This hook is called approximately once per second. It is a way of making it
│ │ │ │  easy for plugins to do timed events, for sending messages or whatever.</p>
│ │ │ │ -<a name="on_resume()"></a>
│ │ │ │ -<a name="on_pause()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_resume%28%29+on_pause%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_resume%28%29+on_pause%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-resume-on-pause">
│ │ │ │ -<h2>on_resume() on_pause()</h2>
│ │ │ │ +<a name="on_pause()"></a>
│ │ │ │ +<a name="on_resume()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_pause%28%29+on_resume%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_pause%28%29+on_resume%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-pause-on-resume">
│ │ │ │ +<h2>on_pause() on_resume()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -virtual bool <strong>on_pause</strong> ();
│ │ │ │  virtual bool <strong>on_resume</strong> ();
│ │ │ │ +virtual bool <strong>on_pause</strong> ();
│ │ │ │  </pre>
│ │ │ │  <p>These hooks are called when the torrent is paused and resumed respectively.
│ │ │ │  The return value indicates if the event was handled. A return value of
│ │ │ │  <tt class="docutils literal">true</tt> indicates that it was handled, and no other <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> after this one
│ │ │ │  will have this hook function called, and the standard handler will also not be
│ │ │ │  invoked. So, returning true effectively overrides the standard behavior of
│ │ │ │  pause or resume.</p>
│ │ │ │ @@ -545,51 +545,51 @@
│ │ │ │  {
│ │ │ │     virtual string_view <strong>type</strong> () const;
│ │ │ │     virtual void <strong>add_handshake</strong> (entry&amp;);
│ │ │ │     virtual void <strong>on_disconnect</strong> (error_code const&amp;);
│ │ │ │     virtual void <strong>on_connected</strong> ();
│ │ │ │     virtual bool <strong>on_handshake</strong> (span&lt;char const&gt;);
│ │ │ │     virtual bool <strong>on_extension_handshake</strong> (bdecode_node const&amp;);
│ │ │ │ +   virtual bool <strong>on_have_all</strong> ();
│ │ │ │ +   virtual bool <strong>on_dont_have</strong> (piece_index_t);
│ │ │ │     virtual bool <strong>on_have_none</strong> ();
│ │ │ │ -   virtual bool <strong>on_bitfield</strong> (bitfield const&amp; <em>/*bitfield*/</em>);
│ │ │ │ +   virtual bool <strong>on_interested</strong> ();
│ │ │ │ +   virtual bool <strong>on_request</strong> (peer_request const&amp;);
│ │ │ │     virtual bool <strong>on_not_interested</strong> ();
│ │ │ │     virtual bool <strong>on_choke</strong> ();
│ │ │ │ +   virtual bool <strong>on_bitfield</strong> (bitfield const&amp; <em>/*bitfield*/</em>);
│ │ │ │     virtual bool <strong>on_allowed_fast</strong> (piece_index_t);
│ │ │ │ -   virtual bool <strong>on_dont_have</strong> (piece_index_t);
│ │ │ │ -   virtual bool <strong>on_request</strong> (peer_request const&amp;);
│ │ │ │ -   virtual bool <strong>on_have_all</strong> ();
│ │ │ │ -   virtual bool <strong>on_unchoke</strong> ();
│ │ │ │ -   virtual bool <strong>on_interested</strong> ();
│ │ │ │     virtual bool <strong>on_have</strong> (piece_index_t);
│ │ │ │ +   virtual bool <strong>on_unchoke</strong> ();
│ │ │ │     virtual bool <strong>on_piece</strong> (peer_request const&amp; <em>/*piece*/</em>
│ │ │ │        , span&lt;char const&gt; <em>/*buf*/</em>);
│ │ │ │ -   virtual bool <strong>on_suggest</strong> (piece_index_t);
│ │ │ │     virtual bool <strong>on_reject</strong> (peer_request const&amp;);
│ │ │ │     virtual bool <strong>on_cancel</strong> (peer_request const&amp;);
│ │ │ │ -   virtual void <strong>sent_have_all</strong> ();
│ │ │ │ -   virtual void <strong>sent_allow_fast</strong> (piece_index_t);
│ │ │ │ -   virtual void <strong>sent_have_none</strong> ();
│ │ │ │ +   virtual bool <strong>on_suggest</strong> (piece_index_t);
│ │ │ │     virtual void <strong>sent_suggest</strong> (piece_index_t);
│ │ │ │     virtual void <strong>sent_choke</strong> ();
│ │ │ │ +   virtual void <strong>sent_have_none</strong> ();
│ │ │ │     virtual void <strong>sent_cancel</strong> (peer_request const&amp;);
│ │ │ │ +   virtual void <strong>sent_allow_fast</strong> (piece_index_t);
│ │ │ │     virtual void <strong>sent_request</strong> (peer_request const&amp;);
│ │ │ │     virtual void <strong>sent_reject_request</strong> (peer_request const&amp;);
│ │ │ │ -   virtual void <strong>sent_interested</strong> ();
│ │ │ │ -   virtual void <strong>sent_unchoke</strong> ();
│ │ │ │ +   virtual void <strong>sent_have_all</strong> ();
│ │ │ │     virtual void <strong>sent_piece</strong> (peer_request const&amp;);
│ │ │ │ -   virtual void <strong>sent_have</strong> (piece_index_t);
│ │ │ │ +   virtual void <strong>sent_unchoke</strong> ();
│ │ │ │ +   virtual void <strong>sent_interested</strong> ();
│ │ │ │     virtual void <strong>sent_not_interested</strong> ();
│ │ │ │ +   virtual void <strong>sent_have</strong> (piece_index_t);
│ │ │ │     virtual void <strong>sent_payload</strong> (int <em>/* bytes */</em>);
│ │ │ │     virtual bool <strong>can_disconnect</strong> (error_code const&amp; <em>/*ec*/</em>);
│ │ │ │     virtual bool <strong>on_extended</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │        span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │     virtual bool <strong>on_unknown_message</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │        span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │ -   virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │     virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │ +   virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │     virtual void <strong>tick</strong> ();
│ │ │ │     virtual bool <strong>write_request</strong> (peer_request const&amp;);
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="type">
│ │ │ │  <h2>type()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ @@ -639,39 +639,39 @@
│ │ │ │  virtual bool <strong>on_extension_handshake</strong> (bdecode_node const&amp;);
│ │ │ │  </pre>
│ │ │ │  <p>called when the extension handshake from the other end is received
│ │ │ │  if this returns false, it means that this extension isn't
│ │ │ │  supported by this peer. It will result in this <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a>
│ │ │ │  being removed from the peer_connection and destructed.
│ │ │ │  this is not called for web seeds</p>
│ │ │ │ -<a name="on_request()"></a>
│ │ │ │ -<a name="on_bitfield()"></a>
│ │ │ │ -<a name="on_allowed_fast()"></a>
│ │ │ │  <a name="on_unchoke()"></a>
│ │ │ │ -<a name="on_have()"></a>
│ │ │ │ -<a name="on_interested()"></a>
│ │ │ │ -<a name="on_have_none()"></a>
│ │ │ │ +<a name="on_bitfield()"></a>
│ │ │ │  <a name="on_not_interested()"></a>
│ │ │ │ +<a name="on_have()"></a>
│ │ │ │  <a name="on_dont_have()"></a>
│ │ │ │ +<a name="on_have_none()"></a>
│ │ │ │ +<a name="on_request()"></a>
│ │ │ │ +<a name="on_allowed_fast()"></a>
│ │ │ │  <a name="on_choke()"></a>
│ │ │ │ -<a name="on_have_all()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_request%28%29+on_bitfield%28%29+on_allowed_fast%28%29+on_unchoke%28%29+on_have%28%29+on_interested%28%29+on_have_none%28%29+on_not_interested%28%29+on_dont_have%28%29+on_choke%28%29+on_have_all%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_request%28%29+on_bitfield%28%29+on_allowed_fast%28%29+on_unchoke%28%29+on_have%28%29+on_interested%28%29+on_have_none%28%29+on_not_interested%28%29+on_dont_have%28%29+on_choke%28%29+on_have_all%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-request-on-bitfield-on-allowed-fast-on-unchoke-on-have-on-interested-on-have-none-on-not-interested-on-dont-have-on-choke-on-have-all">
│ │ │ │ -<h2>on_request() on_bitfield() on_allowed_fast() on_unchoke() on_have() on_interested() on_have_none() on_not_interested() on_dont_have() on_choke() on_have_all()</h2>
│ │ │ │ +<a name="on_have_all()"></a>
│ │ │ │ +<a name="on_interested()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_unchoke%28%29+on_bitfield%28%29+on_not_interested%28%29+on_have%28%29+on_dont_have%28%29+on_have_none%28%29+on_request%28%29+on_allowed_fast%28%29+on_choke%28%29+on_have_all%28%29+on_interested%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_unchoke%28%29+on_bitfield%28%29+on_not_interested%28%29+on_have%28%29+on_dont_have%28%29+on_have_none%28%29+on_request%28%29+on_allowed_fast%28%29+on_choke%28%29+on_have_all%28%29+on_interested%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-unchoke-on-bitfield-on-not-interested-on-have-on-dont-have-on-have-none-on-request-on-allowed-fast-on-choke-on-have-all-on-interested">
│ │ │ │ +<h2>on_unchoke() on_bitfield() on_not_interested() on_have() on_dont_have() on_have_none() on_request() on_allowed_fast() on_choke() on_have_all() on_interested()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +virtual bool <strong>on_have_all</strong> ();
│ │ │ │ +virtual bool <strong>on_dont_have</strong> (piece_index_t);
│ │ │ │  virtual bool <strong>on_have_none</strong> ();
│ │ │ │ -virtual bool <strong>on_bitfield</strong> (bitfield const&amp; <em>/*bitfield*/</em>);
│ │ │ │ +virtual bool <strong>on_interested</strong> ();
│ │ │ │ +virtual bool <strong>on_request</strong> (peer_request const&amp;);
│ │ │ │  virtual bool <strong>on_not_interested</strong> ();
│ │ │ │  virtual bool <strong>on_choke</strong> ();
│ │ │ │ +virtual bool <strong>on_bitfield</strong> (bitfield const&amp; <em>/*bitfield*/</em>);
│ │ │ │  virtual bool <strong>on_allowed_fast</strong> (piece_index_t);
│ │ │ │ -virtual bool <strong>on_dont_have</strong> (piece_index_t);
│ │ │ │ -virtual bool <strong>on_request</strong> (peer_request const&amp;);
│ │ │ │ -virtual bool <strong>on_have_all</strong> ();
│ │ │ │ -virtual bool <strong>on_unchoke</strong> ();
│ │ │ │ -virtual bool <strong>on_interested</strong> ();
│ │ │ │  virtual bool <strong>on_have</strong> (piece_index_t);
│ │ │ │ +virtual bool <strong>on_unchoke</strong> ();
│ │ │ │  </pre>
│ │ │ │  <p>returning true from any of the message handlers
│ │ │ │  indicates that the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> has handled the message.
│ │ │ │  it will break the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> chain traversing and not let
│ │ │ │  anyone else handle the message, including the default
│ │ │ │  handler.</p>
│ │ │ │  <a name="on_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ @@ -683,27 +683,27 @@
│ │ │ │  </pre>
│ │ │ │  <p>This function is called when the peer connection is receiving
│ │ │ │  a piece. <tt class="docutils literal">buf</tt> points (non-owning pointer) to the data in an
│ │ │ │  internal immutable disk buffer. The length of the data is specified
│ │ │ │  in the <tt class="docutils literal">length</tt> member of the <tt class="docutils literal">piece</tt> parameter.
│ │ │ │  returns true to indicate that the piece is handled and the
│ │ │ │  rest of the logic should be ignored.</p>
│ │ │ │ +<a name="sent_unchoke()"></a>
│ │ │ │  <a name="sent_interested()"></a>
│ │ │ │  <a name="sent_not_interested()"></a>
│ │ │ │ -<a name="sent_piece()"></a>
│ │ │ │ -<a name="sent_unchoke()"></a>
│ │ │ │ -<a name="sent_have()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bsent_interested%28%29+sent_not_interested%28%29+sent_piece%28%29+sent_unchoke%28%29+sent_have%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bsent_interested%28%29+sent_not_interested%28%29+sent_piece%28%29+sent_unchoke%28%29+sent_have%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="sent-interested-sent-not-interested-sent-piece-sent-unchoke-sent-have">
│ │ │ │ -<h2>sent_interested() sent_not_interested() sent_piece() sent_unchoke() sent_have()</h2>
│ │ │ │ +<a name="sent_have()"></a>
│ │ │ │ +<a name="sent_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bsent_unchoke%28%29+sent_interested%28%29+sent_not_interested%28%29+sent_have%28%29+sent_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bsent_unchoke%28%29+sent_interested%28%29+sent_not_interested%28%29+sent_have%28%29+sent_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="sent-unchoke-sent-interested-sent-not-interested-sent-have-sent-piece">
│ │ │ │ +<h2>sent_unchoke() sent_interested() sent_not_interested() sent_have() sent_piece()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -virtual void <strong>sent_interested</strong> ();
│ │ │ │ -virtual void <strong>sent_unchoke</strong> ();
│ │ │ │  virtual void <strong>sent_piece</strong> (peer_request const&amp;);
│ │ │ │ -virtual void <strong>sent_have</strong> (piece_index_t);
│ │ │ │ +virtual void <strong>sent_unchoke</strong> ();
│ │ │ │ +virtual void <strong>sent_interested</strong> ();
│ │ │ │  virtual void <strong>sent_not_interested</strong> ();
│ │ │ │ +virtual void <strong>sent_have</strong> (piece_index_t);
│ │ │ │  </pre>
│ │ │ │  <p>called after a choke message has been sent to the peer</p>
│ │ │ │  <a name="sent_payload()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bsent_payload%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bsent_payload%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="sent-payload">
│ │ │ │  <h2>sent_payload()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  virtual void <strong>sent_payload</strong> (int <em>/* bytes */</em>);
│ │ │ │ @@ -739,21 +739,21 @@
│ │ │ │  <div class="section" id="on-unknown-message">
│ │ │ │  <h2>on_unknown_message()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  virtual bool <strong>on_unknown_message</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │        span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │  </pre>
│ │ │ │  <p>this is not called for web seeds</p>
│ │ │ │ -<a name="on_piece_pass()"></a>
│ │ │ │ -<a name="on_piece_failed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_piece_pass%28%29+on_piece_failed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_piece_pass%28%29+on_piece_failed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-piece-pass-on-piece-failed-1">
│ │ │ │ -<h2>on_piece_pass() on_piece_failed()</h2>
│ │ │ │ +<a name="on_piece_failed()"></a>
│ │ │ │ +<a name="on_piece_pass()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_piece_failed%28%29+on_piece_pass%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_piece_failed%28%29+on_piece_pass%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-piece-failed-on-piece-pass-1">
│ │ │ │ +<h2>on_piece_failed() on_piece_pass()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │  virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │ +virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │  </pre>
│ │ │ │  <p>called when a piece that this peer participated in either
│ │ │ │  fails or passes the hash_check</p>
│ │ │ │  <a name="tick()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Btick%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Btick%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="tick-1">
│ │ │ │  <h2>tick()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ @@ -773,16 +773,16 @@
│ │ │ │  </div>
│ │ │ │  <div class="section" id="crypto-plugin">
│ │ │ │  <h1>crypto_plugin</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions.hpp">libtorrent/extensions.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct crypto_plugin
│ │ │ │  {
│ │ │ │ -   virtual void <strong>set_outgoing_key</strong> (span&lt;char const&gt; key) = 0;
│ │ │ │     virtual void <strong>set_incoming_key</strong> (span&lt;char const&gt; key) = 0;
│ │ │ │ +   virtual void <strong>set_outgoing_key</strong> (span&lt;char const&gt; key) = 0;
│ │ │ │     <strong>encrypt</strong> (span&lt;span&lt;char&gt;&gt; <em>/*send_vec*/</em>) = 0;
│ │ │ │     virtual std::tuple&lt;int, int, int&gt; <strong>decrypt</strong> (span&lt;span&lt;char&gt;&gt; <em>/*receive_vec*/</em>) = 0;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="decrypt()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:crypto_plugin%3A%3A%5Bdecrypt%28%29%5D&labels=documentation&body=Documentation+under+heading+%22crypto_plugin%3A%3A%5Bdecrypt%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="decrypt">
│ │ │ │  <h2>decrypt()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ @@ -793,42 +793,42 @@
│ │ │ │  (consume, produce, packet_size)</p>
│ │ │ │  <p>consume is set to the number of bytes which should be trimmed from the
│ │ │ │  head of the buffers, default is 0</p>
│ │ │ │  <p>produce is set to the number of bytes of payload which are now ready to
│ │ │ │  be sent to the upper layer. default is the number of bytes passed in receive_vec</p>
│ │ │ │  <p>packet_size is set to the minimum number of bytes which must be read to
│ │ │ │  advance the next step of decryption. default is 0</p>
│ │ │ │ -<a name="create_smart_ban_plugin()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_smart_ban_plugin%28%29&labels=documentation&body=Documentation+under+heading+%22create_smart_ban_plugin%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="create-smart-ban-plugin">
│ │ │ │ -<h1>create_smart_ban_plugin()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions/smart_ban.hpp">libtorrent/extensions/smart_ban.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::shared_ptr&lt;torrent_plugin&gt; <strong>create_smart_ban_plugin</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │ -</pre>
│ │ │ │ -<p>constructor function for the smart ban extension. The extension keeps
│ │ │ │ -track of the data peers have sent us for failing pieces and once the
│ │ │ │ -piece completes and passes the hash check bans the peers that turned
│ │ │ │ -out to have sent corrupt data.
│ │ │ │ -This function can either be passed in the add_torrent_params::extensions
│ │ │ │ -field, or via <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>.</p>
│ │ │ │  <a name="create_ut_pex_plugin()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_ut_pex_plugin%28%29&labels=documentation&body=Documentation+under+heading+%22create_ut_pex_plugin%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │  <div class="section" id="create-ut-pex-plugin">
│ │ │ │  <h1>create_ut_pex_plugin()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions/ut_pex.hpp">libtorrent/extensions/ut_pex.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::shared_ptr&lt;torrent_plugin&gt; <strong>create_ut_pex_plugin</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │  </pre>
│ │ │ │  <p>constructor function for the ut_pex extension. The ut_pex
│ │ │ │  extension allows peers to gossip about their connections, allowing
│ │ │ │  the swarm stay well connected and peers aware of more peers in the
│ │ │ │  swarm. This extension is enabled by default unless explicitly disabled in
│ │ │ │  the <a class="reference external" href="reference-Session.html#session">session</a> constructor.</p>
│ │ │ │  <p>This can either be passed in the add_torrent_params::extensions field, or
│ │ │ │  via <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>.</p>
│ │ │ │ +<a name="create_smart_ban_plugin()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_smart_ban_plugin%28%29&labels=documentation&body=Documentation+under+heading+%22create_smart_ban_plugin%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="create-smart-ban-plugin">
│ │ │ │ +<h1>create_smart_ban_plugin()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions/smart_ban.hpp">libtorrent/extensions/smart_ban.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::shared_ptr&lt;torrent_plugin&gt; <strong>create_smart_ban_plugin</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │ +</pre>
│ │ │ │ +<p>constructor function for the smart ban extension. The extension keeps
│ │ │ │ +track of the data peers have sent us for failing pieces and once the
│ │ │ │ +piece completes and passes the hash check bans the peers that turned
│ │ │ │ +out to have sent corrupt data.
│ │ │ │ +This function can either be passed in the add_torrent_params::extensions
│ │ │ │ +field, or via <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>.</p>
│ │ │ │  <a name="create_ut_metadata_plugin()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_ut_metadata_plugin%28%29&labels=documentation&body=Documentation+under+heading+%22create_ut_metadata_plugin%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="create-ut-metadata-plugin">
│ │ │ │  <h1>create_ut_metadata_plugin()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions/ut_metadata.hpp">libtorrent/extensions/ut_metadata.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::shared_ptr&lt;torrent_plugin&gt; <strong>create_ut_metadata_plugin</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │  </pre>
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -17,44 +17,44 @@
│ │ │ │ │            o _o_n___a_l_e_r_t_(_)
│ │ │ │ │            o _o_n___u_n_k_n_o_w_n___t_o_r_r_e_n_t_(_)
│ │ │ │ │            o _o_n___t_i_c_k_(_)
│ │ │ │ │            o _g_e_t___u_n_c_h_o_k_e___p_r_i_o_r_i_t_y_(_)
│ │ │ │ │            o _l_o_a_d___s_t_a_t_e_(_)
│ │ │ │ │      * _t_o_r_r_e_n_t___p_l_u_g_i_n
│ │ │ │ │            o _n_e_w___c_o_n_n_e_c_t_i_o_n_(_)
│ │ │ │ │ -          o _o_n___p_i_e_c_e___p_a_s_s_(_)_ _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)
│ │ │ │ │ +          o _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)_ _o_n___p_i_e_c_e___p_a_s_s_(_)
│ │ │ │ │            o _t_i_c_k_(_)
│ │ │ │ │ -          o _o_n___r_e_s_u_m_e_(_)_ _o_n___p_a_u_s_e_(_)
│ │ │ │ │ +          o _o_n___p_a_u_s_e_(_)_ _o_n___r_e_s_u_m_e_(_)
│ │ │ │ │            o _o_n___f_i_l_e_s___c_h_e_c_k_e_d_(_)
│ │ │ │ │            o _o_n___s_t_a_t_e_(_)
│ │ │ │ │            o _o_n___a_d_d___p_e_e_r_(_)
│ │ │ │ │      * _p_e_e_r___p_l_u_g_i_n
│ │ │ │ │            o _t_y_p_e_(_)
│ │ │ │ │            o _a_d_d___h_a_n_d_s_h_a_k_e_(_)
│ │ │ │ │            o _o_n___d_i_s_c_o_n_n_e_c_t_(_)
│ │ │ │ │            o _o_n___c_o_n_n_e_c_t_e_d_(_)
│ │ │ │ │            o _o_n___h_a_n_d_s_h_a_k_e_(_)
│ │ │ │ │            o _o_n___e_x_t_e_n_s_i_o_n___h_a_n_d_s_h_a_k_e_(_)
│ │ │ │ │ -          o _o_n___r_e_q_u_e_s_t_(_)_ _o_n___b_i_t_f_i_e_l_d_(_)_ _o_n___a_l_l_o_w_e_d___f_a_s_t_(_)_ _o_n___u_n_c_h_o_k_e_(_)_ _o_n___h_a_v_e_(_)
│ │ │ │ │ -            _o_n___i_n_t_e_r_e_s_t_e_d_(_)_ _o_n___h_a_v_e___n_o_n_e_(_)_ _o_n___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _o_n___d_o_n_t___h_a_v_e_(_)
│ │ │ │ │ -            _o_n___c_h_o_k_e_(_)_ _o_n___h_a_v_e___a_l_l_(_)
│ │ │ │ │ +          o _o_n___u_n_c_h_o_k_e_(_)_ _o_n___b_i_t_f_i_e_l_d_(_)_ _o_n___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _o_n___h_a_v_e_(_)
│ │ │ │ │ +            _o_n___d_o_n_t___h_a_v_e_(_)_ _o_n___h_a_v_e___n_o_n_e_(_)_ _o_n___r_e_q_u_e_s_t_(_)_ _o_n___a_l_l_o_w_e_d___f_a_s_t_(_)
│ │ │ │ │ +            _o_n___c_h_o_k_e_(_)_ _o_n___h_a_v_e___a_l_l_(_)_ _o_n___i_n_t_e_r_e_s_t_e_d_(_)
│ │ │ │ │            o _o_n___p_i_e_c_e_(_)
│ │ │ │ │ -          o _s_e_n_t___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___p_i_e_c_e_(_)_ _s_e_n_t___u_n_c_h_o_k_e_(_)
│ │ │ │ │ -            _s_e_n_t___h_a_v_e_(_)
│ │ │ │ │ +          o _s_e_n_t___u_n_c_h_o_k_e_(_)_ _s_e_n_t___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___h_a_v_e_(_)
│ │ │ │ │ +            _s_e_n_t___p_i_e_c_e_(_)
│ │ │ │ │            o _s_e_n_t___p_a_y_l_o_a_d_(_)
│ │ │ │ │            o _c_a_n___d_i_s_c_o_n_n_e_c_t_(_)
│ │ │ │ │            o _o_n___e_x_t_e_n_d_e_d_(_)
│ │ │ │ │            o _o_n___u_n_k_n_o_w_n___m_e_s_s_a_g_e_(_)
│ │ │ │ │ -          o _o_n___p_i_e_c_e___p_a_s_s_(_)_ _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)
│ │ │ │ │ +          o _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)_ _o_n___p_i_e_c_e___p_a_s_s_(_)
│ │ │ │ │            o _t_i_c_k_(_)
│ │ │ │ │            o _w_r_i_t_e___r_e_q_u_e_s_t_(_)
│ │ │ │ │      * _c_r_y_p_t_o___p_l_u_g_i_n
│ │ │ │ │            o _d_e_c_r_y_p_t_(_)
│ │ │ │ │ -    * _c_r_e_a_t_e___s_m_a_r_t___b_a_n___p_l_u_g_i_n_(_)
│ │ │ │ │      * _c_r_e_a_t_e___u_t___p_e_x___p_l_u_g_i_n_(_)
│ │ │ │ │ +    * _c_r_e_a_t_e___s_m_a_r_t___b_a_n___p_l_u_g_i_n_(_)
│ │ │ │ │      * _c_r_e_a_t_e___u_t___m_e_t_a_d_a_t_a___p_l_u_g_i_n_(_)
│ │ │ │ │  libtorrent has a _p_l_u_g_i_n interface for implementing extensions to the protocol.
│ │ │ │ │  These can be general extensions for transferring metadata or peer exchange
│ │ │ │ │  extensions, or it could be used to provide a way to customize the protocol to
│ │ │ │ │  fit a particular (closed) network.
│ │ │ │ │  In short, the _p_l_u_g_i_n interface makes it possible to:
│ │ │ │ │      * register extension messages (sent in the extension handshake), see
│ │ │ │ │ @@ -140,67 +140,67 @@
│ │ │ │ │  the _p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e class provides a handle to the internal peer
│ │ │ │ │  connection object, to be used by plugins. This is a low level interface that
│ │ │ │ │  may not be stable across libtorrent versions
│ │ │ │ │  struct peer_connection_handle
│ │ │ │ │  {
│ │ │ │ │     explicit ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee (std::weak_ptr<peer_connection> impl);
│ │ │ │ │     connection_type ttyyppee () const;
│ │ │ │ │ -   peer_plugin const* ffiinndd__pplluuggiinn (string_view type) const;
│ │ │ │ │     void aadddd__eexxtteennssiioonn (std::shared_ptr<peer_plugin>);
│ │ │ │ │ +   peer_plugin const* ffiinndd__pplluuggiinn (string_view type) const;
│ │ │ │ │     bool iiss__sseeeedd () const;
│ │ │ │ │     bool uuppllooaadd__oonnllyy () const;
│ │ │ │ │ -   bool hhaass__ppiieeccee (piece_index_t i) const;
│ │ │ │ │     peer_id const& ppiidd () const;
│ │ │ │ │ -   bool iiss__cchhookkeedd () const;
│ │ │ │ │ +   bool hhaass__ppiieeccee (piece_index_t i) const;
│ │ │ │ │     bool iiss__iinntteerreessttiinngg () const;
│ │ │ │ │ +   bool iiss__cchhookkeedd () const;
│ │ │ │ │     bool hhaass__ppeeeerr__cchhookkeedd () const;
│ │ │ │ │     bool iiss__ppeeeerr__iinntteerreesstteedd () const;
│ │ │ │ │     void cchhookkee__tthhiiss__ppeeeerr ();
│ │ │ │ │     void mmaayybbee__uunncchhookkee__tthhiiss__ppeeeerr ();
│ │ │ │ │     void ggeett__ppeeeerr__iinnffoo (peer_info& p) const;
│ │ │ │ │     torrent_handle aassssoocciiaatteedd__ttoorrrreenntt () const;
│ │ │ │ │     _t_c_p_:_:_e_n_d_p_o_i_n_t const& rreemmoottee () const;
│ │ │ │ │     _t_c_p_:_:_e_n_d_p_o_i_n_t llooccaall__eennddppooiinntt () const;
│ │ │ │ │ -   bool iiss__ddiissccoonnnneeccttiinngg () const;
│ │ │ │ │ -   bool iiss__oouuttggooiinngg () const;
│ │ │ │ │ -   bool iiss__ccoonnnneeccttiinngg () const;
│ │ │ │ │     void ddiissccoonnnneecctt (error_code const& ec, operation_t op
│ │ │ │ │        , disconnect_severity_t = peer_connection_interface::normal);
│ │ │ │ │ +   bool iiss__ccoonnnneeccttiinngg () const;
│ │ │ │ │ +   bool iiss__oouuttggooiinngg () const;
│ │ │ │ │ +   bool iiss__ddiissccoonnnneeccttiinngg () const;
│ │ │ │ │     bool iiggnnoorree__uunncchhookkee__sslloottss () const;
│ │ │ │ │     bool oonn__llooccaall__nneettwwoorrkk () const;
│ │ │ │ │     bool ffaaiilleedd () const;
│ │ │ │ │     bool sshhoouulldd__lloogg (peer_log_alert::direction_t direction) const;
│ │ │ │ │     void ppeeeerr__lloogg (peer_log_alert::direction_t direction
│ │ │ │ │        , char const* event, char const* fmt = "", ...) const TORRENT_FORMAT
│ │ │ │ │  (4,5);
│ │ │ │ │     bool ccaann__ddiissccoonnnneecctt (error_code const& ec) const;
│ │ │ │ │     bool hhaass__mmeettaaddaattaa () const;
│ │ │ │ │     bool iinn__hhaannddsshhaakkee () const;
│ │ │ │ │     void sseenndd__bbuuffffeerr (char const* begin, int size);
│ │ │ │ │     time_point ttiimmee__ooff__llaasstt__uunncchhookkee () const;
│ │ │ │ │     std::time_t llaasstt__sseeeenn__ccoommpplleettee () const;
│ │ │ │ │ -   bool ooppeerraattoorr==== (peer_connection_handle const& o) const;
│ │ │ │ │ -   bool ooppeerraattoorr<< (peer_connection_handle const& o) const;
│ │ │ │ │     bool ooppeerraattoorr!!== (peer_connection_handle const& o) const;
│ │ │ │ │ +   bool ooppeerraattoorr<< (peer_connection_handle const& o) const;
│ │ │ │ │ +   bool ooppeerraattoorr==== (peer_connection_handle const& o) const;
│ │ │ │ │     std::shared_ptr<peer_connection> nnaattiivvee__hhaannddllee () const;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ bbtt__ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e_._h_p_p"
│ │ │ │ │  The _b_t___p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e provides a handle to the internal bittorrent peer
│ │ │ │ │  connection object to plugins. It's low level and may not be a stable API across
│ │ │ │ │  libtorrent versions.
│ │ │ │ │  struct bt_peer_connection_handle : peer_connection_handle
│ │ │ │ │  {
│ │ │ │ │     explicit bbtt__ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee (peer_connection_handle pc);
│ │ │ │ │ -   bool ssuuppppoorrtt__eexxtteennssiioonnss () const;
│ │ │ │ │     bool ppaacckkeett__ffiinniisshheedd () const;
│ │ │ │ │ +   bool ssuuppppoorrtt__eexxtteennssiioonnss () const;
│ │ │ │ │     bool ssuuppppoorrttss__eennccrryyppttiioonn () const;
│ │ │ │ │ -   void sswwiittcchh__sseenndd__ccrryyppttoo (std::shared_ptr<crypto_plugin> crypto);
│ │ │ │ │     void sswwiittcchh__rreeccvv__ccrryyppttoo (std::shared_ptr<crypto_plugin> crypto);
│ │ │ │ │ +   void sswwiittcchh__sseenndd__ccrryyppttoo (std::shared_ptr<crypto_plugin> crypto);
│ │ │ │ │     std::shared_ptr<bt_peer_connection> nnaattiivvee__hhaannddllee () const;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ pplluuggiinn ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p"
│ │ │ │ │  this is the base class for a _s_e_s_s_i_o_n _p_l_u_g_i_n. One primary feature is that it is
│ │ │ │ │  notified of all torrents that are added to the _s_e_s_s_i_o_n, and can add its own
│ │ │ │ │ @@ -321,19 +321,19 @@
│ │ │ │ │  Torrent plugins are associated with a single torrent and have a number of
│ │ │ │ │  functions called at certain events. Many of its functions have the ability to
│ │ │ │ │  change or override the default libtorrent behavior.
│ │ │ │ │  struct torrent_plugin
│ │ │ │ │  {
│ │ │ │ │     virtual std::shared_ptr<peer_plugin> nneeww__ccoonnnneeccttiioonn (peer_connection_handle
│ │ │ │ │  const&);
│ │ │ │ │ -   virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │     virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ +   virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │     virtual void ttiicckk ();
│ │ │ │ │ -   virtual bool oonn__ppaauussee ();
│ │ │ │ │     virtual bool oonn__rreessuummee ();
│ │ │ │ │ +   virtual bool oonn__ppaauussee ();
│ │ │ │ │     virtual void oonn__ffiilleess__cchheecckkeedd ();
│ │ │ │ │     virtual void oonn__ssttaattee (torrent_status::state_t);
│ │ │ │ │     virtual void oonn__aadddd__ppeeeerr (tcp::endpoint const&,
│ │ │ │ │        peer_source_flags_t, add_peer_flags_t);
│ │ │ │ │  
│ │ │ │ │     static constexpr add_peer_flags_t ffiirrsstt__ttiimmee  = 1_bit;
│ │ │ │ │     static constexpr add_peer_flags_t ffiilltteerreedd  = 2_bit;
│ │ │ │ │ @@ -350,30 +350,30 @@
│ │ │ │ │  have its hook functions called on event specific to that peer.
│ │ │ │ │  The peer_connection_handle will be valid as long as the shared_ptr is being
│ │ │ │ │  held by the torrent object. So, it is generally a good idea to not keep a
│ │ │ │ │  shared_ptr to your own _p_e_e_r___p_l_u_g_i_n. If you want to keep references to it, use
│ │ │ │ │  weak_ptr.
│ │ │ │ │  If this function throws an exception, the connection will be closed.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ppiieeccee__ppaassss(()) oonn__ppiieeccee__ffaaiilleedd(()) **********
│ │ │ │ │ -virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │ +********** oonn__ppiieeccee__ffaaiilleedd(()) oonn__ppiieeccee__ppaassss(()) **********
│ │ │ │ │  virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ +virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │  These hooks are called when a piece passes the hash check or fails the hash
│ │ │ │ │  check, respectively. The index is the piece index that was downloaded. It is
│ │ │ │ │  possible to access the list of peers that participated in sending the piece
│ │ │ │ │  through the torrent and the piece_picker.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ttiicckk(()) **********
│ │ │ │ │  virtual void ttiicckk ();
│ │ │ │ │  This hook is called approximately once per second. It is a way of making it
│ │ │ │ │  easy for plugins to do timed events, for sending messages or whatever.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__rreessuummee(()) oonn__ppaauussee(()) **********
│ │ │ │ │ -virtual bool oonn__ppaauussee ();
│ │ │ │ │ +********** oonn__ppaauussee(()) oonn__rreessuummee(()) **********
│ │ │ │ │  virtual bool oonn__rreessuummee ();
│ │ │ │ │ +virtual bool oonn__ppaauussee ();
│ │ │ │ │  These hooks are called when the torrent is paused and resumed respectively. The
│ │ │ │ │  return value indicates if the event was handled. A return value of true
│ │ │ │ │  indicates that it was handled, and no other _p_l_u_g_i_n after this one will have
│ │ │ │ │  this hook function called, and the standard handler will also not be invoked.
│ │ │ │ │  So, returning true effectively overrides the standard behavior of pause or
│ │ │ │ │  resume.
│ │ │ │ │  Note that if you call pause() or resume() on the torrent from your handler it
│ │ │ │ │ @@ -419,51 +419,51 @@
│ │ │ │ │  {
│ │ │ │ │     virtual string_view ttyyppee () const;
│ │ │ │ │     virtual void aadddd__hhaannddsshhaakkee (entry&);
│ │ │ │ │     virtual void oonn__ddiissccoonnnneecctt (error_code const&);
│ │ │ │ │     virtual void oonn__ccoonnnneecctteedd ();
│ │ │ │ │     virtual bool oonn__hhaannddsshhaakkee (span<char const>);
│ │ │ │ │     virtual bool oonn__eexxtteennssiioonn__hhaannddsshhaakkee (bdecode_node const&);
│ │ │ │ │ +   virtual bool oonn__hhaavvee__aallll ();
│ │ │ │ │ +   virtual bool oonn__ddoonntt__hhaavvee (piece_index_t);
│ │ │ │ │     virtual bool oonn__hhaavvee__nnoonnee ();
│ │ │ │ │ -   virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//);
│ │ │ │ │ +   virtual bool oonn__iinntteerreesstteedd ();
│ │ │ │ │ +   virtual bool oonn__rreeqquueesstt (peer_request const&);
│ │ │ │ │     virtual bool oonn__nnoott__iinntteerreesstteedd ();
│ │ │ │ │     virtual bool oonn__cchhookkee ();
│ │ │ │ │ +   virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//);
│ │ │ │ │     virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t);
│ │ │ │ │ -   virtual bool oonn__ddoonntt__hhaavvee (piece_index_t);
│ │ │ │ │ -   virtual bool oonn__rreeqquueesstt (peer_request const&);
│ │ │ │ │ -   virtual bool oonn__hhaavvee__aallll ();
│ │ │ │ │ -   virtual bool oonn__uunncchhookkee ();
│ │ │ │ │ -   virtual bool oonn__iinntteerreesstteedd ();
│ │ │ │ │     virtual bool oonn__hhaavvee (piece_index_t);
│ │ │ │ │ +   virtual bool oonn__uunncchhookkee ();
│ │ │ │ │     virtual bool oonn__ppiieeccee (peer_request const& //**ppiieeccee**//
│ │ │ │ │        , span<char const> //**bbuuff**//);
│ │ │ │ │ -   virtual bool oonn__ssuuggggeesstt (piece_index_t);
│ │ │ │ │     virtual bool oonn__rreejjeecctt (peer_request const&);
│ │ │ │ │     virtual bool oonn__ccaanncceell (peer_request const&);
│ │ │ │ │ -   virtual void sseenntt__hhaavvee__aallll ();
│ │ │ │ │ -   virtual void sseenntt__aallllooww__ffaasstt (piece_index_t);
│ │ │ │ │ -   virtual void sseenntt__hhaavvee__nnoonnee ();
│ │ │ │ │ +   virtual bool oonn__ssuuggggeesstt (piece_index_t);
│ │ │ │ │     virtual void sseenntt__ssuuggggeesstt (piece_index_t);
│ │ │ │ │     virtual void sseenntt__cchhookkee ();
│ │ │ │ │ +   virtual void sseenntt__hhaavvee__nnoonnee ();
│ │ │ │ │     virtual void sseenntt__ccaanncceell (peer_request const&);
│ │ │ │ │ +   virtual void sseenntt__aallllooww__ffaasstt (piece_index_t);
│ │ │ │ │     virtual void sseenntt__rreeqquueesstt (peer_request const&);
│ │ │ │ │     virtual void sseenntt__rreejjeecctt__rreeqquueesstt (peer_request const&);
│ │ │ │ │ -   virtual void sseenntt__iinntteerreesstteedd ();
│ │ │ │ │ -   virtual void sseenntt__uunncchhookkee ();
│ │ │ │ │ +   virtual void sseenntt__hhaavvee__aallll ();
│ │ │ │ │     virtual void sseenntt__ppiieeccee (peer_request const&);
│ │ │ │ │ -   virtual void sseenntt__hhaavvee (piece_index_t);
│ │ │ │ │ +   virtual void sseenntt__uunncchhookkee ();
│ │ │ │ │ +   virtual void sseenntt__iinntteerreesstteedd ();
│ │ │ │ │     virtual void sseenntt__nnoott__iinntteerreesstteedd ();
│ │ │ │ │ +   virtual void sseenntt__hhaavvee (piece_index_t);
│ │ │ │ │     virtual void sseenntt__ppaayyllooaadd (int //** bbyytteess **//);
│ │ │ │ │     virtual bool ccaann__ddiissccoonnnneecctt (error_code const& //**eecc**//);
│ │ │ │ │     virtual bool oonn__eexxtteennddeedd (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │        span<char const> //**bbooddyy**//);
│ │ │ │ │     virtual bool oonn__uunnkknnoowwnn__mmeessssaaggee (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │        span<char const> //**bbooddyy**//);
│ │ │ │ │ -   virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │     virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ +   virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │     virtual void ttiicckk ();
│ │ │ │ │     virtual bool wwrriittee__rreeqquueesstt (peer_request const&);
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ttyyppee(()) **********
│ │ │ │ │  virtual string_view ttyyppee () const;
│ │ │ │ │  This function is expected to return the name of the _p_l_u_g_i_n.
│ │ │ │ │ @@ -491,48 +491,48 @@
│ │ │ │ │  ********** oonn__eexxtteennssiioonn__hhaannddsshhaakkee(()) **********
│ │ │ │ │  virtual bool oonn__eexxtteennssiioonn__hhaannddsshhaakkee (bdecode_node const&);
│ │ │ │ │  called when the extension handshake from the other end is received if this
│ │ │ │ │  returns false, it means that this extension isn't supported by this peer. It
│ │ │ │ │  will result in this _p_e_e_r___p_l_u_g_i_n being removed from the peer_connection and
│ │ │ │ │  destructed. this is not called for web seeds
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__rreeqquueesstt(()) oonn__bbiittffiieelldd(()) oonn__aalllloowweedd__ffaasstt(()) oonn__uunncchhookkee(()) oonn__hhaavvee(())
│ │ │ │ │ -oonn__iinntteerreesstteedd(()) oonn__hhaavvee__nnoonnee(()) oonn__nnoott__iinntteerreesstteedd(()) oonn__ddoonntt__hhaavvee(()) oonn__cchhookkee(())
│ │ │ │ │ -oonn__hhaavvee__aallll(()) **********
│ │ │ │ │ +********** oonn__uunncchhookkee(()) oonn__bbiittffiieelldd(()) oonn__nnoott__iinntteerreesstteedd(()) oonn__hhaavvee(()) oonn__ddoonntt__hhaavvee(())
│ │ │ │ │ +oonn__hhaavvee__nnoonnee(()) oonn__rreeqquueesstt(()) oonn__aalllloowweedd__ffaasstt(()) oonn__cchhookkee(()) oonn__hhaavvee__aallll(())
│ │ │ │ │ +oonn__iinntteerreesstteedd(()) **********
│ │ │ │ │ +virtual bool oonn__hhaavvee__aallll ();
│ │ │ │ │ +virtual bool oonn__ddoonntt__hhaavvee (piece_index_t);
│ │ │ │ │  virtual bool oonn__hhaavvee__nnoonnee ();
│ │ │ │ │ -virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//);
│ │ │ │ │ +virtual bool oonn__iinntteerreesstteedd ();
│ │ │ │ │ +virtual bool oonn__rreeqquueesstt (peer_request const&);
│ │ │ │ │  virtual bool oonn__nnoott__iinntteerreesstteedd ();
│ │ │ │ │  virtual bool oonn__cchhookkee ();
│ │ │ │ │ +virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//);
│ │ │ │ │  virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t);
│ │ │ │ │ -virtual bool oonn__ddoonntt__hhaavvee (piece_index_t);
│ │ │ │ │ -virtual bool oonn__rreeqquueesstt (peer_request const&);
│ │ │ │ │ -virtual bool oonn__hhaavvee__aallll ();
│ │ │ │ │ -virtual bool oonn__uunncchhookkee ();
│ │ │ │ │ -virtual bool oonn__iinntteerreesstteedd ();
│ │ │ │ │  virtual bool oonn__hhaavvee (piece_index_t);
│ │ │ │ │ +virtual bool oonn__uunncchhookkee ();
│ │ │ │ │  returning true from any of the message handlers indicates that the _p_l_u_g_i_n has
│ │ │ │ │  handled the message. it will break the _p_l_u_g_i_n chain traversing and not let
│ │ │ │ │  anyone else handle the message, including the default handler.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** oonn__ppiieeccee(()) **********
│ │ │ │ │  virtual bool oonn__ppiieeccee (peer_request const& //**ppiieeccee**//
│ │ │ │ │        , span<char const> //**bbuuff**//);
│ │ │ │ │  This function is called when the peer connection is receiving a piece. buf
│ │ │ │ │  points (non-owning pointer) to the data in an internal immutable disk buffer.
│ │ │ │ │  The length of the data is specified in the length member of the piece
│ │ │ │ │  parameter. returns true to indicate that the piece is handled and the rest of
│ │ │ │ │  the logic should be ignored.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseenntt__iinntteerreesstteedd(()) sseenntt__nnoott__iinntteerreesstteedd(()) sseenntt__ppiieeccee(()) sseenntt__uunncchhookkee(())
│ │ │ │ │ -sseenntt__hhaavvee(()) **********
│ │ │ │ │ -virtual void sseenntt__iinntteerreesstteedd ();
│ │ │ │ │ -virtual void sseenntt__uunncchhookkee ();
│ │ │ │ │ +********** sseenntt__uunncchhookkee(()) sseenntt__iinntteerreesstteedd(()) sseenntt__nnoott__iinntteerreesstteedd(()) sseenntt__hhaavvee(())
│ │ │ │ │ +sseenntt__ppiieeccee(()) **********
│ │ │ │ │  virtual void sseenntt__ppiieeccee (peer_request const&);
│ │ │ │ │ -virtual void sseenntt__hhaavvee (piece_index_t);
│ │ │ │ │ +virtual void sseenntt__uunncchhookkee ();
│ │ │ │ │ +virtual void sseenntt__iinntteerreesstteedd ();
│ │ │ │ │  virtual void sseenntt__nnoott__iinntteerreesstteedd ();
│ │ │ │ │ +virtual void sseenntt__hhaavvee (piece_index_t);
│ │ │ │ │  called after a choke message has been sent to the peer
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseenntt__ppaayyllooaadd(()) **********
│ │ │ │ │  virtual void sseenntt__ppaayyllooaadd (int //** bbyytteess **//);
│ │ │ │ │  called after piece data has been sent to the peer this can be used for stats
│ │ │ │ │  book keeping
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ @@ -555,17 +555,17 @@
│ │ │ │ │  receiving large messages.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** oonn__uunnkknnoowwnn__mmeessssaaggee(()) **********
│ │ │ │ │  virtual bool oonn__uunnkknnoowwnn__mmeessssaaggee (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │        span<char const> //**bbooddyy**//);
│ │ │ │ │  this is not called for web seeds
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ppiieeccee__ppaassss(()) oonn__ppiieeccee__ffaaiilleedd(()) **********
│ │ │ │ │ -virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │ +********** oonn__ppiieeccee__ffaaiilleedd(()) oonn__ppiieeccee__ppaassss(()) **********
│ │ │ │ │  virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ +virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │  called when a piece that this peer participated in either fails or passes the
│ │ │ │ │  hash_check
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ttiicckk(()) **********
│ │ │ │ │  virtual void ttiicckk ();
│ │ │ │ │  called approximately once every second
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ @@ -575,16 +575,16 @@
│ │ │ │ │  original request message won't be sent and no other _p_l_u_g_i_n will have this
│ │ │ │ │  function called.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ccrryyppttoo__pplluuggiinn ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p"
│ │ │ │ │  struct crypto_plugin
│ │ │ │ │  {
│ │ │ │ │ -   virtual void sseett__oouuttggooiinngg__kkeeyy (span<char const> key) = 0;
│ │ │ │ │     virtual void sseett__iinnccoommiinngg__kkeeyy (span<char const> key) = 0;
│ │ │ │ │ +   virtual void sseett__oouuttggooiinngg__kkeeyy (span<char const> key) = 0;
│ │ │ │ │     eennccrryypptt (span<span<char>> //**sseenndd__vveecc**//) = 0;
│ │ │ │ │     virtual std::tuple<int, int, int> ddeeccrryypptt (span<span<char>> //**rreecceeiivvee__vveecc**//
│ │ │ │ │  ) = 0;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ddeeccrryypptt(()) **********
│ │ │ │ │  virtual std::tuple<int, int, int> ddeeccrryypptt (span<span<char>> //**rreecceeiivvee__vveecc**//) =
│ │ │ │ │ @@ -594,35 +594,35 @@
│ │ │ │ │  consume is set to the number of bytes which should be trimmed from the head of
│ │ │ │ │  the buffers, default is 0
│ │ │ │ │  produce is set to the number of bytes of payload which are now ready to be sent
│ │ │ │ │  to the upper layer. default is the number of bytes passed in receive_vec
│ │ │ │ │  packet_size is set to the minimum number of bytes which must be read to advance
│ │ │ │ │  the next step of decryption. default is 0
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ccrreeaattee__ssmmaarrtt__bbaann__pplluuggiinn(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_/_s_m_a_r_t___b_a_n_._h_p_p"
│ │ │ │ │ -std::shared_ptr<torrent_plugin> ccrreeaattee__ssmmaarrtt__bbaann__pplluuggiinn (torrent_handle const&,
│ │ │ │ │ -client_data_t);
│ │ │ │ │ -constructor function for the smart ban extension. The extension keeps track of
│ │ │ │ │ -the data peers have sent us for failing pieces and once the piece completes and
│ │ │ │ │ -passes the hash check bans the peers that turned out to have sent corrupt data.
│ │ │ │ │ -This function can either be passed in the add_torrent_params::extensions field,
│ │ │ │ │ -or via _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ccrreeaattee__uutt__ppeexx__pplluuggiinn(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_/_u_t___p_e_x_._h_p_p"
│ │ │ │ │  std::shared_ptr<torrent_plugin> ccrreeaattee__uutt__ppeexx__pplluuggiinn (torrent_handle const&,
│ │ │ │ │  client_data_t);
│ │ │ │ │  constructor function for the ut_pex extension. The ut_pex extension allows
│ │ │ │ │  peers to gossip about their connections, allowing the swarm stay well connected
│ │ │ │ │  and peers aware of more peers in the swarm. This extension is enabled by
│ │ │ │ │  default unless explicitly disabled in the _s_e_s_s_i_o_n constructor.
│ │ │ │ │  This can either be passed in the add_torrent_params::extensions field, or via
│ │ │ │ │  _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ccrreeaattee__ssmmaarrtt__bbaann__pplluuggiinn(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_/_s_m_a_r_t___b_a_n_._h_p_p"
│ │ │ │ │ +std::shared_ptr<torrent_plugin> ccrreeaattee__ssmmaarrtt__bbaann__pplluuggiinn (torrent_handle const&,
│ │ │ │ │ +client_data_t);
│ │ │ │ │ +constructor function for the smart ban extension. The extension keeps track of
│ │ │ │ │ +the data peers have sent us for failing pieces and once the piece completes and
│ │ │ │ │ +passes the hash check bans the peers that turned out to have sent corrupt data.
│ │ │ │ │ +This function can either be passed in the add_torrent_params::extensions field,
│ │ │ │ │ +or via _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ccrreeaattee__uutt__mmeettaaddaattaa__pplluuggiinn(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_/_u_t___m_e_t_a_d_a_t_a_._h_p_p"
│ │ │ │ │  std::shared_ptr<torrent_plugin> ccrreeaattee__uutt__mmeettaaddaattaa__pplluuggiinn (torrent_handle
│ │ │ │ │  const&, client_data_t);
│ │ │ │ │  constructor function for the ut_metadata extension. The ut_metadata extension
│ │ │ │ │  allows peers to request the .torrent file (or more specifically the info-
│ │ │ │ │  dictionary of the .torrent file) from each other. This is the main building
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Resume_Data.html
│ │ │ │ @@ -30,30 +30,30 @@
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │  <li><a class="reference internal" href="#read-resume-data" id="toc-entry-1">read_resume_data()</a></li>
│ │ │ │  <li><a class="reference internal" href="#write-resume-data-buf-write-resume-data" id="toc-entry-2">write_resume_data_buf() write_resume_data()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#write-torrent-file-write-torrent-file-buf" id="toc-entry-3">write_torrent_file() write_torrent_file_buf()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#write-torrent-file-buf-write-torrent-file" id="toc-entry-3">write_torrent_file_buf() write_torrent_file()</a></li>
│ │ │ │  <li><a class="reference internal" href="#write-torrent-flags-t" id="toc-entry-4">write_torrent_flags_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │  <a name="read_resume_data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:read_resume_data%28%29&labels=documentation&body=Documentation+under+heading+%22read_resume_data%28%29%22+could+be+improved">report issue</a>]</span><div class="section" id="read-resume-data">
│ │ │ │  <h1>read_resume_data()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/read_resume_data.hpp">libtorrent/read_resume_data.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -add_torrent_params <strong>read_resume_data</strong> (bdecode_node const&amp; rd
│ │ │ │ -   , error_code&amp; ec, int piece_limit = 0x200000);
│ │ │ │ -add_torrent_params <strong>read_resume_data</strong> (bdecode_node const&amp; rd
│ │ │ │ -   , int piece_limit = 0x200000);
│ │ │ │  add_torrent_params <strong>read_resume_data</strong> (span&lt;char const&gt; buffer
│ │ │ │     , error_code&amp; ec, load_torrent_limits const&amp; cfg = {});
│ │ │ │  add_torrent_params <strong>read_resume_data</strong> (span&lt;char const&gt; buffer
│ │ │ │     , load_torrent_limits const&amp; cfg = {});
│ │ │ │ +add_torrent_params <strong>read_resume_data</strong> (bdecode_node const&amp; rd
│ │ │ │ +   , int piece_limit = 0x200000);
│ │ │ │ +add_torrent_params <strong>read_resume_data</strong> (bdecode_node const&amp; rd
│ │ │ │ +   , error_code&amp; ec, int piece_limit = 0x200000);
│ │ │ │  </pre>
│ │ │ │  <p>these functions are used to parse resume data and populate the appropriate
│ │ │ │  fields in an <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object. This object can then be used to add
│ │ │ │  the actual <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object to and pass to session::add_torrent() or
│ │ │ │  session::async_add_torrent().</p>
│ │ │ │  <p>If the client wants to override any field that was loaded from the resume
│ │ │ │  data, e.g. save_path, those fields must be changed after loading resume
│ │ │ │ @@ -72,24 +72,24 @@
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/write_resume_data.hpp">libtorrent/write_resume_data.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  entry <strong>write_resume_data</strong> (add_torrent_params const&amp; atp);
│ │ │ │  std::vector&lt;char&gt; <strong>write_resume_data_buf</strong> (add_torrent_params const&amp; atp);
│ │ │ │  </pre>
│ │ │ │  <p>this function turns the resume data in an <tt class="docutils literal">add_torrent_params</tt> object
│ │ │ │  into a bencoded structure</p>
│ │ │ │ -<a name="write_torrent_file()"></a>
│ │ │ │ -<a name="write_torrent_file_buf()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:write_torrent_file%28%29+write_torrent_file_buf%28%29&labels=documentation&body=Documentation+under+heading+%22write_torrent_file%28%29+write_torrent_file_buf%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="write-torrent-file-write-torrent-file-buf">
│ │ │ │ -<h1>write_torrent_file() write_torrent_file_buf()</h1>
│ │ │ │ +<a name="write_torrent_file_buf()"></a>
│ │ │ │ +<a name="write_torrent_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:write_torrent_file_buf%28%29+write_torrent_file%28%29&labels=documentation&body=Documentation+under+heading+%22write_torrent_file_buf%28%29+write_torrent_file%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="write-torrent-file-buf-write-torrent-file">
│ │ │ │ +<h1>write_torrent_file_buf() write_torrent_file()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/write_resume_data.hpp">libtorrent/write_resume_data.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -entry <strong>write_torrent_file</strong> (add_torrent_params const&amp; atp);
│ │ │ │ -entry <strong>write_torrent_file</strong> (add_torrent_params const&amp; atp, write_torrent_flags_t flags);
│ │ │ │  std::vector&lt;char&gt; <strong>write_torrent_file_buf</strong> (add_torrent_params const&amp; atp
│ │ │ │     , write_torrent_flags_t flags);
│ │ │ │ +entry <strong>write_torrent_file</strong> (add_torrent_params const&amp; atp);
│ │ │ │ +entry <strong>write_torrent_file</strong> (add_torrent_params const&amp; atp, write_torrent_flags_t flags);
│ │ │ │  </pre>
│ │ │ │  <p>writes only the fields to create a .torrent file. This function may fail
│ │ │ │  with a <tt class="docutils literal"><span class="pre">std::system_error</span></tt> exception if:</p>
│ │ │ │  <ul class="simple">
│ │ │ │  <li>The <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object passed to this function does not contain the
│ │ │ │  info dictionary (the <tt class="docutils literal">ti</tt> field)</li>
│ │ │ │  <li>The piece layers are not complete for all files that need them</li>
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,27 +1,27 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │      * _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │      * _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a___b_u_f_(_)_ _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ -    * _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)_ _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e___b_u_f_(_)
│ │ │ │ │ +    * _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e___b_u_f_(_)_ _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │      * _w_r_i_t_e___t_o_r_r_e_n_t___f_l_a_g_s___t
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ rreeaadd__rreessuummee__ddaattaa(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_r_e_a_d___r_e_s_u_m_e___d_a_t_a_._h_p_p"
│ │ │ │ │ -add_torrent_params rreeaadd__rreessuummee__ddaattaa (bdecode_node const& rd
│ │ │ │ │ -   , error_code& ec, int piece_limit = 0x200000);
│ │ │ │ │ -add_torrent_params rreeaadd__rreessuummee__ddaattaa (bdecode_node const& rd
│ │ │ │ │ -   , int piece_limit = 0x200000);
│ │ │ │ │  add_torrent_params rreeaadd__rreessuummee__ddaattaa (span<char const> buffer
│ │ │ │ │     , error_code& ec, load_torrent_limits const& cfg = {});
│ │ │ │ │  add_torrent_params rreeaadd__rreessuummee__ddaattaa (span<char const> buffer
│ │ │ │ │     , load_torrent_limits const& cfg = {});
│ │ │ │ │ +add_torrent_params rreeaadd__rreessuummee__ddaattaa (bdecode_node const& rd
│ │ │ │ │ +   , int piece_limit = 0x200000);
│ │ │ │ │ +add_torrent_params rreeaadd__rreessuummee__ddaattaa (bdecode_node const& rd
│ │ │ │ │ +   , error_code& ec, int piece_limit = 0x200000);
│ │ │ │ │  these functions are used to parse resume data and populate the appropriate
│ │ │ │ │  fields in an _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object. This object can then be used to add the
│ │ │ │ │  actual _t_o_r_r_e_n_t___i_n_f_o object to and pass to session::add_torrent() or session::
│ │ │ │ │  async_add_torrent().
│ │ │ │ │  If the client wants to override any field that was loaded from the resume data,
│ │ │ │ │  e.g. save_path, those fields must be changed after loading resume data but
│ │ │ │ │  before adding the torrent.
│ │ │ │ │ @@ -36,21 +36,21 @@
│ │ │ │ │  ************ wwrriittee__rreessuummee__ddaattaa__bbuuff(()) wwrriittee__rreessuummee__ddaattaa(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_._h_p_p"
│ │ │ │ │  entry wwrriittee__rreessuummee__ddaattaa (add_torrent_params const& atp);
│ │ │ │ │  std::vector<char> wwrriittee__rreessuummee__ddaattaa__bbuuff (add_torrent_params const& atp);
│ │ │ │ │  this function turns the resume data in an add_torrent_params object into a
│ │ │ │ │  bencoded structure
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ wwrriittee__ttoorrrreenntt__ffiillee(()) wwrriittee__ttoorrrreenntt__ffiillee__bbuuff(()) ************
│ │ │ │ │ +************ wwrriittee__ttoorrrreenntt__ffiillee__bbuuff(()) wwrriittee__ttoorrrreenntt__ffiillee(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_._h_p_p"
│ │ │ │ │ +std::vector<char> wwrriittee__ttoorrrreenntt__ffiillee__bbuuff (add_torrent_params const& atp
│ │ │ │ │ +   , write_torrent_flags_t flags);
│ │ │ │ │  entry wwrriittee__ttoorrrreenntt__ffiillee (add_torrent_params const& atp);
│ │ │ │ │  entry wwrriittee__ttoorrrreenntt__ffiillee (add_torrent_params const& atp, write_torrent_flags_t
│ │ │ │ │  flags);
│ │ │ │ │ -std::vector<char> wwrriittee__ttoorrrreenntt__ffiillee__bbuuff (add_torrent_params const& atp
│ │ │ │ │ -   , write_torrent_flags_t flags);
│ │ │ │ │  writes only the fields to create a .torrent file. This function may fail with a
│ │ │ │ │  std::system_error exception if:
│ │ │ │ │      * The _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object passed to this function does not contain
│ │ │ │ │        the info dictionary (the ti field)
│ │ │ │ │      * The piece layers are not complete for all files that need them
│ │ │ │ │  The write_torrent_file_buf() overload returns the torrent file in bencoded
│ │ │ │ │  buffer form. This overload may be faster at the expense of lost flexibility to
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Session.html
│ │ │ │ @@ -29,15 +29,15 @@
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │  <li><a class="reference internal" href="#session-proxy" id="toc-entry-1">session_proxy</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#session-proxy-operator-session-proxy" id="toc-entry-2">session_proxy() operator=() ~session_proxy()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-session-proxy-session-proxy" id="toc-entry-2">operator=() ~session_proxy() session_proxy()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  <li><a class="reference internal" href="#session" id="toc-entry-3">session</a><ul>
│ │ │ │  <li><a class="reference internal" href="#session-1" id="toc-entry-4">session()</a></li>
│ │ │ │  <li><a class="reference internal" href="#session-2" id="toc-entry-5">session()</a></li>
│ │ │ │  <li><a class="reference internal" href="#session-3" id="toc-entry-6">~session()</a></li>
│ │ │ │  <li><a class="reference internal" href="#abort" id="toc-entry-7">abort()</a></li>
│ │ │ │ @@ -47,30 +47,30 @@
│ │ │ │  <li><a class="reference internal" href="#session-params-1" id="toc-entry-9">session_params()</a></li>
│ │ │ │  <li><a class="reference internal" href="#session-params-2" id="toc-entry-10">session_params()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  <li><a class="reference internal" href="#session-handle" id="toc-entry-11">session_handle</a><ul>
│ │ │ │  <li><a class="reference internal" href="#is-valid" id="toc-entry-12">is_valid()</a></li>
│ │ │ │  <li><a class="reference internal" href="#session-state" id="toc-entry-13">session_state()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-torrent-status-refresh-torrent-status" id="toc-entry-14">get_torrent_status() refresh_torrent_status()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#refresh-torrent-status-get-torrent-status" id="toc-entry-14">refresh_torrent_status() get_torrent_status()</a></li>
│ │ │ │  <li><a class="reference internal" href="#post-torrent-updates" id="toc-entry-15">post_torrent_updates()</a></li>
│ │ │ │  <li><a class="reference internal" href="#post-session-stats" id="toc-entry-16">post_session_stats()</a></li>
│ │ │ │  <li><a class="reference internal" href="#post-dht-stats" id="toc-entry-17">post_dht_stats()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-dht-state" id="toc-entry-18">set_dht_state()</a></li>
│ │ │ │  <li><a class="reference internal" href="#get-torrents-find-torrent" id="toc-entry-19">get_torrents() find_torrent()</a></li>
│ │ │ │  <li><a class="reference internal" href="#async-add-torrent-add-torrent" id="toc-entry-20">async_add_torrent() add_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#resume-is-paused-pause" id="toc-entry-21">resume() is_paused() pause()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#is-paused-pause-resume" id="toc-entry-21">is_paused() pause() resume()</a></li>
│ │ │ │  <li><a class="reference internal" href="#is-dht-running" id="toc-entry-22">is_dht_running()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-dht-storage" id="toc-entry-23">set_dht_storage()</a></li>
│ │ │ │  <li><a class="reference internal" href="#add-dht-node" id="toc-entry-24">add_dht_node()</a></li>
│ │ │ │  <li><a class="reference internal" href="#dht-get-item" id="toc-entry-25">dht_get_item()</a></li>
│ │ │ │  <li><a class="reference internal" href="#dht-get-item-1" id="toc-entry-26">dht_get_item()</a></li>
│ │ │ │  <li><a class="reference internal" href="#dht-put-item" id="toc-entry-27">dht_put_item()</a></li>
│ │ │ │  <li><a class="reference internal" href="#dht-put-item-1" id="toc-entry-28">dht_put_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-get-peers-dht-announce" id="toc-entry-29">dht_get_peers() dht_announce()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-announce-dht-get-peers" id="toc-entry-29">dht_announce() dht_get_peers()</a></li>
│ │ │ │  <li><a class="reference internal" href="#dht-live-nodes" id="toc-entry-30">dht_live_nodes()</a></li>
│ │ │ │  <li><a class="reference internal" href="#dht-sample-infohashes" id="toc-entry-31">dht_sample_infohashes()</a></li>
│ │ │ │  <li><a class="reference internal" href="#dht-direct-request" id="toc-entry-32">dht_direct_request()</a></li>
│ │ │ │  <li><a class="reference internal" href="#add-extension" id="toc-entry-33">add_extension()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-ip-filter-get-ip-filter" id="toc-entry-34">set_ip_filter() get_ip_filter()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-port-filter" id="toc-entry-35">set_port_filter()</a></li>
│ │ │ │  <li><a class="reference internal" href="#is-listening-listen-port-ssl-listen-port" id="toc-entry-36">is_listening() listen_port() ssl_listen_port()</a></li>
│ │ │ │ @@ -98,33 +98,33 @@
│ │ │ │  synchronize the completion of the shutdown. The lifetime of this object
│ │ │ │  may outlive <a class="reference external" href="reference-Session.html#session">session</a>, causing the <a class="reference external" href="reference-Session.html#session">session</a> destructor to not block. The
│ │ │ │  <a class="reference external" href="reference-Session.html#session_proxy">session_proxy</a> destructor will block however, until the underlying <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │  is done shutting down.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct session_proxy
│ │ │ │  {
│ │ │ │ -   <strong>~session_proxy</strong> ();
│ │ │ │ -   <strong>session_proxy</strong> ();
│ │ │ │ -   <strong>session_proxy</strong> (session_proxy&amp;&amp;) noexcept;
│ │ │ │     session_proxy&amp; <strong>operator=</strong> (session_proxy&amp;&amp;) &amp; noexcept;
│ │ │ │ -   <strong>session_proxy</strong> (session_proxy const&amp;);
│ │ │ │ +   <strong>session_proxy</strong> (session_proxy&amp;&amp;) noexcept;
│ │ │ │ +   <strong>session_proxy</strong> ();
│ │ │ │ +   <strong>~session_proxy</strong> ();
│ │ │ │     session_proxy&amp; <strong>operator=</strong> (session_proxy const&amp;) &amp;;
│ │ │ │ +   <strong>session_proxy</strong> (session_proxy const&amp;);
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="session_proxy()"></a>
│ │ │ │  <a name="operator=()"></a>
│ │ │ │ -<a name="~session_proxy()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_proxy%3A%3A%5Bsession_proxy%28%29+operator%3D%28%29+~session_proxy%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_proxy%3A%3A%5Bsession_proxy%28%29+operator%3D%28%29+~session_proxy%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="session-proxy-operator-session-proxy">
│ │ │ │ -<h2>session_proxy() operator=() ~session_proxy()</h2>
│ │ │ │ +<a name="~session_proxy()"></a>
│ │ │ │ +<a name="session_proxy()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_proxy%3A%3A%5Boperator%3D%28%29+~session_proxy%28%29+session_proxy%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_proxy%3A%3A%5Boperator%3D%28%29+~session_proxy%28%29+session_proxy%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-session-proxy-session-proxy">
│ │ │ │ +<h2>operator=() ~session_proxy() session_proxy()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -<strong>~session_proxy</strong> ();
│ │ │ │ -<strong>session_proxy</strong> ();
│ │ │ │ -<strong>session_proxy</strong> (session_proxy&amp;&amp;) noexcept;
│ │ │ │  session_proxy&amp; <strong>operator=</strong> (session_proxy&amp;&amp;) &amp; noexcept;
│ │ │ │ -<strong>session_proxy</strong> (session_proxy const&amp;);
│ │ │ │ +<strong>session_proxy</strong> (session_proxy&amp;&amp;) noexcept;
│ │ │ │ +<strong>session_proxy</strong> ();
│ │ │ │ +<strong>~session_proxy</strong> ();
│ │ │ │  session_proxy&amp; <strong>operator=</strong> (session_proxy const&amp;) &amp;;
│ │ │ │ +<strong>session_proxy</strong> (session_proxy const&amp;);
│ │ │ │  </pre>
│ │ │ │  <p>default constructor, does not refer to any <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │  implementation object.</p>
│ │ │ │  <a name="session"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session&labels=documentation&body=Documentation+under+heading+%22class+session%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │  <div class="section" id="session">
│ │ │ │  <h1>session</h1>
│ │ │ │ @@ -141,49 +141,49 @@
│ │ │ │  <p>see <a class="reference external" href="reference-Session.html#apply_settings()">apply_settings()</a>.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct session : session_handle
│ │ │ │  {
│ │ │ │     <strong>session</strong> ();
│ │ │ │     <strong>session</strong> (session_params&amp;&amp; params, session_flags_t flags);
│ │ │ │     <strong>session</strong> (session_params const&amp; params, session_flags_t flags);
│ │ │ │ -   explicit <strong>session</strong> (session_params&amp;&amp; params);
│ │ │ │     explicit <strong>session</strong> (session_params const&amp; params);
│ │ │ │ -   <strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios);
│ │ │ │ -   <strong>session</strong> (session_params const&amp; params, io_context&amp; ios);
│ │ │ │ +   explicit <strong>session</strong> (session_params&amp;&amp; params);
│ │ │ │     <strong>session</strong> (session_params const&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │     <strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │ +   <strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios);
│ │ │ │ +   <strong>session</strong> (session_params const&amp; params, io_context&amp; ios);
│ │ │ │     <strong>~session</strong> ();
│ │ │ │     session_proxy <strong>abort</strong> ();
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="session()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session%3A%3A%5Bsession%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session%3A%3A%5Bsession%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="session-1">
│ │ │ │  <h2>session()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  <strong>session</strong> ();
│ │ │ │  <strong>session</strong> (session_params&amp;&amp; params, session_flags_t flags);
│ │ │ │  <strong>session</strong> (session_params const&amp; params, session_flags_t flags);
│ │ │ │ -explicit <strong>session</strong> (session_params&amp;&amp; params);
│ │ │ │  explicit <strong>session</strong> (session_params const&amp; params);
│ │ │ │ +explicit <strong>session</strong> (session_params&amp;&amp; params);
│ │ │ │  </pre>
│ │ │ │  <p>Constructs the <a class="reference external" href="reference-Session.html#session">session</a> objects which acts as the container of torrents.
│ │ │ │  In order to avoid a race condition between starting the <a class="reference external" href="reference-Session.html#session">session</a> and
│ │ │ │  configuring it, you can pass in a <a class="reference external" href="reference-Session.html#session_params">session_params</a> object. Its settings
│ │ │ │  will take effect before the <a class="reference external" href="reference-Session.html#session">session</a> starts up.</p>
│ │ │ │  <p>The overloads taking <tt class="docutils literal">flags</tt> can be used to start a <a class="reference external" href="reference-Session.html#session">session</a> in
│ │ │ │  paused mode (by passing in <tt class="docutils literal"><span class="pre">session::paused</span></tt>). Note that
│ │ │ │  <tt class="docutils literal">add_default_plugins</tt> do not have an affect on constructors that
│ │ │ │  take a <a class="reference external" href="reference-Session.html#session_params">session_params</a> object. It already contains the plugins to use.</p>
│ │ │ │  <a name="session()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session%3A%3A%5Bsession%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session%3A%3A%5Bsession%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="session-2">
│ │ │ │  <h2>session()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -<strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios);
│ │ │ │ -<strong>session</strong> (session_params const&amp; params, io_context&amp; ios);
│ │ │ │  <strong>session</strong> (session_params const&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │  <strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │ +<strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios);
│ │ │ │ +<strong>session</strong> (session_params const&amp; params, io_context&amp; ios);
│ │ │ │  </pre>
│ │ │ │  <p>Overload of the constructor that takes an external io_context to run
│ │ │ │  the <a class="reference external" href="reference-Session.html#session">session</a> object on. This is primarily useful for tests that may want
│ │ │ │  to run multiple sessions on a single io_context, or low resource
│ │ │ │  systems where additional threads are expensive and sharing an
│ │ │ │  io_context with other events is fine.</p>
│ │ │ │  <div class="admonition warning">
│ │ │ │ @@ -234,16 +234,16 @@
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_params.hpp">libtorrent/session_params.hpp</a>&quot;</p>
│ │ │ │  <p>The <a class="reference external" href="reference-Session.html#session_params">session_params</a> is a parameters pack for configuring the <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │  before it's started.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct session_params
│ │ │ │  {
│ │ │ │     <strong>session_params</strong> ();
│ │ │ │ -   <strong>session_params</strong> (settings_pack&amp;&amp; sp);
│ │ │ │     <strong>session_params</strong> (settings_pack const&amp; sp);
│ │ │ │ +   <strong>session_params</strong> (settings_pack&amp;&amp; sp);
│ │ │ │     <strong>session_params</strong> (settings_pack const&amp; sp
│ │ │ │        , std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; exts);
│ │ │ │     <strong>session_params</strong> (settings_pack&amp;&amp; sp
│ │ │ │        , std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; exts);
│ │ │ │  
│ │ │ │     settings_pack settings;
│ │ │ │     std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; extensions;
│ │ │ │ @@ -254,16 +254,16 @@
│ │ │ │     libtorrent::ip_filter ip_filter;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="session_params()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bsession_params%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bsession_params%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="session-params-1">
│ │ │ │  <h2>session_params()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  <strong>session_params</strong> ();
│ │ │ │ -<strong>session_params</strong> (settings_pack&amp;&amp; sp);
│ │ │ │  <strong>session_params</strong> (settings_pack const&amp; sp);
│ │ │ │ +<strong>session_params</strong> (settings_pack&amp;&amp; sp);
│ │ │ │  </pre>
│ │ │ │  <p>This constructor can be used to start with the default plugins
│ │ │ │  (ut_metadata, ut_pex and smart_ban). Pass a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> to set the
│ │ │ │  initial settings when the <a class="reference external" href="reference-Session.html#session">session</a> starts.</p>
│ │ │ │  <a name="session_params()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bsession_params%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bsession_params%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="session-params-2">
│ │ │ │  <h2>session_params()</h2>
│ │ │ │ @@ -318,77 +318,77 @@
│ │ │ │  any operation on it will throw a system_error exception, with error code
│ │ │ │  invalid_session_handle.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct session_handle
│ │ │ │  {
│ │ │ │     bool <strong>is_valid</strong> () const;
│ │ │ │     session_params <strong>session_state</strong> (save_state_flags_t flags = save_state_flags_t::all()) const;
│ │ │ │ +   void <strong>refresh_torrent_status</strong> (std::vector&lt;torrent_status&gt;* ret
│ │ │ │ +      , status_flags_t flags = {}) const;
│ │ │ │     std::vector&lt;torrent_status&gt; <strong>get_torrent_status</strong> (
│ │ │ │        std::function&lt;bool(torrent_status const&amp;)&gt; const&amp; pred
│ │ │ │        , status_flags_t flags = {}) const;
│ │ │ │ -   void <strong>refresh_torrent_status</strong> (std::vector&lt;torrent_status&gt;* ret
│ │ │ │ -      , status_flags_t flags = {}) const;
│ │ │ │     void <strong>post_torrent_updates</strong> (status_flags_t flags = status_flags_t::all());
│ │ │ │     void <strong>post_session_stats</strong> ();
│ │ │ │     void <strong>post_dht_stats</strong> ();
│ │ │ │ -   void <strong>set_dht_state</strong> (dht::dht_state&amp;&amp; st);
│ │ │ │     void <strong>set_dht_state</strong> (dht::dht_state const&amp; st);
│ │ │ │ +   void <strong>set_dht_state</strong> (dht::dht_state&amp;&amp; st);
│ │ │ │     torrent_handle <strong>find_torrent</strong> (sha1_hash const&amp; info_hash) const;
│ │ │ │     std::vector&lt;torrent_handle&gt; <strong>get_torrents</strong> () const;
│ │ │ │ -   torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params, error_code&amp; ec);
│ │ │ │ -   torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │     void <strong>async_add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │     torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │ -   torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params, error_code&amp; ec);
│ │ │ │ +   torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params, error_code&amp; ec);
│ │ │ │     void <strong>async_add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ +   torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ +   torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params, error_code&amp; ec);
│ │ │ │     void <strong>resume</strong> ();
│ │ │ │     void <strong>pause</strong> ();
│ │ │ │     bool <strong>is_paused</strong> () const;
│ │ │ │     bool <strong>is_dht_running</strong> () const;
│ │ │ │     void <strong>set_dht_storage</strong> (dht::dht_storage_constructor_type sc);
│ │ │ │     void <strong>add_dht_node</strong> (std::pair&lt;std::string, int&gt; const&amp; node);
│ │ │ │     void <strong>dht_get_item</strong> (sha1_hash const&amp; target);
│ │ │ │     void <strong>dht_get_item</strong> (std::array&lt;char, 32&gt; key
│ │ │ │        , std::string salt = std::string());
│ │ │ │     sha1_hash <strong>dht_put_item</strong> (entry data);
│ │ │ │     void <strong>dht_put_item</strong> (std::array&lt;char, 32&gt; key
│ │ │ │        , std::function&lt;void(entry&amp;, std::array&lt;char, 64&gt;&amp;
│ │ │ │        , std::int64_t&amp;, std::string const&amp;)&gt; cb
│ │ │ │        , std::string salt = std::string());
│ │ │ │ -   void <strong>dht_announce</strong> (sha1_hash const&amp; info_hash, int port = 0, dht::announce_flags_t flags = {});
│ │ │ │     void <strong>dht_get_peers</strong> (sha1_hash const&amp; info_hash);
│ │ │ │ +   void <strong>dht_announce</strong> (sha1_hash const&amp; info_hash, int port = 0, dht::announce_flags_t flags = {});
│ │ │ │     void <strong>dht_live_nodes</strong> (sha1_hash const&amp; nid);
│ │ │ │     void <strong>dht_sample_infohashes</strong> (udp::endpoint const&amp; ep, sha1_hash const&amp; target);
│ │ │ │     void <strong>dht_direct_request</strong> (udp::endpoint const&amp; ep, entry const&amp; e, client_data_t userdata = {});
│ │ │ │     void <strong>add_extension</strong> (std::shared_ptr&lt;plugin&gt; ext);
│ │ │ │     void <strong>add_extension</strong> (std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(
│ │ │ │        torrent_handle const&amp;, client_data_t)&gt; ext);
│ │ │ │ -   ip_filter <strong>get_ip_filter</strong> () const;
│ │ │ │     void <strong>set_ip_filter</strong> (ip_filter f);
│ │ │ │ +   ip_filter <strong>get_ip_filter</strong> () const;
│ │ │ │     void <strong>set_port_filter</strong> (port_filter const&amp; f);
│ │ │ │ +   bool <strong>is_listening</strong> () const;
│ │ │ │     unsigned short <strong>ssl_listen_port</strong> () const;
│ │ │ │     unsigned short <strong>listen_port</strong> () const;
│ │ │ │ -   bool <strong>is_listening</strong> () const;
│ │ │ │     ip_filter <strong>get_peer_class_filter</strong> () const;
│ │ │ │     void <strong>set_peer_class_filter</strong> (ip_filter const&amp; f);
│ │ │ │ -   void <strong>set_peer_class_type_filter</strong> (peer_class_type_filter const&amp; f);
│ │ │ │     peer_class_type_filter <strong>get_peer_class_type_filter</strong> () const;
│ │ │ │ +   void <strong>set_peer_class_type_filter</strong> (peer_class_type_filter const&amp; f);
│ │ │ │     peer_class_t <strong>create_peer_class</strong> (char const* name);
│ │ │ │     void <strong>delete_peer_class</strong> (peer_class_t cid);
│ │ │ │     peer_class_info <strong>get_peer_class</strong> (peer_class_t cid) const;
│ │ │ │     void <strong>set_peer_class</strong> (peer_class_t cid, peer_class_info const&amp; pci);
│ │ │ │     void <strong>remove_torrent</strong> (const torrent_handle&amp;, remove_flags_t = {});
│ │ │ │ +   settings_pack <strong>get_settings</strong> () const;
│ │ │ │     void <strong>apply_settings</strong> (settings_pack const&amp;);
│ │ │ │     void <strong>apply_settings</strong> (settings_pack&amp;&amp;);
│ │ │ │ -   settings_pack <strong>get_settings</strong> () const;
│ │ │ │ -   void <strong>set_alert_notify</strong> (std::function&lt;void()&gt; const&amp; fun);
│ │ │ │ -   void <strong>pop_alerts</strong> (std::vector&lt;alert*&gt;* alerts);
│ │ │ │     alert* <strong>wait_for_alert</strong> (time_duration max_wait);
│ │ │ │ -   void <strong>delete_port_mapping</strong> (port_mapping_t handle);
│ │ │ │ +   void <strong>pop_alerts</strong> (std::vector&lt;alert*&gt;* alerts);
│ │ │ │ +   void <strong>set_alert_notify</strong> (std::function&lt;void()&gt; const&amp; fun);
│ │ │ │     std::vector&lt;port_mapping_t&gt; <strong>add_port_mapping</strong> (portmap_protocol t, int external_port, int local_port);
│ │ │ │ +   void <strong>delete_port_mapping</strong> (port_mapping_t handle);
│ │ │ │     void <strong>reopen_network_sockets</strong> (reopen_network_flags_t options = reopen_map_ports);
│ │ │ │     std::shared_ptr&lt;aux::session_impl&gt; <strong>native_handle</strong> () const;
│ │ │ │  
│ │ │ │     static constexpr save_state_flags_t <strong>save_settings</strong>  = 0_bit;
│ │ │ │     static constexpr save_state_flags_t <strong>save_dht_state</strong>  = 2_bit;
│ │ │ │     static constexpr save_state_flags_t <strong>save_extension_state</strong>  = 11_bit;
│ │ │ │     static constexpr save_state_flags_t <strong>save_ip_filter</strong>  = 12_bit;
│ │ │ │ @@ -420,24 +420,24 @@
│ │ │ │  <p>returns the current <a class="reference external" href="reference-Session.html#session">session</a> state. This can be passed to
│ │ │ │  <a class="reference external" href="reference-Session.html#write_session_params()">write_session_params()</a> to save the state to disk and restored using
│ │ │ │  <a class="reference external" href="reference-Session.html#read_session_params()">read_session_params()</a> when constructing a new <a class="reference external" href="reference-Session.html#session">session</a>. The kind of
│ │ │ │  state that's included is all settings, the DHT routing table, possibly
│ │ │ │  plugin-specific state.
│ │ │ │  the flags parameter can be used to only save certain parts of the
│ │ │ │  <a class="reference external" href="reference-Session.html#session">session</a> state</p>
│ │ │ │ -<a name="get_torrent_status()"></a>
│ │ │ │ -<a name="refresh_torrent_status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bget_torrent_status%28%29+refresh_torrent_status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bget_torrent_status%28%29+refresh_torrent_status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-torrent-status-refresh-torrent-status">
│ │ │ │ -<h2>get_torrent_status() refresh_torrent_status()</h2>
│ │ │ │ +<a name="refresh_torrent_status()"></a>
│ │ │ │ +<a name="get_torrent_status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Brefresh_torrent_status%28%29+get_torrent_status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Brefresh_torrent_status%28%29+get_torrent_status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="refresh-torrent-status-get-torrent-status">
│ │ │ │ +<h2>refresh_torrent_status() get_torrent_status()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +void <strong>refresh_torrent_status</strong> (std::vector&lt;torrent_status&gt;* ret
│ │ │ │ +      , status_flags_t flags = {}) const;
│ │ │ │  std::vector&lt;torrent_status&gt; <strong>get_torrent_status</strong> (
│ │ │ │        std::function&lt;bool(torrent_status const&amp;)&gt; const&amp; pred
│ │ │ │        , status_flags_t flags = {}) const;
│ │ │ │ -void <strong>refresh_torrent_status</strong> (std::vector&lt;torrent_status&gt;* ret
│ │ │ │ -      , status_flags_t flags = {}) const;
│ │ │ │  </pre>
│ │ │ │  <div class="admonition note">
│ │ │ │  <p class="first admonition-title">Note</p>
│ │ │ │  <p class="last">these calls are potentially expensive and won't scale well with
│ │ │ │  lots of torrents. If you're concerned about performance, consider
│ │ │ │  using <tt class="docutils literal">post_torrent_updates()</tt> instead.</p>
│ │ │ │  </div>
│ │ │ │ @@ -501,16 +501,16 @@
│ │ │ │  void <strong>post_dht_stats</strong> ();
│ │ │ │  </pre>
│ │ │ │  <p>This will cause a <a class="reference external" href="reference-Alerts.html#dht_stats_alert">dht_stats_alert</a> to be posted.</p>
│ │ │ │  <a name="set_dht_state()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_dht_state%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_dht_state%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="set-dht-state">
│ │ │ │  <h2>set_dht_state()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_dht_state</strong> (dht::dht_state&amp;&amp; st);
│ │ │ │  void <strong>set_dht_state</strong> (dht::dht_state const&amp; st);
│ │ │ │ +void <strong>set_dht_state</strong> (dht::dht_state&amp;&amp; st);
│ │ │ │  </pre>
│ │ │ │  <p>set the DHT state for the <a class="reference external" href="reference-Session.html#session">session</a>. This will be taken into account the
│ │ │ │  next time the DHT is started, as if it had been passed in via the
│ │ │ │  <a class="reference external" href="reference-Session.html#session_params">session_params</a> on startup.</p>
│ │ │ │  <a name="get_torrents()"></a>
│ │ │ │  <a name="find_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bget_torrents%28%29+find_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bget_torrents%28%29+find_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="get-torrents-find-torrent">
│ │ │ │ @@ -528,20 +528,20 @@
│ │ │ │  <p><tt class="docutils literal">get_torrents()</tt> returns a vector of torrent_handles to all the
│ │ │ │  torrents currently in the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │  <a name="async_add_torrent()"></a>
│ │ │ │  <a name="add_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Basync_add_torrent%28%29+add_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Basync_add_torrent%28%29+add_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="async-add-torrent-add-torrent">
│ │ │ │  <h2>async_add_torrent() add_torrent()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params, error_code&amp; ec);
│ │ │ │ -torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │  void <strong>async_add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │  torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │ -torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params, error_code&amp; ec);
│ │ │ │ +torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params, error_code&amp; ec);
│ │ │ │  void <strong>async_add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ +torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ +torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params, error_code&amp; ec);
│ │ │ │  </pre>
│ │ │ │  <p>You add torrents through the <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> function where you give an
│ │ │ │  object with all the parameters. The <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> overloads will block
│ │ │ │  until the torrent has been added (or failed to be added) and returns
│ │ │ │  an error code and a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>. In order to add torrents more
│ │ │ │  efficiently, consider using <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a> which returns
│ │ │ │  immediately, without waiting for the torrent to add. Notification of
│ │ │ │ @@ -566,19 +566,19 @@
│ │ │ │  want to control are torrent_flags::paused and
│ │ │ │  torrent_flags::auto_managed. In order to add a magnet link that will
│ │ │ │  just download the metadata, but no payload, set the
│ │ │ │  torrent_flags::upload_mode flag.</p>
│ │ │ │  <p>Special consideration has to be taken when adding hybrid torrents
│ │ │ │  (i.e. torrents that are BitTorrent v2 torrents that are backwards
│ │ │ │  compatible with v1). For more details, see <a class="reference external" href="manual-ref.html#bittorrent-v2-torrents">BitTorrent v2 torrents</a>.</p>
│ │ │ │ -<a name="resume()"></a>
│ │ │ │  <a name="is_paused()"></a>
│ │ │ │ -<a name="pause()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bresume%28%29+is_paused%28%29+pause%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bresume%28%29+is_paused%28%29+pause%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="resume-is-paused-pause">
│ │ │ │ -<h2>resume() is_paused() pause()</h2>
│ │ │ │ +<a name="pause()"></a>
│ │ │ │ +<a name="resume()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bis_paused%28%29+pause%28%29+resume%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bis_paused%28%29+pause%28%29+resume%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="is-paused-pause-resume">
│ │ │ │ +<h2>is_paused() pause() resume()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>resume</strong> ();
│ │ │ │  void <strong>pause</strong> ();
│ │ │ │  bool <strong>is_paused</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>Pausing the <a class="reference external" href="reference-Session.html#session">session</a> has the same effect as pausing every torrent in
│ │ │ │  it, except that torrents will not be resumed by the auto-manage
│ │ │ │ @@ -690,21 +690,21 @@
│ │ │ │  with the function object's context and make the function entirely
│ │ │ │  self-contained. The only reason data blob's value is computed
│ │ │ │  via a function instead of just passing in the new value is to avoid
│ │ │ │  race conditions. If you want to <em>update</em> the value in the DHT, you
│ │ │ │  must first retrieve it, then modify it, then write it back. The way
│ │ │ │  the DHT works, it is natural to always do a lookup before storing and
│ │ │ │  calling the callback in between is convenient.</p>
│ │ │ │ -<a name="dht_get_peers()"></a>
│ │ │ │ -<a name="dht_announce()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_get_peers%28%29+dht_announce%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_get_peers%28%29+dht_announce%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-get-peers-dht-announce">
│ │ │ │ -<h2>dht_get_peers() dht_announce()</h2>
│ │ │ │ +<a name="dht_announce()"></a>
│ │ │ │ +<a name="dht_get_peers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_announce%28%29+dht_get_peers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_announce%28%29+dht_get_peers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-announce-dht-get-peers">
│ │ │ │ +<h2>dht_announce() dht_get_peers()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>dht_announce</strong> (sha1_hash const&amp; info_hash, int port = 0, dht::announce_flags_t flags = {});
│ │ │ │  void <strong>dht_get_peers</strong> (sha1_hash const&amp; info_hash);
│ │ │ │ +void <strong>dht_announce</strong> (sha1_hash const&amp; info_hash, int port = 0, dht::announce_flags_t flags = {});
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">dht_get_peers()</tt> will issue a DHT get_peer request to the DHT for the
│ │ │ │  specified info-hash. The response (the peers) will be posted back in a
│ │ │ │  <a class="reference external" href="reference-Alerts.html#dht_get_peers_reply_alert">dht_get_peers_reply_alert</a>.</p>
│ │ │ │  <p><tt class="docutils literal">dht_announce()</tt> will issue a DHT announce request to the DHT to the
│ │ │ │  specified info-hash, advertising the specified port. If the port is
│ │ │ │  left at its default, 0, the port will be implied by the DHT message's
│ │ │ │ @@ -792,16 +792,16 @@
│ │ │ │  </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">add_extension</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">lt</span><span class="operator">::</span><span class="name">create_smart_ban_plugin</span><span class="punctuation">);</span>
│ │ │ │  </pre>
│ │ │ │  <a name="set_ip_filter()"></a>
│ │ │ │  <a name="get_ip_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_ip_filter%28%29+get_ip_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_ip_filter%28%29+get_ip_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="set-ip-filter-get-ip-filter">
│ │ │ │  <h2>set_ip_filter() get_ip_filter()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -ip_filter <strong>get_ip_filter</strong> () const;
│ │ │ │  void <strong>set_ip_filter</strong> (ip_filter f);
│ │ │ │ +ip_filter <strong>get_ip_filter</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>Sets a filter that will be used to reject and accept incoming as well
│ │ │ │  as outgoing connections based on their originating ip address. The
│ │ │ │  default filter will allow connections to any ip address. To build a
│ │ │ │  set of rules for which addresses are accepted and not, see <a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a>.</p>
│ │ │ │  <p>Each time a peer is blocked because of the IP filter, a
│ │ │ │  <a class="reference external" href="reference-Alerts.html#peer_blocked_alert">peer_blocked_alert</a> is generated. <tt class="docutils literal">get_ip_filter()</tt> Returns the
│ │ │ │ @@ -818,17 +818,17 @@
│ │ │ │  anti-virus software by connecting to SMTP, FTP ports.</p>
│ │ │ │  <a name="is_listening()"></a>
│ │ │ │  <a name="listen_port()"></a>
│ │ │ │  <a name="ssl_listen_port()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bis_listening%28%29+listen_port%28%29+ssl_listen_port%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bis_listening%28%29+listen_port%28%29+ssl_listen_port%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="is-listening-listen-port-ssl-listen-port">
│ │ │ │  <h2>is_listening() listen_port() ssl_listen_port()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +bool <strong>is_listening</strong> () const;
│ │ │ │  unsigned short <strong>ssl_listen_port</strong> () const;
│ │ │ │  unsigned short <strong>listen_port</strong> () const;
│ │ │ │ -bool <strong>is_listening</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">is_listening()</tt> will tell you whether or not the <a class="reference external" href="reference-Session.html#session">session</a> has
│ │ │ │  successfully opened a listening port. If it hasn't, this function will
│ │ │ │  return false, and then you can set a new
│ │ │ │  <a class="reference external" href="reference-Settings.html#listen_interfaces">settings_pack::listen_interfaces</a> to try another interface and port to
│ │ │ │  bind to.</p>
│ │ │ │  <p><tt class="docutils literal">listen_port()</tt> returns the port we ended up listening on.</p>
│ │ │ │ @@ -867,16 +867,16 @@
│ │ │ │  <p>The <tt class="docutils literal">get_peer_class_filter()</tt> function returns the current filter.</p>
│ │ │ │  <p>For more information, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │  <a name="set_peer_class_type_filter()"></a>
│ │ │ │  <a name="get_peer_class_type_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_peer_class_type_filter%28%29+get_peer_class_type_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_peer_class_type_filter%28%29+get_peer_class_type_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="set-peer-class-type-filter-get-peer-class-type-filter">
│ │ │ │  <h2>set_peer_class_type_filter() get_peer_class_type_filter()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_peer_class_type_filter</strong> (peer_class_type_filter const&amp; f);
│ │ │ │  peer_class_type_filter <strong>get_peer_class_type_filter</strong> () const;
│ │ │ │ +void <strong>set_peer_class_type_filter</strong> (peer_class_type_filter const&amp; f);
│ │ │ │  </pre>
│ │ │ │  <p>Sets and gets the <em>peer class type filter</em>. This is controls automatic
│ │ │ │  peer class assignments to peers based on what kind of socket it is.</p>
│ │ │ │  <p>It does not only support assigning peer classes, it also supports
│ │ │ │  removing peer classes based on socket type.</p>
│ │ │ │  <p>The order of these rules being applied are:</p>
│ │ │ │  <ol class="arabic simple">
│ │ │ │ @@ -944,28 +944,28 @@
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>remove_torrent</strong> (const torrent_handle&amp;, remove_flags_t = {});
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">remove_torrent()</tt> will close all peer connections associated with
│ │ │ │  the torrent and tell the tracker that we've stopped participating in
│ │ │ │  the swarm. This operation cannot fail. When it completes, you will
│ │ │ │  receive a <a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a>.</p>
│ │ │ │ -<p><a class="reference external" href="reference-Custom_Storage.html#remove_torrent()">remove_torrent()</a> is non-blocking, but will remove the torrent from the
│ │ │ │ +<p><a class="reference external" href="reference-Session.html#remove_torrent()">remove_torrent()</a> is non-blocking, but will remove the torrent from the
│ │ │ │  <a class="reference external" href="reference-Session.html#session">session</a> synchronously. Calling <a class="reference external" href="reference-Session.html#add_torrent()">session_handle::add_torrent()</a> immediately
│ │ │ │  afterward with the same torrent will succeed. Note that this creates a
│ │ │ │  new handle which is not equal to the removed one.</p>
│ │ │ │  <p>The optional second argument <tt class="docutils literal">options</tt> can be used to delete all the
│ │ │ │  files downloaded by this torrent. To do so, pass in the value
│ │ │ │  <tt class="docutils literal"><span class="pre">session_handle::delete_files</span></tt>. Once the torrent is deleted, a
│ │ │ │  <a class="reference external" href="reference-Alerts.html#torrent_deleted_alert">torrent_deleted_alert</a> is posted.</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> remains valid for some time after <a class="reference external" href="reference-Custom_Storage.html#remove_torrent()">remove_torrent()</a> is
│ │ │ │ +<p>The <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> remains valid for some time after <a class="reference external" href="reference-Session.html#remove_torrent()">remove_torrent()</a> is
│ │ │ │  called. It will become invalid only after all libtorrent tasks (such as
│ │ │ │  I/O tasks) release their references to the torrent. Until this happens,
│ │ │ │  <a class="reference external" href="reference-Torrent_Handle.html#is_valid()">torrent_handle::is_valid()</a> will return true, and other calls such
│ │ │ │  as <a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a> will succeed. Because of this, and because
│ │ │ │ -<a class="reference external" href="reference-Custom_Storage.html#remove_torrent()">remove_torrent()</a> is non-blocking, the following sequence usually
│ │ │ │ +<a class="reference external" href="reference-Session.html#remove_torrent()">remove_torrent()</a> is non-blocking, the following sequence usually
│ │ │ │  succeeds (does not throw system_error):
│ │ │ │  .. code:: c++</p>
│ │ │ │  <blockquote>
│ │ │ │  session.remove_handle(handle);
│ │ │ │  handle.save_resume_data();</blockquote>
│ │ │ │  <p>Note that when a queued or downloading torrent is removed, its position
│ │ │ │  in the download queue is vacated and every subsequent torrent in the
│ │ │ │ @@ -974,30 +974,30 @@
│ │ │ │  advised to remove them from the back of the queue, to minimize the
│ │ │ │  shifting.</p>
│ │ │ │  <a name="get_settings()"></a>
│ │ │ │  <a name="apply_settings()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bget_settings%28%29+apply_settings%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bget_settings%28%29+apply_settings%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="get-settings-apply-settings">
│ │ │ │  <h2>get_settings() apply_settings()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +settings_pack <strong>get_settings</strong> () const;
│ │ │ │  void <strong>apply_settings</strong> (settings_pack const&amp;);
│ │ │ │  void <strong>apply_settings</strong> (settings_pack&amp;&amp;);
│ │ │ │ -settings_pack <strong>get_settings</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>Applies the settings specified by the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> <tt class="docutils literal">s</tt>. This is an
│ │ │ │  asynchronous operation that will return immediately and actually apply
│ │ │ │  the settings to the main thread of libtorrent some time later.</p>
│ │ │ │  <a name="set_alert_notify()"></a>
│ │ │ │  <a name="pop_alerts()"></a>
│ │ │ │  <a name="wait_for_alert()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_alert_notify%28%29+pop_alerts%28%29+wait_for_alert%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_alert_notify%28%29+pop_alerts%28%29+wait_for_alert%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="set-alert-notify-pop-alerts-wait-for-alert">
│ │ │ │  <h2>set_alert_notify() pop_alerts() wait_for_alert()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_alert_notify</strong> (std::function&lt;void()&gt; const&amp; fun);
│ │ │ │ -void <strong>pop_alerts</strong> (std::vector&lt;alert*&gt;* alerts);
│ │ │ │  alert* <strong>wait_for_alert</strong> (time_duration max_wait);
│ │ │ │ +void <strong>pop_alerts</strong> (std::vector&lt;alert*&gt;* alerts);
│ │ │ │ +void <strong>set_alert_notify</strong> (std::function&lt;void()&gt; const&amp; fun);
│ │ │ │  </pre>
│ │ │ │  <p>Alerts is the main mechanism for libtorrent to report errors and
│ │ │ │  events. <tt class="docutils literal">pop_alerts</tt> fills in the vector passed to it with pointers
│ │ │ │  to new alerts. The <a class="reference external" href="reference-Session.html#session">session</a> still owns these alerts and they will stay
│ │ │ │  valid until the next time <tt class="docutils literal">pop_alerts</tt> is called. You may not delete
│ │ │ │  the <a class="reference external" href="reference-Alerts.html#alert">alert</a> objects.</p>
│ │ │ │  <p>It is safe to call <tt class="docutils literal">pop_alerts</tt> from multiple different threads, as
│ │ │ │ @@ -1048,16 +1048,16 @@
│ │ │ │  <tt class="docutils literal"><span class="pre">alert::type()</span></tt> but can also be queries from a concrete type via
│ │ │ │  <tt class="docutils literal"><span class="pre">T::alert_type</span></tt>, as a static constant.</p>
│ │ │ │  <a name="add_port_mapping()"></a>
│ │ │ │  <a name="delete_port_mapping()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Badd_port_mapping%28%29+delete_port_mapping%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Badd_port_mapping%28%29+delete_port_mapping%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="add-port-mapping-delete-port-mapping">
│ │ │ │  <h2>add_port_mapping() delete_port_mapping()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>delete_port_mapping</strong> (port_mapping_t handle);
│ │ │ │  std::vector&lt;port_mapping_t&gt; <strong>add_port_mapping</strong> (portmap_protocol t, int external_port, int local_port);
│ │ │ │ +void <strong>delete_port_mapping</strong> (port_mapping_t handle);
│ │ │ │  </pre>
│ │ │ │  <p>add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP,
│ │ │ │  whichever is enabled. A mapping is created for each listen socket
│ │ │ │  in the <a class="reference external" href="reference-Session.html#session">session</a>. The return values are all handles referring to the
│ │ │ │  port mappings that were just created. Pass them to <a class="reference external" href="reference-Session.html#delete_port_mapping()">delete_port_mapping()</a>
│ │ │ │  to remove them.</p>
│ │ │ │  <a name="reopen_network_sockets()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Breopen_network_sockets%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Breopen_network_sockets%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ @@ -1131,22 +1131,22 @@
│ │ │ │  <a name="write_session_params_buf()"></a>
│ │ │ │  <a name="write_session_params()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:read_session_params%28%29+write_session_params_buf%28%29+write_session_params%28%29&labels=documentation&body=Documentation+under+heading+%22read_session_params%28%29+write_session_params_buf%28%29+write_session_params%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │  <div class="section" id="read-session-params-write-session-params-buf-write-session-params">
│ │ │ │  <h1>read_session_params() write_session_params_buf() write_session_params()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_params.hpp">libtorrent/session_params.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -entry <strong>write_session_params</strong> (session_params const&amp; sp
│ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │  std::vector&lt;char&gt; <strong>write_session_params_buf</strong> (session_params const&amp; sp
│ │ │ │     , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ -session_params <strong>read_session_params</strong> (bdecode_node const&amp; e
│ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │  session_params <strong>read_session_params</strong> (span&lt;char const&gt; buf
│ │ │ │     , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ +entry <strong>write_session_params</strong> (session_params const&amp; sp
│ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ +session_params <strong>read_session_params</strong> (bdecode_node const&amp; e
│ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │  </pre>
│ │ │ │  <p>These functions serialize and de-serialize a <tt class="docutils literal">session_params</tt> object to and
│ │ │ │  from bencoded form. The <a class="reference external" href="reference-Session.html#session_params">session_params</a> object is used to initialize a new
│ │ │ │  <a class="reference external" href="reference-Session.html#session">session</a> using the state from a previous one (or by programmatically configure
│ │ │ │  the <a class="reference external" href="reference-Session.html#session">session</a> up-front).
│ │ │ │  The flags parameter can be used to only save and load certain aspects of the
│ │ │ │  session's state.
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,41 +1,41 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │      * _s_e_s_s_i_o_n___p_r_o_x_y
│ │ │ │ │ -          o _s_e_s_s_i_o_n___p_r_o_x_y_(_)_ _o_p_e_r_a_t_o_r_=_(_)_ _~_s_e_s_s_i_o_n___p_r_o_x_y_(_)
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_=_(_)_ _~_s_e_s_s_i_o_n___p_r_o_x_y_(_)_ _s_e_s_s_i_o_n___p_r_o_x_y_(_)
│ │ │ │ │      * _s_e_s_s_i_o_n
│ │ │ │ │            o _s_e_s_s_i_o_n_(_)
│ │ │ │ │            o _s_e_s_s_i_o_n_(_)
│ │ │ │ │            o _~_s_e_s_s_i_o_n_(_)
│ │ │ │ │            o _a_b_o_r_t_(_)
│ │ │ │ │      * _s_e_s_s_i_o_n___p_a_r_a_m_s
│ │ │ │ │            o _s_e_s_s_i_o_n___p_a_r_a_m_s_(_)
│ │ │ │ │            o _s_e_s_s_i_o_n___p_a_r_a_m_s_(_)
│ │ │ │ │      * _s_e_s_s_i_o_n___h_a_n_d_l_e
│ │ │ │ │            o _i_s___v_a_l_i_d_(_)
│ │ │ │ │            o _s_e_s_s_i_o_n___s_t_a_t_e_(_)
│ │ │ │ │ -          o _g_e_t___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)_ _r_e_f_r_e_s_h___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)
│ │ │ │ │ +          o _r_e_f_r_e_s_h___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)_ _g_e_t___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)
│ │ │ │ │            o _p_o_s_t___t_o_r_r_e_n_t___u_p_d_a_t_e_s_(_)
│ │ │ │ │            o _p_o_s_t___s_e_s_s_i_o_n___s_t_a_t_s_(_)
│ │ │ │ │            o _p_o_s_t___d_h_t___s_t_a_t_s_(_)
│ │ │ │ │            o _s_e_t___d_h_t___s_t_a_t_e_(_)
│ │ │ │ │            o _g_e_t___t_o_r_r_e_n_t_s_(_)_ _f_i_n_d___t_o_r_r_e_n_t_(_)
│ │ │ │ │            o _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_)_ _a_d_d___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -          o _r_e_s_u_m_e_(_)_ _i_s___p_a_u_s_e_d_(_)_ _p_a_u_s_e_(_)
│ │ │ │ │ +          o _i_s___p_a_u_s_e_d_(_)_ _p_a_u_s_e_(_)_ _r_e_s_u_m_e_(_)
│ │ │ │ │            o _i_s___d_h_t___r_u_n_n_i_n_g_(_)
│ │ │ │ │            o _s_e_t___d_h_t___s_t_o_r_a_g_e_(_)
│ │ │ │ │            o _a_d_d___d_h_t___n_o_d_e_(_)
│ │ │ │ │            o _d_h_t___g_e_t___i_t_e_m_(_)
│ │ │ │ │            o _d_h_t___g_e_t___i_t_e_m_(_)
│ │ │ │ │            o _d_h_t___p_u_t___i_t_e_m_(_)
│ │ │ │ │            o _d_h_t___p_u_t___i_t_e_m_(_)
│ │ │ │ │ -          o _d_h_t___g_e_t___p_e_e_r_s_(_)_ _d_h_t___a_n_n_o_u_n_c_e_(_)
│ │ │ │ │ +          o _d_h_t___a_n_n_o_u_n_c_e_(_)_ _d_h_t___g_e_t___p_e_e_r_s_(_)
│ │ │ │ │            o _d_h_t___l_i_v_e___n_o_d_e_s_(_)
│ │ │ │ │            o _d_h_t___s_a_m_p_l_e___i_n_f_o_h_a_s_h_e_s_(_)
│ │ │ │ │            o _d_h_t___d_i_r_e_c_t___r_e_q_u_e_s_t_(_)
│ │ │ │ │            o _a_d_d___e_x_t_e_n_s_i_o_n_(_)
│ │ │ │ │            o _s_e_t___i_p___f_i_l_t_e_r_(_)_ _g_e_t___i_p___f_i_l_t_e_r_(_)
│ │ │ │ │            o _s_e_t___p_o_r_t___f_i_l_t_e_r_(_)
│ │ │ │ │            o _i_s___l_i_s_t_e_n_i_n_g_(_)_ _l_i_s_t_e_n___p_o_r_t_(_)_ _s_s_l___l_i_s_t_e_n___p_o_r_t_(_)
│ │ │ │ │ @@ -58,29 +58,29 @@
│ │ │ │ │  _s_e_s_s_i_o_n destruction is explicitly initiated, this holder is used to synchronize
│ │ │ │ │  the completion of the shutdown. The lifetime of this object may outlive
│ │ │ │ │  _s_e_s_s_i_o_n, causing the _s_e_s_s_i_o_n destructor to not block. The _s_e_s_s_i_o_n___p_r_o_x_y
│ │ │ │ │  destructor will block however, until the underlying _s_e_s_s_i_o_n is done shutting
│ │ │ │ │  down.
│ │ │ │ │  struct session_proxy
│ │ │ │ │  {
│ │ │ │ │ -   ~~sseessssiioonn__pprrooxxyy ();
│ │ │ │ │ -   sseessssiioonn__pprrooxxyy ();
│ │ │ │ │ -   sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept;
│ │ │ │ │     session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept;
│ │ │ │ │ -   sseessssiioonn__pprrooxxyy (session_proxy const&);
│ │ │ │ │ +   sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept;
│ │ │ │ │ +   sseessssiioonn__pprrooxxyy ();
│ │ │ │ │ +   ~~sseessssiioonn__pprrooxxyy ();
│ │ │ │ │     session_proxy& ooppeerraattoorr== (session_proxy const&) &;
│ │ │ │ │ +   sseessssiioonn__pprrooxxyy (session_proxy const&);
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseessssiioonn__pprrooxxyy(()) ooppeerraattoorr==(()) ~~sseessssiioonn__pprrooxxyy(()) **********
│ │ │ │ │ -~~sseessssiioonn__pprrooxxyy ();
│ │ │ │ │ -sseessssiioonn__pprrooxxyy ();
│ │ │ │ │ -sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept;
│ │ │ │ │ +********** ooppeerraattoorr==(()) ~~sseessssiioonn__pprrooxxyy(()) sseessssiioonn__pprrooxxyy(()) **********
│ │ │ │ │  session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept;
│ │ │ │ │ -sseessssiioonn__pprrooxxyy (session_proxy const&);
│ │ │ │ │ +sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept;
│ │ │ │ │ +sseessssiioonn__pprrooxxyy ();
│ │ │ │ │ +~~sseessssiioonn__pprrooxxyy ();
│ │ │ │ │  session_proxy& ooppeerraattoorr== (session_proxy const&) &;
│ │ │ │ │ +sseessssiioonn__pprrooxxyy (session_proxy const&);
│ │ │ │ │  default constructor, does not refer to any _s_e_s_s_i_o_n implementation object.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ sseessssiioonn ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n_._h_p_p"
│ │ │ │ │  The _s_e_s_s_i_o_n holds all state that spans multiple torrents. Among other things it
│ │ │ │ │  runs the network loop and manages all torrents. Once it's created, the _s_e_s_s_i_o_n
│ │ │ │ │  object will spawn the main thread that will do all the work. The main thread
│ │ │ │ │ @@ -91,44 +91,44 @@
│ │ │ │ │  it in to session::apply_settings().
│ │ │ │ │  see _a_p_p_l_y___s_e_t_t_i_n_g_s_(_).
│ │ │ │ │  struct session : session_handle
│ │ │ │ │  {
│ │ │ │ │     sseessssiioonn ();
│ │ │ │ │     sseessssiioonn (session_params&& params, session_flags_t flags);
│ │ │ │ │     sseessssiioonn (session_params const& params, session_flags_t flags);
│ │ │ │ │ -   explicit sseessssiioonn (session_params&& params);
│ │ │ │ │     explicit sseessssiioonn (session_params const& params);
│ │ │ │ │ -   sseessssiioonn (session_params&& params, io_context& ios);
│ │ │ │ │ -   sseessssiioonn (session_params const& params, io_context& ios);
│ │ │ │ │ +   explicit sseessssiioonn (session_params&& params);
│ │ │ │ │     sseessssiioonn (session_params const& params, io_context& ios, session_flags_t);
│ │ │ │ │     sseessssiioonn (session_params&& params, io_context& ios, session_flags_t);
│ │ │ │ │ +   sseessssiioonn (session_params&& params, io_context& ios);
│ │ │ │ │ +   sseessssiioonn (session_params const& params, io_context& ios);
│ │ │ │ │     ~~sseessssiioonn ();
│ │ │ │ │     session_proxy aabboorrtt ();
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseessssiioonn(()) **********
│ │ │ │ │  sseessssiioonn ();
│ │ │ │ │  sseessssiioonn (session_params&& params, session_flags_t flags);
│ │ │ │ │  sseessssiioonn (session_params const& params, session_flags_t flags);
│ │ │ │ │ -explicit sseessssiioonn (session_params&& params);
│ │ │ │ │  explicit sseessssiioonn (session_params const& params);
│ │ │ │ │ +explicit sseessssiioonn (session_params&& params);
│ │ │ │ │  Constructs the _s_e_s_s_i_o_n objects which acts as the container of torrents. In
│ │ │ │ │  order to avoid a race condition between starting the _s_e_s_s_i_o_n and configuring
│ │ │ │ │  it, you can pass in a _s_e_s_s_i_o_n___p_a_r_a_m_s object. Its settings will take effect
│ │ │ │ │  before the _s_e_s_s_i_o_n starts up.
│ │ │ │ │  The overloads taking flags can be used to start a _s_e_s_s_i_o_n in paused mode (by
│ │ │ │ │  passing in session::paused). Note that add_default_plugins do not have an
│ │ │ │ │  affect on constructors that take a _s_e_s_s_i_o_n___p_a_r_a_m_s object. It already contains
│ │ │ │ │  the plugins to use.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseessssiioonn(()) **********
│ │ │ │ │ -sseessssiioonn (session_params&& params, io_context& ios);
│ │ │ │ │ -sseessssiioonn (session_params const& params, io_context& ios);
│ │ │ │ │  sseessssiioonn (session_params const& params, io_context& ios, session_flags_t);
│ │ │ │ │  sseessssiioonn (session_params&& params, io_context& ios, session_flags_t);
│ │ │ │ │ +sseessssiioonn (session_params&& params, io_context& ios);
│ │ │ │ │ +sseessssiioonn (session_params const& params, io_context& ios);
│ │ │ │ │  Overload of the constructor that takes an external io_context to run the
│ │ │ │ │  _s_e_s_s_i_o_n object on. This is primarily useful for tests that may want to run
│ │ │ │ │  multiple sessions on a single io_context, or low resource systems where
│ │ │ │ │  additional threads are expensive and sharing an io_context with other events is
│ │ │ │ │  fine.
│ │ │ │ │  Warning
│ │ │ │ │  The _s_e_s_s_i_o_n object does not cleanly terminate with an external io_context. The
│ │ │ │ │ @@ -163,16 +163,16 @@
│ │ │ │ │  ************ sseessssiioonn__ppaarraammss ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___p_a_r_a_m_s_._h_p_p"
│ │ │ │ │  The _s_e_s_s_i_o_n___p_a_r_a_m_s is a parameters pack for configuring the _s_e_s_s_i_o_n before it's
│ │ │ │ │  started.
│ │ │ │ │  struct session_params
│ │ │ │ │  {
│ │ │ │ │     sseessssiioonn__ppaarraammss ();
│ │ │ │ │ -   sseessssiioonn__ppaarraammss (settings_pack&& sp);
│ │ │ │ │     sseessssiioonn__ppaarraammss (settings_pack const& sp);
│ │ │ │ │ +   sseessssiioonn__ppaarraammss (settings_pack&& sp);
│ │ │ │ │     sseessssiioonn__ppaarraammss (settings_pack const& sp
│ │ │ │ │        , std::vector<std::shared_ptr<plugin>> exts);
│ │ │ │ │     sseessssiioonn__ppaarraammss (settings_pack&& sp
│ │ │ │ │        , std::vector<std::shared_ptr<plugin>> exts);
│ │ │ │ │  
│ │ │ │ │     settings_pack settings;
│ │ │ │ │     std::vector<std::shared_ptr<plugin>> extensions;
│ │ │ │ │ @@ -181,16 +181,16 @@
│ │ │ │ │     disk_io_constructor_type disk_io_constructor;
│ │ │ │ │     std::map<std::string, std::string> ext_state;
│ │ │ │ │     libtorrent::ip_filter ip_filter;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseessssiioonn__ppaarraammss(()) **********
│ │ │ │ │  sseessssiioonn__ppaarraammss ();
│ │ │ │ │ -sseessssiioonn__ppaarraammss (settings_pack&& sp);
│ │ │ │ │  sseessssiioonn__ppaarraammss (settings_pack const& sp);
│ │ │ │ │ +sseessssiioonn__ppaarraammss (settings_pack&& sp);
│ │ │ │ │  This constructor can be used to start with the default plugins (ut_metadata,
│ │ │ │ │  ut_pex and smart_ban). Pass a _s_e_t_t_i_n_g_s___p_a_c_k to set the initial settings when
│ │ │ │ │  the _s_e_s_s_i_o_n starts.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseessssiioonn__ppaarraammss(()) **********
│ │ │ │ │  sseessssiioonn__ppaarraammss (settings_pack const& sp
│ │ │ │ │        , std::vector<std::shared_ptr<plugin>> exts);
│ │ │ │ │ @@ -232,82 +232,82 @@
│ │ │ │ │  operation on it will throw a system_error exception, with error code
│ │ │ │ │  invalid_session_handle.
│ │ │ │ │  struct session_handle
│ │ │ │ │  {
│ │ │ │ │     bool iiss__vvaalliidd () const;
│ │ │ │ │     session_params sseessssiioonn__ssttaattee (save_state_flags_t flags =
│ │ │ │ │  save_state_flags_t::all()) const;
│ │ │ │ │ +   void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector<torrent_status>* ret
│ │ │ │ │ +      , status_flags_t flags = {}) const;
│ │ │ │ │     std::vector<torrent_status> ggeett__ttoorrrreenntt__ssttaattuuss (
│ │ │ │ │        std::function<bool(torrent_status const&)> const& pred
│ │ │ │ │        , status_flags_t flags = {}) const;
│ │ │ │ │ -   void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector<torrent_status>* ret
│ │ │ │ │ -      , status_flags_t flags = {}) const;
│ │ │ │ │     void ppoosstt__ttoorrrreenntt__uuppddaatteess (status_flags_t flags = status_flags_t::all());
│ │ │ │ │     void ppoosstt__sseessssiioonn__ssttaattss ();
│ │ │ │ │     void ppoosstt__ddhhtt__ssttaattss ();
│ │ │ │ │ -   void sseett__ddhhtt__ssttaattee (dht::dht_state&& st);
│ │ │ │ │     void sseett__ddhhtt__ssttaattee (dht::dht_state const& st);
│ │ │ │ │ +   void sseett__ddhhtt__ssttaattee (dht::dht_state&& st);
│ │ │ │ │     torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const;
│ │ │ │ │     std::vector<torrent_handle> ggeett__ttoorrrreennttss () const;
│ │ │ │ │ +   void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │ +   torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │     torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params, error_code&
│ │ │ │ │  ec);
│ │ │ │ │ +   void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │     torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │ -   void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │ -   torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │     torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params, error_code& ec);
│ │ │ │ │ -   void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │     void rreessuummee ();
│ │ │ │ │     void ppaauussee ();
│ │ │ │ │     bool iiss__ppaauusseedd () const;
│ │ │ │ │     bool iiss__ddhhtt__rruunnnniinngg () const;
│ │ │ │ │     void sseett__ddhhtt__ssttoorraaggee (dht::dht_storage_constructor_type sc);
│ │ │ │ │     void aadddd__ddhhtt__nnooddee (std::pair<std::string, int> const& node);
│ │ │ │ │     void ddhhtt__ggeett__iitteemm (sha1_hash const& target);
│ │ │ │ │     void ddhhtt__ggeett__iitteemm (std::array<char, 32> key
│ │ │ │ │        , std::string salt = std::string());
│ │ │ │ │     sha1_hash ddhhtt__ppuutt__iitteemm (entry data);
│ │ │ │ │     void ddhhtt__ppuutt__iitteemm (std::array<char, 32> key
│ │ │ │ │        , std::function<void(entry&, std::array<char, 64>&
│ │ │ │ │        , std::int64_t&, std::string const&)> cb
│ │ │ │ │        , std::string salt = std::string());
│ │ │ │ │ +   void ddhhtt__ggeett__ppeeeerrss (sha1_hash const& info_hash);
│ │ │ │ │     void ddhhtt__aannnnoouunnccee (sha1_hash const& info_hash, int port = 0, dht::
│ │ │ │ │  announce_flags_t flags = {});
│ │ │ │ │ -   void ddhhtt__ggeett__ppeeeerrss (sha1_hash const& info_hash);
│ │ │ │ │     void ddhhtt__lliivvee__nnooddeess (sha1_hash const& nid);
│ │ │ │ │     void ddhhtt__ssaammppllee__iinnffoohhaasshheess (udp::endpoint const& ep, sha1_hash const&
│ │ │ │ │  target);
│ │ │ │ │     void ddhhtt__ddiirreecctt__rreeqquueesstt (udp::endpoint const& ep, entry const& e,
│ │ │ │ │  client_data_t userdata = {});
│ │ │ │ │     void aadddd__eexxtteennssiioonn (std::shared_ptr<plugin> ext);
│ │ │ │ │     void aadddd__eexxtteennssiioonn (std::function<std::shared_ptr<torrent_plugin>(
│ │ │ │ │        torrent_handle const&, client_data_t)> ext);
│ │ │ │ │ -   ip_filter ggeett__iipp__ffiilltteerr () const;
│ │ │ │ │     void sseett__iipp__ffiilltteerr (ip_filter f);
│ │ │ │ │ +   ip_filter ggeett__iipp__ffiilltteerr () const;
│ │ │ │ │     void sseett__ppoorrtt__ffiilltteerr (port_filter const& f);
│ │ │ │ │ +   bool iiss__lliisstteenniinngg () const;
│ │ │ │ │     unsigned short ssssll__lliisstteenn__ppoorrtt () const;
│ │ │ │ │     unsigned short lliisstteenn__ppoorrtt () const;
│ │ │ │ │ -   bool iiss__lliisstteenniinngg () const;
│ │ │ │ │     ip_filter ggeett__ppeeeerr__ccllaassss__ffiilltteerr () const;
│ │ │ │ │     void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f);
│ │ │ │ │ -   void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f);
│ │ │ │ │     peer_class_type_filter ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr () const;
│ │ │ │ │ +   void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f);
│ │ │ │ │     peer_class_t ccrreeaattee__ppeeeerr__ccllaassss (char const* name);
│ │ │ │ │     void ddeelleettee__ppeeeerr__ccllaassss (peer_class_t cid);
│ │ │ │ │     peer_class_info ggeett__ppeeeerr__ccllaassss (peer_class_t cid) const;
│ │ │ │ │     void sseett__ppeeeerr__ccllaassss (peer_class_t cid, peer_class_info const& pci);
│ │ │ │ │     void rreemmoovvee__ttoorrrreenntt (const torrent_handle&, remove_flags_t = {});
│ │ │ │ │ +   settings_pack ggeett__sseettttiinnggss () const;
│ │ │ │ │     void aappppllyy__sseettttiinnggss (settings_pack const&);
│ │ │ │ │     void aappppllyy__sseettttiinnggss (settings_pack&&);
│ │ │ │ │ -   settings_pack ggeett__sseettttiinnggss () const;
│ │ │ │ │ -   void sseett__aalleerrtt__nnoottiiffyy (std::function<void()> const& fun);
│ │ │ │ │ -   void ppoopp__aalleerrttss (std::vector<alert*>* alerts);
│ │ │ │ │     alert* wwaaiitt__ffoorr__aalleerrtt (time_duration max_wait);
│ │ │ │ │ -   void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle);
│ │ │ │ │ +   void ppoopp__aalleerrttss (std::vector<alert*>* alerts);
│ │ │ │ │ +   void sseett__aalleerrtt__nnoottiiffyy (std::function<void()> const& fun);
│ │ │ │ │     std::vector<port_mapping_t> aadddd__ppoorrtt__mmaappppiinngg (portmap_protocol t, int
│ │ │ │ │  external_port, int local_port);
│ │ │ │ │ +   void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle);
│ │ │ │ │     void rreeooppeenn__nneettwwoorrkk__ssoocckkeettss (reopen_network_flags_t options =
│ │ │ │ │  reopen_map_ports);
│ │ │ │ │     std::shared_ptr<aux::session_impl> nnaattiivvee__hhaannddllee () const;
│ │ │ │ │  
│ │ │ │ │     static constexpr save_state_flags_t ssaavvee__sseettttiinnggss  = 0_bit;
│ │ │ │ │     static constexpr save_state_flags_t ssaavvee__ddhhtt__ssttaattee  = 2_bit;
│ │ │ │ │     static constexpr save_state_flags_t ssaavvee__eexxtteennssiioonn__ssttaattee  = 11_bit;
│ │ │ │ │ @@ -333,20 +333,20 @@
│ │ │ │ │  all()) const;
│ │ │ │ │  returns the current _s_e_s_s_i_o_n state. This can be passed to _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)
│ │ │ │ │  to save the state to disk and restored using _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_) when
│ │ │ │ │  constructing a new _s_e_s_s_i_o_n. The kind of state that's included is all settings,
│ │ │ │ │  the DHT routing table, possibly plugin-specific state. the flags parameter can
│ │ │ │ │  be used to only save certain parts of the _s_e_s_s_i_o_n state
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett__ttoorrrreenntt__ssttaattuuss(()) rreeffrreesshh__ttoorrrreenntt__ssttaattuuss(()) **********
│ │ │ │ │ +********** rreeffrreesshh__ttoorrrreenntt__ssttaattuuss(()) ggeett__ttoorrrreenntt__ssttaattuuss(()) **********
│ │ │ │ │ +void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector<torrent_status>* ret
│ │ │ │ │ +      , status_flags_t flags = {}) const;
│ │ │ │ │  std::vector<torrent_status> ggeett__ttoorrrreenntt__ssttaattuuss (
│ │ │ │ │        std::function<bool(torrent_status const&)> const& pred
│ │ │ │ │        , status_flags_t flags = {}) const;
│ │ │ │ │ -void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector<torrent_status>* ret
│ │ │ │ │ -      , status_flags_t flags = {}) const;
│ │ │ │ │  Note
│ │ │ │ │  these calls are potentially expensive and won't scale well with lots of
│ │ │ │ │  torrents. If you're concerned about performance, consider using
│ │ │ │ │  post_torrent_updates() instead.
│ │ │ │ │  get_torrent_status returns a vector of the _t_o_r_r_e_n_t___s_t_a_t_u_s for every torrent
│ │ │ │ │  which satisfies pred, which is a predicate function which determines if a
│ │ │ │ │  torrent should be included in the returned set or not. Returning true means it
│ │ │ │ │ @@ -391,16 +391,16 @@
│ │ │ │ │  For more information, see the _s_e_s_s_i_o_n_ _s_t_a_t_i_s_t_i_c_s section.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ppoosstt__ddhhtt__ssttaattss(()) **********
│ │ │ │ │  void ppoosstt__ddhhtt__ssttaattss ();
│ │ │ │ │  This will cause a _d_h_t___s_t_a_t_s___a_l_e_r_t to be posted.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseett__ddhhtt__ssttaattee(()) **********
│ │ │ │ │ -void sseett__ddhhtt__ssttaattee (dht::dht_state&& st);
│ │ │ │ │  void sseett__ddhhtt__ssttaattee (dht::dht_state const& st);
│ │ │ │ │ +void sseett__ddhhtt__ssttaattee (dht::dht_state&& st);
│ │ │ │ │  set the DHT state for the _s_e_s_s_i_o_n. This will be taken into account the next
│ │ │ │ │  time the DHT is started, as if it had been passed in via the _s_e_s_s_i_o_n___p_a_r_a_m_s on
│ │ │ │ │  startup.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ggeett__ttoorrrreennttss(()) ffiinndd__ttoorrrreenntt(()) **********
│ │ │ │ │  torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const;
│ │ │ │ │  std::vector<torrent_handle> ggeett__ttoorrrreennttss () const;
│ │ │ │ │ @@ -408,20 +408,20 @@
│ │ │ │ │  such a torrent in the _s_e_s_s_i_o_n, a _t_o_r_r_e_n_t___h_a_n_d_l_e to that torrent is returned. In
│ │ │ │ │  case the torrent cannot be found, an invalid _t_o_r_r_e_n_t___h_a_n_d_l_e is returned.
│ │ │ │ │  See torrent_handle::is_valid() to know if the torrent was found or not.
│ │ │ │ │  get_torrents() returns a vector of torrent_handles to all the torrents
│ │ │ │ │  currently in the _s_e_s_s_i_o_n.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aassyynncc__aadddd__ttoorrrreenntt(()) aadddd__ttoorrrreenntt(()) **********
│ │ │ │ │ -torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params, error_code& ec);
│ │ │ │ │ -torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │  void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │  torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │ -torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params, error_code& ec);
│ │ │ │ │ +torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params, error_code& ec);
│ │ │ │ │  void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │ +torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │ +torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params, error_code& ec);
│ │ │ │ │  You add torrents through the _a_d_d___t_o_r_r_e_n_t_(_) function where you give an object
│ │ │ │ │  with all the parameters. The _a_d_d___t_o_r_r_e_n_t_(_) overloads will block until the
│ │ │ │ │  torrent has been added (or failed to be added) and returns an error code and a
│ │ │ │ │  _t_o_r_r_e_n_t___h_a_n_d_l_e. In order to add torrents more efficiently, consider using
│ │ │ │ │  _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_) which returns immediately, without waiting for the torrent
│ │ │ │ │  to add. Notification of the torrent being added is sent as _a_d_d___t_o_r_r_e_n_t___a_l_e_r_t.
│ │ │ │ │  The save_path field in _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s must be set to a valid path where the
│ │ │ │ │ @@ -442,15 +442,15 @@
│ │ │ │ │  torrent_flags::paused and torrent_flags::auto_managed. In order to add a magnet
│ │ │ │ │  link that will just download the metadata, but no payload, set the
│ │ │ │ │  torrent_flags::upload_mode flag.
│ │ │ │ │  Special consideration has to be taken when adding hybrid torrents (i.e.
│ │ │ │ │  torrents that are BitTorrent v2 torrents that are backwards compatible with
│ │ │ │ │  v1). For more details, see _B_i_t_T_o_r_r_e_n_t_ _v_2_ _t_o_r_r_e_n_t_s.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreessuummee(()) iiss__ppaauusseedd(()) ppaauussee(()) **********
│ │ │ │ │ +********** iiss__ppaauusseedd(()) ppaauussee(()) rreessuummee(()) **********
│ │ │ │ │  void rreessuummee ();
│ │ │ │ │  void ppaauussee ();
│ │ │ │ │  bool iiss__ppaauusseedd () const;
│ │ │ │ │  Pausing the _s_e_s_s_i_o_n has the same effect as pausing every torrent in it, except
│ │ │ │ │  that torrents will not be resumed by the auto-manage mechanism. Resuming will
│ │ │ │ │  restore the torrents to their previous paused state. i.e. the _s_e_s_s_i_o_n pause
│ │ │ │ │  state is separate from the torrent pause state. A torrent is inactive if it is
│ │ │ │ │ @@ -529,18 +529,18 @@
│ │ │ │ │  and make the function entirely self-contained. The only reason data blob's
│ │ │ │ │  value is computed via a function instead of just passing in the new value is to
│ │ │ │ │  avoid race conditions. If you want to uuppddaattee the value in the DHT, you must
│ │ │ │ │  first retrieve it, then modify it, then write it back. The way the DHT works,
│ │ │ │ │  it is natural to always do a lookup before storing and calling the callback in
│ │ │ │ │  between is convenient.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddhhtt__ggeett__ppeeeerrss(()) ddhhtt__aannnnoouunnccee(()) **********
│ │ │ │ │ +********** ddhhtt__aannnnoouunnccee(()) ddhhtt__ggeett__ppeeeerrss(()) **********
│ │ │ │ │ +void ddhhtt__ggeett__ppeeeerrss (sha1_hash const& info_hash);
│ │ │ │ │  void ddhhtt__aannnnoouunnccee (sha1_hash const& info_hash, int port = 0, dht::
│ │ │ │ │  announce_flags_t flags = {});
│ │ │ │ │ -void ddhhtt__ggeett__ppeeeerrss (sha1_hash const& info_hash);
│ │ │ │ │  dht_get_peers() will issue a DHT get_peer request to the DHT for the specified
│ │ │ │ │  info-hash. The response (the peers) will be posted back in a
│ │ │ │ │  _d_h_t___g_e_t___p_e_e_r_s___r_e_p_l_y___a_l_e_r_t.
│ │ │ │ │  dht_announce() will issue a DHT announce request to the DHT to the specified
│ │ │ │ │  info-hash, advertising the specified port. If the port is left at its default,
│ │ │ │ │  0, the port will be implied by the DHT message's source port (which may improve
│ │ │ │ │  connectivity through a NAT). dht_announce() is not affected by the
│ │ │ │ │ @@ -598,16 +598,16 @@
│ │ │ │ │        A _p_l_u_g_i_n that, with a small overhead, can ban peers that sends bad data
│ │ │ │ │        with very high accuracy. Should eliminate most problems on poisoned
│ │ │ │ │        torrents.
│ │ │ │ │  #include <libtorrent/extensions/smart_ban.hpp>
│ │ │ │ │  ses.add_extension(&lt::create_smart_ban_plugin);
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseett__iipp__ffiilltteerr(()) ggeett__iipp__ffiilltteerr(()) **********
│ │ │ │ │ -ip_filter ggeett__iipp__ffiilltteerr () const;
│ │ │ │ │  void sseett__iipp__ffiilltteerr (ip_filter f);
│ │ │ │ │ +ip_filter ggeett__iipp__ffiilltteerr () const;
│ │ │ │ │  Sets a filter that will be used to reject and accept incoming as well as
│ │ │ │ │  outgoing connections based on their originating ip address. The default filter
│ │ │ │ │  will allow connections to any ip address. To build a set of rules for which
│ │ │ │ │  addresses are accepted and not, see _i_p___f_i_l_t_e_r.
│ │ │ │ │  Each time a peer is blocked because of the IP filter, a _p_e_e_r___b_l_o_c_k_e_d___a_l_e_r_t is
│ │ │ │ │  generated. get_ip_filter() Returns the _i_p___f_i_l_t_e_r currently in the _s_e_s_s_i_o_n. See
│ │ │ │ │  _i_p___f_i_l_t_e_r.
│ │ │ │ │ @@ -616,17 +616,17 @@
│ │ │ │ │  void sseett__ppoorrtt__ffiilltteerr (port_filter const& f);
│ │ │ │ │  apply _p_o_r_t___f_i_l_t_e_r f to incoming and outgoing peers. a port filter will reject
│ │ │ │ │  making outgoing peer connections to certain remote ports. The main intention is
│ │ │ │ │  to be able to avoid triggering certain anti-virus software by connecting to
│ │ │ │ │  SMTP, FTP ports.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** iiss__lliisstteenniinngg(()) lliisstteenn__ppoorrtt(()) ssssll__lliisstteenn__ppoorrtt(()) **********
│ │ │ │ │ +bool iiss__lliisstteenniinngg () const;
│ │ │ │ │  unsigned short ssssll__lliisstteenn__ppoorrtt () const;
│ │ │ │ │  unsigned short lliisstteenn__ppoorrtt () const;
│ │ │ │ │ -bool iiss__lliisstteenniinngg () const;
│ │ │ │ │  is_listening() will tell you whether or not the _s_e_s_s_i_o_n has successfully opened
│ │ │ │ │  a listening port. If it hasn't, this function will return false, and then you
│ │ │ │ │  can set a new _s_e_t_t_i_n_g_s___p_a_c_k_:_:_l_i_s_t_e_n___i_n_t_e_r_f_a_c_e_s to try another interface and
│ │ │ │ │  port to bind to.
│ │ │ │ │  listen_port() returns the port we ended up listening on.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseett__ppeeeerr__ccllaassss__ffiilltteerr(()) ggeett__ppeeeerr__ccllaassss__ffiilltteerr(()) **********
│ │ │ │ │ @@ -653,16 +653,16 @@
│ │ │ │ │  removed from a peer as a result of this call, peer classes are only added.
│ │ │ │ │  The peer_class argument cannot be greater than 31. The bitmasks representing
│ │ │ │ │  peer classes in the peer_class_filter are 32 bits.
│ │ │ │ │  The get_peer_class_filter() function returns the current filter.
│ │ │ │ │  For more information, see _p_e_e_r_ _c_l_a_s_s_e_s.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr(()) ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr(()) **********
│ │ │ │ │ -void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f);
│ │ │ │ │  peer_class_type_filter ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr () const;
│ │ │ │ │ +void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f);
│ │ │ │ │  Sets and gets the ppeeeerr ccllaassss ttyyppee ffiilltteerr. This is controls automatic peer class
│ │ │ │ │  assignments to peers based on what kind of socket it is.
│ │ │ │ │  It does not only support assigning peer classes, it also supports removing peer
│ │ │ │ │  classes based on socket type.
│ │ │ │ │  The order of these rules being applied are:
│ │ │ │ │     1. peer-class IP filter
│ │ │ │ │     2. peer-class type filter, removing classes
│ │ │ │ │ @@ -731,25 +731,25 @@
│ │ │ │ │  Note that when a queued or downloading torrent is removed, its position in the
│ │ │ │ │  download queue is vacated and every subsequent torrent in the queue has their
│ │ │ │ │  queue positions updated. This can potentially cause a large state_update to be
│ │ │ │ │  posted. When removing all torrents, it is advised to remove them from the back
│ │ │ │ │  of the queue, to minimize the shifting.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ggeett__sseettttiinnggss(()) aappppllyy__sseettttiinnggss(()) **********
│ │ │ │ │ +settings_pack ggeett__sseettttiinnggss () const;
│ │ │ │ │  void aappppllyy__sseettttiinnggss (settings_pack const&);
│ │ │ │ │  void aappppllyy__sseettttiinnggss (settings_pack&&);
│ │ │ │ │ -settings_pack ggeett__sseettttiinnggss () const;
│ │ │ │ │  Applies the settings specified by the _s_e_t_t_i_n_g_s___p_a_c_k s. This is an asynchronous
│ │ │ │ │  operation that will return immediately and actually apply the settings to the
│ │ │ │ │  main thread of libtorrent some time later.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseett__aalleerrtt__nnoottiiffyy(()) ppoopp__aalleerrttss(()) wwaaiitt__ffoorr__aalleerrtt(()) **********
│ │ │ │ │ -void sseett__aalleerrtt__nnoottiiffyy (std::function<void()> const& fun);
│ │ │ │ │ -void ppoopp__aalleerrttss (std::vector<alert*>* alerts);
│ │ │ │ │  alert* wwaaiitt__ffoorr__aalleerrtt (time_duration max_wait);
│ │ │ │ │ +void ppoopp__aalleerrttss (std::vector<alert*>* alerts);
│ │ │ │ │ +void sseett__aalleerrtt__nnoottiiffyy (std::function<void()> const& fun);
│ │ │ │ │  Alerts is the main mechanism for libtorrent to report errors and events.
│ │ │ │ │  pop_alerts fills in the vector passed to it with pointers to new alerts. The
│ │ │ │ │  _s_e_s_s_i_o_n still owns these alerts and they will stay valid until the next time
│ │ │ │ │  pop_alerts is called. You may not delete the _a_l_e_r_t objects.
│ │ │ │ │  It is safe to call pop_alerts from multiple different threads, as long as the
│ │ │ │ │  alerts themselves are not accessed once another thread calls pop_alerts. Doing
│ │ │ │ │  this requires manual synchronization between the popping threads.
│ │ │ │ │ @@ -789,17 +789,17 @@
│ │ │ │ │  block. It should not perform any expensive work. It really should just notify
│ │ │ │ │  the main application thread.
│ │ │ │ │  The type of an _a_l_e_r_t is returned by the polymorphic function alert::type() but
│ │ │ │ │  can also be queries from a concrete type via T::alert_type, as a static
│ │ │ │ │  constant.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aadddd__ppoorrtt__mmaappppiinngg(()) ddeelleettee__ppoorrtt__mmaappppiinngg(()) **********
│ │ │ │ │ -void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle);
│ │ │ │ │  std::vector<port_mapping_t> aadddd__ppoorrtt__mmaappppiinngg (portmap_protocol t, int
│ │ │ │ │  external_port, int local_port);
│ │ │ │ │ +void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle);
│ │ │ │ │  add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP,
│ │ │ │ │  whichever is enabled. A mapping is created for each listen socket in the
│ │ │ │ │  _s_e_s_s_i_o_n. The return values are all handles referring to the port mappings that
│ │ │ │ │  were just created. Pass them to _d_e_l_e_t_e___p_o_r_t___m_a_p_p_i_n_g_(_) to remove them.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** rreeooppeenn__nneettwwoorrkk__ssoocckkeettss(()) **********
│ │ │ │ │  void rreeooppeenn__nneettwwoorrkk__ssoocckkeettss (reopen_network_flags_t options =
│ │ │ │ │ @@ -848,22 +848,22 @@
│ │ │ │ │        This option indicates if the ports are mapped using natpmp and upnp. If
│ │ │ │ │        mapping was already made, they are deleted and added again. This only
│ │ │ │ │        works if natpmp and/or upnp are configured to be enable.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ rreeaadd__sseessssiioonn__ppaarraammss(()) wwrriittee__sseessssiioonn__ppaarraammss__bbuuff(()) wwrriittee__sseessssiioonn__ppaarraammss(())
│ │ │ │ │  ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___p_a_r_a_m_s_._h_p_p"
│ │ │ │ │ -entry wwrriittee__sseessssiioonn__ppaarraammss (session_params const& sp
│ │ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ │  std::vector<char> wwrriittee__sseessssiioonn__ppaarraammss__bbuuff (session_params const& sp
│ │ │ │ │     , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ │ -session_params rreeaadd__sseessssiioonn__ppaarraammss (bdecode_node const& e
│ │ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ │  session_params rreeaadd__sseessssiioonn__ppaarraammss (span<char const> buf
│ │ │ │ │     , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ │ +entry wwrriittee__sseessssiioonn__ppaarraammss (session_params const& sp
│ │ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ │ +session_params rreeaadd__sseessssiioonn__ppaarraammss (bdecode_node const& e
│ │ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ │  These functions serialize and de-serialize a session_params object to and from
│ │ │ │ │  bencoded form. The _s_e_s_s_i_o_n___p_a_r_a_m_s object is used to initialize a new _s_e_s_s_i_o_n
│ │ │ │ │  using the state from a previous one (or by programmatically configure the
│ │ │ │ │  _s_e_s_s_i_o_n up-front). The flags parameter can be used to only save and load
│ │ │ │ │  certain aspects of the session's state. The _buf suffix indicates the function
│ │ │ │ │  operates on buffer rather than the bencoded structure. The torrents in a
│ │ │ │ │  _s_e_s_s_i_o_n are not part of the _s_e_s_s_i_o_n___p_a_r_a_m_s state, they have to be restored
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Settings.html
│ │ │ │ @@ -29,35 +29,35 @@
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │  <li><a class="reference internal" href="#settings-pack" id="toc-entry-1">settings_pack</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#set-int-set-bool-set-str" id="toc-entry-2">set_int() set_bool() set_str()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-bool-set-int-set-str" id="toc-entry-2">set_bool() set_int() set_str()</a></li>
│ │ │ │  <li><a class="reference internal" href="#has-val" id="toc-entry-3">has_val()</a></li>
│ │ │ │  <li><a class="reference internal" href="#clear" id="toc-entry-4">clear()</a></li>
│ │ │ │  <li><a class="reference internal" href="#clear-1" id="toc-entry-5">clear()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-int-get-str-get-bool" id="toc-entry-6">get_int() get_str() get_bool()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-bool-get-str-get-int" id="toc-entry-6">get_bool() get_str() get_int()</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-type-bases" id="toc-entry-7">enum type_bases</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-mmap-write-mode-t" id="toc-entry-8">enum mmap_write_mode_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-suggest-mode-t" id="toc-entry-9">enum suggest_mode_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-choking-algorithm-t" id="toc-entry-10">enum choking_algorithm_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-seed-choking-algorithm-t" id="toc-entry-11">enum seed_choking_algorithm_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-io-buffer-mode-t" id="toc-entry-12">enum io_buffer_mode_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-bandwidth-mixed-algo-t" id="toc-entry-13">enum bandwidth_mixed_algo_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-enc-policy" id="toc-entry-14">enum enc_policy</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-enc-level" id="toc-entry-15">enum enc_level</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-proxy-type-t" id="toc-entry-16">enum proxy_type_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#min-memory-usage-high-performance-seed" id="toc-entry-17">min_memory_usage() high_performance_seed()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#generate-fingerprint" id="toc-entry-18">generate_fingerprint()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#setting-by-name-name-for-setting" id="toc-entry-19">setting_by_name() name_for_setting()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#default-settings" id="toc-entry-20">default_settings()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#setting-by-name-name-for-setting" id="toc-entry-17">setting_by_name() name_for_setting()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#default-settings" id="toc-entry-18">default_settings()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#high-performance-seed-min-memory-usage" id="toc-entry-19">high_performance_seed() min_memory_usage()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#generate-fingerprint" id="toc-entry-20">generate_fingerprint()</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │  <p>You have some control over <a class="reference external" href="reference-Session.html#session">session</a> configuration through the session::apply_settings()
│ │ │ │  member function. To change one or more configuration options, create a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>
│ │ │ │  object and fill it with the settings to be set and pass it in to session::apply_settings().</p>
│ │ │ │  <p>The <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> object is a collection of settings updates that are applied
│ │ │ │  to the <a class="reference external" href="reference-Session.html#session">session</a> when passed to session::apply_settings(). It's empty when
│ │ │ │ @@ -4598,18 +4598,18 @@
│ │ │ │  </div>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct settings_pack final : settings_interface
│ │ │ │  {
│ │ │ │     friend  void <strong>apply_pack_impl</strong> (settings_pack const*
│ │ │ │        , aux::session_settings_single_thread&amp;
│ │ │ │        , std::vector&lt;void(aux::session_impl::*)()&gt;*);
│ │ │ │ -   void <strong>set_int</strong> (int name, int val) override;
│ │ │ │     void <strong>set_str</strong> (int name, std::string val) override;
│ │ │ │ -   void <strong>set_int</strong> (int name, flags::bitfield_flag&lt;Type, Tag&gt; const val);
│ │ │ │     void <strong>set_bool</strong> (int name, bool val) override;
│ │ │ │ +   void <strong>set_int</strong> (int name, flags::bitfield_flag&lt;Type, Tag&gt; const val);
│ │ │ │ +   void <strong>set_int</strong> (int name, int val) override;
│ │ │ │     bool <strong>has_val</strong> (int name) const override;
│ │ │ │     void <strong>clear</strong> ();
│ │ │ │     void <strong>clear</strong> (int name);
│ │ │ │     int <strong>get_int</strong> (int name) const override;
│ │ │ │     std::string const&amp; <strong>get_str</strong> (int name) const override;
│ │ │ │     bool <strong>get_bool</strong> (int name) const override;
│ │ │ │     void <strong>for_each</strong> (Fun&amp;&amp; f) const;
│ │ │ │ @@ -4685,23 +4685,23 @@
│ │ │ │        socks5,
│ │ │ │        socks5_pw,
│ │ │ │        http,
│ │ │ │        http_pw,
│ │ │ │     };
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="set_int()"></a>
│ │ │ │  <a name="set_bool()"></a>
│ │ │ │ -<a name="set_str()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bset_int%28%29+set_bool%28%29+set_str%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bset_int%28%29+set_bool%28%29+set_str%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="set-int-set-bool-set-str">
│ │ │ │ -<h2>set_int() set_bool() set_str()</h2>
│ │ │ │ +<a name="set_int()"></a>
│ │ │ │ +<a name="set_str()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bset_bool%28%29+set_int%28%29+set_str%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bset_bool%28%29+set_int%28%29+set_str%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="set-bool-set-int-set-str">
│ │ │ │ +<h2>set_bool() set_int() set_str()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_int</strong> (int name, int val) override;
│ │ │ │  void <strong>set_str</strong> (int name, std::string val) override;
│ │ │ │ -void <strong>set_int</strong> (int name, flags::bitfield_flag&lt;Type, Tag&gt; const val);
│ │ │ │  void <strong>set_bool</strong> (int name, bool val) override;
│ │ │ │ +void <strong>set_int</strong> (int name, flags::bitfield_flag&lt;Type, Tag&gt; const val);
│ │ │ │ +void <strong>set_int</strong> (int name, int val) override;
│ │ │ │  </pre>
│ │ │ │  <p>set a configuration option in the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>. <tt class="docutils literal">name</tt> is one of
│ │ │ │  the enum values from string_types, int_types or bool_types. They must
│ │ │ │  match the respective type of the set_* function.</p>
│ │ │ │  <a name="has_val()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bhas_val%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bhas_val%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="has-val">
│ │ │ │  <h2>has_val()</h2>
│ │ │ │ @@ -4721,19 +4721,19 @@
│ │ │ │  <a name="clear()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bclear%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bclear%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="clear-1">
│ │ │ │  <h2>clear()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>clear</strong> (int name);
│ │ │ │  </pre>
│ │ │ │  <p>clear a specific setting from the pack</p>
│ │ │ │ -<a name="get_int()"></a>
│ │ │ │ +<a name="get_bool()"></a>
│ │ │ │  <a name="get_str()"></a>
│ │ │ │ -<a name="get_bool()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bget_int%28%29+get_str%28%29+get_bool%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bget_int%28%29+get_str%28%29+get_bool%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-int-get-str-get-bool">
│ │ │ │ -<h2>get_int() get_str() get_bool()</h2>
│ │ │ │ +<a name="get_int()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bget_bool%28%29+get_str%28%29+get_int%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bget_bool%28%29+get_str%28%29+get_int%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-bool-get-str-get-int">
│ │ │ │ +<h2>get_bool() get_str() get_int()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  int <strong>get_int</strong> (int name) const override;
│ │ │ │  std::string const&amp; <strong>get_str</strong> (int name) const override;
│ │ │ │  bool <strong>get_bool</strong> (int name) const override;
│ │ │ │  </pre>
│ │ │ │  <p>queries the current configuration option from the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>.
│ │ │ │  <tt class="docutils literal">name</tt> is one of the enumeration values from string_types, int_types
│ │ │ │ @@ -5096,19 +5096,38 @@
│ │ │ │  <tr><td>http_pw</td>
│ │ │ │  <td>5</td>
│ │ │ │  <td>The server is assumed to be an HTTP proxy that requires user
│ │ │ │  authorization. The username and password will be sent to the proxy.</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="min_memory_usage()"></a>
│ │ │ │ -<a name="high_performance_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:min_memory_usage%28%29+high_performance_seed%28%29&labels=documentation&body=Documentation+under+heading+%22min_memory_usage%28%29+high_performance_seed%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<a name="setting_by_name()"></a>
│ │ │ │ +<a name="name_for_setting()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:setting_by_name%28%29+name_for_setting%28%29&labels=documentation&body=Documentation+under+heading+%22setting_by_name%28%29+name_for_setting%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │ -<div class="section" id="min-memory-usage-high-performance-seed">
│ │ │ │ -<h1>min_memory_usage() high_performance_seed()</h1>
│ │ │ │ +<div class="section" id="setting-by-name-name-for-setting">
│ │ │ │ +<h1>setting_by_name() name_for_setting()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>name_for_setting</strong> (int s);
│ │ │ │ +int <strong>setting_by_name</strong> (string_view name);
│ │ │ │ +</pre>
│ │ │ │ +<p>converts a setting integer (from the enums string_types, int_types or
│ │ │ │ +bool_types) to a string, and vice versa.</p>
│ │ │ │ +<a name="default_settings()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:default_settings%28%29&labels=documentation&body=Documentation+under+heading+%22default_settings%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="default-settings">
│ │ │ │ +<h1>default_settings()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +settings_pack <strong>default_settings</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> with every setting set to its default value</p>
│ │ │ │ +<a name="high_performance_seed()"></a>
│ │ │ │ +<a name="min_memory_usage()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:high_performance_seed%28%29+min_memory_usage%28%29&labels=documentation&body=Documentation+under+heading+%22high_performance_seed%28%29+min_memory_usage%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="high-performance-seed-min-memory-usage">
│ │ │ │ +<h1>high_performance_seed() min_memory_usage()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/session.hpp">libtorrent/session.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  settings_pack <strong>high_performance_seed</strong> ();
│ │ │ │  settings_pack <strong>min_memory_usage</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
│ │ │ │ @@ -5183,33 +5202,14 @@
│ │ │ │  <td>Tribler</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p>There's an informal directory of client id's <a class="reference external" href="http://wiki.theory.org/BitTorrentSpecification#peer_id">here</a>.</p>
│ │ │ │  <p>The <tt class="docutils literal">major</tt>, <tt class="docutils literal">minor</tt>, <tt class="docutils literal">revision</tt> and <tt class="docutils literal">tag</tt> parameters are used to
│ │ │ │  identify the version of your client.</p>
│ │ │ │ -<a name="setting_by_name()"></a>
│ │ │ │ -<a name="name_for_setting()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:setting_by_name%28%29+name_for_setting%28%29&labels=documentation&body=Documentation+under+heading+%22setting_by_name%28%29+name_for_setting%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="setting-by-name-name-for-setting">
│ │ │ │ -<h1>setting_by_name() name_for_setting()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>setting_by_name</strong> (string_view name);
│ │ │ │ -char const* <strong>name_for_setting</strong> (int s);
│ │ │ │ -</pre>
│ │ │ │ -<p>converts a setting integer (from the enums string_types, int_types or
│ │ │ │ -bool_types) to a string, and vice versa.</p>
│ │ │ │ -<a name="default_settings()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:default_settings%28%29&labels=documentation&body=Documentation+under+heading+%22default_settings%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="default-settings">
│ │ │ │ -<h1>default_settings()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -settings_pack <strong>default_settings</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> with every setting set to its default value</p>
│ │ │ │  </div>
│ │ │ │  
│ │ │ │      </div>
│ │ │ │      </div>
│ │ │ │      <div id="gradient"></div>
│ │ │ │      <div id="filler">
│ │ │ │      <div id="footer">
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,32 +1,32 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │      * _s_e_t_t_i_n_g_s___p_a_c_k
│ │ │ │ │ -          o _s_e_t___i_n_t_(_)_ _s_e_t___b_o_o_l_(_)_ _s_e_t___s_t_r_(_)
│ │ │ │ │ +          o _s_e_t___b_o_o_l_(_)_ _s_e_t___i_n_t_(_)_ _s_e_t___s_t_r_(_)
│ │ │ │ │            o _h_a_s___v_a_l_(_)
│ │ │ │ │            o _c_l_e_a_r_(_)
│ │ │ │ │            o _c_l_e_a_r_(_)
│ │ │ │ │ -          o _g_e_t___i_n_t_(_)_ _g_e_t___s_t_r_(_)_ _g_e_t___b_o_o_l_(_)
│ │ │ │ │ +          o _g_e_t___b_o_o_l_(_)_ _g_e_t___s_t_r_(_)_ _g_e_t___i_n_t_(_)
│ │ │ │ │            o _e_n_u_m_ _t_y_p_e___b_a_s_e_s
│ │ │ │ │            o _e_n_u_m_ _m_m_a_p___w_r_i_t_e___m_o_d_e___t
│ │ │ │ │            o _e_n_u_m_ _s_u_g_g_e_s_t___m_o_d_e___t
│ │ │ │ │            o _e_n_u_m_ _c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m___t
│ │ │ │ │            o _e_n_u_m_ _s_e_e_d___c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m___t
│ │ │ │ │            o _e_n_u_m_ _i_o___b_u_f_f_e_r___m_o_d_e___t
│ │ │ │ │            o _e_n_u_m_ _b_a_n_d_w_i_d_t_h___m_i_x_e_d___a_l_g_o___t
│ │ │ │ │            o _e_n_u_m_ _e_n_c___p_o_l_i_c_y
│ │ │ │ │            o _e_n_u_m_ _e_n_c___l_e_v_e_l
│ │ │ │ │            o _e_n_u_m_ _p_r_o_x_y___t_y_p_e___t
│ │ │ │ │ -    * _m_i_n___m_e_m_o_r_y___u_s_a_g_e_(_)_ _h_i_g_h___p_e_r_f_o_r_m_a_n_c_e___s_e_e_d_(_)
│ │ │ │ │ -    * _g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_t_(_)
│ │ │ │ │      * _s_e_t_t_i_n_g___b_y___n_a_m_e_(_)_ _n_a_m_e___f_o_r___s_e_t_t_i_n_g_(_)
│ │ │ │ │      * _d_e_f_a_u_l_t___s_e_t_t_i_n_g_s_(_)
│ │ │ │ │ +    * _h_i_g_h___p_e_r_f_o_r_m_a_n_c_e___s_e_e_d_(_)_ _m_i_n___m_e_m_o_r_y___u_s_a_g_e_(_)
│ │ │ │ │ +    * _g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_t_(_)
│ │ │ │ │  You have some control over _s_e_s_s_i_o_n configuration through the session::
│ │ │ │ │  apply_settings() member function. To change one or more configuration options,
│ │ │ │ │  create a _s_e_t_t_i_n_g_s___p_a_c_k object and fill it with the settings to be set and pass
│ │ │ │ │  it in to session::apply_settings().
│ │ │ │ │  The _s_e_t_t_i_n_g_s___p_a_c_k object is a collection of settings updates that are applied
│ │ │ │ │  to the _s_e_s_s_i_o_n when passed to session::apply_settings(). It's empty when
│ │ │ │ │  constructed.
│ │ │ │ │ @@ -1435,18 +1435,18 @@
│ │ │ │ │  connect to the external NAT-PMP port (configured using announce_port) instead
│ │ │ │ │  of the actual local listening port.
│ │ │ │ │  struct settings_pack final : settings_interface
│ │ │ │ │  {
│ │ │ │ │     friend  void aappppllyy__ppaacckk__iimmppll (settings_pack const*
│ │ │ │ │        , aux::session_settings_single_thread&
│ │ │ │ │        , std::vector<void(aux::session_impl::*)()>*);
│ │ │ │ │ -   void sseett__iinntt (int name, int val) override;
│ │ │ │ │     void sseett__ssttrr (int name, std::string val) override;
│ │ │ │ │ -   void sseett__iinntt (int name, flags::bitfield_flag<Type, Tag> const val);
│ │ │ │ │     void sseett__bbooooll (int name, bool val) override;
│ │ │ │ │ +   void sseett__iinntt (int name, flags::bitfield_flag<Type, Tag> const val);
│ │ │ │ │ +   void sseett__iinntt (int name, int val) override;
│ │ │ │ │     bool hhaass__vvaall (int name) const override;
│ │ │ │ │     void cclleeaarr ();
│ │ │ │ │     void cclleeaarr (int name);
│ │ │ │ │     int ggeett__iinntt (int name) const override;
│ │ │ │ │     std::string const& ggeett__ssttrr (int name) const override;
│ │ │ │ │     bool ggeett__bbooooll (int name) const override;
│ │ │ │ │     void ffoorr__eeaacchh (Fun&& f) const;
│ │ │ │ │ @@ -1522,19 +1522,19 @@
│ │ │ │ │        socks5,
│ │ │ │ │        socks5_pw,
│ │ │ │ │        http,
│ │ │ │ │        http_pw,
│ │ │ │ │     };
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__iinntt(()) sseett__bbooooll(()) sseett__ssttrr(()) **********
│ │ │ │ │ -void sseett__iinntt (int name, int val) override;
│ │ │ │ │ +********** sseett__bbooooll(()) sseett__iinntt(()) sseett__ssttrr(()) **********
│ │ │ │ │  void sseett__ssttrr (int name, std::string val) override;
│ │ │ │ │ -void sseett__iinntt (int name, flags::bitfield_flag<Type, Tag> const val);
│ │ │ │ │  void sseett__bbooooll (int name, bool val) override;
│ │ │ │ │ +void sseett__iinntt (int name, flags::bitfield_flag<Type, Tag> const val);
│ │ │ │ │ +void sseett__iinntt (int name, int val) override;
│ │ │ │ │  set a configuration option in the _s_e_t_t_i_n_g_s___p_a_c_k. name is one of the enum values
│ │ │ │ │  from string_types, int_types or bool_types. They must match the respective type
│ │ │ │ │  of the set_* function.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** hhaass__vvaall(()) **********
│ │ │ │ │  bool hhaass__vvaall (int name) const override;
│ │ │ │ │  queries whether the specified configuration option has a value set in this
│ │ │ │ │ @@ -1545,15 +1545,15 @@
│ │ │ │ │  void cclleeaarr ();
│ │ │ │ │  clear the settings pack from all settings
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** cclleeaarr(()) **********
│ │ │ │ │  void cclleeaarr (int name);
│ │ │ │ │  clear a specific setting from the pack
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett__iinntt(()) ggeett__ssttrr(()) ggeett__bbooooll(()) **********
│ │ │ │ │ +********** ggeett__bbooooll(()) ggeett__ssttrr(()) ggeett__iinntt(()) **********
│ │ │ │ │  int ggeett__iinntt (int name) const override;
│ │ │ │ │  std::string const& ggeett__ssttrr (int name) const override;
│ │ │ │ │  bool ggeett__bbooooll (int name) const override;
│ │ │ │ │  queries the current configuration option from the _s_e_t_t_i_n_g_s___p_a_c_k. name is one of
│ │ │ │ │  the enumeration values from string_types, int_types or bool_types. The enum
│ │ │ │ │  value must match the type of the get_* function. If the specified setting field
│ │ │ │ │  has not been set, the default value is returned.
│ │ │ │ │ @@ -1683,15 +1683,27 @@
│ │ │ │ │  |         |     |trackers, a plain proxy will suffice. The proxy is assumed to|
│ │ │ │ │  |         |     |not require authorization. The username and password will not|
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_e_ _u_s_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |         |     |The server is assumed to be an HTTP proxy that requires user |
│ │ │ │ │  |http_pw  |5    |authorization. The username and password will be sent to the |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_r_o_x_y_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ mmiinn__mmeemmoorryy__uussaaggee(()) hhiigghh__ppeerrffoorrmmaannccee__sseeeedd(()) ************
│ │ │ │ │ +************ sseettttiinngg__bbyy__nnaammee(()) nnaammee__ffoorr__sseettttiinngg(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ +char const* nnaammee__ffoorr__sseettttiinngg (int s);
│ │ │ │ │ +int sseettttiinngg__bbyy__nnaammee (string_view name);
│ │ │ │ │ +converts a setting integer (from the enums string_types, int_types or
│ │ │ │ │ +bool_types) to a string, and vice versa.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ddeeffaauulltt__sseettttiinnggss(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ +settings_pack ddeeffaauulltt__sseettttiinnggss ();
│ │ │ │ │ +returns a _s_e_t_t_i_n_g_s___p_a_c_k with every setting set to its default value
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ hhiigghh__ppeerrffoorrmmaannccee__sseeeedd(()) mmiinn__mmeemmoorryy__uussaaggee(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n_._h_p_p"
│ │ │ │ │  settings_pack hhiigghh__ppeerrffoorrmmaannccee__sseeeedd ();
│ │ │ │ │  settings_pack mmiinn__mmeemmoorryy__uussaaggee ();
│ │ │ │ │  The default values of the _s_e_s_s_i_o_n settings are set for a regular bittorrent
│ │ │ │ │  client running on a desktop system. There are functions that can set the
│ │ │ │ │  _s_e_s_s_i_o_n settings to pre set settings for other environments. These can be used
│ │ │ │ │  for the basis, and should be tweaked to fit your needs better.
│ │ │ │ │ @@ -1731,26 +1743,14 @@
│ │ │ │ │  |_B_T_ _ _ _ _ _ _|_B_i_t_T_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_D_E_ _ _ _ _ _ _|_D_e_l_u_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_A_Z_ _ _ _ _ _ _|_A_z_u_r_e_u_s_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_T_L_ _ _ _ _ _ _|_T_r_i_b_l_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  There's an informal directory of client id's _h_e_r_e.
│ │ │ │ │  The major, minor, revision and tag parameters are used to identify the version
│ │ │ │ │  of your client.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ sseettttiinngg__bbyy__nnaammee(()) nnaammee__ffoorr__sseettttiinngg(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ -int sseettttiinngg__bbyy__nnaammee (string_view name);
│ │ │ │ │ -char const* nnaammee__ffoorr__sseettttiinngg (int s);
│ │ │ │ │ -converts a setting integer (from the enums string_types, int_types or
│ │ │ │ │ -bool_types) to a string, and vice versa.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddeeffaauulltt__sseettttiinnggss(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ -settings_pack ddeeffaauulltt__sseettttiinnggss ();
│ │ │ │ │ -returns a _s_e_t_t_i_n_g_s___p_a_c_k with every setting set to its default value
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  _b_l_o_g
│ │ │ │ │  _u_T_P
│ │ │ │ │  _d_o_w_n_l_o_a_d
│ │ │ │ │  _d_o_c_u_m_e_n_t_a_t_i_o_n
│ │ │ │ │  _D_H_T_ _p_u_t_ _e_x_t_e_n_s_i_o_n
│ │ │ │ │  _p_y_t_h_o_n_ _b_i_n_d_i_n_g_s
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Stats.html
│ │ │ │ @@ -28,25 +28,50 @@
│ │ │ │  <td>2.0.11</td></tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │ -<li><a class="reference internal" href="#stats-metric" id="toc-entry-1">stats_metric</a></li>
│ │ │ │ -<li><a class="reference internal" href="#counters" id="toc-entry-2">counters</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#inc-stats-counter-operator" id="toc-entry-3">inc_stats_counter() operator[]()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#counters" id="toc-entry-1">counters</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#operator-inc-stats-counter" id="toc-entry-2">operator[]() inc_stats_counter()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ +<li><a class="reference internal" href="#stats-metric" id="toc-entry-3">stats_metric</a></li>
│ │ │ │  <li><a class="reference internal" href="#session-stats-metrics" id="toc-entry-4">session_stats_metrics()</a></li>
│ │ │ │  <li><a class="reference internal" href="#find-metric-idx" id="toc-entry-5">find_metric_idx()</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-metric-type-t" id="toc-entry-6">enum metric_type_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │ -<a name="stats_metric"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+stats_metric&labels=documentation&body=Documentation+under+heading+%22class+stats_metric%22+could+be+improved">report issue</a>]</span><div class="section" id="stats-metric">
│ │ │ │ +<a name="counters"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+counters&labels=documentation&body=Documentation+under+heading+%22class+counters%22+could+be+improved">report issue</a>]</span><div class="section" id="counters">
│ │ │ │ +<h1>counters</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/performance_counters.hpp">libtorrent/performance_counters.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct counters
│ │ │ │ +{
│ │ │ │ +   <strong>counters</strong> () ;
│ │ │ │ +   <strong>counters</strong> (counters const&amp;) ;
│ │ │ │ +   counters&amp; <strong>operator=</strong> (counters const&amp;) &amp; ;
│ │ │ │ +   std::int64_t <strong>inc_stats_counter</strong> (int c, std::int64_t value = 1) ;
│ │ │ │ +   std::int64_t <strong>operator[]</strong> (int i) const ;
│ │ │ │ +   void <strong>blend_stats_counter</strong> (int c, std::int64_t value, int ratio) ;
│ │ │ │ +   void <strong>set_value</strong> (int c, std::int64_t value) ;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="operator[]()"></a>
│ │ │ │ +<a name="inc_stats_counter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:counters%3A%3A%5Boperator%5B%5D%28%29+inc_stats_counter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22counters%3A%3A%5Boperator%5B%5D%28%29+inc_stats_counter%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-inc-stats-counter">
│ │ │ │ +<h2>operator[]() inc_stats_counter()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::int64_t <strong>inc_stats_counter</strong> (int c, std::int64_t value = 1) ;
│ │ │ │ +std::int64_t <strong>operator[]</strong> (int i) const ;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the new value</p>
│ │ │ │ +<a name="stats_metric"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+stats_metric&labels=documentation&body=Documentation+under+heading+%22class+stats_metric%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="stats-metric">
│ │ │ │  <h1>stats_metric</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_stats.hpp">libtorrent/session_stats.hpp</a>&quot;</p>
│ │ │ │  <p>describes one statistics metric from the <a class="reference external" href="reference-Session.html#session">session</a>. For more information,
│ │ │ │  see the <a class="reference external" href="manual-ref.html#session-statistics">session statistics</a> section.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct stats_metric
│ │ │ │  {
│ │ │ │ @@ -62,40 +87,15 @@
│ │ │ │  <a name="value_index"></a>
│ │ │ │  <a name="type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:stats_metric%3A%3A%5Bvalue_index+type%5D&labels=documentation&body=Documentation+under+heading+%22stats_metric%3A%3A%5Bvalue_index+type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>value_index type</dt>
│ │ │ │  <dd>the index into the <a class="reference external" href="reference-Session.html#session">session</a> stats array, where the underlying value of
│ │ │ │  this counter or gauge is found. The <a class="reference external" href="reference-Session.html#session">session</a> stats array is part of the
│ │ │ │  <a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a> object.</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="counters"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+counters&labels=documentation&body=Documentation+under+heading+%22class+counters%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="counters">
│ │ │ │ -<h1>counters</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/performance_counters.hpp">libtorrent/performance_counters.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct counters
│ │ │ │ -{
│ │ │ │ -   <strong>counters</strong> () ;
│ │ │ │ -   <strong>counters</strong> (counters const&amp;) ;
│ │ │ │ -   counters&amp; <strong>operator=</strong> (counters const&amp;) &amp; ;
│ │ │ │ -   std::int64_t <strong>operator[]</strong> (int i) const ;
│ │ │ │ -   std::int64_t <strong>inc_stats_counter</strong> (int c, std::int64_t value = 1) ;
│ │ │ │ -   void <strong>blend_stats_counter</strong> (int c, std::int64_t value, int ratio) ;
│ │ │ │ -   void <strong>set_value</strong> (int c, std::int64_t value) ;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="inc_stats_counter()"></a>
│ │ │ │ -<a name="operator[]()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:counters%3A%3A%5Binc_stats_counter%28%29+operator%5B%5D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22counters%3A%3A%5Binc_stats_counter%28%29+operator%5B%5D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="inc-stats-counter-operator">
│ │ │ │ -<h2>inc_stats_counter() operator[]()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::int64_t <strong>operator[]</strong> (int i) const ;
│ │ │ │ -std::int64_t <strong>inc_stats_counter</strong> (int c, std::int64_t value = 1) ;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the new value</p>
│ │ │ │  <a name="session_stats_metrics()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_stats_metrics%28%29&labels=documentation&body=Documentation+under+heading+%22session_stats_metrics%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │  <div class="section" id="session-stats-metrics">
│ │ │ │  <h1>session_stats_metrics()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_stats.hpp">libtorrent/session_stats.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::vector&lt;stats_metric&gt; <strong>session_stats_metrics</strong> ();
│ │ │ │  </pre>
│ │ │ │  <p>This free function returns the list of available metrics exposed by
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,19 +1,37 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │ -    * _s_t_a_t_s___m_e_t_r_i_c
│ │ │ │ │      * _c_o_u_n_t_e_r_s
│ │ │ │ │ -          o _i_n_c___s_t_a_t_s___c_o_u_n_t_e_r_(_)_ _o_p_e_r_a_t_o_r_[_]_(_)
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_[_]_(_)_ _i_n_c___s_t_a_t_s___c_o_u_n_t_e_r_(_)
│ │ │ │ │ +    * _s_t_a_t_s___m_e_t_r_i_c
│ │ │ │ │      * _s_e_s_s_i_o_n___s_t_a_t_s___m_e_t_r_i_c_s_(_)
│ │ │ │ │      * _f_i_n_d___m_e_t_r_i_c___i_d_x_(_)
│ │ │ │ │      * _e_n_u_m_ _m_e_t_r_i_c___t_y_p_e___t
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ccoouunntteerrss ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._h_p_p"
│ │ │ │ │ +struct counters
│ │ │ │ │ +{
│ │ │ │ │ +   ccoouunntteerrss () ;
│ │ │ │ │ +   ccoouunntteerrss (counters const&) ;
│ │ │ │ │ +   counters& ooppeerraattoorr== (counters const&) & ;
│ │ │ │ │ +   std::int64_t iinncc__ssttaattss__ccoouunntteerr (int c, std::int64_t value = 1) ;
│ │ │ │ │ +   std::int64_t ooppeerraattoorr[[]] (int i) const ;
│ │ │ │ │ +   void bblleenndd__ssttaattss__ccoouunntteerr (int c, std::int64_t value, int ratio) ;
│ │ │ │ │ +   void sseett__vvaalluuee (int c, std::int64_t value) ;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ooppeerraattoorr[[]](()) iinncc__ssttaattss__ccoouunntteerr(()) **********
│ │ │ │ │ +std::int64_t iinncc__ssttaattss__ccoouunntteerr (int c, std::int64_t value = 1) ;
│ │ │ │ │ +std::int64_t ooppeerraattoorr[[]] (int i) const ;
│ │ │ │ │ +returns the new value
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ssttaattss__mmeettrriicc ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___s_t_a_t_s_._h_p_p"
│ │ │ │ │  describes one statistics metric from the _s_e_s_s_i_o_n. For more information, see the
│ │ │ │ │  _s_e_s_s_i_o_n_ _s_t_a_t_i_s_t_i_c_s section.
│ │ │ │ │  struct stats_metric
│ │ │ │ │  {
│ │ │ │ │     char const* name;
│ │ │ │ │ @@ -25,32 +43,14 @@
│ │ │ │ │        the name of the counter or gauge
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    value_index type
│ │ │ │ │        the index into the _s_e_s_s_i_o_n stats array, where the underlying value of
│ │ │ │ │        this counter or gauge is found. The _s_e_s_s_i_o_n stats array is part of the
│ │ │ │ │        _s_e_s_s_i_o_n___s_t_a_t_s___a_l_e_r_t object.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ccoouunntteerrss ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._h_p_p"
│ │ │ │ │ -struct counters
│ │ │ │ │ -{
│ │ │ │ │ -   ccoouunntteerrss () ;
│ │ │ │ │ -   ccoouunntteerrss (counters const&) ;
│ │ │ │ │ -   counters& ooppeerraattoorr== (counters const&) & ;
│ │ │ │ │ -   std::int64_t ooppeerraattoorr[[]] (int i) const ;
│ │ │ │ │ -   std::int64_t iinncc__ssttaattss__ccoouunntteerr (int c, std::int64_t value = 1) ;
│ │ │ │ │ -   void bblleenndd__ssttaattss__ccoouunntteerr (int c, std::int64_t value, int ratio) ;
│ │ │ │ │ -   void sseett__vvaalluuee (int c, std::int64_t value) ;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iinncc__ssttaattss__ccoouunntteerr(()) ooppeerraattoorr[[]](()) **********
│ │ │ │ │ -std::int64_t ooppeerraattoorr[[]] (int i) const ;
│ │ │ │ │ -std::int64_t iinncc__ssttaattss__ccoouunntteerr (int c, std::int64_t value = 1) ;
│ │ │ │ │ -returns the new value
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ sseessssiioonn__ssttaattss__mmeettrriiccss(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___s_t_a_t_s_._h_p_p"
│ │ │ │ │  std::vector<stats_metric> sseessssiioonn__ssttaattss__mmeettrriiccss ();
│ │ │ │ │  This free function returns the list of available metrics exposed by
│ │ │ │ │  libtorrent's statistics API. Each metric has a name and a vvaalluuee iinnddeexx. The
│ │ │ │ │  value index is the index into the array in _s_e_s_s_i_o_n___s_t_a_t_s___a_l_e_r_t where this
│ │ │ │ │  metric's value can be found when the _s_e_s_s_i_o_n stats is sampled (by calling
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Storage.html
│ │ │ │ @@ -45,40 +45,40 @@
│ │ │ │  <li><a class="reference internal" href="#end-file" id="toc-entry-11">end_file()</a></li>
│ │ │ │  <li><a class="reference internal" href="#file-range" id="toc-entry-12">file_range()</a></li>
│ │ │ │  <li><a class="reference internal" href="#total-size" id="toc-entry-13">total_size()</a></li>
│ │ │ │  <li><a class="reference internal" href="#num-pieces-set-num-pieces" id="toc-entry-14">num_pieces() set_num_pieces()</a></li>
│ │ │ │  <li><a class="reference internal" href="#end-piece" id="toc-entry-15">end_piece()</a></li>
│ │ │ │  <li><a class="reference internal" href="#last-piece" id="toc-entry-16">last_piece()</a></li>
│ │ │ │  <li><a class="reference internal" href="#piece-range" id="toc-entry-17">piece_range()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-piece-length-piece-length" id="toc-entry-18">set_piece_length() piece_length()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-length-set-piece-length" id="toc-entry-18">piece_length() set_piece_length()</a></li>
│ │ │ │  <li><a class="reference internal" href="#piece-size" id="toc-entry-19">piece_size()</a></li>
│ │ │ │  <li><a class="reference internal" href="#piece-size2" id="toc-entry-20">piece_size2()</a></li>
│ │ │ │  <li><a class="reference internal" href="#blocks-in-piece2" id="toc-entry-21">blocks_in_piece2()</a></li>
│ │ │ │  <li><a class="reference internal" href="#blocks-per-piece" id="toc-entry-22">blocks_per_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-name-name" id="toc-entry-23">set_name() name()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#name-set-name" id="toc-entry-23">name() set_name()</a></li>
│ │ │ │  <li><a class="reference internal" href="#swap" id="toc-entry-24">swap()</a></li>
│ │ │ │  <li><a class="reference internal" href="#canonicalize" id="toc-entry-25">canonicalize()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-size-hash-root-file-offset-pad-file-at-file-path-file-name-symlink-root-ptr-mtime" id="toc-entry-26">file_size() hash() root() file_offset() pad_file_at() file_path() file_name() symlink() root_ptr() mtime()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-num-pieces-file-num-blocks-file-piece-range" id="toc-entry-27">file_num_pieces() file_num_blocks() file_piece_range()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-first-piece-node-file-first-block-node" id="toc-entry-28">file_first_piece_node() file_first_block_node()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-path-pad-file-at-hash-symlink-file-name-root-root-ptr-file-size-mtime-file-offset" id="toc-entry-26">file_path() pad_file_at() hash() symlink() file_name() root() root_ptr() file_size() mtime() file_offset()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-num-blocks-file-piece-range-file-num-pieces" id="toc-entry-27">file_num_blocks() file_piece_range() file_num_pieces()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-first-block-node-file-first-piece-node" id="toc-entry-28">file_first_block_node() file_first_piece_node()</a></li>
│ │ │ │  <li><a class="reference internal" href="#file-path-hash" id="toc-entry-29">file_path_hash()</a></li>
│ │ │ │  <li><a class="reference internal" href="#all-path-hashes" id="toc-entry-30">all_path_hashes()</a></li>
│ │ │ │  <li><a class="reference internal" href="#file-flags" id="toc-entry-31">file_flags()</a></li>
│ │ │ │  <li><a class="reference internal" href="#file-absolute-path" id="toc-entry-32">file_absolute_path()</a></li>
│ │ │ │  <li><a class="reference internal" href="#file-index-at-piece-file-index-at-offset" id="toc-entry-33">file_index_at_piece() file_index_at_offset()</a></li>
│ │ │ │  <li><a class="reference internal" href="#file-index-for-root" id="toc-entry-34">file_index_for_root()</a></li>
│ │ │ │  <li><a class="reference internal" href="#piece-index-at-file" id="toc-entry-35">piece_index_at_file()</a></li>
│ │ │ │  <li><a class="reference internal" href="#sanitize-symlinks" id="toc-entry-36">sanitize_symlinks()</a></li>
│ │ │ │  <li><a class="reference internal" href="#v2" id="toc-entry-37">v2()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#default-disk-io-constructor" id="toc-entry-38">default_disk_io_constructor()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#posix-disk-io-constructor" id="toc-entry-39">posix_disk_io_constructor()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#mmap-disk-io-constructor" id="toc-entry-38">mmap_disk_io_constructor()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#default-disk-io-constructor" id="toc-entry-39">default_disk_io_constructor()</a></li>
│ │ │ │  <li><a class="reference internal" href="#disabled-disk-io-constructor" id="toc-entry-40">disabled_disk_io_constructor()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#mmap-disk-io-constructor" id="toc-entry-41">mmap_disk_io_constructor()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#posix-disk-io-constructor" id="toc-entry-41">posix_disk_io_constructor()</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-storage-mode-t" id="toc-entry-42">enum storage_mode_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-status-t" id="toc-entry-43">enum status_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-move-flags-t" id="toc-entry-44">enum move_flags_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │  <a name="storage_params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_params&labels=documentation&body=Documentation+under+heading+%22class+storage_params%22+could+be+improved">report issue</a>]</span><div class="section" id="storage-params">
│ │ │ │  <h1>storage_params</h1>
│ │ │ │ @@ -139,65 +139,65 @@
│ │ │ │  size. Everything necessary to interpret a regular bittorrent storage
│ │ │ │  file structure.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  class file_storage
│ │ │ │  {
│ │ │ │     bool <strong>is_valid</strong> () const;
│ │ │ │     void <strong>reserve</strong> (int num_files);
│ │ │ │ -   void <strong>add_file_borrow</strong> (error_code&amp; ec, string_view filename
│ │ │ │ +   void <strong>add_file_borrow</strong> (string_view filename
│ │ │ │        , std::string const&amp; path, std::int64_t file_size
│ │ │ │        , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │        , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ -   void <strong>add_file</strong> (std::string const&amp; path, std::int64_t file_size
│ │ │ │ +   void <strong>add_file</strong> (error_code&amp; ec, std::string const&amp; path, std::int64_t file_size
│ │ │ │        , file_flags_t file_flags = {}
│ │ │ │        , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ -   void <strong>add_file</strong> (error_code&amp; ec, std::string const&amp; path, std::int64_t file_size
│ │ │ │ +   void <strong>add_file</strong> (std::string const&amp; path, std::int64_t file_size
│ │ │ │        , file_flags_t file_flags = {}
│ │ │ │        , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ -   void <strong>add_file_borrow</strong> (string_view filename
│ │ │ │ +   void <strong>add_file_borrow</strong> (error_code&amp; ec, string_view filename
│ │ │ │        , std::string const&amp; path, std::int64_t file_size
│ │ │ │        , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │        , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │        , char const* root_hash = nullptr);
│ │ │ │     void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │     std::vector&lt;file_slice&gt; <strong>map_block</strong> (piece_index_t piece, std::int64_t offset
│ │ │ │        , std::int64_t size) const;
│ │ │ │     peer_request <strong>map_file</strong> (file_index_t file, std::int64_t offset, int size) const;
│ │ │ │     int <strong>num_files</strong> () const noexcept;
│ │ │ │     file_index_t <strong>end_file</strong> () const noexcept;
│ │ │ │     index_range&lt;file_index_t&gt; <strong>file_range</strong> () const noexcept;
│ │ │ │     std::int64_t <strong>total_size</strong> () const;
│ │ │ │ -   void <strong>set_num_pieces</strong> (int n);
│ │ │ │     int <strong>num_pieces</strong> () const;
│ │ │ │ +   void <strong>set_num_pieces</strong> (int n);
│ │ │ │     piece_index_t <strong>end_piece</strong> () const;
│ │ │ │     piece_index_t <strong>last_piece</strong> () const;
│ │ │ │     index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │ -   void <strong>set_piece_length</strong> (int l);
│ │ │ │     int <strong>piece_length</strong> () const;
│ │ │ │ +   void <strong>set_piece_length</strong> (int l);
│ │ │ │     int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │     int <strong>piece_size2</strong> (piece_index_t index) const;
│ │ │ │     int <strong>blocks_in_piece2</strong> (piece_index_t index) const;
│ │ │ │     int <strong>blocks_per_piece</strong> () const;
│ │ │ │ -   void <strong>set_name</strong> (std::string const&amp; n);
│ │ │ │     std::string const&amp; <strong>name</strong> () const;
│ │ │ │ +   void <strong>set_name</strong> (std::string const&amp; n);
│ │ │ │     void <strong>swap</strong> (file_storage&amp; ti) noexcept;
│ │ │ │     void <strong>canonicalize</strong> ();
│ │ │ │ -   bool <strong>pad_file_at</strong> (file_index_t index) const;
│ │ │ │ -   std::string <strong>file_path</strong> (file_index_t index, std::string const&amp; save_path = &quot;&quot;) const;
│ │ │ │ -   sha256_hash <strong>root</strong> (file_index_t index) const;
│ │ │ │ -   sha1_hash <strong>hash</strong> (file_index_t index) const;
│ │ │ │ +   std::string <strong>symlink</strong> (file_index_t index) const;
│ │ │ │     std::int64_t <strong>file_size</strong> (file_index_t index) const;
│ │ │ │ -   string_view <strong>file_name</strong> (file_index_t index) const;
│ │ │ │ +   sha256_hash <strong>root</strong> (file_index_t index) const;
│ │ │ │ +   bool <strong>pad_file_at</strong> (file_index_t index) const;
│ │ │ │     std::int64_t <strong>file_offset</strong> (file_index_t index) const;
│ │ │ │ -   std::string <strong>symlink</strong> (file_index_t index) const;
│ │ │ │ -   std::time_t <strong>mtime</strong> (file_index_t index) const;
│ │ │ │ +   sha1_hash <strong>hash</strong> (file_index_t index) const;
│ │ │ │     char const* <strong>root_ptr</strong> (file_index_t const index) const;
│ │ │ │ +   std::time_t <strong>mtime</strong> (file_index_t index) const;
│ │ │ │ +   string_view <strong>file_name</strong> (file_index_t index) const;
│ │ │ │ +   std::string <strong>file_path</strong> (file_index_t index, std::string const&amp; save_path = &quot;&quot;) const;
│ │ │ │     int <strong>file_num_blocks</strong> (file_index_t index) const;
│ │ │ │     int <strong>file_num_pieces</strong> (file_index_t index) const;
│ │ │ │     index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t) const;
│ │ │ │     int <strong>file_first_block_node</strong> (file_index_t index) const;
│ │ │ │     int <strong>file_first_piece_node</strong> (file_index_t index) const;
│ │ │ │     std::uint32_t <strong>file_path_hash</strong> (file_index_t index, std::string const&amp; save_path) const;
│ │ │ │     void <strong>all_path_hashes</strong> (std::unordered_set&lt;std::uint32_t&gt;&amp; table) const;
│ │ │ │ @@ -235,28 +235,28 @@
│ │ │ │  be used to avoid reallocating the internal file list when the number
│ │ │ │  of files to be added is known up-front.</p>
│ │ │ │  <a name="add_file_borrow()"></a>
│ │ │ │  <a name="add_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Badd_file_borrow%28%29+add_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Badd_file_borrow%28%29+add_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="add-file-borrow-add-file">
│ │ │ │  <h2>add_file_borrow() add_file()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>add_file_borrow</strong> (error_code&amp; ec, string_view filename
│ │ │ │ +void <strong>add_file_borrow</strong> (string_view filename
│ │ │ │        , std::string const&amp; path, std::int64_t file_size
│ │ │ │        , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │        , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ -void <strong>add_file</strong> (std::string const&amp; path, std::int64_t file_size
│ │ │ │ +void <strong>add_file</strong> (error_code&amp; ec, std::string const&amp; path, std::int64_t file_size
│ │ │ │        , file_flags_t file_flags = {}
│ │ │ │        , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ -void <strong>add_file</strong> (error_code&amp; ec, std::string const&amp; path, std::int64_t file_size
│ │ │ │ +void <strong>add_file</strong> (std::string const&amp; path, std::int64_t file_size
│ │ │ │        , file_flags_t file_flags = {}
│ │ │ │        , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ -void <strong>add_file_borrow</strong> (string_view filename
│ │ │ │ +void <strong>add_file_borrow</strong> (error_code&amp; ec, string_view filename
│ │ │ │        , std::string const&amp; path, std::int64_t file_size
│ │ │ │        , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │        , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │        , char const* root_hash = nullptr);
│ │ │ │  </pre>
│ │ │ │  <p>Adds a file to the file storage. The <tt class="docutils literal">add_file_borrow</tt> version
│ │ │ │  expects that <tt class="docutils literal">filename</tt> is the file name (without a path) of
│ │ │ │ @@ -363,16 +363,16 @@
│ │ │ │  </pre>
│ │ │ │  <p>returns the total number of bytes all the files in this torrent spans</p>
│ │ │ │  <a name="num_pieces()"></a>
│ │ │ │  <a name="set_num_pieces()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bnum_pieces%28%29+set_num_pieces%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bnum_pieces%28%29+set_num_pieces%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="num-pieces-set-num-pieces">
│ │ │ │  <h2>num_pieces() set_num_pieces()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_num_pieces</strong> (int n);
│ │ │ │  int <strong>num_pieces</strong> () const;
│ │ │ │ +void <strong>set_num_pieces</strong> (int n);
│ │ │ │  </pre>
│ │ │ │  <p>set and get the number of pieces in the torrent</p>
│ │ │ │  <a name="end_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bend_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bend_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="end-piece">
│ │ │ │  <h2>end_piece()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ @@ -392,31 +392,31 @@
│ │ │ │  <h2>piece_range()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │  </pre>
│ │ │ │  <p>returns an implementation-defined type that can be used as the
│ │ │ │  container in a range-for loop. Where the values are the indices of all
│ │ │ │  pieces in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │ -<a name="set_piece_length()"></a>
│ │ │ │ -<a name="piece_length()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bset_piece_length%28%29+piece_length%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bset_piece_length%28%29+piece_length%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-piece-length-piece-length">
│ │ │ │ -<h2>set_piece_length() piece_length()</h2>
│ │ │ │ +<a name="piece_length()"></a>
│ │ │ │ +<a name="set_piece_length()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_length%28%29+set_piece_length%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_length%28%29+set_piece_length%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-length-set-piece-length">
│ │ │ │ +<h2>piece_length() set_piece_length()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_piece_length</strong> (int l);
│ │ │ │  int <strong>piece_length</strong> () const;
│ │ │ │ +void <strong>set_piece_length</strong> (int l);
│ │ │ │  </pre>
│ │ │ │  <p>set and get the size of each piece in this torrent. It must be a power of two
│ │ │ │  and at least 16 kiB.</p>
│ │ │ │  <a name="piece_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="piece-size">
│ │ │ │  <h2>piece_size()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │  </pre>
│ │ │ │ -<p>returns the piece size of <tt class="docutils literal">index</tt>. This will be the same as <a class="reference external" href="reference-Create_Torrents.html#piece_length()">piece_length()</a>, except
│ │ │ │ +<p>returns the piece size of <tt class="docutils literal">index</tt>. This will be the same as <a class="reference external" href="reference-Storage.html#piece_length()">piece_length()</a>, except
│ │ │ │  for the last piece, which may be shorter.</p>
│ │ │ │  <a name="piece_size2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_size2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_size2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="piece-size2">
│ │ │ │  <h2>piece_size2()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  int <strong>piece_size2</strong> (piece_index_t index) const;
│ │ │ │  </pre>
│ │ │ │ @@ -435,21 +435,21 @@
│ │ │ │  <div class="section" id="blocks-per-piece">
│ │ │ │  <h2>blocks_per_piece()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  int <strong>blocks_per_piece</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>returns the number of blocks there are in the typical piece. There
│ │ │ │  may be fewer in the last piece)</p>
│ │ │ │ -<a name="set_name()"></a>
│ │ │ │ -<a name="name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bset_name%28%29+name%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bset_name%28%29+name%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-name-name">
│ │ │ │ -<h2>set_name() name()</h2>
│ │ │ │ +<a name="name()"></a>
│ │ │ │ +<a name="set_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bname%28%29+set_name%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bname%28%29+set_name%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="name-set-name">
│ │ │ │ +<h2>name() set_name()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_name</strong> (std::string const&amp; n);
│ │ │ │  std::string const&amp; <strong>name</strong> () const;
│ │ │ │ +void <strong>set_name</strong> (std::string const&amp; n);
│ │ │ │  </pre>
│ │ │ │  <p>set and get the name of this torrent. For multi-file torrents, this is also
│ │ │ │  the name of the root directory all the files are stored in.</p>
│ │ │ │  <a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="swap">
│ │ │ │  <h2>swap()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ @@ -460,37 +460,37 @@
│ │ │ │  <div class="section" id="canonicalize">
│ │ │ │  <h2>canonicalize()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>canonicalize</strong> ();
│ │ │ │  </pre>
│ │ │ │  <p>arrange files and padding to match the canonical form required
│ │ │ │  by BEP 52</p>
│ │ │ │ -<a name="file_size()"></a>
│ │ │ │ -<a name="hash()"></a>
│ │ │ │ -<a name="root()"></a>
│ │ │ │ -<a name="file_offset()"></a>
│ │ │ │ -<a name="pad_file_at()"></a>
│ │ │ │  <a name="file_path()"></a>
│ │ │ │ -<a name="file_name()"></a>
│ │ │ │ +<a name="pad_file_at()"></a>
│ │ │ │ +<a name="hash()"></a>
│ │ │ │  <a name="symlink()"></a>
│ │ │ │ +<a name="file_name()"></a>
│ │ │ │ +<a name="root()"></a>
│ │ │ │  <a name="root_ptr()"></a>
│ │ │ │ -<a name="mtime()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_size%28%29+hash%28%29+root%28%29+file_offset%28%29+pad_file_at%28%29+file_path%28%29+file_name%28%29+symlink%28%29+root_ptr%28%29+mtime%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_size%28%29+hash%28%29+root%28%29+file_offset%28%29+pad_file_at%28%29+file_path%28%29+file_name%28%29+symlink%28%29+root_ptr%28%29+mtime%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-size-hash-root-file-offset-pad-file-at-file-path-file-name-symlink-root-ptr-mtime">
│ │ │ │ -<h2>file_size() hash() root() file_offset() pad_file_at() file_path() file_name() symlink() root_ptr() mtime()</h2>
│ │ │ │ +<a name="file_size()"></a>
│ │ │ │ +<a name="mtime()"></a>
│ │ │ │ +<a name="file_offset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_path%28%29+pad_file_at%28%29+hash%28%29+symlink%28%29+file_name%28%29+root%28%29+root_ptr%28%29+file_size%28%29+mtime%28%29+file_offset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_path%28%29+pad_file_at%28%29+hash%28%29+symlink%28%29+file_name%28%29+root%28%29+root_ptr%28%29+file_size%28%29+mtime%28%29+file_offset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-path-pad-file-at-hash-symlink-file-name-root-root-ptr-file-size-mtime-file-offset">
│ │ │ │ +<h2>file_path() pad_file_at() hash() symlink() file_name() root() root_ptr() file_size() mtime() file_offset()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>pad_file_at</strong> (file_index_t index) const;
│ │ │ │ -std::string <strong>file_path</strong> (file_index_t index, std::string const&amp; save_path = &quot;&quot;) const;
│ │ │ │ -sha256_hash <strong>root</strong> (file_index_t index) const;
│ │ │ │ -sha1_hash <strong>hash</strong> (file_index_t index) const;
│ │ │ │ +std::string <strong>symlink</strong> (file_index_t index) const;
│ │ │ │  std::int64_t <strong>file_size</strong> (file_index_t index) const;
│ │ │ │ -string_view <strong>file_name</strong> (file_index_t index) const;
│ │ │ │ +sha256_hash <strong>root</strong> (file_index_t index) const;
│ │ │ │ +bool <strong>pad_file_at</strong> (file_index_t index) const;
│ │ │ │  std::int64_t <strong>file_offset</strong> (file_index_t index) const;
│ │ │ │ -std::string <strong>symlink</strong> (file_index_t index) const;
│ │ │ │ -std::time_t <strong>mtime</strong> (file_index_t index) const;
│ │ │ │ +sha1_hash <strong>hash</strong> (file_index_t index) const;
│ │ │ │  char const* <strong>root_ptr</strong> (file_index_t const index) const;
│ │ │ │ +std::time_t <strong>mtime</strong> (file_index_t index) const;
│ │ │ │ +string_view <strong>file_name</strong> (file_index_t index) const;
│ │ │ │ +std::string <strong>file_path</strong> (file_index_t index, std::string const&amp; save_path = &quot;&quot;) const;
│ │ │ │  </pre>
│ │ │ │  <p>These functions are used to query attributes of files at
│ │ │ │  a given index.</p>
│ │ │ │  <p>The <tt class="docutils literal">hash()</tt> is a SHA-1 hash of the file, or 0 if none was
│ │ │ │  provided in the torrent file. This can potentially be used to
│ │ │ │  join a bittorrent network with other file sharing networks.</p>
│ │ │ │  <p><tt class="docutils literal">root()</tt> returns the SHA-256 merkle tree root of the specified file,
│ │ │ │ @@ -508,34 +508,34 @@
│ │ │ │  index is a pad-file.</p>
│ │ │ │  <p><tt class="docutils literal">file_name()</tt> returns <em>just</em> the name of the file, whereas
│ │ │ │  <tt class="docutils literal">file_path()</tt> returns the path (inside the torrent file) with
│ │ │ │  the filename appended.</p>
│ │ │ │  <p><tt class="docutils literal">file_offset()</tt> returns the byte offset within the torrent file
│ │ │ │  where this file starts. It can be used to map the file to a piece
│ │ │ │  index (given the piece size).</p>
│ │ │ │ -<a name="file_num_pieces()"></a>
│ │ │ │  <a name="file_num_blocks()"></a>
│ │ │ │ -<a name="file_piece_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_num_pieces%28%29+file_num_blocks%28%29+file_piece_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_num_pieces%28%29+file_num_blocks%28%29+file_piece_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-num-pieces-file-num-blocks-file-piece-range">
│ │ │ │ -<h2>file_num_pieces() file_num_blocks() file_piece_range()</h2>
│ │ │ │ +<a name="file_piece_range()"></a>
│ │ │ │ +<a name="file_num_pieces()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_num_blocks%28%29+file_piece_range%28%29+file_num_pieces%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_num_blocks%28%29+file_piece_range%28%29+file_num_pieces%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-num-blocks-file-piece-range-file-num-pieces">
│ │ │ │ +<h2>file_num_blocks() file_piece_range() file_num_pieces()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  int <strong>file_num_blocks</strong> (file_index_t index) const;
│ │ │ │  int <strong>file_num_pieces</strong> (file_index_t index) const;
│ │ │ │  index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t) const;
│ │ │ │  </pre>
│ │ │ │  <p>Returns the number of pieces or blocks the file at <cite>index</cite> spans,
│ │ │ │  under the assumption that the file is aligned to the start of a piece.
│ │ │ │  This is only meaningful for v2 torrents, where files are guaranteed
│ │ │ │  such alignment.
│ │ │ │  These numbers are used to size and navigate the merkle hash tree for
│ │ │ │  each file.</p>
│ │ │ │ -<a name="file_first_piece_node()"></a>
│ │ │ │ -<a name="file_first_block_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_first_piece_node%28%29+file_first_block_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_first_piece_node%28%29+file_first_block_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-first-piece-node-file-first-block-node">
│ │ │ │ -<h2>file_first_piece_node() file_first_block_node()</h2>
│ │ │ │ +<a name="file_first_block_node()"></a>
│ │ │ │ +<a name="file_first_piece_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_first_block_node%28%29+file_first_piece_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_first_block_node%28%29+file_first_piece_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-first-block-node-file-first-piece-node">
│ │ │ │ +<h2>file_first_block_node() file_first_piece_node()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  int <strong>file_first_block_node</strong> (file_index_t index) const;
│ │ │ │  int <strong>file_first_piece_node</strong> (file_index_t index) const;
│ │ │ │  </pre>
│ │ │ │  <p>index of first piece node in the merkle tree</p>
│ │ │ │  <a name="file_path_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_path_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_path_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="file-path-hash">
│ │ │ │ @@ -629,57 +629,57 @@
│ │ │ │  <dd>this file has the executable attribute set.</dd>
│ │ │ │  </dl>
│ │ │ │  <a name="flag_symlink"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bflag_symlink%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bflag_symlink%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>flag_symlink</dt>
│ │ │ │  <dd>this file is a symbolic link. It should have a link
│ │ │ │  target string associated with it.</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="default_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:default_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22default_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<a name="mmap_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:mmap_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22mmap_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │ +<div class="section" id="mmap-disk-io-constructor">
│ │ │ │ +<h1>mmap_disk_io_constructor()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/mmap_disk_io.hpp">libtorrent/mmap_disk_io.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::unique_ptr&lt;disk_interface&gt; <strong>mmap_disk_io_constructor</strong> (
│ │ │ │ +   io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │ +</pre>
│ │ │ │ +<p>constructs a memory mapped file disk I/O object.</p>
│ │ │ │ +<a name="default_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:default_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22default_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="default-disk-io-constructor">
│ │ │ │  <h1>default_disk_io_constructor()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/session.hpp">libtorrent/session.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::unique_ptr&lt;disk_interface&gt; <strong>default_disk_io_constructor</strong> (
│ │ │ │     io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │  </pre>
│ │ │ │  <p>the constructor function for the default storage. On systems that support
│ │ │ │  memory mapped files (and a 64 bit address space) the memory mapped storage
│ │ │ │  will be constructed, otherwise the portable posix storage.</p>
│ │ │ │ -<a name="posix_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:posix_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22posix_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="posix-disk-io-constructor">
│ │ │ │ -<h1>posix_disk_io_constructor()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/posix_disk_io.hpp">libtorrent/posix_disk_io.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::unique_ptr&lt;disk_interface&gt; <strong>posix_disk_io_constructor</strong> (
│ │ │ │ -   io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │ -</pre>
│ │ │ │ -<p>this is a simple posix disk I/O back-end, used for systems that don't
│ │ │ │ -have a 64 bit virtual address space or don't support memory mapped files.
│ │ │ │ -It's implemented using portable C file functions and is single-threaded.</p>
│ │ │ │  <a name="disabled_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disabled_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22disabled_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="disabled-disk-io-constructor">
│ │ │ │  <h1>disabled_disk_io_constructor()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/disabled_disk_io.hpp">libtorrent/disabled_disk_io.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::unique_ptr&lt;disk_interface&gt; <strong>disabled_disk_io_constructor</strong> (
│ │ │ │     io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │  </pre>
│ │ │ │  <p>creates a disk io object that discards all data written to it, and only
│ │ │ │  returns zero-buffers when read from. May be useful for testing and
│ │ │ │  benchmarking.</p>
│ │ │ │ -<a name="mmap_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:mmap_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22mmap_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="mmap-disk-io-constructor">
│ │ │ │ -<h1>mmap_disk_io_constructor()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/mmap_disk_io.hpp">libtorrent/mmap_disk_io.hpp</a>&quot;</p>
│ │ │ │ +<a name="posix_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:posix_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22posix_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="posix-disk-io-constructor">
│ │ │ │ +<h1>posix_disk_io_constructor()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/posix_disk_io.hpp">libtorrent/posix_disk_io.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::unique_ptr&lt;disk_interface&gt; <strong>mmap_disk_io_constructor</strong> (
│ │ │ │ +std::unique_ptr&lt;disk_interface&gt; <strong>posix_disk_io_constructor</strong> (
│ │ │ │     io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │  </pre>
│ │ │ │ -<p>constructs a memory mapped file disk I/O object.</p>
│ │ │ │ +<p>this is a simple posix disk I/O back-end, used for systems that don't
│ │ │ │ +have a 64 bit virtual address space or don't support memory mapped files.
│ │ │ │ +It's implemented using portable C file functions and is single-threaded.</p>
│ │ │ │  <a name="storage_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+storage_mode_t&labels=documentation&body=Documentation+under+heading+%22enum+storage_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="enum-storage-mode-t">
│ │ │ │  <h1>enum storage_mode_t</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/storage_defs.hpp">libtorrent/storage_defs.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │  <col width="22%" />
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -16,39 +16,39 @@
│ │ │ │ │            o _e_n_d___f_i_l_e_(_)
│ │ │ │ │            o _f_i_l_e___r_a_n_g_e_(_)
│ │ │ │ │            o _t_o_t_a_l___s_i_z_e_(_)
│ │ │ │ │            o _n_u_m___p_i_e_c_e_s_(_)_ _s_e_t___n_u_m___p_i_e_c_e_s_(_)
│ │ │ │ │            o _e_n_d___p_i_e_c_e_(_)
│ │ │ │ │            o _l_a_s_t___p_i_e_c_e_(_)
│ │ │ │ │            o _p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │ -          o _s_e_t___p_i_e_c_e___l_e_n_g_t_h_(_)_ _p_i_e_c_e___l_e_n_g_t_h_(_)
│ │ │ │ │ +          o _p_i_e_c_e___l_e_n_g_t_h_(_)_ _s_e_t___p_i_e_c_e___l_e_n_g_t_h_(_)
│ │ │ │ │            o _p_i_e_c_e___s_i_z_e_(_)
│ │ │ │ │            o _p_i_e_c_e___s_i_z_e_2_(_)
│ │ │ │ │            o _b_l_o_c_k_s___i_n___p_i_e_c_e_2_(_)
│ │ │ │ │            o _b_l_o_c_k_s___p_e_r___p_i_e_c_e_(_)
│ │ │ │ │ -          o _s_e_t___n_a_m_e_(_)_ _n_a_m_e_(_)
│ │ │ │ │ +          o _n_a_m_e_(_)_ _s_e_t___n_a_m_e_(_)
│ │ │ │ │            o _s_w_a_p_(_)
│ │ │ │ │            o _c_a_n_o_n_i_c_a_l_i_z_e_(_)
│ │ │ │ │ -          o _f_i_l_e___s_i_z_e_(_)_ _h_a_s_h_(_)_ _r_o_o_t_(_)_ _f_i_l_e___o_f_f_s_e_t_(_)_ _p_a_d___f_i_l_e___a_t_(_)_ _f_i_l_e___p_a_t_h_(_)
│ │ │ │ │ -            _f_i_l_e___n_a_m_e_(_)_ _s_y_m_l_i_n_k_(_)_ _r_o_o_t___p_t_r_(_)_ _m_t_i_m_e_(_)
│ │ │ │ │ -          o _f_i_l_e___n_u_m___p_i_e_c_e_s_(_)_ _f_i_l_e___n_u_m___b_l_o_c_k_s_(_)_ _f_i_l_e___p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │ -          o _f_i_l_e___f_i_r_s_t___p_i_e_c_e___n_o_d_e_(_)_ _f_i_l_e___f_i_r_s_t___b_l_o_c_k___n_o_d_e_(_)
│ │ │ │ │ +          o _f_i_l_e___p_a_t_h_(_)_ _p_a_d___f_i_l_e___a_t_(_)_ _h_a_s_h_(_)_ _s_y_m_l_i_n_k_(_)_ _f_i_l_e___n_a_m_e_(_)_ _r_o_o_t_(_)
│ │ │ │ │ +            _r_o_o_t___p_t_r_(_)_ _f_i_l_e___s_i_z_e_(_)_ _m_t_i_m_e_(_)_ _f_i_l_e___o_f_f_s_e_t_(_)
│ │ │ │ │ +          o _f_i_l_e___n_u_m___b_l_o_c_k_s_(_)_ _f_i_l_e___p_i_e_c_e___r_a_n_g_e_(_)_ _f_i_l_e___n_u_m___p_i_e_c_e_s_(_)
│ │ │ │ │ +          o _f_i_l_e___f_i_r_s_t___b_l_o_c_k___n_o_d_e_(_)_ _f_i_l_e___f_i_r_s_t___p_i_e_c_e___n_o_d_e_(_)
│ │ │ │ │            o _f_i_l_e___p_a_t_h___h_a_s_h_(_)
│ │ │ │ │            o _a_l_l___p_a_t_h___h_a_s_h_e_s_(_)
│ │ │ │ │            o _f_i_l_e___f_l_a_g_s_(_)
│ │ │ │ │            o _f_i_l_e___a_b_s_o_l_u_t_e___p_a_t_h_(_)
│ │ │ │ │            o _f_i_l_e___i_n_d_e_x___a_t___p_i_e_c_e_(_)_ _f_i_l_e___i_n_d_e_x___a_t___o_f_f_s_e_t_(_)
│ │ │ │ │            o _f_i_l_e___i_n_d_e_x___f_o_r___r_o_o_t_(_)
│ │ │ │ │            o _p_i_e_c_e___i_n_d_e_x___a_t___f_i_l_e_(_)
│ │ │ │ │            o _s_a_n_i_t_i_z_e___s_y_m_l_i_n_k_s_(_)
│ │ │ │ │            o _v_2_(_)
│ │ │ │ │ +    * _m_m_a_p___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │      * _d_e_f_a_u_l_t___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ -    * _p_o_s_i_x___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │      * _d_i_s_a_b_l_e_d___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ -    * _m_m_a_p___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ +    * _p_o_s_i_x___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │      * _e_n_u_m_ _s_t_o_r_a_g_e___m_o_d_e___t
│ │ │ │ │      * _e_n_u_m_ _s_t_a_t_u_s___t
│ │ │ │ │      * _e_n_u_m_ _m_o_v_e___f_l_a_g_s___t
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ssttoorraaggee__ppaarraammss ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_t_o_r_a_g_e___d_e_f_s_._h_p_p"
│ │ │ │ │  a parameter pack used to construct the storage for a torrent, used in
│ │ │ │ │ @@ -96,68 +96,68 @@
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_f_i_l_e___s_t_o_r_a_g_e_._h_p_p"
│ │ │ │ │  The file_storage class represents a file list and the piece size. Everything
│ │ │ │ │  necessary to interpret a regular bittorrent storage file structure.
│ │ │ │ │  class file_storage
│ │ │ │ │  {
│ │ │ │ │     bool iiss__vvaalliidd () const;
│ │ │ │ │     void rreesseerrvvee (int num_files);
│ │ │ │ │ -   void aadddd__ffiillee__bboorrrrooww (error_code& ec, string_view filename
│ │ │ │ │ +   void aadddd__ffiillee__bboorrrrooww (string_view filename
│ │ │ │ │        , std::string const& path, std::int64_t file_size
│ │ │ │ │        , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │        , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ │ -   void aadddd__ffiillee (std::string const& path, std::int64_t file_size
│ │ │ │ │ +   void aadddd__ffiillee (error_code& ec, std::string const& path, std::int64_t
│ │ │ │ │ +file_size
│ │ │ │ │        , file_flags_t file_flags = {}
│ │ │ │ │        , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ │ -   void aadddd__ffiillee (error_code& ec, std::string const& path, std::int64_t
│ │ │ │ │ -file_size
│ │ │ │ │ +   void aadddd__ffiillee (std::string const& path, std::int64_t file_size
│ │ │ │ │        , file_flags_t file_flags = {}
│ │ │ │ │        , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ │ -   void aadddd__ffiillee__bboorrrrooww (string_view filename
│ │ │ │ │ +   void aadddd__ffiillee__bboorrrrooww (error_code& ec, string_view filename
│ │ │ │ │        , std::string const& path, std::int64_t file_size
│ │ │ │ │        , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │        , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ │     void rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
│ │ │ │ │     std::vector<file_slice> mmaapp__bblloocckk (piece_index_t piece, std::int64_t offset
│ │ │ │ │        , std::int64_t size) const;
│ │ │ │ │     peer_request mmaapp__ffiillee (file_index_t file, std::int64_t offset, int size)
│ │ │ │ │  const;
│ │ │ │ │     int nnuumm__ffiilleess () const noexcept;
│ │ │ │ │     file_index_t eenndd__ffiillee () const noexcept;
│ │ │ │ │     index_range<file_index_t> ffiillee__rraannggee () const noexcept;
│ │ │ │ │     std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ -   void sseett__nnuumm__ppiieecceess (int n);
│ │ │ │ │     int nnuumm__ppiieecceess () const;
│ │ │ │ │ +   void sseett__nnuumm__ppiieecceess (int n);
│ │ │ │ │     piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │     piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │     index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │ -   void sseett__ppiieeccee__lleennggtthh (int l);
│ │ │ │ │     int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ +   void sseett__ppiieeccee__lleennggtthh (int l);
│ │ │ │ │     int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │     int ppiieeccee__ssiizzee22 (piece_index_t index) const;
│ │ │ │ │     int bblloocckkss__iinn__ppiieeccee22 (piece_index_t index) const;
│ │ │ │ │     int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │ -   void sseett__nnaammee (std::string const& n);
│ │ │ │ │     std::string const& nnaammee () const;
│ │ │ │ │ +   void sseett__nnaammee (std::string const& n);
│ │ │ │ │     void sswwaapp (file_storage& ti) noexcept;
│ │ │ │ │     void ccaannoonniiccaalliizzee ();
│ │ │ │ │ -   bool ppaadd__ffiillee__aatt (file_index_t index) const;
│ │ │ │ │ -   std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path =
│ │ │ │ │ -"") const;
│ │ │ │ │ -   sha256_hash rroooott (file_index_t index) const;
│ │ │ │ │ -   sha1_hash hhaasshh (file_index_t index) const;
│ │ │ │ │ +   std::string ssyymmlliinnkk (file_index_t index) const;
│ │ │ │ │     std::int64_t ffiillee__ssiizzee (file_index_t index) const;
│ │ │ │ │ -   string_view ffiillee__nnaammee (file_index_t index) const;
│ │ │ │ │ +   sha256_hash rroooott (file_index_t index) const;
│ │ │ │ │ +   bool ppaadd__ffiillee__aatt (file_index_t index) const;
│ │ │ │ │     std::int64_t ffiillee__ooffffsseett (file_index_t index) const;
│ │ │ │ │ -   std::string ssyymmlliinnkk (file_index_t index) const;
│ │ │ │ │ -   std::time_t mmttiimmee (file_index_t index) const;
│ │ │ │ │ +   sha1_hash hhaasshh (file_index_t index) const;
│ │ │ │ │     char const* rroooott__ppttrr (file_index_t const index) const;
│ │ │ │ │ +   std::time_t mmttiimmee (file_index_t index) const;
│ │ │ │ │ +   string_view ffiillee__nnaammee (file_index_t index) const;
│ │ │ │ │ +   std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path =
│ │ │ │ │ +"") const;
│ │ │ │ │     int ffiillee__nnuumm__bblloocckkss (file_index_t index) const;
│ │ │ │ │     int ffiillee__nnuumm__ppiieecceess (file_index_t index) const;
│ │ │ │ │     index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t) const;
│ │ │ │ │     int ffiillee__ffiirrsstt__bblloocckk__nnooddee (file_index_t index) const;
│ │ │ │ │     int ffiillee__ffiirrsstt__ppiieeccee__nnooddee (file_index_t index) const;
│ │ │ │ │     std::uint32_t ffiillee__ppaatthh__hhaasshh (file_index_t index, std::string const&
│ │ │ │ │  save_path) const;
│ │ │ │ │ @@ -186,28 +186,28 @@
│ │ │ │ │  ********** rreesseerrvvee(()) **********
│ │ │ │ │  void rreesseerrvvee (int num_files);
│ │ │ │ │  allocates space for num_files in the internal file list. This can be used to
│ │ │ │ │  avoid reallocating the internal file list when the number of files to be added
│ │ │ │ │  is known up-front.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aadddd__ffiillee__bboorrrrooww(()) aadddd__ffiillee(()) **********
│ │ │ │ │ -void aadddd__ffiillee__bboorrrrooww (error_code& ec, string_view filename
│ │ │ │ │ +void aadddd__ffiillee__bboorrrrooww (string_view filename
│ │ │ │ │        , std::string const& path, std::int64_t file_size
│ │ │ │ │        , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │        , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ │ -void aadddd__ffiillee (std::string const& path, std::int64_t file_size
│ │ │ │ │ +void aadddd__ffiillee (error_code& ec, std::string const& path, std::int64_t file_size
│ │ │ │ │        , file_flags_t file_flags = {}
│ │ │ │ │        , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ │ -void aadddd__ffiillee (error_code& ec, std::string const& path, std::int64_t file_size
│ │ │ │ │ +void aadddd__ffiillee (std::string const& path, std::int64_t file_size
│ │ │ │ │        , file_flags_t file_flags = {}
│ │ │ │ │        , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ │ -void aadddd__ffiillee__bboorrrrooww (string_view filename
│ │ │ │ │ +void aadddd__ffiillee__bboorrrrooww (error_code& ec, string_view filename
│ │ │ │ │        , std::string const& path, std::int64_t file_size
│ │ │ │ │        , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │        , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │        , char const* root_hash = nullptr);
│ │ │ │ │  Adds a file to the file storage. The add_file_borrow version expects that
│ │ │ │ │  filename is the file name (without a path) of the file that's being added. This
│ │ │ │ │  memory is bboorrrroowweedd, i.e. it is the caller's responsibility to make sure it
│ │ │ │ │ @@ -281,16 +281,16 @@
│ │ │ │ │  _f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ttoottaall__ssiizzee(()) **********
│ │ │ │ │  std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │  returns the total number of bytes all the files in this torrent spans
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** nnuumm__ppiieecceess(()) sseett__nnuumm__ppiieecceess(()) **********
│ │ │ │ │ -void sseett__nnuumm__ppiieecceess (int n);
│ │ │ │ │  int nnuumm__ppiieecceess () const;
│ │ │ │ │ +void sseett__nnuumm__ppiieecceess (int n);
│ │ │ │ │  set and get the number of pieces in the torrent
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** eenndd__ppiieeccee(()) **********
│ │ │ │ │  piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │  returns the index of the one-past-end piece in the file storage
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** llaasstt__ppiieeccee(()) **********
│ │ │ │ │ @@ -301,17 +301,17 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ppiieeccee__rraannggee(()) **********
│ │ │ │ │  index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │  returns an implementation-defined type that can be used as the container in a
│ │ │ │ │  range-for loop. Where the values are the indices of all pieces in the
│ │ │ │ │  _f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__ppiieeccee__lleennggtthh(()) ppiieeccee__lleennggtthh(()) **********
│ │ │ │ │ -void sseett__ppiieeccee__lleennggtthh (int l);
│ │ │ │ │ +********** ppiieeccee__lleennggtthh(()) sseett__ppiieeccee__lleennggtthh(()) **********
│ │ │ │ │  int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ +void sseett__ppiieeccee__lleennggtthh (int l);
│ │ │ │ │  set and get the size of each piece in this torrent. It must be a power of two
│ │ │ │ │  and at least 16 kiB.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ppiieeccee__ssiizzee(()) **********
│ │ │ │ │  int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │  returns the piece size of index. This will be the same as _p_i_e_c_e___l_e_n_g_t_h_(_),
│ │ │ │ │  except for the last piece, which may be shorter.
│ │ │ │ │ @@ -328,41 +328,41 @@
│ │ │ │ │  returns the number of blocks in the specified piece, for v2 torrents.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** bblloocckkss__ppeerr__ppiieeccee(()) **********
│ │ │ │ │  int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │  returns the number of blocks there are in the typical piece. There may be fewer
│ │ │ │ │  in the last piece)
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__nnaammee(()) nnaammee(()) **********
│ │ │ │ │ -void sseett__nnaammee (std::string const& n);
│ │ │ │ │ +********** nnaammee(()) sseett__nnaammee(()) **********
│ │ │ │ │  std::string const& nnaammee () const;
│ │ │ │ │ +void sseett__nnaammee (std::string const& n);
│ │ │ │ │  set and get the name of this torrent. For multi-file torrents, this is also the
│ │ │ │ │  name of the root directory all the files are stored in.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sswwaapp(()) **********
│ │ │ │ │  void sswwaapp (file_storage& ti) noexcept;
│ │ │ │ │  swap all content of tthhiiss with ttii.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ccaannoonniiccaalliizzee(()) **********
│ │ │ │ │  void ccaannoonniiccaalliizzee ();
│ │ │ │ │  arrange files and padding to match the canonical form required by BEP 52
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__ssiizzee(()) hhaasshh(()) rroooott(()) ffiillee__ooffffsseett(()) ppaadd__ffiillee__aatt(()) ffiillee__ppaatthh(())
│ │ │ │ │ -ffiillee__nnaammee(()) ssyymmlliinnkk(()) rroooott__ppttrr(()) mmttiimmee(()) **********
│ │ │ │ │ -bool ppaadd__ffiillee__aatt (file_index_t index) const;
│ │ │ │ │ -std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path = "")
│ │ │ │ │ -const;
│ │ │ │ │ -sha256_hash rroooott (file_index_t index) const;
│ │ │ │ │ -sha1_hash hhaasshh (file_index_t index) const;
│ │ │ │ │ +********** ffiillee__ppaatthh(()) ppaadd__ffiillee__aatt(()) hhaasshh(()) ssyymmlliinnkk(()) ffiillee__nnaammee(()) rroooott(()) rroooott__ppttrr(())
│ │ │ │ │ +ffiillee__ssiizzee(()) mmttiimmee(()) ffiillee__ooffffsseett(()) **********
│ │ │ │ │ +std::string ssyymmlliinnkk (file_index_t index) const;
│ │ │ │ │  std::int64_t ffiillee__ssiizzee (file_index_t index) const;
│ │ │ │ │ -string_view ffiillee__nnaammee (file_index_t index) const;
│ │ │ │ │ +sha256_hash rroooott (file_index_t index) const;
│ │ │ │ │ +bool ppaadd__ffiillee__aatt (file_index_t index) const;
│ │ │ │ │  std::int64_t ffiillee__ooffffsseett (file_index_t index) const;
│ │ │ │ │ -std::string ssyymmlliinnkk (file_index_t index) const;
│ │ │ │ │ -std::time_t mmttiimmee (file_index_t index) const;
│ │ │ │ │ +sha1_hash hhaasshh (file_index_t index) const;
│ │ │ │ │  char const* rroooott__ppttrr (file_index_t const index) const;
│ │ │ │ │ +std::time_t mmttiimmee (file_index_t index) const;
│ │ │ │ │ +string_view ffiillee__nnaammee (file_index_t index) const;
│ │ │ │ │ +std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path = "")
│ │ │ │ │ +const;
│ │ │ │ │  These functions are used to query attributes of files at a given index.
│ │ │ │ │  The hash() is a SHA-1 hash of the file, or 0 if none was provided in the
│ │ │ │ │  torrent file. This can potentially be used to join a bittorrent network with
│ │ │ │ │  other file sharing networks.
│ │ │ │ │  root() returns the SHA-256 merkle tree root of the specified file, in case this
│ │ │ │ │  is a v2 torrent. Otherwise returns zeros. root_ptr() returns a pointer to the
│ │ │ │ │  SHA-256 merkle tree root hash for the specified file. The pointer points into
│ │ │ │ │ @@ -375,24 +375,24 @@
│ │ │ │ │  file_size() returns the size of a file.
│ │ │ │ │  pad_file_at() returns true if the file at the given index is a pad-file.
│ │ │ │ │  file_name() returns jjuusstt the name of the file, whereas file_path() returns the
│ │ │ │ │  path (inside the torrent file) with the filename appended.
│ │ │ │ │  file_offset() returns the byte offset within the torrent file where this file
│ │ │ │ │  starts. It can be used to map the file to a piece index (given the piece size).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__nnuumm__ppiieecceess(()) ffiillee__nnuumm__bblloocckkss(()) ffiillee__ppiieeccee__rraannggee(()) **********
│ │ │ │ │ +********** ffiillee__nnuumm__bblloocckkss(()) ffiillee__ppiieeccee__rraannggee(()) ffiillee__nnuumm__ppiieecceess(()) **********
│ │ │ │ │  int ffiillee__nnuumm__bblloocckkss (file_index_t index) const;
│ │ │ │ │  int ffiillee__nnuumm__ppiieecceess (file_index_t index) const;
│ │ │ │ │  index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t) const;
│ │ │ │ │  Returns the number of pieces or blocks the file atindexspans, under the
│ │ │ │ │  assumption that the file is aligned to the start of a piece. This is only
│ │ │ │ │  meaningful for v2 torrents, where files are guaranteed such alignment. These
│ │ │ │ │  numbers are used to size and navigate the merkle hash tree for each file.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__ffiirrsstt__ppiieeccee__nnooddee(()) ffiillee__ffiirrsstt__bblloocckk__nnooddee(()) **********
│ │ │ │ │ +********** ffiillee__ffiirrsstt__bblloocckk__nnooddee(()) ffiillee__ffiirrsstt__ppiieeccee__nnooddee(()) **********
│ │ │ │ │  int ffiillee__ffiirrsstt__bblloocckk__nnooddee (file_index_t index) const;
│ │ │ │ │  int ffiillee__ffiirrsstt__ppiieeccee__nnooddee (file_index_t index) const;
│ │ │ │ │  index of first piece node in the merkle tree
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ffiillee__ppaatthh__hhaasshh(()) **********
│ │ │ │ │  std::uint32_t ffiillee__ppaatthh__hhaasshh (file_index_t index, std::string const& save_path)
│ │ │ │ │  const;
│ │ │ │ │ @@ -450,42 +450,42 @@
│ │ │ │ │    flag_executable
│ │ │ │ │        this file has the executable attribute set.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    flag_symlink
│ │ │ │ │        this file is a symbolic link. It should have a link target string
│ │ │ │ │        associated with it.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ mmmmaapp__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_m_m_a_p___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │ +std::unique_ptr<disk_interface> mmmmaapp__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ +   io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ +constructs a memory mapped file disk I/O object.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ddeeffaauulltt__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n_._h_p_p"
│ │ │ │ │  std::unique_ptr<disk_interface> ddeeffaauulltt__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │     io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │  the constructor function for the default storage. On systems that support
│ │ │ │ │  memory mapped files (and a 64 bit address space) the memory mapped storage will
│ │ │ │ │  be constructed, otherwise the portable posix storage.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppoossiixx__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_s_i_x___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │ -std::unique_ptr<disk_interface> ppoossiixx__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ -   io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ -this is a simple posix disk I/O back-end, used for systems that don't have a 64
│ │ │ │ │ -bit virtual address space or don't support memory mapped files. It's
│ │ │ │ │ -implemented using portable C file functions and is single-threaded.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ddiissaabblleedd__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_a_b_l_e_d___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │  std::unique_ptr<disk_interface> ddiissaabblleedd__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │     io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │  creates a disk io object that discards all data written to it, and only returns
│ │ │ │ │  zero-buffers when read from. May be useful for testing and benchmarking.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ mmmmaapp__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_m_m_a_p___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │ -std::unique_ptr<disk_interface> mmmmaapp__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ +************ ppoossiixx__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_s_i_x___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │ +std::unique_ptr<disk_interface> ppoossiixx__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │     io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ -constructs a memory mapped file disk I/O object.
│ │ │ │ │ +this is a simple posix disk I/O back-end, used for systems that don't have a 64
│ │ │ │ │ +bit virtual address space or don't support memory mapped files. It's
│ │ │ │ │ +implemented using portable C file functions and is single-threaded.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ eennuumm ssttoorraaggee__mmooddee__tt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_t_o_r_a_g_e___d_e_f_s_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |                     |     |All pieces will be written to their final      |
│ │ │ │ │  |                     |     |position, all files will be allocated in full  |
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Handle.html
│ │ │ │ @@ -40,51 +40,51 @@
│ │ │ │  <li><a class="reference internal" href="#partial-piece-info" id="toc-entry-4">partial_piece_info</a></li>
│ │ │ │  <li><a class="reference internal" href="#torrent-handle" id="toc-entry-5">torrent_handle</a><ul>
│ │ │ │  <li><a class="reference internal" href="#torrent-handle-1" id="toc-entry-6">torrent_handle()</a></li>
│ │ │ │  <li><a class="reference internal" href="#add-piece" id="toc-entry-7">add_piece()</a></li>
│ │ │ │  <li><a class="reference internal" href="#read-piece" id="toc-entry-8">read_piece()</a></li>
│ │ │ │  <li><a class="reference internal" href="#have-piece" id="toc-entry-9">have_piece()</a></li>
│ │ │ │  <li><a class="reference internal" href="#post-peer-info-get-peer-info" id="toc-entry-10">post_peer_info() get_peer_info()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#post-status-status" id="toc-entry-11">post_status() status()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#status-post-status" id="toc-entry-11">status() post_status()</a></li>
│ │ │ │  <li><a class="reference internal" href="#post-download-queue-get-download-queue" id="toc-entry-12">post_download_queue() get_download_queue()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-piece-deadline-reset-piece-deadline-clear-piece-deadlines" id="toc-entry-13">set_piece_deadline() reset_piece_deadline() clear_piece_deadlines()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-progress-post-file-progress" id="toc-entry-14">file_progress() post_file_progress()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#clear-piece-deadlines-set-piece-deadline-reset-piece-deadline" id="toc-entry-13">clear_piece_deadlines() set_piece_deadline() reset_piece_deadline()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#post-file-progress-file-progress" id="toc-entry-14">post_file_progress() file_progress()</a></li>
│ │ │ │  <li><a class="reference internal" href="#file-status" id="toc-entry-15">file_status()</a></li>
│ │ │ │  <li><a class="reference internal" href="#clear-error" id="toc-entry-16">clear_error()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-tracker-replace-trackers-trackers-post-trackers" id="toc-entry-17">add_tracker() replace_trackers() trackers() post_trackers()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#remove-url-seed-add-url-seed-url-seeds" id="toc-entry-18">remove_url_seed() add_url_seed() url_seeds()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#http-seeds-add-http-seed-remove-http-seed" id="toc-entry-19">http_seeds() add_http_seed() remove_http_seed()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-tracker-post-trackers-replace-trackers-trackers" id="toc-entry-17">add_tracker() post_trackers() replace_trackers() trackers()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#remove-url-seed-url-seeds-add-url-seed" id="toc-entry-18">remove_url_seed() url_seeds() add_url_seed()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#http-seeds-remove-http-seed-add-http-seed" id="toc-entry-19">http_seeds() remove_http_seed() add_http_seed()</a></li>
│ │ │ │  <li><a class="reference internal" href="#add-extension" id="toc-entry-20">add_extension()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-metadata" id="toc-entry-21">set_metadata()</a></li>
│ │ │ │  <li><a class="reference internal" href="#is-valid" id="toc-entry-22">is_valid()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#resume-pause" id="toc-entry-23">resume() pause()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#flags-unset-flags-set-flags" id="toc-entry-24">flags() unset_flags() set_flags()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#pause-resume" id="toc-entry-23">pause() resume()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#unset-flags-set-flags-flags" id="toc-entry-24">unset_flags() set_flags() flags()</a></li>
│ │ │ │  <li><a class="reference internal" href="#flush-cache" id="toc-entry-25">flush_cache()</a></li>
│ │ │ │  <li><a class="reference internal" href="#force-recheck" id="toc-entry-26">force_recheck()</a></li>
│ │ │ │  <li><a class="reference internal" href="#save-resume-data" id="toc-entry-27">save_resume_data()</a></li>
│ │ │ │  <li><a class="reference internal" href="#need-save-resume-data" id="toc-entry-28">need_save_resume_data()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#queue-position-down-queue-position-queue-position-top-queue-position-bottom-queue-position-up" id="toc-entry-29">queue_position_down() queue_position() queue_position_top() queue_position_bottom() queue_position_up()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#queue-position-down-queue-position-bottom-queue-position-queue-position-top-queue-position-up" id="toc-entry-29">queue_position_down() queue_position_bottom() queue_position() queue_position_top() queue_position_up()</a></li>
│ │ │ │  <li><a class="reference internal" href="#queue-position-set" id="toc-entry-30">queue_position_set()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-ssl-certificate-set-ssl-certificate-buffer" id="toc-entry-31">set_ssl_certificate() set_ssl_certificate_buffer()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-file-torrent-file-with-hashes" id="toc-entry-32">torrent_file() torrent_file_with_hashes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-ssl-certificate-buffer-set-ssl-certificate" id="toc-entry-31">set_ssl_certificate_buffer() set_ssl_certificate()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-file-with-hashes-torrent-file" id="toc-entry-32">torrent_file_with_hashes() torrent_file()</a></li>
│ │ │ │  <li><a class="reference internal" href="#piece-layers" id="toc-entry-33">piece_layers()</a></li>
│ │ │ │  <li><a class="reference internal" href="#post-piece-availability-piece-availability" id="toc-entry-34">post_piece_availability() piece_availability()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-priority-prioritize-pieces-get-piece-priorities" id="toc-entry-35">piece_priority() prioritize_pieces() get_piece_priorities()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-priority-prioritize-files-get-file-priorities" id="toc-entry-36">file_priority() prioritize_files() get_file_priorities()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#force-reannounce-force-dht-announce-force-lsd-announce" id="toc-entry-37">force_reannounce() force_dht_announce() force_lsd_announce()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#prioritize-pieces-piece-priority-get-piece-priorities" id="toc-entry-35">prioritize_pieces() piece_priority() get_piece_priorities()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-priority-get-file-priorities-prioritize-files" id="toc-entry-36">file_priority() get_file_priorities() prioritize_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#force-dht-announce-force-reannounce-force-lsd-announce" id="toc-entry-37">force_dht_announce() force_reannounce() force_lsd_announce()</a></li>
│ │ │ │  <li><a class="reference internal" href="#scrape-tracker" id="toc-entry-38">scrape_tracker()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#download-limit-set-upload-limit-upload-limit-set-download-limit" id="toc-entry-39">download_limit() set_upload_limit() upload_limit() set_download_limit()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-upload-limit-upload-limit-download-limit-set-download-limit" id="toc-entry-39">set_upload_limit() upload_limit() download_limit() set_download_limit()</a></li>
│ │ │ │  <li><a class="reference internal" href="#connect-peer" id="toc-entry-40">connect_peer()</a></li>
│ │ │ │  <li><a class="reference internal" href="#clear-peers" id="toc-entry-41">clear_peers()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-max-uploads-max-uploads" id="toc-entry-42">set_max_uploads() max_uploads()</a></li>
│ │ │ │  <li><a class="reference internal" href="#set-max-connections-max-connections" id="toc-entry-43">set_max_connections() max_connections()</a></li>
│ │ │ │  <li><a class="reference internal" href="#move-storage" id="toc-entry-44">move_storage()</a></li>
│ │ │ │  <li><a class="reference internal" href="#rename-file" id="toc-entry-45">rename_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#info-hash-info-hashes" id="toc-entry-46">info_hash() info_hashes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#operator-operator-operator" id="toc-entry-47">operator&lt;() operator!=() operator==()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#info-hashes-info-hash" id="toc-entry-46">info_hashes() info_hash()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-operator-operator" id="toc-entry-47">operator!=() operator&lt;() operator==()</a></li>
│ │ │ │  <li><a class="reference internal" href="#id" id="toc-entry-48">id()</a></li>
│ │ │ │  <li><a class="reference internal" href="#native-handle" id="toc-entry-49">native_handle()</a></li>
│ │ │ │  <li><a class="reference internal" href="#userdata" id="toc-entry-50">userdata()</a></li>
│ │ │ │  <li><a class="reference internal" href="#in-session" id="toc-entry-51">in_session()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  <li><a class="reference internal" href="#hash-value" id="toc-entry-52">hash_value()</a></li>
│ │ │ │ @@ -94,16 +94,16 @@
│ │ │ │  <h1>block_info</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │  <p>holds the state of a block in a piece. Who we requested
│ │ │ │  it from and how far along we are at downloading it.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct block_info
│ │ │ │  {
│ │ │ │ -   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>peer</strong> () const;
│ │ │ │     void <strong>set_peer</strong> (tcp::endpoint const&amp; ep);
│ │ │ │ +   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>peer</strong> () const;
│ │ │ │  
│ │ │ │     enum block_state_t
│ │ │ │     {
│ │ │ │        none,
│ │ │ │        requested,
│ │ │ │        writing,
│ │ │ │        finished,
│ │ │ │ @@ -115,16 +115,16 @@
│ │ │ │     unsigned num_peers:14;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="peer()"></a>
│ │ │ │  <a name="set_peer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bpeer%28%29+set_peer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bpeer%28%29+set_peer%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="peer-set-peer">
│ │ │ │  <h2>peer() set_peer()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -<a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>peer</strong> () const;
│ │ │ │  void <strong>set_peer</strong> (tcp::endpoint const&amp; ep);
│ │ │ │ +<a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>peer</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>The peer is the ip address of the peer this block was downloaded from.</p>
│ │ │ │  <a name="block_state_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+block_state_t&labels=documentation&body=Documentation+under+heading+%22enum+block_state_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="enum-block-state-t">
│ │ │ │  <h2>enum block_state_t</h2>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │ @@ -267,106 +267,106 @@
│ │ │ │  {
│ │ │ │     friend std::size_t <strong>hash_value</strong> (torrent_handle const&amp; th);
│ │ │ │     <strong>torrent_handle</strong> () noexcept = default;
│ │ │ │     void <strong>add_piece</strong> (piece_index_t piece, std::vector&lt;char&gt; data, add_piece_flags_t flags = {}) const;
│ │ │ │     void <strong>add_piece</strong> (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
│ │ │ │     void <strong>read_piece</strong> (piece_index_t piece) const;
│ │ │ │     bool <strong>have_piece</strong> (piece_index_t piece) const;
│ │ │ │ -   void <strong>post_peer_info</strong> () const;
│ │ │ │     void <strong>get_peer_info</strong> (std::vector&lt;peer_info&gt;&amp; v) const;
│ │ │ │ +   void <strong>post_peer_info</strong> () const;
│ │ │ │     torrent_status <strong>status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │     void <strong>post_status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │     void <strong>get_download_queue</strong> (std::vector&lt;partial_piece_info&gt;&amp; queue) const;
│ │ │ │     void <strong>post_download_queue</strong> () const;
│ │ │ │     std::vector&lt;partial_piece_info&gt; <strong>get_download_queue</strong> () const;
│ │ │ │ -   void <strong>set_piece_deadline</strong> (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
│ │ │ │ -   void <strong>reset_piece_deadline</strong> (piece_index_t index) const;
│ │ │ │     void <strong>clear_piece_deadlines</strong> () const;
│ │ │ │ +   void <strong>reset_piece_deadline</strong> (piece_index_t index) const;
│ │ │ │ +   void <strong>set_piece_deadline</strong> (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
│ │ │ │     void <strong>file_progress</strong> (std::vector&lt;std::int64_t&gt;&amp; progress, file_progress_flags_t flags = {}) const;
│ │ │ │     void <strong>post_file_progress</strong> (file_progress_flags_t flags) const;
│ │ │ │     std::vector&lt;std::int64_t&gt; <strong>file_progress</strong> (file_progress_flags_t flags = {}) const;
│ │ │ │     std::vector&lt;open_file_state&gt; <strong>file_status</strong> () const;
│ │ │ │     void <strong>clear_error</strong> () const;
│ │ │ │ +   void <strong>replace_trackers</strong> (std::vector&lt;announce_entry&gt; const&amp;) const;
│ │ │ │     void <strong>add_tracker</strong> (announce_entry const&amp;) const;
│ │ │ │     std::vector&lt;announce_entry&gt; <strong>trackers</strong> () const;
│ │ │ │ -   void <strong>replace_trackers</strong> (std::vector&lt;announce_entry&gt; const&amp;) const;
│ │ │ │     void <strong>post_trackers</strong> () const;
│ │ │ │ +   void <strong>add_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │     void <strong>remove_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │     std::set&lt;std::string&gt; <strong>url_seeds</strong> () const;
│ │ │ │ -   void <strong>add_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │ -   std::set&lt;std::string&gt; <strong>http_seeds</strong> () const;
│ │ │ │     void <strong>remove_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │     void <strong>add_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +   std::set&lt;std::string&gt; <strong>http_seeds</strong> () const;
│ │ │ │     void <strong>add_extension</strong> (
│ │ │ │        std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(torrent_handle const&amp;, client_data_t)&gt; const&amp; ext
│ │ │ │        , client_data_t userdata = client_data_t{});
│ │ │ │     bool <strong>set_metadata</strong> (span&lt;char const&gt; metadata) const;
│ │ │ │     bool <strong>is_valid</strong> () const;
│ │ │ │     void <strong>pause</strong> (pause_flags_t flags = {}) const;
│ │ │ │     void <strong>resume</strong> () const;
│ │ │ │ -   void <strong>set_flags</strong> (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ -   void <strong>set_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ -   torrent_flags_t <strong>flags</strong> () const;
│ │ │ │     void <strong>unset_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ +   torrent_flags_t <strong>flags</strong> () const;
│ │ │ │ +   void <strong>set_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ +   void <strong>set_flags</strong> (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │     void <strong>flush_cache</strong> () const;
│ │ │ │     void <strong>force_recheck</strong> () const;
│ │ │ │     void <strong>save_resume_data</strong> (resume_data_flags_t flags = {}) const;
│ │ │ │     bool <strong>need_save_resume_data</strong> (resume_data_flags_t flags) const;
│ │ │ │     bool <strong>need_save_resume_data</strong> () const;
│ │ │ │ -   void <strong>queue_position_bottom</strong> () const;
│ │ │ │ -   void <strong>queue_position_top</strong> () const;
│ │ │ │     void <strong>queue_position_up</strong> () const;
│ │ │ │ +   void <strong>queue_position_bottom</strong> () const;
│ │ │ │     queue_position_t <strong>queue_position</strong> () const;
│ │ │ │     void <strong>queue_position_down</strong> () const;
│ │ │ │ +   void <strong>queue_position_top</strong> () const;
│ │ │ │     void <strong>queue_position_set</strong> (queue_position_t p) const;
│ │ │ │ -   void <strong>set_ssl_certificate_buffer</strong> (std::string const&amp; certificate
│ │ │ │ -      , std::string const&amp; private_key
│ │ │ │ -      , std::string const&amp; dh_params);
│ │ │ │     void <strong>set_ssl_certificate</strong> (std::string const&amp; certificate
│ │ │ │        , std::string const&amp; private_key
│ │ │ │        , std::string const&amp; dh_params
│ │ │ │        , std::string const&amp; passphrase = &quot;&quot;);
│ │ │ │ -   std::shared_ptr&lt;const torrent_info&gt; <strong>torrent_file</strong> () const;
│ │ │ │ +   void <strong>set_ssl_certificate_buffer</strong> (std::string const&amp; certificate
│ │ │ │ +      , std::string const&amp; private_key
│ │ │ │ +      , std::string const&amp; dh_params);
│ │ │ │     std::shared_ptr&lt;torrent_info&gt; <strong>torrent_file_with_hashes</strong> () const;
│ │ │ │ +   std::shared_ptr&lt;const torrent_info&gt; <strong>torrent_file</strong> () const;
│ │ │ │     std::vector&lt;std::vector&lt;sha256_hash&gt;&gt; <strong>piece_layers</strong> () const;
│ │ │ │ -   void <strong>piece_availability</strong> (std::vector&lt;int&gt;&amp; avail) const;
│ │ │ │     void <strong>post_piece_availability</strong> () const;
│ │ │ │ -   void <strong>prioritize_pieces</strong> (std::vector&lt;download_priority_t&gt; const&amp; pieces) const;
│ │ │ │ -   std::vector&lt;download_priority_t&gt; <strong>get_piece_priorities</strong> () const;
│ │ │ │ -   void <strong>prioritize_pieces</strong> (std::vector&lt;std::pair&lt;piece_index_t, download_priority_t&gt;&gt; const&amp; pieces) const;
│ │ │ │ +   void <strong>piece_availability</strong> (std::vector&lt;int&gt;&amp; avail) const;
│ │ │ │     void <strong>piece_priority</strong> (piece_index_t index, download_priority_t priority) const;
│ │ │ │     download_priority_t <strong>piece_priority</strong> (piece_index_t index) const;
│ │ │ │ +   void <strong>prioritize_pieces</strong> (std::vector&lt;download_priority_t&gt; const&amp; pieces) const;
│ │ │ │ +   void <strong>prioritize_pieces</strong> (std::vector&lt;std::pair&lt;piece_index_t, download_priority_t&gt;&gt; const&amp; pieces) const;
│ │ │ │ +   std::vector&lt;download_priority_t&gt; <strong>get_piece_priorities</strong> () const;
│ │ │ │     std::vector&lt;download_priority_t&gt; <strong>get_file_priorities</strong> () const;
│ │ │ │ -   void <strong>file_priority</strong> (file_index_t index, download_priority_t priority) const;
│ │ │ │     void <strong>prioritize_files</strong> (std::vector&lt;download_priority_t&gt; const&amp; files) const;
│ │ │ │     download_priority_t <strong>file_priority</strong> (file_index_t index) const;
│ │ │ │ +   void <strong>file_priority</strong> (file_index_t index, download_priority_t priority) const;
│ │ │ │ +   void <strong>force_reannounce</strong> (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
│ │ │ │     void <strong>force_dht_announce</strong> () const;
│ │ │ │     void <strong>force_lsd_announce</strong> () const;
│ │ │ │ -   void <strong>force_reannounce</strong> (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
│ │ │ │     void <strong>scrape_tracker</strong> (int idx = -1) const;
│ │ │ │ -   int <strong>upload_limit</strong> () const;
│ │ │ │     void <strong>set_download_limit</strong> (int limit) const;
│ │ │ │ -   int <strong>download_limit</strong> () const;
│ │ │ │ +   int <strong>upload_limit</strong> () const;
│ │ │ │     void <strong>set_upload_limit</strong> (int limit) const;
│ │ │ │ +   int <strong>download_limit</strong> () const;
│ │ │ │     void <strong>connect_peer</strong> (tcp::endpoint const&amp; adr, peer_source_flags_t source = {}
│ │ │ │        , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
│ │ │ │     void <strong>clear_peers</strong> ();
│ │ │ │     int <strong>max_uploads</strong> () const;
│ │ │ │     void <strong>set_max_uploads</strong> (int max_uploads) const;
│ │ │ │ -   int <strong>max_connections</strong> () const;
│ │ │ │     void <strong>set_max_connections</strong> (int max_connections) const;
│ │ │ │ +   int <strong>max_connections</strong> () const;
│ │ │ │     void <strong>move_storage</strong> (std::string const&amp; save_path
│ │ │ │        , move_flags_t flags = move_flags_t::always_replace_files
│ │ │ │        ) const;
│ │ │ │     void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_name) const;
│ │ │ │     sha1_hash <strong>info_hash</strong> () const;
│ │ │ │     info_hash_t <strong>info_hashes</strong> () const;
│ │ │ │ +   bool <strong>operator==</strong> (const torrent_handle&amp; h) const;
│ │ │ │     bool <strong>operator!=</strong> (const torrent_handle&amp; h) const;
│ │ │ │     bool <strong>operator&lt;</strong> (const torrent_handle&amp; h) const;
│ │ │ │ -   bool <strong>operator==</strong> (const torrent_handle&amp; h) const;
│ │ │ │     std::uint32_t <strong>id</strong> () const;
│ │ │ │     std::shared_ptr&lt;torrent&gt; <strong>native_handle</strong> () const;
│ │ │ │     client_data_t <strong>userdata</strong> () const;
│ │ │ │     bool <strong>in_session</strong> () const;
│ │ │ │  
│ │ │ │     static constexpr add_piece_flags_t <strong>overwrite_existing</strong>  = 0_bit;
│ │ │ │     static constexpr status_flags_t <strong>query_distributed_copies</strong>  = 0_bit;
│ │ │ │ @@ -449,31 +449,31 @@
│ │ │ │  <p>Returns true if this piece has been completely downloaded and written
│ │ │ │  to disk, and false otherwise.</p>
│ │ │ │  <a name="post_peer_info()"></a>
│ │ │ │  <a name="get_peer_info()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpost_peer_info%28%29+get_peer_info%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpost_peer_info%28%29+get_peer_info%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="post-peer-info-get-peer-info">
│ │ │ │  <h2>post_peer_info() get_peer_info()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>post_peer_info</strong> () const;
│ │ │ │  void <strong>get_peer_info</strong> (std::vector&lt;peer_info&gt;&amp; v) const;
│ │ │ │ +void <strong>post_peer_info</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>Query information about connected peers for this torrent. If the
│ │ │ │  <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is invalid, it will throw a system_error exception.</p>
│ │ │ │  <p><tt class="docutils literal">post_peer_info()</tt> is asynchronous and will trigger the posting of
│ │ │ │  a <a class="reference external" href="reference-Alerts.html#peer_info_alert">peer_info_alert</a>. The <a class="reference external" href="reference-Alerts.html#alert">alert</a> contain a list of <a class="reference external" href="reference-Core.html#peer_info">peer_info</a> objects, one
│ │ │ │  for each connected peer.</p>
│ │ │ │  <p><tt class="docutils literal">get_peer_info()</tt> is synchronous and takes a reference to a vector
│ │ │ │  that will be cleared and filled with one <a class="reference external" href="reference-Bencoding.html#entry">entry</a> for each peer
│ │ │ │  connected to this torrent, given the handle is valid. Each <a class="reference external" href="reference-Bencoding.html#entry">entry</a> in
│ │ │ │  the vector contains information about that particular peer. See
│ │ │ │  <a class="reference external" href="reference-Core.html#peer_info">peer_info</a>.</p>
│ │ │ │ -<a name="post_status()"></a>
│ │ │ │ -<a name="status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpost_status%28%29+status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpost_status%28%29+status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="post-status-status">
│ │ │ │ -<h2>post_status() status()</h2>
│ │ │ │ +<a name="status()"></a>
│ │ │ │ +<a name="post_status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bstatus%28%29+post_status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bstatus%28%29+post_status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="status-post-status">
│ │ │ │ +<h2>status() post_status()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  torrent_status <strong>status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │  void <strong>post_status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">status()</tt> will return a structure with information about the status
│ │ │ │  of this torrent. If the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is invalid, it will throw
│ │ │ │  system_error exception. See <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a>. The <tt class="docutils literal">flags</tt>
│ │ │ │ @@ -501,23 +501,23 @@
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">post_download_queue()</tt> triggers a download_queue_alert to be
│ │ │ │  posted.
│ │ │ │  <tt class="docutils literal">get_download_queue()</tt> is a synchronous call and returns a vector
│ │ │ │  with information about pieces that are partially downloaded or not
│ │ │ │  downloaded but partially requested. See <a class="reference external" href="reference-Torrent_Handle.html#partial_piece_info">partial_piece_info</a> for the
│ │ │ │  fields in the returned vector.</p>
│ │ │ │ +<a name="clear_piece_deadlines()"></a>
│ │ │ │  <a name="set_piece_deadline()"></a>
│ │ │ │ -<a name="reset_piece_deadline()"></a>
│ │ │ │ -<a name="clear_piece_deadlines()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_piece_deadline%28%29+reset_piece_deadline%28%29+clear_piece_deadlines%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_piece_deadline%28%29+reset_piece_deadline%28%29+clear_piece_deadlines%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-piece-deadline-reset-piece-deadline-clear-piece-deadlines">
│ │ │ │ -<h2>set_piece_deadline() reset_piece_deadline() clear_piece_deadlines()</h2>
│ │ │ │ +<a name="reset_piece_deadline()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bclear_piece_deadlines%28%29+set_piece_deadline%28%29+reset_piece_deadline%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bclear_piece_deadlines%28%29+set_piece_deadline%28%29+reset_piece_deadline%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="clear-piece-deadlines-set-piece-deadline-reset-piece-deadline">
│ │ │ │ +<h2>clear_piece_deadlines() set_piece_deadline() reset_piece_deadline()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_piece_deadline</strong> (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
│ │ │ │ -void <strong>reset_piece_deadline</strong> (piece_index_t index) const;
│ │ │ │  void <strong>clear_piece_deadlines</strong> () const;
│ │ │ │ +void <strong>reset_piece_deadline</strong> (piece_index_t index) const;
│ │ │ │ +void <strong>set_piece_deadline</strong> (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
│ │ │ │  </pre>
│ │ │ │  <p>This function sets or resets the deadline associated with a specific
│ │ │ │  piece index (<tt class="docutils literal">index</tt>). libtorrent will attempt to download this
│ │ │ │  entire piece before the deadline expires. This is not necessarily
│ │ │ │  possible, but pieces with a more recent deadline will always be
│ │ │ │  prioritized over pieces with a deadline further ahead in time. The
│ │ │ │  deadline (and flags) of a piece can be changed by calling this
│ │ │ │ @@ -528,18 +528,18 @@
│ │ │ │  <p><tt class="docutils literal">deadline</tt> is the number of milliseconds until this piece should be
│ │ │ │  completed.</p>
│ │ │ │  <p><tt class="docutils literal">reset_piece_deadline</tt> removes the deadline from the piece. If it
│ │ │ │  hasn't already been downloaded, it will no longer be considered a
│ │ │ │  priority.</p>
│ │ │ │  <p><tt class="docutils literal">clear_piece_deadlines()</tt> removes deadlines on all pieces in
│ │ │ │  the torrent. As if <a class="reference external" href="reference-Torrent_Handle.html#reset_piece_deadline()">reset_piece_deadline()</a> was called on all pieces.</p>
│ │ │ │ -<a name="file_progress()"></a>
│ │ │ │ -<a name="post_file_progress()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bfile_progress%28%29+post_file_progress%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bfile_progress%28%29+post_file_progress%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-progress-post-file-progress">
│ │ │ │ -<h2>file_progress() post_file_progress()</h2>
│ │ │ │ +<a name="post_file_progress()"></a>
│ │ │ │ +<a name="file_progress()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpost_file_progress%28%29+file_progress%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpost_file_progress%28%29+file_progress%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="post-file-progress-file-progress">
│ │ │ │ +<h2>post_file_progress() file_progress()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>file_progress</strong> (std::vector&lt;std::int64_t&gt;&amp; progress, file_progress_flags_t flags = {}) const;
│ │ │ │  void <strong>post_file_progress</strong> (file_progress_flags_t flags) const;
│ │ │ │  std::vector&lt;std::int64_t&gt; <strong>file_progress</strong> (file_progress_flags_t flags = {}) const;
│ │ │ │  </pre>
│ │ │ │  <p>This function fills in the supplied vector, or returns a vector, with
│ │ │ │  the number of bytes downloaded of each file in this torrent. The
│ │ │ │ @@ -573,23 +573,23 @@
│ │ │ │  <h2>clear_error()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>clear_error</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>If the torrent is in an error state (i.e. <tt class="docutils literal"><span class="pre">torrent_status::error</span></tt> is
│ │ │ │  non-empty), this will clear the error and start the torrent again.</p>
│ │ │ │  <a name="add_tracker()"></a>
│ │ │ │ +<a name="post_trackers()"></a>
│ │ │ │  <a name="replace_trackers()"></a>
│ │ │ │ -<a name="trackers()"></a>
│ │ │ │ -<a name="post_trackers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Badd_tracker%28%29+replace_trackers%28%29+trackers%28%29+post_trackers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Badd_tracker%28%29+replace_trackers%28%29+trackers%28%29+post_trackers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-tracker-replace-trackers-trackers-post-trackers">
│ │ │ │ -<h2>add_tracker() replace_trackers() trackers() post_trackers()</h2>
│ │ │ │ +<a name="trackers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Badd_tracker%28%29+post_trackers%28%29+replace_trackers%28%29+trackers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Badd_tracker%28%29+post_trackers%28%29+replace_trackers%28%29+trackers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-tracker-post-trackers-replace-trackers-trackers">
│ │ │ │ +<h2>add_tracker() post_trackers() replace_trackers() trackers()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +void <strong>replace_trackers</strong> (std::vector&lt;announce_entry&gt; const&amp;) const;
│ │ │ │  void <strong>add_tracker</strong> (announce_entry const&amp;) const;
│ │ │ │  std::vector&lt;announce_entry&gt; <strong>trackers</strong> () const;
│ │ │ │ -void <strong>replace_trackers</strong> (std::vector&lt;announce_entry&gt; const&amp;) const;
│ │ │ │  void <strong>post_trackers</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">trackers()</tt> returns the list of trackers for this torrent. The
│ │ │ │  announce <a class="reference external" href="reference-Bencoding.html#entry">entry</a> contains both a string <tt class="docutils literal">url</tt> which specify the
│ │ │ │  announce url for the tracker as well as an <a class="reference external" href="reference-Core.html#int">int</a> <tt class="docutils literal">tier</tt>, which is
│ │ │ │  specifies the order in which this tracker is tried. If you want
│ │ │ │  libtorrent to use another list of trackers for this torrent, you can
│ │ │ │ @@ -603,41 +603,41 @@
│ │ │ │  set. If it is, it doesn't do anything. If it's not in the current set
│ │ │ │  of trackers, it will insert it in the tier specified in the
│ │ │ │  <a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a>.</p>
│ │ │ │  <p>The updated set of trackers will be saved in the resume data, and when
│ │ │ │  a torrent is started with resume data, the trackers from the resume
│ │ │ │  data will replace the original ones.</p>
│ │ │ │  <a name="remove_url_seed()"></a>
│ │ │ │ -<a name="add_url_seed()"></a>
│ │ │ │ -<a name="url_seeds()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bremove_url_seed%28%29+add_url_seed%28%29+url_seeds%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bremove_url_seed%28%29+add_url_seed%28%29+url_seeds%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="remove-url-seed-add-url-seed-url-seeds">
│ │ │ │ -<h2>remove_url_seed() add_url_seed() url_seeds()</h2>
│ │ │ │ +<a name="url_seeds()"></a>
│ │ │ │ +<a name="add_url_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bremove_url_seed%28%29+url_seeds%28%29+add_url_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bremove_url_seed%28%29+url_seeds%28%29+add_url_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="remove-url-seed-url-seeds-add-url-seed">
│ │ │ │ +<h2>remove_url_seed() url_seeds() add_url_seed()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +void <strong>add_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │  void <strong>remove_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │  std::set&lt;std::string&gt; <strong>url_seeds</strong> () const;
│ │ │ │ -void <strong>add_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">add_url_seed()</tt> adds another url to the torrent's list of url
│ │ │ │  seeds. If the given url already exists in that list, the call has no
│ │ │ │  effect. The torrent will connect to the server and try to download
│ │ │ │  pieces from it, unless it's paused, queued, checking or seeding.
│ │ │ │  <tt class="docutils literal">remove_url_seed()</tt> removes the given url if it exists already.
│ │ │ │  <tt class="docutils literal">url_seeds()</tt> return a set of the url seeds currently in this
│ │ │ │  torrent. Note that URLs that fails may be removed automatically from
│ │ │ │  the list.</p>
│ │ │ │  <p>See <a class="reference external" href="manual-ref.html#http-seeding">http seeding</a> for more information.</p>
│ │ │ │  <a name="http_seeds()"></a>
│ │ │ │ -<a name="add_http_seed()"></a>
│ │ │ │ -<a name="remove_http_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bhttp_seeds%28%29+add_http_seed%28%29+remove_http_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bhttp_seeds%28%29+add_http_seed%28%29+remove_http_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="http-seeds-add-http-seed-remove-http-seed">
│ │ │ │ -<h2>http_seeds() add_http_seed() remove_http_seed()</h2>
│ │ │ │ +<a name="remove_http_seed()"></a>
│ │ │ │ +<a name="add_http_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bhttp_seeds%28%29+remove_http_seed%28%29+add_http_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bhttp_seeds%28%29+remove_http_seed%28%29+add_http_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="http-seeds-remove-http-seed-add-http-seed">
│ │ │ │ +<h2>http_seeds() remove_http_seed() add_http_seed()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::set&lt;std::string&gt; <strong>http_seeds</strong> () const;
│ │ │ │  void <strong>remove_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │  void <strong>add_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +std::set&lt;std::string&gt; <strong>http_seeds</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>These functions are identical as the <tt class="docutils literal">*_url_seed()</tt> variants, but
│ │ │ │  they operate on <a class="reference external" href="https://www.bittorrent.org/beps/bep_0017.html">BEP 17</a> web seeds instead of <a class="reference external" href="https://www.bittorrent.org/beps/bep_0019.html">BEP 19</a>.</p>
│ │ │ │  <p>See <a class="reference external" href="manual-ref.html#http-seeding">http seeding</a> for more information.</p>
│ │ │ │  <a name="add_extension()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Badd_extension%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Badd_extension%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="add-extension">
│ │ │ │  <h2>add_extension()</h2>
│ │ │ │ @@ -679,18 +679,18 @@
│ │ │ │  afterward.</p>
│ │ │ │  <p>Clients should only use <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a> to determine if the result of
│ │ │ │  session::find_torrent() was successful.</p>
│ │ │ │  <p>Unlike other member functions which return a value, <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a>
│ │ │ │  completes immediately, without blocking on a result from the
│ │ │ │  network thread. Also unlike other functions, it never throws
│ │ │ │  the system_error exception.</p>
│ │ │ │ -<a name="resume()"></a>
│ │ │ │ -<a name="pause()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bresume%28%29+pause%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bresume%28%29+pause%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="resume-pause">
│ │ │ │ -<h2>resume() pause()</h2>
│ │ │ │ +<a name="pause()"></a>
│ │ │ │ +<a name="resume()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpause%28%29+resume%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpause%28%29+resume%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="pause-resume">
│ │ │ │ +<h2>pause() resume()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>pause</strong> (pause_flags_t flags = {}) const;
│ │ │ │  void <strong>resume</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">pause()</tt>, and <tt class="docutils literal">resume()</tt> will disconnect all peers and reconnect
│ │ │ │  all peers respectively. When a torrent is paused, it will however
│ │ │ │  remember all share ratios to all peers and remember all potential (not
│ │ │ │ @@ -704,24 +704,24 @@
│ │ │ │  <div class="admonition note">
│ │ │ │  <p class="first admonition-title">Note</p>
│ │ │ │  <p class="last">Torrents that are auto-managed may be automatically resumed again. It
│ │ │ │  does not make sense to pause an auto-managed torrent without making it
│ │ │ │  not auto-managed first. Torrents are auto-managed by default when added
│ │ │ │  to the <a class="reference external" href="reference-Session.html#session">session</a>. For more information, see <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</p>
│ │ │ │  </div>
│ │ │ │ -<a name="flags()"></a>
│ │ │ │  <a name="unset_flags()"></a>
│ │ │ │ -<a name="set_flags()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bflags%28%29+unset_flags%28%29+set_flags%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bflags%28%29+unset_flags%28%29+set_flags%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="flags-unset-flags-set-flags">
│ │ │ │ -<h2>flags() unset_flags() set_flags()</h2>
│ │ │ │ +<a name="set_flags()"></a>
│ │ │ │ +<a name="flags()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bunset_flags%28%29+set_flags%28%29+flags%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bunset_flags%28%29+set_flags%28%29+flags%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="unset-flags-set-flags-flags">
│ │ │ │ +<h2>unset_flags() set_flags() flags()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_flags</strong> (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ -void <strong>set_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ -torrent_flags_t <strong>flags</strong> () const;
│ │ │ │  void <strong>unset_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ +torrent_flags_t <strong>flags</strong> () const;
│ │ │ │ +void <strong>set_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ +void <strong>set_flags</strong> (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │  </pre>
│ │ │ │  <p>sets and gets the torrent state flags. See <a class="reference external" href="reference-Core.html#torrent_flags_t">torrent_flags_t</a>.
│ │ │ │  The <tt class="docutils literal">set_flags</tt> overload that take a mask will affect all
│ │ │ │  flags part of the mask, and set their values to what the
│ │ │ │  <tt class="docutils literal">flags</tt> argument is set to. This allows clearing and
│ │ │ │  setting flags in a single function call.
│ │ │ │  The <tt class="docutils literal">set_flags</tt> overload that just takes flags, sets all
│ │ │ │ @@ -780,15 +780,15 @@
│ │ │ │  <li>No torrent state has changed since the last saving of resume
│ │ │ │  data, and the only_if_modified flag is set.
│ │ │ │  metadata (see libtorrent's <a class="reference external" href="manual-ref.html#metadata-from-peers">metadata from peers</a> extension)</li>
│ │ │ │  </ol>
│ │ │ │  </blockquote>
│ │ │ │  <p>Note that some <a class="reference external" href="reference-Stats.html#counters">counters</a> may be outdated by the time you receive the fast resume data</p>
│ │ │ │  <p>When saving resume data because of shutting down, make sure not to
│ │ │ │ -<a class="reference external" href="reference-Custom_Storage.html#remove_torrent()">remove_torrent()</a> before you receive the <a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a>.
│ │ │ │ +<a class="reference external" href="reference-Session.html#remove_torrent()">remove_torrent()</a> before you receive the <a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a>.
│ │ │ │  There's no need to pause the <a class="reference external" href="reference-Session.html#session">session</a> or torrent when saving resume
│ │ │ │  data.</p>
│ │ │ │  <p>The paused state of a torrent is saved in the resume data, so pausing
│ │ │ │  all torrents before saving resume data will all torrents be restored
│ │ │ │  in a paused state.</p>
│ │ │ │  <div class="admonition note">
│ │ │ │  <p class="first admonition-title">Note</p>
│ │ │ │ @@ -878,26 +878,26 @@
│ │ │ │  <p class="first admonition-title">Note</p>
│ │ │ │  <p class="last">A torrent's resume data is considered saved as soon as the
│ │ │ │  <a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a> is posted. It is important to make sure this
│ │ │ │  <a class="reference external" href="reference-Alerts.html#alert">alert</a> is received and handled in order for this function to be
│ │ │ │  meaningful.</p>
│ │ │ │  </div>
│ │ │ │  <a name="queue_position_down()"></a>
│ │ │ │ +<a name="queue_position_bottom()"></a>
│ │ │ │  <a name="queue_position()"></a>
│ │ │ │  <a name="queue_position_top()"></a>
│ │ │ │ -<a name="queue_position_bottom()"></a>
│ │ │ │ -<a name="queue_position_up()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bqueue_position_down%28%29+queue_position%28%29+queue_position_top%28%29+queue_position_bottom%28%29+queue_position_up%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bqueue_position_down%28%29+queue_position%28%29+queue_position_top%28%29+queue_position_bottom%28%29+queue_position_up%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="queue-position-down-queue-position-queue-position-top-queue-position-bottom-queue-position-up">
│ │ │ │ -<h2>queue_position_down() queue_position() queue_position_top() queue_position_bottom() queue_position_up()</h2>
│ │ │ │ +<a name="queue_position_up()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bqueue_position_down%28%29+queue_position_bottom%28%29+queue_position%28%29+queue_position_top%28%29+queue_position_up%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bqueue_position_down%28%29+queue_position_bottom%28%29+queue_position%28%29+queue_position_top%28%29+queue_position_up%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="queue-position-down-queue-position-bottom-queue-position-queue-position-top-queue-position-up">
│ │ │ │ +<h2>queue_position_down() queue_position_bottom() queue_position() queue_position_top() queue_position_up()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>queue_position_bottom</strong> () const;
│ │ │ │ -void <strong>queue_position_top</strong> () const;
│ │ │ │  void <strong>queue_position_up</strong> () const;
│ │ │ │ +void <strong>queue_position_bottom</strong> () const;
│ │ │ │  queue_position_t <strong>queue_position</strong> () const;
│ │ │ │  void <strong>queue_position_down</strong> () const;
│ │ │ │ +void <strong>queue_position_top</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>Every torrent that is added is assigned a queue position exactly one
│ │ │ │  greater than the greatest queue position of all existing torrents.
│ │ │ │  Torrents that are being seeded have -1 as their queue position, since
│ │ │ │  they're no longer in line to be downloaded.</p>
│ │ │ │  <p>When a torrent is removed or turns into a seed, all torrents with
│ │ │ │  greater queue positions have their positions decreased to fill in the
│ │ │ │ @@ -916,26 +916,26 @@
│ │ │ │  <h2>queue_position_set()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>queue_position_set</strong> (queue_position_t p) const;
│ │ │ │  </pre>
│ │ │ │  <p>updates the position in the queue for this torrent. The relative order
│ │ │ │  of all other torrents remain intact but their numerical queue position
│ │ │ │  shifts to make space for this torrent's new position</p>
│ │ │ │ -<a name="set_ssl_certificate()"></a>
│ │ │ │ -<a name="set_ssl_certificate_buffer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_ssl_certificate%28%29+set_ssl_certificate_buffer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_ssl_certificate%28%29+set_ssl_certificate_buffer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-ssl-certificate-set-ssl-certificate-buffer">
│ │ │ │ -<h2>set_ssl_certificate() set_ssl_certificate_buffer()</h2>
│ │ │ │ +<a name="set_ssl_certificate_buffer()"></a>
│ │ │ │ +<a name="set_ssl_certificate()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_ssl_certificate_buffer%28%29+set_ssl_certificate%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_ssl_certificate_buffer%28%29+set_ssl_certificate%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-ssl-certificate-buffer-set-ssl-certificate">
│ │ │ │ +<h2>set_ssl_certificate_buffer() set_ssl_certificate()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_ssl_certificate_buffer</strong> (std::string const&amp; certificate
│ │ │ │ -      , std::string const&amp; private_key
│ │ │ │ -      , std::string const&amp; dh_params);
│ │ │ │  void <strong>set_ssl_certificate</strong> (std::string const&amp; certificate
│ │ │ │        , std::string const&amp; private_key
│ │ │ │        , std::string const&amp; dh_params
│ │ │ │        , std::string const&amp; passphrase = &quot;&quot;);
│ │ │ │ +void <strong>set_ssl_certificate_buffer</strong> (std::string const&amp; certificate
│ │ │ │ +      , std::string const&amp; private_key
│ │ │ │ +      , std::string const&amp; dh_params);
│ │ │ │  </pre>
│ │ │ │  <p>For SSL torrents, use this to specify a path to a .pem file to use as
│ │ │ │  this client's certificate. The certificate must be signed by the
│ │ │ │  certificate in the .torrent file to be valid.</p>
│ │ │ │  <p>The <a class="reference external" href="reference-Torrent_Handle.html#set_ssl_certificate_buffer()">set_ssl_certificate_buffer()</a> overload takes the actual certificate,
│ │ │ │  private key and DH params as strings, rather than paths to files.</p>
│ │ │ │  <p><tt class="docutils literal">cert</tt> is a path to the (signed) certificate in .pem format
│ │ │ │ @@ -951,21 +951,21 @@
│ │ │ │  <p>Note that when a torrent first starts up, and it needs a certificate,
│ │ │ │  it will suspend connecting to any peers until it has one. It's
│ │ │ │  typically desirable to resume the torrent after setting the SSL
│ │ │ │  certificate.</p>
│ │ │ │  <p>If you receive a <a class="reference external" href="reference-Alerts.html#torrent_need_cert_alert">torrent_need_cert_alert</a>, you need to call this to
│ │ │ │  provide a valid cert. If you don't have a cert you won't be allowed to
│ │ │ │  connect to any peers.</p>
│ │ │ │ -<a name="torrent_file()"></a>
│ │ │ │ -<a name="torrent_file_with_hashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Btorrent_file%28%29+torrent_file_with_hashes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Btorrent_file%28%29+torrent_file_with_hashes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-file-torrent-file-with-hashes">
│ │ │ │ -<h2>torrent_file() torrent_file_with_hashes()</h2>
│ │ │ │ +<a name="torrent_file_with_hashes()"></a>
│ │ │ │ +<a name="torrent_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Btorrent_file_with_hashes%28%29+torrent_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Btorrent_file_with_hashes%28%29+torrent_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-file-with-hashes-torrent-file">
│ │ │ │ +<h2>torrent_file_with_hashes() torrent_file()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::shared_ptr&lt;const torrent_info&gt; <strong>torrent_file</strong> () const;
│ │ │ │  std::shared_ptr&lt;torrent_info&gt; <strong>torrent_file_with_hashes</strong> () const;
│ │ │ │ +std::shared_ptr&lt;const torrent_info&gt; <strong>torrent_file</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p><a class="reference external" href="reference-Torrent_Handle.html#torrent_file()">torrent_file()</a> returns a pointer to the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object
│ │ │ │  associated with this torrent. The <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object may be a copy
│ │ │ │  of the internal object. If the torrent doesn't have metadata, the
│ │ │ │  pointer will not be initialized (i.e. a nullptr). The torrent may be
│ │ │ │  in a state without metadata only if it was started without a .torrent
│ │ │ │  file, e.g. by being added by magnet link.</p>
│ │ │ │ @@ -1002,37 +1002,37 @@
│ │ │ │  vector. This is a blocking call that will synchronize with the
│ │ │ │  libtorrent network thread.</p>
│ │ │ │  <a name="post_piece_availability()"></a>
│ │ │ │  <a name="piece_availability()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpost_piece_availability%28%29+piece_availability%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpost_piece_availability%28%29+piece_availability%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="post-piece-availability-piece-availability">
│ │ │ │  <h2>post_piece_availability() piece_availability()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>piece_availability</strong> (std::vector&lt;int&gt;&amp; avail) const;
│ │ │ │  void <strong>post_piece_availability</strong> () const;
│ │ │ │ +void <strong>piece_availability</strong> (std::vector&lt;int&gt;&amp; avail) const;
│ │ │ │  </pre>
│ │ │ │  <p>The piece availability is the number of peers that we are connected
│ │ │ │  that has advertised having a particular piece. This is the information
│ │ │ │  that libtorrent uses in order to prefer picking rare pieces.</p>
│ │ │ │  <p><tt class="docutils literal">post_piece_availability()</tt> will trigger a <a class="reference external" href="reference-Alerts.html#piece_availability_alert">piece_availability_alert</a>
│ │ │ │  to be posted.</p>
│ │ │ │  <p><tt class="docutils literal">piece_availability()</tt> fills the specified <tt class="docutils literal"><span class="pre">std::vector&lt;int&gt;</span></tt>
│ │ │ │  with the availability for each piece in this torrent. libtorrent does
│ │ │ │  not keep track of availability for seeds, so if the torrent is
│ │ │ │  seeding the availability for all pieces is reported as 0.</p>
│ │ │ │ -<a name="piece_priority()"></a>
│ │ │ │  <a name="prioritize_pieces()"></a>
│ │ │ │ -<a name="get_piece_priorities()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpiece_priority%28%29+prioritize_pieces%28%29+get_piece_priorities%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpiece_priority%28%29+prioritize_pieces%28%29+get_piece_priorities%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-priority-prioritize-pieces-get-piece-priorities">
│ │ │ │ -<h2>piece_priority() prioritize_pieces() get_piece_priorities()</h2>
│ │ │ │ +<a name="piece_priority()"></a>
│ │ │ │ +<a name="get_piece_priorities()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bprioritize_pieces%28%29+piece_priority%28%29+get_piece_priorities%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bprioritize_pieces%28%29+piece_priority%28%29+get_piece_priorities%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="prioritize-pieces-piece-priority-get-piece-priorities">
│ │ │ │ +<h2>prioritize_pieces() piece_priority() get_piece_priorities()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>prioritize_pieces</strong> (std::vector&lt;download_priority_t&gt; const&amp; pieces) const;
│ │ │ │ -std::vector&lt;download_priority_t&gt; <strong>get_piece_priorities</strong> () const;
│ │ │ │ -void <strong>prioritize_pieces</strong> (std::vector&lt;std::pair&lt;piece_index_t, download_priority_t&gt;&gt; const&amp; pieces) const;
│ │ │ │  void <strong>piece_priority</strong> (piece_index_t index, download_priority_t priority) const;
│ │ │ │  download_priority_t <strong>piece_priority</strong> (piece_index_t index) const;
│ │ │ │ +void <strong>prioritize_pieces</strong> (std::vector&lt;download_priority_t&gt; const&amp; pieces) const;
│ │ │ │ +void <strong>prioritize_pieces</strong> (std::vector&lt;std::pair&lt;piece_index_t, download_priority_t&gt;&gt; const&amp; pieces) const;
│ │ │ │ +std::vector&lt;download_priority_t&gt; <strong>get_piece_priorities</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>These functions are used to set and get the priority of individual
│ │ │ │  pieces. By default all pieces have priority 4. That means that the
│ │ │ │  random rarest first algorithm is effectively active for all pieces.
│ │ │ │  You may however change the priority of individual pieces. There are 8
│ │ │ │  priority levels. 0 means not to download the piece at all. Otherwise,
│ │ │ │  lower priority values means less likely to be picked. Piece priority
│ │ │ │ @@ -1055,23 +1055,23 @@
│ │ │ │  not allowed.</p>
│ │ │ │  <p><tt class="docutils literal">get_piece_priorities</tt> returns a vector with one element for each piece
│ │ │ │  in the torrent. Each element is the current priority of that piece.</p>
│ │ │ │  <p>It's possible to cancel the effect of <em>file</em> priorities by setting the
│ │ │ │  priorities for the affected pieces. Care has to be taken when mixing
│ │ │ │  usage of file- and piece priorities.</p>
│ │ │ │  <a name="file_priority()"></a>
│ │ │ │ -<a name="prioritize_files()"></a>
│ │ │ │ -<a name="get_file_priorities()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bfile_priority%28%29+prioritize_files%28%29+get_file_priorities%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bfile_priority%28%29+prioritize_files%28%29+get_file_priorities%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-priority-prioritize-files-get-file-priorities">
│ │ │ │ -<h2>file_priority() prioritize_files() get_file_priorities()</h2>
│ │ │ │ +<a name="get_file_priorities()"></a>
│ │ │ │ +<a name="prioritize_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bfile_priority%28%29+get_file_priorities%28%29+prioritize_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bfile_priority%28%29+get_file_priorities%28%29+prioritize_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-priority-get-file-priorities-prioritize-files">
│ │ │ │ +<h2>file_priority() get_file_priorities() prioritize_files()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::vector&lt;download_priority_t&gt; <strong>get_file_priorities</strong> () const;
│ │ │ │ -void <strong>file_priority</strong> (file_index_t index, download_priority_t priority) const;
│ │ │ │  void <strong>prioritize_files</strong> (std::vector&lt;download_priority_t&gt; const&amp; files) const;
│ │ │ │  download_priority_t <strong>file_priority</strong> (file_index_t index) const;
│ │ │ │ +void <strong>file_priority</strong> (file_index_t index, download_priority_t priority) const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">index</tt> must be in the range [0, number_of_files).</p>
│ │ │ │  <p><tt class="docutils literal">file_priority()</tt> queries or sets the priority of file <tt class="docutils literal">index</tt>.</p>
│ │ │ │  <p><tt class="docutils literal">prioritize_files()</tt> takes a vector that has at as many elements as
│ │ │ │  there are files in the torrent. Each <a class="reference external" href="reference-Bencoding.html#entry">entry</a> is the priority of that
│ │ │ │  file. The function sets the priorities of all the pieces in the
│ │ │ │  torrent based on the vector.</p>
│ │ │ │ @@ -1094,23 +1094,23 @@
│ │ │ │  <a class="reference external" href="reference-Alerts.html#file_prio_alert">file_prio_alert</a>.</p>
│ │ │ │  <p>When combining file- and piece priorities, the resume file will record
│ │ │ │  both. When loading the resume data, the file priorities will be applied
│ │ │ │  first, then the piece priorities.</p>
│ │ │ │  <p>Moving data from a file into the part file is currently not
│ │ │ │  supported. If a file has its priority set to 0 <em>after</em> it has already
│ │ │ │  been created, it will not be moved into the partfile.</p>
│ │ │ │ -<a name="force_reannounce()"></a>
│ │ │ │  <a name="force_dht_announce()"></a>
│ │ │ │ -<a name="force_lsd_announce()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bforce_reannounce%28%29+force_dht_announce%28%29+force_lsd_announce%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bforce_reannounce%28%29+force_dht_announce%28%29+force_lsd_announce%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="force-reannounce-force-dht-announce-force-lsd-announce">
│ │ │ │ -<h2>force_reannounce() force_dht_announce() force_lsd_announce()</h2>
│ │ │ │ +<a name="force_reannounce()"></a>
│ │ │ │ +<a name="force_lsd_announce()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bforce_dht_announce%28%29+force_reannounce%28%29+force_lsd_announce%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bforce_dht_announce%28%29+force_reannounce%28%29+force_lsd_announce%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="force-dht-announce-force-reannounce-force-lsd-announce">
│ │ │ │ +<h2>force_dht_announce() force_reannounce() force_lsd_announce()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +void <strong>force_reannounce</strong> (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
│ │ │ │  void <strong>force_dht_announce</strong> () const;
│ │ │ │  void <strong>force_lsd_announce</strong> () const;
│ │ │ │ -void <strong>force_reannounce</strong> (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">force_reannounce()</tt> will force this torrent to do another tracker
│ │ │ │  request, to receive new peers. The <tt class="docutils literal">seconds</tt> argument specifies how
│ │ │ │  many seconds from now to issue the tracker announces.</p>
│ │ │ │  <p>If the tracker's <tt class="docutils literal">min_interval</tt> has not passed since the last
│ │ │ │  announce, the forced announce will be scheduled to happen immediately
│ │ │ │  as the <tt class="docutils literal">min_interval</tt> expires. This is to honor trackers minimum
│ │ │ │ @@ -1134,25 +1134,25 @@
│ │ │ │  <tt class="docutils literal">idx</tt> is &gt;= 0, the tracker with the specified index will scraped.</p>
│ │ │ │  <p>A scrape request queries the tracker for statistics such as total
│ │ │ │  number of incomplete peers, complete peers, number of downloads etc.</p>
│ │ │ │  <p>This request will specifically update the <tt class="docutils literal">num_complete</tt> and
│ │ │ │  <tt class="docutils literal">num_incomplete</tt> fields in the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> struct once it
│ │ │ │  completes. When it completes, it will generate a <a class="reference external" href="reference-Alerts.html#scrape_reply_alert">scrape_reply_alert</a>.
│ │ │ │  If it fails, it will generate a <a class="reference external" href="reference-Alerts.html#scrape_failed_alert">scrape_failed_alert</a>.</p>
│ │ │ │ -<a name="download_limit()"></a>
│ │ │ │  <a name="set_upload_limit()"></a>
│ │ │ │  <a name="upload_limit()"></a>
│ │ │ │ -<a name="set_download_limit()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bdownload_limit%28%29+set_upload_limit%28%29+upload_limit%28%29+set_download_limit%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bdownload_limit%28%29+set_upload_limit%28%29+upload_limit%28%29+set_download_limit%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="download-limit-set-upload-limit-upload-limit-set-download-limit">
│ │ │ │ -<h2>download_limit() set_upload_limit() upload_limit() set_download_limit()</h2>
│ │ │ │ +<a name="download_limit()"></a>
│ │ │ │ +<a name="set_download_limit()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_upload_limit%28%29+upload_limit%28%29+download_limit%28%29+set_download_limit%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_upload_limit%28%29+upload_limit%28%29+download_limit%28%29+set_download_limit%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-upload-limit-upload-limit-download-limit-set-download-limit">
│ │ │ │ +<h2>set_upload_limit() upload_limit() download_limit() set_download_limit()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -int <strong>upload_limit</strong> () const;
│ │ │ │  void <strong>set_download_limit</strong> (int limit) const;
│ │ │ │ -int <strong>download_limit</strong> () const;
│ │ │ │ +int <strong>upload_limit</strong> () const;
│ │ │ │  void <strong>set_upload_limit</strong> (int limit) const;
│ │ │ │ +int <strong>download_limit</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">set_upload_limit</tt> 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.
│ │ │ │  <tt class="docutils literal">set_download_limit</tt> works the same way but for download bandwidth
│ │ │ │  instead of upload bandwidth. Note that setting a higher limit on a
│ │ │ │  torrent then the global limit
│ │ │ │ @@ -1203,16 +1203,16 @@
│ │ │ │  <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>.</p>
│ │ │ │  <p><tt class="docutils literal">max_uploads()</tt> returns the current settings.</p>
│ │ │ │  <a name="set_max_connections()"></a>
│ │ │ │  <a name="max_connections()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_max_connections%28%29+max_connections%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_max_connections%28%29+max_connections%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="set-max-connections-max-connections">
│ │ │ │  <h2>set_max_connections() max_connections()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -int <strong>max_connections</strong> () const;
│ │ │ │  void <strong>set_max_connections</strong> (int max_connections) const;
│ │ │ │ +int <strong>max_connections</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">set_max_connections()</tt> sets the maximum number of connection this
│ │ │ │  torrent will open. If all connections are used up, incoming
│ │ │ │  connections may be refused or poor connections may be closed. This
│ │ │ │  must be at least 2. The default is unlimited number of connections. If
│ │ │ │  -1 is given to the function, it means unlimited. There is also a
│ │ │ │  global limit of the number of connections, set by
│ │ │ │ @@ -1275,37 +1275,37 @@
│ │ │ │  <h2>rename_file()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_name) const;
│ │ │ │  </pre>
│ │ │ │  <p>Renames the file with the given index asynchronously. The rename
│ │ │ │  operation is complete when either a <a class="reference external" href="reference-Alerts.html#file_renamed_alert">file_renamed_alert</a> or
│ │ │ │  <a class="reference external" href="reference-Alerts.html#file_rename_failed_alert">file_rename_failed_alert</a> is posted.</p>
│ │ │ │ -<a name="info_hash()"></a>
│ │ │ │ -<a name="info_hashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Binfo_hash%28%29+info_hashes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Binfo_hash%28%29+info_hashes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="info-hash-info-hashes">
│ │ │ │ -<h2>info_hash() info_hashes()</h2>
│ │ │ │ +<a name="info_hashes()"></a>
│ │ │ │ +<a name="info_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="info-hashes-info-hash">
│ │ │ │ +<h2>info_hashes() info_hash()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  sha1_hash <strong>info_hash</strong> () const;
│ │ │ │  info_hash_t <strong>info_hashes</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>returns the info-hash(es) of the torrent. If this handle is to a
│ │ │ │  torrent that hasn't loaded yet (for instance by being added) by a
│ │ │ │  URL, the returned value is undefined.
│ │ │ │  The <tt class="docutils literal">info_hash()</tt> returns the SHA-1 info-hash for v1 torrents and a
│ │ │ │  truncated hash for v2 torrents. For the full v2 info-hash, use
│ │ │ │  <tt class="docutils literal">info_hashes()</tt> instead.</p>
│ │ │ │ -<a name="operator<()"></a>
│ │ │ │  <a name="operator!=()"></a>
│ │ │ │ -<a name="operator==()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Boperator%3C%28%29+operator%21%3D%28%29+operator%3D%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Boperator%3C%28%29+operator%21%3D%28%29+operator%3D%3D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<a name="operator<()"></a>
│ │ │ │ +<a name="operator==()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Boperator%21%3D%28%29+operator%3C%28%29+operator%3D%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Boperator%21%3D%28%29+operator%3C%28%29+operator%3D%3D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="operator-operator-operator">
│ │ │ │ -<h2>operator&lt;() operator!=() operator==()</h2>
│ │ │ │ +<h2>operator!=() operator&lt;() operator==()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +bool <strong>operator==</strong> (const torrent_handle&amp; h) const;
│ │ │ │  bool <strong>operator!=</strong> (const torrent_handle&amp; h) const;
│ │ │ │  bool <strong>operator&lt;</strong> (const torrent_handle&amp; h) const;
│ │ │ │ -bool <strong>operator==</strong> (const torrent_handle&amp; h) const;
│ │ │ │  </pre>
│ │ │ │  <p>comparison operators. The order of the torrents is unspecified
│ │ │ │  but stable.</p>
│ │ │ │  <a name="id()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bid%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="id">
│ │ │ │  <h2>id()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -9,67 +9,67 @@
│ │ │ │ │      * _p_a_r_t_i_a_l___p_i_e_c_e___i_n_f_o
│ │ │ │ │      * _t_o_r_r_e_n_t___h_a_n_d_l_e
│ │ │ │ │            o _t_o_r_r_e_n_t___h_a_n_d_l_e_(_)
│ │ │ │ │            o _a_d_d___p_i_e_c_e_(_)
│ │ │ │ │            o _r_e_a_d___p_i_e_c_e_(_)
│ │ │ │ │            o _h_a_v_e___p_i_e_c_e_(_)
│ │ │ │ │            o _p_o_s_t___p_e_e_r___i_n_f_o_(_)_ _g_e_t___p_e_e_r___i_n_f_o_(_)
│ │ │ │ │ -          o _p_o_s_t___s_t_a_t_u_s_(_)_ _s_t_a_t_u_s_(_)
│ │ │ │ │ +          o _s_t_a_t_u_s_(_)_ _p_o_s_t___s_t_a_t_u_s_(_)
│ │ │ │ │            o _p_o_s_t___d_o_w_n_l_o_a_d___q_u_e_u_e_(_)_ _g_e_t___d_o_w_n_l_o_a_d___q_u_e_u_e_(_)
│ │ │ │ │ -          o _s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_)_ _r_e_s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_)_ _c_l_e_a_r___p_i_e_c_e___d_e_a_d_l_i_n_e_s_(_)
│ │ │ │ │ -          o _f_i_l_e___p_r_o_g_r_e_s_s_(_)_ _p_o_s_t___f_i_l_e___p_r_o_g_r_e_s_s_(_)
│ │ │ │ │ +          o _c_l_e_a_r___p_i_e_c_e___d_e_a_d_l_i_n_e_s_(_)_ _s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_)_ _r_e_s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_)
│ │ │ │ │ +          o _p_o_s_t___f_i_l_e___p_r_o_g_r_e_s_s_(_)_ _f_i_l_e___p_r_o_g_r_e_s_s_(_)
│ │ │ │ │            o _f_i_l_e___s_t_a_t_u_s_(_)
│ │ │ │ │            o _c_l_e_a_r___e_r_r_o_r_(_)
│ │ │ │ │ -          o _a_d_d___t_r_a_c_k_e_r_(_)_ _r_e_p_l_a_c_e___t_r_a_c_k_e_r_s_(_)_ _t_r_a_c_k_e_r_s_(_)_ _p_o_s_t___t_r_a_c_k_e_r_s_(_)
│ │ │ │ │ -          o _r_e_m_o_v_e___u_r_l___s_e_e_d_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)_ _u_r_l___s_e_e_d_s_(_)
│ │ │ │ │ -          o _h_t_t_p___s_e_e_d_s_(_)_ _a_d_d___h_t_t_p___s_e_e_d_(_)_ _r_e_m_o_v_e___h_t_t_p___s_e_e_d_(_)
│ │ │ │ │ +          o _a_d_d___t_r_a_c_k_e_r_(_)_ _p_o_s_t___t_r_a_c_k_e_r_s_(_)_ _r_e_p_l_a_c_e___t_r_a_c_k_e_r_s_(_)_ _t_r_a_c_k_e_r_s_(_)
│ │ │ │ │ +          o _r_e_m_o_v_e___u_r_l___s_e_e_d_(_)_ _u_r_l___s_e_e_d_s_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)
│ │ │ │ │ +          o _h_t_t_p___s_e_e_d_s_(_)_ _r_e_m_o_v_e___h_t_t_p___s_e_e_d_(_)_ _a_d_d___h_t_t_p___s_e_e_d_(_)
│ │ │ │ │            o _a_d_d___e_x_t_e_n_s_i_o_n_(_)
│ │ │ │ │            o _s_e_t___m_e_t_a_d_a_t_a_(_)
│ │ │ │ │            o _i_s___v_a_l_i_d_(_)
│ │ │ │ │ -          o _r_e_s_u_m_e_(_)_ _p_a_u_s_e_(_)
│ │ │ │ │ -          o _f_l_a_g_s_(_)_ _u_n_s_e_t___f_l_a_g_s_(_)_ _s_e_t___f_l_a_g_s_(_)
│ │ │ │ │ +          o _p_a_u_s_e_(_)_ _r_e_s_u_m_e_(_)
│ │ │ │ │ +          o _u_n_s_e_t___f_l_a_g_s_(_)_ _s_e_t___f_l_a_g_s_(_)_ _f_l_a_g_s_(_)
│ │ │ │ │            o _f_l_u_s_h___c_a_c_h_e_(_)
│ │ │ │ │            o _f_o_r_c_e___r_e_c_h_e_c_k_(_)
│ │ │ │ │            o _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │            o _n_e_e_d___s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ -          o _q_u_e_u_e___p_o_s_i_t_i_o_n___d_o_w_n_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n___t_o_p_(_)
│ │ │ │ │ -            _q_u_e_u_e___p_o_s_i_t_i_o_n___b_o_t_t_o_m_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n___u_p_(_)
│ │ │ │ │ +          o _q_u_e_u_e___p_o_s_i_t_i_o_n___d_o_w_n_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n___b_o_t_t_o_m_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n_(_)
│ │ │ │ │ +            _q_u_e_u_e___p_o_s_i_t_i_o_n___t_o_p_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n___u_p_(_)
│ │ │ │ │            o _q_u_e_u_e___p_o_s_i_t_i_o_n___s_e_t_(_)
│ │ │ │ │ -          o _s_e_t___s_s_l___c_e_r_t_i_f_i_c_a_t_e_(_)_ _s_e_t___s_s_l___c_e_r_t_i_f_i_c_a_t_e___b_u_f_f_e_r_(_)
│ │ │ │ │ -          o _t_o_r_r_e_n_t___f_i_l_e_(_)_ _t_o_r_r_e_n_t___f_i_l_e___w_i_t_h___h_a_s_h_e_s_(_)
│ │ │ │ │ +          o _s_e_t___s_s_l___c_e_r_t_i_f_i_c_a_t_e___b_u_f_f_e_r_(_)_ _s_e_t___s_s_l___c_e_r_t_i_f_i_c_a_t_e_(_)
│ │ │ │ │ +          o _t_o_r_r_e_n_t___f_i_l_e___w_i_t_h___h_a_s_h_e_s_(_)_ _t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │            o _p_i_e_c_e___l_a_y_e_r_s_(_)
│ │ │ │ │            o _p_o_s_t___p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y_(_)_ _p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y_(_)
│ │ │ │ │ -          o _p_i_e_c_e___p_r_i_o_r_i_t_y_(_)_ _p_r_i_o_r_i_t_i_z_e___p_i_e_c_e_s_(_)_ _g_e_t___p_i_e_c_e___p_r_i_o_r_i_t_i_e_s_(_)
│ │ │ │ │ -          o _f_i_l_e___p_r_i_o_r_i_t_y_(_)_ _p_r_i_o_r_i_t_i_z_e___f_i_l_e_s_(_)_ _g_e_t___f_i_l_e___p_r_i_o_r_i_t_i_e_s_(_)
│ │ │ │ │ -          o _f_o_r_c_e___r_e_a_n_n_o_u_n_c_e_(_)_ _f_o_r_c_e___d_h_t___a_n_n_o_u_n_c_e_(_)_ _f_o_r_c_e___l_s_d___a_n_n_o_u_n_c_e_(_)
│ │ │ │ │ +          o _p_r_i_o_r_i_t_i_z_e___p_i_e_c_e_s_(_)_ _p_i_e_c_e___p_r_i_o_r_i_t_y_(_)_ _g_e_t___p_i_e_c_e___p_r_i_o_r_i_t_i_e_s_(_)
│ │ │ │ │ +          o _f_i_l_e___p_r_i_o_r_i_t_y_(_)_ _g_e_t___f_i_l_e___p_r_i_o_r_i_t_i_e_s_(_)_ _p_r_i_o_r_i_t_i_z_e___f_i_l_e_s_(_)
│ │ │ │ │ +          o _f_o_r_c_e___d_h_t___a_n_n_o_u_n_c_e_(_)_ _f_o_r_c_e___r_e_a_n_n_o_u_n_c_e_(_)_ _f_o_r_c_e___l_s_d___a_n_n_o_u_n_c_e_(_)
│ │ │ │ │            o _s_c_r_a_p_e___t_r_a_c_k_e_r_(_)
│ │ │ │ │ -          o _d_o_w_n_l_o_a_d___l_i_m_i_t_(_)_ _s_e_t___u_p_l_o_a_d___l_i_m_i_t_(_)_ _u_p_l_o_a_d___l_i_m_i_t_(_)
│ │ │ │ │ +          o _s_e_t___u_p_l_o_a_d___l_i_m_i_t_(_)_ _u_p_l_o_a_d___l_i_m_i_t_(_)_ _d_o_w_n_l_o_a_d___l_i_m_i_t_(_)
│ │ │ │ │              _s_e_t___d_o_w_n_l_o_a_d___l_i_m_i_t_(_)
│ │ │ │ │            o _c_o_n_n_e_c_t___p_e_e_r_(_)
│ │ │ │ │            o _c_l_e_a_r___p_e_e_r_s_(_)
│ │ │ │ │            o _s_e_t___m_a_x___u_p_l_o_a_d_s_(_)_ _m_a_x___u_p_l_o_a_d_s_(_)
│ │ │ │ │            o _s_e_t___m_a_x___c_o_n_n_e_c_t_i_o_n_s_(_)_ _m_a_x___c_o_n_n_e_c_t_i_o_n_s_(_)
│ │ │ │ │            o _m_o_v_e___s_t_o_r_a_g_e_(_)
│ │ │ │ │            o _r_e_n_a_m_e___f_i_l_e_(_)
│ │ │ │ │ -          o _i_n_f_o___h_a_s_h_(_)_ _i_n_f_o___h_a_s_h_e_s_(_)
│ │ │ │ │ -          o _o_p_e_r_a_t_o_r_<_(_)_ _o_p_e_r_a_t_o_r_!_=_(_)_ _o_p_e_r_a_t_o_r_=_=_(_)
│ │ │ │ │ +          o _i_n_f_o___h_a_s_h_e_s_(_)_ _i_n_f_o___h_a_s_h_(_)
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_!_=_(_)_ _o_p_e_r_a_t_o_r_<_(_)_ _o_p_e_r_a_t_o_r_=_=_(_)
│ │ │ │ │            o _i_d_(_)
│ │ │ │ │            o _n_a_t_i_v_e___h_a_n_d_l_e_(_)
│ │ │ │ │            o _u_s_e_r_d_a_t_a_(_)
│ │ │ │ │            o _i_n___s_e_s_s_i_o_n_(_)
│ │ │ │ │      * _h_a_s_h___v_a_l_u_e_(_)
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ bblloocckk__iinnffoo ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___h_a_n_d_l_e_._h_p_p"
│ │ │ │ │  holds the state of a block in a piece. Who we requested it from and how far
│ │ │ │ │  along we are at downloading it.
│ │ │ │ │  struct block_info
│ │ │ │ │  {
│ │ │ │ │ -   _t_c_p_:_:_e_n_d_p_o_i_n_t ppeeeerr () const;
│ │ │ │ │     void sseett__ppeeeerr (tcp::endpoint const& ep);
│ │ │ │ │ +   _t_c_p_:_:_e_n_d_p_o_i_n_t ppeeeerr () const;
│ │ │ │ │  
│ │ │ │ │     enum block_state_t
│ │ │ │ │     {
│ │ │ │ │        none,
│ │ │ │ │        requested,
│ │ │ │ │        writing,
│ │ │ │ │        finished,
│ │ │ │ │ @@ -78,16 +78,16 @@
│ │ │ │ │     unsigned bytes_progress:15;
│ │ │ │ │     unsigned block_size:15;
│ │ │ │ │     unsigned state:2;
│ │ │ │ │     unsigned num_peers:14;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ppeeeerr(()) sseett__ppeeeerr(()) **********
│ │ │ │ │ -_t_c_p_:_:_e_n_d_p_o_i_n_t ppeeeerr () const;
│ │ │ │ │  void sseett__ppeeeerr (tcp::endpoint const& ep);
│ │ │ │ │ +_t_c_p_:_:_e_n_d_p_o_i_n_t ppeeeerr () const;
│ │ │ │ │  The peer is the ip address of the peer this block was downloaded from.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** eennuumm bblloocckk__ssttaattee__tt **********
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___h_a_n_d_l_e_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |none     |0    |This block has not been downloaded or requested form any   |
│ │ │ │ │ @@ -181,114 +181,114 @@
│ │ │ │ │     ttoorrrreenntt__hhaannddllee () noexcept = default;
│ │ │ │ │     void aadddd__ppiieeccee (piece_index_t piece, std::vector<char> data,
│ │ │ │ │  add_piece_flags_t flags = {}) const;
│ │ │ │ │     void aadddd__ppiieeccee (piece_index_t piece, char const* data, add_piece_flags_t
│ │ │ │ │  flags = {}) const;
│ │ │ │ │     void rreeaadd__ppiieeccee (piece_index_t piece) const;
│ │ │ │ │     bool hhaavvee__ppiieeccee (piece_index_t piece) const;
│ │ │ │ │ -   void ppoosstt__ppeeeerr__iinnffoo () const;
│ │ │ │ │     void ggeett__ppeeeerr__iinnffoo (std::vector<peer_info>& v) const;
│ │ │ │ │ +   void ppoosstt__ppeeeerr__iinnffoo () const;
│ │ │ │ │     torrent_status ssttaattuuss (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ │     void ppoosstt__ssttaattuuss (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ │     void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector<partial_piece_info>& queue) const;
│ │ │ │ │     void ppoosstt__ddoowwnnllooaadd__qquueeuuee () const;
│ │ │ │ │     std::vector<partial_piece_info> ggeett__ddoowwnnllooaadd__qquueeuuee () const;
│ │ │ │ │ +   void cclleeaarr__ppiieeccee__ddeeaaddlliinneess () const;
│ │ │ │ │ +   void rreesseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index) const;
│ │ │ │ │     void sseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index, int deadline, deadline_flags_t
│ │ │ │ │  flags = {}) const;
│ │ │ │ │ -   void rreesseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index) const;
│ │ │ │ │ -   void cclleeaarr__ppiieeccee__ddeeaaddlliinneess () const;
│ │ │ │ │     void ffiillee__pprrooggrreessss (std::vector<std::int64_t>& progress,
│ │ │ │ │  file_progress_flags_t flags = {}) const;
│ │ │ │ │     void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const;
│ │ │ │ │     std::vector<std::int64_t> ffiillee__pprrooggrreessss (file_progress_flags_t flags = {})
│ │ │ │ │  const;
│ │ │ │ │     std::vector<open_file_state> ffiillee__ssttaattuuss () const;
│ │ │ │ │     void cclleeaarr__eerrrroorr () const;
│ │ │ │ │ +   void rreeppllaaccee__ttrraacckkeerrss (std::vector<announce_entry> const&) const;
│ │ │ │ │     void aadddd__ttrraacckkeerr (announce_entry const&) const;
│ │ │ │ │     std::vector<announce_entry> ttrraacckkeerrss () const;
│ │ │ │ │ -   void rreeppllaaccee__ttrraacckkeerrss (std::vector<announce_entry> const&) const;
│ │ │ │ │     void ppoosstt__ttrraacckkeerrss () const;
│ │ │ │ │ +   void aadddd__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │     void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │     std::set<std::string> uurrll__sseeeeddss () const;
│ │ │ │ │ -   void aadddd__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │ -   std::set<std::string> hhttttpp__sseeeeddss () const;
│ │ │ │ │     void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const;
│ │ │ │ │     void aadddd__hhttttpp__sseeeedd (std::string const& url) const;
│ │ │ │ │ +   std::set<std::string> hhttttpp__sseeeeddss () const;
│ │ │ │ │     void aadddd__eexxtteennssiioonn (
│ │ │ │ │        std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&,
│ │ │ │ │  client_data_t)> const& ext
│ │ │ │ │        , client_data_t userdata = client_data_t{});
│ │ │ │ │     bool sseett__mmeettaaddaattaa (span<char const> metadata) const;
│ │ │ │ │     bool iiss__vvaalliidd () const;
│ │ │ │ │     void ppaauussee (pause_flags_t flags = {}) const;
│ │ │ │ │     void rreessuummee () const;
│ │ │ │ │ -   void sseett__ffllaaggss (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ │ -   void sseett__ffllaaggss (torrent_flags_t flags) const;
│ │ │ │ │ -   torrent_flags_t ffllaaggss () const;
│ │ │ │ │     void uunnsseett__ffllaaggss (torrent_flags_t flags) const;
│ │ │ │ │ +   torrent_flags_t ffllaaggss () const;
│ │ │ │ │ +   void sseett__ffllaaggss (torrent_flags_t flags) const;
│ │ │ │ │ +   void sseett__ffllaaggss (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ │     void fflluusshh__ccaacchhee () const;
│ │ │ │ │     void ffoorrccee__rreecchheecckk () const;
│ │ │ │ │     void ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags = {}) const;
│ │ │ │ │     bool nneeeedd__ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags) const;
│ │ │ │ │     bool nneeeedd__ssaavvee__rreessuummee__ddaattaa () const;
│ │ │ │ │ -   void qquueeuuee__ppoossiittiioonn__bboottttoomm () const;
│ │ │ │ │ -   void qquueeuuee__ppoossiittiioonn__ttoopp () const;
│ │ │ │ │     void qquueeuuee__ppoossiittiioonn__uupp () const;
│ │ │ │ │ +   void qquueeuuee__ppoossiittiioonn__bboottttoomm () const;
│ │ │ │ │     queue_position_t qquueeuuee__ppoossiittiioonn () const;
│ │ │ │ │     void qquueeuuee__ppoossiittiioonn__ddoowwnn () const;
│ │ │ │ │ +   void qquueeuuee__ppoossiittiioonn__ttoopp () const;
│ │ │ │ │     void qquueeuuee__ppoossiittiioonn__sseett (queue_position_t p) const;
│ │ │ │ │ -   void sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr (std::string const& certificate
│ │ │ │ │ -      , std::string const& private_key
│ │ │ │ │ -      , std::string const& dh_params);
│ │ │ │ │     void sseett__ssssll__cceerrttiiffiiccaattee (std::string const& certificate
│ │ │ │ │        , std::string const& private_key
│ │ │ │ │        , std::string const& dh_params
│ │ │ │ │        , std::string const& passphrase = "");
│ │ │ │ │ -   std::shared_ptr<const torrent_info> ttoorrrreenntt__ffiillee () const;
│ │ │ │ │ +   void sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr (std::string const& certificate
│ │ │ │ │ +      , std::string const& private_key
│ │ │ │ │ +      , std::string const& dh_params);
│ │ │ │ │     std::shared_ptr<torrent_info> ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess () const;
│ │ │ │ │ +   std::shared_ptr<const torrent_info> ttoorrrreenntt__ffiillee () const;
│ │ │ │ │     std::vector<std::vector<sha256_hash>> ppiieeccee__llaayyeerrss () const;
│ │ │ │ │ -   void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector<int>& avail) const;
│ │ │ │ │     void ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy () const;
│ │ │ │ │ +   void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector<int>& avail) const;
│ │ │ │ │ +   void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority)
│ │ │ │ │ +const;
│ │ │ │ │ +   download_priority_t ppiieeccee__pprriioorriittyy (piece_index_t index) const;
│ │ │ │ │     void pprriioorriittiizzee__ppiieecceess (std::vector<download_priority_t> const& pieces)
│ │ │ │ │  const;
│ │ │ │ │ -   std::vector<download_priority_t> ggeett__ppiieeccee__pprriioorriittiieess () const;
│ │ │ │ │     void pprriioorriittiizzee__ppiieecceess (std::vector<std::pair<piece_index_t,
│ │ │ │ │  download_priority_t>> const& pieces) const;
│ │ │ │ │ -   void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority)
│ │ │ │ │ -const;
│ │ │ │ │ -   download_priority_t ppiieeccee__pprriioorriittyy (piece_index_t index) const;
│ │ │ │ │ +   std::vector<download_priority_t> ggeett__ppiieeccee__pprriioorriittiieess () const;
│ │ │ │ │     std::vector<download_priority_t> ggeett__ffiillee__pprriioorriittiieess () const;
│ │ │ │ │ -   void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const;
│ │ │ │ │     void pprriioorriittiizzee__ffiilleess (std::vector<download_priority_t> const& files) const;
│ │ │ │ │     download_priority_t ffiillee__pprriioorriittyy (file_index_t index) const;
│ │ │ │ │ -   void ffoorrccee__ddhhtt__aannnnoouunnccee () const;
│ │ │ │ │ -   void ffoorrccee__llssdd__aannnnoouunnccee () const;
│ │ │ │ │ +   void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const;
│ │ │ │ │     void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t =
│ │ │ │ │  {}) const;
│ │ │ │ │ +   void ffoorrccee__ddhhtt__aannnnoouunnccee () const;
│ │ │ │ │ +   void ffoorrccee__llssdd__aannnnoouunnccee () const;
│ │ │ │ │     void ssccrraappee__ttrraacckkeerr (int idx = -1) const;
│ │ │ │ │ -   int uuppllooaadd__lliimmiitt () const;
│ │ │ │ │     void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const;
│ │ │ │ │ -   int ddoowwnnllooaadd__lliimmiitt () const;
│ │ │ │ │ +   int uuppllooaadd__lliimmiitt () const;
│ │ │ │ │     void sseett__uuppllooaadd__lliimmiitt (int limit) const;
│ │ │ │ │ +   int ddoowwnnllooaadd__lliimmiitt () const;
│ │ │ │ │     void ccoonnnneecctt__ppeeeerr (tcp::endpoint const& adr, peer_source_flags_t source = {}
│ │ │ │ │        , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
│ │ │ │ │     void cclleeaarr__ppeeeerrss ();
│ │ │ │ │     int mmaaxx__uuppllooaaddss () const;
│ │ │ │ │     void sseett__mmaaxx__uuppllooaaddss (int max_uploads) const;
│ │ │ │ │ -   int mmaaxx__ccoonnnneeccttiioonnss () const;
│ │ │ │ │     void sseett__mmaaxx__ccoonnnneeccttiioonnss (int max_connections) const;
│ │ │ │ │ +   int mmaaxx__ccoonnnneeccttiioonnss () const;
│ │ │ │ │     void mmoovvee__ssttoorraaggee (std::string const& save_path
│ │ │ │ │        , move_flags_t flags = move_flags_t::always_replace_files
│ │ │ │ │        ) const;
│ │ │ │ │     void rreennaammee__ffiillee (file_index_t index, std::string const& new_name) const;
│ │ │ │ │     sha1_hash iinnffoo__hhaasshh () const;
│ │ │ │ │     info_hash_t iinnffoo__hhaasshheess () const;
│ │ │ │ │ +   bool ooppeerraattoorr==== (const torrent_handle& h) const;
│ │ │ │ │     bool ooppeerraattoorr!!== (const torrent_handle& h) const;
│ │ │ │ │     bool ooppeerraattoorr<< (const torrent_handle& h) const;
│ │ │ │ │ -   bool ooppeerraattoorr==== (const torrent_handle& h) const;
│ │ │ │ │     std::uint32_t iidd () const;
│ │ │ │ │     std::shared_ptr<torrent> nnaattiivvee__hhaannddllee () const;
│ │ │ │ │     client_data_t uusseerrddaattaa () const;
│ │ │ │ │     bool iinn__sseessssiioonn () const;
│ │ │ │ │  
│ │ │ │ │     static constexpr add_piece_flags_t oovveerrwwrriittee__eexxiissttiinngg  = 0_bit;
│ │ │ │ │     static constexpr status_flags_t qquueerryy__ddiissttrriibbuutteedd__ccooppiieess  = 0_bit;
│ │ │ │ │ @@ -355,27 +355,27 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** hhaavvee__ppiieeccee(()) **********
│ │ │ │ │  bool hhaavvee__ppiieeccee (piece_index_t piece) const;
│ │ │ │ │  Returns true if this piece has been completely downloaded and written to disk,
│ │ │ │ │  and false otherwise.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ppoosstt__ppeeeerr__iinnffoo(()) ggeett__ppeeeerr__iinnffoo(()) **********
│ │ │ │ │ -void ppoosstt__ppeeeerr__iinnffoo () const;
│ │ │ │ │  void ggeett__ppeeeerr__iinnffoo (std::vector<peer_info>& v) const;
│ │ │ │ │ +void ppoosstt__ppeeeerr__iinnffoo () const;
│ │ │ │ │  Query information about connected peers for this torrent. If the _t_o_r_r_e_n_t___h_a_n_d_l_e
│ │ │ │ │  is invalid, it will throw a system_error exception.
│ │ │ │ │  post_peer_info() is asynchronous and will trigger the posting of a
│ │ │ │ │  _p_e_e_r___i_n_f_o___a_l_e_r_t. The _a_l_e_r_t contain a list of _p_e_e_r___i_n_f_o objects, one for each
│ │ │ │ │  connected peer.
│ │ │ │ │  get_peer_info() is synchronous and takes a reference to a vector that will be
│ │ │ │ │  cleared and filled with one _e_n_t_r_y for each peer connected to this torrent,
│ │ │ │ │  given the handle is valid. Each _e_n_t_r_y in the vector contains information about
│ │ │ │ │  that particular peer. See _p_e_e_r___i_n_f_o.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppoosstt__ssttaattuuss(()) ssttaattuuss(()) **********
│ │ │ │ │ +********** ssttaattuuss(()) ppoosstt__ssttaattuuss(()) **********
│ │ │ │ │  torrent_status ssttaattuuss (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ │  void ppoosstt__ssttaattuuss (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ │  status() will return a structure with information about the status of this
│ │ │ │ │  torrent. If the _t_o_r_r_e_n_t___h_a_n_d_l_e is invalid, it will throw system_error
│ │ │ │ │  exception. See _t_o_r_r_e_n_t___s_t_a_t_u_s. The flags argument filters what information is
│ │ │ │ │  returned in the _t_o_r_r_e_n_t___s_t_a_t_u_s. Some information in there is relatively
│ │ │ │ │  expensive to calculate, and if you're not interested in it (and see performance
│ │ │ │ │ @@ -395,19 +395,19 @@
│ │ │ │ │  std::vector<partial_piece_info> ggeett__ddoowwnnllooaadd__qquueeuuee () const;
│ │ │ │ │  post_download_queue() triggers a download_queue_alert to be posted.
│ │ │ │ │  get_download_queue() is a synchronous call and returns a vector with
│ │ │ │ │  information about pieces that are partially downloaded or not downloaded but
│ │ │ │ │  partially requested. See _p_a_r_t_i_a_l___p_i_e_c_e___i_n_f_o for the fields in the returned
│ │ │ │ │  vector.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__ppiieeccee__ddeeaaddlliinnee(()) rreesseett__ppiieeccee__ddeeaaddlliinnee(()) cclleeaarr__ppiieeccee__ddeeaaddlliinneess(()) **********
│ │ │ │ │ +********** cclleeaarr__ppiieeccee__ddeeaaddlliinneess(()) sseett__ppiieeccee__ddeeaaddlliinnee(()) rreesseett__ppiieeccee__ddeeaaddlliinnee(()) **********
│ │ │ │ │ +void cclleeaarr__ppiieeccee__ddeeaaddlliinneess () const;
│ │ │ │ │ +void rreesseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index) const;
│ │ │ │ │  void sseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index, int deadline, deadline_flags_t
│ │ │ │ │  flags = {}) const;
│ │ │ │ │ -void rreesseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index) const;
│ │ │ │ │ -void cclleeaarr__ppiieeccee__ddeeaaddlliinneess () const;
│ │ │ │ │  This function sets or resets the deadline associated with a specific piece
│ │ │ │ │  index (index). libtorrent will attempt to download this entire piece before the
│ │ │ │ │  deadline expires. This is not necessarily possible, but pieces with a more
│ │ │ │ │  recent deadline will always be prioritized over pieces with a deadline further
│ │ │ │ │  ahead in time. The deadline (and flags) of a piece can be changed by calling
│ │ │ │ │  this function again.
│ │ │ │ │  If the piece is already downloaded when this call is made, nothing happens,
│ │ │ │ │ @@ -415,15 +415,15 @@
│ │ │ │ │  same effect as calling _r_e_a_d___p_i_e_c_e_(_) for index.
│ │ │ │ │  deadline is the number of milliseconds until this piece should be completed.
│ │ │ │ │  reset_piece_deadline removes the deadline from the piece. If it hasn't already
│ │ │ │ │  been downloaded, it will no longer be considered a priority.
│ │ │ │ │  clear_piece_deadlines() removes deadlines on all pieces in the torrent. As if
│ │ │ │ │  _r_e_s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_) was called on all pieces.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__pprrooggrreessss(()) ppoosstt__ffiillee__pprrooggrreessss(()) **********
│ │ │ │ │ +********** ppoosstt__ffiillee__pprrooggrreessss(()) ffiillee__pprrooggrreessss(()) **********
│ │ │ │ │  void ffiillee__pprrooggrreessss (std::vector<std::int64_t>& progress, file_progress_flags_t
│ │ │ │ │  flags = {}) const;
│ │ │ │ │  void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const;
│ │ │ │ │  std::vector<std::int64_t> ffiillee__pprrooggrreessss (file_progress_flags_t flags = {})
│ │ │ │ │  const;
│ │ │ │ │  This function fills in the supplied vector, or returns a vector, with the
│ │ │ │ │  number of bytes downloaded of each file in this torrent. The progress values
│ │ │ │ │ @@ -449,18 +449,18 @@
│ │ │ │ │  See _o_p_e_n___f_i_l_e___s_t_a_t_e
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** cclleeaarr__eerrrroorr(()) **********
│ │ │ │ │  void cclleeaarr__eerrrroorr () const;
│ │ │ │ │  If the torrent is in an error state (i.e. torrent_status::error is non-empty),
│ │ │ │ │  this will clear the error and start the torrent again.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__ttrraacckkeerr(()) rreeppllaaccee__ttrraacckkeerrss(()) ttrraacckkeerrss(()) ppoosstt__ttrraacckkeerrss(()) **********
│ │ │ │ │ +********** aadddd__ttrraacckkeerr(()) ppoosstt__ttrraacckkeerrss(()) rreeppllaaccee__ttrraacckkeerrss(()) ttrraacckkeerrss(()) **********
│ │ │ │ │ +void rreeppllaaccee__ttrraacckkeerrss (std::vector<announce_entry> const&) const;
│ │ │ │ │  void aadddd__ttrraacckkeerr (announce_entry const&) const;
│ │ │ │ │  std::vector<announce_entry> ttrraacckkeerrss () const;
│ │ │ │ │ -void rreeppllaaccee__ttrraacckkeerrss (std::vector<announce_entry> const&) const;
│ │ │ │ │  void ppoosstt__ttrraacckkeerrss () const;
│ │ │ │ │  trackers() returns the list of trackers for this torrent. The announce _e_n_t_r_y
│ │ │ │ │  contains both a string url which specify the announce url for the tracker as
│ │ │ │ │  well as an _i_n_t tier, which is specifies the order in which this tracker is
│ │ │ │ │  tried. If you want libtorrent to use another list of trackers for this torrent,
│ │ │ │ │  you can use replace_trackers() which takes a list of the same form as the one
│ │ │ │ │  returned from trackers() and will replace it. If you want an immediate effect,
│ │ │ │ │ @@ -470,30 +470,30 @@
│ │ │ │ │  add_tracker() will look if the specified tracker is already in the set. If it
│ │ │ │ │  is, it doesn't do anything. If it's not in the current set of trackers, it will
│ │ │ │ │  insert it in the tier specified in the _a_n_n_o_u_n_c_e___e_n_t_r_y.
│ │ │ │ │  The updated set of trackers will be saved in the resume data, and when a
│ │ │ │ │  torrent is started with resume data, the trackers from the resume data will
│ │ │ │ │  replace the original ones.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreemmoovvee__uurrll__sseeeedd(()) aadddd__uurrll__sseeeedd(()) uurrll__sseeeeddss(()) **********
│ │ │ │ │ +********** rreemmoovvee__uurrll__sseeeedd(()) uurrll__sseeeeddss(()) aadddd__uurrll__sseeeedd(()) **********
│ │ │ │ │ +void aadddd__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │  void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │  std::set<std::string> uurrll__sseeeeddss () const;
│ │ │ │ │ -void aadddd__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │  add_url_seed() adds another url to the torrent's list of url seeds. If the
│ │ │ │ │  given url already exists in that list, the call has no effect. The torrent will
│ │ │ │ │  connect to the server and try to download pieces from it, unless it's paused,
│ │ │ │ │  queued, checking or seeding. remove_url_seed() removes the given url if it
│ │ │ │ │  exists already. url_seeds() return a set of the url seeds currently in this
│ │ │ │ │  torrent. Note that URLs that fails may be removed automatically from the list.
│ │ │ │ │  See _h_t_t_p_ _s_e_e_d_i_n_g for more information.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** hhttttpp__sseeeeddss(()) aadddd__hhttttpp__sseeeedd(()) rreemmoovvee__hhttttpp__sseeeedd(()) **********
│ │ │ │ │ -std::set<std::string> hhttttpp__sseeeeddss () const;
│ │ │ │ │ +********** hhttttpp__sseeeeddss(()) rreemmoovvee__hhttttpp__sseeeedd(()) aadddd__hhttttpp__sseeeedd(()) **********
│ │ │ │ │  void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const;
│ │ │ │ │  void aadddd__hhttttpp__sseeeedd (std::string const& url) const;
│ │ │ │ │ +std::set<std::string> hhttttpp__sseeeeddss () const;
│ │ │ │ │  These functions are identical as the *_url_seed() variants, but they operate on
│ │ │ │ │  _B_E_P_ _1_7 web seeds instead of _B_E_P_ _1_9.
│ │ │ │ │  See _h_t_t_p_ _s_e_e_d_i_n_g for more information.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aadddd__eexxtteennssiioonn(()) **********
│ │ │ │ │  void aadddd__eexxtteennssiioonn (
│ │ │ │ │        std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&,
│ │ │ │ │ @@ -524,15 +524,15 @@
│ │ │ │ │  and false afterward.
│ │ │ │ │  Clients should only use _i_s___v_a_l_i_d_(_) to determine if the result of session::
│ │ │ │ │  find_torrent() was successful.
│ │ │ │ │  Unlike other member functions which return a value, _i_s___v_a_l_i_d_(_) completes
│ │ │ │ │  immediately, without blocking on a result from the network thread. Also unlike
│ │ │ │ │  other functions, it never throws the system_error exception.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreessuummee(()) ppaauussee(()) **********
│ │ │ │ │ +********** ppaauussee(()) rreessuummee(()) **********
│ │ │ │ │  void ppaauussee (pause_flags_t flags = {}) const;
│ │ │ │ │  void rreessuummee () const;
│ │ │ │ │  pause(), and resume() will disconnect all peers and reconnect all peers
│ │ │ │ │  respectively. When a torrent is paused, it will however remember all share
│ │ │ │ │  ratios to all peers and remember all potential (not connected) peers. Torrents
│ │ │ │ │  may be paused automatically if there is a file error (e.g. disk full) or
│ │ │ │ │  something similar. See _f_i_l_e___e_r_r_o_r___a_l_e_r_t.
│ │ │ │ │ @@ -541,19 +541,19 @@
│ │ │ │ │  for the torrent_status::paused flag.
│ │ │ │ │  Note
│ │ │ │ │  Torrents that are auto-managed may be automatically resumed again. It does not
│ │ │ │ │  make sense to pause an auto-managed torrent without making it not auto-managed
│ │ │ │ │  first. Torrents are auto-managed by default when added to the _s_e_s_s_i_o_n. For more
│ │ │ │ │  information, see _q_u_e_u_i_n_g.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffllaaggss(()) uunnsseett__ffllaaggss(()) sseett__ffllaaggss(()) **********
│ │ │ │ │ -void sseett__ffllaaggss (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ │ -void sseett__ffllaaggss (torrent_flags_t flags) const;
│ │ │ │ │ -torrent_flags_t ffllaaggss () const;
│ │ │ │ │ +********** uunnsseett__ffllaaggss(()) sseett__ffllaaggss(()) ffllaaggss(()) **********
│ │ │ │ │  void uunnsseett__ffllaaggss (torrent_flags_t flags) const;
│ │ │ │ │ +torrent_flags_t ffllaaggss () const;
│ │ │ │ │ +void sseett__ffllaaggss (torrent_flags_t flags) const;
│ │ │ │ │ +void sseett__ffllaaggss (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ │  sets and gets the torrent state flags. See _t_o_r_r_e_n_t___f_l_a_g_s___t. The set_flags
│ │ │ │ │  overload that take a mask will affect all flags part of the mask, and set their
│ │ │ │ │  values to what the flags argument is set to. This allows clearing and setting
│ │ │ │ │  flags in a single function call. The set_flags overload that just takes flags,
│ │ │ │ │  sets all the specified flags and leave any other flags unchanged. unset_flags
│ │ │ │ │  clears the specified flags, while leaving any other flags unchanged.
│ │ │ │ │  Theseed_modeflag is special, it can only be cleared once the torrent has been
│ │ │ │ │ @@ -677,21 +677,21 @@
│ │ │ │ │  thread. A way to avoid blocking is to instead call _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) directly,
│ │ │ │ │  specifying the conditions under which resume data should be saved.
│ │ │ │ │  Note
│ │ │ │ │  A torrent's resume data is considered saved as soon as the
│ │ │ │ │  _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t is posted. It is important to make sure this _a_l_e_r_t is
│ │ │ │ │  received and handled in order for this function to be meaningful.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** qquueeuuee__ppoossiittiioonn__ddoowwnn(()) qquueeuuee__ppoossiittiioonn(()) qquueeuuee__ppoossiittiioonn__ttoopp(())
│ │ │ │ │ -qquueeuuee__ppoossiittiioonn__bboottttoomm(()) qquueeuuee__ppoossiittiioonn__uupp(()) **********
│ │ │ │ │ -void qquueeuuee__ppoossiittiioonn__bboottttoomm () const;
│ │ │ │ │ -void qquueeuuee__ppoossiittiioonn__ttoopp () const;
│ │ │ │ │ +********** qquueeuuee__ppoossiittiioonn__ddoowwnn(()) qquueeuuee__ppoossiittiioonn__bboottttoomm(()) qquueeuuee__ppoossiittiioonn(())
│ │ │ │ │ +qquueeuuee__ppoossiittiioonn__ttoopp(()) qquueeuuee__ppoossiittiioonn__uupp(()) **********
│ │ │ │ │  void qquueeuuee__ppoossiittiioonn__uupp () const;
│ │ │ │ │ +void qquueeuuee__ppoossiittiioonn__bboottttoomm () const;
│ │ │ │ │  queue_position_t qquueeuuee__ppoossiittiioonn () const;
│ │ │ │ │  void qquueeuuee__ppoossiittiioonn__ddoowwnn () const;
│ │ │ │ │ +void qquueeuuee__ppoossiittiioonn__ttoopp () const;
│ │ │ │ │  Every torrent that is added is assigned a queue position exactly one greater
│ │ │ │ │  than the greatest queue position of all existing torrents. Torrents that are
│ │ │ │ │  being seeded have -1 as their queue position, since they're no longer in line
│ │ │ │ │  to be downloaded.
│ │ │ │ │  When a torrent is removed or turns into a seed, all torrents with greater queue
│ │ │ │ │  positions have their positions decreased to fill in the space in the sequence.
│ │ │ │ │  queue_position() returns the torrent's position in the download queue. The
│ │ │ │ │ @@ -705,22 +705,22 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** qquueeuuee__ppoossiittiioonn__sseett(()) **********
│ │ │ │ │  void qquueeuuee__ppoossiittiioonn__sseett (queue_position_t p) const;
│ │ │ │ │  updates the position in the queue for this torrent. The relative order of all
│ │ │ │ │  other torrents remain intact but their numerical queue position shifts to make
│ │ │ │ │  space for this torrent's new position
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__ssssll__cceerrttiiffiiccaattee(()) sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr(()) **********
│ │ │ │ │ -void sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr (std::string const& certificate
│ │ │ │ │ -      , std::string const& private_key
│ │ │ │ │ -      , std::string const& dh_params);
│ │ │ │ │ +********** sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr(()) sseett__ssssll__cceerrttiiffiiccaattee(()) **********
│ │ │ │ │  void sseett__ssssll__cceerrttiiffiiccaattee (std::string const& certificate
│ │ │ │ │        , std::string const& private_key
│ │ │ │ │        , std::string const& dh_params
│ │ │ │ │        , std::string const& passphrase = "");
│ │ │ │ │ +void sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr (std::string const& certificate
│ │ │ │ │ +      , std::string const& private_key
│ │ │ │ │ +      , std::string const& dh_params);
│ │ │ │ │  For SSL torrents, use this to specify a path to a .pem file to use as this
│ │ │ │ │  client's certificate. The certificate must be signed by the certificate in the
│ │ │ │ │  .torrent file to be valid.
│ │ │ │ │  The _s_e_t___s_s_l___c_e_r_t_i_f_i_c_a_t_e___b_u_f_f_e_r_(_) overload takes the actual certificate, private
│ │ │ │ │  key and DH params as strings, rather than paths to files.
│ │ │ │ │  cert is a path to the (signed) certificate in .pem format corresponding to this
│ │ │ │ │  torrent.
│ │ │ │ │ @@ -734,17 +734,17 @@
│ │ │ │ │  Note that when a torrent first starts up, and it needs a certificate, it will
│ │ │ │ │  suspend connecting to any peers until it has one. It's typically desirable to
│ │ │ │ │  resume the torrent after setting the SSL certificate.
│ │ │ │ │  If you receive a _t_o_r_r_e_n_t___n_e_e_d___c_e_r_t___a_l_e_r_t, you need to call this to provide a
│ │ │ │ │  valid cert. If you don't have a cert you won't be allowed to connect to any
│ │ │ │ │  peers.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttoorrrreenntt__ffiillee(()) ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess(()) **********
│ │ │ │ │ -std::shared_ptr<const torrent_info> ttoorrrreenntt__ffiillee () const;
│ │ │ │ │ +********** ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess(()) ttoorrrreenntt__ffiillee(()) **********
│ │ │ │ │  std::shared_ptr<torrent_info> ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess () const;
│ │ │ │ │ +std::shared_ptr<const torrent_info> ttoorrrreenntt__ffiillee () const;
│ │ │ │ │  _t_o_r_r_e_n_t___f_i_l_e_(_) returns a pointer to the _t_o_r_r_e_n_t___i_n_f_o object associated with
│ │ │ │ │  this torrent. The _t_o_r_r_e_n_t___i_n_f_o object may be a copy of the internal object. If
│ │ │ │ │  the torrent doesn't have metadata, the pointer will not be initialized (i.e. a
│ │ │ │ │  nullptr). The torrent may be in a state without metadata only if it was started
│ │ │ │ │  without a .torrent file, e.g. by being added by magnet link.
│ │ │ │ │  Note that the _t_o_r_r_e_n_t___i_n_f_o object returned here may be a different instance
│ │ │ │ │  than the one added to the _s_e_s_s_i_o_n, with different attributes like piece layers,
│ │ │ │ │ @@ -771,32 +771,32 @@
│ │ │ │ │  ********** ppiieeccee__llaayyeerrss(()) **********
│ │ │ │ │  std::vector<std::vector<sha256_hash>> ppiieeccee__llaayyeerrss () const;
│ │ │ │ │  returns the piece layers for all files in the torrent. If this is a v1 torrent
│ │ │ │ │  (and doesn't have any piece layers) it returns an empty vector. This is a
│ │ │ │ │  blocking call that will synchronize with the libtorrent network thread.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy(()) ppiieeccee__aavvaaiillaabbiilliittyy(()) **********
│ │ │ │ │ -void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector<int>& avail) const;
│ │ │ │ │  void ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy () const;
│ │ │ │ │ +void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector<int>& avail) const;
│ │ │ │ │  The piece availability is the number of peers that we are connected that has
│ │ │ │ │  advertised having a particular piece. This is the information that libtorrent
│ │ │ │ │  uses in order to prefer picking rare pieces.
│ │ │ │ │  post_piece_availability() will trigger a _p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y___a_l_e_r_t to be posted.
│ │ │ │ │  piece_availability() fills the specified std::vector<int> with the availability
│ │ │ │ │  for each piece in this torrent. libtorrent does not keep track of availability
│ │ │ │ │  for seeds, so if the torrent is seeding the availability for all pieces is
│ │ │ │ │  reported as 0.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__pprriioorriittyy(()) pprriioorriittiizzee__ppiieecceess(()) ggeett__ppiieeccee__pprriioorriittiieess(()) **********
│ │ │ │ │ +********** pprriioorriittiizzee__ppiieecceess(()) ppiieeccee__pprriioorriittyy(()) ggeett__ppiieeccee__pprriioorriittiieess(()) **********
│ │ │ │ │ +void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority) const;
│ │ │ │ │ +download_priority_t ppiieeccee__pprriioorriittyy (piece_index_t index) const;
│ │ │ │ │  void pprriioorriittiizzee__ppiieecceess (std::vector<download_priority_t> const& pieces) const;
│ │ │ │ │ -std::vector<download_priority_t> ggeett__ppiieeccee__pprriioorriittiieess () const;
│ │ │ │ │  void pprriioorriittiizzee__ppiieecceess (std::vector<std::pair<piece_index_t,
│ │ │ │ │  download_priority_t>> const& pieces) const;
│ │ │ │ │ -void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority) const;
│ │ │ │ │ -download_priority_t ppiieeccee__pprriioorriittyy (piece_index_t index) const;
│ │ │ │ │ +std::vector<download_priority_t> ggeett__ppiieeccee__pprriioorriittiieess () const;
│ │ │ │ │  These functions are used to set and get the priority of individual pieces. By
│ │ │ │ │  default all pieces have priority 4. That means that the random rarest first
│ │ │ │ │  algorithm is effectively active for all pieces. You may however change the
│ │ │ │ │  priority of individual pieces. There are 8 priority levels. 0 means not to
│ │ │ │ │  download the piece at all. Otherwise, lower priority values means less likely
│ │ │ │ │  to be picked. Piece priority takes precedence over piece availability. Every
│ │ │ │ │  piece with priority 7 will be attempted to be picked before a priority 6 piece
│ │ │ │ │ @@ -816,19 +816,19 @@
│ │ │ │ │  where the piece index or priority is out of range, are not allowed.
│ │ │ │ │  get_piece_priorities returns a vector with one element for each piece in the
│ │ │ │ │  torrent. Each element is the current priority of that piece.
│ │ │ │ │  It's possible to cancel the effect of ffiillee priorities by setting the priorities
│ │ │ │ │  for the affected pieces. Care has to be taken when mixing usage of file- and
│ │ │ │ │  piece priorities.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__pprriioorriittyy(()) pprriioorriittiizzee__ffiilleess(()) ggeett__ffiillee__pprriioorriittiieess(()) **********
│ │ │ │ │ +********** ffiillee__pprriioorriittyy(()) ggeett__ffiillee__pprriioorriittiieess(()) pprriioorriittiizzee__ffiilleess(()) **********
│ │ │ │ │  std::vector<download_priority_t> ggeett__ffiillee__pprriioorriittiieess () const;
│ │ │ │ │ -void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const;
│ │ │ │ │  void pprriioorriittiizzee__ffiilleess (std::vector<download_priority_t> const& files) const;
│ │ │ │ │  download_priority_t ffiillee__pprriioorriittyy (file_index_t index) const;
│ │ │ │ │ +void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const;
│ │ │ │ │  index must be in the range [0, number_of_files).
│ │ │ │ │  file_priority() queries or sets the priority of file index.
│ │ │ │ │  prioritize_files() takes a vector that has at as many elements as there are
│ │ │ │ │  files in the torrent. Each _e_n_t_r_y is the priority of that file. The function
│ │ │ │ │  sets the priorities of all the pieces in the torrent based on the vector.
│ │ │ │ │  get_file_priorities() returns a vector with the priorities of all files.
│ │ │ │ │  The priority values are the same as for _p_i_e_c_e___p_r_i_o_r_i_t_y_(_). See
│ │ │ │ │ @@ -847,19 +847,19 @@
│ │ │ │ │  When combining file- and piece priorities, the resume file will record both.
│ │ │ │ │  When loading the resume data, the file priorities will be applied first, then
│ │ │ │ │  the piece priorities.
│ │ │ │ │  Moving data from a file into the part file is currently not supported. If a
│ │ │ │ │  file has its priority set to 0 aafftteerr it has already been created, it will not
│ │ │ │ │  be moved into the partfile.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffoorrccee__rreeaannnnoouunnccee(()) ffoorrccee__ddhhtt__aannnnoouunnccee(()) ffoorrccee__llssdd__aannnnoouunnccee(()) **********
│ │ │ │ │ -void ffoorrccee__ddhhtt__aannnnoouunnccee () const;
│ │ │ │ │ -void ffoorrccee__llssdd__aannnnoouunnccee () const;
│ │ │ │ │ +********** ffoorrccee__ddhhtt__aannnnoouunnccee(()) ffoorrccee__rreeaannnnoouunnccee(()) ffoorrccee__llssdd__aannnnoouunnccee(()) **********
│ │ │ │ │  void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t = {})
│ │ │ │ │  const;
│ │ │ │ │ +void ffoorrccee__ddhhtt__aannnnoouunnccee () const;
│ │ │ │ │ +void ffoorrccee__llssdd__aannnnoouunnccee () const;
│ │ │ │ │  force_reannounce() will force this torrent to do another tracker request, to
│ │ │ │ │  receive new peers. The seconds argument specifies how many seconds from now to
│ │ │ │ │  issue the tracker announces.
│ │ │ │ │  If the tracker's min_interval has not passed since the last announce, the
│ │ │ │ │  forced announce will be scheduled to happen immediately as the min_interval
│ │ │ │ │  expires. This is to honor trackers minimum re-announce interval settings.
│ │ │ │ │  The tracker_index argument specifies which tracker to re-announce. If set to -
│ │ │ │ │ @@ -877,20 +877,20 @@
│ │ │ │ │  A scrape request queries the tracker for statistics such as total number of
│ │ │ │ │  incomplete peers, complete peers, number of downloads etc.
│ │ │ │ │  This request will specifically update the num_complete and num_incomplete
│ │ │ │ │  fields in the _t_o_r_r_e_n_t___s_t_a_t_u_s struct once it completes. When it completes, it
│ │ │ │ │  will generate a _s_c_r_a_p_e___r_e_p_l_y___a_l_e_r_t. If it fails, it will generate a
│ │ │ │ │  _s_c_r_a_p_e___f_a_i_l_e_d___a_l_e_r_t.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddoowwnnllooaadd__lliimmiitt(()) sseett__uuppllooaadd__lliimmiitt(()) uuppllooaadd__lliimmiitt(()) sseett__ddoowwnnllooaadd__lliimmiitt(())
│ │ │ │ │ +********** sseett__uuppllooaadd__lliimmiitt(()) uuppllooaadd__lliimmiitt(()) ddoowwnnllooaadd__lliimmiitt(()) sseett__ddoowwnnllooaadd__lliimmiitt(())
│ │ │ │ │  **********
│ │ │ │ │ -int uuppllooaadd__lliimmiitt () const;
│ │ │ │ │  void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const;
│ │ │ │ │ -int ddoowwnnllooaadd__lliimmiitt () const;
│ │ │ │ │ +int uuppllooaadd__lliimmiitt () const;
│ │ │ │ │  void sseett__uuppllooaadd__lliimmiitt (int limit) const;
│ │ │ │ │ +int ddoowwnnllooaadd__lliimmiitt () const;
│ │ │ │ │  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. set_download_limit works the same way but for
│ │ │ │ │  download bandwidth instead of upload bandwidth. Note that setting a higher
│ │ │ │ │  limit on a torrent then the global limit (settings_pack::upload_rate_limit)
│ │ │ │ │  will not override the global rate limit. The torrent can never upload more than
│ │ │ │ │  the global rate limit.
│ │ │ │ │ @@ -923,16 +923,16 @@
│ │ │ │ │  set_max_uploads() sets the maximum number of peers that's unchoked at the same
│ │ │ │ │  time on this torrent. If you set this to -1, there will be no limit. This
│ │ │ │ │  defaults to infinite. The primary setting controlling this is the global
│ │ │ │ │  unchoke slots limit, set by unchoke_slots_limit in _s_e_t_t_i_n_g_s___p_a_c_k.
│ │ │ │ │  max_uploads() returns the current settings.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseett__mmaaxx__ccoonnnneeccttiioonnss(()) mmaaxx__ccoonnnneeccttiioonnss(()) **********
│ │ │ │ │ -int mmaaxx__ccoonnnneeccttiioonnss () const;
│ │ │ │ │  void sseett__mmaaxx__ccoonnnneeccttiioonnss (int max_connections) const;
│ │ │ │ │ +int mmaaxx__ccoonnnneeccttiioonnss () const;
│ │ │ │ │  set_max_connections() sets the maximum number of connection this torrent will
│ │ │ │ │  open. If all connections are used up, incoming connections may be refused or
│ │ │ │ │  poor connections may be closed. This must be at least 2. The default is
│ │ │ │ │  unlimited number of connections. If -1 is given to the function, it means
│ │ │ │ │  unlimited. There is also a global limit of the number of connections, set by
│ │ │ │ │  connections_limit in _s_e_t_t_i_n_g_s___p_a_c_k.
│ │ │ │ │  max_connections() returns the current settings.
│ │ │ │ │ @@ -982,27 +982,27 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** rreennaammee__ffiillee(()) **********
│ │ │ │ │  void rreennaammee__ffiillee (file_index_t index, std::string const& new_name) const;
│ │ │ │ │  Renames the file with the given index asynchronously. The rename operation is
│ │ │ │ │  complete when either a _f_i_l_e___r_e_n_a_m_e_d___a_l_e_r_t or _f_i_l_e___r_e_n_a_m_e___f_a_i_l_e_d___a_l_e_r_t is
│ │ │ │ │  posted.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iinnffoo__hhaasshh(()) iinnffoo__hhaasshheess(()) **********
│ │ │ │ │ +********** iinnffoo__hhaasshheess(()) iinnffoo__hhaasshh(()) **********
│ │ │ │ │  sha1_hash iinnffoo__hhaasshh () const;
│ │ │ │ │  info_hash_t iinnffoo__hhaasshheess () const;
│ │ │ │ │  returns the info-hash(es) of the torrent. If this handle is to a torrent that
│ │ │ │ │  hasn't loaded yet (for instance by being added) by a URL, the returned value is
│ │ │ │ │  undefined. The info_hash() returns the SHA-1 info-hash for v1 torrents and a
│ │ │ │ │  truncated hash for v2 torrents. For the full v2 info-hash, use info_hashes()
│ │ │ │ │  instead.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr<<(()) ooppeerraattoorr!!==(()) ooppeerraattoorr====(()) **********
│ │ │ │ │ +********** ooppeerraattoorr!!==(()) ooppeerraattoorr<<(()) ooppeerraattoorr====(()) **********
│ │ │ │ │ +bool ooppeerraattoorr==== (const torrent_handle& h) const;
│ │ │ │ │  bool ooppeerraattoorr!!== (const torrent_handle& h) const;
│ │ │ │ │  bool ooppeerraattoorr<< (const torrent_handle& h) const;
│ │ │ │ │ -bool ooppeerraattoorr==== (const torrent_handle& h) const;
│ │ │ │ │  comparison operators. The order of the torrents is unspecified but stable.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** iidd(()) **********
│ │ │ │ │  std::uint32_t iidd () const;
│ │ │ │ │  returns a unique identifier for this torrent. It's not a dense index. It's not
│ │ │ │ │  preserved across sessions.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Info.html
│ │ │ │ @@ -41,23 +41,23 @@
│ │ │ │  <li><a class="reference internal" href="#load-torrent-limits" id="toc-entry-5">load_torrent_limits</a></li>
│ │ │ │  <li><a class="reference internal" href="#torrent-info" id="toc-entry-6">torrent_info</a><ul>
│ │ │ │  <li><a class="reference internal" href="#torrent-info-1" id="toc-entry-7">torrent_info()</a></li>
│ │ │ │  <li><a class="reference internal" href="#torrent-info-2" id="toc-entry-8">~torrent_info()</a></li>
│ │ │ │  <li><a class="reference internal" href="#files-orig-files" id="toc-entry-9">files() orig_files()</a></li>
│ │ │ │  <li><a class="reference internal" href="#rename-file" id="toc-entry-10">rename_file()</a></li>
│ │ │ │  <li><a class="reference internal" href="#remap-files" id="toc-entry-11">remap_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-tracker-clear-trackers-trackers" id="toc-entry-12">add_tracker() clear_trackers() trackers()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#clear-trackers-add-tracker-trackers" id="toc-entry-12">clear_trackers() add_tracker() trackers()</a></li>
│ │ │ │  <li><a class="reference internal" href="#similar-torrents-collections" id="toc-entry-13">similar_torrents() collections()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-url-seed-add-http-seed-web-seeds-set-web-seeds" id="toc-entry-14">add_url_seed() add_http_seed() web_seeds() set_web_seeds()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#web-seeds-set-web-seeds-add-http-seed-add-url-seed" id="toc-entry-14">web_seeds() set_web_seeds() add_http_seed() add_url_seed()</a></li>
│ │ │ │  <li><a class="reference internal" href="#total-size" id="toc-entry-15">total_size()</a></li>
│ │ │ │  <li><a class="reference internal" href="#num-pieces-piece-length" id="toc-entry-16">num_pieces() piece_length()</a></li>
│ │ │ │  <li><a class="reference internal" href="#blocks-per-piece" id="toc-entry-17">blocks_per_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#last-piece-piece-range-end-piece" id="toc-entry-18">last_piece() piece_range() end_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#info-hash-info-hashes" id="toc-entry-19">info_hash() info_hashes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#v2-v1" id="toc-entry-20">v2() v1()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-range-last-piece-end-piece" id="toc-entry-18">piece_range() last_piece() end_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#info-hashes-info-hash" id="toc-entry-19">info_hashes() info_hash()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#v1-v2" id="toc-entry-20">v1() v2()</a></li>
│ │ │ │  <li><a class="reference internal" href="#num-files" id="toc-entry-21">num_files()</a></li>
│ │ │ │  <li><a class="reference internal" href="#map-block" id="toc-entry-22">map_block()</a></li>
│ │ │ │  <li><a class="reference internal" href="#map-file" id="toc-entry-23">map_file()</a></li>
│ │ │ │  <li><a class="reference internal" href="#ssl-cert" id="toc-entry-24">ssl_cert()</a></li>
│ │ │ │  <li><a class="reference internal" href="#is-valid" id="toc-entry-25">is_valid()</a></li>
│ │ │ │  <li><a class="reference internal" href="#priv" id="toc-entry-26">priv()</a></li>
│ │ │ │  <li><a class="reference internal" href="#is-i2p" id="toc-entry-27">is_i2p()</a></li>
│ │ │ │ @@ -197,69 +197,69 @@
│ │ │ │  <div class="section" id="torrent-info">
│ │ │ │  <h1>torrent_info</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_info.hpp">libtorrent/torrent_info.hpp</a>&quot;</p>
│ │ │ │  <p>the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> class holds the information found in a .torrent file.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  class torrent_info
│ │ │ │  {
│ │ │ │ -   explicit <strong>torrent_info</strong> (span&lt;char const&gt; buffer, from_span_t);
│ │ │ │ -   <strong>torrent_info</strong> (span&lt;char const&gt; buffer, error_code&amp; ec, from_span_t);
│ │ │ │ -   <strong>torrent_info</strong> (torrent_info const&amp; t);
│ │ │ │ -   <strong>torrent_info</strong> (std::string const&amp; filename, error_code&amp; ec);
│ │ │ │ +   <strong>torrent_info</strong> (char const* buffer, int size, error_code&amp; ec);
│ │ │ │     <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg);
│ │ │ │     explicit <strong>torrent_info</strong> (info_hash_t const&amp; info_hash);
│ │ │ │ -   explicit <strong>torrent_info</strong> (std::string const&amp; filename);
│ │ │ │     <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, error_code&amp; ec);
│ │ │ │ -   explicit <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file);
│ │ │ │ -   <strong>torrent_info</strong> (char const* buffer, int size, error_code&amp; ec);
│ │ │ │ -   <strong>torrent_info</strong> (std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ +   explicit <strong>torrent_info</strong> (std::string const&amp; filename);
│ │ │ │ +   <strong>torrent_info</strong> (std::string const&amp; filename, error_code&amp; ec);
│ │ │ │     <strong>torrent_info</strong> (span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg, from_span_t);
│ │ │ │ +   <strong>torrent_info</strong> (span&lt;char const&gt; buffer, error_code&amp; ec, from_span_t);
│ │ │ │     <strong>torrent_info</strong> (char const* buffer, int size);
│ │ │ │ +   explicit <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file);
│ │ │ │ +   <strong>torrent_info</strong> (std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ +   explicit <strong>torrent_info</strong> (span&lt;char const&gt; buffer, from_span_t);
│ │ │ │ +   <strong>torrent_info</strong> (torrent_info const&amp; t);
│ │ │ │     <strong>~torrent_info</strong> ();
│ │ │ │     file_storage const&amp; <strong>files</strong> () const;
│ │ │ │     file_storage const&amp; <strong>orig_files</strong> () const;
│ │ │ │     void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │     void <strong>remap_files</strong> (file_storage const&amp; f);
│ │ │ │ -   void <strong>add_tracker</strong> (std::string const&amp; url, int tier = 0);
│ │ │ │     std::vector&lt;announce_entry&gt; const&amp; <strong>trackers</strong> () const;
│ │ │ │ +   void <strong>clear_trackers</strong> ();
│ │ │ │     void <strong>add_tracker</strong> (std::string const&amp; url, int tier
│ │ │ │        , announce_entry::tracker_source source);
│ │ │ │ -   void <strong>clear_trackers</strong> ();
│ │ │ │ -   std::vector&lt;sha1_hash&gt; <strong>similar_torrents</strong> () const;
│ │ │ │ +   void <strong>add_tracker</strong> (std::string const&amp; url, int tier = 0);
│ │ │ │     std::vector&lt;std::string&gt; <strong>collections</strong> () const;
│ │ │ │ +   std::vector&lt;sha1_hash&gt; <strong>similar_torrents</strong> () const;
│ │ │ │ +   std::vector&lt;web_seed_entry&gt; const&amp; <strong>web_seeds</strong> () const;
│ │ │ │     void <strong>set_web_seeds</strong> (std::vector&lt;web_seed_entry&gt; seeds);
│ │ │ │     void <strong>add_http_seed</strong> (std::string const&amp; url
│ │ │ │        , std::string const&amp; extern_auth = std::string()
│ │ │ │        , web_seed_entry::headers_t const&amp; extra_headers = web_seed_entry::headers_t());
│ │ │ │     void <strong>add_url_seed</strong> (std::string const&amp; url
│ │ │ │        , std::string const&amp; ext_auth = std::string()
│ │ │ │        , web_seed_entry::headers_t const&amp; ext_headers = web_seed_entry::headers_t());
│ │ │ │ -   std::vector&lt;web_seed_entry&gt; const&amp; <strong>web_seeds</strong> () const;
│ │ │ │     std::int64_t <strong>total_size</strong> () const;
│ │ │ │ -   int <strong>piece_length</strong> () const;
│ │ │ │     int <strong>num_pieces</strong> () const;
│ │ │ │ +   int <strong>piece_length</strong> () const;
│ │ │ │     int <strong>blocks_per_piece</strong> () const;
│ │ │ │ -   piece_index_t <strong>end_piece</strong> () const;
│ │ │ │     index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const;
│ │ │ │     piece_index_t <strong>last_piece</strong> () const;
│ │ │ │ -   info_hash_t const&amp; <strong>info_hashes</strong> () const;
│ │ │ │ +   piece_index_t <strong>end_piece</strong> () const;
│ │ │ │     sha1_hash <strong>info_hash</strong> () const noexcept;
│ │ │ │ -   bool <strong>v1</strong> () const;
│ │ │ │ +   info_hash_t const&amp; <strong>info_hashes</strong> () const;
│ │ │ │     bool <strong>v2</strong> () const;
│ │ │ │ +   bool <strong>v1</strong> () const;
│ │ │ │     int <strong>num_files</strong> () const;
│ │ │ │     std::vector&lt;file_slice&gt; <strong>map_block</strong> (piece_index_t const piece
│ │ │ │        , std::int64_t offset, int size) const;
│ │ │ │     peer_request <strong>map_file</strong> (file_index_t const file, std::int64_t offset, int size) const;
│ │ │ │     string_view <strong>ssl_cert</strong> () const;
│ │ │ │     bool <strong>is_valid</strong> () const;
│ │ │ │     bool <strong>priv</strong> () const;
│ │ │ │     bool <strong>is_i2p</strong> () const;
│ │ │ │     int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │ -   char const* <strong>hash_for_piece_ptr</strong> (piece_index_t const index) const;
│ │ │ │     sha1_hash <strong>hash_for_piece</strong> (piece_index_t index) const;
│ │ │ │ +   char const* <strong>hash_for_piece_ptr</strong> (piece_index_t const index) const;
│ │ │ │     bool <strong>is_loaded</strong> () const;
│ │ │ │     const std::string&amp; <strong>name</strong> () const;
│ │ │ │     std::time_t <strong>creation_date</strong> () const;
│ │ │ │     const std::string&amp; <strong>creator</strong> () const;
│ │ │ │     const std::string&amp; <strong>comment</strong> () const;
│ │ │ │     std::vector&lt;std::pair&lt;std::string, int&gt;&gt; const&amp; <strong>nodes</strong> () const;
│ │ │ │     void <strong>add_node</strong> (std::pair&lt;std::string, int&gt; const&amp; node);
│ │ │ │ @@ -269,27 +269,27 @@
│ │ │ │     span&lt;char const&gt; <strong>piece_layer</strong> (file_index_t) const;
│ │ │ │     void <strong>free_piece_layers</strong> ();
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="torrent_info()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Btorrent_info%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Btorrent_info%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="torrent-info-1">
│ │ │ │  <h2>torrent_info()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -explicit <strong>torrent_info</strong> (span&lt;char const&gt; buffer, from_span_t);
│ │ │ │ -<strong>torrent_info</strong> (span&lt;char const&gt; buffer, error_code&amp; ec, from_span_t);
│ │ │ │ -<strong>torrent_info</strong> (torrent_info const&amp; t);
│ │ │ │ -<strong>torrent_info</strong> (std::string const&amp; filename, error_code&amp; ec);
│ │ │ │ +<strong>torrent_info</strong> (char const* buffer, int size, error_code&amp; ec);
│ │ │ │  <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg);
│ │ │ │  explicit <strong>torrent_info</strong> (info_hash_t const&amp; info_hash);
│ │ │ │ -explicit <strong>torrent_info</strong> (std::string const&amp; filename);
│ │ │ │  <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, error_code&amp; ec);
│ │ │ │ -explicit <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file);
│ │ │ │ -<strong>torrent_info</strong> (char const* buffer, int size, error_code&amp; ec);
│ │ │ │ -<strong>torrent_info</strong> (std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ +explicit <strong>torrent_info</strong> (std::string const&amp; filename);
│ │ │ │ +<strong>torrent_info</strong> (std::string const&amp; filename, error_code&amp; ec);
│ │ │ │  <strong>torrent_info</strong> (span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg, from_span_t);
│ │ │ │ +<strong>torrent_info</strong> (span&lt;char const&gt; buffer, error_code&amp; ec, from_span_t);
│ │ │ │  <strong>torrent_info</strong> (char const* buffer, int size);
│ │ │ │ +explicit <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file);
│ │ │ │ +<strong>torrent_info</strong> (std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ +explicit <strong>torrent_info</strong> (span&lt;char const&gt; buffer, from_span_t);
│ │ │ │ +<strong>torrent_info</strong> (torrent_info const&amp; t);
│ │ │ │  </pre>
│ │ │ │  <p>The constructor that takes an info-hash will initialize the info-hash
│ │ │ │  to the given value, but leave all other fields empty. This is used
│ │ │ │  internally when downloading torrents without the metadata. The
│ │ │ │  metadata will be created by libtorrent as soon as it has been
│ │ │ │  downloaded from the swarm.</p>
│ │ │ │  <p>The constructor that takes a <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> will create a <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>
│ │ │ │ @@ -348,15 +348,15 @@
│ │ │ │  <pre class="literal-block">
│ │ │ │  void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │  </pre>
│ │ │ │  <p>Renames the file with the specified index to the new name. The new
│ │ │ │  filename is reflected by the <tt class="docutils literal">file_storage</tt> returned by <tt class="docutils literal">files()</tt>
│ │ │ │  but not by the one returned by <tt class="docutils literal">orig_files()</tt>.</p>
│ │ │ │  <p>If you want to rename the base name of the torrent (for a multi file
│ │ │ │ -torrent), you can copy the <tt class="docutils literal">file_storage</tt> (see <a class="reference external" href="reference-Create_Torrents.html#files()">files()</a> and
│ │ │ │ +torrent), you can copy the <tt class="docutils literal">file_storage</tt> (see <a class="reference external" href="reference-Torrent_Info.html#files()">files()</a> and
│ │ │ │  <a class="reference external" href="reference-Torrent_Info.html#orig_files()">orig_files()</a> ), change the name, and then use <a class="reference internal" href="#remap-files">remap_files()</a>.</p>
│ │ │ │  <p>The <tt class="docutils literal">new_filename</tt> can both be a relative path, in which case the
│ │ │ │  file name is relative to the <tt class="docutils literal">save_path</tt> of the torrent. If the
│ │ │ │  <tt class="docutils literal">new_filename</tt> is an absolute path (i.e. <tt class="docutils literal">is_complete(new_filename)
│ │ │ │  == true</tt>), then the file is detached from the <tt class="docutils literal">save_path</tt> of the
│ │ │ │  torrent. In this case the file is not moved when <a class="reference external" href="reference-Torrent_Handle.html#move_storage()">move_storage()</a> is
│ │ │ │  invoked.</p>
│ │ │ │ @@ -376,25 +376,25 @@
│ │ │ │  </div>
│ │ │ │  <p>Remaps the file storage to a new file layout. This can be used to, for
│ │ │ │  instance, download all data in a torrent to a single file, or to a
│ │ │ │  number of fixed size sector aligned files, regardless of the number
│ │ │ │  and sizes of the files in the torrent.</p>
│ │ │ │  <p>The new specified <tt class="docutils literal">file_storage</tt> must have the exact same size as
│ │ │ │  the current one.</p>
│ │ │ │ -<a name="add_tracker()"></a>
│ │ │ │  <a name="clear_trackers()"></a>
│ │ │ │ -<a name="trackers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Badd_tracker%28%29+clear_trackers%28%29+trackers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Badd_tracker%28%29+clear_trackers%28%29+trackers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-tracker-clear-trackers-trackers">
│ │ │ │ -<h2>add_tracker() clear_trackers() trackers()</h2>
│ │ │ │ +<a name="add_tracker()"></a>
│ │ │ │ +<a name="trackers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bclear_trackers%28%29+add_tracker%28%29+trackers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bclear_trackers%28%29+add_tracker%28%29+trackers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="clear-trackers-add-tracker-trackers">
│ │ │ │ +<h2>clear_trackers() add_tracker() trackers()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>add_tracker</strong> (std::string const&amp; url, int tier = 0);
│ │ │ │  std::vector&lt;announce_entry&gt; const&amp; <strong>trackers</strong> () const;
│ │ │ │ +void <strong>clear_trackers</strong> ();
│ │ │ │  void <strong>add_tracker</strong> (std::string const&amp; url, int tier
│ │ │ │        , announce_entry::tracker_source source);
│ │ │ │ -void <strong>clear_trackers</strong> ();
│ │ │ │ +void <strong>add_tracker</strong> (std::string const&amp; url, int tier = 0);
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">add_tracker()</tt> adds a tracker to the announce-list. The <tt class="docutils literal">tier</tt>
│ │ │ │  determines the order in which the trackers are to be tried.
│ │ │ │  The <tt class="docutils literal">trackers()</tt> function will return a sorted vector of
│ │ │ │  <a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a>. Each announce <a class="reference external" href="reference-Bencoding.html#entry">entry</a> contains a string, which is
│ │ │ │  the tracker url, and a tier index. The tier index is the high-level
│ │ │ │  priority. No matter which trackers that works or not, the ones with
│ │ │ │ @@ -403,37 +403,37 @@
│ │ │ │  <p><tt class="docutils literal">trackers()</tt> returns all entries from announce-list.</p>
│ │ │ │  <p><tt class="docutils literal">clear_trackers()</tt> removes all trackers from announce-list.</p>
│ │ │ │  <a name="similar_torrents()"></a>
│ │ │ │  <a name="collections()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bsimilar_torrents%28%29+collections%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bsimilar_torrents%28%29+collections%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="similar-torrents-collections">
│ │ │ │  <h2>similar_torrents() collections()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::vector&lt;sha1_hash&gt; <strong>similar_torrents</strong> () const;
│ │ │ │  std::vector&lt;std::string&gt; <strong>collections</strong> () const;
│ │ │ │ +std::vector&lt;sha1_hash&gt; <strong>similar_torrents</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>These two functions are related to <a class="reference external" href="https://www.bittorrent.org/beps/bep_0038.html">BEP 38</a> (mutable torrents). The
│ │ │ │  vectors returned from these correspond to the &quot;similar&quot; and
│ │ │ │  &quot;collections&quot; keys in the .torrent file. Both info-hashes and
│ │ │ │  collections from within the info-dict and from outside of it are
│ │ │ │  included.</p>
│ │ │ │ -<a name="add_url_seed()"></a>
│ │ │ │ -<a name="add_http_seed()"></a>
│ │ │ │  <a name="web_seeds()"></a>
│ │ │ │ -<a name="set_web_seeds()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Badd_url_seed%28%29+add_http_seed%28%29+web_seeds%28%29+set_web_seeds%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Badd_url_seed%28%29+add_http_seed%28%29+web_seeds%28%29+set_web_seeds%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-url-seed-add-http-seed-web-seeds-set-web-seeds">
│ │ │ │ -<h2>add_url_seed() add_http_seed() web_seeds() set_web_seeds()</h2>
│ │ │ │ +<a name="set_web_seeds()"></a>
│ │ │ │ +<a name="add_http_seed()"></a>
│ │ │ │ +<a name="add_url_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bweb_seeds%28%29+set_web_seeds%28%29+add_http_seed%28%29+add_url_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bweb_seeds%28%29+set_web_seeds%28%29+add_http_seed%28%29+add_url_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="web-seeds-set-web-seeds-add-http-seed-add-url-seed">
│ │ │ │ +<h2>web_seeds() set_web_seeds() add_http_seed() add_url_seed()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +std::vector&lt;web_seed_entry&gt; const&amp; <strong>web_seeds</strong> () const;
│ │ │ │  void <strong>set_web_seeds</strong> (std::vector&lt;web_seed_entry&gt; seeds);
│ │ │ │  void <strong>add_http_seed</strong> (std::string const&amp; url
│ │ │ │        , std::string const&amp; extern_auth = std::string()
│ │ │ │        , web_seed_entry::headers_t const&amp; extra_headers = web_seed_entry::headers_t());
│ │ │ │  void <strong>add_url_seed</strong> (std::string const&amp; url
│ │ │ │        , std::string const&amp; ext_auth = std::string()
│ │ │ │        , web_seed_entry::headers_t const&amp; ext_headers = web_seed_entry::headers_t());
│ │ │ │ -std::vector&lt;web_seed_entry&gt; const&amp; <strong>web_seeds</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">web_seeds()</tt> returns all url seeds and http seeds in the torrent.
│ │ │ │  Each <a class="reference external" href="reference-Bencoding.html#entry">entry</a> is a <tt class="docutils literal">web_seed_entry</tt> and may refer to either a url seed
│ │ │ │  or http seed.</p>
│ │ │ │  <p><tt class="docutils literal">add_url_seed()</tt> and <tt class="docutils literal">add_http_seed()</tt> adds one url to the list of
│ │ │ │  url/http seeds.</p>
│ │ │ │  <p><tt class="docutils literal">set_web_seeds()</tt> replaces all web seeds with the ones specified in
│ │ │ │ @@ -458,16 +458,16 @@
│ │ │ │  the total size will be larger than the sum of all (regular) file
│ │ │ │  sizes.</p>
│ │ │ │  <a name="num_pieces()"></a>
│ │ │ │  <a name="piece_length()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bnum_pieces%28%29+piece_length%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bnum_pieces%28%29+piece_length%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="num-pieces-piece-length">
│ │ │ │  <h2>num_pieces() piece_length()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -int <strong>piece_length</strong> () const;
│ │ │ │  int <strong>num_pieces</strong> () const;
│ │ │ │ +int <strong>piece_length</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">piece_length()</tt> and <tt class="docutils literal">num_pieces()</tt> returns the number of byte
│ │ │ │  for each piece and the total number of pieces, respectively. The
│ │ │ │  difference between <tt class="docutils literal">piece_size()</tt> and <tt class="docutils literal">piece_length()</tt> is that
│ │ │ │  <tt class="docutils literal">piece_size()</tt> takes the piece index as argument and gives you the
│ │ │ │  exact size of that piece. It will always be the same as
│ │ │ │  <tt class="docutils literal">piece_length()</tt> except in the case of the last piece, which may be
│ │ │ │ @@ -476,48 +476,48 @@
│ │ │ │  <div class="section" id="blocks-per-piece">
│ │ │ │  <h2>blocks_per_piece()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  int <strong>blocks_per_piece</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>returns the number of blocks there are in the typical piece. There
│ │ │ │  may be fewer in the last piece)</p>
│ │ │ │ -<a name="last_piece()"></a>
│ │ │ │  <a name="piece_range()"></a>
│ │ │ │ -<a name="end_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Blast_piece%28%29+piece_range%28%29+end_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Blast_piece%28%29+piece_range%28%29+end_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="last-piece-piece-range-end-piece">
│ │ │ │ -<h2>last_piece() piece_range() end_piece()</h2>
│ │ │ │ +<a name="last_piece()"></a>
│ │ │ │ +<a name="end_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpiece_range%28%29+last_piece%28%29+end_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpiece_range%28%29+last_piece%28%29+end_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-range-last-piece-end-piece">
│ │ │ │ +<h2>piece_range() last_piece() end_piece()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -piece_index_t <strong>end_piece</strong> () const;
│ │ │ │  index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const;
│ │ │ │  piece_index_t <strong>last_piece</strong> () const;
│ │ │ │ +piece_index_t <strong>end_piece</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">last_piece()</tt> returns the index to the last piece in the torrent and
│ │ │ │  <tt class="docutils literal">end_piece()</tt> returns the index to the one-past-end piece in the
│ │ │ │  torrent
│ │ │ │  <tt class="docutils literal">piece_range()</tt> returns an implementation-defined type that can be
│ │ │ │  used as the container in a range-for loop. Where the values are the
│ │ │ │  indices of all pieces in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │ -<a name="info_hash()"></a>
│ │ │ │ -<a name="info_hashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Binfo_hash%28%29+info_hashes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Binfo_hash%28%29+info_hashes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="info-hash-info-hashes">
│ │ │ │ -<h2>info_hash() info_hashes()</h2>
│ │ │ │ +<a name="info_hashes()"></a>
│ │ │ │ +<a name="info_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="info-hashes-info-hash">
│ │ │ │ +<h2>info_hashes() info_hash()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -info_hash_t const&amp; <strong>info_hashes</strong> () const;
│ │ │ │  sha1_hash <strong>info_hash</strong> () const noexcept;
│ │ │ │ +info_hash_t const&amp; <strong>info_hashes</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>returns the info-hash of the torrent. For BitTorrent v2 support, use
│ │ │ │  <tt class="docutils literal">info_hashes()</tt> to get an object that may hold both a v1 and v2
│ │ │ │  info-hash</p>
│ │ │ │ -<a name="v2()"></a>
│ │ │ │ -<a name="v1()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bv2%28%29+v1%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bv2%28%29+v1%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="v2-v1">
│ │ │ │ -<h2>v2() v1()</h2>
│ │ │ │ +<a name="v1()"></a>
│ │ │ │ +<a name="v2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bv1%28%29+v2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bv1%28%29+v2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="v1-v2">
│ │ │ │ +<h2>v1() v2()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>v1</strong> () const;
│ │ │ │  bool <strong>v2</strong> () const;
│ │ │ │ +bool <strong>v1</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>returns whether this torrent has v1 and/or v2 metadata, respectively.
│ │ │ │  Hybrid torrents have both. These are shortcuts for
│ │ │ │  info_hashes().has_v1() and info_hashes().has_v2() calls.</p>
│ │ │ │  <a name="num_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bnum_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bnum_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="num-files">
│ │ │ │  <h2>num_files()</h2>
│ │ │ │ @@ -588,23 +588,23 @@
│ │ │ │  to peers over anything other than the i2p network.</p>
│ │ │ │  <a name="piece_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpiece_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpiece_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="piece-size">
│ │ │ │  <h2>piece_size()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │  </pre>
│ │ │ │ -<p>returns the piece size of file with <tt class="docutils literal">index</tt>. This will be the same as <a class="reference external" href="reference-Create_Torrents.html#piece_length()">piece_length()</a>,
│ │ │ │ +<p>returns the piece size of file with <tt class="docutils literal">index</tt>. This will be the same as <a class="reference external" href="reference-Storage.html#piece_length()">piece_length()</a>,
│ │ │ │  except for the last piece, which may be shorter.</p>
│ │ │ │  <a name="hash_for_piece()"></a>
│ │ │ │  <a name="hash_for_piece_ptr()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bhash_for_piece%28%29+hash_for_piece_ptr%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bhash_for_piece%28%29+hash_for_piece_ptr%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="hash-for-piece-hash-for-piece-ptr">
│ │ │ │  <h2>hash_for_piece() hash_for_piece_ptr()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -char const* <strong>hash_for_piece_ptr</strong> (piece_index_t const index) const;
│ │ │ │  sha1_hash <strong>hash_for_piece</strong> (piece_index_t index) const;
│ │ │ │ +char const* <strong>hash_for_piece_ptr</strong> (piece_index_t const index) const;
│ │ │ │  </pre>
│ │ │ │  <p><tt class="docutils literal">hash_for_piece()</tt> takes a piece-index and returns the 20-bytes
│ │ │ │  sha1-hash for that piece and <tt class="docutils literal">info_hash()</tt> returns the 20-bytes
│ │ │ │  sha1-hash for the info-section of the torrent file.
│ │ │ │  <tt class="docutils literal">hash_for_piece_ptr()</tt> returns a pointer to the 20 byte sha1 digest
│ │ │ │  for the piece. Note that the string is not 0-terminated.</p>
│ │ │ │  <a name="name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bname%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bname%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -10,23 +10,23 @@
│ │ │ │ │      * _l_o_a_d___t_o_r_r_e_n_t___l_i_m_i_t_s
│ │ │ │ │      * _t_o_r_r_e_n_t___i_n_f_o
│ │ │ │ │            o _t_o_r_r_e_n_t___i_n_f_o_(_)
│ │ │ │ │            o _~_t_o_r_r_e_n_t___i_n_f_o_(_)
│ │ │ │ │            o _f_i_l_e_s_(_)_ _o_r_i_g___f_i_l_e_s_(_)
│ │ │ │ │            o _r_e_n_a_m_e___f_i_l_e_(_)
│ │ │ │ │            o _r_e_m_a_p___f_i_l_e_s_(_)
│ │ │ │ │ -          o _a_d_d___t_r_a_c_k_e_r_(_)_ _c_l_e_a_r___t_r_a_c_k_e_r_s_(_)_ _t_r_a_c_k_e_r_s_(_)
│ │ │ │ │ +          o _c_l_e_a_r___t_r_a_c_k_e_r_s_(_)_ _a_d_d___t_r_a_c_k_e_r_(_)_ _t_r_a_c_k_e_r_s_(_)
│ │ │ │ │            o _s_i_m_i_l_a_r___t_o_r_r_e_n_t_s_(_)_ _c_o_l_l_e_c_t_i_o_n_s_(_)
│ │ │ │ │ -          o _a_d_d___u_r_l___s_e_e_d_(_)_ _a_d_d___h_t_t_p___s_e_e_d_(_)_ _w_e_b___s_e_e_d_s_(_)_ _s_e_t___w_e_b___s_e_e_d_s_(_)
│ │ │ │ │ +          o _w_e_b___s_e_e_d_s_(_)_ _s_e_t___w_e_b___s_e_e_d_s_(_)_ _a_d_d___h_t_t_p___s_e_e_d_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)
│ │ │ │ │            o _t_o_t_a_l___s_i_z_e_(_)
│ │ │ │ │            o _n_u_m___p_i_e_c_e_s_(_)_ _p_i_e_c_e___l_e_n_g_t_h_(_)
│ │ │ │ │            o _b_l_o_c_k_s___p_e_r___p_i_e_c_e_(_)
│ │ │ │ │ -          o _l_a_s_t___p_i_e_c_e_(_)_ _p_i_e_c_e___r_a_n_g_e_(_)_ _e_n_d___p_i_e_c_e_(_)
│ │ │ │ │ -          o _i_n_f_o___h_a_s_h_(_)_ _i_n_f_o___h_a_s_h_e_s_(_)
│ │ │ │ │ -          o _v_2_(_)_ _v_1_(_)
│ │ │ │ │ +          o _p_i_e_c_e___r_a_n_g_e_(_)_ _l_a_s_t___p_i_e_c_e_(_)_ _e_n_d___p_i_e_c_e_(_)
│ │ │ │ │ +          o _i_n_f_o___h_a_s_h_e_s_(_)_ _i_n_f_o___h_a_s_h_(_)
│ │ │ │ │ +          o _v_1_(_)_ _v_2_(_)
│ │ │ │ │            o _n_u_m___f_i_l_e_s_(_)
│ │ │ │ │            o _m_a_p___b_l_o_c_k_(_)
│ │ │ │ │            o _m_a_p___f_i_l_e_(_)
│ │ │ │ │            o _s_s_l___c_e_r_t_(_)
│ │ │ │ │            o _i_s___v_a_l_i_d_(_)
│ │ │ │ │            o _p_r_i_v_(_)
│ │ │ │ │            o _i_s___i_2_p_(_)
│ │ │ │ │ @@ -120,74 +120,74 @@
│ │ │ │ │        the max number of bdecode tokens
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ttoorrrreenntt__iinnffoo ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___i_n_f_o_._h_p_p"
│ │ │ │ │  the _t_o_r_r_e_n_t___i_n_f_o class holds the information found in a .torrent file.
│ │ │ │ │  class torrent_info
│ │ │ │ │  {
│ │ │ │ │ -   explicit ttoorrrreenntt__iinnffoo (span<char const> buffer, from_span_t);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (span<char const> buffer, error_code& ec, from_span_t);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (torrent_info const& t);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec);
│ │ │ │ │     ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, load_torrent_limits const&
│ │ │ │ │  cfg);
│ │ │ │ │     explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash);
│ │ │ │ │ -   explicit ttoorrrreenntt__iinnffoo (std::string const& filename);
│ │ │ │ │     ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec);
│ │ │ │ │ -   explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ +   explicit ttoorrrreenntt__iinnffoo (std::string const& filename);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec);
│ │ │ │ │     ttoorrrreenntt__iinnffoo (span<char const> buffer, load_torrent_limits const& cfg,
│ │ │ │ │  from_span_t);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (span<char const> buffer, error_code& ec, from_span_t);
│ │ │ │ │     ttoorrrreenntt__iinnffoo (char const* buffer, int size);
│ │ │ │ │ +   explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ +   explicit ttoorrrreenntt__iinnffoo (span<char const> buffer, from_span_t);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (torrent_info const& t);
│ │ │ │ │     ~~ttoorrrreenntt__iinnffoo ();
│ │ │ │ │     file_storage const& ffiilleess () const;
│ │ │ │ │     file_storage const& oorriigg__ffiilleess () const;
│ │ │ │ │     void rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
│ │ │ │ │     void rreemmaapp__ffiilleess (file_storage const& f);
│ │ │ │ │ -   void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0);
│ │ │ │ │     std::vector<announce_entry> const& ttrraacckkeerrss () const;
│ │ │ │ │ +   void cclleeaarr__ttrraacckkeerrss ();
│ │ │ │ │     void aadddd__ttrraacckkeerr (std::string const& url, int tier
│ │ │ │ │        , announce_entry::tracker_source source);
│ │ │ │ │ -   void cclleeaarr__ttrraacckkeerrss ();
│ │ │ │ │ -   std::vector<sha1_hash> ssiimmiillaarr__ttoorrrreennttss () const;
│ │ │ │ │ +   void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0);
│ │ │ │ │     std::vector<std::string> ccoolllleeccttiioonnss () const;
│ │ │ │ │ +   std::vector<sha1_hash> ssiimmiillaarr__ttoorrrreennttss () const;
│ │ │ │ │ +   std::vector<web_seed_entry> const& wweebb__sseeeeddss () const;
│ │ │ │ │     void sseett__wweebb__sseeeeddss (std::vector<web_seed_entry> seeds);
│ │ │ │ │     void aadddd__hhttttpp__sseeeedd (std::string const& url
│ │ │ │ │        , std::string const& extern_auth = std::string()
│ │ │ │ │        , web_seed_entry::headers_t const& extra_headers = web_seed_entry::
│ │ │ │ │  headers_t());
│ │ │ │ │     void aadddd__uurrll__sseeeedd (std::string const& url
│ │ │ │ │        , std::string const& ext_auth = std::string()
│ │ │ │ │        , web_seed_entry::headers_t const& ext_headers = web_seed_entry::
│ │ │ │ │  headers_t());
│ │ │ │ │ -   std::vector<web_seed_entry> const& wweebb__sseeeeddss () const;
│ │ │ │ │     std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ -   int ppiieeccee__lleennggtthh () const;
│ │ │ │ │     int nnuumm__ppiieecceess () const;
│ │ │ │ │ +   int ppiieeccee__lleennggtthh () const;
│ │ │ │ │     int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │ -   piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │     index_range<piece_index_t> ppiieeccee__rraannggee () const;
│ │ │ │ │     piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │ -   info_hash_t const& iinnffoo__hhaasshheess () const;
│ │ │ │ │ +   piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │     sha1_hash iinnffoo__hhaasshh () const noexcept;
│ │ │ │ │ -   bool vv11 () const;
│ │ │ │ │ +   info_hash_t const& iinnffoo__hhaasshheess () const;
│ │ │ │ │     bool vv22 () const;
│ │ │ │ │ +   bool vv11 () const;
│ │ │ │ │     int nnuumm__ffiilleess () const;
│ │ │ │ │     std::vector<file_slice> mmaapp__bblloocckk (piece_index_t const piece
│ │ │ │ │        , std::int64_t offset, int size) const;
│ │ │ │ │     peer_request mmaapp__ffiillee (file_index_t const file, std::int64_t offset, int
│ │ │ │ │  size) const;
│ │ │ │ │     string_view ssssll__cceerrtt () const;
│ │ │ │ │     bool iiss__vvaalliidd () const;
│ │ │ │ │     bool pprriivv () const;
│ │ │ │ │     bool iiss__ii22pp () const;
│ │ │ │ │     int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │ -   char const* hhaasshh__ffoorr__ppiieeccee__ppttrr (piece_index_t const index) const;
│ │ │ │ │     sha1_hash hhaasshh__ffoorr__ppiieeccee (piece_index_t index) const;
│ │ │ │ │ +   char const* hhaasshh__ffoorr__ppiieeccee__ppttrr (piece_index_t const index) const;
│ │ │ │ │     bool iiss__llooaaddeedd () const;
│ │ │ │ │     const std::string& nnaammee () const;
│ │ │ │ │     std::time_t ccrreeaattiioonn__ddaattee () const;
│ │ │ │ │     const std::string& ccrreeaattoorr () const;
│ │ │ │ │     const std::string& ccoommmmeenntt () const;
│ │ │ │ │     std::vector<std::pair<std::string, int>> const& nnooddeess () const;
│ │ │ │ │     void aadddd__nnooddee (std::pair<std::string, int> const& node);
│ │ │ │ │ @@ -196,29 +196,29 @@
│ │ │ │ │     bdecode_node iinnffoo (char const* key) const;
│ │ │ │ │     span<char const> iinnffoo__sseeccttiioonn () const;
│ │ │ │ │     span<char const> ppiieeccee__llaayyeerr (file_index_t) const;
│ │ │ │ │     void ffrreeee__ppiieeccee__llaayyeerrss ();
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ttoorrrreenntt__iinnffoo(()) **********
│ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (span<char const> buffer, from_span_t);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (span<char const> buffer, error_code& ec, from_span_t);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (torrent_info const& t);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec);
│ │ │ │ │  ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, load_torrent_limits const&
│ │ │ │ │  cfg);
│ │ │ │ │  explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash);
│ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (std::string const& filename);
│ │ │ │ │  ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec);
│ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (std::string const& filename);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec);
│ │ │ │ │  ttoorrrreenntt__iinnffoo (span<char const> buffer, load_torrent_limits const& cfg,
│ │ │ │ │  from_span_t);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (span<char const> buffer, error_code& ec, from_span_t);
│ │ │ │ │  ttoorrrreenntt__iinnffoo (char const* buffer, int size);
│ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (span<char const> buffer, from_span_t);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (torrent_info const& t);
│ │ │ │ │  The constructor that takes an info-hash will initialize the info-hash to the
│ │ │ │ │  given value, but leave all other fields empty. This is used internally when
│ │ │ │ │  downloading torrents without the metadata. The metadata will be created by
│ │ │ │ │  libtorrent as soon as it has been downloaded from the swarm.
│ │ │ │ │  The constructor that takes a _b_d_e_c_o_d_e___n_o_d_e will create a _t_o_r_r_e_n_t___i_n_f_o object
│ │ │ │ │  from the information found in the given torrent_file. The _b_d_e_c_o_d_e___n_o_d_e
│ │ │ │ │  represents a tree node in an bencoded file. To load an ordinary .torrent file
│ │ │ │ │ @@ -284,49 +284,49 @@
│ │ │ │ │  Remaps the file storage to a new file layout. This can be used to, for
│ │ │ │ │  instance, download all data in a torrent to a single file, or to a number of
│ │ │ │ │  fixed size sector aligned files, regardless of the number and sizes of the
│ │ │ │ │  files in the torrent.
│ │ │ │ │  The new specified file_storage must have the exact same size as the current
│ │ │ │ │  one.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__ttrraacckkeerr(()) cclleeaarr__ttrraacckkeerrss(()) ttrraacckkeerrss(()) **********
│ │ │ │ │ -void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0);
│ │ │ │ │ +********** cclleeaarr__ttrraacckkeerrss(()) aadddd__ttrraacckkeerr(()) ttrraacckkeerrss(()) **********
│ │ │ │ │  std::vector<announce_entry> const& ttrraacckkeerrss () const;
│ │ │ │ │ +void cclleeaarr__ttrraacckkeerrss ();
│ │ │ │ │  void aadddd__ttrraacckkeerr (std::string const& url, int tier
│ │ │ │ │        , announce_entry::tracker_source source);
│ │ │ │ │ -void cclleeaarr__ttrraacckkeerrss ();
│ │ │ │ │ +void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0);
│ │ │ │ │  add_tracker() adds a tracker to the announce-list. The tier determines the
│ │ │ │ │  order in which the trackers are to be tried. The trackers() function will
│ │ │ │ │  return a sorted vector of _a_n_n_o_u_n_c_e___e_n_t_r_y. Each announce _e_n_t_r_y contains a
│ │ │ │ │  string, which is the tracker url, and a tier index. The tier index is the high-
│ │ │ │ │  level priority. No matter which trackers that works or not, the ones with lower
│ │ │ │ │  tier will always be tried before the one with higher tier number. For more
│ │ │ │ │  information, see _a_n_n_o_u_n_c_e___e_n_t_r_y.
│ │ │ │ │  trackers() returns all entries from announce-list.
│ │ │ │ │  clear_trackers() removes all trackers from announce-list.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ssiimmiillaarr__ttoorrrreennttss(()) ccoolllleeccttiioonnss(()) **********
│ │ │ │ │ -std::vector<sha1_hash> ssiimmiillaarr__ttoorrrreennttss () const;
│ │ │ │ │  std::vector<std::string> ccoolllleeccttiioonnss () const;
│ │ │ │ │ +std::vector<sha1_hash> ssiimmiillaarr__ttoorrrreennttss () const;
│ │ │ │ │  These two functions are related to _B_E_P_ _3_8 (mutable torrents). The vectors
│ │ │ │ │  returned from these correspond to the "similar" and "collections" keys in the
│ │ │ │ │  .torrent file. Both info-hashes and collections from within the info-dict and
│ │ │ │ │  from outside of it are included.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__uurrll__sseeeedd(()) aadddd__hhttttpp__sseeeedd(()) wweebb__sseeeeddss(()) sseett__wweebb__sseeeeddss(()) **********
│ │ │ │ │ +********** wweebb__sseeeeddss(()) sseett__wweebb__sseeeeddss(()) aadddd__hhttttpp__sseeeedd(()) aadddd__uurrll__sseeeedd(()) **********
│ │ │ │ │ +std::vector<web_seed_entry> const& wweebb__sseeeeddss () const;
│ │ │ │ │  void sseett__wweebb__sseeeeddss (std::vector<web_seed_entry> seeds);
│ │ │ │ │  void aadddd__hhttttpp__sseeeedd (std::string const& url
│ │ │ │ │        , std::string const& extern_auth = std::string()
│ │ │ │ │        , web_seed_entry::headers_t const& extra_headers = web_seed_entry::
│ │ │ │ │  headers_t());
│ │ │ │ │  void aadddd__uurrll__sseeeedd (std::string const& url
│ │ │ │ │        , std::string const& ext_auth = std::string()
│ │ │ │ │        , web_seed_entry::headers_t const& ext_headers = web_seed_entry::
│ │ │ │ │  headers_t());
│ │ │ │ │ -std::vector<web_seed_entry> const& wweebb__sseeeeddss () const;
│ │ │ │ │  web_seeds() returns all url seeds and http seeds in the torrent. Each _e_n_t_r_y is
│ │ │ │ │  a web_seed_entry and may refer to either a url seed or http seed.
│ │ │ │ │  add_url_seed() and add_http_seed() adds one url to the list of url/http seeds.
│ │ │ │ │  set_web_seeds() replaces all web seeds with the ones specified in the seeds
│ │ │ │ │  vector.
│ │ │ │ │  The extern_auth argument can be used for other authorization schemes than basic
│ │ │ │ │  HTTP authorization. If set, it will override any username and password found in
│ │ │ │ │ @@ -340,46 +340,46 @@
│ │ │ │ │  std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │  total_size() returns the total number of bytes the torrent-file represents.
│ │ │ │ │  Note that this is the number of pieces times the piece size (modulo the last
│ │ │ │ │  piece possibly being smaller). With pad files, the total size will be larger
│ │ │ │ │  than the sum of all (regular) file sizes.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** nnuumm__ppiieecceess(()) ppiieeccee__lleennggtthh(()) **********
│ │ │ │ │ -int ppiieeccee__lleennggtthh () const;
│ │ │ │ │  int nnuumm__ppiieecceess () const;
│ │ │ │ │ +int ppiieeccee__lleennggtthh () const;
│ │ │ │ │  piece_length() and num_pieces() returns the number of byte for each piece and
│ │ │ │ │  the total number of pieces, respectively. The difference between piece_size()
│ │ │ │ │  and piece_length() is that piece_size() takes the piece index as argument and
│ │ │ │ │  gives you the exact size of that piece. It will always be the same as
│ │ │ │ │  piece_length() except in the case of the last piece, which may be smaller.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** bblloocckkss__ppeerr__ppiieeccee(()) **********
│ │ │ │ │  int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │  returns the number of blocks there are in the typical piece. There may be fewer
│ │ │ │ │  in the last piece)
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** llaasstt__ppiieeccee(()) ppiieeccee__rraannggee(()) eenndd__ppiieeccee(()) **********
│ │ │ │ │ -piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ +********** ppiieeccee__rraannggee(()) llaasstt__ppiieeccee(()) eenndd__ppiieeccee(()) **********
│ │ │ │ │  index_range<piece_index_t> ppiieeccee__rraannggee () const;
│ │ │ │ │  piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │ +piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │  last_piece() returns the index to the last piece in the torrent and end_piece()
│ │ │ │ │  returns the index to the one-past-end piece in the torrent piece_range()
│ │ │ │ │  returns an implementation-defined type that can be used as the container in a
│ │ │ │ │  range-for loop. Where the values are the indices of all pieces in the
│ │ │ │ │  _f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iinnffoo__hhaasshh(()) iinnffoo__hhaasshheess(()) **********
│ │ │ │ │ -info_hash_t const& iinnffoo__hhaasshheess () const;
│ │ │ │ │ +********** iinnffoo__hhaasshheess(()) iinnffoo__hhaasshh(()) **********
│ │ │ │ │  sha1_hash iinnffoo__hhaasshh () const noexcept;
│ │ │ │ │ +info_hash_t const& iinnffoo__hhaasshheess () const;
│ │ │ │ │  returns the info-hash of the torrent. For BitTorrent v2 support, use
│ │ │ │ │  info_hashes() to get an object that may hold both a v1 and v2 info-hash
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** vv22(()) vv11(()) **********
│ │ │ │ │ -bool vv11 () const;
│ │ │ │ │ +********** vv11(()) vv22(()) **********
│ │ │ │ │  bool vv22 () const;
│ │ │ │ │ +bool vv11 () const;
│ │ │ │ │  returns whether this torrent has v1 and/or v2 metadata, respectively. Hybrid
│ │ │ │ │  torrents have both. These are shortcuts for info_hashes().has_v1() and
│ │ │ │ │  info_hashes().has_v2() calls.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** nnuumm__ffiilleess(()) **********
│ │ │ │ │  int nnuumm__ffiilleess () const;
│ │ │ │ │  If you need index-access to files you can use the num_files() along with the
│ │ │ │ │ @@ -428,16 +428,16 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ppiieeccee__ssiizzee(()) **********
│ │ │ │ │  int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │  returns the piece size of file with index. This will be the same as
│ │ │ │ │  _p_i_e_c_e___l_e_n_g_t_h_(_), except for the last piece, which may be shorter.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** hhaasshh__ffoorr__ppiieeccee(()) hhaasshh__ffoorr__ppiieeccee__ppttrr(()) **********
│ │ │ │ │ -char const* hhaasshh__ffoorr__ppiieeccee__ppttrr (piece_index_t const index) const;
│ │ │ │ │  sha1_hash hhaasshh__ffoorr__ppiieeccee (piece_index_t index) const;
│ │ │ │ │ +char const* hhaasshh__ffoorr__ppiieeccee__ppttrr (piece_index_t const index) const;
│ │ │ │ │  hash_for_piece() takes a piece-index and returns the 20-bytes sha1-hash for
│ │ │ │ │  that piece and info_hash() returns the 20-bytes sha1-hash for the info-section
│ │ │ │ │  of the torrent file. hash_for_piece_ptr() returns a pointer to the 20 byte sha1
│ │ │ │ │  digest for the piece. Note that the string is not 0-terminated.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** nnaammee(()) **********
│ │ │ │ │  const std::string& nnaammee () const;
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Status.html
│ │ │ │ @@ -426,15 +426,15 @@
│ │ │ │  currently connected to.</dd>
│ │ │ │  </dl>
│ │ │ │  <a name="num_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_peers%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>num_peers</dt>
│ │ │ │  <dd>the number of peers this torrent currently is connected to. Peer
│ │ │ │  connections that are in the half-open state (is attempting to connect)
│ │ │ │  or are queued for later connection attempt do not count. Although they
│ │ │ │ -are visible in the peer list when you call <a class="reference external" href="reference-Plugins.html#get_peer_info()">get_peer_info()</a>.</dd>
│ │ │ │ +are visible in the peer list when you call <a class="reference external" href="reference-Torrent_Handle.html#get_peer_info()">get_peer_info()</a>.</dd>
│ │ │ │  </dl>
│ │ │ │  <a name="num_complete"></a>
│ │ │ │  <a name="num_incomplete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_complete+num_incomplete%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_complete+num_incomplete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>num_complete num_incomplete</dt>
│ │ │ │  <dd>if the tracker sends scrape info in its announce reply, these fields
│ │ │ │  will be set to the total number of peers that have the whole file and
│ │ │ │  the total number of peers that are still downloading. set to -1 if the
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Trackers.html
│ │ │ │ @@ -31,15 +31,15 @@
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │  <li><a class="reference internal" href="#announce-infohash" id="toc-entry-1">announce_infohash</a></li>
│ │ │ │  <li><a class="reference internal" href="#announce-endpoint" id="toc-entry-2">announce_endpoint</a></li>
│ │ │ │  <li><a class="reference internal" href="#announce-entry" id="toc-entry-3">announce_entry</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#operator-announce-entry-announce-entry" id="toc-entry-4">operator=() announce_entry() ~announce_entry()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#announce-entry-operator-announce-entry" id="toc-entry-4">~announce_entry() operator=() announce_entry()</a></li>
│ │ │ │  <li><a class="reference internal" href="#enum-tracker-source" id="toc-entry-5">enum tracker_source</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │  <a name="announce_infohash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+announce_infohash&labels=documentation&body=Documentation+under+heading+%22class+announce_infohash%22+could+be+improved">report issue</a>]</span><div class="section" id="announce-infohash">
│ │ │ │  <h1>announce_infohash</h1>
│ │ │ │ @@ -131,19 +131,19 @@
│ │ │ │  <h1>announce_entry</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/announce_entry.hpp">libtorrent/announce_entry.hpp</a>&quot;</p>
│ │ │ │  <p>this class holds information about one bittorrent tracker, as it
│ │ │ │  relates to a specific torrent.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct announce_entry
│ │ │ │  {
│ │ │ │ -   <strong>~announce_entry</strong> ();
│ │ │ │     announce_entry&amp; <strong>operator=</strong> (announce_entry const&amp;) &amp;;
│ │ │ │ -   <strong>announce_entry</strong> (announce_entry const&amp;);
│ │ │ │     explicit <strong>announce_entry</strong> (string_view u);
│ │ │ │ +   <strong>~announce_entry</strong> ();
│ │ │ │     <strong>announce_entry</strong> ();
│ │ │ │ +   <strong>announce_entry</strong> (announce_entry const&amp;);
│ │ │ │  
│ │ │ │     enum tracker_source
│ │ │ │     {
│ │ │ │        source_torrent,
│ │ │ │        source_client,
│ │ │ │        source_magnet_link,
│ │ │ │        source_tex,
│ │ │ │ @@ -154,24 +154,24 @@
│ │ │ │     std::vector&lt;announce_endpoint&gt; endpoints;
│ │ │ │     std::uint8_t <strong>tier</strong>  = 0;
│ │ │ │     std::uint8_t <strong>fail_limit</strong>  = 0;
│ │ │ │     std::uint8_t source:4;
│ │ │ │     bool verified:1;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ +<a name="~announce_entry()"></a>
│ │ │ │  <a name="operator=()"></a>
│ │ │ │ -<a name="announce_entry()"></a>
│ │ │ │ -<a name="~announce_entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Boperator%3D%28%29+announce_entry%28%29+~announce_entry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Boperator%3D%28%29+announce_entry%28%29+~announce_entry%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-announce-entry-announce-entry">
│ │ │ │ -<h2>operator=() announce_entry() ~announce_entry()</h2>
│ │ │ │ +<a name="announce_entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5B~announce_entry%28%29+operator%3D%28%29+announce_entry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5B~announce_entry%28%29+operator%3D%28%29+announce_entry%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="announce-entry-operator-announce-entry">
│ │ │ │ +<h2>~announce_entry() operator=() announce_entry()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -<strong>~announce_entry</strong> ();
│ │ │ │  announce_entry&amp; <strong>operator=</strong> (announce_entry const&amp;) &amp;;
│ │ │ │ -<strong>announce_entry</strong> (announce_entry const&amp;);
│ │ │ │  explicit <strong>announce_entry</strong> (string_view u);
│ │ │ │ +<strong>~announce_entry</strong> ();
│ │ │ │  <strong>announce_entry</strong> ();
│ │ │ │ +<strong>announce_entry</strong> (announce_entry const&amp;);
│ │ │ │  </pre>
│ │ │ │  <p>constructs a tracker announce <a class="reference external" href="reference-Bencoding.html#entry">entry</a> with <tt class="docutils literal">u</tt> as the URL.</p>
│ │ │ │  <a name="tracker_source"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+tracker_source&labels=documentation&body=Documentation+under+heading+%22enum+tracker_source%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="enum-tracker-source">
│ │ │ │  <h2>enum tracker_source</h2>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/announce_entry.hpp">libtorrent/announce_entry.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │ @@ -189,15 +189,15 @@
│ │ │ │  <tbody valign="top">
│ │ │ │  <tr><td>source_torrent</td>
│ │ │ │  <td>1</td>
│ │ │ │  <td>the tracker was part of the .torrent file</td>
│ │ │ │  </tr>
│ │ │ │  <tr><td>source_client</td>
│ │ │ │  <td>2</td>
│ │ │ │ -<td>the tracker was added programmatically via the <a class="reference external" href="reference-Create_Torrents.html#add_tracker()">add_tracker()</a> function</td>
│ │ │ │ +<td>the tracker was added programmatically via the <a class="reference external" href="reference-Torrent_Handle.html#add_tracker()">add_tracker()</a> function</td>
│ │ │ │  </tr>
│ │ │ │  <tr><td>source_magnet_link</td>
│ │ │ │  <td>4</td>
│ │ │ │  <td>the tracker was part of a magnet link</td>
│ │ │ │  </tr>
│ │ │ │  <tr><td>source_tex</td>
│ │ │ │  <td>8</td>
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -2,15 +2,15 @@
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │      * _a_n_n_o_u_n_c_e___i_n_f_o_h_a_s_h
│ │ │ │ │      * _a_n_n_o_u_n_c_e___e_n_d_p_o_i_n_t
│ │ │ │ │      * _a_n_n_o_u_n_c_e___e_n_t_r_y
│ │ │ │ │ -          o _o_p_e_r_a_t_o_r_=_(_)_ _a_n_n_o_u_n_c_e___e_n_t_r_y_(_)_ _~_a_n_n_o_u_n_c_e___e_n_t_r_y_(_)
│ │ │ │ │ +          o _~_a_n_n_o_u_n_c_e___e_n_t_r_y_(_)_ _o_p_e_r_a_t_o_r_=_(_)_ _a_n_n_o_u_n_c_e___e_n_t_r_y_(_)
│ │ │ │ │            o _e_n_u_m_ _t_r_a_c_k_e_r___s_o_u_r_c_e
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ aannnnoouunnccee__iinnffoohhaasshh ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_n_n_o_u_n_c_e___e_n_t_r_y_._h_p_p"
│ │ │ │ │  struct announce_infohash
│ │ │ │ │  {
│ │ │ │ │     std::string message;
│ │ │ │ │ @@ -78,19 +78,19 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ aannnnoouunnccee__eennttrryy ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_n_n_o_u_n_c_e___e_n_t_r_y_._h_p_p"
│ │ │ │ │  this class holds information about one bittorrent tracker, as it relates to a
│ │ │ │ │  specific torrent.
│ │ │ │ │  struct announce_entry
│ │ │ │ │  {
│ │ │ │ │ -   ~~aannnnoouunnccee__eennttrryy ();
│ │ │ │ │     announce_entry& ooppeerraattoorr== (announce_entry const&) &;
│ │ │ │ │ -   aannnnoouunnccee__eennttrryy (announce_entry const&);
│ │ │ │ │     explicit aannnnoouunnccee__eennttrryy (string_view u);
│ │ │ │ │ +   ~~aannnnoouunnccee__eennttrryy ();
│ │ │ │ │     aannnnoouunnccee__eennttrryy ();
│ │ │ │ │ +   aannnnoouunnccee__eennttrryy (announce_entry const&);
│ │ │ │ │  
│ │ │ │ │     enum tracker_source
│ │ │ │ │     {
│ │ │ │ │        source_torrent,
│ │ │ │ │        source_client,
│ │ │ │ │        source_magnet_link,
│ │ │ │ │        source_tex,
│ │ │ │ │ @@ -101,20 +101,20 @@
│ │ │ │ │     std::vector<announce_endpoint> endpoints;
│ │ │ │ │     std::uint8_t ttiieerr  = 0;
│ │ │ │ │     std::uint8_t ffaaiill__lliimmiitt  = 0;
│ │ │ │ │     std::uint8_t source:4;
│ │ │ │ │     bool verified:1;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr==(()) aannnnoouunnccee__eennttrryy(()) ~~aannnnoouunnccee__eennttrryy(()) **********
│ │ │ │ │ -~~aannnnoouunnccee__eennttrryy ();
│ │ │ │ │ +********** ~~aannnnoouunnccee__eennttrryy(()) ooppeerraattoorr==(()) aannnnoouunnccee__eennttrryy(()) **********
│ │ │ │ │  announce_entry& ooppeerraattoorr== (announce_entry const&) &;
│ │ │ │ │ -aannnnoouunnccee__eennttrryy (announce_entry const&);
│ │ │ │ │  explicit aannnnoouunnccee__eennttrryy (string_view u);
│ │ │ │ │ +~~aannnnoouunnccee__eennttrryy ();
│ │ │ │ │  aannnnoouunnccee__eennttrryy ();
│ │ │ │ │ +aannnnoouunnccee__eennttrryy (announce_entry const&);
│ │ │ │ │  constructs a tracker announce _e_n_t_r_y with u as the URL.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** eennuumm ttrraacckkeerr__ssoouurrccee **********
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_n_n_o_u_n_c_e___e_n_t_r_y_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_s_o_u_r_c_e___t_o_r_r_e_n_t_ _ _ _ _|_1_ _ _ _ _|_t_h_e_ _t_r_a_c_k_e_r_ _w_a_s_ _p_a_r_t_ _o_f_ _t_h_e_ _._t_o_r_r_e_n_t_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ |
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Utility.html
│ │ │ │ @@ -29,22 +29,22 @@
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │  <li><a class="reference internal" href="#hasher" id="toc-entry-1">hasher</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#hasher-operator" id="toc-entry-2">hasher() operator=()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-hasher" id="toc-entry-2">operator=() hasher()</a></li>
│ │ │ │  <li><a class="reference internal" href="#update" id="toc-entry-3">update()</a></li>
│ │ │ │  <li><a class="reference internal" href="#final" id="toc-entry-4">final()</a></li>
│ │ │ │  <li><a class="reference internal" href="#reset" id="toc-entry-5">reset()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  <li><a class="reference internal" href="#hasher256" id="toc-entry-6">hasher256</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#hasher256-operator" id="toc-entry-7">hasher256() operator=()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-hasher256" id="toc-entry-7">operator=() hasher256()</a></li>
│ │ │ │  <li><a class="reference internal" href="#update-1" id="toc-entry-8">update()</a></li>
│ │ │ │  <li><a class="reference internal" href="#final-1" id="toc-entry-9">final()</a></li>
│ │ │ │  <li><a class="reference internal" href="#reset-1" id="toc-entry-10">reset()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │  <li><a class="reference internal" href="#bitfield" id="toc-entry-11">bitfield</a><ul>
│ │ │ │  <li><a class="reference internal" href="#bitfield-1" id="toc-entry-12">bitfield()</a></li>
│ │ │ │ @@ -82,32 +82,32 @@
│ │ │ │  <p>The built-in software version of sha1-algorithm was implemented
│ │ │ │  by Steve Reid and released as public domain.
│ │ │ │  For more info, see <tt class="docutils literal">src/sha1.cpp</tt>.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  class hasher
│ │ │ │  {
│ │ │ │     <strong>hasher</strong> ();
│ │ │ │ -   hasher&amp; <strong>operator=</strong> (hasher const&amp;) &amp;;
│ │ │ │     <strong>hasher</strong> (char const* data, int len);
│ │ │ │ -   <strong>hasher</strong> (hasher const&amp;);
│ │ │ │     explicit <strong>hasher</strong> (span&lt;char const&gt; data);
│ │ │ │ +   hasher&amp; <strong>operator=</strong> (hasher const&amp;) &amp;;
│ │ │ │ +   <strong>hasher</strong> (hasher const&amp;);
│ │ │ │     hasher&amp; <strong>update</strong> (span&lt;char const&gt; data);
│ │ │ │     hasher&amp; <strong>update</strong> (char const* data, int len);
│ │ │ │     sha1_hash <strong>final</strong> ();
│ │ │ │     void <strong>reset</strong> ();
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="hasher()"></a>
│ │ │ │ -<a name="operator=()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Bhasher%28%29+operator%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Bhasher%28%29+operator%3D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="hasher-operator">
│ │ │ │ -<h2>hasher() operator=()</h2>
│ │ │ │ +<a name="operator=()"></a>
│ │ │ │ +<a name="hasher()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Boperator%3D%28%29+hasher%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Boperator%3D%28%29+hasher%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-hasher">
│ │ │ │ +<h2>operator=() hasher()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -hasher&amp; <strong>operator=</strong> (hasher const&amp;) &amp;;
│ │ │ │  <strong>hasher</strong> (char const* data, int len);
│ │ │ │ -<strong>hasher</strong> (hasher const&amp;);
│ │ │ │  explicit <strong>hasher</strong> (span&lt;char const&gt; data);
│ │ │ │ +hasher&amp; <strong>operator=</strong> (hasher const&amp;) &amp;;
│ │ │ │ +<strong>hasher</strong> (hasher const&amp;);
│ │ │ │  </pre>
│ │ │ │  <p>this is the same as default constructing followed by a call to
│ │ │ │  <tt class="docutils literal">update(data, len)</tt>.</p>
│ │ │ │  <a name="update()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Bupdate%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Bupdate%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="update">
│ │ │ │  <h2>update()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ @@ -136,33 +136,33 @@
│ │ │ │  <div class="section" id="hasher256">
│ │ │ │  <h1>hasher256</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/hasher.hpp">libtorrent/hasher.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  class hasher256
│ │ │ │  {
│ │ │ │     <strong>hasher256</strong> ();
│ │ │ │ +   <strong>hasher256</strong> (hasher256 const&amp;);
│ │ │ │     hasher256&amp; <strong>operator=</strong> (hasher256 const&amp;) &amp;;
│ │ │ │     <strong>hasher256</strong> (char const* data, int len);
│ │ │ │     explicit <strong>hasher256</strong> (span&lt;char const&gt; data);
│ │ │ │ -   <strong>hasher256</strong> (hasher256 const&amp;);
│ │ │ │     hasher256&amp; <strong>update</strong> (char const* data, int len);
│ │ │ │     hasher256&amp; <strong>update</strong> (span&lt;char const&gt; data);
│ │ │ │     sha256_hash <strong>final</strong> ();
│ │ │ │     void <strong>reset</strong> ();
│ │ │ │     <strong>~hasher256</strong> ();
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="hasher256()"></a>
│ │ │ │ -<a name="operator=()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Bhasher256%28%29+operator%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Bhasher256%28%29+operator%3D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="hasher256-operator">
│ │ │ │ -<h2>hasher256() operator=()</h2>
│ │ │ │ +<a name="operator=()"></a>
│ │ │ │ +<a name="hasher256()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Boperator%3D%28%29+hasher256%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Boperator%3D%28%29+hasher256%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-hasher256">
│ │ │ │ +<h2>operator=() hasher256()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ +<strong>hasher256</strong> (hasher256 const&amp;);
│ │ │ │  hasher256&amp; <strong>operator=</strong> (hasher256 const&amp;) &amp;;
│ │ │ │  <strong>hasher256</strong> (char const* data, int len);
│ │ │ │  explicit <strong>hasher256</strong> (span&lt;char const&gt; data);
│ │ │ │ -<strong>hasher256</strong> (hasher256 const&amp;);
│ │ │ │  </pre>
│ │ │ │  <p>this is the same as default constructing followed by a call to
│ │ │ │  <tt class="docutils literal">update(data, len)</tt>.</p>
│ │ │ │  <a name="update()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Bupdate%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Bupdate%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="update-1">
│ │ │ │  <h2>update()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ @@ -192,23 +192,23 @@
│ │ │ │  <h1>bitfield</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/bitfield.hpp">libtorrent/bitfield.hpp</a>&quot;</p>
│ │ │ │  <p>The <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> type stores any number of bits as a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>
│ │ │ │  in a heap allocated array.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct bitfield
│ │ │ │  {
│ │ │ │ -   explicit <strong>bitfield</strong> (int bits);
│ │ │ │     <strong>bitfield</strong> () noexcept = default;
│ │ │ │ -   <strong>bitfield</strong> (char const* b, int bits);
│ │ │ │ -   <strong>bitfield</strong> (bitfield&amp;&amp; rhs) noexcept = default;
│ │ │ │ -   <strong>bitfield</strong> (bitfield const&amp; rhs);
│ │ │ │     <strong>bitfield</strong> (int bits, bool val);
│ │ │ │ +   explicit <strong>bitfield</strong> (int bits);
│ │ │ │ +   <strong>bitfield</strong> (bitfield const&amp; rhs);
│ │ │ │ +   <strong>bitfield</strong> (bitfield&amp;&amp; rhs) noexcept = default;
│ │ │ │ +   <strong>bitfield</strong> (char const* b, int bits);
│ │ │ │     void <strong>assign</strong> (char const* b, int const bits);
│ │ │ │ -   bool <strong>operator[]</strong> (int index) const noexcept;
│ │ │ │     bool <strong>get_bit</strong> (int index) const noexcept;
│ │ │ │ +   bool <strong>operator[]</strong> (int index) const noexcept;
│ │ │ │     void <strong>clear_bit</strong> (int index) noexcept;
│ │ │ │     void <strong>set_bit</strong> (int index) noexcept;
│ │ │ │     bool <strong>all_set</strong> () const noexcept;
│ │ │ │     bool <strong>none_set</strong> () const noexcept;
│ │ │ │     int <strong>size</strong> () const noexcept;
│ │ │ │     int <strong>num_words</strong> () const noexcept;
│ │ │ │     int <strong>num_bytes</strong> () const noexcept;
│ │ │ │ @@ -221,20 +221,20 @@
│ │ │ │     int <strong>find_last_clear</strong> () const noexcept;
│ │ │ │     bool <strong>operator==</strong> (lt::bitfield const&amp; rhs) const;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │  <a name="bitfield()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bbitfield%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bbitfield%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="bitfield-1">
│ │ │ │  <h2>bitfield()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -explicit <strong>bitfield</strong> (int bits);
│ │ │ │  <strong>bitfield</strong> () noexcept = default;
│ │ │ │ -<strong>bitfield</strong> (char const* b, int bits);
│ │ │ │ -<strong>bitfield</strong> (bitfield&amp;&amp; rhs) noexcept = default;
│ │ │ │ -<strong>bitfield</strong> (bitfield const&amp; rhs);
│ │ │ │  <strong>bitfield</strong> (int bits, bool val);
│ │ │ │ +explicit <strong>bitfield</strong> (int bits);
│ │ │ │ +<strong>bitfield</strong> (bitfield const&amp; rhs);
│ │ │ │ +<strong>bitfield</strong> (bitfield&amp;&amp; rhs) noexcept = default;
│ │ │ │ +<strong>bitfield</strong> (char const* b, int bits);
│ │ │ │  </pre>
│ │ │ │  <p>constructs a new <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>. The default constructor creates an empty
│ │ │ │  <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>. <tt class="docutils literal">bits</tt> is the size of the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> (specified in bits).
│ │ │ │  <tt class="docutils literal">val</tt> is the value to initialize the bits to. If not specified
│ │ │ │  all bits are initialized to 0.</p>
│ │ │ │  <p>The constructor taking a pointer <tt class="docutils literal">b</tt> and <tt class="docutils literal">bits</tt> copies a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>
│ │ │ │  from the specified buffer, and <tt class="docutils literal">bits</tt> number of bits (rounded up to
│ │ │ │ @@ -248,16 +248,16 @@
│ │ │ │  <p>copy <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> from buffer <tt class="docutils literal">b</tt> of <tt class="docutils literal">bits</tt> number of bits, rounded up to
│ │ │ │  the nearest byte boundary.</p>
│ │ │ │  <a name="get_bit()"></a>
│ │ │ │  <a name="operator[]()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bget_bit%28%29+operator%5B%5D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bget_bit%28%29+operator%5B%5D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="get-bit-operator">
│ │ │ │  <h2>get_bit() operator[]()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>operator[]</strong> (int index) const noexcept;
│ │ │ │  bool <strong>get_bit</strong> (int index) const noexcept;
│ │ │ │ +bool <strong>operator[]</strong> (int index) const noexcept;
│ │ │ │  </pre>
│ │ │ │  <p>query bit at <tt class="docutils literal">index</tt>. Returns true if bit is 1, otherwise false.</p>
│ │ │ │  <a name="clear_bit()"></a>
│ │ │ │  <a name="set_bit()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bclear_bit%28%29+set_bit%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bclear_bit%28%29+set_bit%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="clear-bit-set-bit">
│ │ │ │  <h2>clear_bit() set_bit()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,19 +1,19 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │      * _h_a_s_h_e_r
│ │ │ │ │ -          o _h_a_s_h_e_r_(_)_ _o_p_e_r_a_t_o_r_=_(_)
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_=_(_)_ _h_a_s_h_e_r_(_)
│ │ │ │ │            o _u_p_d_a_t_e_(_)
│ │ │ │ │            o _f_i_n_a_l_(_)
│ │ │ │ │            o _r_e_s_e_t_(_)
│ │ │ │ │      * _h_a_s_h_e_r_2_5_6
│ │ │ │ │ -          o _h_a_s_h_e_r_2_5_6_(_)_ _o_p_e_r_a_t_o_r_=_(_)
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_=_(_)_ _h_a_s_h_e_r_2_5_6_(_)
│ │ │ │ │            o _u_p_d_a_t_e_(_)
│ │ │ │ │            o _f_i_n_a_l_(_)
│ │ │ │ │            o _r_e_s_e_t_(_)
│ │ │ │ │      * _b_i_t_f_i_e_l_d
│ │ │ │ │            o _b_i_t_f_i_e_l_d_(_)
│ │ │ │ │            o _a_s_s_i_g_n_(_)
│ │ │ │ │            o _g_e_t___b_i_t_(_)_ _o_p_e_r_a_t_o_r_[_]_(_)
│ │ │ │ │ @@ -43,29 +43,29 @@
│ │ │ │ │  If you want to reuse the _h_a_s_h_e_r object once you have created a hash, you have
│ │ │ │ │  to call reset() to reinitialize it.
│ │ │ │ │  The built-in software version of sha1-algorithm was implemented by Steve Reid
│ │ │ │ │  and released as public domain. For more info, see src/sha1.cpp.
│ │ │ │ │  class hasher
│ │ │ │ │  {
│ │ │ │ │     hhaasshheerr ();
│ │ │ │ │ -   hasher& ooppeerraattoorr== (hasher const&) &;
│ │ │ │ │     hhaasshheerr (char const* data, int len);
│ │ │ │ │ -   hhaasshheerr (hasher const&);
│ │ │ │ │     explicit hhaasshheerr (span<char const> data);
│ │ │ │ │ +   hasher& ooppeerraattoorr== (hasher const&) &;
│ │ │ │ │ +   hhaasshheerr (hasher const&);
│ │ │ │ │     hasher& uuppddaattee (span<char const> data);
│ │ │ │ │     hasher& uuppddaattee (char const* data, int len);
│ │ │ │ │     sha1_hash ffiinnaall ();
│ │ │ │ │     void rreesseett ();
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** hhaasshheerr(()) ooppeerraattoorr==(()) **********
│ │ │ │ │ -hasher& ooppeerraattoorr== (hasher const&) &;
│ │ │ │ │ +********** ooppeerraattoorr==(()) hhaasshheerr(()) **********
│ │ │ │ │  hhaasshheerr (char const* data, int len);
│ │ │ │ │ -hhaasshheerr (hasher const&);
│ │ │ │ │  explicit hhaasshheerr (span<char const> data);
│ │ │ │ │ +hasher& ooppeerraattoorr== (hasher const&) &;
│ │ │ │ │ +hhaasshheerr (hasher const&);
│ │ │ │ │  this is the same as default constructing followed by a call to update(data,
│ │ │ │ │  len).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** uuppddaattee(()) **********
│ │ │ │ │  hasher& uuppddaattee (span<char const> data);
│ │ │ │ │  hasher& uuppddaattee (char const* data, int len);
│ │ │ │ │  append the following bytes to what is being hashed
│ │ │ │ │ @@ -81,30 +81,30 @@
│ │ │ │ │  constructed.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ hhaasshheerr225566 ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_h_a_s_h_e_r_._h_p_p"
│ │ │ │ │  class hasher256
│ │ │ │ │  {
│ │ │ │ │     hhaasshheerr225566 ();
│ │ │ │ │ +   hhaasshheerr225566 (hasher256 const&);
│ │ │ │ │     hasher256& ooppeerraattoorr== (hasher256 const&) &;
│ │ │ │ │     hhaasshheerr225566 (char const* data, int len);
│ │ │ │ │     explicit hhaasshheerr225566 (span<char const> data);
│ │ │ │ │ -   hhaasshheerr225566 (hasher256 const&);
│ │ │ │ │     hasher256& uuppddaattee (char const* data, int len);
│ │ │ │ │     hasher256& uuppddaattee (span<char const> data);
│ │ │ │ │     sha256_hash ffiinnaall ();
│ │ │ │ │     void rreesseett ();
│ │ │ │ │     ~~hhaasshheerr225566 ();
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** hhaasshheerr225566(()) ooppeerraattoorr==(()) **********
│ │ │ │ │ +********** ooppeerraattoorr==(()) hhaasshheerr225566(()) **********
│ │ │ │ │ +hhaasshheerr225566 (hasher256 const&);
│ │ │ │ │  hasher256& ooppeerraattoorr== (hasher256 const&) &;
│ │ │ │ │  hhaasshheerr225566 (char const* data, int len);
│ │ │ │ │  explicit hhaasshheerr225566 (span<char const> data);
│ │ │ │ │ -hhaasshheerr225566 (hasher256 const&);
│ │ │ │ │  this is the same as default constructing followed by a call to update(data,
│ │ │ │ │  len).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** uuppddaattee(()) **********
│ │ │ │ │  hasher256& uuppddaattee (char const* data, int len);
│ │ │ │ │  hasher256& uuppddaattee (span<char const> data);
│ │ │ │ │  append the following bytes to what is being hashed
│ │ │ │ │ @@ -121,23 +121,23 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ bbiittffiieelldd ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_i_t_f_i_e_l_d_._h_p_p"
│ │ │ │ │  The _b_i_t_f_i_e_l_d type stores any number of bits as a _b_i_t_f_i_e_l_d in a heap allocated
│ │ │ │ │  array.
│ │ │ │ │  struct bitfield
│ │ │ │ │  {
│ │ │ │ │ -   explicit bbiittffiieelldd (int bits);
│ │ │ │ │     bbiittffiieelldd () noexcept = default;
│ │ │ │ │ -   bbiittffiieelldd (char const* b, int bits);
│ │ │ │ │ -   bbiittffiieelldd (bitfield&& rhs) noexcept = default;
│ │ │ │ │ -   bbiittffiieelldd (bitfield const& rhs);
│ │ │ │ │     bbiittffiieelldd (int bits, bool val);
│ │ │ │ │ +   explicit bbiittffiieelldd (int bits);
│ │ │ │ │ +   bbiittffiieelldd (bitfield const& rhs);
│ │ │ │ │ +   bbiittffiieelldd (bitfield&& rhs) noexcept = default;
│ │ │ │ │ +   bbiittffiieelldd (char const* b, int bits);
│ │ │ │ │     void aassssiiggnn (char const* b, int const bits);
│ │ │ │ │ -   bool ooppeerraattoorr[[]] (int index) const noexcept;
│ │ │ │ │     bool ggeett__bbiitt (int index) const noexcept;
│ │ │ │ │ +   bool ooppeerraattoorr[[]] (int index) const noexcept;
│ │ │ │ │     void cclleeaarr__bbiitt (int index) noexcept;
│ │ │ │ │     void sseett__bbiitt (int index) noexcept;
│ │ │ │ │     bool aallll__sseett () const noexcept;
│ │ │ │ │     bool nnoonnee__sseett () const noexcept;
│ │ │ │ │     int ssiizzee () const noexcept;
│ │ │ │ │     int nnuumm__wwoorrddss () const noexcept;
│ │ │ │ │     int nnuumm__bbyytteess () const noexcept;
│ │ │ │ │ @@ -148,35 +148,35 @@
│ │ │ │ │     int ccoouunntt () const noexcept;
│ │ │ │ │     int ffiinndd__ffiirrsstt__sseett () const noexcept;
│ │ │ │ │     int ffiinndd__llaasstt__cclleeaarr () const noexcept;
│ │ │ │ │     bool ooppeerraattoorr==== (lt::bitfield const& rhs) const;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** bbiittffiieelldd(()) **********
│ │ │ │ │ -explicit bbiittffiieelldd (int bits);
│ │ │ │ │  bbiittffiieelldd () noexcept = default;
│ │ │ │ │ -bbiittffiieelldd (char const* b, int bits);
│ │ │ │ │ -bbiittffiieelldd (bitfield&& rhs) noexcept = default;
│ │ │ │ │ -bbiittffiieelldd (bitfield const& rhs);
│ │ │ │ │  bbiittffiieelldd (int bits, bool val);
│ │ │ │ │ +explicit bbiittffiieelldd (int bits);
│ │ │ │ │ +bbiittffiieelldd (bitfield const& rhs);
│ │ │ │ │ +bbiittffiieelldd (bitfield&& rhs) noexcept = default;
│ │ │ │ │ +bbiittffiieelldd (char const* b, int bits);
│ │ │ │ │  constructs a new _b_i_t_f_i_e_l_d. The default constructor creates an empty _b_i_t_f_i_e_l_d.
│ │ │ │ │  bits is the size of the _b_i_t_f_i_e_l_d (specified in bits). val is the value to
│ │ │ │ │  initialize the bits to. If not specified all bits are initialized to 0.
│ │ │ │ │  The constructor taking a pointer b and bits copies a _b_i_t_f_i_e_l_d from the
│ │ │ │ │  specified buffer, and bits number of bits (rounded up to the nearest byte
│ │ │ │ │  boundary).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aassssiiggnn(()) **********
│ │ │ │ │  void aassssiiggnn (char const* b, int const bits);
│ │ │ │ │  copy _b_i_t_f_i_e_l_d from buffer b of bits number of bits, rounded up to the nearest
│ │ │ │ │  byte boundary.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ggeett__bbiitt(()) ooppeerraattoorr[[]](()) **********
│ │ │ │ │ -bool ooppeerraattoorr[[]] (int index) const noexcept;
│ │ │ │ │  bool ggeett__bbiitt (int index) const noexcept;
│ │ │ │ │ +bool ooppeerraattoorr[[]] (int index) const noexcept;
│ │ │ │ │  query bit at index. Returns true if bit is 1, otherwise false.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** cclleeaarr__bbiitt(()) sseett__bbiitt(()) **********
│ │ │ │ │  void cclleeaarr__bbiitt (int index) noexcept;
│ │ │ │ │  void sseett__bbiitt (int index) noexcept;
│ │ │ │ │  set bit at index to 0 (clear_bit) or 1 (set_bit).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference.html
│ │ │ │┄ Ordering differences only
│ │ │ │ @@ -19,229 +19,228 @@
│ │ │ │      <img src="img/logo-color-text.png" alt="libtorrent logo"/>
│ │ │ │      </a>
│ │ │ │      <div>
│ │ │ │  <h1 class="title">reference documentation</h1>
│ │ │ │  
│ │ │ │  <p><a class="reference external" href="single-page-ref.html">single-page version</a></p>
│ │ │ │  <div class="main-toc docutils container">
│ │ │ │ -<p class="rubric">Core</p>
│ │ │ │ +<p class="rubric">Add Torrent</p>
│ │ │ │  <div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#piece_block">piece_block</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#info_hash_t">info_hash_t</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#peer_info">peer_info</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#peer_request">peer_request</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#torrent_peer_equal()">torrent_peer_equal()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#parse_magnet_uri()">parse_magnet_uri()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#truncate_files()">truncate_files()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#version()">version()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#load_torrent_parsed()">load_torrent_parsed()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#load_torrent_buffer()">load_torrent_buffer()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#load_torrent_file()">load_torrent_file()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#protocol_version">protocol_version</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#socket_type_t">socket_type_t</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#portmap_transport">portmap_transport</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#portmap_protocol">portmap_protocol</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#event_t">event_t</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#connection_type">connection_type</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#torrent_flags_t">torrent_flags_t</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#pex_flags_t">pex_flags_t</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#download_priority_t">download_priority_t</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#int">int</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#charconst*">char const*</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Core.html#std::uint64_t">std::uint64_t</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Add_Torrent.html#client_data_t">client_data_t</a></div>
│ │ │ │  </div>
│ │ │ │ -<p class="rubric">Torrent Handle</p>
│ │ │ │ +<p class="rubric">Settings</p>
│ │ │ │  <div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Torrent_Handle.html#block_info">block_info</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Torrent_Handle.html#partial_piece_info">partial_piece_info</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Torrent_Handle.html#hash_value()">hash_value()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Settings.html#overview">overview</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Settings.html#setting_by_name()">setting_by_name()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Settings.html#name_for_setting()">name_for_setting()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Settings.html#default_settings()">default_settings()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Settings.html#high_performance_seed()">high_performance_seed()</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#generate_fingerprint()">generate_fingerprint()</a></div>
│ │ │ │  </div>
│ │ │ │  <p class="rubric">Torrent Info</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-Torrent_Info.html#web_seed_entry">web_seed_entry</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Torrent_Info.html#load_torrent_limits">load_torrent_limits</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a></div>
│ │ │ │  </div>
│ │ │ │ +<p class="rubric">Torrent Handle</p>
│ │ │ │ +<div class="line-block">
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Torrent_Handle.html#block_info">block_info</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Torrent_Handle.html#partial_piece_info">partial_piece_info</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Torrent_Handle.html#hash_value()">hash_value()</a></div>
│ │ │ │ +</div>
│ │ │ │  <p class="rubric">Session</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-Session.html#session_proxy">session_proxy</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Session.html#session">session</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Session.html#session_params">session_params</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Session.html#session_handle">session_handle</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Session.html#read_session_params()">read_session_params()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Session.html#write_session_params_buf()">write_session_params_buf()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Session.html#write_session_params()">write_session_params()</a></div>
│ │ │ │  </div>
│ │ │ │  <p class="rubric">Stats</p>
│ │ │ │  <div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Stats.html#stats_metric">stats_metric</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Stats.html#counters">counters</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Stats.html#stats_metric">stats_metric</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Stats.html#session_stats_metrics()">session_stats_metrics()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Stats.html#find_metric_idx()">find_metric_idx()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Stats.html#metric_type_t">metric_type_t</a></div>
│ │ │ │  </div>
│ │ │ │ -<p class="rubric">Add Torrent</p>
│ │ │ │ -<div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Add_Torrent.html#client_data_t">client_data_t</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a></div>
│ │ │ │ -</div>
│ │ │ │  <p class="rubric">Trackers</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-Trackers.html#announce_infohash">announce_infohash</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Trackers.html#announce_endpoint">announce_endpoint</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a></div>
│ │ │ │  </div>
│ │ │ │ -<p class="rubric">Torrent Status</p>
│ │ │ │ +<p class="rubric">Core</p>
│ │ │ │  <div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#peer_request">peer_request</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#piece_block">piece_block</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#peer_info">peer_info</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#info_hash_t">info_hash_t</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#load_torrent_file()">load_torrent_file()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#load_torrent_parsed()">load_torrent_parsed()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#load_torrent_buffer()">load_torrent_buffer()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#truncate_files()">truncate_files()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#parse_magnet_uri()">parse_magnet_uri()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#torrent_peer_equal()">torrent_peer_equal()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#version()">version()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#event_t">event_t</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#portmap_transport">portmap_transport</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#portmap_protocol">portmap_protocol</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#protocol_version">protocol_version</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#socket_type_t">socket_type_t</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#connection_type">connection_type</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#torrent_flags_t">torrent_flags_t</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#int">int</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#pex_flags_t">pex_flags_t</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#charconst*">char const*</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#std::uint64_t">std::uint64_t</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Core.html#download_priority_t">download_priority_t</a></div>
│ │ │ │  </div>
│ │ │ │ -<p class="rubric">Settings</p>
│ │ │ │ +<p class="rubric">Torrent Status</p>
│ │ │ │  <div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Settings.html#overview">overview</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</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 class="line"><a class="reference external" href="reference-Settings.html#generate_fingerprint()">generate_fingerprint()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Settings.html#setting_by_name()">setting_by_name()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Settings.html#name_for_setting()">name_for_setting()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Settings.html#default_settings()">default_settings()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a></div>
│ │ │ │  </div>
│ │ │ │  <p class="rubric">DHT</p>
│ │ │ │  <div class="line-block">
│ │ │ │ +<div class="line"><a class="reference external" href="reference-DHT.html#dht_state">dht_state</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-DHT.html#dht_storage_counters">dht_storage_counters</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-DHT.html#dht_storage_interface">dht_storage_interface</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-DHT.html#dht_state">dht_state</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-DHT.html#dht_default_storage_constructor()">dht_default_storage_constructor()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-DHT.html#sign_mutable_item()">sign_mutable_item()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-DHT.html#announce_flags_t">announce_flags_t</a></div>
│ │ │ │  </div>
│ │ │ │  <p class="rubric">Resume Data</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Resume_Data.html#write_resume_data_buf()">write_resume_data_buf()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Resume_Data.html#write_torrent_file_buf()">write_torrent_file_buf()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Resume_Data.html#write_torrent_flags_t">write_torrent_flags_t</a></div>
│ │ │ │  </div>
│ │ │ │  </div>
│ │ │ │  <div class="main-toc docutils container">
│ │ │ │ +<p class="rubric">Create Torrents</p>
│ │ │ │ +<div class="line-block">
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Create_Torrents.html#overview">overview</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Create_Torrents.html#add_files()">add_files()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Create_Torrents.html#set_piece_hashes()">set_piece_hashes()</a></div>
│ │ │ │ +</div>
│ │ │ │  <p class="rubric">Filter</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Filter.html#port_filter">port_filter</a></div>
│ │ │ │  </div>
│ │ │ │ -<p class="rubric">Error Codes</p>
│ │ │ │ -<div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Error_Codes.html#storage_error">storage_error</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Error_Codes.html#libtorrent_category()">libtorrent_category()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Error_Codes.html#http_category()">http_category()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Error_Codes.html#i2p_category()">i2p_category()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Error_Codes.html#bdecode_category()">bdecode_category()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Error_Codes.html#pcp_category()">pcp_category()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Error_Codes.html#socks_category()">socks_category()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Error_Codes.html#gzip_category()">gzip_category()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Error_Codes.html#upnp_category()">upnp_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#pcp_errors">pcp_errors</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 class="line"><a class="reference external" href="reference-Error_Codes.html#error_code_enum">error_code_enum</a></div>
│ │ │ │ -</div>
│ │ │ │  <p class="rubric">Bdecoding</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Bdecoding.html#print_entry()">print_entry()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Bdecoding.html#bdecode()">bdecode()</a></div>
│ │ │ │  </div>
│ │ │ │  <p class="rubric">Bencoding</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-Bencoding.html#overview">overview</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Bencoding.html#entry">entry</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Bencoding.html#bencode()">bencode()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Bencoding.html#operator&lt;&lt;()">operator&lt;&lt;()</a></div>
│ │ │ │  </div>
│ │ │ │ -<p class="rubric">Create Torrents</p>
│ │ │ │ +<p class="rubric">Error Codes</p>
│ │ │ │  <div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Create_Torrents.html#overview">overview</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Create_Torrents.html#add_files()">add_files()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Create_Torrents.html#set_piece_hashes()">set_piece_hashes()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Error_Codes.html#storage_error">storage_error</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Error_Codes.html#gzip_category()">gzip_category()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Error_Codes.html#upnp_category()">upnp_category()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Error_Codes.html#bdecode_category()">bdecode_category()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Error_Codes.html#pcp_category()">pcp_category()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Error_Codes.html#i2p_category()">i2p_category()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Error_Codes.html#libtorrent_category()">libtorrent_category()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Error_Codes.html#http_category()">http_category()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Error_Codes.html#socks_category()">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#error_code_enum">error_code_enum</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#pcp_errors">pcp_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#http_errors">http_errors</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Error_Codes.html#socks_error_code">socks_error_code</a></div>
│ │ │ │  </div>
│ │ │ │  </div>
│ │ │ │  <div class="main-toc docutils container">
│ │ │ │ -<p class="rubric">Utility</p>
│ │ │ │ -<div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Utility.html#hasher">hasher</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Utility.html#hasher256">hasher256</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Utility.html#bitfield">bitfield</a></div>
│ │ │ │ -</div>
│ │ │ │ -<p class="rubric">Storage</p>
│ │ │ │ -<div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Storage.html#storage_params">storage_params</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Storage.html#file_slice">file_slice</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Storage.html#file_storage">file_storage</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Storage.html#default_disk_io_constructor()">default_disk_io_constructor()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Storage.html#posix_disk_io_constructor()">posix_disk_io_constructor()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Storage.html#disabled_disk_io_constructor()">disabled_disk_io_constructor()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Storage.html#mmap_disk_io_constructor()">mmap_disk_io_constructor()</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Storage.html#storage_mode_t">storage_mode_t</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Storage.html#status_t">status_t</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Storage.html#move_flags_t">move_flags_t</a></div>
│ │ │ │ -</div>
│ │ │ │  <p class="rubric">Plugins</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-Plugins.html#overview">overview</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Plugins.html#peer_connection_handle">peer_connection_handle</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Plugins.html#bt_peer_connection_handle">bt_peer_connection_handle</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Plugins.html#plugin">plugin</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Plugins.html#torrent_plugin">torrent_plugin</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Plugins.html#crypto_plugin">crypto_plugin</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Plugins.html#create_smart_ban_plugin()">create_smart_ban_plugin()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Plugins.html#create_ut_pex_plugin()">create_ut_pex_plugin()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Plugins.html#create_smart_ban_plugin()">create_smart_ban_plugin()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Plugins.html#create_ut_metadata_plugin()">create_ut_metadata_plugin()</a></div>
│ │ │ │  </div>
│ │ │ │ -<p class="rubric">PeerClass</p>
│ │ │ │ -<div class="line-block">
│ │ │ │ -<div class="line"><a class="reference external" href="reference-PeerClass.html#peer_class_info">peer_class_info</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-PeerClass.html#peer_class_type_filter">peer_class_type_filter</a></div>
│ │ │ │ -</div>
│ │ │ │  <p class="rubric">Custom Storage</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-Custom_Storage.html#overview">overview</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Custom_Storage.html#disk_observer">disk_observer</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Custom_Storage.html#open_file_state">open_file_state</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Custom_Storage.html#storage_holder">storage_holder</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Custom_Storage.html#settings_interface">settings_interface</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Custom_Storage.html#buffer_allocator_interface">buffer_allocator_interface</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Custom_Storage.html#disk_buffer_holder">disk_buffer_holder</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Custom_Storage.html#open_file_state">open_file_state</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Custom_Storage.html#storage_holder">storage_holder</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Custom_Storage.html#disk_observer">disk_observer</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Custom_Storage.html#file_open_mode_t">file_open_mode_t</a></div>
│ │ │ │  </div>
│ │ │ │ +<p class="rubric">PeerClass</p>
│ │ │ │ +<div class="line-block">
│ │ │ │ +<div class="line"><a class="reference external" href="reference-PeerClass.html#peer_class_info">peer_class_info</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-PeerClass.html#peer_class_type_filter">peer_class_type_filter</a></div>
│ │ │ │ +</div>
│ │ │ │ +<p class="rubric">Storage</p>
│ │ │ │ +<div class="line-block">
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Storage.html#storage_params">storage_params</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Storage.html#file_slice">file_slice</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Storage.html#file_storage">file_storage</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Storage.html#mmap_disk_io_constructor()">mmap_disk_io_constructor()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Storage.html#default_disk_io_constructor()">default_disk_io_constructor()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Storage.html#disabled_disk_io_constructor()">disabled_disk_io_constructor()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Storage.html#posix_disk_io_constructor()">posix_disk_io_constructor()</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Storage.html#storage_mode_t">storage_mode_t</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Storage.html#status_t">status_t</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Storage.html#move_flags_t">move_flags_t</a></div>
│ │ │ │ +</div>
│ │ │ │ +<p class="rubric">Utility</p>
│ │ │ │ +<div class="line-block">
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Utility.html#hasher">hasher</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Utility.html#hasher256">hasher256</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Utility.html#bitfield">bitfield</a></div>
│ │ │ │ +</div>
│ │ │ │  <p class="rubric">ed25519</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-ed25519.html#ed25519_create_seed()">ed25519_create_seed()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-ed25519.html#ed25519_create_keypair()">ed25519_create_keypair()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-ed25519.html#ed25519_sign()">ed25519_sign()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-ed25519.html#ed25519_verify()">ed25519_verify()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-ed25519.html#ed25519_add_scalar()">ed25519_add_scalar()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-ed25519.html#ed25519_key_exchange()">ed25519_key_exchange()</a></div>
│ │ │ │  </div>
│ │ │ │  </div>
│ │ │ │  <div class="main-toc docutils container">
│ │ │ │  <p class="rubric">Alerts</p>
│ │ │ │  <div class="line-block">
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#overview">overview</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Alerts.html#alert">alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#dht_routing_bucket">dht_routing_bucket</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#peer_alert">peer_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#tracker_alert">tracker_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#read_piece_alert">read_piece_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#file_completed_alert">file_completed_alert</a></div>
│ │ │ │ @@ -334,19 +333,20 @@
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#oversized_file_alert">oversized_file_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#torrent_conflict_alert">torrent_conflict_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#peer_info_alert">peer_info_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#file_progress_alert">file_progress_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#piece_info_alert">piece_info_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#piece_availability_alert">piece_availability_alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#tracker_list_alert">tracker_list_alert</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Alerts.html#alert">alert</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#alert_cast()">alert_cast()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#operation_name()">operation_name()</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Alerts.html#operation_t">operation_t</a></div>
│ │ │ │ -<div class="line"><a class="reference external" href="reference-Alerts.html#alert_category_t">alert_category_t</a></div>
│ │ │ │  <div class="line"><a class="reference external" href="reference-Core.html#int">int</a></div>
│ │ │ │ +<div class="line"><a class="reference external" href="reference-Alerts.html#alert_category_t">alert_category_t</a></div>
│ │ │ │  </div>
│ │ │ │  </div>
│ │ │ │  
│ │ │ │      </div>
│ │ │ │      </div>
│ │ │ │      <div id="gradient"></div>
│ │ │ │      <div id="filler">
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,175 +1,174 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  ************ rreeffeerreennccee ddooccuummeennttaattiioonn ************
│ │ │ │ │  _s_i_n_g_l_e_-_p_a_g_e_ _v_e_r_s_i_o_n
│ │ │ │ │ -Core
│ │ │ │ │ -_p_i_e_c_e___b_l_o_c_k
│ │ │ │ │ -_i_n_f_o___h_a_s_h___t
│ │ │ │ │ -_p_e_e_r___i_n_f_o
│ │ │ │ │ -_p_e_e_r___r_e_q_u_e_s_t
│ │ │ │ │ -_t_o_r_r_e_n_t___p_e_e_r___e_q_u_a_l_(_)
│ │ │ │ │ -_m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ -_p_a_r_s_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ -_t_r_u_n_c_a_t_e___f_i_l_e_s_(_)
│ │ │ │ │ -_v_e_r_s_i_o_n_(_)
│ │ │ │ │ -_l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_)
│ │ │ │ │ -_l_o_a_d___t_o_r_r_e_n_t___b_u_f_f_e_r_(_)
│ │ │ │ │ -_l_o_a_d___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │ -_p_r_o_t_o_c_o_l___v_e_r_s_i_o_n
│ │ │ │ │ -_s_o_c_k_e_t___t_y_p_e___t
│ │ │ │ │ -_p_o_r_t_m_a_p___t_r_a_n_s_p_o_r_t
│ │ │ │ │ -_p_o_r_t_m_a_p___p_r_o_t_o_c_o_l
│ │ │ │ │ -_e_v_e_n_t___t
│ │ │ │ │ -_c_o_n_n_e_c_t_i_o_n___t_y_p_e
│ │ │ │ │ -_t_o_r_r_e_n_t___f_l_a_g_s___t
│ │ │ │ │ -_p_e_x___f_l_a_g_s___t
│ │ │ │ │ -_d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t
│ │ │ │ │ -_i_n_t
│ │ │ │ │ -_c_h_a_r_ _c_o_n_s_t_*
│ │ │ │ │ -_s_t_d_:_:_u_i_n_t_6_4___t
│ │ │ │ │ +Add Torrent
│ │ │ │ │ +_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s
│ │ │ │ │ +_c_l_i_e_n_t___d_a_t_a___t
│ │ │ │ │ +Settings
│ │ │ │ │ +_o_v_e_r_v_i_e_w
│ │ │ │ │ +_s_e_t_t_i_n_g_s___p_a_c_k
│ │ │ │ │ +_s_e_t_t_i_n_g___b_y___n_a_m_e_(_)
│ │ │ │ │ +_n_a_m_e___f_o_r___s_e_t_t_i_n_g_(_)
│ │ │ │ │ +_d_e_f_a_u_l_t___s_e_t_t_i_n_g_s_(_)
│ │ │ │ │ +_h_i_g_h___p_e_r_f_o_r_m_a_n_c_e___s_e_e_d_(_)
│ │ │ │ │ +_m_i_n___m_e_m_o_r_y___u_s_a_g_e_(_)
│ │ │ │ │ +_g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_t_(_)
│ │ │ │ │ +Torrent Info
│ │ │ │ │ +_w_e_b___s_e_e_d___e_n_t_r_y
│ │ │ │ │ +_l_o_a_d___t_o_r_r_e_n_t___l_i_m_i_t_s
│ │ │ │ │ +_t_o_r_r_e_n_t___i_n_f_o
│ │ │ │ │  Torrent Handle
│ │ │ │ │  _b_l_o_c_k___i_n_f_o
│ │ │ │ │  _p_a_r_t_i_a_l___p_i_e_c_e___i_n_f_o
│ │ │ │ │  _t_o_r_r_e_n_t___h_a_n_d_l_e
│ │ │ │ │  _h_a_s_h___v_a_l_u_e_(_)
│ │ │ │ │ -Torrent Info
│ │ │ │ │ -_w_e_b___s_e_e_d___e_n_t_r_y
│ │ │ │ │ -_l_o_a_d___t_o_r_r_e_n_t___l_i_m_i_t_s
│ │ │ │ │ -_t_o_r_r_e_n_t___i_n_f_o
│ │ │ │ │  Session
│ │ │ │ │  _s_e_s_s_i_o_n___p_r_o_x_y
│ │ │ │ │  _s_e_s_s_i_o_n
│ │ │ │ │  _s_e_s_s_i_o_n___p_a_r_a_m_s
│ │ │ │ │  _s_e_s_s_i_o_n___h_a_n_d_l_e
│ │ │ │ │  _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)
│ │ │ │ │  _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s___b_u_f_(_)
│ │ │ │ │  _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)
│ │ │ │ │  Stats
│ │ │ │ │ -_s_t_a_t_s___m_e_t_r_i_c
│ │ │ │ │  _c_o_u_n_t_e_r_s
│ │ │ │ │ +_s_t_a_t_s___m_e_t_r_i_c
│ │ │ │ │  _s_e_s_s_i_o_n___s_t_a_t_s___m_e_t_r_i_c_s_(_)
│ │ │ │ │  _f_i_n_d___m_e_t_r_i_c___i_d_x_(_)
│ │ │ │ │  _m_e_t_r_i_c___t_y_p_e___t
│ │ │ │ │ -Add Torrent
│ │ │ │ │ -_c_l_i_e_n_t___d_a_t_a___t
│ │ │ │ │ -_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s
│ │ │ │ │  Trackers
│ │ │ │ │  _a_n_n_o_u_n_c_e___i_n_f_o_h_a_s_h
│ │ │ │ │  _a_n_n_o_u_n_c_e___e_n_d_p_o_i_n_t
│ │ │ │ │  _a_n_n_o_u_n_c_e___e_n_t_r_y
│ │ │ │ │ +Core
│ │ │ │ │ +_p_e_e_r___r_e_q_u_e_s_t
│ │ │ │ │ +_p_i_e_c_e___b_l_o_c_k
│ │ │ │ │ +_p_e_e_r___i_n_f_o
│ │ │ │ │ +_i_n_f_o___h_a_s_h___t
│ │ │ │ │ +_l_o_a_d___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │ +_l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_)
│ │ │ │ │ +_l_o_a_d___t_o_r_r_e_n_t___b_u_f_f_e_r_(_)
│ │ │ │ │ +_t_r_u_n_c_a_t_e___f_i_l_e_s_(_)
│ │ │ │ │ +_m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ +_p_a_r_s_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ +_t_o_r_r_e_n_t___p_e_e_r___e_q_u_a_l_(_)
│ │ │ │ │ +_v_e_r_s_i_o_n_(_)
│ │ │ │ │ +_e_v_e_n_t___t
│ │ │ │ │ +_p_o_r_t_m_a_p___t_r_a_n_s_p_o_r_t
│ │ │ │ │ +_p_o_r_t_m_a_p___p_r_o_t_o_c_o_l
│ │ │ │ │ +_p_r_o_t_o_c_o_l___v_e_r_s_i_o_n
│ │ │ │ │ +_s_o_c_k_e_t___t_y_p_e___t
│ │ │ │ │ +_c_o_n_n_e_c_t_i_o_n___t_y_p_e
│ │ │ │ │ +_t_o_r_r_e_n_t___f_l_a_g_s___t
│ │ │ │ │ +_i_n_t
│ │ │ │ │ +_p_e_x___f_l_a_g_s___t
│ │ │ │ │ +_c_h_a_r_ _c_o_n_s_t_*
│ │ │ │ │ +_s_t_d_:_:_u_i_n_t_6_4___t
│ │ │ │ │ +_d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t
│ │ │ │ │  Torrent Status
│ │ │ │ │  _t_o_r_r_e_n_t___s_t_a_t_u_s
│ │ │ │ │ -Settings
│ │ │ │ │ -_o_v_e_r_v_i_e_w
│ │ │ │ │ -_s_e_t_t_i_n_g_s___p_a_c_k
│ │ │ │ │ -_m_i_n___m_e_m_o_r_y___u_s_a_g_e_(_)
│ │ │ │ │ -_h_i_g_h___p_e_r_f_o_r_m_a_n_c_e___s_e_e_d_(_)
│ │ │ │ │ -_g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_t_(_)
│ │ │ │ │ -_s_e_t_t_i_n_g___b_y___n_a_m_e_(_)
│ │ │ │ │ -_n_a_m_e___f_o_r___s_e_t_t_i_n_g_(_)
│ │ │ │ │ -_d_e_f_a_u_l_t___s_e_t_t_i_n_g_s_(_)
│ │ │ │ │  DHT
│ │ │ │ │ +_d_h_t___s_t_a_t_e
│ │ │ │ │  _d_h_t___s_t_o_r_a_g_e___c_o_u_n_t_e_r_s
│ │ │ │ │  _d_h_t___s_t_o_r_a_g_e___i_n_t_e_r_f_a_c_e
│ │ │ │ │ -_d_h_t___s_t_a_t_e
│ │ │ │ │  _d_h_t___d_e_f_a_u_l_t___s_t_o_r_a_g_e___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │  _s_i_g_n___m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │  _a_n_n_o_u_n_c_e___f_l_a_g_s___t
│ │ │ │ │  Resume Data
│ │ │ │ │  _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │  _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a___b_u_f_(_)
│ │ │ │ │  _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ -_w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │  _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e___b_u_f_(_)
│ │ │ │ │ +_w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │  _w_r_i_t_e___t_o_r_r_e_n_t___f_l_a_g_s___t
│ │ │ │ │ +Create Torrents
│ │ │ │ │ +_o_v_e_r_v_i_e_w
│ │ │ │ │ +_c_r_e_a_t_e___t_o_r_r_e_n_t
│ │ │ │ │ +_a_d_d___f_i_l_e_s_(_)
│ │ │ │ │ +_s_e_t___p_i_e_c_e___h_a_s_h_e_s_(_)
│ │ │ │ │  Filter
│ │ │ │ │  _i_p___f_i_l_t_e_r
│ │ │ │ │  _p_o_r_t___f_i_l_t_e_r
│ │ │ │ │ -Error Codes
│ │ │ │ │ -_s_t_o_r_a_g_e___e_r_r_o_r
│ │ │ │ │ -_l_i_b_t_o_r_r_e_n_t___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -_h_t_t_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -_i_2_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -_b_d_e_c_o_d_e___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -_p_c_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -_s_o_c_k_s___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -_g_z_i_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -_u_p_n_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -_e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ -_h_t_t_p___e_r_r_o_r_s
│ │ │ │ │ -_i_2_p___e_r_r_o_r___c_o_d_e
│ │ │ │ │ -_e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ -_p_c_p___e_r_r_o_r_s
│ │ │ │ │ -_s_o_c_k_s___e_r_r_o_r___c_o_d_e
│ │ │ │ │ -_e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ -_e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │  Bdecoding
│ │ │ │ │  _b_d_e_c_o_d_e___n_o_d_e
│ │ │ │ │  _p_r_i_n_t___e_n_t_r_y_(_)
│ │ │ │ │  _b_d_e_c_o_d_e_(_)
│ │ │ │ │  Bencoding
│ │ │ │ │  _o_v_e_r_v_i_e_w
│ │ │ │ │  _e_n_t_r_y
│ │ │ │ │  _b_e_n_c_o_d_e_(_)
│ │ │ │ │  _o_p_e_r_a_t_o_r_<_<_(_)
│ │ │ │ │ -Create Torrents
│ │ │ │ │ -_o_v_e_r_v_i_e_w
│ │ │ │ │ -_c_r_e_a_t_e___t_o_r_r_e_n_t
│ │ │ │ │ -_a_d_d___f_i_l_e_s_(_)
│ │ │ │ │ -_s_e_t___p_i_e_c_e___h_a_s_h_e_s_(_)
│ │ │ │ │ -Utility
│ │ │ │ │ -_h_a_s_h_e_r
│ │ │ │ │ -_h_a_s_h_e_r_2_5_6
│ │ │ │ │ -_b_i_t_f_i_e_l_d
│ │ │ │ │ -Storage
│ │ │ │ │ -_s_t_o_r_a_g_e___p_a_r_a_m_s
│ │ │ │ │ -_f_i_l_e___s_l_i_c_e
│ │ │ │ │ -_f_i_l_e___s_t_o_r_a_g_e
│ │ │ │ │ -_d_e_f_a_u_l_t___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ -_p_o_s_i_x___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ -_d_i_s_a_b_l_e_d___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ -_m_m_a_p___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ -_s_t_o_r_a_g_e___m_o_d_e___t
│ │ │ │ │ -_s_t_a_t_u_s___t
│ │ │ │ │ -_m_o_v_e___f_l_a_g_s___t
│ │ │ │ │ +Error Codes
│ │ │ │ │ +_s_t_o_r_a_g_e___e_r_r_o_r
│ │ │ │ │ +_g_z_i_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +_u_p_n_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +_b_d_e_c_o_d_e___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +_p_c_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +_i_2_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +_l_i_b_t_o_r_r_e_n_t___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +_h_t_t_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +_s_o_c_k_s___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +_e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +_e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +_e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +_p_c_p___e_r_r_o_r_s
│ │ │ │ │ +_i_2_p___e_r_r_o_r___c_o_d_e
│ │ │ │ │ +_e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +_h_t_t_p___e_r_r_o_r_s
│ │ │ │ │ +_s_o_c_k_s___e_r_r_o_r___c_o_d_e
│ │ │ │ │  Plugins
│ │ │ │ │  _o_v_e_r_v_i_e_w
│ │ │ │ │  _p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e
│ │ │ │ │  _b_t___p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e
│ │ │ │ │  _p_l_u_g_i_n
│ │ │ │ │  _t_o_r_r_e_n_t___p_l_u_g_i_n
│ │ │ │ │  _p_e_e_r___p_l_u_g_i_n
│ │ │ │ │  _c_r_y_p_t_o___p_l_u_g_i_n
│ │ │ │ │ -_c_r_e_a_t_e___s_m_a_r_t___b_a_n___p_l_u_g_i_n_(_)
│ │ │ │ │  _c_r_e_a_t_e___u_t___p_e_x___p_l_u_g_i_n_(_)
│ │ │ │ │ +_c_r_e_a_t_e___s_m_a_r_t___b_a_n___p_l_u_g_i_n_(_)
│ │ │ │ │  _c_r_e_a_t_e___u_t___m_e_t_a_d_a_t_a___p_l_u_g_i_n_(_)
│ │ │ │ │ -PeerClass
│ │ │ │ │ -_p_e_e_r___c_l_a_s_s___i_n_f_o
│ │ │ │ │ -_p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r
│ │ │ │ │  Custom Storage
│ │ │ │ │  _o_v_e_r_v_i_e_w
│ │ │ │ │ -_d_i_s_k___o_b_s_e_r_v_e_r
│ │ │ │ │ -_o_p_e_n___f_i_l_e___s_t_a_t_e
│ │ │ │ │ -_d_i_s_k___i_n_t_e_r_f_a_c_e
│ │ │ │ │ -_s_t_o_r_a_g_e___h_o_l_d_e_r
│ │ │ │ │  _s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e
│ │ │ │ │  _b_u_f_f_e_r___a_l_l_o_c_a_t_o_r___i_n_t_e_r_f_a_c_e
│ │ │ │ │  _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r
│ │ │ │ │ +_o_p_e_n___f_i_l_e___s_t_a_t_e
│ │ │ │ │ +_d_i_s_k___i_n_t_e_r_f_a_c_e
│ │ │ │ │ +_s_t_o_r_a_g_e___h_o_l_d_e_r
│ │ │ │ │ +_d_i_s_k___o_b_s_e_r_v_e_r
│ │ │ │ │  _f_i_l_e___o_p_e_n___m_o_d_e___t
│ │ │ │ │ +PeerClass
│ │ │ │ │ +_p_e_e_r___c_l_a_s_s___i_n_f_o
│ │ │ │ │ +_p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r
│ │ │ │ │ +Storage
│ │ │ │ │ +_s_t_o_r_a_g_e___p_a_r_a_m_s
│ │ │ │ │ +_f_i_l_e___s_l_i_c_e
│ │ │ │ │ +_f_i_l_e___s_t_o_r_a_g_e
│ │ │ │ │ +_m_m_a_p___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ +_d_e_f_a_u_l_t___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ +_d_i_s_a_b_l_e_d___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ +_p_o_s_i_x___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ +_s_t_o_r_a_g_e___m_o_d_e___t
│ │ │ │ │ +_s_t_a_t_u_s___t
│ │ │ │ │ +_m_o_v_e___f_l_a_g_s___t
│ │ │ │ │ +Utility
│ │ │ │ │ +_h_a_s_h_e_r
│ │ │ │ │ +_h_a_s_h_e_r_2_5_6
│ │ │ │ │ +_b_i_t_f_i_e_l_d
│ │ │ │ │  ed25519
│ │ │ │ │  _e_d_2_5_5_1_9___c_r_e_a_t_e___s_e_e_d_(_)
│ │ │ │ │  _e_d_2_5_5_1_9___c_r_e_a_t_e___k_e_y_p_a_i_r_(_)
│ │ │ │ │  _e_d_2_5_5_1_9___s_i_g_n_(_)
│ │ │ │ │  _e_d_2_5_5_1_9___v_e_r_i_f_y_(_)
│ │ │ │ │  _e_d_2_5_5_1_9___a_d_d___s_c_a_l_a_r_(_)
│ │ │ │ │  _e_d_2_5_5_1_9___k_e_y___e_x_c_h_a_n_g_e_(_)
│ │ │ │ │  Alerts
│ │ │ │ │  _o_v_e_r_v_i_e_w
│ │ │ │ │ -_a_l_e_r_t
│ │ │ │ │  _d_h_t___r_o_u_t_i_n_g___b_u_c_k_e_t
│ │ │ │ │  _t_o_r_r_e_n_t___a_l_e_r_t
│ │ │ │ │  _p_e_e_r___a_l_e_r_t
│ │ │ │ │  _t_r_a_c_k_e_r___a_l_e_r_t
│ │ │ │ │  _t_o_r_r_e_n_t___r_e_m_o_v_e_d___a_l_e_r_t
│ │ │ │ │  _r_e_a_d___p_i_e_c_e___a_l_e_r_t
│ │ │ │ │  _f_i_l_e___c_o_m_p_l_e_t_e_d___a_l_e_r_t
│ │ │ │ │ @@ -262,19 +261,20 @@
│ │ │ │ │  _o_v_e_r_s_i_z_e_d___f_i_l_e___a_l_e_r_t
│ │ │ │ │  _t_o_r_r_e_n_t___c_o_n_f_l_i_c_t___a_l_e_r_t
│ │ │ │ │  _p_e_e_r___i_n_f_o___a_l_e_r_t
│ │ │ │ │  _f_i_l_e___p_r_o_g_r_e_s_s___a_l_e_r_t
│ │ │ │ │  _p_i_e_c_e___i_n_f_o___a_l_e_r_t
│ │ │ │ │  _p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y___a_l_e_r_t
│ │ │ │ │  _t_r_a_c_k_e_r___l_i_s_t___a_l_e_r_t
│ │ │ │ │ +_a_l_e_r_t
│ │ │ │ │  _a_l_e_r_t___c_a_s_t_(_)
│ │ │ │ │  _o_p_e_r_a_t_i_o_n___n_a_m_e_(_)
│ │ │ │ │  _o_p_e_r_a_t_i_o_n___t
│ │ │ │ │ -_a_l_e_r_t___c_a_t_e_g_o_r_y___t
│ │ │ │ │  _i_n_t
│ │ │ │ │ +_a_l_e_r_t___c_a_t_e_g_o_r_y___t
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  _b_l_o_g
│ │ │ │ │  _u_T_P
│ │ │ │ │  _d_o_w_n_l_o_a_d
│ │ │ │ │  _d_o_c_u_m_e_n_t_a_t_i_o_n
│ │ │ │ │  _D_H_T_ _p_u_t_ _e_x_t_e_n_s_i_o_n
│ │ │ │ │  _p_y_t_h_o_n_ _b_i_n_d_i_n_g_s
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/single-page-ref.html
│ │ │ │ @@ -28,12566 +28,2800 @@
│ │ │ │  <td>2.0.11</td></tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │  <p><a class="reference external" href="reference.html">home</a></p>
│ │ │ │  <div class="contents topic" id="table-of-contents">
│ │ │ │  <p class="topic-title">Table of contents</p>
│ │ │ │  <ul class="simple">
│ │ │ │ -<li><a class="reference internal" href="#piece-block" id="toc-entry-1">piece_block</a></li>
│ │ │ │ -<li><a class="reference internal" href="#info-hash-t" id="toc-entry-2">info_hash_t</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#info-hash-t-1" id="toc-entry-3">info_hash_t()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#has-v1-has-v2-has" id="toc-entry-4">has_v1() has_v2() has()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get" id="toc-entry-5">get()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-best" id="toc-entry-6">get_best()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#for-each" id="toc-entry-7">for_each()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#a-word-of-caution" id="toc-entry-1">a word of caution</a></li>
│ │ │ │ +<li><a class="reference internal" href="#plugin-interface" id="toc-entry-2">plugin-interface</a></li>
│ │ │ │ +<li><a class="reference internal" href="#custom-alerts" id="toc-entry-3">custom alerts</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-connection-handle" id="toc-entry-4">peer_connection_handle</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bt-peer-connection-handle" id="toc-entry-5">bt_peer_connection_handle</a></li>
│ │ │ │ +<li><a class="reference internal" href="#plugin" id="toc-entry-6">plugin</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#implemented-features" id="toc-entry-7">implemented_features()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#new-torrent" id="toc-entry-8">new_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#added" id="toc-entry-9">added()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#abort" id="toc-entry-10">abort()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-dht-request" id="toc-entry-11">on_dht_request()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-alert" id="toc-entry-12">on_alert()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-unknown-torrent" id="toc-entry-13">on_unknown_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-tick" id="toc-entry-14">on_tick()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-unchoke-priority" id="toc-entry-15">get_unchoke_priority()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#load-state" id="toc-entry-16">load_state()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-info" id="toc-entry-8">peer_info</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#i2p-destination" id="toc-entry-9">i2p_destination()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-plugin" id="toc-entry-17">torrent_plugin</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#new-connection" id="toc-entry-18">new_connection()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-piece-pass-on-piece-failed" id="toc-entry-19">on_piece_pass() on_piece_failed()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tick" id="toc-entry-20">tick()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-resume-on-pause" id="toc-entry-21">on_resume() on_pause()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-files-checked" id="toc-entry-22">on_files_checked()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-state" id="toc-entry-23">on_state()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-add-peer" id="toc-entry-24">on_add_peer()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-request" id="toc-entry-10">peer_request</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#operator" id="toc-entry-11">operator==()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-plugin" id="toc-entry-25">peer_plugin</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#type" id="toc-entry-26">type()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-handshake" id="toc-entry-27">add_handshake()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-disconnect" id="toc-entry-28">on_disconnect()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-connected" id="toc-entry-29">on_connected()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-handshake" id="toc-entry-30">on_handshake()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-extension-handshake" id="toc-entry-31">on_extension_handshake()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-have-on-have-all-on-request-on-bitfield-on-not-interested-on-choke-on-allowed-fast-on-have-none-on-unchoke-on-interested-on-dont-have" id="toc-entry-32">on_have() on_have_all() on_request() on_bitfield() on_not_interested() on_choke() on_allowed_fast() on_have_none() on_unchoke() on_interested() on_dont_have()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-piece" id="toc-entry-33">on_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#sent-have-sent-interested-sent-not-interested-sent-piece-sent-unchoke" id="toc-entry-34">sent_have() sent_interested() sent_not_interested() sent_piece() sent_unchoke()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#sent-payload" id="toc-entry-35">sent_payload()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#can-disconnect" id="toc-entry-36">can_disconnect()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-extended" id="toc-entry-37">on_extended()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-unknown-message" id="toc-entry-38">on_unknown_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#on-piece-pass-on-piece-failed-1" id="toc-entry-39">on_piece_pass() on_piece_failed()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tick-1" id="toc-entry-40">tick()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#write-request" id="toc-entry-41">write_request()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-peer-equal" id="toc-entry-12">torrent_peer_equal()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#make-magnet-uri" id="toc-entry-13">make_magnet_uri()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#parse-magnet-uri" id="toc-entry-14">parse_magnet_uri()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#truncate-files" id="toc-entry-15">truncate_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#version" id="toc-entry-16">version()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#load-torrent-buffer-load-torrent-file-load-torrent-parsed" id="toc-entry-17">load_torrent_buffer() load_torrent_file() load_torrent_parsed()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-protocol-version" id="toc-entry-18">enum protocol_version</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-socket-type-t" id="toc-entry-19">enum socket_type_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-portmap-transport" id="toc-entry-20">enum portmap_transport</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-portmap-protocol" id="toc-entry-21">enum portmap_protocol</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-event-t" id="toc-entry-22">enum event_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-connection-type" id="toc-entry-23">enum connection_type</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-flags-t" id="toc-entry-24">torrent_flags_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#pex-flags-t" id="toc-entry-25">pex_flags_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#download-priority-t" id="toc-entry-26">download_priority_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#int" id="toc-entry-27">int</a></li>
│ │ │ │ -<li><a class="reference internal" href="#char-const" id="toc-entry-28">char const*</a></li>
│ │ │ │ -<li><a class="reference internal" href="#std-uint64-t" id="toc-entry-29">std::uint64_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#block-info" id="toc-entry-30">block_info</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#set-peer-peer" id="toc-entry-31">set_peer() peer()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-block-state-t" id="toc-entry-32">enum block_state_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#crypto-plugin" id="toc-entry-42">crypto_plugin</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#decrypt" id="toc-entry-43">decrypt()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#partial-piece-info" id="toc-entry-33">partial_piece_info</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-handle" id="toc-entry-34">torrent_handle</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#torrent-handle-1" id="toc-entry-35">torrent_handle()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-piece" id="toc-entry-36">add_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#read-piece" id="toc-entry-37">read_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#have-piece" id="toc-entry-38">have_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-peer-info-post-peer-info" id="toc-entry-39">get_peer_info() post_peer_info()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#post-status-status" id="toc-entry-40">post_status() status()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-download-queue-post-download-queue" id="toc-entry-41">get_download_queue() post_download_queue()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#clear-piece-deadlines-reset-piece-deadline-set-piece-deadline" id="toc-entry-42">clear_piece_deadlines() reset_piece_deadline() set_piece_deadline()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-progress-post-file-progress" id="toc-entry-43">file_progress() post_file_progress()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-status" id="toc-entry-44">file_status()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#clear-error" id="toc-entry-45">clear_error()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-tracker-replace-trackers-trackers-post-trackers" id="toc-entry-46">add_tracker() replace_trackers() trackers() post_trackers()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#url-seeds-remove-url-seed-add-url-seed" id="toc-entry-47">url_seeds() remove_url_seed() add_url_seed()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-http-seed-remove-http-seed-http-seeds" id="toc-entry-48">add_http_seed() remove_http_seed() http_seeds()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-extension" id="toc-entry-49">add_extension()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-metadata" id="toc-entry-50">set_metadata()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#is-valid" id="toc-entry-51">is_valid()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#resume-pause" id="toc-entry-52">resume() pause()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#flags-unset-flags-set-flags" id="toc-entry-53">flags() unset_flags() set_flags()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#flush-cache" id="toc-entry-54">flush_cache()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#force-recheck" id="toc-entry-55">force_recheck()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#save-resume-data" id="toc-entry-56">save_resume_data()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#need-save-resume-data" id="toc-entry-57">need_save_resume_data()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#queue-position-bottom-queue-position-up-queue-position-top-queue-position-down-queue-position" id="toc-entry-58">queue_position_bottom() queue_position_up() queue_position_top() queue_position_down() queue_position()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#queue-position-set" id="toc-entry-59">queue_position_set()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-ssl-certificate-buffer-set-ssl-certificate" id="toc-entry-60">set_ssl_certificate_buffer() set_ssl_certificate()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-file-torrent-file-with-hashes" id="toc-entry-61">torrent_file() torrent_file_with_hashes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-layers" id="toc-entry-62">piece_layers()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-availability-post-piece-availability" id="toc-entry-63">piece_availability() post_piece_availability()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-piece-priorities-piece-priority-prioritize-pieces" id="toc-entry-64">get_piece_priorities() piece_priority() prioritize_pieces()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-file-priorities-file-priority-prioritize-files" id="toc-entry-65">get_file_priorities() file_priority() prioritize_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#force-reannounce-force-dht-announce-force-lsd-announce" id="toc-entry-66">force_reannounce() force_dht_announce() force_lsd_announce()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#scrape-tracker" id="toc-entry-67">scrape_tracker()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-download-limit-download-limit-upload-limit-set-upload-limit" id="toc-entry-68">set_download_limit() download_limit() upload_limit() set_upload_limit()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#connect-peer" id="toc-entry-69">connect_peer()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#clear-peers" id="toc-entry-70">clear_peers()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-max-uploads-max-uploads" id="toc-entry-71">set_max_uploads() max_uploads()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#max-connections-set-max-connections" id="toc-entry-72">max_connections() set_max_connections()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#move-storage" id="toc-entry-73">move_storage()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#rename-file" id="toc-entry-74">rename_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#info-hashes-info-hash" id="toc-entry-75">info_hashes() info_hash()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#operator-operator-operator" id="toc-entry-76">operator!=() operator==() operator&lt;()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#id" id="toc-entry-77">id()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#native-handle" id="toc-entry-78">native_handle()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#userdata" id="toc-entry-79">userdata()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#in-session" id="toc-entry-80">in_session()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#create-ut-pex-plugin" id="toc-entry-44">create_ut_pex_plugin()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#create-smart-ban-plugin" id="toc-entry-45">create_smart_ban_plugin()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#create-ut-metadata-plugin" id="toc-entry-46">create_ut_metadata_plugin()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-torrent-params" id="toc-entry-47">add_torrent_params</a></li>
│ │ │ │ +<li><a class="reference internal" href="#client-data-t" id="toc-entry-48">client_data_t</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#client-data-t-1" id="toc-entry-49">client_data_t()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-const-void" id="toc-entry-50">operator=() const*() void*()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#hash-value" id="toc-entry-81">hash_value()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#web-seed-entry" id="toc-entry-82">web_seed_entry</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#operator-1" id="toc-entry-83">operator==()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#operator-2" id="toc-entry-84">operator&lt;()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-type-t" id="toc-entry-85">enum type_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#settings-interface" id="toc-entry-51">settings_interface</a></li>
│ │ │ │ +<li><a class="reference internal" href="#buffer-allocator-interface" id="toc-entry-52">buffer_allocator_interface</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disk-buffer-holder" id="toc-entry-53">disk_buffer_holder</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#disk-buffer-holder-1" id="toc-entry-54">disk_buffer_holder()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disk-buffer-holder-2" id="toc-entry-55">disk_buffer_holder()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disk-buffer-holder-3" id="toc-entry-56">~disk_buffer_holder()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#data" id="toc-entry-57">data()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#reset" id="toc-entry-58">reset()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#swap" id="toc-entry-59">swap()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#is-mutable" id="toc-entry-60">is_mutable()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bool" id="toc-entry-61">bool()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#load-torrent-limits" id="toc-entry-86">load_torrent_limits</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-info" id="toc-entry-87">torrent_info</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#torrent-info-1" id="toc-entry-88">torrent_info()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-info-2" id="toc-entry-89">~torrent_info()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#files-orig-files" id="toc-entry-90">files() orig_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#rename-file-1" id="toc-entry-91">rename_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#remap-files" id="toc-entry-92">remap_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-tracker-clear-trackers-trackers" id="toc-entry-93">add_tracker() clear_trackers() trackers()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#collections-similar-torrents" id="toc-entry-94">collections() similar_torrents()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-http-seed-set-web-seeds-add-url-seed-web-seeds" id="toc-entry-95">add_http_seed() set_web_seeds() add_url_seed() web_seeds()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#total-size" id="toc-entry-96">total_size()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-length-num-pieces" id="toc-entry-97">piece_length() num_pieces()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#blocks-per-piece" id="toc-entry-98">blocks_per_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#last-piece-end-piece-piece-range" id="toc-entry-99">last_piece() end_piece() piece_range()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#info-hashes-info-hash-1" id="toc-entry-100">info_hashes() info_hash()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#v1-v2" id="toc-entry-101">v1() v2()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#num-files" id="toc-entry-102">num_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#map-block" id="toc-entry-103">map_block()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#map-file" id="toc-entry-104">map_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#ssl-cert" id="toc-entry-105">ssl_cert()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#is-valid-1" id="toc-entry-106">is_valid()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#priv" id="toc-entry-107">priv()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#is-i2p" id="toc-entry-108">is_i2p()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-size" id="toc-entry-109">piece_size()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#hash-for-piece-ptr-hash-for-piece" id="toc-entry-110">hash_for_piece_ptr() hash_for_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#name" id="toc-entry-111">name()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#creation-date" id="toc-entry-112">creation_date()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#creator" id="toc-entry-113">creator()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#comment" id="toc-entry-114">comment()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#nodes" id="toc-entry-115">nodes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-node" id="toc-entry-116">add_node()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#parse-info-section" id="toc-entry-117">parse_info_section()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#info" id="toc-entry-118">info()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#info-section" id="toc-entry-119">info_section()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-layer" id="toc-entry-120">piece_layer()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#free-piece-layers" id="toc-entry-121">free_piece_layers()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#open-file-state" id="toc-entry-62">open_file_state</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disk-interface" id="toc-entry-63">disk_interface</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#new-torrent-1" id="toc-entry-64">new_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#remove-torrent" id="toc-entry-65">remove_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-read-async-write" id="toc-entry-66">async_read() async_write()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-hash" id="toc-entry-67">async_hash()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-hash2" id="toc-entry-68">async_hash2()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-move-storage" id="toc-entry-69">async_move_storage()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-release-files" id="toc-entry-70">async_release_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-check-files" id="toc-entry-71">async_check_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-stop-torrent" id="toc-entry-72">async_stop_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-rename-file" id="toc-entry-73">async_rename_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-delete-files" id="toc-entry-74">async_delete_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-set-file-priority" id="toc-entry-75">async_set_file_priority()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-clear-piece" id="toc-entry-76">async_clear_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#update-stats-counters" id="toc-entry-77">update_stats_counters()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-status" id="toc-entry-78">get_status()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#abort-1" id="toc-entry-79">abort()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#submit-jobs" id="toc-entry-80">submit_jobs()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#settings-updated" id="toc-entry-81">settings_updated()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#hasher" id="toc-entry-122">hasher</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#operator-hasher" id="toc-entry-123">operator=() hasher()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#update" id="toc-entry-124">update()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#final" id="toc-entry-125">final()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#reset" id="toc-entry-126">reset()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#storage-holder" id="toc-entry-82">storage_holder</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disk-observer" id="toc-entry-83">disk_observer</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#on-disk" id="toc-entry-84">on_disk()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#hasher256" id="toc-entry-127">hasher256</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#operator-hasher256" id="toc-entry-128">operator=() hasher256()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#update-1" id="toc-entry-129">update()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#final-1" id="toc-entry-130">final()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#reset-1" id="toc-entry-131">reset()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-open-mode-t" id="toc-entry-85">file_open_mode_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#settings-pack" id="toc-entry-86">settings_pack</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#set-str-set-int-set-bool" id="toc-entry-87">set_str() set_int() set_bool()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#has-val" id="toc-entry-88">has_val()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#clear" id="toc-entry-89">clear()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#clear-1" id="toc-entry-90">clear()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-int-get-bool-get-str" id="toc-entry-91">get_int() get_bool() get_str()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-type-bases" id="toc-entry-92">enum type_bases</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-mmap-write-mode-t" id="toc-entry-93">enum mmap_write_mode_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-suggest-mode-t" id="toc-entry-94">enum suggest_mode_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-choking-algorithm-t" id="toc-entry-95">enum choking_algorithm_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-seed-choking-algorithm-t" id="toc-entry-96">enum seed_choking_algorithm_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-io-buffer-mode-t" id="toc-entry-97">enum io_buffer_mode_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-bandwidth-mixed-algo-t" id="toc-entry-98">enum bandwidth_mixed_algo_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-enc-policy" id="toc-entry-99">enum enc_policy</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-enc-level" id="toc-entry-100">enum enc_level</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-proxy-type-t" id="toc-entry-101">enum proxy_type_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#bitfield" id="toc-entry-132">bitfield</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#bitfield-1" id="toc-entry-133">bitfield()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#assign" id="toc-entry-134">assign()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#operator-get-bit" id="toc-entry-135">operator[]() get_bit()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#clear-bit-set-bit" id="toc-entry-136">clear_bit() set_bit()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#all-set" id="toc-entry-137">all_set()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#none-set" id="toc-entry-138">none_set()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#size" id="toc-entry-139">size()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#num-words" id="toc-entry-140">num_words()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#num-bytes" id="toc-entry-141">num_bytes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#empty" id="toc-entry-142">empty()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#data" id="toc-entry-143">data()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#swap" id="toc-entry-144">swap()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#count" id="toc-entry-145">count()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#find-first-set" id="toc-entry-146">find_first_set()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#find-last-clear" id="toc-entry-147">find_last_clear()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#setting-by-name-name-for-setting" id="toc-entry-102">setting_by_name() name_for_setting()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#default-settings" id="toc-entry-103">default_settings()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#high-performance-seed-min-memory-usage" id="toc-entry-104">high_performance_seed() min_memory_usage()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#generate-fingerprint" id="toc-entry-105">generate_fingerprint()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#create-torrent" id="toc-entry-106">create_torrent</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#create-torrent-1" id="toc-entry-107">create_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#generate-generate-buf" id="toc-entry-108">generate() generate_buf()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#files" id="toc-entry-109">files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-comment" id="toc-entry-110">set_comment()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-creator" id="toc-entry-111">set_creator()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-creation-date" id="toc-entry-112">set_creation_date()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-hash" id="toc-entry-113">set_hash()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-hash2" id="toc-entry-114">set_hash2()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-url-seed-add-http-seed" id="toc-entry-115">add_url_seed() add_http_seed()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-node" id="toc-entry-116">add_node()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-tracker" id="toc-entry-117">add_tracker()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-root-cert" id="toc-entry-118">set_root_cert()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#priv-set-priv" id="toc-entry-119">priv() set_priv()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#num-pieces" id="toc-entry-120">num_pieces()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-range" id="toc-entry-121">piece_range()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-range" id="toc-entry-122">file_range()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-piece-range" id="toc-entry-123">file_piece_range()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#total-size" id="toc-entry-124">total_size()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-length-piece-size" id="toc-entry-125">piece_length() piece_size()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-collection-add-similar-torrent" id="toc-entry-126">add_collection() add_similar_torrent()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#session-proxy" id="toc-entry-148">session_proxy</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#operator-session-proxy-session-proxy" id="toc-entry-149">operator=() session_proxy() ~session_proxy()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-files" id="toc-entry-127">add_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-piece-hashes" id="toc-entry-128">set_piece_hashes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#web-seed-entry" id="toc-entry-129">web_seed_entry</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#operator" id="toc-entry-130">operator==()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-1" id="toc-entry-131">operator&lt;()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-type-t" id="toc-entry-132">enum type_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#session" id="toc-entry-150">session</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#session-1" id="toc-entry-151">session()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#session-2" id="toc-entry-152">session()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#session-3" id="toc-entry-153">~session()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#abort" id="toc-entry-154">abort()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#load-torrent-limits" id="toc-entry-133">load_torrent_limits</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-info" id="toc-entry-134">torrent_info</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#torrent-info-1" id="toc-entry-135">torrent_info()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-info-2" id="toc-entry-136">~torrent_info()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#files-orig-files" id="toc-entry-137">files() orig_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#rename-file" id="toc-entry-138">rename_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#remap-files" id="toc-entry-139">remap_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#clear-trackers-add-tracker-trackers" id="toc-entry-140">clear_trackers() add_tracker() trackers()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#collections-similar-torrents" id="toc-entry-141">collections() similar_torrents()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-url-seed-web-seeds-set-web-seeds-add-http-seed" id="toc-entry-142">add_url_seed() web_seeds() set_web_seeds() add_http_seed()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#total-size-1" id="toc-entry-143">total_size()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-length-num-pieces" id="toc-entry-144">piece_length() num_pieces()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#blocks-per-piece" id="toc-entry-145">blocks_per_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-range-last-piece-end-piece" id="toc-entry-146">piece_range() last_piece() end_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#info-hashes-info-hash" id="toc-entry-147">info_hashes() info_hash()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#v1-v2" id="toc-entry-148">v1() v2()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#num-files" id="toc-entry-149">num_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#map-block" id="toc-entry-150">map_block()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#map-file" id="toc-entry-151">map_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#ssl-cert" id="toc-entry-152">ssl_cert()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#is-valid" id="toc-entry-153">is_valid()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#priv" id="toc-entry-154">priv()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#is-i2p" id="toc-entry-155">is_i2p()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-size" id="toc-entry-156">piece_size()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#hash-for-piece-ptr-hash-for-piece" id="toc-entry-157">hash_for_piece_ptr() hash_for_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#name" id="toc-entry-158">name()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#creation-date" id="toc-entry-159">creation_date()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#creator" id="toc-entry-160">creator()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#comment" id="toc-entry-161">comment()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#nodes" id="toc-entry-162">nodes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-node-1" id="toc-entry-163">add_node()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#parse-info-section" id="toc-entry-164">parse_info_section()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#info" id="toc-entry-165">info()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#info-section" id="toc-entry-166">info_section()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-layer" id="toc-entry-167">piece_layer()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#free-piece-layers" id="toc-entry-168">free_piece_layers()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#session-params" id="toc-entry-155">session_params</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#session-params-1" id="toc-entry-156">session_params()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#session-params-2" id="toc-entry-157">session_params()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#ip-filter" id="toc-entry-169">ip_filter</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#empty" id="toc-entry-170">empty()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-rule" id="toc-entry-171">add_rule()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#access" id="toc-entry-172">access()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#export-filter" id="toc-entry-173">export_filter()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-access-flags" id="toc-entry-174">enum access_flags</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#session-handle" id="toc-entry-158">session_handle</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#is-valid-2" id="toc-entry-159">is_valid()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#session-state" id="toc-entry-160">session_state()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#refresh-torrent-status-get-torrent-status" id="toc-entry-161">refresh_torrent_status() get_torrent_status()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#post-torrent-updates" id="toc-entry-162">post_torrent_updates()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#post-session-stats" id="toc-entry-163">post_session_stats()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#post-dht-stats" id="toc-entry-164">post_dht_stats()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-dht-state" id="toc-entry-165">set_dht_state()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#find-torrent-get-torrents" id="toc-entry-166">find_torrent() get_torrents()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-torrent-async-add-torrent" id="toc-entry-167">add_torrent() async_add_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#is-paused-resume-pause" id="toc-entry-168">is_paused() resume() pause()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#is-dht-running" id="toc-entry-169">is_dht_running()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-dht-storage" id="toc-entry-170">set_dht_storage()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-dht-node" id="toc-entry-171">add_dht_node()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-get-item" id="toc-entry-172">dht_get_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-get-item-1" id="toc-entry-173">dht_get_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-put-item" id="toc-entry-174">dht_put_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-put-item-1" id="toc-entry-175">dht_put_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-get-peers-dht-announce" id="toc-entry-176">dht_get_peers() dht_announce()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-live-nodes" id="toc-entry-177">dht_live_nodes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-sample-infohashes" id="toc-entry-178">dht_sample_infohashes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-direct-request" id="toc-entry-179">dht_direct_request()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-extension-1" id="toc-entry-180">add_extension()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-ip-filter-get-ip-filter" id="toc-entry-181">set_ip_filter() get_ip_filter()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-port-filter" id="toc-entry-182">set_port_filter()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#listen-port-is-listening-ssl-listen-port" id="toc-entry-183">listen_port() is_listening() ssl_listen_port()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-peer-class-filter-set-peer-class-filter" id="toc-entry-184">get_peer_class_filter() set_peer_class_filter()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-peer-class-type-filter-get-peer-class-type-filter" id="toc-entry-185">set_peer_class_type_filter() get_peer_class_type_filter()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#create-peer-class" id="toc-entry-186">create_peer_class()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#delete-peer-class" id="toc-entry-187">delete_peer_class()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-peer-class-set-peer-class" id="toc-entry-188">get_peer_class() set_peer_class()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#remove-torrent" id="toc-entry-189">remove_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#apply-settings-get-settings" id="toc-entry-190">apply_settings() get_settings()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#pop-alerts-wait-for-alert-set-alert-notify" id="toc-entry-191">pop_alerts() wait_for_alert() set_alert_notify()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-port-mapping-delete-port-mapping" id="toc-entry-192">add_port_mapping() delete_port_mapping()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#reopen-network-sockets" id="toc-entry-193">reopen_network_sockets()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#native-handle-1" id="toc-entry-194">native_handle()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#port-filter" id="toc-entry-175">port_filter</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#add-rule-1" id="toc-entry-176">add_rule()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#access-1" id="toc-entry-177">access()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-access-flags-1" id="toc-entry-178">enum access_flags</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#write-session-params-buf-read-session-params-write-session-params" id="toc-entry-195">write_session_params_buf() read_session_params() write_session_params()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#stats-metric" id="toc-entry-196">stats_metric</a></li>
│ │ │ │ -<li><a class="reference internal" href="#counters" id="toc-entry-197">counters</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#operator-inc-stats-counter" id="toc-entry-198">operator[]() inc_stats_counter()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#block-info" id="toc-entry-179">block_info</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#peer-set-peer" id="toc-entry-180">peer() set_peer()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-block-state-t" id="toc-entry-181">enum block_state_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#session-stats-metrics" id="toc-entry-199">session_stats_metrics()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#find-metric-idx" id="toc-entry-200">find_metric_idx()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-metric-type-t" id="toc-entry-201">enum metric_type_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#ip-filter" id="toc-entry-202">ip_filter</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#empty-1" id="toc-entry-203">empty()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-rule" id="toc-entry-204">add_rule()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#access" id="toc-entry-205">access()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#export-filter" id="toc-entry-206">export_filter()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-access-flags" id="toc-entry-207">enum access_flags</a></li>
│ │ │ │ +<li><a class="reference internal" href="#partial-piece-info" id="toc-entry-182">partial_piece_info</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-handle" id="toc-entry-183">torrent_handle</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#torrent-handle-1" id="toc-entry-184">torrent_handle()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-piece" id="toc-entry-185">add_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#read-piece" id="toc-entry-186">read_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#have-piece" id="toc-entry-187">have_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-peer-info-post-peer-info" id="toc-entry-188">get_peer_info() post_peer_info()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#post-status-status" id="toc-entry-189">post_status() status()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#post-download-queue-get-download-queue" id="toc-entry-190">post_download_queue() get_download_queue()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-piece-deadline-reset-piece-deadline-clear-piece-deadlines" id="toc-entry-191">set_piece_deadline() reset_piece_deadline() clear_piece_deadlines()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-progress-post-file-progress" id="toc-entry-192">file_progress() post_file_progress()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-status" id="toc-entry-193">file_status()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#clear-error" id="toc-entry-194">clear_error()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-tracker-replace-trackers-trackers-post-trackers" id="toc-entry-195">add_tracker() replace_trackers() trackers() post_trackers()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#remove-url-seed-add-url-seed-url-seeds" id="toc-entry-196">remove_url_seed() add_url_seed() url_seeds()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#http-seeds-remove-http-seed-add-http-seed" id="toc-entry-197">http_seeds() remove_http_seed() add_http_seed()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-extension" id="toc-entry-198">add_extension()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-metadata" id="toc-entry-199">set_metadata()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#is-valid-1" id="toc-entry-200">is_valid()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#pause-resume" id="toc-entry-201">pause() resume()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-flags-unset-flags-flags" id="toc-entry-202">set_flags() unset_flags() flags()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#flush-cache" id="toc-entry-203">flush_cache()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#force-recheck" id="toc-entry-204">force_recheck()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#save-resume-data" id="toc-entry-205">save_resume_data()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#need-save-resume-data" id="toc-entry-206">need_save_resume_data()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#queue-position-top-queue-position-down-queue-position-bottom-queue-position-up-queue-position" id="toc-entry-207">queue_position_top() queue_position_down() queue_position_bottom() queue_position_up() queue_position()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#queue-position-set" id="toc-entry-208">queue_position_set()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-ssl-certificate-set-ssl-certificate-buffer" id="toc-entry-209">set_ssl_certificate() set_ssl_certificate_buffer()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-file-with-hashes-torrent-file" id="toc-entry-210">torrent_file_with_hashes() torrent_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-layers" id="toc-entry-211">piece_layers()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#post-piece-availability-piece-availability" id="toc-entry-212">post_piece_availability() piece_availability()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-priority-prioritize-pieces-get-piece-priorities" id="toc-entry-213">piece_priority() prioritize_pieces() get_piece_priorities()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-file-priorities-prioritize-files-file-priority" id="toc-entry-214">get_file_priorities() prioritize_files() file_priority()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#force-lsd-announce-force-reannounce-force-dht-announce" id="toc-entry-215">force_lsd_announce() force_reannounce() force_dht_announce()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#scrape-tracker" id="toc-entry-216">scrape_tracker()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-download-limit-set-upload-limit-upload-limit-download-limit" id="toc-entry-217">set_download_limit() set_upload_limit() upload_limit() download_limit()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#connect-peer" id="toc-entry-218">connect_peer()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#clear-peers" id="toc-entry-219">clear_peers()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-max-uploads-max-uploads" id="toc-entry-220">set_max_uploads() max_uploads()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#max-connections-set-max-connections" id="toc-entry-221">max_connections() set_max_connections()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#move-storage" id="toc-entry-222">move_storage()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#rename-file-1" id="toc-entry-223">rename_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#info-hashes-info-hash-1" id="toc-entry-224">info_hashes() info_hash()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-operator-operator" id="toc-entry-225">operator!=() operator==() operator&lt;()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#id" id="toc-entry-226">id()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#native-handle" id="toc-entry-227">native_handle()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#userdata" id="toc-entry-228">userdata()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#in-session" id="toc-entry-229">in_session()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#port-filter" id="toc-entry-208">port_filter</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#add-rule-1" id="toc-entry-209">add_rule()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#access-1" id="toc-entry-210">access()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-access-flags-1" id="toc-entry-211">enum access_flags</a></li>
│ │ │ │ +<li><a class="reference internal" href="#hash-value" id="toc-entry-230">hash_value()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-proxy" id="toc-entry-231">session_proxy</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#operator-session-proxy-session-proxy" id="toc-entry-232">operator=() session_proxy() ~session_proxy()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#client-data-t" id="toc-entry-212">client_data_t</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#client-data-t-1" id="toc-entry-213">client_data_t()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#const-void-operator" id="toc-entry-214">const*() void*() operator=()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session" id="toc-entry-233">session</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#session-1" id="toc-entry-234">session()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-2" id="toc-entry-235">session()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-3" id="toc-entry-236">~session()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#abort-2" id="toc-entry-237">abort()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#add-torrent-params" id="toc-entry-215">add_torrent_params</a></li>
│ │ │ │ -<li><a class="reference internal" href="#announce-infohash" id="toc-entry-216">announce_infohash</a></li>
│ │ │ │ -<li><a class="reference internal" href="#announce-endpoint" id="toc-entry-217">announce_endpoint</a></li>
│ │ │ │ -<li><a class="reference internal" href="#announce-entry" id="toc-entry-218">announce_entry</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#operator-announce-entry-announce-entry" id="toc-entry-219">operator=() ~announce_entry() announce_entry()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-tracker-source" id="toc-entry-220">enum tracker_source</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-params" id="toc-entry-238">session_params</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#session-params-1" id="toc-entry-239">session_params()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-params-2" id="toc-entry-240">session_params()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#alert" id="toc-entry-221">alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#timestamp" id="toc-entry-222">timestamp()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#type" id="toc-entry-223">type()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#what" id="toc-entry-224">what()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#message" id="toc-entry-225">message()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#category" id="toc-entry-226">category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-handle" id="toc-entry-241">session_handle</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#is-valid-2" id="toc-entry-242">is_valid()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-state" id="toc-entry-243">session_state()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-torrent-status-refresh-torrent-status" id="toc-entry-244">get_torrent_status() refresh_torrent_status()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#post-torrent-updates" id="toc-entry-245">post_torrent_updates()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#post-session-stats" id="toc-entry-246">post_session_stats()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#post-dht-stats" id="toc-entry-247">post_dht_stats()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-dht-state" id="toc-entry-248">set_dht_state()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#find-torrent-get-torrents" id="toc-entry-249">find_torrent() get_torrents()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#async-add-torrent-add-torrent" id="toc-entry-250">async_add_torrent() add_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#is-paused-pause-resume" id="toc-entry-251">is_paused() pause() resume()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#is-dht-running" id="toc-entry-252">is_dht_running()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-dht-storage" id="toc-entry-253">set_dht_storage()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-dht-node" id="toc-entry-254">add_dht_node()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-get-item" id="toc-entry-255">dht_get_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-get-item-1" id="toc-entry-256">dht_get_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-put-item" id="toc-entry-257">dht_put_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-put-item-1" id="toc-entry-258">dht_put_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-announce-dht-get-peers" id="toc-entry-259">dht_announce() dht_get_peers()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-live-nodes" id="toc-entry-260">dht_live_nodes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-sample-infohashes" id="toc-entry-261">dht_sample_infohashes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-direct-request" id="toc-entry-262">dht_direct_request()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-extension-1" id="toc-entry-263">add_extension()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-ip-filter-get-ip-filter" id="toc-entry-264">set_ip_filter() get_ip_filter()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-port-filter" id="toc-entry-265">set_port_filter()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#ssl-listen-port-is-listening-listen-port" id="toc-entry-266">ssl_listen_port() is_listening() listen_port()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-peer-class-filter-set-peer-class-filter" id="toc-entry-267">get_peer_class_filter() set_peer_class_filter()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-peer-class-type-filter-get-peer-class-type-filter" id="toc-entry-268">set_peer_class_type_filter() get_peer_class_type_filter()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#create-peer-class" id="toc-entry-269">create_peer_class()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#delete-peer-class" id="toc-entry-270">delete_peer_class()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-peer-class-set-peer-class" id="toc-entry-271">get_peer_class() set_peer_class()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#remove-torrent-1" id="toc-entry-272">remove_torrent()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#apply-settings-get-settings" id="toc-entry-273">apply_settings() get_settings()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#pop-alerts-set-alert-notify-wait-for-alert" id="toc-entry-274">pop_alerts() set_alert_notify() wait_for_alert()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-port-mapping-delete-port-mapping" id="toc-entry-275">add_port_mapping() delete_port_mapping()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#reopen-network-sockets" id="toc-entry-276">reopen_network_sockets()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#native-handle-1" id="toc-entry-277">native_handle()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-routing-bucket" id="toc-entry-227">dht_routing_bucket</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-alert" id="toc-entry-228">torrent_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#message-1" id="toc-entry-229">message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#read-session-params-write-session-params-buf-write-session-params" id="toc-entry-278">read_session_params() write_session_params_buf() write_session_params()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#counters" id="toc-entry-279">counters</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#operator-inc-stats-counter" id="toc-entry-280">operator[]() inc_stats_counter()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-alert" id="toc-entry-230">peer_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-alert" id="toc-entry-231">tracker_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#tracker-url" id="toc-entry-232">tracker_url()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#stats-metric" id="toc-entry-281">stats_metric</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-stats-metrics" id="toc-entry-282">session_stats_metrics()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#find-metric-idx" id="toc-entry-283">find_metric_idx()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-metric-type-t" id="toc-entry-284">enum metric_type_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#announce-infohash" id="toc-entry-285">announce_infohash</a></li>
│ │ │ │ +<li><a class="reference internal" href="#announce-endpoint" id="toc-entry-286">announce_endpoint</a></li>
│ │ │ │ +<li><a class="reference internal" href="#announce-entry" id="toc-entry-287">announce_entry</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#operator-announce-entry-announce-entry" id="toc-entry-288">operator=() ~announce_entry() announce_entry()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-tracker-source" id="toc-entry-289">enum tracker_source</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-removed-alert" id="toc-entry-233">torrent_removed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#read-piece-alert" id="toc-entry-234">read_piece_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-completed-alert" id="toc-entry-235">file_completed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-renamed-alert" id="toc-entry-236">file_renamed_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#new-name-old-name" id="toc-entry-237">new_name() old_name()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-class-info" id="toc-entry-290">peer_class_info</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-class-type-filter" id="toc-entry-291">peer_class_type_filter</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#remove-add" id="toc-entry-292">remove() add()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#allow-disallow" id="toc-entry-293">allow() disallow()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#apply" id="toc-entry-294">apply()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-socket-type-t" id="toc-entry-295">enum socket_type_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#file-rename-failed-alert" id="toc-entry-238">file_rename_failed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#performance-alert" id="toc-entry-239">performance_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#enum-performance-warning-t" id="toc-entry-240">enum performance_warning_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#storage-params" id="toc-entry-296">storage_params</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-slice" id="toc-entry-297">file_slice</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-storage" id="toc-entry-298">file_storage</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#is-valid-3" id="toc-entry-299">is_valid()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#reserve" id="toc-entry-300">reserve()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-file-borrow-add-file" id="toc-entry-301">add_file_borrow() add_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#rename-file-2" id="toc-entry-302">rename_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#map-block-1" id="toc-entry-303">map_block()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#map-file-1" id="toc-entry-304">map_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#num-files-1" id="toc-entry-305">num_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#end-file" id="toc-entry-306">end_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-range-1" id="toc-entry-307">file_range()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#total-size-2" id="toc-entry-308">total_size()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-num-pieces-num-pieces" id="toc-entry-309">set_num_pieces() num_pieces()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#end-piece" id="toc-entry-310">end_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#last-piece" id="toc-entry-311">last_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-range-1" id="toc-entry-312">piece_range()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-length-set-piece-length" id="toc-entry-313">piece_length() set_piece_length()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-size-1" id="toc-entry-314">piece_size()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-size2" id="toc-entry-315">piece_size2()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#blocks-in-piece2" id="toc-entry-316">blocks_in_piece2()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#blocks-per-piece-1" id="toc-entry-317">blocks_per_piece()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#name-set-name" id="toc-entry-318">name() set_name()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#swap-1" id="toc-entry-319">swap()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#canonicalize" id="toc-entry-320">canonicalize()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-offset-symlink-hash-file-name-file-size-root-ptr-root-file-path-pad-file-at-mtime" id="toc-entry-321">file_offset() symlink() hash() file_name() file_size() root_ptr() root() file_path() pad_file_at() mtime()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-num-pieces-file-piece-range-file-num-blocks" id="toc-entry-322">file_num_pieces() file_piece_range() file_num_blocks()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-first-block-node-file-first-piece-node" id="toc-entry-323">file_first_block_node() file_first_piece_node()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-path-hash" id="toc-entry-324">file_path_hash()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#all-path-hashes" id="toc-entry-325">all_path_hashes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-flags" id="toc-entry-326">file_flags()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-absolute-path" id="toc-entry-327">file_absolute_path()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-index-at-piece-file-index-at-offset" id="toc-entry-328">file_index_at_piece() file_index_at_offset()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-index-for-root" id="toc-entry-329">file_index_for_root()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-index-at-file" id="toc-entry-330">piece_index_at_file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#sanitize-symlinks" id="toc-entry-331">sanitize_symlinks()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#v2" id="toc-entry-332">v2()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#state-changed-alert" id="toc-entry-241">state_changed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-error-alert" id="toc-entry-242">tracker_error_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#failure-reason" id="toc-entry-243">failure_reason()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#mmap-disk-io-constructor" id="toc-entry-333">mmap_disk_io_constructor()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#default-disk-io-constructor" id="toc-entry-334">default_disk_io_constructor()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#disabled-disk-io-constructor" id="toc-entry-335">disabled_disk_io_constructor()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#posix-disk-io-constructor" id="toc-entry-336">posix_disk_io_constructor()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-storage-mode-t" id="toc-entry-337">enum storage_mode_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-status-t" id="toc-entry-338">enum status_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-move-flags-t" id="toc-entry-339">enum move_flags_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-routing-bucket" id="toc-entry-340">dht_routing_bucket</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-alert" id="toc-entry-341">torrent_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#message" id="toc-entry-342">message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-warning-alert" id="toc-entry-244">tracker_warning_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#warning-message" id="toc-entry-245">warning_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-alert" id="toc-entry-343">peer_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-alert" id="toc-entry-344">tracker_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#tracker-url" id="toc-entry-345">tracker_url()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#scrape-reply-alert" id="toc-entry-246">scrape_reply_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#scrape-failed-alert" id="toc-entry-247">scrape_failed_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#error-message" id="toc-entry-248">error_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-removed-alert" id="toc-entry-346">torrent_removed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#read-piece-alert" id="toc-entry-347">read_piece_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-completed-alert" id="toc-entry-348">file_completed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-renamed-alert" id="toc-entry-349">file_renamed_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#new-name-old-name" id="toc-entry-350">new_name() old_name()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-reply-alert" id="toc-entry-249">tracker_reply_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-reply-alert" id="toc-entry-250">dht_reply_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-announce-alert" id="toc-entry-251">tracker_announce_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#hash-failed-alert" id="toc-entry-252">hash_failed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-ban-alert" id="toc-entry-253">peer_ban_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-unsnubbed-alert" id="toc-entry-254">peer_unsnubbed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-snubbed-alert" id="toc-entry-255">peer_snubbed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-error-alert" id="toc-entry-256">peer_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-connect-alert" id="toc-entry-257">peer_connect_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#enum-direction-t" id="toc-entry-258">enum direction_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-rename-failed-alert" id="toc-entry-351">file_rename_failed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#performance-alert" id="toc-entry-352">performance_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#enum-performance-warning-t" id="toc-entry-353">enum performance_warning_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-disconnected-alert" id="toc-entry-259">peer_disconnected_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#invalid-request-alert" id="toc-entry-260">invalid_request_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-finished-alert" id="toc-entry-261">torrent_finished_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-finished-alert" id="toc-entry-262">piece_finished_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#request-dropped-alert" id="toc-entry-263">request_dropped_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#block-timeout-alert" id="toc-entry-264">block_timeout_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#block-finished-alert" id="toc-entry-265">block_finished_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#block-downloading-alert" id="toc-entry-266">block_downloading_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#unwanted-block-alert" id="toc-entry-267">unwanted_block_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#storage-moved-alert" id="toc-entry-268">storage_moved_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#storage-path-old-path" id="toc-entry-269">storage_path() old_path()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#state-changed-alert" id="toc-entry-354">state_changed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-error-alert" id="toc-entry-355">tracker_error_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#failure-reason" id="toc-entry-356">failure_reason()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#storage-moved-failed-alert" id="toc-entry-270">storage_moved_failed_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#file-path" id="toc-entry-271">file_path()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-warning-alert" id="toc-entry-357">tracker_warning_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#warning-message" id="toc-entry-358">warning_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-deleted-alert" id="toc-entry-272">torrent_deleted_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-delete-failed-alert" id="toc-entry-273">torrent_delete_failed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#save-resume-data-alert" id="toc-entry-274">save_resume_data_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#save-resume-data-failed-alert" id="toc-entry-275">save_resume_data_failed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-paused-alert" id="toc-entry-276">torrent_paused_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-resumed-alert" id="toc-entry-277">torrent_resumed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-checked-alert" id="toc-entry-278">torrent_checked_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#url-seed-alert" id="toc-entry-279">url_seed_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#server-url" id="toc-entry-280">server_url()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#error-message-1" id="toc-entry-281">error_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#scrape-reply-alert" id="toc-entry-359">scrape_reply_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#scrape-failed-alert" id="toc-entry-360">scrape_failed_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#error-message" id="toc-entry-361">error_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#file-error-alert" id="toc-entry-282">file_error_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#filename" id="toc-entry-283">filename()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-reply-alert" id="toc-entry-362">tracker_reply_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-reply-alert" id="toc-entry-363">dht_reply_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-announce-alert" id="toc-entry-364">tracker_announce_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#hash-failed-alert" id="toc-entry-365">hash_failed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-ban-alert" id="toc-entry-366">peer_ban_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-unsnubbed-alert" id="toc-entry-367">peer_unsnubbed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-snubbed-alert" id="toc-entry-368">peer_snubbed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-error-alert" id="toc-entry-369">peer_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-connect-alert" id="toc-entry-370">peer_connect_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#enum-direction-t" id="toc-entry-371">enum direction_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#metadata-failed-alert" id="toc-entry-284">metadata_failed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#metadata-received-alert" id="toc-entry-285">metadata_received_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#udp-error-alert" id="toc-entry-286">udp_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#external-ip-alert" id="toc-entry-287">external_ip_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#listen-failed-alert" id="toc-entry-288">listen_failed_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#listen-interface" id="toc-entry-289">listen_interface()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-disconnected-alert" id="toc-entry-372">peer_disconnected_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#invalid-request-alert" id="toc-entry-373">invalid_request_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-finished-alert" id="toc-entry-374">torrent_finished_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-finished-alert" id="toc-entry-375">piece_finished_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#request-dropped-alert" id="toc-entry-376">request_dropped_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#block-timeout-alert" id="toc-entry-377">block_timeout_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#block-finished-alert" id="toc-entry-378">block_finished_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#block-downloading-alert" id="toc-entry-379">block_downloading_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#unwanted-block-alert" id="toc-entry-380">unwanted_block_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#storage-moved-alert" id="toc-entry-381">storage_moved_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#storage-path-old-path" id="toc-entry-382">storage_path() old_path()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#listen-succeeded-alert" id="toc-entry-290">listen_succeeded_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#portmap-error-alert" id="toc-entry-291">portmap_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#portmap-alert" id="toc-entry-292">portmap_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#portmap-log-alert" id="toc-entry-293">portmap_log_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#log-message" id="toc-entry-294">log_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#storage-moved-failed-alert" id="toc-entry-383">storage_moved_failed_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#file-path" id="toc-entry-384">file_path()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#fastresume-rejected-alert" id="toc-entry-295">fastresume_rejected_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#file-path-1" id="toc-entry-296">file_path()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-deleted-alert" id="toc-entry-385">torrent_deleted_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-delete-failed-alert" id="toc-entry-386">torrent_delete_failed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#save-resume-data-alert" id="toc-entry-387">save_resume_data_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#save-resume-data-failed-alert" id="toc-entry-388">save_resume_data_failed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-paused-alert" id="toc-entry-389">torrent_paused_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-resumed-alert" id="toc-entry-390">torrent_resumed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-checked-alert" id="toc-entry-391">torrent_checked_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#url-seed-alert" id="toc-entry-392">url_seed_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#server-url" id="toc-entry-393">server_url()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#error-message-1" id="toc-entry-394">error_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-blocked-alert" id="toc-entry-297">peer_blocked_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#enum-reason-t" id="toc-entry-298">enum reason_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-error-alert" id="toc-entry-395">file_error_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#filename" id="toc-entry-396">filename()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-announce-alert" id="toc-entry-299">dht_announce_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-get-peers-alert" id="toc-entry-300">dht_get_peers_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#cache-flushed-alert" id="toc-entry-301">cache_flushed_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#lsd-peer-alert" id="toc-entry-302">lsd_peer_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#trackerid-alert" id="toc-entry-303">trackerid_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#tracker-id" id="toc-entry-304">tracker_id()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#metadata-failed-alert" id="toc-entry-397">metadata_failed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#metadata-received-alert" id="toc-entry-398">metadata_received_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#udp-error-alert" id="toc-entry-399">udp_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#external-ip-alert" id="toc-entry-400">external_ip_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#listen-failed-alert" id="toc-entry-401">listen_failed_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#listen-interface" id="toc-entry-402">listen_interface()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-bootstrap-alert" id="toc-entry-305">dht_bootstrap_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-error-alert" id="toc-entry-306">torrent_error_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#filename-1" id="toc-entry-307">filename()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#listen-succeeded-alert" id="toc-entry-403">listen_succeeded_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#portmap-error-alert" id="toc-entry-404">portmap_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#portmap-alert" id="toc-entry-405">portmap_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#portmap-log-alert" id="toc-entry-406">portmap_log_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#log-message" id="toc-entry-407">log_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-need-cert-alert" id="toc-entry-308">torrent_need_cert_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#incoming-connection-alert" id="toc-entry-309">incoming_connection_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-torrent-alert" id="toc-entry-310">add_torrent_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#state-update-alert" id="toc-entry-311">state_update_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#session-stats-alert" id="toc-entry-312">session_stats_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#counters-1" id="toc-entry-313">counters()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#fastresume-rejected-alert" id="toc-entry-408">fastresume_rejected_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#file-path-1" id="toc-entry-409">file_path()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-error-alert" id="toc-entry-314">dht_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-immutable-item-alert" id="toc-entry-315">dht_immutable_item_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-mutable-item-alert" id="toc-entry-316">dht_mutable_item_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-put-alert" id="toc-entry-317">dht_put_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#i2p-alert" id="toc-entry-318">i2p_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-outgoing-get-peers-alert" id="toc-entry-319">dht_outgoing_get_peers_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#log-alert" id="toc-entry-320">log_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#log-message-1" id="toc-entry-321">log_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-blocked-alert" id="toc-entry-410">peer_blocked_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#enum-reason-t" id="toc-entry-411">enum reason_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-log-alert" id="toc-entry-322">torrent_log_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#log-message-2" id="toc-entry-323">log_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-announce-alert" id="toc-entry-412">dht_announce_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-get-peers-alert" id="toc-entry-413">dht_get_peers_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#cache-flushed-alert" id="toc-entry-414">cache_flushed_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#lsd-peer-alert" id="toc-entry-415">lsd_peer_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#trackerid-alert" id="toc-entry-416">trackerid_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#tracker-id" id="toc-entry-417">tracker_id()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-log-alert" id="toc-entry-324">peer_log_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#log-message-3" id="toc-entry-325">log_message()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-direction-t-1" id="toc-entry-326">enum direction_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-bootstrap-alert" id="toc-entry-418">dht_bootstrap_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-error-alert" id="toc-entry-419">torrent_error_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#filename-1" id="toc-entry-420">filename()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#lsd-error-alert" id="toc-entry-327">lsd_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-lookup" id="toc-entry-328">dht_lookup</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-stats-alert" id="toc-entry-329">dht_stats_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#incoming-request-alert" id="toc-entry-330">incoming_request_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-log-alert" id="toc-entry-331">dht_log_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#log-message-4" id="toc-entry-332">log_message()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-dht-module-t" id="toc-entry-333">enum dht_module_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-need-cert-alert" id="toc-entry-421">torrent_need_cert_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#incoming-connection-alert" id="toc-entry-422">incoming_connection_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#add-torrent-alert" id="toc-entry-423">add_torrent_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#state-update-alert" id="toc-entry-424">state_update_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-stats-alert" id="toc-entry-425">session_stats_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#counters-1" id="toc-entry-426">counters()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-pkt-alert" id="toc-entry-334">dht_pkt_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#pkt-buf" id="toc-entry-335">pkt_buf()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-direction-t-2" id="toc-entry-336">enum direction_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-error-alert" id="toc-entry-427">dht_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-immutable-item-alert" id="toc-entry-428">dht_immutable_item_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-mutable-item-alert" id="toc-entry-429">dht_mutable_item_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-put-alert" id="toc-entry-430">dht_put_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#i2p-alert" id="toc-entry-431">i2p_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-outgoing-get-peers-alert" id="toc-entry-432">dht_outgoing_get_peers_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#log-alert" id="toc-entry-433">log_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#log-message-1" id="toc-entry-434">log_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-get-peers-reply-alert" id="toc-entry-337">dht_get_peers_reply_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-direct-response-alert" id="toc-entry-338">dht_direct_response_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#picker-log-alert" id="toc-entry-339">picker_log_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#session-error-alert" id="toc-entry-340">session_error_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-live-nodes-alert" id="toc-entry-341">dht_live_nodes_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#num-nodes-nodes" id="toc-entry-342">num_nodes() nodes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-log-alert" id="toc-entry-435">torrent_log_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#log-message-2" id="toc-entry-436">log_message()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#session-stats-header-alert" id="toc-entry-343">session_stats_header_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-sample-infohashes-alert" id="toc-entry-344">dht_sample_infohashes_alert</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#samples-num-samples" id="toc-entry-345">samples() num_samples()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#num-nodes" id="toc-entry-346">num_nodes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#nodes-1" id="toc-entry-347">nodes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-log-alert" id="toc-entry-437">peer_log_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#log-message-3" id="toc-entry-438">log_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-direction-t-1" id="toc-entry-439">enum direction_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#block-uploaded-alert" id="toc-entry-348">block_uploaded_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#alerts-dropped-alert" id="toc-entry-349">alerts_dropped_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#socks5-alert" id="toc-entry-350">socks5_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-prio-alert" id="toc-entry-351">file_prio_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#oversized-file-alert" id="toc-entry-352">oversized_file_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-conflict-alert" id="toc-entry-353">torrent_conflict_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-info-alert" id="toc-entry-354">peer_info_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-progress-alert" id="toc-entry-355">file_progress_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-info-alert" id="toc-entry-356">piece_info_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-availability-alert" id="toc-entry-357">piece_availability_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tracker-list-alert" id="toc-entry-358">tracker_list_alert</a></li>
│ │ │ │ -<li><a class="reference internal" href="#alert-cast" id="toc-entry-359">alert_cast()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#operation-name" id="toc-entry-360">operation_name()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-operation-t" id="toc-entry-361">enum operation_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#alert-category-t" id="toc-entry-362">alert_category_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#int-1" id="toc-entry-363">int</a></li>
│ │ │ │ -<li><a class="reference internal" href="#storage-params" id="toc-entry-364">storage_params</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-slice" id="toc-entry-365">file_slice</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-storage" id="toc-entry-366">file_storage</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#is-valid-3" id="toc-entry-367">is_valid()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#reserve" id="toc-entry-368">reserve()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-file-add-file-borrow" id="toc-entry-369">add_file() add_file_borrow()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#rename-file-2" id="toc-entry-370">rename_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#map-block-1" id="toc-entry-371">map_block()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#map-file-1" id="toc-entry-372">map_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#num-files-1" id="toc-entry-373">num_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#end-file" id="toc-entry-374">end_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-range" id="toc-entry-375">file_range()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#total-size-1" id="toc-entry-376">total_size()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#num-pieces-set-num-pieces" id="toc-entry-377">num_pieces() set_num_pieces()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#end-piece" id="toc-entry-378">end_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#last-piece" id="toc-entry-379">last_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-range" id="toc-entry-380">piece_range()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-piece-length-piece-length" id="toc-entry-381">set_piece_length() piece_length()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-size-1" id="toc-entry-382">piece_size()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-size2" id="toc-entry-383">piece_size2()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#blocks-in-piece2" id="toc-entry-384">blocks_in_piece2()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#blocks-per-piece-1" id="toc-entry-385">blocks_per_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#name-set-name" id="toc-entry-386">name() set_name()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#swap-1" id="toc-entry-387">swap()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#canonicalize" id="toc-entry-388">canonicalize()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#root-mtime-symlink-file-offset-hash-pad-file-at-root-ptr-file-name-file-path-file-size" id="toc-entry-389">root() mtime() symlink() file_offset() hash() pad_file_at() root_ptr() file_name() file_path() file_size()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-piece-range-file-num-blocks-file-num-pieces" id="toc-entry-390">file_piece_range() file_num_blocks() file_num_pieces()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-first-piece-node-file-first-block-node" id="toc-entry-391">file_first_piece_node() file_first_block_node()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-path-hash" id="toc-entry-392">file_path_hash()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#all-path-hashes" id="toc-entry-393">all_path_hashes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-flags" id="toc-entry-394">file_flags()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-absolute-path" id="toc-entry-395">file_absolute_path()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-index-at-offset-file-index-at-piece" id="toc-entry-396">file_index_at_offset() file_index_at_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-index-for-root" id="toc-entry-397">file_index_for_root()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-index-at-file" id="toc-entry-398">piece_index_at_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#sanitize-symlinks" id="toc-entry-399">sanitize_symlinks()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#v2" id="toc-entry-400">v2()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#lsd-error-alert" id="toc-entry-440">lsd_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-lookup" id="toc-entry-441">dht_lookup</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-stats-alert" id="toc-entry-442">dht_stats_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#incoming-request-alert" id="toc-entry-443">incoming_request_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-log-alert" id="toc-entry-444">dht_log_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#log-message-4" id="toc-entry-445">log_message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-dht-module-t" id="toc-entry-446">enum dht_module_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#default-disk-io-constructor" id="toc-entry-401">default_disk_io_constructor()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#posix-disk-io-constructor" id="toc-entry-402">posix_disk_io_constructor()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#disabled-disk-io-constructor" id="toc-entry-403">disabled_disk_io_constructor()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#mmap-disk-io-constructor" id="toc-entry-404">mmap_disk_io_constructor()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-storage-mode-t" id="toc-entry-405">enum storage_mode_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-status-t" id="toc-entry-406">enum status_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-move-flags-t" id="toc-entry-407">enum move_flags_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#a-word-of-caution" id="toc-entry-408">a word of caution</a></li>
│ │ │ │ -<li><a class="reference internal" href="#plugin-interface" id="toc-entry-409">plugin-interface</a></li>
│ │ │ │ -<li><a class="reference internal" href="#custom-alerts" id="toc-entry-410">custom alerts</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-connection-handle" id="toc-entry-411">peer_connection_handle</a></li>
│ │ │ │ -<li><a class="reference internal" href="#bt-peer-connection-handle" id="toc-entry-412">bt_peer_connection_handle</a></li>
│ │ │ │ -<li><a class="reference internal" href="#plugin" id="toc-entry-413">plugin</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#implemented-features" id="toc-entry-414">implemented_features()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#new-torrent" id="toc-entry-415">new_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#added" id="toc-entry-416">added()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#abort-1" id="toc-entry-417">abort()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-dht-request" id="toc-entry-418">on_dht_request()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-alert" id="toc-entry-419">on_alert()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-unknown-torrent" id="toc-entry-420">on_unknown_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-tick" id="toc-entry-421">on_tick()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-unchoke-priority" id="toc-entry-422">get_unchoke_priority()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#load-state" id="toc-entry-423">load_state()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-pkt-alert" id="toc-entry-447">dht_pkt_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#pkt-buf" id="toc-entry-448">pkt_buf()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-direction-t-2" id="toc-entry-449">enum direction_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-plugin" id="toc-entry-424">torrent_plugin</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#new-connection" id="toc-entry-425">new_connection()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-piece-failed-on-piece-pass" id="toc-entry-426">on_piece_failed() on_piece_pass()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tick" id="toc-entry-427">tick()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-resume-on-pause" id="toc-entry-428">on_resume() on_pause()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-files-checked" id="toc-entry-429">on_files_checked()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-state" id="toc-entry-430">on_state()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-add-peer" id="toc-entry-431">on_add_peer()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-get-peers-reply-alert" id="toc-entry-450">dht_get_peers_reply_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-direct-response-alert" id="toc-entry-451">dht_direct_response_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#picker-log-alert" id="toc-entry-452">picker_log_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-error-alert" id="toc-entry-453">session_error_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-live-nodes-alert" id="toc-entry-454">dht_live_nodes_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#num-nodes-nodes" id="toc-entry-455">num_nodes() nodes()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-plugin" id="toc-entry-432">peer_plugin</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#type-1" id="toc-entry-433">type()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-handshake" id="toc-entry-434">add_handshake()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-disconnect" id="toc-entry-435">on_disconnect()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-connected" id="toc-entry-436">on_connected()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-handshake" id="toc-entry-437">on_handshake()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-extension-handshake" id="toc-entry-438">on_extension_handshake()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-choke-on-unchoke-on-have-all-on-have-none-on-bitfield-on-not-interested-on-request-on-have-on-dont-have-on-interested-on-allowed-fast" id="toc-entry-439">on_choke() on_unchoke() on_have_all() on_have_none() on_bitfield() on_not_interested() on_request() on_have() on_dont_have() on_interested() on_allowed_fast()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-piece" id="toc-entry-440">on_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#sent-interested-sent-have-sent-not-interested-sent-piece-sent-unchoke" id="toc-entry-441">sent_interested() sent_have() sent_not_interested() sent_piece() sent_unchoke()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#sent-payload" id="toc-entry-442">sent_payload()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#can-disconnect" id="toc-entry-443">can_disconnect()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-extended" id="toc-entry-444">on_extended()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-unknown-message" id="toc-entry-445">on_unknown_message()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#on-piece-failed-on-piece-pass-1" id="toc-entry-446">on_piece_failed() on_piece_pass()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tick-1" id="toc-entry-447">tick()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#write-request" id="toc-entry-448">write_request()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#session-stats-header-alert" id="toc-entry-456">session_stats_header_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-sample-infohashes-alert" id="toc-entry-457">dht_sample_infohashes_alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#samples-num-samples" id="toc-entry-458">samples() num_samples()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#num-nodes" id="toc-entry-459">num_nodes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#nodes-1" id="toc-entry-460">nodes()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#crypto-plugin" id="toc-entry-449">crypto_plugin</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#decrypt" id="toc-entry-450">decrypt()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#block-uploaded-alert" id="toc-entry-461">block_uploaded_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#alerts-dropped-alert" id="toc-entry-462">alerts_dropped_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#socks5-alert" id="toc-entry-463">socks5_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-prio-alert" id="toc-entry-464">file_prio_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#oversized-file-alert" id="toc-entry-465">oversized_file_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-conflict-alert" id="toc-entry-466">torrent_conflict_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-info-alert" id="toc-entry-467">peer_info_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file-progress-alert" id="toc-entry-468">file_progress_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-info-alert" id="toc-entry-469">piece_info_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-availability-alert" id="toc-entry-470">piece_availability_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tracker-list-alert" id="toc-entry-471">tracker_list_alert</a></li>
│ │ │ │ +<li><a class="reference internal" href="#alert" id="toc-entry-472">alert</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#timestamp" id="toc-entry-473">timestamp()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#type-1" id="toc-entry-474">type()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#what" id="toc-entry-475">what()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#message-1" id="toc-entry-476">message()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#category" id="toc-entry-477">category()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#create-smart-ban-plugin" id="toc-entry-451">create_smart_ban_plugin()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#create-ut-pex-plugin" id="toc-entry-452">create_ut_pex_plugin()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#create-ut-metadata-plugin" id="toc-entry-453">create_ut_metadata_plugin()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#torrent-status" id="toc-entry-454">torrent_status</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#operator-3" id="toc-entry-455">operator==()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-state-t" id="toc-entry-456">enum state_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#alert-cast" id="toc-entry-478">alert_cast()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operation-name" id="toc-entry-479">operation_name()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-operation-t" id="toc-entry-480">enum operation_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#int" id="toc-entry-481">int</a></li>
│ │ │ │ +<li><a class="reference internal" href="#alert-category-t" id="toc-entry-482">alert_category_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#hasher" id="toc-entry-483">hasher</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#operator-hasher" id="toc-entry-484">operator=() hasher()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#update" id="toc-entry-485">update()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#final" id="toc-entry-486">final()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#reset-1" id="toc-entry-487">reset()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#peer-class-info" id="toc-entry-457">peer_class_info</a></li>
│ │ │ │ -<li><a class="reference internal" href="#peer-class-type-filter" id="toc-entry-458">peer_class_type_filter</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#remove-add" id="toc-entry-459">remove() add()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#disallow-allow" id="toc-entry-460">disallow() allow()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#apply" id="toc-entry-461">apply()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-socket-type-t-1" id="toc-entry-462">enum socket_type_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#hasher256" id="toc-entry-488">hasher256</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#operator-hasher256" id="toc-entry-489">operator=() hasher256()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#update-1" id="toc-entry-490">update()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#final-1" id="toc-entry-491">final()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#reset-2" id="toc-entry-492">reset()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#disk-observer" id="toc-entry-463">disk_observer</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#on-disk" id="toc-entry-464">on_disk()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bitfield" id="toc-entry-493">bitfield</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#bitfield-1" id="toc-entry-494">bitfield()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#assign" id="toc-entry-495">assign()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-get-bit" id="toc-entry-496">operator[]() get_bit()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#set-bit-clear-bit" id="toc-entry-497">set_bit() clear_bit()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#all-set" id="toc-entry-498">all_set()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#none-set" id="toc-entry-499">none_set()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#size" id="toc-entry-500">size()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#num-words" id="toc-entry-501">num_words()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#num-bytes" id="toc-entry-502">num_bytes()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#empty-1" id="toc-entry-503">empty()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#data-1" id="toc-entry-504">data()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#swap-2" id="toc-entry-505">swap()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#count" id="toc-entry-506">count()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#find-first-set" id="toc-entry-507">find_first_set()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#find-last-clear" id="toc-entry-508">find_last_clear()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#open-file-state" id="toc-entry-465">open_file_state</a></li>
│ │ │ │ -<li><a class="reference internal" href="#disk-interface" id="toc-entry-466">disk_interface</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#new-torrent-1" id="toc-entry-467">new_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#remove-torrent-1" id="toc-entry-468">remove_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-read-async-write" id="toc-entry-469">async_read() async_write()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-hash" id="toc-entry-470">async_hash()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-hash2" id="toc-entry-471">async_hash2()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-move-storage" id="toc-entry-472">async_move_storage()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-release-files" id="toc-entry-473">async_release_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-check-files" id="toc-entry-474">async_check_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-stop-torrent" id="toc-entry-475">async_stop_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-rename-file" id="toc-entry-476">async_rename_file()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-delete-files" id="toc-entry-477">async_delete_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-set-file-priority" id="toc-entry-478">async_set_file_priority()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#async-clear-piece" id="toc-entry-479">async_clear_piece()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#update-stats-counters" id="toc-entry-480">update_stats_counters()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-status" id="toc-entry-481">get_status()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#abort-2" id="toc-entry-482">abort()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#submit-jobs" id="toc-entry-483">submit_jobs()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#settings-updated" id="toc-entry-484">settings_updated()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-request" id="toc-entry-509">peer_request</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#operator-2" id="toc-entry-510">operator==()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#storage-holder" id="toc-entry-485">storage_holder</a></li>
│ │ │ │ -<li><a class="reference internal" href="#settings-interface" id="toc-entry-486">settings_interface</a></li>
│ │ │ │ -<li><a class="reference internal" href="#buffer-allocator-interface" id="toc-entry-487">buffer_allocator_interface</a></li>
│ │ │ │ -<li><a class="reference internal" href="#disk-buffer-holder" id="toc-entry-488">disk_buffer_holder</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#disk-buffer-holder-1" id="toc-entry-489">disk_buffer_holder()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#disk-buffer-holder-2" id="toc-entry-490">disk_buffer_holder()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#disk-buffer-holder-3" id="toc-entry-491">~disk_buffer_holder()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#data-1" id="toc-entry-492">data()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#reset-2" id="toc-entry-493">reset()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#swap-2" id="toc-entry-494">swap()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#is-mutable" id="toc-entry-495">is_mutable()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#bool" id="toc-entry-496">bool()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#piece-block" id="toc-entry-511">piece_block</a></li>
│ │ │ │ +<li><a class="reference internal" href="#peer-info" id="toc-entry-512">peer_info</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#i2p-destination" id="toc-entry-513">i2p_destination()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#file-open-mode-t" id="toc-entry-497">file_open_mode_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#settings-pack" id="toc-entry-498">settings_pack</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#set-bool-set-int-set-str" id="toc-entry-499">set_bool() set_int() set_str()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#has-val" id="toc-entry-500">has_val()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#clear" id="toc-entry-501">clear()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#clear-1" id="toc-entry-502">clear()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-str-get-bool-get-int" id="toc-entry-503">get_str() get_bool() get_int()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-type-bases" id="toc-entry-504">enum type_bases</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-mmap-write-mode-t" id="toc-entry-505">enum mmap_write_mode_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-suggest-mode-t" id="toc-entry-506">enum suggest_mode_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-choking-algorithm-t" id="toc-entry-507">enum choking_algorithm_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-seed-choking-algorithm-t" id="toc-entry-508">enum seed_choking_algorithm_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-io-buffer-mode-t" id="toc-entry-509">enum io_buffer_mode_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-bandwidth-mixed-algo-t" id="toc-entry-510">enum bandwidth_mixed_algo_t</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-enc-policy" id="toc-entry-511">enum enc_policy</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-enc-level" id="toc-entry-512">enum enc_level</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-proxy-type-t" id="toc-entry-513">enum proxy_type_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#info-hash-t" id="toc-entry-514">info_hash_t</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#info-hash-t-1" id="toc-entry-515">info_hash_t()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#has-v2-has-v1-has" id="toc-entry-516">has_v2() has_v1() has()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get" id="toc-entry-517">get()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-best" id="toc-entry-518">get_best()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#for-each" id="toc-entry-519">for_each()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#min-memory-usage-high-performance-seed" id="toc-entry-514">min_memory_usage() high_performance_seed()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#generate-fingerprint" id="toc-entry-515">generate_fingerprint()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#name-for-setting-setting-by-name" id="toc-entry-516">name_for_setting() setting_by_name()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#default-settings" id="toc-entry-517">default_settings()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#storage-error" id="toc-entry-518">storage_error</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#bool-1" id="toc-entry-519">bool()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file" id="toc-entry-520">file()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#load-torrent-parsed-load-torrent-file-load-torrent-buffer" id="toc-entry-520">load_torrent_parsed() load_torrent_file() load_torrent_buffer()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#truncate-files" id="toc-entry-521">truncate_files()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#make-magnet-uri" id="toc-entry-522">make_magnet_uri()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#parse-magnet-uri" id="toc-entry-523">parse_magnet_uri()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-peer-equal" id="toc-entry-524">torrent_peer_equal()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#version" id="toc-entry-525">version()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-event-t" id="toc-entry-526">enum event_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-portmap-transport" id="toc-entry-527">enum portmap_transport</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-portmap-protocol" id="toc-entry-528">enum portmap_protocol</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-protocol-version" id="toc-entry-529">enum protocol_version</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-socket-type-t-1" id="toc-entry-530">enum socket_type_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-connection-type" id="toc-entry-531">enum connection_type</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-flags-t" id="toc-entry-532">torrent_flags_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#int-1" id="toc-entry-533">int</a></li>
│ │ │ │ +<li><a class="reference internal" href="#pex-flags-t" id="toc-entry-534">pex_flags_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#char-const" id="toc-entry-535">char const*</a></li>
│ │ │ │ +<li><a class="reference internal" href="#std-uint64-t" id="toc-entry-536">std::uint64_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#download-priority-t" id="toc-entry-537">download_priority_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bdecode-node" id="toc-entry-538">bdecode_node</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#bdecode-node-1" id="toc-entry-539">bdecode_node()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bdecode-node-operator" id="toc-entry-540">bdecode_node() operator=()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#type-2" id="toc-entry-541">type()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bool-1" id="toc-entry-542">bool()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#non-owning" id="toc-entry-543">non_owning()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#data-section-data-offset" id="toc-entry-544">data_section() data_offset()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#list-size-list-at-list-string-value-at-list-int-value-at" id="toc-entry-545">list_size() list_at() list_string_value_at() list_int_value_at()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dict-at-node-dict-find-int-dict-find-int-value-dict-find-list-dict-find-dict-at-dict-size-dict-find-string-dict-find-string-value-dict-find-dict" id="toc-entry-546">dict_at_node() dict_find_int() dict_find_int_value() dict_find_list() dict_find() dict_at() dict_size() dict_find_string() dict_find_string_value() dict_find_dict()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#int-value" id="toc-entry-547">int_value()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#string-offset-string-ptr-string-value-string-length" id="toc-entry-548">string_offset() string_ptr() string_value() string_length()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#clear-2" id="toc-entry-549">clear()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#swap-3" id="toc-entry-550">swap()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#reserve-1" id="toc-entry-551">reserve()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#switch-underlying-buffer" id="toc-entry-552">switch_underlying_buffer()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#has-soft-error" id="toc-entry-553">has_soft_error()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-type-t-1" id="toc-entry-554">enum type_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#libtorrent-category" id="toc-entry-521">libtorrent_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#http-category" id="toc-entry-522">http_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#i2p-category" id="toc-entry-523">i2p_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#bdecode-category" id="toc-entry-524">bdecode_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#pcp-category" id="toc-entry-525">pcp_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#socks-category" id="toc-entry-526">socks_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#gzip-category" id="toc-entry-527">gzip_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#upnp-category" id="toc-entry-528">upnp_category()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-error-code-enum" id="toc-entry-529">enum error_code_enum</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-http-errors" id="toc-entry-530">enum http_errors</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-i2p-error-code" id="toc-entry-531">enum i2p_error_code</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-error-code-enum-1" id="toc-entry-532">enum error_code_enum</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-pcp-errors" id="toc-entry-533">enum pcp_errors</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-socks-error-code" id="toc-entry-534">enum socks_error_code</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-error-code-enum-2" id="toc-entry-535">enum error_code_enum</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-error-code-enum-3" id="toc-entry-536">enum error_code_enum</a></li>
│ │ │ │ -<li><a class="reference internal" href="#bdecode-node" id="toc-entry-537">bdecode_node</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#bdecode-node-1" id="toc-entry-538">bdecode_node()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#operator-bdecode-node" id="toc-entry-539">operator=() bdecode_node()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#type-2" id="toc-entry-540">type()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#bool-2" id="toc-entry-541">bool()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#non-owning" id="toc-entry-542">non_owning()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#data-section-data-offset" id="toc-entry-543">data_section() data_offset()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#list-string-value-at-list-int-value-at-list-size-list-at" id="toc-entry-544">list_string_value_at() list_int_value_at() list_size() list_at()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dict-find-int-dict-size-dict-at-node-dict-at-dict-find-string-dict-find-string-value-dict-find-dict-find-int-value-dict-find-list-dict-find-dict" id="toc-entry-545">dict_find_int() dict_size() dict_at_node() dict_at() dict_find_string() dict_find_string_value() dict_find() dict_find_int_value() dict_find_list() dict_find_dict()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#int-value" id="toc-entry-546">int_value()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#string-value-string-offset-string-length-string-ptr" id="toc-entry-547">string_value() string_offset() string_length() string_ptr()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#clear-2" id="toc-entry-548">clear()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#swap-3" id="toc-entry-549">swap()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#reserve-1" id="toc-entry-550">reserve()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#switch-underlying-buffer" id="toc-entry-551">switch_underlying_buffer()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#has-soft-error" id="toc-entry-552">has_soft_error()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-type-t-1" id="toc-entry-553">enum type_t</a></li>
│ │ │ │ +<li><a class="reference internal" href="#print-entry" id="toc-entry-555">print_entry()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bdecode" id="toc-entry-556">bdecode()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#torrent-status" id="toc-entry-557">torrent_status</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#operator-3" id="toc-entry-558">operator==()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-state-t" id="toc-entry-559">enum state_t</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#print-entry" id="toc-entry-554">print_entry()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#bdecode" id="toc-entry-555">bdecode()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#entry" id="toc-entry-556">entry</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#type-3" id="toc-entry-557">type()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#entry-1" id="toc-entry-558">entry()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#entry-2" id="toc-entry-559">entry()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#entry-3" id="toc-entry-560">entry()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#operator-4" id="toc-entry-561">operator=()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#preformatted-dict-list-string-integer" id="toc-entry-562">preformatted() dict() list() string() integer()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#swap-4" id="toc-entry-563">swap()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#operator-5" id="toc-entry-564">operator[]()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#find-key" id="toc-entry-565">find_key()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#to-string" id="toc-entry-566">to_string()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#enum-data-type" id="toc-entry-567">enum data_type</a></li>
│ │ │ │ +<li><a class="reference internal" href="#entry" id="toc-entry-560">entry</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#type-3" id="toc-entry-561">type()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#entry-1" id="toc-entry-562">entry()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#entry-2" id="toc-entry-563">entry()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#entry-3" id="toc-entry-564">entry()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-4" id="toc-entry-565">operator=()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#string-preformatted-list-integer-dict" id="toc-entry-566">string() preformatted() list() integer() dict()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#swap-4" id="toc-entry-567">swap()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-5" id="toc-entry-568">operator[]()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#find-key" id="toc-entry-569">find_key()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#to-string" id="toc-entry-570">to_string()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-data-type" id="toc-entry-571">enum data_type</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#bencode" id="toc-entry-568">bencode()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#operator-6" id="toc-entry-569">operator&lt;&lt;()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#create-torrent" id="toc-entry-570">create_torrent</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#create-torrent-1" id="toc-entry-571">create_torrent()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#generate-generate-buf" id="toc-entry-572">generate() generate_buf()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#files" id="toc-entry-573">files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-comment" id="toc-entry-574">set_comment()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-creator" id="toc-entry-575">set_creator()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-creation-date" id="toc-entry-576">set_creation_date()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-hash" id="toc-entry-577">set_hash()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-hash2" id="toc-entry-578">set_hash2()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-http-seed-add-url-seed" id="toc-entry-579">add_http_seed() add_url_seed()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-node-1" id="toc-entry-580">add_node()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-tracker" id="toc-entry-581">add_tracker()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-root-cert" id="toc-entry-582">set_root_cert()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-priv-priv" id="toc-entry-583">set_priv() priv()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#num-pieces" id="toc-entry-584">num_pieces()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-range-1" id="toc-entry-585">piece_range()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-range-1" id="toc-entry-586">file_range()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#file-piece-range" id="toc-entry-587">file_piece_range()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#total-size-2" id="toc-entry-588">total_size()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#piece-length-piece-size" id="toc-entry-589">piece_length() piece_size()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#add-similar-torrent-add-collection" id="toc-entry-590">add_similar_torrent() add_collection()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bencode" id="toc-entry-572">bencode()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#operator-6" id="toc-entry-573">operator&lt;&lt;()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#storage-error" id="toc-entry-574">storage_error</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#bool-2" id="toc-entry-575">bool()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#file" id="toc-entry-576">file()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#add-files" id="toc-entry-591">add_files()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#set-piece-hashes" id="toc-entry-592">set_piece_hashes()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#dht-storage-counters" id="toc-entry-593">dht_storage_counters</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#reset-3" id="toc-entry-594">reset()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#gzip-category" id="toc-entry-577">gzip_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#upnp-category" id="toc-entry-578">upnp_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#bdecode-category" id="toc-entry-579">bdecode_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#pcp-category" id="toc-entry-580">pcp_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#i2p-category" id="toc-entry-581">i2p_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#libtorrent-category" id="toc-entry-582">libtorrent_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#http-category" id="toc-entry-583">http_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#socks-category" id="toc-entry-584">socks_category()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-error-code-enum" id="toc-entry-585">enum error_code_enum</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-error-code-enum-1" id="toc-entry-586">enum error_code_enum</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-error-code-enum-2" id="toc-entry-587">enum error_code_enum</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-pcp-errors" id="toc-entry-588">enum pcp_errors</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-i2p-error-code" id="toc-entry-589">enum i2p_error_code</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-error-code-enum-3" id="toc-entry-590">enum error_code_enum</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-http-errors" id="toc-entry-591">enum http_errors</a></li>
│ │ │ │ +<li><a class="reference internal" href="#enum-socks-error-code" id="toc-entry-592">enum socks_error_code</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-state" id="toc-entry-593">dht_state</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-storage-counters" id="toc-entry-594">dht_storage_counters</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#reset-3" id="toc-entry-595">reset()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-storage-interface" id="toc-entry-595">dht_storage_interface</a><ul>
│ │ │ │ -<li><a class="reference internal" href="#update-node-ids" id="toc-entry-596">update_node_ids()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-peers" id="toc-entry-597">get_peers()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#announce-peer" id="toc-entry-598">announce_peer()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-immutable-item" id="toc-entry-599">get_immutable_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#put-immutable-item" id="toc-entry-600">put_immutable_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-mutable-item-seq" id="toc-entry-601">get_mutable_item_seq()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-mutable-item" id="toc-entry-602">get_mutable_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#put-mutable-item" id="toc-entry-603">put_mutable_item()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#get-infohashes-sample" id="toc-entry-604">get_infohashes_sample()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#tick-2" id="toc-entry-605">tick()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#counters-2" id="toc-entry-606">counters()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#dht-storage-interface" id="toc-entry-596">dht_storage_interface</a><ul>
│ │ │ │ +<li><a class="reference internal" href="#update-node-ids" id="toc-entry-597">update_node_ids()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-peers" id="toc-entry-598">get_peers()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#announce-peer" id="toc-entry-599">announce_peer()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-immutable-item" id="toc-entry-600">get_immutable_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#put-immutable-item" id="toc-entry-601">put_immutable_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-mutable-item-seq" id="toc-entry-602">get_mutable_item_seq()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-mutable-item" id="toc-entry-603">get_mutable_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#put-mutable-item" id="toc-entry-604">put_mutable_item()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#get-infohashes-sample" id="toc-entry-605">get_infohashes_sample()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#tick-2" id="toc-entry-606">tick()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#counters-2" id="toc-entry-607">counters()</a></li>
│ │ │ │  </ul>
│ │ │ │  </li>
│ │ │ │ -<li><a class="reference internal" href="#dht-state" id="toc-entry-607">dht_state</a></li>
│ │ │ │  <li><a class="reference internal" href="#dht-default-storage-constructor" id="toc-entry-608">dht_default_storage_constructor()</a></li>
│ │ │ │  <li><a class="reference internal" href="#sign-mutable-item" id="toc-entry-609">sign_mutable_item()</a></li>
│ │ │ │  <li><a class="reference internal" href="#announce-flags-t" id="toc-entry-610">announce_flags_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#read-resume-data" id="toc-entry-611">read_resume_data()</a></li>
│ │ │ │ -<li><a class="reference internal" href="#write-resume-data-buf-write-resume-data" id="toc-entry-612">write_resume_data_buf() write_resume_data()</a></li>
│ │ │ │ +<li><a class="reference internal" href="#write-resume-data-write-resume-data-buf" id="toc-entry-612">write_resume_data() write_resume_data_buf()</a></li>
│ │ │ │  <li><a class="reference internal" href="#write-torrent-file-buf-write-torrent-file" id="toc-entry-613">write_torrent_file_buf() write_torrent_file()</a></li>
│ │ │ │  <li><a class="reference internal" href="#write-torrent-flags-t" id="toc-entry-614">write_torrent_flags_t</a></li>
│ │ │ │  <li><a class="reference internal" href="#ed25519-create-seed" id="toc-entry-615">ed25519_create_seed()</a></li>
│ │ │ │  <li><a class="reference internal" href="#ed25519-create-keypair" id="toc-entry-616">ed25519_create_keypair()</a></li>
│ │ │ │  <li><a class="reference internal" href="#ed25519-sign" id="toc-entry-617">ed25519_sign()</a></li>
│ │ │ │  <li><a class="reference internal" href="#ed25519-verify" id="toc-entry-618">ed25519_verify()</a></li>
│ │ │ │  <li><a class="reference internal" href="#ed25519-add-scalar" id="toc-entry-619">ed25519_add_scalar()</a></li>
│ │ │ │  <li><a class="reference internal" href="#ed25519-key-exchange" id="toc-entry-620">ed25519_key_exchange()</a></li>
│ │ │ │  </ul>
│ │ │ │  </div>
│ │ │ │ -<a name="piece_block"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_block&labels=documentation&body=Documentation+under+heading+%22class+piece_block%22+could+be+improved">report issue</a>]</span><div class="section" id="piece-block">
│ │ │ │ -<h1>piece_block</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/piece_block.hpp">libtorrent/piece_block.hpp</a>&quot;</p>
│ │ │ │ +<p>libtorrent has a <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> interface for implementing extensions to the protocol.
│ │ │ │ +These can be general extensions for transferring metadata or peer exchange
│ │ │ │ +extensions, or it could be used to provide a way to customize the protocol
│ │ │ │ +to fit a particular (closed) network.</p>
│ │ │ │ +<p>In short, the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> interface makes it possible to:</p>
│ │ │ │ +<ul class="simple">
│ │ │ │ +<li>register extension messages (sent in the extension handshake), see
│ │ │ │ +<a class="reference external" href="manual-ref.html#extensions">extensions</a>.</li>
│ │ │ │ +<li>add data and parse data from the extension handshake.</li>
│ │ │ │ +<li>send extension messages and standard bittorrent messages.</li>
│ │ │ │ +<li>override or block the handling of standard bittorrent messages.</li>
│ │ │ │ +<li>save and restore state via the <a class="reference external" href="reference-Session.html#session">session</a> state</li>
│ │ │ │ +<li>see all alerts that are posted</li>
│ │ │ │ +</ul>
│ │ │ │ +<div class="section" id="a-word-of-caution">
│ │ │ │ +<h1>a word of caution</h1>
│ │ │ │ +<p>Writing your own <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> is a very easy way to introduce serious bugs such as
│ │ │ │ +dead locks and race conditions. Since a <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> has access to internal
│ │ │ │ +structures it is also quite easy to sabotage libtorrent's operation.</p>
│ │ │ │ +<p>All the callbacks are always called from the libtorrent network thread. In
│ │ │ │ +case portions of your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> are called from other threads, typically the main
│ │ │ │ +thread, you cannot use any of the member functions on the internal structures
│ │ │ │ +in libtorrent, since those require being called from the libtorrent network
│ │ │ │ +thread . Furthermore, you also need to synchronize your own shared data
│ │ │ │ +within the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a>, to make sure it is not accessed at the same time from the
│ │ │ │ +libtorrent thread (through a callback). If you need to send out a message
│ │ │ │ +from another thread, it is advised to use an internal queue, and do the
│ │ │ │ +actual sending in <tt class="docutils literal">tick()</tt>.</p>
│ │ │ │ +<p>Since the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> interface gives you easy access to internal structures, it
│ │ │ │ +is not supported as a stable API. Plugins should be considered specific to a
│ │ │ │ +specific version of libtorrent. Although, in practice the internals mostly
│ │ │ │ +don't change that dramatically.</p>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="plugin-interface">
│ │ │ │ +<h1>plugin-interface</h1>
│ │ │ │ +<p>The <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> interface consists of three base classes that the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> may
│ │ │ │ +implement. These are called <a class="reference external" href="reference-Plugins.html#plugin">plugin</a>, <a class="reference external" href="reference-Plugins.html#torrent_plugin">torrent_plugin</a> and <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a>.
│ │ │ │ +They are found in the <tt class="docutils literal">&lt;libtorrent/extensions.hpp&gt;</tt> header.</p>
│ │ │ │ +<p>These plugins are instantiated for each <a class="reference external" href="reference-Session.html#session">session</a>, torrent and possibly each peer,
│ │ │ │ +respectively.</p>
│ │ │ │ +<p>For plugins that only need per torrent state, it is enough to only implement
│ │ │ │ +<tt class="docutils literal">torrent_plugin</tt> and pass a constructor function or function object to
│ │ │ │ +<tt class="docutils literal"><span class="pre">session::add_extension()</span></tt> or <tt class="docutils literal"><span class="pre">torrent_handle::add_extension()</span></tt> (if the
│ │ │ │ +torrent has already been started and you want to hook in the extension at
│ │ │ │ +run-time).</p>
│ │ │ │ +<p>The signature of the function is:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="name">torrent_plugin</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="operator">*</span><span class="punctuation">)(</span><span class="name">torrent_handle</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">client_data_t</span><span class="punctuation">);</span>
│ │ │ │ +</pre>
│ │ │ │ +<p>The second argument is the userdata passed to <tt class="docutils literal"><span class="pre">session::add_torrent()</span></tt> or
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_handle::add_extension()</span></tt>.</p>
│ │ │ │ +<p>The function should return a <tt class="docutils literal"><span class="pre">std::shared_ptr&lt;torrent_plugin&gt;</span></tt> which
│ │ │ │ +may or may not be 0. If it is a nullptr, the extension is simply ignored
│ │ │ │ +for this torrent. If it is a valid pointer (to a class inheriting
│ │ │ │ +<tt class="docutils literal">torrent_plugin</tt>), it will be associated with this torrent and callbacks
│ │ │ │ +will be made on torrent events.</p>
│ │ │ │ +<p>For more elaborate plugins which require <a class="reference external" href="reference-Session.html#session">session</a> wide state, you would
│ │ │ │ +implement <tt class="docutils literal">plugin</tt>, construct an object (in a <tt class="docutils literal"><span class="pre">std::shared_ptr</span></tt>) and pass
│ │ │ │ +it in to <tt class="docutils literal"><span class="pre">session::add_extension()</span></tt>.</p>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="custom-alerts">
│ │ │ │ +<h1>custom alerts</h1>
│ │ │ │ +<p>Since plugins are running within internal libtorrent threads, one convenient
│ │ │ │ +way to communicate with the client is to post custom alerts.</p>
│ │ │ │ +<p>The expected interface of any <a class="reference external" href="reference-Alerts.html#alert">alert</a>, apart from deriving from the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +base class, looks like this:</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct piece_block
│ │ │ │ -{
│ │ │ │ -   <strong>piece_block</strong> () = default;
│ │ │ │ -   <strong>piece_block</strong> (piece_index_t p_index, int b_index);
│ │ │ │ -   bool <strong>operator&lt;</strong> (piece_block const&amp; b) const;
│ │ │ │ -   bool <strong>operator==</strong> (piece_block const&amp; b) const;
│ │ │ │ -   bool <strong>operator!=</strong> (piece_block const&amp; b) const;
│ │ │ │ +static const int alert_type = <em>&lt;unique alert ID&gt;</em>;
│ │ │ │ +virtual int type() const { return alert_type; }
│ │ │ │  
│ │ │ │ -   static const piece_block invalid;
│ │ │ │ -   piece_index_t piece_index {0};
│ │ │ │ -   int <strong>block_index</strong>  = 0;
│ │ │ │ +virtual std::string message() const;
│ │ │ │ +
│ │ │ │ +static const alert_category_t static_category = <em>&lt;bitmask of alert::category_t flags&gt;</em>;
│ │ │ │ +virtual alert_category_t category() const { return static_category; }
│ │ │ │ +
│ │ │ │ +virtual char const* what() const { return <em>&lt;string literal of the name of this alert&gt;</em>; }
│ │ │ │ +</pre>
│ │ │ │ +<p>The <tt class="docutils literal">alert_type</tt> is used for the type-checking in <tt class="docutils literal">alert_cast</tt>. It must
│ │ │ │ +not collide with any other <a class="reference external" href="reference-Alerts.html#alert">alert</a>. The built-in alerts in libtorrent will
│ │ │ │ +not use <a class="reference external" href="reference-Alerts.html#alert">alert</a> type IDs greater than <tt class="docutils literal">user_alert_id</tt>. When defining your
│ │ │ │ +own <a class="reference external" href="reference-Alerts.html#alert">alert</a>, make sure it's greater than this constant.</p>
│ │ │ │ +<p><tt class="docutils literal">type()</tt> is the run-time equivalence of the <tt class="docutils literal">alert_type</tt>.</p>
│ │ │ │ +<p>The <tt class="docutils literal">message()</tt> virtual function is expected to construct a useful
│ │ │ │ +string representation of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> and the event or data it represents.
│ │ │ │ +Something convenient to put in a log file for instance.</p>
│ │ │ │ +<p><tt class="docutils literal">clone()</tt> is used internally to copy alerts. The suggested implementation
│ │ │ │ +of simply allocating a new instance as a copy of <tt class="docutils literal">*this</tt> is all that's
│ │ │ │ +expected.</p>
│ │ │ │ +<p>The static category is required for checking whether or not the category
│ │ │ │ +for a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> is enabled or not, without instantiating the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.
│ │ │ │ +The <tt class="docutils literal">category</tt> virtual function is the run-time equivalence.</p>
│ │ │ │ +<p>The <tt class="docutils literal">what()</tt> virtual function may simply be a string literal of the class
│ │ │ │ +name of your <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ +<p>For more information, see the <a class="reference external" href="reference-Alerts.html">alert section</a>.</p>
│ │ │ │ +<a name="peer_connection_handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_connection_handle&labels=documentation&body=Documentation+under+heading+%22class+peer_connection_handle%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="peer-connection-handle">
│ │ │ │ +<h1>peer_connection_handle</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_connection_handle.hpp">libtorrent/peer_connection_handle.hpp</a>&quot;</p>
│ │ │ │ +<p>the <a class="reference external" href="reference-Plugins.html#peer_connection_handle">peer_connection_handle</a> class provides a handle to the internal peer
│ │ │ │ +connection object, to be used by plugins. This is a low level interface that
│ │ │ │ +may not be stable across libtorrent versions</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_connection_handle
│ │ │ │ +{
│ │ │ │ +   explicit <strong>peer_connection_handle</strong> (std::weak_ptr&lt;peer_connection&gt; impl);
│ │ │ │ +   connection_type <strong>type</strong> () const;
│ │ │ │ +   void <strong>add_extension</strong> (std::shared_ptr&lt;peer_plugin&gt;);
│ │ │ │ +   peer_plugin const* <strong>find_plugin</strong> (string_view type) const;
│ │ │ │ +   bool <strong>is_seed</strong> () const;
│ │ │ │ +   bool <strong>upload_only</strong> () const;
│ │ │ │ +   bool <strong>has_piece</strong> (piece_index_t i) const;
│ │ │ │ +   peer_id const&amp; <strong>pid</strong> () const;
│ │ │ │ +   bool <strong>is_choked</strong> () const;
│ │ │ │ +   bool <strong>is_interesting</strong> () const;
│ │ │ │ +   bool <strong>is_peer_interested</strong> () const;
│ │ │ │ +   bool <strong>has_peer_choked</strong> () const;
│ │ │ │ +   void <strong>maybe_unchoke_this_peer</strong> ();
│ │ │ │ +   void <strong>choke_this_peer</strong> ();
│ │ │ │ +   void <strong>get_peer_info</strong> (peer_info&amp; p) const;
│ │ │ │ +   torrent_handle <strong>associated_torrent</strong> () const;
│ │ │ │ +   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>local_endpoint</strong> () const;
│ │ │ │ +   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> const&amp; <strong>remote</strong> () const;
│ │ │ │ +   bool <strong>is_outgoing</strong> () const;
│ │ │ │ +   void <strong>disconnect</strong> (error_code const&amp; ec, operation_t op
│ │ │ │ +      , disconnect_severity_t = peer_connection_interface::normal);
│ │ │ │ +   bool <strong>is_connecting</strong> () const;
│ │ │ │ +   bool <strong>is_disconnecting</strong> () const;
│ │ │ │ +   bool <strong>ignore_unchoke_slots</strong> () const;
│ │ │ │ +   bool <strong>on_local_network</strong> () const;
│ │ │ │ +   bool <strong>failed</strong> () const;
│ │ │ │ +   bool <strong>should_log</strong> (peer_log_alert::direction_t direction) const;
│ │ │ │ +   void <strong>peer_log</strong> (peer_log_alert::direction_t direction
│ │ │ │ +      , char const* event, char const* fmt = &quot;&quot;, ...) const TORRENT_FORMAT(4,5);
│ │ │ │ +   bool <strong>can_disconnect</strong> (error_code const&amp; ec) const;
│ │ │ │ +   bool <strong>has_metadata</strong> () const;
│ │ │ │ +   bool <strong>in_handshake</strong> () const;
│ │ │ │ +   void <strong>send_buffer</strong> (char const* begin, int size);
│ │ │ │ +   std::time_t <strong>last_seen_complete</strong> () const;
│ │ │ │ +   time_point <strong>time_of_last_unchoke</strong> () const;
│ │ │ │ +   bool <strong>operator&lt;</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │ +   bool <strong>operator==</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │ +   bool <strong>operator!=</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │ +   std::shared_ptr&lt;peer_connection&gt; <strong>native_handle</strong> () const;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="info_hash_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+info_hash_t&labels=documentation&body=Documentation+under+heading+%22class+info_hash_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="info-hash-t">
│ │ │ │ -<h1>info_hash_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/info_hash.hpp">libtorrent/info_hash.hpp</a>&quot;</p>
│ │ │ │ -<p>class holding the info-hash of a torrent. It can hold a v1 info-hash
│ │ │ │ -(SHA-1) or a v2 info-hash (SHA-256) or both.</p>
│ │ │ │ -<div class="admonition note">
│ │ │ │ -<p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">If <tt class="docutils literal">has_v2()</tt> is false then the v1 hash might actually be a truncated
│ │ │ │ -v2 hash</p>
│ │ │ │ -</div>
│ │ │ │ +<a name="bt_peer_connection_handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+bt_peer_connection_handle&labels=documentation&body=Documentation+under+heading+%22class+bt_peer_connection_handle%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="bt-peer-connection-handle">
│ │ │ │ +<h1>bt_peer_connection_handle</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_connection_handle.hpp">libtorrent/peer_connection_handle.hpp</a>&quot;</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Plugins.html#bt_peer_connection_handle">bt_peer_connection_handle</a> provides a handle to the internal bittorrent
│ │ │ │ +peer connection object to plugins. It's low level and may not be a stable API
│ │ │ │ +across libtorrent versions.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct info_hash_t
│ │ │ │ +struct bt_peer_connection_handle : peer_connection_handle
│ │ │ │  {
│ │ │ │ -   <strong>info_hash_t</strong> (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ -   <strong>info_hash_t</strong> () noexcept = default;
│ │ │ │ -   explicit <strong>info_hash_t</strong> (sha256_hash h2) noexcept;
│ │ │ │ -   explicit <strong>info_hash_t</strong> (sha1_hash h1) noexcept;
│ │ │ │ -   bool <strong>has_v2</strong> () const;
│ │ │ │ -   bool <strong>has</strong> (protocol_version v) const;
│ │ │ │ -   bool <strong>has_v1</strong> () const;
│ │ │ │ -   sha1_hash <strong>get</strong> (protocol_version v) const;
│ │ │ │ -   sha1_hash <strong>get_best</strong> () const;
│ │ │ │ -   friend bool <strong>operator!=</strong> (info_hash_t const&amp; lhs, info_hash_t const&amp; rhs);
│ │ │ │ -   friend bool <strong>operator==</strong> (info_hash_t const&amp; lhs, info_hash_t const&amp; rhs) noexcept;
│ │ │ │ -   template &lt;typename F&gt; void <strong>for_each</strong> (F f) const;
│ │ │ │ -   bool <strong>operator&lt;</strong> (info_hash_t const&amp; o) const;
│ │ │ │ -   friend std::ostream&amp; <strong>operator&lt;&lt;</strong> (std::ostream&amp; os, info_hash_t const&amp; ih);
│ │ │ │ +   explicit <strong>bt_peer_connection_handle</strong> (peer_connection_handle pc);
│ │ │ │ +   bool <strong>packet_finished</strong> () const;
│ │ │ │ +   bool <strong>support_extensions</strong> () const;
│ │ │ │ +   bool <strong>supports_encryption</strong> () const;
│ │ │ │ +   void <strong>switch_recv_crypto</strong> (std::shared_ptr&lt;crypto_plugin&gt; crypto);
│ │ │ │ +   void <strong>switch_send_crypto</strong> (std::shared_ptr&lt;crypto_plugin&gt; crypto);
│ │ │ │ +   std::shared_ptr&lt;bt_peer_connection&gt; <strong>native_handle</strong> () const;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="plugin"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+plugin&labels=documentation&body=Documentation+under+heading+%22class+plugin%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="plugin">
│ │ │ │ +<h1>plugin</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions.hpp">libtorrent/extensions.hpp</a>&quot;</p>
│ │ │ │ +<p>this is the base class for a <a class="reference external" href="reference-Session.html#session">session</a> <a class="reference external" href="reference-Plugins.html#plugin">plugin</a>. One primary feature
│ │ │ │ +is that it is notified of all torrents that are added to the <a class="reference external" href="reference-Session.html#session">session</a>,
│ │ │ │ +and can add its own torrent_plugins.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct plugin
│ │ │ │ +{
│ │ │ │ +   virtual feature_flags_t <strong>implemented_features</strong> ();
│ │ │ │ +   virtual std::shared_ptr&lt;torrent_plugin&gt; <strong>new_torrent</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │ +   virtual void <strong>added</strong> (session_handle const&amp;);
│ │ │ │ +   virtual void <strong>abort</strong> ();
│ │ │ │ +   virtual bool <strong>on_dht_request</strong> (string_view <em>/* query */</em>
│ │ │ │ +      , udp::endpoint const&amp; <em>/* source */</em>, bdecode_node const&amp; <em>/* message */</em>
│ │ │ │ +      , entry&amp; <em>/* response */</em>);
│ │ │ │ +   virtual void <strong>on_alert</strong> (alert const*);
│ │ │ │ +   virtual bool <strong>on_unknown_torrent</strong> (info_hash_t const&amp; <em>/* info_hash */</em>
│ │ │ │ +      , peer_connection_handle const&amp; <em>/* pc */</em>, add_torrent_params&amp; <em>/* p */</em>);
│ │ │ │ +   virtual void <strong>on_tick</strong> ();
│ │ │ │ +   virtual uint64_t <strong>get_unchoke_priority</strong> (peer_connection_handle const&amp; <em>/* peer */</em>);
│ │ │ │ +   virtual std::map&lt;std::string, std::string&gt; <strong>save_state</strong> () const;
│ │ │ │ +   virtual void <strong>load_state</strong> (std::map&lt;std::string, std::string&gt; const&amp;);
│ │ │ │  
│ │ │ │ -   sha1_hash v1;
│ │ │ │ -   sha256_hash v2;
│ │ │ │ +   static constexpr feature_flags_t <strong>optimistic_unchoke_feature</strong>  = 1_bit;
│ │ │ │ +   static constexpr feature_flags_t <strong>tick_feature</strong>  = 2_bit;
│ │ │ │ +   static constexpr feature_flags_t <strong>dht_request_feature</strong>  = 3_bit;
│ │ │ │ +   static constexpr feature_flags_t <strong>alert_feature</strong>  = 4_bit;
│ │ │ │ +   static constexpr feature_flags_t <strong>unknown_torrent_feature</strong>  = 5_bit;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="info_hash_t()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Binfo_hash_t%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Binfo_hash_t%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="info-hash-t-1">
│ │ │ │ -<h2>info_hash_t()</h2>
│ │ │ │ +<a name="implemented_features()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bimplemented_features%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bimplemented_features%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="implemented-features">
│ │ │ │ +<h2>implemented_features()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -<strong>info_hash_t</strong> (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ -<strong>info_hash_t</strong> () noexcept = default;
│ │ │ │ -explicit <strong>info_hash_t</strong> (sha256_hash h2) noexcept;
│ │ │ │ -explicit <strong>info_hash_t</strong> (sha1_hash h1) noexcept;
│ │ │ │ +virtual feature_flags_t <strong>implemented_features</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>The default constructor creates an object that has neither a v1 or v2
│ │ │ │ -hash.</p>
│ │ │ │ -<p>For backwards compatibility, make it possible to construct directly
│ │ │ │ -from a v1 hash. This constructor allows <em>implicit</em> conversion from a
│ │ │ │ -v1 hash, but the implicitness is deprecated.</p>
│ │ │ │ -<a name="has_v1()"></a>
│ │ │ │ -<a name="has_v2()"></a>
│ │ │ │ -<a name="has()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bhas_v1%28%29+has_v2%28%29+has%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bhas_v1%28%29+has_v2%28%29+has%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="has-v1-has-v2-has">
│ │ │ │ -<h2>has_v1() has_v2() has()</h2>
│ │ │ │ +<p>This function is expected to return a bitmask indicating which features
│ │ │ │ +this <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> implements. Some callbacks on this object may not be called
│ │ │ │ +unless the corresponding feature flag is returned here. Note that
│ │ │ │ +callbacks may still be called even if the corresponding feature is not
│ │ │ │ +specified in the return value here. See feature_flags_t for possible
│ │ │ │ +flags to return.</p>
│ │ │ │ +<a name="new_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bnew_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bnew_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="new-torrent">
│ │ │ │ +<h2>new_torrent()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>has_v2</strong> () const;
│ │ │ │ -bool <strong>has</strong> (protocol_version v) const;
│ │ │ │ -bool <strong>has_v1</strong> () const;
│ │ │ │ +virtual std::shared_ptr&lt;torrent_plugin&gt; <strong>new_torrent</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │  </pre>
│ │ │ │ -<p>returns true if the corresponding info hash is present in this
│ │ │ │ -object.</p>
│ │ │ │ -<a name="get()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bget%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bget%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get">
│ │ │ │ -<h2>get()</h2>
│ │ │ │ +<p>this is called by the <a class="reference external" href="reference-Session.html#session">session</a> every time a new torrent is added.
│ │ │ │ +The <tt class="docutils literal">torrent*</tt> points to the internal torrent object created
│ │ │ │ +for the new torrent. The <a class="reference external" href="reference-Add_Torrent.html#client_data_t">client_data_t</a> is the userdata pointer as
│ │ │ │ +passed in via <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>.</p>
│ │ │ │ +<p>If the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> returns a <a class="reference external" href="reference-Plugins.html#torrent_plugin">torrent_plugin</a> instance, it will be added
│ │ │ │ +to the new torrent. Otherwise, return an empty shared_ptr to a
│ │ │ │ +<a class="reference external" href="reference-Plugins.html#torrent_plugin">torrent_plugin</a> (the default).</p>
│ │ │ │ +<a name="added()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Badded%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Badded%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="added">
│ │ │ │ +<h2>added()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -sha1_hash <strong>get</strong> (protocol_version v) const;
│ │ │ │ +virtual void <strong>added</strong> (session_handle const&amp;);
│ │ │ │  </pre>
│ │ │ │ -<p>returns the has for the specified protocol version</p>
│ │ │ │ -<a name="get_best()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bget_best%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bget_best%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-best">
│ │ │ │ -<h2>get_best()</h2>
│ │ │ │ +<p>called when <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> is added to a <a class="reference external" href="reference-Session.html#session">session</a></p>
│ │ │ │ +<a name="abort()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Babort%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Babort%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="abort">
│ │ │ │ +<h2>abort()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -sha1_hash <strong>get_best</strong> () const;
│ │ │ │ +virtual void <strong>abort</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>returns the v2 (truncated) info-hash, if there is one, otherwise
│ │ │ │ -returns the v1 info-hash</p>
│ │ │ │ -<a name="for_each()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bfor_each%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bfor_each%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="for-each">
│ │ │ │ -<h2>for_each()</h2>
│ │ │ │ +<p>called when the <a class="reference external" href="reference-Session.html#session">session</a> is aborted
│ │ │ │ +the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> should perform any cleanup necessary to allow the session's
│ │ │ │ +destruction (e.g. cancel outstanding async operations)</p>
│ │ │ │ +<a name="on_dht_request()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bon_dht_request%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bon_dht_request%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-dht-request">
│ │ │ │ +<h2>on_dht_request()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -template &lt;typename F&gt; void <strong>for_each</strong> (F f) const;
│ │ │ │ +virtual bool <strong>on_dht_request</strong> (string_view <em>/* query */</em>
│ │ │ │ +      , udp::endpoint const&amp; <em>/* source */</em>, bdecode_node const&amp; <em>/* message */</em>
│ │ │ │ +      , entry&amp; <em>/* response */</em>);
│ │ │ │  </pre>
│ │ │ │ -<p>calls the function object <tt class="docutils literal">f</tt> for each hash that is available.
│ │ │ │ -starting with v1. The signature of <tt class="docutils literal">F</tt> is:</p>
│ │ │ │ +<p>called when a dht request is received.
│ │ │ │ +If your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> expects this to be called, make sure to include the flag
│ │ │ │ +<tt class="docutils literal">dht_request_feature</tt> in the return value from <a class="reference external" href="reference-Plugins.html#implemented_features()">implemented_features()</a>.</p>
│ │ │ │ +<a name="on_alert()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bon_alert%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bon_alert%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-alert">
│ │ │ │ +<h2>on_alert()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void(sha1_hash const&amp;, protocol_version);
│ │ │ │ +virtual void <strong>on_alert</strong> (alert const*);
│ │ │ │  </pre>
│ │ │ │ -<a name="peer_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_info&labels=documentation&body=Documentation+under+heading+%22class+peer_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="peer-info">
│ │ │ │ -<h1>peer_info</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_info.hpp">libtorrent/peer_info.hpp</a>&quot;</p>
│ │ │ │ -<p>holds information and statistics about one peer
│ │ │ │ -that libtorrent is connected to</p>
│ │ │ │ +<p>called when an <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted alerts that are filtered are not posted.
│ │ │ │ +If your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> expects this to be called, make sure to include the flag
│ │ │ │ +<tt class="docutils literal">alert_feature</tt> in the return value from <a class="reference external" href="reference-Plugins.html#implemented_features()">implemented_features()</a>.</p>
│ │ │ │ +<a name="on_unknown_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bon_unknown_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bon_unknown_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-unknown-torrent">
│ │ │ │ +<h2>on_unknown_torrent()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct peer_info
│ │ │ │ -{
│ │ │ │ -   sha256_hash <strong>i2p_destination</strong> () const;
│ │ │ │ -
│ │ │ │ -   std::string client;
│ │ │ │ -   typed_bitfield&lt;piece_index_t&gt; pieces;
│ │ │ │ -   std::int64_t total_download;
│ │ │ │ -   std::int64_t total_upload;
│ │ │ │ -   time_duration last_request;
│ │ │ │ -   time_duration last_active;
│ │ │ │ -   time_duration download_queue_time;
│ │ │ │ -   static constexpr peer_flags_t <strong>interesting</strong>  = 0_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>choked</strong>  = 1_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>remote_interested</strong>  = 2_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>remote_choked</strong>  = 3_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>supports_extensions</strong>  = 4_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>outgoing_connection</strong>  = 5_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>local_connection</strong>  = 5_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>handshake</strong>  = 6_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>connecting</strong>  = 7_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>on_parole</strong>  = 9_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>seed</strong>  = 10_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>optimistic_unchoke</strong>  = 11_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>snubbed</strong>  = 12_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>upload_only</strong>  = 13_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>endgame_mode</strong>  = 14_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>holepunched</strong>  = 15_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>i2p_socket</strong>  = 16_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>utp_socket</strong>  = 17_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>ssl_socket</strong>  = 18_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>rc4_encrypted</strong>  = 19_bit;
│ │ │ │ -   static constexpr peer_flags_t <strong>plaintext_encrypted</strong>  = 20_bit;
│ │ │ │ -   peer_flags_t flags;
│ │ │ │ -   static constexpr peer_source_flags_t <strong>tracker</strong>  = 0_bit;
│ │ │ │ -   static constexpr peer_source_flags_t <strong>dht</strong>  = 1_bit;
│ │ │ │ -   static constexpr peer_source_flags_t <strong>pex</strong>  = 2_bit;
│ │ │ │ -   static constexpr peer_source_flags_t <strong>lsd</strong>  = 3_bit;
│ │ │ │ -   static constexpr peer_source_flags_t <strong>resume_data</strong>  = 4_bit;
│ │ │ │ -   static constexpr peer_source_flags_t <strong>incoming</strong>  = 5_bit;
│ │ │ │ -   peer_source_flags_t source;
│ │ │ │ -   int up_speed;
│ │ │ │ -   int down_speed;
│ │ │ │ -   int payload_up_speed;
│ │ │ │ -   int payload_down_speed;
│ │ │ │ -   peer_id pid;
│ │ │ │ -   int queue_bytes;
│ │ │ │ -   int request_timeout;
│ │ │ │ -   int send_buffer_size;
│ │ │ │ -   int used_send_buffer;
│ │ │ │ -   int receive_buffer_size;
│ │ │ │ -   int used_receive_buffer;
│ │ │ │ -   int receive_buffer_watermark;
│ │ │ │ -   int num_hashfails;
│ │ │ │ -   int download_queue_length;
│ │ │ │ -   int timed_out_requests;
│ │ │ │ -   int busy_requests;
│ │ │ │ -   int requests_in_buffer;
│ │ │ │ -   int target_dl_queue_length;
│ │ │ │ -   int upload_queue_length;
│ │ │ │ -   int failcount;
│ │ │ │ -   piece_index_t downloading_piece_index;
│ │ │ │ -   int downloading_block_index;
│ │ │ │ -   int downloading_progress;
│ │ │ │ -   int downloading_total;
│ │ │ │ -   static constexpr connection_type_t <strong>standard_bittorrent</strong>  = 0_bit;
│ │ │ │ -   static constexpr connection_type_t <strong>web_seed</strong>  = 1_bit;
│ │ │ │ -   static constexpr connection_type_t <strong>http_seed</strong>  = 2_bit;
│ │ │ │ -   connection_type_t connection_type;
│ │ │ │ -   int pending_disk_bytes;
│ │ │ │ -   int pending_disk_read_bytes;
│ │ │ │ -   int send_quota;
│ │ │ │ -   int receive_quota;
│ │ │ │ -   int rtt;
│ │ │ │ -   int num_pieces;
│ │ │ │ -   int download_rate_peak;
│ │ │ │ -   int upload_rate_peak;
│ │ │ │ -   float progress;
│ │ │ │ -   int progress_ppm;
│ │ │ │ -   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> ip;
│ │ │ │ -   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> local_endpoint;
│ │ │ │ -   static constexpr bandwidth_state_flags_t <strong>bw_idle</strong>  = 0_bit;
│ │ │ │ -   static constexpr bandwidth_state_flags_t <strong>bw_limit</strong>  = 1_bit;
│ │ │ │ -   static constexpr bandwidth_state_flags_t <strong>bw_network</strong>  = 2_bit;
│ │ │ │ -   static constexpr bandwidth_state_flags_t <strong>bw_disk</strong>  = 4_bit;
│ │ │ │ -   bandwidth_state_flags_t read_state;
│ │ │ │ -   bandwidth_state_flags_t write_state;
│ │ │ │ -};
│ │ │ │ +virtual bool <strong>on_unknown_torrent</strong> (info_hash_t const&amp; <em>/* info_hash */</em>
│ │ │ │ +      , peer_connection_handle const&amp; <em>/* pc */</em>, add_torrent_params&amp; <em>/* p */</em>);
│ │ │ │  </pre>
│ │ │ │ -<a name="i2p_destination()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bi2p_destination%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bi2p_destination%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="i2p-destination">
│ │ │ │ -<h2>i2p_destination()</h2>
│ │ │ │ +<p>return true if the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> should be added</p>
│ │ │ │ +<a name="on_tick()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bon_tick%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bon_tick%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-tick">
│ │ │ │ +<h2>on_tick()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -sha256_hash <strong>i2p_destination</strong> () const;
│ │ │ │ +virtual void <strong>on_tick</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>If this peer is an i2p peer, this function returns the destination
│ │ │ │ -address of the peer</p>
│ │ │ │ -<a name="client"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bclient%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bclient%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>client</dt>
│ │ │ │ -<dd>A human readable string describing the software at the other end of
│ │ │ │ -the connection. In some cases this information is not available, then
│ │ │ │ -it will contain a string that may give away something about which
│ │ │ │ -software is running in the other end. In the case of a web seed, the
│ │ │ │ -server type and version will be a part of this string. This is UTF-8
│ │ │ │ -encoded.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpieces%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>pieces</dt>
│ │ │ │ -<dd>a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>, with one bit per piece in the torrent. Each bit tells you
│ │ │ │ -if the peer has that piece (if it's set to 1) or if the peer miss that
│ │ │ │ -piece (set to 0).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="total_download"></a>
│ │ │ │ -<a name="total_upload"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Btotal_download+total_upload%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Btotal_download+total_upload%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>total_download total_upload</dt>
│ │ │ │ -<dd>the total number of bytes downloaded from and uploaded to this peer.
│ │ │ │ -These numbers do not include the protocol chatter, but only the
│ │ │ │ -payload data.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="last_request"></a>
│ │ │ │ -<a name="last_active"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Blast_request+last_active%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Blast_request+last_active%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>last_request last_active</dt>
│ │ │ │ -<dd>the time since we last sent a request to this peer and since any
│ │ │ │ -transfer occurred with this peer</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="download_queue_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bdownload_queue_time%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bdownload_queue_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>download_queue_time</dt>
│ │ │ │ -<dd>the time until all blocks in the request queue will be downloaded</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="interesting"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Binteresting%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Binteresting%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>interesting</dt>
│ │ │ │ -<dd><strong>we</strong> are interested in pieces from this peer.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="choked"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bchoked%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bchoked%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>choked</dt>
│ │ │ │ -<dd><strong>we</strong> have choked this peer.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="remote_interested"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bremote_interested%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bremote_interested%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>remote_interested</dt>
│ │ │ │ -<dd>the peer is interested in <strong>us</strong></dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="remote_choked"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bremote_choked%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bremote_choked%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>remote_choked</dt>
│ │ │ │ -<dd>the peer has choked <strong>us</strong>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="supports_extensions"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bsupports_extensions%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bsupports_extensions%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>supports_extensions</dt>
│ │ │ │ -<dd>means that this peer supports the
│ │ │ │ -<a class="reference external" href="extension_protocol.html">extension protocol</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="outgoing_connection"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Boutgoing_connection%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Boutgoing_connection%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>outgoing_connection</dt>
│ │ │ │ -<dd>The connection was initiated by us, the peer has a
│ │ │ │ -listen port open, and that port is the same as in the
│ │ │ │ -address of this peer. If this flag is not set, this
│ │ │ │ -peer connection was opened by this peer connecting to
│ │ │ │ -us.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="local_connection"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Blocal_connection%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Blocal_connection%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>local_connection</dt>
│ │ │ │ -<dd>deprecated synonym for outgoing_connection</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="handshake"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bhandshake%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bhandshake%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>handshake</dt>
│ │ │ │ -<dd>The connection is opened, and waiting for the
│ │ │ │ -handshake. Until the handshake is done, the peer
│ │ │ │ -cannot be identified.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="connecting"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bconnecting%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bconnecting%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>connecting</dt>
│ │ │ │ -<dd>The connection is in a half-open state (i.e. it is
│ │ │ │ -being connected).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="on_parole"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bon_parole%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bon_parole%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>on_parole</dt>
│ │ │ │ -<dd>The peer has participated in a piece that failed the
│ │ │ │ -hash check, and is now &quot;on parole&quot;, 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.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="seed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bseed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bseed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>seed</dt>
│ │ │ │ -<dd>This peer is a seed (it has all the pieces).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="optimistic_unchoke"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Boptimistic_unchoke%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Boptimistic_unchoke%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>optimistic_unchoke</dt>
│ │ │ │ -<dd>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.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="snubbed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bsnubbed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bsnubbed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>snubbed</dt>
│ │ │ │ -<dd>This peer has recently failed to send a block within
│ │ │ │ -the request timeout from when the request was sent.
│ │ │ │ -We're currently picking one block at a time from this
│ │ │ │ -peer.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="upload_only"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bupload_only%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bupload_only%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>upload_only</dt>
│ │ │ │ -<dd>This peer has either explicitly (with an extension)
│ │ │ │ -or implicitly (by becoming a seed) told us that it
│ │ │ │ -will not downloading anything more, regardless of
│ │ │ │ -which pieces we have.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="endgame_mode"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bendgame_mode%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bendgame_mode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>endgame_mode</dt>
│ │ │ │ -<dd>This means the last time this peer picket a piece,
│ │ │ │ -it could not pick as many as it wanted because there
│ │ │ │ -were not enough free ones. i.e. all pieces this peer
│ │ │ │ -has were already requested from other peers.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="holepunched"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bholepunched%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bholepunched%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>holepunched</dt>
│ │ │ │ -<dd>This flag is set if the peer was in holepunch mode
│ │ │ │ -when the connection succeeded. This typically only
│ │ │ │ -happens if both peers are behind a NAT and the peers
│ │ │ │ -connect via the NAT holepunch mechanism.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="i2p_socket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bi2p_socket%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bi2p_socket%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>i2p_socket</dt>
│ │ │ │ -<dd>indicates that this socket is running on top of the
│ │ │ │ -I2P transport.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="utp_socket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Butp_socket%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Butp_socket%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>utp_socket</dt>
│ │ │ │ -<dd>indicates that this socket is a uTP socket</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="ssl_socket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bssl_socket%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bssl_socket%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>ssl_socket</dt>
│ │ │ │ -<dd>indicates that this socket is running on top of an SSL
│ │ │ │ -(TLS) channel</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="rc4_encrypted"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Brc4_encrypted%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Brc4_encrypted%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>rc4_encrypted</dt>
│ │ │ │ -<dd>this connection is obfuscated with RC4</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="plaintext_encrypted"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bplaintext_encrypted%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bplaintext_encrypted%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>plaintext_encrypted</dt>
│ │ │ │ -<dd>the handshake of this connection was obfuscated
│ │ │ │ -with a Diffie-Hellman exchange</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bflags%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bflags%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>flags</dt>
│ │ │ │ -<dd>tells you in which state the peer is in. It is set to
│ │ │ │ -any combination of the peer_flags_t flags above.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="tracker"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Btracker%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Btracker%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>tracker</dt>
│ │ │ │ -<dd>The peer was received from the tracker.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bdht%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bdht%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>dht</dt>
│ │ │ │ -<dd>The peer was received from the kademlia DHT.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pex"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpex%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpex%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>pex</dt>
│ │ │ │ -<dd>The peer was received from the peer exchange
│ │ │ │ -extension.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="lsd"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Blsd%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Blsd%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>lsd</dt>
│ │ │ │ -<dd>The peer was received from the local service
│ │ │ │ -discovery (The peer is on the local network).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="resume_data"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bresume_data%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bresume_data%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>resume_data</dt>
│ │ │ │ -<dd>The peer was added from the fast resume data.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="incoming"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bincoming%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bincoming%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>incoming</dt>
│ │ │ │ -<dd>we received an incoming connection from this peer</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="source"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bsource%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bsource%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>source</dt>
│ │ │ │ -<dd>a combination of flags describing from which sources this peer
│ │ │ │ -was received. A combination of the peer_source_flags_t above.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="up_speed"></a>
│ │ │ │ -<a name="down_speed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bup_speed+down_speed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bup_speed+down_speed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>up_speed down_speed</dt>
│ │ │ │ -<dd>the current upload and download speed we have to and from this peer
│ │ │ │ -(including any protocol messages). updated about once per second</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="payload_up_speed"></a>
│ │ │ │ -<a name="payload_down_speed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpayload_up_speed+payload_down_speed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpayload_up_speed+payload_down_speed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>payload_up_speed payload_down_speed</dt>
│ │ │ │ -<dd>The transfer rates of payload data only updated about once per second</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpid%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>pid</dt>
│ │ │ │ -<dd>the peer's id as used in the bittorrent protocol. This id can be used
│ │ │ │ -to extract 'fingerprints' from the peer. Sometimes it can tell you
│ │ │ │ -which client the peer is using. See identify_client()_</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="queue_bytes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bqueue_bytes%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bqueue_bytes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>queue_bytes</dt>
│ │ │ │ -<dd>the number of bytes we have requested from this peer, but not yet
│ │ │ │ -received.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="request_timeout"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Brequest_timeout%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Brequest_timeout%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>request_timeout</dt>
│ │ │ │ -<dd>the number of seconds until the current front piece request will time
│ │ │ │ -out. This timeout can be adjusted through
│ │ │ │ -<tt class="docutils literal"><span class="pre">settings_pack::request_timeout</span></tt>.
│ │ │ │ --1 means that there is not outstanding request.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="send_buffer_size"></a>
│ │ │ │ -<a name="used_send_buffer"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bsend_buffer_size+used_send_buffer%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bsend_buffer_size+used_send_buffer%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>send_buffer_size used_send_buffer</dt>
│ │ │ │ -<dd>the number of bytes allocated
│ │ │ │ -and used for the peer's send buffer, respectively.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="receive_buffer_size"></a>
│ │ │ │ -<a name="used_receive_buffer"></a>
│ │ │ │ -<a name="receive_buffer_watermark"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Breceive_buffer_size+used_receive_buffer+receive_buffer_watermark%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Breceive_buffer_size+used_receive_buffer+receive_buffer_watermark%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>receive_buffer_size used_receive_buffer receive_buffer_watermark</dt>
│ │ │ │ -<dd>the number of bytes
│ │ │ │ -allocated and used as receive buffer, respectively.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_hashfails"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bnum_hashfails%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bnum_hashfails%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_hashfails</dt>
│ │ │ │ -<dd>the number of pieces this peer has participated in sending us that
│ │ │ │ -turned out to fail the hash check.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="download_queue_length"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bdownload_queue_length%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bdownload_queue_length%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>download_queue_length</dt>
│ │ │ │ -<dd>this is the number of requests we have sent to this peer that we
│ │ │ │ -haven't got a response for yet</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="timed_out_requests"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Btimed_out_requests%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Btimed_out_requests%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>timed_out_requests</dt>
│ │ │ │ -<dd>the number of block requests that have timed out, and are still in the
│ │ │ │ -download queue</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="busy_requests"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bbusy_requests%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bbusy_requests%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>busy_requests</dt>
│ │ │ │ -<dd>the number of busy requests in the download queue. A busy request is a
│ │ │ │ -request for a block we've also requested from a different peer</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="requests_in_buffer"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Brequests_in_buffer%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Brequests_in_buffer%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>requests_in_buffer</dt>
│ │ │ │ -<dd>the number of requests messages that are currently in the send buffer
│ │ │ │ -waiting to be sent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="target_dl_queue_length"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Btarget_dl_queue_length%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Btarget_dl_queue_length%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>target_dl_queue_length</dt>
│ │ │ │ -<dd>the number of requests that is tried to be maintained (this is
│ │ │ │ -typically a function of download speed)</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="upload_queue_length"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bupload_queue_length%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bupload_queue_length%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>upload_queue_length</dt>
│ │ │ │ -<dd>the number of piece-requests we have received from this peer
│ │ │ │ -that we haven't answered with a piece yet.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="failcount"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bfailcount%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bfailcount%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>failcount</dt>
│ │ │ │ -<dd>the number of times this peer has &quot;failed&quot;. i.e. failed to connect or
│ │ │ │ -disconnected us. The failcount is decremented when we see this peer in
│ │ │ │ -a tracker response or peer exchange message.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="downloading_piece_index"></a>
│ │ │ │ -<a name="downloading_block_index"></a>
│ │ │ │ -<a name="downloading_progress"></a>
│ │ │ │ -<a name="downloading_total"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bdownloading_piece_index+downloading_block_index+downloading_progress+downloading_total%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bdownloading_piece_index+downloading_block_index+downloading_progress+downloading_total%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>downloading_piece_index downloading_block_index downloading_progress downloading_total</dt>
│ │ │ │ -<dd>You can know which piece, and which part of that piece, that is
│ │ │ │ -currently being downloaded from a specific peer by looking at these
│ │ │ │ -four members. <tt class="docutils literal">downloading_piece_index</tt> is the index of the piece
│ │ │ │ -that is currently being downloaded. This may be set to -1 if there's
│ │ │ │ -currently no piece downloading from this peer. If it is &gt;= 0, the
│ │ │ │ -other three members are valid. <tt class="docutils literal">downloading_block_index</tt> is the
│ │ │ │ -index of the block (or sub-piece) that is being downloaded.
│ │ │ │ -<tt class="docutils literal">downloading_progress</tt> is the number of bytes of this block we have
│ │ │ │ -received from the peer, and <tt class="docutils literal">downloading_total</tt> is the total number
│ │ │ │ -of bytes in this block.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="standard_bittorrent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bstandard_bittorrent%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bstandard_bittorrent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>standard_bittorrent</dt>
│ │ │ │ -<dd>Regular bittorrent connection</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="web_seed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bweb_seed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bweb_seed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>web_seed</dt>
│ │ │ │ -<dd>HTTP connection using the <a class="reference external" href="https://www.bittorrent.org/beps/bep_0019.html">BEP 19</a> protocol</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="http_seed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bhttp_seed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bhttp_seed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>http_seed</dt>
│ │ │ │ -<dd>HTTP connection using the <a class="reference external" href="https://www.bittorrent.org/beps/bep_0017.html">BEP 17</a> protocol</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="connection_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bconnection_type%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bconnection_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>connection_type</dt>
│ │ │ │ -<dd>the kind of connection this peer uses. See connection_type_t.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pending_disk_bytes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpending_disk_bytes%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpending_disk_bytes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>pending_disk_bytes</dt>
│ │ │ │ -<dd>the number of bytes this peer has pending in the disk-io thread.
│ │ │ │ -Downloaded and waiting to be written to disk. This is what is capped
│ │ │ │ -by <tt class="docutils literal"><span class="pre">settings_pack::max_queued_disk_bytes</span></tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pending_disk_read_bytes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpending_disk_read_bytes%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpending_disk_read_bytes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>pending_disk_read_bytes</dt>
│ │ │ │ -<dd>number of outstanding bytes to read
│ │ │ │ -from disk</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="send_quota"></a>
│ │ │ │ -<a name="receive_quota"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bsend_quota+receive_quota%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bsend_quota+receive_quota%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>send_quota receive_quota</dt>
│ │ │ │ -<dd>the number of bytes this peer has been assigned to be allowed to send
│ │ │ │ -and receive until it has to request more quota from the bandwidth
│ │ │ │ -manager.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="rtt"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Brtt%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Brtt%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>rtt</dt>
│ │ │ │ -<dd>an estimated round trip time to this peer, in milliseconds. It is
│ │ │ │ -estimated by timing the TCP <tt class="docutils literal">connect()</tt>. It may be 0 for
│ │ │ │ -incoming connections.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bnum_pieces%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bnum_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_pieces</dt>
│ │ │ │ -<dd>the number of pieces this peer has.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="download_rate_peak"></a>
│ │ │ │ -<a name="upload_rate_peak"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bdownload_rate_peak+upload_rate_peak%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bdownload_rate_peak+upload_rate_peak%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>download_rate_peak upload_rate_peak</dt>
│ │ │ │ -<dd>the highest download and upload rates seen on this connection. They
│ │ │ │ -are given in bytes per second. This number is reset to 0 on reconnect.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="progress"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bprogress%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bprogress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>progress</dt>
│ │ │ │ -<dd>the progress of the peer in the range [0, 1]. This is always 0 when
│ │ │ │ -floating point operations are disabled, instead use <tt class="docutils literal">progress_ppm</tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="progress_ppm"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bprogress_ppm%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bprogress_ppm%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>progress_ppm</dt>
│ │ │ │ -<dd>indicates the download progress of the peer in the range [0, 1000000]
│ │ │ │ -(parts per million).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="ip"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bip%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bip%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>ip</dt>
│ │ │ │ -<dd>the IP-address to this peer. The type is an asio endpoint. For
│ │ │ │ -more info, see the <a class="reference external" href="http://asio.sourceforge.net/asio-0.3.8/doc/asio/reference.html">asio</a> documentation. This field is not valid for
│ │ │ │ -i2p peers. Instead use the <a class="reference external" href="reference-Core.html#i2p_destination()">i2p_destination()</a> function.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="local_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>local_endpoint</dt>
│ │ │ │ -<dd>the IP and port pair the socket is bound to locally. i.e. the IP
│ │ │ │ -address of the interface it's going out over. This may be useful for
│ │ │ │ -multi-homed clients with multiple interfaces to the internet.
│ │ │ │ -This field is not valid for i2p peers.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="bw_idle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bbw_idle%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bbw_idle%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>bw_idle</dt>
│ │ │ │ -<dd>The peer is not waiting for any external events to
│ │ │ │ -send or receive data.</dd>
│ │ │ │ +<p>called once per second.
│ │ │ │ +If your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> expects this to be called, make sure to include the flag
│ │ │ │ +<tt class="docutils literal">tick_feature</tt> in the return value from <a class="reference external" href="reference-Plugins.html#implemented_features()">implemented_features()</a>.</p>
│ │ │ │ +<a name="get_unchoke_priority()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bget_unchoke_priority%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bget_unchoke_priority%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-unchoke-priority">
│ │ │ │ +<h2>get_unchoke_priority()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual uint64_t <strong>get_unchoke_priority</strong> (peer_connection_handle const&amp; <em>/* peer */</em>);
│ │ │ │ +</pre>
│ │ │ │ +<p>called when choosing peers to optimistically unchoke. The return value
│ │ │ │ +indicates the peer's priority for unchoking. Lower return values
│ │ │ │ +correspond to higher priority. Priorities above 2^63-1 are reserved.
│ │ │ │ +If your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> has no priority to assign a peer it should return 2^64-1.
│ │ │ │ +If your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> expects this to be called, make sure to include the flag
│ │ │ │ +<tt class="docutils literal">optimistic_unchoke_feature</tt> in the return value from <a class="reference external" href="reference-Plugins.html#implemented_features()">implemented_features()</a>.
│ │ │ │ +If multiple plugins implement this function the lowest return value
│ │ │ │ +(i.e. the highest priority) is used.</p>
│ │ │ │ +<a name="load_state()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bload_state%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bload_state%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="load-state">
│ │ │ │ +<h2>load_state()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual void <strong>load_state</strong> (std::map&lt;std::string, std::string&gt; const&amp;);
│ │ │ │ +</pre>
│ │ │ │ +<p>called on startup while loading settings state from the <a class="reference external" href="reference-Session.html#session_params">session_params</a></p>
│ │ │ │ +<a name="optimistic_unchoke_feature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Boptimistic_unchoke_feature%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Boptimistic_unchoke_feature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>optimistic_unchoke_feature</dt>
│ │ │ │ +<dd>include this bit if your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> needs to alter the order of the
│ │ │ │ +optimistic unchoke of peers. i.e. have the on_optimistic_unchoke()
│ │ │ │ +callback be called.</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="bw_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bbw_limit%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bbw_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>bw_limit</dt>
│ │ │ │ -<dd>The peer is waiting for the rate limiter.</dd>
│ │ │ │ +<a name="tick_feature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Btick_feature%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Btick_feature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>tick_feature</dt>
│ │ │ │ +<dd>include this bit if your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> needs to have <a class="reference external" href="reference-Plugins.html#on_tick()">on_tick()</a> called</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="bw_network"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bbw_network%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bbw_network%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>bw_network</dt>
│ │ │ │ -<dd>The peer has quota and is currently waiting for a
│ │ │ │ -network read or write operation to complete. This is
│ │ │ │ -the state all peers are in if there are no bandwidth
│ │ │ │ -limits.</dd>
│ │ │ │ +<a name="dht_request_feature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bdht_request_feature%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bdht_request_feature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>dht_request_feature</dt>
│ │ │ │ +<dd>include this bit if your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> needs to have <a class="reference external" href="reference-Plugins.html#on_dht_request()">on_dht_request()</a>
│ │ │ │ +called</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="bw_disk"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bbw_disk%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bbw_disk%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>bw_disk</dt>
│ │ │ │ -<dd>The peer is waiting for the disk I/O thread to catch
│ │ │ │ -up writing buffers to disk before downloading more.</dd>
│ │ │ │ +<a name="alert_feature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Balert_feature%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Balert_feature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>alert_feature</dt>
│ │ │ │ +<dd>include this bit if your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> needs to have <a class="reference external" href="reference-Plugins.html#on_alert()">on_alert()</a>
│ │ │ │ +called</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="read_state"></a>
│ │ │ │ -<a name="write_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bread_state+write_state%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bread_state+write_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>read_state write_state</dt>
│ │ │ │ -<dd>bitmasks indicating what state this peer
│ │ │ │ -is in with regards to sending and receiving data. The states are
│ │ │ │ -defined as independent flags of type bandwidth_state_flags_t, in this
│ │ │ │ -class.</dd>
│ │ │ │ +<a name="unknown_torrent_feature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bunknown_torrent_feature%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bunknown_torrent_feature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>unknown_torrent_feature</dt>
│ │ │ │ +<dd>include this bit if your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> needs to have <a class="reference external" href="reference-Plugins.html#on_unknown_torrent()">on_unknown_torrent()</a>
│ │ │ │ +called even if there is no active torrent in the <a class="reference external" href="reference-Session.html#session">session</a></dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="peer_request"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_request&labels=documentation&body=Documentation+under+heading+%22class+peer_request%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<a name="torrent_plugin"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_plugin&labels=documentation&body=Documentation+under+heading+%22class+torrent_plugin%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │ -<div class="section" id="peer-request">
│ │ │ │ -<h1>peer_request</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_request.hpp">libtorrent/peer_request.hpp</a>&quot;</p>
│ │ │ │ -<p>represents a byte range within a piece. Internally this is is used for
│ │ │ │ -incoming piece requests.</p>
│ │ │ │ +<div class="section" id="torrent-plugin">
│ │ │ │ +<h1>torrent_plugin</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions.hpp">libtorrent/extensions.hpp</a>&quot;</p>
│ │ │ │ +<p>Torrent plugins are associated with a single torrent and have a number
│ │ │ │ +of functions called at certain events. Many of its functions have the
│ │ │ │ +ability to change or override the default libtorrent behavior.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct peer_request
│ │ │ │ +struct torrent_plugin
│ │ │ │  {
│ │ │ │ -   bool <strong>operator==</strong> (peer_request const&amp; r) const;
│ │ │ │ +   virtual std::shared_ptr&lt;peer_plugin&gt; <strong>new_connection</strong> (peer_connection_handle const&amp;);
│ │ │ │ +   virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │ +   virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │ +   virtual void <strong>tick</strong> ();
│ │ │ │ +   virtual bool <strong>on_resume</strong> ();
│ │ │ │ +   virtual bool <strong>on_pause</strong> ();
│ │ │ │ +   virtual void <strong>on_files_checked</strong> ();
│ │ │ │ +   virtual void <strong>on_state</strong> (torrent_status::state_t);
│ │ │ │ +   virtual void <strong>on_add_peer</strong> (tcp::endpoint const&amp;,
│ │ │ │ +      peer_source_flags_t, add_peer_flags_t);
│ │ │ │  
│ │ │ │ -   piece_index_t piece;
│ │ │ │ -   int start;
│ │ │ │ -   int length;
│ │ │ │ +   static constexpr add_peer_flags_t <strong>first_time</strong>  = 1_bit;
│ │ │ │ +   static constexpr add_peer_flags_t <strong>filtered</strong>  = 2_bit;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="operator==()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Boperator%3D%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Boperator%3D%3D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator">
│ │ │ │ -<h2>operator==()</h2>
│ │ │ │ +<a name="new_connection()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bnew_connection%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bnew_connection%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="new-connection">
│ │ │ │ +<h2>new_connection()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>operator==</strong> (peer_request const&amp; r) const;
│ │ │ │ +virtual std::shared_ptr&lt;peer_plugin&gt; <strong>new_connection</strong> (peer_connection_handle const&amp;);
│ │ │ │  </pre>
│ │ │ │ -<p>returns true if the right hand side <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> refers to the same
│ │ │ │ -range as this does.</p>
│ │ │ │ -<a name="piece"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Bpiece%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Bpiece%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>piece</dt>
│ │ │ │ -<dd>The index of the piece in which the range starts.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="start"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Bstart%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Bstart%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>start</dt>
│ │ │ │ -<dd>The byte offset within that piece where the range starts.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="length"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Blength%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Blength%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>length</dt>
│ │ │ │ -<dd>The size of the range, in bytes.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_peer_equal()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_peer_equal%28%29&labels=documentation&body=Documentation+under+heading+%22torrent_peer_equal%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="torrent-peer-equal">
│ │ │ │ -<h1>torrent_peer_equal()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_peer.hpp">libtorrent/torrent_peer.hpp</a>&quot;</p>
│ │ │ │ +<p>This function is called each time a new peer is connected to the torrent. You
│ │ │ │ +may choose to ignore this by just returning a default constructed
│ │ │ │ +<tt class="docutils literal">shared_ptr</tt> (in which case you don't need to override this member
│ │ │ │ +function).</p>
│ │ │ │ +<p>If you need an extension to the peer connection (which most plugins do) you
│ │ │ │ +are supposed to return an instance of your <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a> class. Which in
│ │ │ │ +turn will have its hook functions called on event specific to that peer.</p>
│ │ │ │ +<p>The <tt class="docutils literal">peer_connection_handle</tt> will be valid as long as the <tt class="docutils literal">shared_ptr</tt>
│ │ │ │ +is being held by the torrent object. So, it is generally a good idea to not
│ │ │ │ +keep a <tt class="docutils literal">shared_ptr</tt> to your own <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a>. If you want to keep references
│ │ │ │ +to it, use <tt class="docutils literal">weak_ptr</tt>.</p>
│ │ │ │ +<p>If this function throws an exception, the connection will be closed.</p>
│ │ │ │ +<a name="on_piece_pass()"></a>
│ │ │ │ +<a name="on_piece_failed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_piece_pass%28%29+on_piece_failed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_piece_pass%28%29+on_piece_failed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-piece-pass-on-piece-failed">
│ │ │ │ +<h2>on_piece_pass() on_piece_failed()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -inline bool <strong>torrent_peer_equal</strong> (torrent_peer const* lhs, torrent_peer const* rhs);
│ │ │ │ +virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │ +virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │  </pre>
│ │ │ │ -<a name="make_magnet_uri()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:make_magnet_uri%28%29&labels=documentation&body=Documentation+under+heading+%22make_magnet_uri%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="make-magnet-uri">
│ │ │ │ -<h1>make_magnet_uri()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/magnet_uri.hpp">libtorrent/magnet_uri.hpp</a>&quot;</p>
│ │ │ │ +<p>These hooks are called when a piece passes the hash check or fails the hash
│ │ │ │ +check, respectively. The <tt class="docutils literal">index</tt> is the piece index that was downloaded.
│ │ │ │ +It is possible to access the list of peers that participated in sending the
│ │ │ │ +piece through the <tt class="docutils literal">torrent</tt> and the <tt class="docutils literal">piece_picker</tt>.</p>
│ │ │ │ +<a name="tick()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Btick%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Btick%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="tick">
│ │ │ │ +<h2>tick()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::string <strong>make_magnet_uri</strong> (torrent_handle const&amp; handle);
│ │ │ │ -std::string <strong>make_magnet_uri</strong> (add_torrent_params const&amp; atp);
│ │ │ │ -std::string <strong>make_magnet_uri</strong> (torrent_info const&amp; info);
│ │ │ │ +virtual void <strong>tick</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>Generates a magnet URI from the specified torrent.</p>
│ │ │ │ -<p>Several fields from the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> objects are recorded in the
│ │ │ │ -magnet link. In order to not include them, they have to be cleared before
│ │ │ │ -calling <a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a>. These fields are used:</p>
│ │ │ │ -<blockquote>
│ │ │ │ -<tt class="docutils literal">ti</tt>, <tt class="docutils literal">info_hashes</tt>, <tt class="docutils literal">url_seeds</tt>, <tt class="docutils literal">dht_nodes</tt>,
│ │ │ │ -<tt class="docutils literal">file_priorities</tt>, <tt class="docutils literal">trackers</tt>, <tt class="docutils literal">name</tt>, <tt class="docutils literal">peers</tt>.</blockquote>
│ │ │ │ -<p>Depending on what the use case for the resulting magnet link is, clearing
│ │ │ │ -<tt class="docutils literal">peers</tt> and <tt class="docutils literal">dht_nodes</tt> is probably a good idea if the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>
│ │ │ │ -came from a running torrent. Those lists may be long and be ephemeral.</p>
│ │ │ │ -<p>If none of the <tt class="docutils literal">info_hashes</tt> or <tt class="docutils literal">ti</tt> fields are set, there is not
│ │ │ │ -info-hash available, and a magnet link cannot be created. In this case
│ │ │ │ -<a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a> returns an empty string.</p>
│ │ │ │ -<p>The recommended way to generate a magnet link from a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is to
│ │ │ │ -call <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a>, which will post a <a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a>
│ │ │ │ -containing an <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object. This can then be passed to
│ │ │ │ -<a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a>.</p>
│ │ │ │ -<p>The overload that takes a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> will make blocking calls to
│ │ │ │ -query information about the torrent. If the torrent handle is invalid,
│ │ │ │ -an empty string is returned.</p>
│ │ │ │ -<p>For more information about magnet links, see <a class="reference external" href="manual-ref.html#magnet-links">magnet links</a>.</p>
│ │ │ │ -<a name="parse_magnet_uri()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:parse_magnet_uri%28%29&labels=documentation&body=Documentation+under+heading+%22parse_magnet_uri%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="parse-magnet-uri">
│ │ │ │ -<h1>parse_magnet_uri()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/magnet_uri.hpp">libtorrent/magnet_uri.hpp</a>&quot;</p>
│ │ │ │ +<p>This hook is called approximately once per second. It is a way of making it
│ │ │ │ +easy for plugins to do timed events, for sending messages or whatever.</p>
│ │ │ │ +<a name="on_resume()"></a>
│ │ │ │ +<a name="on_pause()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_resume%28%29+on_pause%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_resume%28%29+on_pause%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-resume-on-pause">
│ │ │ │ +<h2>on_resume() on_pause()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -add_torrent_params <strong>parse_magnet_uri</strong> (string_view uri, error_code&amp; ec);
│ │ │ │ -add_torrent_params <strong>parse_magnet_uri</strong> (string_view uri);
│ │ │ │ -void <strong>parse_magnet_uri</strong> (string_view uri, add_torrent_params&amp; p, error_code&amp; ec);
│ │ │ │ +virtual bool <strong>on_resume</strong> ();
│ │ │ │ +virtual bool <strong>on_pause</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>This function parses out information from the magnet link and populates the
│ │ │ │ -<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object. The overload that does not take an
│ │ │ │ -<tt class="docutils literal">error_code</tt> reference will throw a system_error on error
│ │ │ │ -The overload taking an <tt class="docutils literal">add_torrent_params</tt> reference will fill in the
│ │ │ │ -fields specified in the magnet URI.</p>
│ │ │ │ -<a name="truncate_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:truncate_files%28%29&labels=documentation&body=Documentation+under+heading+%22truncate_files%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="truncate-files">
│ │ │ │ -<h1>truncate_files()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/truncate.hpp">libtorrent/truncate.hpp</a>&quot;</p>
│ │ │ │ +<p>These hooks are called when the torrent is paused and resumed respectively.
│ │ │ │ +The return value indicates if the event was handled. A return value of
│ │ │ │ +<tt class="docutils literal">true</tt> indicates that it was handled, and no other <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> after this one
│ │ │ │ +will have this hook function called, and the standard handler will also not be
│ │ │ │ +invoked. So, returning true effectively overrides the standard behavior of
│ │ │ │ +pause or resume.</p>
│ │ │ │ +<p>Note that if you call <tt class="docutils literal">pause()</tt> or <tt class="docutils literal">resume()</tt> on the torrent from your
│ │ │ │ +handler it will recurse back into your handler, so in order to invoke the
│ │ │ │ +standard handler, you have to keep your own state on whether you want standard
│ │ │ │ +behavior or overridden behavior.</p>
│ │ │ │ +<a name="on_files_checked()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_files_checked%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_files_checked%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-files-checked">
│ │ │ │ +<h2>on_files_checked()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>truncate_files</strong> (file_storage const&amp; fs, std::string const&amp; save_path, storage_error&amp; ec);
│ │ │ │ +virtual void <strong>on_files_checked</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>Truncates files larger than specified in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>, saved under
│ │ │ │ -the specified save_path.</p>
│ │ │ │ -<a name="version()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:version%28%29&labels=documentation&body=Documentation+under+heading+%22version%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="version">
│ │ │ │ -<h1>version()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ +<p>This function is called when the initial files of the torrent have been
│ │ │ │ +checked. If there are no files to check, this function is called immediately.</p>
│ │ │ │ +<p>i.e. This function is always called when the torrent is in a state where it
│ │ │ │ +can start downloading.</p>
│ │ │ │ +<a name="on_state()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_state%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_state%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-state">
│ │ │ │ +<h2>on_state()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -char const* <strong>version</strong> ();
│ │ │ │ +virtual void <strong>on_state</strong> (torrent_status::state_t);
│ │ │ │  </pre>
│ │ │ │ -<p>returns the libtorrent version as string form in this format:
│ │ │ │ -&quot;&lt;major&gt;.&lt;minor&gt;.&lt;tiny&gt;.&lt;tag&gt;&quot;</p>
│ │ │ │ -<a name="load_torrent_buffer()"></a>
│ │ │ │ -<a name="load_torrent_file()"></a>
│ │ │ │ -<a name="load_torrent_parsed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_buffer%28%29+load_torrent_file%28%29+load_torrent_parsed%28%29&labels=documentation&body=Documentation+under+heading+%22load_torrent_buffer%28%29+load_torrent_file%28%29+load_torrent_parsed%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="load-torrent-buffer-load-torrent-file-load-torrent-parsed">
│ │ │ │ -<h1>load_torrent_buffer() load_torrent_file() load_torrent_parsed()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/load_torrent.hpp">libtorrent/load_torrent.hpp</a>&quot;</p>
│ │ │ │ +<p>called when the torrent changes state
│ │ │ │ +the state is one of <a class="reference external" href="reference-Torrent_Status.html#state_t">torrent_status::state_t</a>
│ │ │ │ +enum members</p>
│ │ │ │ +<a name="on_add_peer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_add_peer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_add_peer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-add-peer">
│ │ │ │ +<h2>on_add_peer()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -add_torrent_params <strong>load_torrent_file</strong> (
│ │ │ │ -   std::string const&amp; filename);
│ │ │ │ -add_torrent_params <strong>load_torrent_buffer</strong> (
│ │ │ │ -   span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg);
│ │ │ │ -add_torrent_params <strong>load_torrent_buffer</strong> (
│ │ │ │ -   span&lt;char const&gt; buffer);
│ │ │ │ -add_torrent_params <strong>load_torrent_file</strong> (
│ │ │ │ -   std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ -add_torrent_params <strong>load_torrent_parsed</strong> (
│ │ │ │ -   bdecode_node const&amp; torrent_file);
│ │ │ │ -add_torrent_params <strong>load_torrent_parsed</strong> (
│ │ │ │ -   bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg);
│ │ │ │ +virtual void <strong>on_add_peer</strong> (tcp::endpoint const&amp;,
│ │ │ │ +      peer_source_flags_t, add_peer_flags_t);
│ │ │ │  </pre>
│ │ │ │ -<p>These functions load the content of a .torrent file into an
│ │ │ │ -<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object.
│ │ │ │ -The immutable part of a torrent file (the info-dictionary) is stored in
│ │ │ │ -the <tt class="docutils literal">ti</tt> field in the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object (as a <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>
│ │ │ │ -object).
│ │ │ │ -The returned object is suitable to be:</p>
│ │ │ │ -<blockquote>
│ │ │ │ -<ul class="simple">
│ │ │ │ -<li>added to a <a class="reference external" href="reference-Session.html#session">session</a> via <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> or <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a></li>
│ │ │ │ -<li>saved as a .torrent_file via <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a></li>
│ │ │ │ -<li>turned into a magnet link via <a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a></li>
│ │ │ │ -</ul>
│ │ │ │ -</blockquote>
│ │ │ │ -<a name="protocol_version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+protocol_version&labels=documentation&body=Documentation+under+heading+%22enum+protocol_version%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-protocol-version">
│ │ │ │ -<h1>enum protocol_version</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/info_hash.hpp">libtorrent/info_hash.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="8%" />
│ │ │ │ -<col width="10%" />
│ │ │ │ -<col width="82%" />
│ │ │ │ -</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>V1</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>The original BitTorrent version, using SHA-1 hashes</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>V2</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>Version 2 of the BitTorrent protocol, using SHA-256 hashes</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>NUM</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="socket_type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+socket_type_t&labels=documentation&body=Documentation+under+heading+%22enum+socket_type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-socket-type-t">
│ │ │ │ -<h1>enum socket_type_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/socket_type.hpp">libtorrent/socket_type.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="38%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="41%" />
│ │ │ │ -</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>tcp</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>socks5</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>http</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>utp</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>i2p</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>tcp_ssl</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>socks5_ssl</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>http_ssl</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>utp_ssl</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="portmap_transport"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+portmap_transport&labels=documentation&body=Documentation+under+heading+%22enum+portmap_transport%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-portmap-transport">
│ │ │ │ -<h1>enum portmap_transport</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/portmap.hpp">libtorrent/portmap.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="67%" />
│ │ │ │ -</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>natpmp</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>natpmp can be NAT-PMP or PCP</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>upnp</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="portmap_protocol"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+portmap_protocol&labels=documentation&body=Documentation+under+heading+%22enum+portmap_protocol%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-portmap-protocol">
│ │ │ │ -<h1>enum portmap_protocol</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/portmap.hpp">libtorrent/portmap.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="23%" />
│ │ │ │ -<col width="27%" />
│ │ │ │ -<col width="50%" />
│ │ │ │ -</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>none</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>tcp</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>udp</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="event_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+event_t&labels=documentation&body=Documentation+under+heading+%22enum+event_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-event-t">
│ │ │ │ -<h1>enum event_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/tracker_manager.hpp">libtorrent/tracker_manager.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="35%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ -<col width="42%" />
│ │ │ │ -</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>none</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>completed</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>started</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>stopped</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>paused</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="connection_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+connection_type&labels=documentation&body=Documentation+under+heading+%22enum+connection_type%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-connection-type">
│ │ │ │ -<h1>enum connection_type</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_connection.hpp">libtorrent/peer_connection.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="38%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="41%" />
│ │ │ │ -</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>bittorrent</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>url_seed</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>http_seed</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="torrent_flags_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_flags_t&labels=documentation&body=Documentation+under+heading+%22torrent_flags_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-flags-t">
│ │ │ │ -<h1>torrent_flags_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_flags.hpp">libtorrent/torrent_flags.hpp</a>&quot;</p>
│ │ │ │ -<a name="torrent_flags_t::seed_mode"></a><dl class="docutils">
│ │ │ │ -<dt>seed_mode</dt>
│ │ │ │ -<dd><p class="first">If <tt class="docutils literal">seed_mode</tt> is set, libtorrent will assume that all files
│ │ │ │ -are present for this torrent and that they all match the hashes in
│ │ │ │ -the torrent file. Each time a peer requests to download a block,
│ │ │ │ -the piece is verified against the hash, unless it has been verified
│ │ │ │ -already. If a hash fails, the torrent will automatically leave the
│ │ │ │ -seed mode and recheck all the files. The use case for this mode is
│ │ │ │ -if a torrent is created and seeded, or if the user already know
│ │ │ │ -that the files are complete, this is a way to avoid the initial
│ │ │ │ -file checks, and significantly reduce the startup time.</p>
│ │ │ │ -<p>Setting <tt class="docutils literal">seed_mode</tt> on a torrent without metadata (a
│ │ │ │ -.torrent file) is a no-op and will be ignored.</p>
│ │ │ │ -<p class="last">It is not possible to <em>set</em> the <tt class="docutils literal">seed_mode</tt> flag on a torrent after it has
│ │ │ │ -been added to a <a class="reference external" href="reference-Session.html#session">session</a>. It is possible to <em>clear</em> it though.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::upload_mode"></a><dl class="docutils">
│ │ │ │ -<dt>upload_mode</dt>
│ │ │ │ -<dd><p class="first">If <tt class="docutils literal">upload_mode</tt> is set, the torrent will be initialized in
│ │ │ │ -upload-mode, which means it will not make any piece requests. This
│ │ │ │ -state is typically entered on disk I/O errors, and if the torrent
│ │ │ │ -is also auto managed, it will be taken out of this state
│ │ │ │ -periodically (see <tt class="docutils literal"><span class="pre">settings_pack::optimistic_disk_retry</span></tt>).</p>
│ │ │ │ -<p>This mode can be used to avoid race conditions when
│ │ │ │ -adjusting priorities of pieces before allowing the torrent to start
│ │ │ │ -downloading.</p>
│ │ │ │ -<p class="last">If the torrent is auto-managed (<tt class="docutils literal">auto_managed</tt>), the torrent
│ │ │ │ -will eventually be taken out of upload-mode, regardless of how it
│ │ │ │ -got there. If it's important to manually control when the torrent
│ │ │ │ -leaves upload mode, don't make it auto managed.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::share_mode"></a><dl class="docutils">
│ │ │ │ -<dt>share_mode</dt>
│ │ │ │ -<dd><p class="first">determines if the torrent should be added in <em>share mode</em> or not.
│ │ │ │ -Share mode indicates that we are not interested in downloading the
│ │ │ │ -torrent, but merely want to improve our share ratio (i.e. increase
│ │ │ │ -it). A torrent started in share mode will do its best to never
│ │ │ │ -download more than it uploads to the swarm. If the swarm does not
│ │ │ │ -have enough demand for upload capacity, the torrent will not
│ │ │ │ -download anything. This mode is intended to be safe to add any
│ │ │ │ -number of torrents to, without manual screening, without the risk
│ │ │ │ -of downloading more than is uploaded.</p>
│ │ │ │ -<p>A torrent in share mode sets the priority to all pieces to 0,
│ │ │ │ -except for the pieces that are downloaded, when pieces are decided
│ │ │ │ -to be downloaded. This affects the progress bar, which might be set
│ │ │ │ -to &quot;100% finished&quot; most of the time. Do not change file or piece
│ │ │ │ -priorities for torrents in share mode, it will make it not work.</p>
│ │ │ │ -<p class="last">The share mode has one setting, the share ratio target, see
│ │ │ │ -<tt class="docutils literal"><span class="pre">settings_pack::share_mode_target</span></tt> for more info.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::apply_ip_filter"></a><dl class="docutils">
│ │ │ │ -<dt>apply_ip_filter</dt>
│ │ │ │ -<dd>determines if the IP filter should apply to this torrent or not. By
│ │ │ │ -default all torrents are subject to filtering by the IP filter
│ │ │ │ -(i.e. this flag is set by default). This is useful if certain
│ │ │ │ -torrents needs to be exempt for some reason, being an auto-update
│ │ │ │ -torrent for instance.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::paused"></a><dl class="docutils">
│ │ │ │ -<dt>paused</dt>
│ │ │ │ -<dd>specifies whether or not the torrent is paused. i.e. it won't connect to the tracker or any of the peers
│ │ │ │ -until it's resumed. Note that a paused torrent that also has the
│ │ │ │ -auto_managed flag set can be started at any time by libtorrent's queuing
│ │ │ │ -logic. See <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::auto_managed"></a><dl class="docutils">
│ │ │ │ -<dt>auto_managed</dt>
│ │ │ │ -<dd><p class="first">If the torrent is auto-managed (<tt class="docutils literal">auto_managed</tt>), the torrent
│ │ │ │ -may be resumed at any point, regardless of how it paused. If it's
│ │ │ │ -important to manually control when the torrent is paused and
│ │ │ │ -resumed, don't make it auto managed.</p>
│ │ │ │ -<p class="last">If <tt class="docutils literal">auto_managed</tt> is set, the torrent will be queued,
│ │ │ │ -started and seeded automatically by libtorrent. When this is set,
│ │ │ │ -the torrent should also be started as paused. The default queue
│ │ │ │ -order is the order the torrents were added. They are all downloaded
│ │ │ │ -in that order. For more details, see <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::duplicate_is_error"></a><dl class="docutils">
│ │ │ │ -<dt>duplicate_is_error</dt>
│ │ │ │ -<dd>used in <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> to indicate that it's an error to attempt
│ │ │ │ -to add a torrent that's already in the <a class="reference external" href="reference-Session.html#session">session</a>. If it's not considered an
│ │ │ │ -error, a handle to the existing torrent is returned.
│ │ │ │ -This flag is not saved by <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a>, since it is only meant for
│ │ │ │ -adding torrents.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::update_subscribe"></a><dl class="docutils">
│ │ │ │ -<dt>update_subscribe</dt>
│ │ │ │ -<dd>on by default and means that this torrent will be part of state
│ │ │ │ -updates when calling <a class="reference external" href="reference-Session.html#post_torrent_updates()">post_torrent_updates()</a>.
│ │ │ │ -This flag is not saved by <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::super_seeding"></a><dl class="docutils">
│ │ │ │ -<dt>super_seeding</dt>
│ │ │ │ -<dd>sets the torrent into super seeding/initial seeding mode. If the torrent
│ │ │ │ -is not a seed, this flag has no effect.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::sequential_download"></a><dl class="docutils">
│ │ │ │ -<dt>sequential_download</dt>
│ │ │ │ -<dd>sets the sequential download state for the torrent. In this mode the
│ │ │ │ -piece picker will pick pieces with low index numbers before pieces with
│ │ │ │ -high indices. The actual pieces that are picked depend on other factors
│ │ │ │ -still, such as which pieces a peer has and whether it is in parole mode
│ │ │ │ -or &quot;prefer whole pieces&quot;-mode. Sequential mode is not ideal for streaming
│ │ │ │ -media. For that, see <a class="reference external" href="reference-Torrent_Handle.html#set_piece_deadline()">set_piece_deadline()</a> instead.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::stop_when_ready"></a><dl class="docutils">
│ │ │ │ -<dt>stop_when_ready</dt>
│ │ │ │ -<dd><p class="first">When this flag is set, the torrent will <em>force stop</em> whenever it
│ │ │ │ -transitions from a non-data-transferring state into a data-transferring
│ │ │ │ -state (referred to as being ready to download or seed). This is useful
│ │ │ │ -for torrents that should not start downloading or seeding yet, but want
│ │ │ │ -to be made ready to do so. A torrent may need to have its files checked
│ │ │ │ -for instance, so it needs to be started and possibly queued for checking
│ │ │ │ -(auto-managed and started) but as soon as it's done, it should be
│ │ │ │ -stopped.</p>
│ │ │ │ -<p><em>Force stopped</em> means auto-managed is set to false and it's paused. As
│ │ │ │ -if the auto_manages flag is cleared and the paused flag is set on the torrent.</p>
│ │ │ │ -<p>Note that the torrent may transition into a downloading state while
│ │ │ │ -setting this flag, and since the logic is edge triggered you may
│ │ │ │ -miss the edge. To avoid this race, if the torrent already is in a
│ │ │ │ -downloading state when this call is made, it will trigger the
│ │ │ │ -stop-when-ready immediately.</p>
│ │ │ │ -<p>When the stop-when-ready logic fires, the flag is cleared. Any
│ │ │ │ -subsequent transitions between downloading and non-downloading states
│ │ │ │ -will not be affected, until this flag is set again.</p>
│ │ │ │ -<p>The behavior is more robust when setting this flag as part of adding
│ │ │ │ -the torrent. See <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>.</p>
│ │ │ │ -<p>The stop-when-ready flag fixes the inherent race condition of waiting
│ │ │ │ -for the <a class="reference external" href="reference-Alerts.html#state_changed_alert">state_changed_alert</a> and then call <a class="reference external" href="reference-Session.html#pause()">pause()</a>. The download/seeding
│ │ │ │ -will most likely start in between posting the <a class="reference external" href="reference-Alerts.html#alert">alert</a> and receiving the
│ │ │ │ -call to pause.</p>
│ │ │ │ -<p class="last">A downloading state is one where peers are being connected. Which means
│ │ │ │ -just downloading the metadata via the <tt class="docutils literal">ut_metadata</tt> extension counts
│ │ │ │ -as a downloading state. In order to stop a torrent once the metadata
│ │ │ │ -has been downloaded, instead set all file priorities to dont_download</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::override_trackers"></a><dl class="docutils">
│ │ │ │ -<dt>override_trackers</dt>
│ │ │ │ -<dd>when this flag is set, the tracker list in the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>
│ │ │ │ -object override any trackers from the torrent file. If the flag is
│ │ │ │ -not set, the trackers from the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object will be
│ │ │ │ -added to the list of trackers used by the torrent.
│ │ │ │ -This flag is set by <a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a> if there are trackers present in
│ │ │ │ -the resume data file. This effectively makes the trackers saved in the
│ │ │ │ -resume data take precedence over the original trackers. This includes if
│ │ │ │ -there's an empty list of trackers, to support the case where they were
│ │ │ │ -explicitly removed in the previous <a class="reference external" href="reference-Session.html#session">session</a>.
│ │ │ │ -This flag is not saved by <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a></dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::override_web_seeds"></a><dl class="docutils">
│ │ │ │ -<dt>override_web_seeds</dt>
│ │ │ │ -<dd>If this flag is set, the web seeds from the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>
│ │ │ │ -object will override any web seeds in the torrent file. If it's not
│ │ │ │ -set, web seeds in the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object will be added to the
│ │ │ │ -list of web seeds used by the torrent.
│ │ │ │ -This flag is set by <a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a> if there are web seeds present in
│ │ │ │ -the resume data file. This effectively makes the web seeds saved in the
│ │ │ │ -resume data take precedence over the original ones. This includes if
│ │ │ │ -there's an empty list of web seeds, to support the case where they were
│ │ │ │ -explicitly removed in the previous <a class="reference external" href="reference-Session.html#session">session</a>.
│ │ │ │ -This flag is not saved by <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a></dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::need_save_resume"></a><dl class="docutils">
│ │ │ │ -<dt>need_save_resume</dt>
│ │ │ │ -<dd><p class="first">if this flag is set (which it is by default) the torrent will be
│ │ │ │ -considered needing to save its resume data immediately, in the
│ │ │ │ -category if_metadata_changed. See resume_data_flags_t and
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> for details.</p>
│ │ │ │ -<p class="last">This flag is cleared by a successful call to <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a>
│ │ │ │ -This flag is not saved by <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a>, since it represents an
│ │ │ │ -ephemeral state of a running torrent.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::disable_dht"></a><dl class="docutils">
│ │ │ │ -<dt>disable_dht</dt>
│ │ │ │ -<dd>set this flag to disable DHT for this torrent. This lets you have the DHT
│ │ │ │ -enabled for the whole client, and still have specific torrents not
│ │ │ │ -participating in it. i.e. not announcing to the DHT nor picking up peers
│ │ │ │ -from it.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::disable_lsd"></a><dl class="docutils">
│ │ │ │ -<dt>disable_lsd</dt>
│ │ │ │ -<dd>set this flag to disable local service discovery for this torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::disable_pex"></a><dl class="docutils">
│ │ │ │ -<dt>disable_pex</dt>
│ │ │ │ -<dd>set this flag to disable peer exchange for this torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::no_verify_files"></a><dl class="docutils">
│ │ │ │ -<dt>no_verify_files</dt>
│ │ │ │ -<dd>if this flag is set, the resume data will be assumed to be correct
│ │ │ │ -without validating it against any files on disk. This may be used when
│ │ │ │ -restoring a <a class="reference external" href="reference-Session.html#session">session</a> by loading resume data from disk. It will save time
│ │ │ │ -and also delay any hard disk errors until files are actually needed. If
│ │ │ │ -the resume data cannot be trusted, or if a torrent is added for the first
│ │ │ │ -time to some save path that may already have some of the files, this flag
│ │ │ │ -should not be set.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::default_dont_download"></a><dl class="docutils">
│ │ │ │ -<dt>default_dont_download</dt>
│ │ │ │ -<dd>default all file priorities to dont_download. This is useful for adding
│ │ │ │ -magnet links where the number of files is unknown, but the
│ │ │ │ -file_priorities is still set for some files. Any file not covered by
│ │ │ │ -the file_priorities list will be set to normal download priority,
│ │ │ │ -unless this flag is set, in which case they will be set to 0
│ │ │ │ -(dont_download).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::i2p_torrent"></a><dl class="docutils">
│ │ │ │ -<dt>i2p_torrent</dt>
│ │ │ │ -<dd>this flag makes the torrent be considered an &quot;i2p torrent&quot; for purposes
│ │ │ │ -of the allow_i2p_mixed setting. When mixing regular peers and i2p peers
│ │ │ │ -is disabled, i2p torrents won't add normal peers to its peer list.
│ │ │ │ -Note that non i2p torrents may still allow i2p peers (on the off-chance
│ │ │ │ -that a tracker return them and the <a class="reference external" href="reference-Session.html#session">session</a> is configured with a SAM
│ │ │ │ -connection).
│ │ │ │ -This flag is set automatically when adding a torrent that has at least
│ │ │ │ -one tracker whose hostname ends with .i2p.
│ │ │ │ -It's also set by <a class="reference external" href="reference-Core.html#parse_magnet_uri()">parse_magnet_uri()</a> if the tracker list contains such
│ │ │ │ -URL.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_flags_t::all"></a><dl class="docutils">
│ │ │ │ -<dt>all</dt>
│ │ │ │ -<dd>all torrent flags combined. Can conveniently be used when creating masks
│ │ │ │ -for flags</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pex_flags_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:pex_flags_t&labels=documentation&body=Documentation+under+heading+%22pex_flags_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="pex-flags-t">
│ │ │ │ -<h1>pex_flags_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/pex_flags.hpp">libtorrent/pex_flags.hpp</a>&quot;</p>
│ │ │ │ -<a name="pex_flags_t::pex_encryption"></a><dl class="docutils">
│ │ │ │ -<dt>pex_encryption</dt>
│ │ │ │ -<dd>the peer supports protocol encryption</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pex_flags_t::pex_seed"></a><dl class="docutils">
│ │ │ │ -<dt>pex_seed</dt>
│ │ │ │ -<dd>the peer is a seed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pex_flags_t::pex_utp"></a><dl class="docutils">
│ │ │ │ -<dt>pex_utp</dt>
│ │ │ │ -<dd>the peer supports the uTP, transport protocol over UDP.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pex_flags_t::pex_holepunch"></a><dl class="docutils">
│ │ │ │ -<dt>pex_holepunch</dt>
│ │ │ │ -<dd>the peer supports the holepunch extension If this flag is received from a
│ │ │ │ -peer, it can be used as a rendezvous point in case direct connections to
│ │ │ │ -the peer fail</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pex_flags_t::pex_lt_v2"></a><dl class="docutils">
│ │ │ │ -<dt>pex_lt_v2</dt>
│ │ │ │ -<dd>protocol v2
│ │ │ │ -this is not a standard flag, it is only used internally</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="download_priority_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:download_priority_t&labels=documentation&body=Documentation+under+heading+%22download_priority_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="download-priority-t">
│ │ │ │ -<h1>download_priority_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/download_priority.hpp">libtorrent/download_priority.hpp</a>&quot;</p>
│ │ │ │ -<a name="download_priority_t::dont_download"></a><dl class="docutils">
│ │ │ │ -<dt>dont_download</dt>
│ │ │ │ -<dd>Don't download the file or piece. Partial pieces may still be downloaded when
│ │ │ │ -setting file priorities.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="download_priority_t::default_priority"></a><dl class="docutils">
│ │ │ │ -<dt>default_priority</dt>
│ │ │ │ -<dd>The default priority for files and pieces.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="download_priority_t::low_priority"></a><dl class="docutils">
│ │ │ │ -<dt>low_priority</dt>
│ │ │ │ -<dd>The lowest priority for files and pieces.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="download_priority_t::top_priority"></a><dl class="docutils">
│ │ │ │ -<dt>top_priority</dt>
│ │ │ │ -<dd>The highest priority for files and pieces.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="int"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:int&labels=documentation&body=Documentation+under+heading+%22int%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="int">
│ │ │ │ -<h1>int</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ -<a name="int::version_major"></a><dl class="docutils">
│ │ │ │ -<dt>version_major</dt>
│ │ │ │ -<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="int::version_minor"></a><dl class="docutils">
│ │ │ │ -<dt>version_minor</dt>
│ │ │ │ -<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="int::version_tiny"></a><dl class="docutils">
│ │ │ │ -<dt>version_tiny</dt>
│ │ │ │ -<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="char const*"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:char+const%2A&labels=documentation&body=Documentation+under+heading+%22char+const%2A%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="char-const">
│ │ │ │ -<h1>char const*</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ -<a name="char const*::version_str"></a><dl class="docutils">
│ │ │ │ -<dt>version_str</dt>
│ │ │ │ -<dd>the libtorrent version in string form</dd>
│ │ │ │ +<p>called every time a new peer is added to the peer list.
│ │ │ │ +This is before the peer is connected to. For <tt class="docutils literal">flags</tt>, see
│ │ │ │ +torrent_plugin::flags_t. The <tt class="docutils literal">source</tt> argument refers to
│ │ │ │ +the source where we learned about this peer from. It's a
│ │ │ │ +bitmask, because many sources may have told us about the same
│ │ │ │ +peer. For peer source flags, see peer_info::peer_source_flags.</p>
│ │ │ │ +<a name="first_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bfirst_time%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bfirst_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>first_time</dt>
│ │ │ │ +<dd>this is the first time we see this peer</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="std::uint64_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:std%3A%3Auint64_t&labels=documentation&body=Documentation+under+heading+%22std%3A%3Auint64_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="std-uint64-t">
│ │ │ │ -<h1>std::uint64_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ -<a name="std::uint64_t::version_revision"></a><dl class="docutils">
│ │ │ │ -<dt>version_revision</dt>
│ │ │ │ -<dd>the git commit of this libtorrent version</dd>
│ │ │ │ +<a name="filtered"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bfiltered%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bfiltered%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>filtered</dt>
│ │ │ │ +<dd>this peer was not added because it was
│ │ │ │ +filtered by the IP filter</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="block_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_info&labels=documentation&body=Documentation+under+heading+%22class+block_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="block-info">
│ │ │ │ -<h1>block_info</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │ -<p>holds the state of a block in a piece. Who we requested
│ │ │ │ -it from and how far along we are at downloading it.</p>
│ │ │ │ +<a name="peer_plugin"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_plugin&labels=documentation&body=Documentation+under+heading+%22class+peer_plugin%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="peer-plugin">
│ │ │ │ +<h1>peer_plugin</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions.hpp">libtorrent/extensions.hpp</a>&quot;</p>
│ │ │ │ +<p>peer plugins are associated with a specific peer. A peer could be
│ │ │ │ +both a regular bittorrent peer (<tt class="docutils literal">bt_peer_connection</tt>) or one of the
│ │ │ │ +web seed connections (<tt class="docutils literal">web_peer_connection</tt> or <tt class="docutils literal">http_seed_connection</tt>).
│ │ │ │ +In order to only attach to certain peers, make your
│ │ │ │ +torrent_plugin::new_connection only return a <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> for certain peer
│ │ │ │ +connection types</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct block_info
│ │ │ │ +struct peer_plugin
│ │ │ │  {
│ │ │ │ -   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>peer</strong> () const;
│ │ │ │ -   void <strong>set_peer</strong> (tcp::endpoint const&amp; ep);
│ │ │ │ -
│ │ │ │ -   enum block_state_t
│ │ │ │ -   {
│ │ │ │ -      none,
│ │ │ │ -      requested,
│ │ │ │ -      writing,
│ │ │ │ -      finished,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   unsigned bytes_progress:15;
│ │ │ │ -   unsigned block_size:15;
│ │ │ │ -   unsigned state:2;
│ │ │ │ -   unsigned num_peers:14;
│ │ │ │ +   virtual string_view <strong>type</strong> () const;
│ │ │ │ +   virtual void <strong>add_handshake</strong> (entry&amp;);
│ │ │ │ +   virtual void <strong>on_disconnect</strong> (error_code const&amp;);
│ │ │ │ +   virtual void <strong>on_connected</strong> ();
│ │ │ │ +   virtual bool <strong>on_handshake</strong> (span&lt;char const&gt;);
│ │ │ │ +   virtual bool <strong>on_extension_handshake</strong> (bdecode_node const&amp;);
│ │ │ │ +   virtual bool <strong>on_bitfield</strong> (bitfield const&amp; <em>/*bitfield*/</em>);
│ │ │ │ +   virtual bool <strong>on_dont_have</strong> (piece_index_t);
│ │ │ │ +   virtual bool <strong>on_allowed_fast</strong> (piece_index_t);
│ │ │ │ +   virtual bool <strong>on_have_all</strong> ();
│ │ │ │ +   virtual bool <strong>on_choke</strong> ();
│ │ │ │ +   virtual bool <strong>on_request</strong> (peer_request const&amp;);
│ │ │ │ +   virtual bool <strong>on_have_none</strong> ();
│ │ │ │ +   virtual bool <strong>on_have</strong> (piece_index_t);
│ │ │ │ +   virtual bool <strong>on_unchoke</strong> ();
│ │ │ │ +   virtual bool <strong>on_not_interested</strong> ();
│ │ │ │ +   virtual bool <strong>on_interested</strong> ();
│ │ │ │ +   virtual bool <strong>on_piece</strong> (peer_request const&amp; <em>/*piece*/</em>
│ │ │ │ +      , span&lt;char const&gt; <em>/*buf*/</em>);
│ │ │ │ +   virtual bool <strong>on_cancel</strong> (peer_request const&amp;);
│ │ │ │ +   virtual bool <strong>on_suggest</strong> (piece_index_t);
│ │ │ │ +   virtual bool <strong>on_reject</strong> (peer_request const&amp;);
│ │ │ │ +   virtual void <strong>sent_have_none</strong> ();
│ │ │ │ +   virtual void <strong>sent_choke</strong> ();
│ │ │ │ +   virtual void <strong>sent_suggest</strong> (piece_index_t);
│ │ │ │ +   virtual void <strong>sent_reject_request</strong> (peer_request const&amp;);
│ │ │ │ +   virtual void <strong>sent_request</strong> (peer_request const&amp;);
│ │ │ │ +   virtual void <strong>sent_allow_fast</strong> (piece_index_t);
│ │ │ │ +   virtual void <strong>sent_cancel</strong> (peer_request const&amp;);
│ │ │ │ +   virtual void <strong>sent_have_all</strong> ();
│ │ │ │ +   virtual void <strong>sent_have</strong> (piece_index_t);
│ │ │ │ +   virtual void <strong>sent_interested</strong> ();
│ │ │ │ +   virtual void <strong>sent_unchoke</strong> ();
│ │ │ │ +   virtual void <strong>sent_piece</strong> (peer_request const&amp;);
│ │ │ │ +   virtual void <strong>sent_not_interested</strong> ();
│ │ │ │ +   virtual void <strong>sent_payload</strong> (int <em>/* bytes */</em>);
│ │ │ │ +   virtual bool <strong>can_disconnect</strong> (error_code const&amp; <em>/*ec*/</em>);
│ │ │ │ +   virtual bool <strong>on_extended</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │ +      span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │ +   virtual bool <strong>on_unknown_message</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │ +      span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │ +   virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │ +   virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │ +   virtual void <strong>tick</strong> ();
│ │ │ │ +   virtual bool <strong>write_request</strong> (peer_request const&amp;);
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="set_peer()"></a>
│ │ │ │ -<a name="peer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bset_peer%28%29+peer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bset_peer%28%29+peer%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="set-peer-peer">
│ │ │ │ -<h2>set_peer() peer()</h2>
│ │ │ │ +<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="type">
│ │ │ │ +<h2>type()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -<a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>peer</strong> () const;
│ │ │ │ -void <strong>set_peer</strong> (tcp::endpoint const&amp; ep);
│ │ │ │ +virtual string_view <strong>type</strong> () const;
│ │ │ │  </pre>
│ │ │ │ -<p>The peer is the ip address of the peer this block was downloaded from.</p>
│ │ │ │ -<a name="block_state_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+block_state_t&labels=documentation&body=Documentation+under+heading+%22enum+block_state_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-block-state-t">
│ │ │ │ -<h2>enum block_state_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="8%" />
│ │ │ │ -<col width="79%" />
│ │ │ │ -</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>none</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>This block has not been downloaded or requested form any peer.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>requested</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>The block has been requested, but not completely downloaded yet.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>writing</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>The block has been downloaded and is currently queued for being
│ │ │ │ -written to disk.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>finished</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>The block has been written to disk.</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="bytes_progress"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bbytes_progress%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bbytes_progress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>bytes_progress</dt>
│ │ │ │ -<dd>the number of bytes that have been received for this block</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="block_size"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bblock_size%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bblock_size%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>block_size</dt>
│ │ │ │ -<dd>the total number of bytes in this block.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bstate%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bstate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>state</dt>
│ │ │ │ -<dd>the state this block is in (see <a class="reference external" href="reference-Torrent_Handle.html#block_state_t">block_state_t</a>)</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bnum_peers%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bnum_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_peers</dt>
│ │ │ │ -<dd>the number of peers that is currently requesting this block. Typically
│ │ │ │ -this is 0 or 1, but at the end of the torrent blocks may be requested
│ │ │ │ -by more peers in parallel to speed things up.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="partial_piece_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+partial_piece_info&labels=documentation&body=Documentation+under+heading+%22class+partial_piece_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="partial-piece-info">
│ │ │ │ -<h1>partial_piece_info</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │ -<p>This class holds information about pieces that have outstanding requests
│ │ │ │ -or outstanding writes</p>
│ │ │ │ +<p>This function is expected to return the name of
│ │ │ │ +the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a>.</p>
│ │ │ │ +<a name="add_handshake()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Badd_handshake%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Badd_handshake%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-handshake">
│ │ │ │ +<h2>add_handshake()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct partial_piece_info
│ │ │ │ -{
│ │ │ │ -   piece_index_t piece_index;
│ │ │ │ -   int blocks_in_piece;
│ │ │ │ -   int finished;
│ │ │ │ -   int writing;
│ │ │ │ -   int requested;
│ │ │ │ -   block_info const* blocks;
│ │ │ │ -};
│ │ │ │ +virtual void <strong>add_handshake</strong> (entry&amp;);
│ │ │ │  </pre>
│ │ │ │ -<a name="piece_index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Bpiece_index%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Bpiece_index%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>piece_index</dt>
│ │ │ │ -<dd>the index of the piece in question. <tt class="docutils literal">blocks_in_piece</tt> is the number
│ │ │ │ -of blocks in this particular piece. This number will be the same for
│ │ │ │ -most pieces, but
│ │ │ │ -the last piece may have fewer blocks than the standard pieces.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="blocks_in_piece"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Bblocks_in_piece%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Bblocks_in_piece%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>blocks_in_piece</dt>
│ │ │ │ -<dd>the number of blocks in this piece</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="finished"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Bfinished%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Bfinished%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>finished</dt>
│ │ │ │ -<dd>the number of blocks that are in the finished state</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="writing"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Bwriting%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Bwriting%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>writing</dt>
│ │ │ │ -<dd>the number of blocks that are in the writing state</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="requested"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Brequested%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Brequested%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>requested</dt>
│ │ │ │ -<dd>the number of blocks that are in the requested state</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="blocks"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Bblocks%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Bblocks%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>blocks</dt>
│ │ │ │ -<dd><p class="first">this is an array of <tt class="docutils literal">blocks_in_piece</tt> number of
│ │ │ │ -items. One for each block in the piece.</p>
│ │ │ │ -<div class="admonition warning last">
│ │ │ │ -<p class="first admonition-title">Warning</p>
│ │ │ │ -<p class="last">This is a pointer that points to an array
│ │ │ │ -that's owned by the <a class="reference external" href="reference-Session.html#session">session</a> object. The next time
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#get_download_queue()">get_download_queue()</a> is called, it will be invalidated.
│ │ │ │ -In the case of <a class="reference external" href="reference-Alerts.html#piece_info_alert">piece_info_alert</a>, these pointers point into the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -object itself, and will be invalidated when the <a class="reference external" href="reference-Alerts.html#alert">alert</a> destruct.</p>
│ │ │ │ -</div>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_handle&labels=documentation&body=Documentation+under+heading+%22class+torrent_handle%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-handle">
│ │ │ │ -<h1>torrent_handle</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │ -<p>You will usually have to store your torrent handles somewhere, since it's
│ │ │ │ -the object through which you retrieve information about the torrent and
│ │ │ │ -aborts the torrent.</p>
│ │ │ │ -<div class="admonition warning">
│ │ │ │ -<p class="first admonition-title">Warning</p>
│ │ │ │ -<p class="last">Any member function that returns a value or fills in a value has to be
│ │ │ │ -made synchronously. This means it has to wait for the main thread to
│ │ │ │ -complete the query before it can return. This might potentially be
│ │ │ │ -expensive if done from within a GUI thread that needs to stay
│ │ │ │ -responsive. Try to avoid querying for information you don't need, and
│ │ │ │ -try to do it in as few calls as possible. You can get most of the
│ │ │ │ -interesting information about a torrent from the
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a> call.</p>
│ │ │ │ -</div>
│ │ │ │ -<p>The default constructor will initialize the handle to an invalid state.
│ │ │ │ -Which means you cannot perform any operation on it, unless you first
│ │ │ │ -assign it a valid handle. If you try to perform any operation on an
│ │ │ │ -uninitialized handle, it will throw <tt class="docutils literal">invalid_handle</tt>.</p>
│ │ │ │ -<div class="admonition warning">
│ │ │ │ -<p class="first admonition-title">Warning</p>
│ │ │ │ -<p class="last">All operations on a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> may throw system_error
│ │ │ │ -exception, in case the handle is no longer referring to a torrent.
│ │ │ │ -There is one exception <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a> will never throw. Since the torrents
│ │ │ │ -are processed by a background thread, there is no guarantee that a
│ │ │ │ -handle will remain valid between two calls.</p>
│ │ │ │ -</div>
│ │ │ │ +<p>can add entries to the extension handshake
│ │ │ │ +this is not called for web seeds</p>
│ │ │ │ +<a name="on_disconnect()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_disconnect%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_disconnect%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-disconnect">
│ │ │ │ +<h2>on_disconnect()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct torrent_handle
│ │ │ │ -{
│ │ │ │ -   friend std::size_t <strong>hash_value</strong> (torrent_handle const&amp; th);
│ │ │ │ -   <strong>torrent_handle</strong> () noexcept = default;
│ │ │ │ -   void <strong>add_piece</strong> (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
│ │ │ │ -   void <strong>add_piece</strong> (piece_index_t piece, std::vector&lt;char&gt; data, add_piece_flags_t flags = {}) const;
│ │ │ │ -   void <strong>read_piece</strong> (piece_index_t piece) const;
│ │ │ │ -   bool <strong>have_piece</strong> (piece_index_t piece) const;
│ │ │ │ -   void <strong>get_peer_info</strong> (std::vector&lt;peer_info&gt;&amp; v) const;
│ │ │ │ -   void <strong>post_peer_info</strong> () const;
│ │ │ │ -   torrent_status <strong>status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ -   void <strong>post_status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ -   void <strong>get_download_queue</strong> (std::vector&lt;partial_piece_info&gt;&amp; queue) const;
│ │ │ │ -   void <strong>post_download_queue</strong> () const;
│ │ │ │ -   std::vector&lt;partial_piece_info&gt; <strong>get_download_queue</strong> () const;
│ │ │ │ -   void <strong>clear_piece_deadlines</strong> () const;
│ │ │ │ -   void <strong>set_piece_deadline</strong> (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
│ │ │ │ -   void <strong>reset_piece_deadline</strong> (piece_index_t index) const;
│ │ │ │ -   void <strong>file_progress</strong> (std::vector&lt;std::int64_t&gt;&amp; progress, file_progress_flags_t flags = {}) const;
│ │ │ │ -   void <strong>post_file_progress</strong> (file_progress_flags_t flags) const;
│ │ │ │ -   std::vector&lt;std::int64_t&gt; <strong>file_progress</strong> (file_progress_flags_t flags = {}) const;
│ │ │ │ -   std::vector&lt;open_file_state&gt; <strong>file_status</strong> () const;
│ │ │ │ -   void <strong>clear_error</strong> () const;
│ │ │ │ -   void <strong>post_trackers</strong> () const;
│ │ │ │ -   std::vector&lt;announce_entry&gt; <strong>trackers</strong> () const;
│ │ │ │ -   void <strong>add_tracker</strong> (announce_entry const&amp;) const;
│ │ │ │ -   void <strong>replace_trackers</strong> (std::vector&lt;announce_entry&gt; const&amp;) const;
│ │ │ │ -   void <strong>add_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │ -   std::set&lt;std::string&gt; <strong>url_seeds</strong> () const;
│ │ │ │ -   void <strong>remove_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │ -   std::set&lt;std::string&gt; <strong>http_seeds</strong> () const;
│ │ │ │ -   void <strong>add_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │ -   void <strong>remove_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │ -   void <strong>add_extension</strong> (
│ │ │ │ -      std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(torrent_handle const&amp;, client_data_t)&gt; const&amp; ext
│ │ │ │ -      , client_data_t userdata = client_data_t{});
│ │ │ │ -   bool <strong>set_metadata</strong> (span&lt;char const&gt; metadata) const;
│ │ │ │ -   bool <strong>is_valid</strong> () const;
│ │ │ │ -   void <strong>resume</strong> () const;
│ │ │ │ -   void <strong>pause</strong> (pause_flags_t flags = {}) const;
│ │ │ │ -   void <strong>set_flags</strong> (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ -   void <strong>set_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ -   torrent_flags_t <strong>flags</strong> () const;
│ │ │ │ -   void <strong>unset_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ -   void <strong>flush_cache</strong> () const;
│ │ │ │ -   void <strong>force_recheck</strong> () const;
│ │ │ │ -   void <strong>save_resume_data</strong> (resume_data_flags_t flags = {}) const;
│ │ │ │ -   bool <strong>need_save_resume_data</strong> (resume_data_flags_t flags) const;
│ │ │ │ -   bool <strong>need_save_resume_data</strong> () const;
│ │ │ │ -   void <strong>queue_position_up</strong> () const;
│ │ │ │ -   void <strong>queue_position_top</strong> () const;
│ │ │ │ -   void <strong>queue_position_bottom</strong> () const;
│ │ │ │ -   void <strong>queue_position_down</strong> () const;
│ │ │ │ -   queue_position_t <strong>queue_position</strong> () const;
│ │ │ │ -   void <strong>queue_position_set</strong> (queue_position_t p) const;
│ │ │ │ -   void <strong>set_ssl_certificate_buffer</strong> (std::string const&amp; certificate
│ │ │ │ -      , std::string const&amp; private_key
│ │ │ │ -      , std::string const&amp; dh_params);
│ │ │ │ -   void <strong>set_ssl_certificate</strong> (std::string const&amp; certificate
│ │ │ │ -      , std::string const&amp; private_key
│ │ │ │ -      , std::string const&amp; dh_params
│ │ │ │ -      , std::string const&amp; passphrase = &quot;&quot;);
│ │ │ │ -   std::shared_ptr&lt;torrent_info&gt; <strong>torrent_file_with_hashes</strong> () const;
│ │ │ │ -   std::shared_ptr&lt;const torrent_info&gt; <strong>torrent_file</strong> () const;
│ │ │ │ -   std::vector&lt;std::vector&lt;sha256_hash&gt;&gt; <strong>piece_layers</strong> () const;
│ │ │ │ -   void <strong>piece_availability</strong> (std::vector&lt;int&gt;&amp; avail) const;
│ │ │ │ -   void <strong>post_piece_availability</strong> () const;
│ │ │ │ -   std::vector&lt;download_priority_t&gt; <strong>get_piece_priorities</strong> () const;
│ │ │ │ -   void <strong>piece_priority</strong> (piece_index_t index, download_priority_t priority) const;
│ │ │ │ -   download_priority_t <strong>piece_priority</strong> (piece_index_t index) const;
│ │ │ │ -   void <strong>prioritize_pieces</strong> (std::vector&lt;download_priority_t&gt; const&amp; pieces) const;
│ │ │ │ -   void <strong>prioritize_pieces</strong> (std::vector&lt;std::pair&lt;piece_index_t, download_priority_t&gt;&gt; const&amp; pieces) const;
│ │ │ │ -   std::vector&lt;download_priority_t&gt; <strong>get_file_priorities</strong> () const;
│ │ │ │ -   download_priority_t <strong>file_priority</strong> (file_index_t index) const;
│ │ │ │ -   void <strong>prioritize_files</strong> (std::vector&lt;download_priority_t&gt; const&amp; files) const;
│ │ │ │ -   void <strong>file_priority</strong> (file_index_t index, download_priority_t priority) const;
│ │ │ │ -   void <strong>force_reannounce</strong> (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
│ │ │ │ -   void <strong>force_dht_announce</strong> () const;
│ │ │ │ -   void <strong>force_lsd_announce</strong> () const;
│ │ │ │ -   void <strong>scrape_tracker</strong> (int idx = -1) const;
│ │ │ │ -   void <strong>set_download_limit</strong> (int limit) const;
│ │ │ │ -   void <strong>set_upload_limit</strong> (int limit) const;
│ │ │ │ -   int <strong>upload_limit</strong> () const;
│ │ │ │ -   int <strong>download_limit</strong> () const;
│ │ │ │ -   void <strong>connect_peer</strong> (tcp::endpoint const&amp; adr, peer_source_flags_t source = {}
│ │ │ │ -      , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
│ │ │ │ -   void <strong>clear_peers</strong> ();
│ │ │ │ -   void <strong>set_max_uploads</strong> (int max_uploads) const;
│ │ │ │ -   int <strong>max_uploads</strong> () const;
│ │ │ │ -   int <strong>max_connections</strong> () const;
│ │ │ │ -   void <strong>set_max_connections</strong> (int max_connections) const;
│ │ │ │ -   void <strong>move_storage</strong> (std::string const&amp; save_path
│ │ │ │ -      , move_flags_t flags = move_flags_t::always_replace_files
│ │ │ │ -      ) const;
│ │ │ │ -   void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_name) const;
│ │ │ │ -   info_hash_t <strong>info_hashes</strong> () const;
│ │ │ │ -   sha1_hash <strong>info_hash</strong> () const;
│ │ │ │ -   bool <strong>operator!=</strong> (const torrent_handle&amp; h) const;
│ │ │ │ -   bool <strong>operator&lt;</strong> (const torrent_handle&amp; h) const;
│ │ │ │ -   bool <strong>operator==</strong> (const torrent_handle&amp; h) const;
│ │ │ │ -   std::uint32_t <strong>id</strong> () const;
│ │ │ │ -   std::shared_ptr&lt;torrent&gt; <strong>native_handle</strong> () const;
│ │ │ │ -   client_data_t <strong>userdata</strong> () const;
│ │ │ │ -   bool <strong>in_session</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr add_piece_flags_t <strong>overwrite_existing</strong>  = 0_bit;
│ │ │ │ -   static constexpr status_flags_t <strong>query_distributed_copies</strong>  = 0_bit;
│ │ │ │ -   static constexpr status_flags_t <strong>query_accurate_download_counters</strong>  = 1_bit;
│ │ │ │ -   static constexpr status_flags_t <strong>query_last_seen_complete</strong>  = 2_bit;
│ │ │ │ -   static constexpr status_flags_t <strong>query_pieces</strong>  = 3_bit;
│ │ │ │ -   static constexpr status_flags_t <strong>query_verified_pieces</strong>  = 4_bit;
│ │ │ │ -   static constexpr status_flags_t <strong>query_torrent_file</strong>  = 5_bit;
│ │ │ │ -   static constexpr status_flags_t <strong>query_name</strong>  = 6_bit;
│ │ │ │ -   static constexpr status_flags_t <strong>query_save_path</strong>  = 7_bit;
│ │ │ │ -   static constexpr deadline_flags_t <strong>alert_when_available</strong>  = 0_bit;
│ │ │ │ -   static constexpr file_progress_flags_t <strong>piece_granularity</strong>  = 0_bit;
│ │ │ │ -   static constexpr pause_flags_t <strong>graceful_pause</strong>  = 0_bit;
│ │ │ │ -   static constexpr resume_data_flags_t <strong>flush_disk_cache</strong>  = 0_bit;
│ │ │ │ -   static constexpr resume_data_flags_t <strong>save_info_dict</strong>  = 1_bit;
│ │ │ │ -   static constexpr resume_data_flags_t <strong>only_if_modified</strong>  = 2_bit;
│ │ │ │ -   static constexpr resume_data_flags_t <strong>if_counters_changed</strong>  = 3_bit;
│ │ │ │ -   static constexpr resume_data_flags_t <strong>if_download_progress</strong>  = 4_bit;
│ │ │ │ -   static constexpr resume_data_flags_t <strong>if_config_changed</strong>  = 5_bit;
│ │ │ │ -   static constexpr resume_data_flags_t <strong>if_state_changed</strong>  = 6_bit;
│ │ │ │ -   static constexpr resume_data_flags_t <strong>if_metadata_changed</strong>  = 7_bit;
│ │ │ │ -   static constexpr reannounce_flags_t <strong>ignore_min_interval</strong>  = 0_bit;
│ │ │ │ -};
│ │ │ │ +virtual void <strong>on_disconnect</strong> (error_code const&amp;);
│ │ │ │  </pre>
│ │ │ │ -<a name="torrent_handle()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Btorrent_handle%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Btorrent_handle%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="torrent-handle-1">
│ │ │ │ -<h2>torrent_handle()</h2>
│ │ │ │ +<p>called when the peer is being disconnected.</p>
│ │ │ │ +<a name="on_connected()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_connected%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_connected%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-connected">
│ │ │ │ +<h2>on_connected()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -<strong>torrent_handle</strong> () noexcept = default;
│ │ │ │ +virtual void <strong>on_connected</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>constructs a torrent handle that does not refer to a torrent.
│ │ │ │ -i.e. <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a> will return false.</p>
│ │ │ │ -<a name="add_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Badd_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Badd_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-piece">
│ │ │ │ -<h2>add_piece()</h2>
│ │ │ │ +<p>called when the peer is successfully connected. Note that
│ │ │ │ +incoming connections will have been connected by the time
│ │ │ │ +the peer <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> is attached to it, and won't have this hook
│ │ │ │ +called.</p>
│ │ │ │ +<a name="on_handshake()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_handshake%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_handshake%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-handshake">
│ │ │ │ +<h2>on_handshake()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>add_piece</strong> (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
│ │ │ │ -void <strong>add_piece</strong> (piece_index_t piece, std::vector&lt;char&gt; data, add_piece_flags_t flags = {}) const;
│ │ │ │ +virtual bool <strong>on_handshake</strong> (span&lt;char const&gt;);
│ │ │ │  </pre>
│ │ │ │ -<p>This function will write <tt class="docutils literal">data</tt> to the storage as piece <tt class="docutils literal">piece</tt>,
│ │ │ │ -as if it had been downloaded from a peer.</p>
│ │ │ │ -<p>By default, data that's already been downloaded is not overwritten by
│ │ │ │ -this buffer. If you trust this data to be correct (and pass the piece
│ │ │ │ -hash check) you may pass the overwrite_existing flag. This will
│ │ │ │ -instruct libtorrent to overwrite any data that may already have been
│ │ │ │ -downloaded with this data.</p>
│ │ │ │ -<p>Since the data is written asynchronously, you may know that is passed
│ │ │ │ -or failed the hash check by waiting for <a class="reference external" href="reference-Alerts.html#piece_finished_alert">piece_finished_alert</a> or
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#hash_failed_alert">hash_failed_alert</a>.</p>
│ │ │ │ -<p>Adding pieces while the torrent is being checked (i.e. in
│ │ │ │ -<a class="reference external" href="reference-Torrent_Status.html#checking_files">torrent_status::checking_files</a> state) is not supported.</p>
│ │ │ │ -<p>The overload taking a raw pointer to the data is a blocking call. It
│ │ │ │ -won't return until the libtorrent thread has copied the data into its
│ │ │ │ -disk write buffer. <tt class="docutils literal">data</tt> is expected to point to a buffer of as
│ │ │ │ -many bytes as the size of the specified piece. See
│ │ │ │ -<a class="reference external" href="reference-Storage.html#piece_size()">file_storage::piece_size()</a>.</p>
│ │ │ │ -<p>The data in the buffer is copied and passed on to the disk IO thread
│ │ │ │ -to be written at a later point.</p>
│ │ │ │ -<p>The overload taking a <tt class="docutils literal"><span class="pre">std::vector&lt;char&gt;</span></tt> is not blocking, it will
│ │ │ │ -send the buffer to the main thread and return immediately.</p>
│ │ │ │ -<a name="read_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bread_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bread_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="read-piece">
│ │ │ │ -<h2>read_piece()</h2>
│ │ │ │ +<p>this is called when the initial bittorrent handshake is received.
│ │ │ │ +Returning false means that the other end doesn't support this extension
│ │ │ │ +and will remove it from the list of plugins. this is not called for web
│ │ │ │ +seeds</p>
│ │ │ │ +<a name="on_extension_handshake()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_extension_handshake%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_extension_handshake%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-extension-handshake">
│ │ │ │ +<h2>on_extension_handshake()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>read_piece</strong> (piece_index_t piece) const;
│ │ │ │ +virtual bool <strong>on_extension_handshake</strong> (bdecode_node const&amp;);
│ │ │ │  </pre>
│ │ │ │ -<p>This function starts an asynchronous read operation of the specified
│ │ │ │ -piece from this torrent. You must have completed the download of the
│ │ │ │ -specified piece before calling this function.</p>
│ │ │ │ -<p>When the read operation is completed, it is passed back through an
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#alert">alert</a>, <a class="reference external" href="reference-Alerts.html#read_piece_alert">read_piece_alert</a>. Since this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is a response to an explicit
│ │ │ │ -call, it will always be posted, regardless of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
│ │ │ │ -<p>Note that if you read multiple pieces, the read operations are not
│ │ │ │ -guaranteed to finish in the same order as you initiated them.</p>
│ │ │ │ -<a name="have_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bhave_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bhave_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="have-piece">
│ │ │ │ -<h2>have_piece()</h2>
│ │ │ │ +<p>called when the extension handshake from the other end is received
│ │ │ │ +if this returns false, it means that this extension isn't
│ │ │ │ +supported by this peer. It will result in this <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a>
│ │ │ │ +being removed from the peer_connection and destructed.
│ │ │ │ +this is not called for web seeds</p>
│ │ │ │ +<a name="on_have()"></a>
│ │ │ │ +<a name="on_have_all()"></a>
│ │ │ │ +<a name="on_request()"></a>
│ │ │ │ +<a name="on_bitfield()"></a>
│ │ │ │ +<a name="on_not_interested()"></a>
│ │ │ │ +<a name="on_choke()"></a>
│ │ │ │ +<a name="on_allowed_fast()"></a>
│ │ │ │ +<a name="on_have_none()"></a>
│ │ │ │ +<a name="on_unchoke()"></a>
│ │ │ │ +<a name="on_interested()"></a>
│ │ │ │ +<a name="on_dont_have()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_have%28%29+on_have_all%28%29+on_request%28%29+on_bitfield%28%29+on_not_interested%28%29+on_choke%28%29+on_allowed_fast%28%29+on_have_none%28%29+on_unchoke%28%29+on_interested%28%29+on_dont_have%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_have%28%29+on_have_all%28%29+on_request%28%29+on_bitfield%28%29+on_not_interested%28%29+on_choke%28%29+on_allowed_fast%28%29+on_have_none%28%29+on_unchoke%28%29+on_interested%28%29+on_dont_have%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-have-on-have-all-on-request-on-bitfield-on-not-interested-on-choke-on-allowed-fast-on-have-none-on-unchoke-on-interested-on-dont-have">
│ │ │ │ +<h2>on_have() on_have_all() on_request() on_bitfield() on_not_interested() on_choke() on_allowed_fast() on_have_none() on_unchoke() on_interested() on_dont_have()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>have_piece</strong> (piece_index_t piece) const;
│ │ │ │ +virtual bool <strong>on_bitfield</strong> (bitfield const&amp; <em>/*bitfield*/</em>);
│ │ │ │ +virtual bool <strong>on_dont_have</strong> (piece_index_t);
│ │ │ │ +virtual bool <strong>on_allowed_fast</strong> (piece_index_t);
│ │ │ │ +virtual bool <strong>on_have_all</strong> ();
│ │ │ │ +virtual bool <strong>on_choke</strong> ();
│ │ │ │ +virtual bool <strong>on_request</strong> (peer_request const&amp;);
│ │ │ │ +virtual bool <strong>on_have_none</strong> ();
│ │ │ │ +virtual bool <strong>on_have</strong> (piece_index_t);
│ │ │ │ +virtual bool <strong>on_unchoke</strong> ();
│ │ │ │ +virtual bool <strong>on_not_interested</strong> ();
│ │ │ │ +virtual bool <strong>on_interested</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>Returns true if this piece has been completely downloaded and written
│ │ │ │ -to disk, and false otherwise.</p>
│ │ │ │ -<a name="get_peer_info()"></a>
│ │ │ │ -<a name="post_peer_info()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bget_peer_info%28%29+post_peer_info%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bget_peer_info%28%29+post_peer_info%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-peer-info-post-peer-info">
│ │ │ │ -<h2>get_peer_info() post_peer_info()</h2>
│ │ │ │ +<p>returning true from any of the message handlers
│ │ │ │ +indicates that the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> has handled the message.
│ │ │ │ +it will break the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> chain traversing and not let
│ │ │ │ +anyone else handle the message, including the default
│ │ │ │ +handler.</p>
│ │ │ │ +<a name="on_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-piece">
│ │ │ │ +<h2>on_piece()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>get_peer_info</strong> (std::vector&lt;peer_info&gt;&amp; v) const;
│ │ │ │ -void <strong>post_peer_info</strong> () const;
│ │ │ │ +virtual bool <strong>on_piece</strong> (peer_request const&amp; <em>/*piece*/</em>
│ │ │ │ +      , span&lt;char const&gt; <em>/*buf*/</em>);
│ │ │ │  </pre>
│ │ │ │ -<p>Query information about connected peers for this torrent. If the
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is invalid, it will throw a system_error exception.</p>
│ │ │ │ -<p><tt class="docutils literal">post_peer_info()</tt> is asynchronous and will trigger the posting of
│ │ │ │ -a <a class="reference external" href="reference-Alerts.html#peer_info_alert">peer_info_alert</a>. The <a class="reference external" href="reference-Alerts.html#alert">alert</a> contain a list of <a class="reference external" href="reference-Core.html#peer_info">peer_info</a> objects, one
│ │ │ │ -for each connected peer.</p>
│ │ │ │ -<p><tt class="docutils literal">get_peer_info()</tt> is synchronous and takes a reference to a vector
│ │ │ │ -that will be cleared and filled with one <a class="reference external" href="reference-Bencoding.html#entry">entry</a> for each peer
│ │ │ │ -connected to this torrent, given the handle is valid. Each <a class="reference external" href="reference-Bencoding.html#entry">entry</a> in
│ │ │ │ -the vector contains information about that particular peer. See
│ │ │ │ -<a class="reference external" href="reference-Core.html#peer_info">peer_info</a>.</p>
│ │ │ │ -<a name="post_status()"></a>
│ │ │ │ -<a name="status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpost_status%28%29+status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpost_status%28%29+status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="post-status-status">
│ │ │ │ -<h2>post_status() status()</h2>
│ │ │ │ +<p>This function is called when the peer connection is receiving
│ │ │ │ +a piece. <tt class="docutils literal">buf</tt> points (non-owning pointer) to the data in an
│ │ │ │ +internal immutable disk buffer. The length of the data is specified
│ │ │ │ +in the <tt class="docutils literal">length</tt> member of the <tt class="docutils literal">piece</tt> parameter.
│ │ │ │ +returns true to indicate that the piece is handled and the
│ │ │ │ +rest of the logic should be ignored.</p>
│ │ │ │ +<a name="sent_have()"></a>
│ │ │ │ +<a name="sent_interested()"></a>
│ │ │ │ +<a name="sent_not_interested()"></a>
│ │ │ │ +<a name="sent_piece()"></a>
│ │ │ │ +<a name="sent_unchoke()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bsent_have%28%29+sent_interested%28%29+sent_not_interested%28%29+sent_piece%28%29+sent_unchoke%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bsent_have%28%29+sent_interested%28%29+sent_not_interested%28%29+sent_piece%28%29+sent_unchoke%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="sent-have-sent-interested-sent-not-interested-sent-piece-sent-unchoke">
│ │ │ │ +<h2>sent_have() sent_interested() sent_not_interested() sent_piece() sent_unchoke()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -torrent_status <strong>status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ -void <strong>post_status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ +virtual void <strong>sent_have</strong> (piece_index_t);
│ │ │ │ +virtual void <strong>sent_interested</strong> ();
│ │ │ │ +virtual void <strong>sent_unchoke</strong> ();
│ │ │ │ +virtual void <strong>sent_piece</strong> (peer_request const&amp;);
│ │ │ │ +virtual void <strong>sent_not_interested</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">status()</tt> will return a structure with information about the status
│ │ │ │ -of this torrent. If the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is invalid, it will throw
│ │ │ │ -system_error exception. See <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a>. The <tt class="docutils literal">flags</tt>
│ │ │ │ -argument filters what information is returned in the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a>.
│ │ │ │ -Some information in there is relatively expensive to calculate, and if
│ │ │ │ -you're not interested in it (and see performance issues), you can
│ │ │ │ -filter them out.</p>
│ │ │ │ -<p>The <tt class="docutils literal">status()</tt> function will block until the internal libtorrent
│ │ │ │ -thread responds with the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> object. To avoid blocking,
│ │ │ │ -instead call <tt class="docutils literal">post_status()</tt>. It will trigger posting of a
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#state_update_alert">state_update_alert</a> with a single <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> object for this
│ │ │ │ -torrent.</p>
│ │ │ │ -<p>In order to get regular updates for torrents whose status changes,
│ │ │ │ -consider calling session::post_torrent_updates()`` instead.</p>
│ │ │ │ -<p>By default everything is included. The flags you can use to decide
│ │ │ │ -what to <em>include</em> are defined in this class.</p>
│ │ │ │ -<a name="get_download_queue()"></a>
│ │ │ │ -<a name="post_download_queue()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bget_download_queue%28%29+post_download_queue%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bget_download_queue%28%29+post_download_queue%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-download-queue-post-download-queue">
│ │ │ │ -<h2>get_download_queue() post_download_queue()</h2>
│ │ │ │ +<p>called after a choke message has been sent to the peer</p>
│ │ │ │ +<a name="sent_payload()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bsent_payload%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bsent_payload%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="sent-payload">
│ │ │ │ +<h2>sent_payload()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>get_download_queue</strong> (std::vector&lt;partial_piece_info&gt;&amp; queue) const;
│ │ │ │ -void <strong>post_download_queue</strong> () const;
│ │ │ │ -std::vector&lt;partial_piece_info&gt; <strong>get_download_queue</strong> () const;
│ │ │ │ +virtual void <strong>sent_payload</strong> (int <em>/* bytes */</em>);
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">post_download_queue()</tt> triggers a download_queue_alert to be
│ │ │ │ -posted.
│ │ │ │ -<tt class="docutils literal">get_download_queue()</tt> is a synchronous call and returns a vector
│ │ │ │ -with information about pieces that are partially downloaded or not
│ │ │ │ -downloaded but partially requested. See <a class="reference external" href="reference-Torrent_Handle.html#partial_piece_info">partial_piece_info</a> for the
│ │ │ │ -fields in the returned vector.</p>
│ │ │ │ -<a name="clear_piece_deadlines()"></a>
│ │ │ │ -<a name="reset_piece_deadline()"></a>
│ │ │ │ -<a name="set_piece_deadline()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bclear_piece_deadlines%28%29+reset_piece_deadline%28%29+set_piece_deadline%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bclear_piece_deadlines%28%29+reset_piece_deadline%28%29+set_piece_deadline%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="clear-piece-deadlines-reset-piece-deadline-set-piece-deadline">
│ │ │ │ -<h2>clear_piece_deadlines() reset_piece_deadline() set_piece_deadline()</h2>
│ │ │ │ +<p>called after piece data has been sent to the peer
│ │ │ │ +this can be used for stats book keeping</p>
│ │ │ │ +<a name="can_disconnect()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bcan_disconnect%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bcan_disconnect%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="can-disconnect">
│ │ │ │ +<h2>can_disconnect()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>clear_piece_deadlines</strong> () const;
│ │ │ │ -void <strong>set_piece_deadline</strong> (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
│ │ │ │ -void <strong>reset_piece_deadline</strong> (piece_index_t index) const;
│ │ │ │ +virtual bool <strong>can_disconnect</strong> (error_code const&amp; <em>/*ec*/</em>);
│ │ │ │  </pre>
│ │ │ │ -<p>This function sets or resets the deadline associated with a specific
│ │ │ │ -piece index (<tt class="docutils literal">index</tt>). libtorrent will attempt to download this
│ │ │ │ -entire piece before the deadline expires. This is not necessarily
│ │ │ │ -possible, but pieces with a more recent deadline will always be
│ │ │ │ -prioritized over pieces with a deadline further ahead in time. The
│ │ │ │ -deadline (and flags) of a piece can be changed by calling this
│ │ │ │ -function again.</p>
│ │ │ │ -<p>If the piece is already downloaded when this call is made, nothing
│ │ │ │ -happens, unless the alert_when_available flag is set, in which case it
│ │ │ │ -will have the same effect as calling <a class="reference external" href="reference-Torrent_Handle.html#read_piece()">read_piece()</a> for <tt class="docutils literal">index</tt>.</p>
│ │ │ │ -<p><tt class="docutils literal">deadline</tt> is the number of milliseconds until this piece should be
│ │ │ │ -completed.</p>
│ │ │ │ -<p><tt class="docutils literal">reset_piece_deadline</tt> removes the deadline from the piece. If it
│ │ │ │ -hasn't already been downloaded, it will no longer be considered a
│ │ │ │ -priority.</p>
│ │ │ │ -<p><tt class="docutils literal">clear_piece_deadlines()</tt> removes deadlines on all pieces in
│ │ │ │ -the torrent. As if <a class="reference external" href="reference-Torrent_Handle.html#reset_piece_deadline()">reset_piece_deadline()</a> was called on all pieces.</p>
│ │ │ │ -<a name="file_progress()"></a>
│ │ │ │ -<a name="post_file_progress()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bfile_progress%28%29+post_file_progress%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bfile_progress%28%29+post_file_progress%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-progress-post-file-progress">
│ │ │ │ -<h2>file_progress() post_file_progress()</h2>
│ │ │ │ +<p>called when libtorrent think this peer should be disconnected.
│ │ │ │ +if the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> returns false, the peer will not be disconnected.</p>
│ │ │ │ +<a name="on_extended()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_extended%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_extended%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-extended">
│ │ │ │ +<h2>on_extended()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>file_progress</strong> (std::vector&lt;std::int64_t&gt;&amp; progress, file_progress_flags_t flags = {}) const;
│ │ │ │ -void <strong>post_file_progress</strong> (file_progress_flags_t flags) const;
│ │ │ │ -std::vector&lt;std::int64_t&gt; <strong>file_progress</strong> (file_progress_flags_t flags = {}) const;
│ │ │ │ +virtual bool <strong>on_extended</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │ +      span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │  </pre>
│ │ │ │ -<p>This function fills in the supplied vector, or returns a vector, with
│ │ │ │ -the number of bytes downloaded of each file in this torrent. The
│ │ │ │ -progress values are ordered the same as the files in the
│ │ │ │ -<a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>.</p>
│ │ │ │ -<p>This operation is not very cheap. Its complexity is <em>O(n + mj)</em>.
│ │ │ │ -Where <em>n</em> is the number of files, <em>m</em> is the number of currently
│ │ │ │ -downloading pieces and <em>j</em> is the number of blocks in a piece.</p>
│ │ │ │ -<p>The <tt class="docutils literal">flags</tt> parameter can be used to specify the granularity of the
│ │ │ │ -file progress. If left at the default value of 0, the progress will be
│ │ │ │ -as accurate as possible, but also more expensive to calculate. If
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_handle::piece_granularity</span></tt> is specified, the progress will
│ │ │ │ -be specified in piece granularity. i.e. only pieces that have been
│ │ │ │ -fully downloaded and passed the hash check count. When specifying
│ │ │ │ -piece granularity, the operation is a lot cheaper, since libtorrent
│ │ │ │ -already keeps track of this internally and no calculation is required.</p>
│ │ │ │ -<a name="file_status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bfile_status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bfile_status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-status">
│ │ │ │ -<h2>file_status()</h2>
│ │ │ │ +<p>called when an extended message is received. If returning true,
│ │ │ │ +the message is not processed by any other <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> and if false
│ │ │ │ +is returned the next <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> in the chain will receive it to
│ │ │ │ +be able to handle it. This is not called for web seeds.
│ │ │ │ +thus function may be called more than once per incoming message, but
│ │ │ │ +only the last of the calls will the <tt class="docutils literal">body</tt> size equal the <tt class="docutils literal">length</tt>.
│ │ │ │ +i.e. Every time another fragment of the message is received, this
│ │ │ │ +function will be called, until finally the whole message has been
│ │ │ │ +received. The purpose of this is to allow early disconnects for invalid
│ │ │ │ +messages and for reporting progress of receiving large messages.</p>
│ │ │ │ +<a name="on_unknown_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_unknown_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_unknown_message%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-unknown-message">
│ │ │ │ +<h2>on_unknown_message()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::vector&lt;open_file_state&gt; <strong>file_status</strong> () const;
│ │ │ │ +virtual bool <strong>on_unknown_message</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │ +      span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │  </pre>
│ │ │ │ -<p>This function returns a vector with status about files
│ │ │ │ -that are open for this torrent. Any file that is not open
│ │ │ │ -will not be reported in the vector, i.e. it's possible that
│ │ │ │ -the vector is empty when returning, if none of the files in the
│ │ │ │ -torrent are currently open.</p>
│ │ │ │ -<p>See <a class="reference external" href="reference-Custom_Storage.html#open_file_state">open_file_state</a></p>
│ │ │ │ -<a name="clear_error()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bclear_error%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bclear_error%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="clear-error">
│ │ │ │ -<h2>clear_error()</h2>
│ │ │ │ +<p>this is not called for web seeds</p>
│ │ │ │ +<a name="on_piece_pass()"></a>
│ │ │ │ +<a name="on_piece_failed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_piece_pass%28%29+on_piece_failed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_piece_pass%28%29+on_piece_failed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="on-piece-pass-on-piece-failed-1">
│ │ │ │ +<h2>on_piece_pass() on_piece_failed()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>clear_error</strong> () const;
│ │ │ │ +virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │ +virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │  </pre>
│ │ │ │ -<p>If the torrent is in an error state (i.e. <tt class="docutils literal"><span class="pre">torrent_status::error</span></tt> is
│ │ │ │ -non-empty), this will clear the error and start the torrent again.</p>
│ │ │ │ -<a name="add_tracker()"></a>
│ │ │ │ -<a name="replace_trackers()"></a>
│ │ │ │ -<a name="trackers()"></a>
│ │ │ │ -<a name="post_trackers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Badd_tracker%28%29+replace_trackers%28%29+trackers%28%29+post_trackers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Badd_tracker%28%29+replace_trackers%28%29+trackers%28%29+post_trackers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-tracker-replace-trackers-trackers-post-trackers">
│ │ │ │ -<h2>add_tracker() replace_trackers() trackers() post_trackers()</h2>
│ │ │ │ +<p>called when a piece that this peer participated in either
│ │ │ │ +fails or passes the hash_check</p>
│ │ │ │ +<a name="tick()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Btick%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Btick%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="tick-1">
│ │ │ │ +<h2>tick()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>post_trackers</strong> () const;
│ │ │ │ -std::vector&lt;announce_entry&gt; <strong>trackers</strong> () const;
│ │ │ │ -void <strong>add_tracker</strong> (announce_entry const&amp;) const;
│ │ │ │ -void <strong>replace_trackers</strong> (std::vector&lt;announce_entry&gt; const&amp;) const;
│ │ │ │ +virtual void <strong>tick</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">trackers()</tt> returns the list of trackers for this torrent. The
│ │ │ │ -announce <a class="reference external" href="reference-Bencoding.html#entry">entry</a> contains both a string <tt class="docutils literal">url</tt> which specify the
│ │ │ │ -announce url for the tracker as well as an <a class="reference external" href="reference-Core.html#int">int</a> <tt class="docutils literal">tier</tt>, which is
│ │ │ │ -specifies the order in which this tracker is tried. If you want
│ │ │ │ -libtorrent to use another list of trackers for this torrent, you can
│ │ │ │ -use <tt class="docutils literal">replace_trackers()</tt> which takes a list of the same form as the
│ │ │ │ -one returned from <tt class="docutils literal">trackers()</tt> and will replace it. If you want an
│ │ │ │ -immediate effect, you have to call <a class="reference external" href="reference-Torrent_Handle.html#force_reannounce()">force_reannounce()</a>. See
│ │ │ │ -<a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a>.</p>
│ │ │ │ -<p><tt class="docutils literal">post_trackers()</tt> is the asynchronous version of <tt class="docutils literal">trackers()</tt>. It
│ │ │ │ -will trigger a <a class="reference external" href="reference-Alerts.html#tracker_list_alert">tracker_list_alert</a> to be posted.</p>
│ │ │ │ -<p><tt class="docutils literal">add_tracker()</tt> will look if the specified tracker is already in the
│ │ │ │ -set. If it is, it doesn't do anything. If it's not in the current set
│ │ │ │ -of trackers, it will insert it in the tier specified in the
│ │ │ │ -<a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a>.</p>
│ │ │ │ -<p>The updated set of trackers will be saved in the resume data, and when
│ │ │ │ -a torrent is started with resume data, the trackers from the resume
│ │ │ │ -data will replace the original ones.</p>
│ │ │ │ -<a name="url_seeds()"></a>
│ │ │ │ -<a name="remove_url_seed()"></a>
│ │ │ │ -<a name="add_url_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Burl_seeds%28%29+remove_url_seed%28%29+add_url_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Burl_seeds%28%29+remove_url_seed%28%29+add_url_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="url-seeds-remove-url-seed-add-url-seed">
│ │ │ │ -<h2>url_seeds() remove_url_seed() add_url_seed()</h2>
│ │ │ │ +<p>called approximately once every second</p>
│ │ │ │ +<a name="write_request()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bwrite_request%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bwrite_request%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="write-request">
│ │ │ │ +<h2>write_request()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>add_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │ -std::set&lt;std::string&gt; <strong>url_seeds</strong> () const;
│ │ │ │ -void <strong>remove_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +virtual bool <strong>write_request</strong> (peer_request const&amp;);
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">add_url_seed()</tt> adds another url to the torrent's list of url
│ │ │ │ -seeds. If the given url already exists in that list, the call has no
│ │ │ │ -effect. The torrent will connect to the server and try to download
│ │ │ │ -pieces from it, unless it's paused, queued, checking or seeding.
│ │ │ │ -<tt class="docutils literal">remove_url_seed()</tt> removes the given url if it exists already.
│ │ │ │ -<tt class="docutils literal">url_seeds()</tt> return a set of the url seeds currently in this
│ │ │ │ -torrent. Note that URLs that fails may be removed automatically from
│ │ │ │ -the list.</p>
│ │ │ │ -<p>See <a class="reference external" href="manual-ref.html#http-seeding">http seeding</a> for more information.</p>
│ │ │ │ -<a name="add_http_seed()"></a>
│ │ │ │ -<a name="remove_http_seed()"></a>
│ │ │ │ -<a name="http_seeds()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Badd_http_seed%28%29+remove_http_seed%28%29+http_seeds%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Badd_http_seed%28%29+remove_http_seed%28%29+http_seeds%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-http-seed-remove-http-seed-http-seeds">
│ │ │ │ -<h2>add_http_seed() remove_http_seed() http_seeds()</h2>
│ │ │ │ +<p>called each time a request message is to be sent. If true
│ │ │ │ +is returned, the original request message won't be sent and
│ │ │ │ +no other <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> will have this function called.</p>
│ │ │ │ +<a name="crypto_plugin"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+crypto_plugin&labels=documentation&body=Documentation+under+heading+%22class+crypto_plugin%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="crypto-plugin">
│ │ │ │ +<h1>crypto_plugin</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions.hpp">libtorrent/extensions.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::set&lt;std::string&gt; <strong>http_seeds</strong> () const;
│ │ │ │ -void <strong>add_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │ -void <strong>remove_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +struct crypto_plugin
│ │ │ │ +{
│ │ │ │ +   virtual void <strong>set_incoming_key</strong> (span&lt;char const&gt; key) = 0;
│ │ │ │ +   virtual void <strong>set_outgoing_key</strong> (span&lt;char const&gt; key) = 0;
│ │ │ │ +   <strong>encrypt</strong> (span&lt;span&lt;char&gt;&gt; <em>/*send_vec*/</em>) = 0;
│ │ │ │ +   virtual std::tuple&lt;int, int, int&gt; <strong>decrypt</strong> (span&lt;span&lt;char&gt;&gt; <em>/*receive_vec*/</em>) = 0;
│ │ │ │ +};
│ │ │ │  </pre>
│ │ │ │ -<p>These functions are identical as the <tt class="docutils literal">*_url_seed()</tt> variants, but
│ │ │ │ -they operate on <a class="reference external" href="https://www.bittorrent.org/beps/bep_0017.html">BEP 17</a> web seeds instead of <a class="reference external" href="https://www.bittorrent.org/beps/bep_0019.html">BEP 19</a>.</p>
│ │ │ │ -<p>See <a class="reference external" href="manual-ref.html#http-seeding">http seeding</a> for more information.</p>
│ │ │ │ -<a name="add_extension()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Badd_extension%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Badd_extension%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-extension">
│ │ │ │ -<h2>add_extension()</h2>
│ │ │ │ +<a name="decrypt()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:crypto_plugin%3A%3A%5Bdecrypt%28%29%5D&labels=documentation&body=Documentation+under+heading+%22crypto_plugin%3A%3A%5Bdecrypt%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="decrypt">
│ │ │ │ +<h2>decrypt()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>add_extension</strong> (
│ │ │ │ -      std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(torrent_handle const&amp;, client_data_t)&gt; const&amp; ext
│ │ │ │ -      , client_data_t userdata = client_data_t{});
│ │ │ │ +virtual std::tuple&lt;int, int, int&gt; <strong>decrypt</strong> (span&lt;span&lt;char&gt;&gt; <em>/*receive_vec*/</em>) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>add the specified extension to this torrent. The <tt class="docutils literal">ext</tt> argument is
│ │ │ │ -a function that will be called from within libtorrent's context
│ │ │ │ -passing in the internal torrent object and the specified userdata
│ │ │ │ -pointer. The function is expected to return a shared pointer to
│ │ │ │ -a <a class="reference external" href="reference-Plugins.html#torrent_plugin">torrent_plugin</a> instance.</p>
│ │ │ │ -<a name="set_metadata()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_metadata%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_metadata%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-metadata">
│ │ │ │ -<h2>set_metadata()</h2>
│ │ │ │ +<p>decrypt the provided buffers.
│ │ │ │ +returns is a tuple representing the values
│ │ │ │ +(consume, produce, packet_size)</p>
│ │ │ │ +<p>consume is set to the number of bytes which should be trimmed from the
│ │ │ │ +head of the buffers, default is 0</p>
│ │ │ │ +<p>produce is set to the number of bytes of payload which are now ready to
│ │ │ │ +be sent to the upper layer. default is the number of bytes passed in receive_vec</p>
│ │ │ │ +<p>packet_size is set to the minimum number of bytes which must be read to
│ │ │ │ +advance the next step of decryption. default is 0</p>
│ │ │ │ +<a name="create_ut_pex_plugin()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_ut_pex_plugin%28%29&labels=documentation&body=Documentation+under+heading+%22create_ut_pex_plugin%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="create-ut-pex-plugin">
│ │ │ │ +<h1>create_ut_pex_plugin()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions/ut_pex.hpp">libtorrent/extensions/ut_pex.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>set_metadata</strong> (span&lt;char const&gt; metadata) const;
│ │ │ │ +std::shared_ptr&lt;torrent_plugin&gt; <strong>create_ut_pex_plugin</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">set_metadata</tt> expects the <em>info</em> section of metadata. i.e. The
│ │ │ │ -buffer passed in will be hashed and verified against the info-hash. If
│ │ │ │ -it fails, a <tt class="docutils literal">metadata_failed_alert</tt> will be generated. If it passes,
│ │ │ │ -a <tt class="docutils literal">metadata_received_alert</tt> is generated. The function returns true
│ │ │ │ -if the metadata is successfully set on the torrent, and false
│ │ │ │ -otherwise. If the torrent already has metadata, this function will not
│ │ │ │ -affect the torrent, and false will be returned.</p>
│ │ │ │ -<a name="is_valid()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bis_valid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bis_valid%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="is-valid">
│ │ │ │ -<h2>is_valid()</h2>
│ │ │ │ +<p>constructor function for the ut_pex extension. The ut_pex
│ │ │ │ +extension allows peers to gossip about their connections, allowing
│ │ │ │ +the swarm stay well connected and peers aware of more peers in the
│ │ │ │ +swarm. This extension is enabled by default unless explicitly disabled in
│ │ │ │ +the <a class="reference external" href="reference-Session.html#session">session</a> constructor.</p>
│ │ │ │ +<p>This can either be passed in the add_torrent_params::extensions field, or
│ │ │ │ +via <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>.</p>
│ │ │ │ +<a name="create_smart_ban_plugin()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_smart_ban_plugin%28%29&labels=documentation&body=Documentation+under+heading+%22create_smart_ban_plugin%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="create-smart-ban-plugin">
│ │ │ │ +<h1>create_smart_ban_plugin()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions/smart_ban.hpp">libtorrent/extensions/smart_ban.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>is_valid</strong> () const;
│ │ │ │ +std::shared_ptr&lt;torrent_plugin&gt; <strong>create_smart_ban_plugin</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │  </pre>
│ │ │ │ -<p>Returns true if this handle refers to a valid torrent and false if it
│ │ │ │ -hasn't been initialized or if the torrent it refers to has been
│ │ │ │ -removed from the <a class="reference external" href="reference-Session.html#session">session</a> AND destructed.</p>
│ │ │ │ -<p>To tell if the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is in the <a class="reference external" href="reference-Session.html#session">session</a>, use
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#in_session()">torrent_handle::in_session()</a>. This will return true before
│ │ │ │ -<a class="reference external" href="reference-Session.html#remove_torrent()">session_handle::remove_torrent()</a> is called, and false
│ │ │ │ -afterward.</p>
│ │ │ │ -<p>Clients should only use <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a> to determine if the result of
│ │ │ │ -session::find_torrent() was successful.</p>
│ │ │ │ -<p>Unlike other member functions which return a value, <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a>
│ │ │ │ -completes immediately, without blocking on a result from the
│ │ │ │ -network thread. Also unlike other functions, it never throws
│ │ │ │ -the system_error exception.</p>
│ │ │ │ -<a name="resume()"></a>
│ │ │ │ -<a name="pause()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bresume%28%29+pause%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bresume%28%29+pause%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="resume-pause">
│ │ │ │ -<h2>resume() pause()</h2>
│ │ │ │ +<p>constructor function for the smart ban extension. The extension keeps
│ │ │ │ +track of the data peers have sent us for failing pieces and once the
│ │ │ │ +piece completes and passes the hash check bans the peers that turned
│ │ │ │ +out to have sent corrupt data.
│ │ │ │ +This function can either be passed in the add_torrent_params::extensions
│ │ │ │ +field, or via <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>.</p>
│ │ │ │ +<a name="create_ut_metadata_plugin()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_ut_metadata_plugin%28%29&labels=documentation&body=Documentation+under+heading+%22create_ut_metadata_plugin%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="create-ut-metadata-plugin">
│ │ │ │ +<h1>create_ut_metadata_plugin()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions/ut_metadata.hpp">libtorrent/extensions/ut_metadata.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>resume</strong> () const;
│ │ │ │ -void <strong>pause</strong> (pause_flags_t flags = {}) const;
│ │ │ │ +std::shared_ptr&lt;torrent_plugin&gt; <strong>create_ut_metadata_plugin</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">pause()</tt>, and <tt class="docutils literal">resume()</tt> will disconnect all peers and reconnect
│ │ │ │ -all peers respectively. When a torrent is paused, it will however
│ │ │ │ -remember all share ratios to all peers and remember all potential (not
│ │ │ │ -connected) peers. Torrents may be paused automatically if there is a
│ │ │ │ -file error (e.g. disk full) or something similar. See
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#file_error_alert">file_error_alert</a>.</p>
│ │ │ │ -<p>For possible values of the <tt class="docutils literal">flags</tt> parameter, see pause_flags_t.</p>
│ │ │ │ -<p>To know if a torrent is paused or not, call
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_handle::flags()</span></tt> and check for the
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_status::paused</span></tt> flag.</p>
│ │ │ │ +<p>constructor function for the ut_metadata extension. The ut_metadata
│ │ │ │ +extension allows peers to request the .torrent file (or more
│ │ │ │ +specifically the info-dictionary of the .torrent file) from each
│ │ │ │ +other. This is the main building block in making magnet links work.
│ │ │ │ +This extension is enabled by default unless explicitly disabled in
│ │ │ │ +the <a class="reference external" href="reference-Session.html#session">session</a> constructor.</p>
│ │ │ │ +<p>This can either be passed in the add_torrent_params::extensions field, or
│ │ │ │ +via <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>.</p>
│ │ │ │ +<a name="add_torrent_params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+add_torrent_params&labels=documentation&body=Documentation+under+heading+%22class+add_torrent_params%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-torrent-params">
│ │ │ │ +<h1>add_torrent_params</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/add_torrent_params.hpp">libtorrent/add_torrent_params.hpp</a>&quot;</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> contains all the information in a .torrent file
│ │ │ │ +along with all information necessary to add that torrent to a <a class="reference external" href="reference-Session.html#session">session</a>.
│ │ │ │ +The key fields when adding a torrent are:</p>
│ │ │ │ +<ul class="simple">
│ │ │ │ +<li>ti - the immutable info-dict part of the torrent</li>
│ │ │ │ +<li>info_hash - when you don't have the metadata (.torrent file). This
│ │ │ │ +uniquely identifies the torrent and can validate the info-dict when
│ │ │ │ +received from the swarm.</li>
│ │ │ │ +</ul>
│ │ │ │ +<p>In order to add a torrent to a <a class="reference external" href="reference-Session.html#session">session</a>, one of those fields must be set
│ │ │ │ +in addition to <tt class="docutils literal">save_path</tt>. The <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object can then be
│ │ │ │ +passed into one of the <tt class="docutils literal"><span class="pre">session::add_torrent()</span></tt> overloads or
│ │ │ │ +<tt class="docutils literal"><span class="pre">session::async_add_torrent()</span></tt>.</p>
│ │ │ │ +<p>If you only specify the info-hash, the torrent file will be downloaded
│ │ │ │ +from peers, which requires them to support the metadata extension. For
│ │ │ │ +the metadata extension to work, libtorrent must be built with extensions
│ │ │ │ +enabled (<tt class="docutils literal">TORRENT_DISABLE_EXTENSIONS</tt> must not be defined). It also
│ │ │ │ +takes an optional <tt class="docutils literal">name</tt> argument. This may be left empty in case no
│ │ │ │ +name should be assigned to the torrent. In case it's not, the name is
│ │ │ │ +used for the torrent as long as it doesn't have metadata. See
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_handle::name</span></tt>.</p>
│ │ │ │ +<p>The <tt class="docutils literal">add_torrent_params</tt> is also used when requesting resume data for a
│ │ │ │ +torrent. It can be saved to and restored from a file and added back to a
│ │ │ │ +new <a class="reference external" href="reference-Session.html#session">session</a>. For serialization and de-serialization of
│ │ │ │ +<tt class="docutils literal">add_torrent_params</tt> objects, see <a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a> and
│ │ │ │ +<a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a>.</p>
│ │ │ │ +<p>The <tt class="docutils literal">add_torrent_params</tt> is also used to represent a parsed .torrent
│ │ │ │ +file. It can be loaded via <a class="reference external" href="reference-Core.html#load_torrent_file()">load_torrent_file()</a>, <a class="reference external" href="reference-Core.html#load_torrent_buffer()">load_torrent_buffer()</a> and
│ │ │ │ +<a class="reference external" href="reference-Core.html#load_torrent_parsed()">load_torrent_parsed()</a>. It can be saved via <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct add_torrent_params
│ │ │ │ +{
│ │ │ │ +   int <strong>version</strong>  = LIBTORRENT_VERSION_NUM;
│ │ │ │ +   std::shared_ptr&lt;torrent_info&gt; ti;
│ │ │ │ +   aux::noexcept_movable&lt;std::vector&lt;std::string&gt;&gt; trackers;
│ │ │ │ +   aux::noexcept_movable&lt;std::vector&lt;int&gt;&gt; tracker_tiers;
│ │ │ │ +   aux::noexcept_movable&lt;std::vector&lt;std::pair&lt;std::string, int&gt;&gt;&gt; dht_nodes;
│ │ │ │ +   std::string name;
│ │ │ │ +   std::string save_path;
│ │ │ │ +   storage_mode_t <strong>storage_mode</strong>  = storage_mode_sparse;
│ │ │ │ +   client_data_t userdata;
│ │ │ │ +   aux::noexcept_movable&lt;std::vector&lt;download_priority_t&gt;&gt; file_priorities;
│ │ │ │ +   std::string trackerid;
│ │ │ │ +   torrent_flags_t <strong>flags</strong>  = torrent_flags::default_flags;
│ │ │ │ +   info_hash_t info_hashes;
│ │ │ │ +   int <strong>max_uploads</strong>  = -1;
│ │ │ │ +   int <strong>max_connections</strong>  = -1;
│ │ │ │ +   int <strong>upload_limit</strong>  = -1;
│ │ │ │ +   int <strong>download_limit</strong>  = -1;
│ │ │ │ +   std::int64_t <strong>total_uploaded</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>total_downloaded</strong>  = 0;
│ │ │ │ +   int <strong>active_time</strong>  = 0;
│ │ │ │ +   int <strong>finished_time</strong>  = 0;
│ │ │ │ +   int <strong>seeding_time</strong>  = 0;
│ │ │ │ +   std::time_t <strong>added_time</strong>  = 0;
│ │ │ │ +   std::time_t <strong>completed_time</strong>  = 0;
│ │ │ │ +   std::time_t <strong>last_seen_complete</strong>  = 0;
│ │ │ │ +   int <strong>num_complete</strong>  = -1;
│ │ │ │ +   int <strong>num_incomplete</strong>  = -1;
│ │ │ │ +   int <strong>num_downloaded</strong>  = -1;
│ │ │ │ +   aux::noexcept_movable&lt;std::vector&lt;std::string&gt;&gt; http_seeds;
│ │ │ │ +   aux::noexcept_movable&lt;std::vector&lt;std::string&gt;&gt; url_seeds;
│ │ │ │ +   aux::noexcept_movable&lt;std::vector&lt;tcp::endpoint&gt;&gt; peers;
│ │ │ │ +   aux::noexcept_movable&lt;std::vector&lt;tcp::endpoint&gt;&gt; banned_peers;
│ │ │ │ +   aux::noexcept_movable&lt;std::map&lt;piece_index_t, bitfield&gt;&gt; unfinished_pieces;
│ │ │ │ +   typed_bitfield&lt;piece_index_t&gt; have_pieces;
│ │ │ │ +   typed_bitfield&lt;piece_index_t&gt; verified_pieces;
│ │ │ │ +   aux::noexcept_movable&lt;std::vector&lt;download_priority_t&gt;&gt; piece_priorities;
│ │ │ │ +   aux::vector&lt;std::vector&lt;sha256_hash&gt;, file_index_t&gt; merkle_trees;
│ │ │ │ +   aux::vector&lt;std::vector&lt;bool&gt;, file_index_t&gt; merkle_tree_mask;
│ │ │ │ +   aux::vector&lt;std::vector&lt;bool&gt;, file_index_t&gt; verified_leaf_hashes;
│ │ │ │ +   aux::noexcept_movable&lt;std::map&lt;file_index_t, std::string&gt;&gt; renamed_files;
│ │ │ │ +   std::time_t <strong>last_download</strong>  = 0;
│ │ │ │ +   std::time_t <strong>last_upload</strong>  = 0;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>version</dt>
│ │ │ │ +<dd>filled in by the constructor and should be left untouched. It is used
│ │ │ │ +for forward binary compatibility.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="ti"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bti%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bti%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>ti</dt>
│ │ │ │ +<dd><a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object with the torrent to add. Unless the
│ │ │ │ +info_hash is set, this is required to be initialized.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="trackers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Btrackers%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Btrackers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>trackers</dt>
│ │ │ │ +<dd>If the torrent doesn't have a tracker, but relies on the DHT to find
│ │ │ │ +peers, the <tt class="docutils literal">trackers</tt> can specify tracker URLs for the torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="tracker_tiers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Btracker_tiers%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Btracker_tiers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>tracker_tiers</dt>
│ │ │ │ +<dd>the tiers the URLs in <tt class="docutils literal">trackers</tt> belong to. Trackers belonging to
│ │ │ │ +different tiers may be treated differently, as defined by the multi
│ │ │ │ +tracker extension. This is optional, if not specified trackers are
│ │ │ │ +assumed to be part of tier 0, or whichever the last tier was as
│ │ │ │ +iterating over the trackers.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_nodes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bdht_nodes%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bdht_nodes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>dht_nodes</dt>
│ │ │ │ +<dd>a list of hostname and port pairs, representing DHT nodes to be added
│ │ │ │ +to the <a class="reference external" href="reference-Session.html#session">session</a> (if DHT is enabled). The hostname may be an IP address.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="name"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bname%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bname%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>name</dt>
│ │ │ │ +<dd>in case there's no other name in this torrent, this name will be used.
│ │ │ │ +The name out of the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object takes precedence if available.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="save_path"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bsave_path%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bsave_path%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>save_path</dt>
│ │ │ │ +<dd><p class="first">the path where the torrent is or will be stored.</p>
│ │ │ │  <div class="admonition note">
│ │ │ │  <p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">Torrents that are auto-managed may be automatically resumed again. It
│ │ │ │ -does not make sense to pause an auto-managed torrent without making it
│ │ │ │ -not auto-managed first. Torrents are auto-managed by default when added
│ │ │ │ -to the <a class="reference external" href="reference-Session.html#session">session</a>. For more information, see <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</p>
│ │ │ │ +<p class="last">On windows this path (and other paths) are interpreted as UNC
│ │ │ │ +paths. This means they must use backslashes as directory separators
│ │ │ │ +and may not contain the special directories &quot;.&quot; or &quot;..&quot;.</p>
│ │ │ │  </div>
│ │ │ │ -<a name="flags()"></a>
│ │ │ │ -<a name="unset_flags()"></a>
│ │ │ │ -<a name="set_flags()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bflags%28%29+unset_flags%28%29+set_flags%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bflags%28%29+unset_flags%28%29+set_flags%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="flags-unset-flags-set-flags">
│ │ │ │ -<h2>flags() unset_flags() set_flags()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_flags</strong> (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ -void <strong>set_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ -torrent_flags_t <strong>flags</strong> () const;
│ │ │ │ -void <strong>unset_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>sets and gets the torrent state flags. See <a class="reference external" href="reference-Core.html#torrent_flags_t">torrent_flags_t</a>.
│ │ │ │ -The <tt class="docutils literal">set_flags</tt> overload that take a mask will affect all
│ │ │ │ -flags part of the mask, and set their values to what the
│ │ │ │ -<tt class="docutils literal">flags</tt> argument is set to. This allows clearing and
│ │ │ │ -setting flags in a single function call.
│ │ │ │ -The <tt class="docutils literal">set_flags</tt> overload that just takes flags, sets all
│ │ │ │ -the specified flags and leave any other flags unchanged.
│ │ │ │ -<tt class="docutils literal">unset_flags</tt> clears the specified flags, while leaving
│ │ │ │ -any other flags unchanged.</p>
│ │ │ │ -<p>The <cite>seed_mode</cite> flag is special, it can only be cleared once the
│ │ │ │ -torrent has been added, and it can only be set as part of the
│ │ │ │ -<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> flags, when adding the torrent.</p>
│ │ │ │ -<a name="flush_cache()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bflush_cache%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bflush_cache%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="flush-cache">
│ │ │ │ -<h2>flush_cache()</h2>
│ │ │ │ +<p class="last">Setting this to an absolute path performs slightly better than a
│ │ │ │ +relative path.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="storage_mode"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bstorage_mode%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bstorage_mode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>storage_mode</dt>
│ │ │ │ +<dd>One of the values from <a class="reference external" href="reference-Storage.html#storage_mode_t">storage_mode_t</a>. For more information, see
│ │ │ │ +<a class="reference external" href="manual-ref.html#storage-allocation">storage allocation</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="userdata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Buserdata%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Buserdata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>userdata</dt>
│ │ │ │ +<dd>The <tt class="docutils literal">userdata</tt> parameter is optional and will be passed on to the
│ │ │ │ +extension constructor functions, if any
│ │ │ │ +(see <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>). It will also be stored in the
│ │ │ │ +torrent object and can be retrieved by calling <a class="reference external" href="reference-Torrent_Handle.html#userdata()">userdata()</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_priorities"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bfile_priorities%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bfile_priorities%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>file_priorities</dt>
│ │ │ │ +<dd>can be set to control the initial file priorities when adding a
│ │ │ │ +torrent. The semantics are the same as for
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_handle::prioritize_files()</span></tt>. The file priorities specified
│ │ │ │ +in here take precedence over those specified in the resume data, if
│ │ │ │ +any.
│ │ │ │ +If this vector of file priorities is shorter than the number of files
│ │ │ │ +in the torrent, the remaining files (not covered by this) will still
│ │ │ │ +have the default download priority. This default can be changed by
│ │ │ │ +setting the default_dont_download torrent_flag.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="trackerid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Btrackerid%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Btrackerid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>trackerid</dt>
│ │ │ │ +<dd>the default tracker id to be used when announcing to trackers. By
│ │ │ │ +default this is empty, and no tracker ID is used, since this is an
│ │ │ │ +optional argument. If a tracker returns a tracker ID, that ID is used
│ │ │ │ +instead of this.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bflags%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bflags%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>flags</dt>
│ │ │ │ +<dd><p class="first">flags controlling aspects of this torrent and how it's added. See
│ │ │ │ +<a class="reference external" href="reference-Core.html#torrent_flags_t">torrent_flags_t</a> for details.</p>
│ │ │ │ +<div class="admonition note last">
│ │ │ │ +<p class="first admonition-title">Note</p>
│ │ │ │ +<p class="last">The <tt class="docutils literal">flags</tt> field is initialized with default flags by the
│ │ │ │ +constructor. In order to preserve default behavior when clearing or
│ │ │ │ +setting other flags, make sure to bitwise OR or in a flag or bitwise
│ │ │ │ +AND the inverse of a flag to clear it.</p>
│ │ │ │ +</div>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>info_hashes</dt>
│ │ │ │ +<dd>set this to the info hash of the torrent to add in case the info-hash
│ │ │ │ +is the only known property of the torrent. i.e. you don't have a
│ │ │ │ +.torrent file nor a magnet link.
│ │ │ │ +To add a magnet link, use <a class="reference external" href="reference-Core.html#parse_magnet_uri()">parse_magnet_uri()</a> to populate fields in the
│ │ │ │ +<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="max_uploads"></a>
│ │ │ │ +<a name="max_connections"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bmax_uploads+max_connections%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bmax_uploads+max_connections%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>max_uploads max_connections</dt>
│ │ │ │ +<dd><p class="first"><tt class="docutils literal">max_uploads</tt>, <tt class="docutils literal">max_connections</tt>, <tt class="docutils literal">upload_limit</tt>,
│ │ │ │ +<tt class="docutils literal">download_limit</tt> correspond to the <tt class="docutils literal">set_max_uploads()</tt>,
│ │ │ │ +<tt class="docutils literal">set_max_connections()</tt>, <tt class="docutils literal">set_upload_limit()</tt> and
│ │ │ │ +<tt class="docutils literal">set_download_limit()</tt> functions on <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>. These values let
│ │ │ │ +you initialize these settings when the torrent is added, instead of
│ │ │ │ +calling these functions immediately following adding it.</p>
│ │ │ │ +<p>-1 means unlimited on these settings just like their counterpart
│ │ │ │ +functions on <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a></p>
│ │ │ │ +<p class="last">For fine grained control over rate limits, including making them apply
│ │ │ │ +to local peers, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="upload_limit"></a>
│ │ │ │ +<a name="download_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bupload_limit+download_limit%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bupload_limit+download_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>upload_limit download_limit</dt>
│ │ │ │ +<dd>the upload and download rate limits for this torrent, specified in
│ │ │ │ +bytes per second. -1 means unlimited.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="total_uploaded"></a>
│ │ │ │ +<a name="total_downloaded"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Btotal_uploaded+total_downloaded%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Btotal_uploaded+total_downloaded%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>total_uploaded total_downloaded</dt>
│ │ │ │ +<dd>the total number of bytes uploaded and downloaded by this torrent so
│ │ │ │ +far.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="active_time"></a>
│ │ │ │ +<a name="finished_time"></a>
│ │ │ │ +<a name="seeding_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bactive_time+finished_time+seeding_time%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bactive_time+finished_time+seeding_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>active_time finished_time seeding_time</dt>
│ │ │ │ +<dd>the number of seconds this torrent has spent in started, finished and
│ │ │ │ +seeding state so far, respectively.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="added_time"></a>
│ │ │ │ +<a name="completed_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Badded_time+completed_time%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Badded_time+completed_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>added_time completed_time</dt>
│ │ │ │ +<dd>if set to a non-zero value, this is the posix time of when this torrent
│ │ │ │ +was first added, including previous runs/sessions. If set to zero, the
│ │ │ │ +internal added_time will be set to the time of when <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> is
│ │ │ │ +called.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="last_seen_complete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Blast_seen_complete%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Blast_seen_complete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>last_seen_complete</dt>
│ │ │ │ +<dd>if set to non-zero, initializes the time (expressed in posix time) when
│ │ │ │ +we last saw a seed or peers that together formed a complete copy of the
│ │ │ │ +torrent. If left set to zero, the internal counterpart to this field
│ │ │ │ +will be updated when we see a seed or a distributed copies &gt;= 1.0.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_complete"></a>
│ │ │ │ +<a name="num_incomplete"></a>
│ │ │ │ +<a name="num_downloaded"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bnum_complete+num_incomplete+num_downloaded%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bnum_complete+num_incomplete+num_downloaded%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_complete num_incomplete num_downloaded</dt>
│ │ │ │ +<dd><p class="first">these field can be used to initialize the torrent's cached scrape data.
│ │ │ │ +The scrape data is high level metadata about the current state of the
│ │ │ │ +swarm, as returned by the tracker (either when announcing to it or by
│ │ │ │ +sending a specific scrape request). <tt class="docutils literal">num_complete</tt> is the number of
│ │ │ │ +peers in the swarm that are seeds, or have every piece in the torrent.
│ │ │ │ +<tt class="docutils literal">num_incomplete</tt> is the number of peers in the swarm that do not have
│ │ │ │ +every piece. <tt class="docutils literal">num_downloaded</tt> is the number of times the torrent has
│ │ │ │ +been downloaded (not initiated, but the number of times a download has
│ │ │ │ +completed).</p>
│ │ │ │ +<p class="last">Leaving any of these values set to -1 indicates we don't know, or we
│ │ │ │ +have not received any scrape data.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="http_seeds"></a>
│ │ │ │ +<a name="url_seeds"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bhttp_seeds+url_seeds%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bhttp_seeds+url_seeds%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>http_seeds url_seeds</dt>
│ │ │ │ +<dd><p class="first">URLs can be added to these two lists to specify additional web
│ │ │ │ +seeds to be used by the torrent. If the <tt class="docutils literal">flag_override_web_seeds</tt>
│ │ │ │ +is set, these will be the _only_ ones to be used. i.e. any web seeds
│ │ │ │ +found in the .torrent file will be overridden.</p>
│ │ │ │ +<p>http_seeds expects URLs to web servers implementing the original HTTP
│ │ │ │ +seed specification <a class="reference external" href="https://www.bittorrent.org/beps/bep_0017.html">BEP 17</a>.</p>
│ │ │ │ +<p class="last">url_seeds expects URLs to regular web servers, aka &quot;get right&quot; style,
│ │ │ │ +specified in <a class="reference external" href="https://www.bittorrent.org/beps/bep_0019.html">BEP 19</a>.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bpeers%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bpeers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>peers</dt>
│ │ │ │ +<dd>peers to add to the torrent, to be tried to be connected to as
│ │ │ │ +bittorrent peers.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="banned_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bbanned_peers%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bbanned_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>banned_peers</dt>
│ │ │ │ +<dd>peers banned from this torrent. The will not be connected to</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="unfinished_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bunfinished_pieces%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bunfinished_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>unfinished_pieces</dt>
│ │ │ │ +<dd>this is a map of partially downloaded piece. The key is the piece index
│ │ │ │ +and the value is a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> where each bit represents a 16 kiB block.
│ │ │ │ +A set bit means we have that block.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="have_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bhave_pieces%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bhave_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>have_pieces</dt>
│ │ │ │ +<dd>this is a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> indicating which pieces we already have of this
│ │ │ │ +torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="verified_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bverified_pieces%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bverified_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>verified_pieces</dt>
│ │ │ │ +<dd>when in seed_mode, pieces with a set bit in this <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> have been
│ │ │ │ +verified to be valid. Other pieces will be verified the first time a
│ │ │ │ +peer requests it.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="piece_priorities"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bpiece_priorities%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bpiece_priorities%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>piece_priorities</dt>
│ │ │ │ +<dd>this sets the priorities for each individual piece in the torrent. Each
│ │ │ │ +element in the vector represent the piece with the same index. If you
│ │ │ │ +set both file- and piece priorities, file priorities will take
│ │ │ │ +precedence.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="merkle_trees"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bmerkle_trees%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bmerkle_trees%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>merkle_trees</dt>
│ │ │ │ +<dd>v2 hashes, if known</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="merkle_tree_mask"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bmerkle_tree_mask%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bmerkle_tree_mask%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>merkle_tree_mask</dt>
│ │ │ │ +<dd>if set, indicates which hashes are included in the corresponding
│ │ │ │ +vector of <tt class="docutils literal">merkle_trees</tt>. These bitmasks always cover the full
│ │ │ │ +tree, a cleared bit means the hash is all zeros (i.e. not set) and
│ │ │ │ +set bit means the next hash in the corresponding vector in
│ │ │ │ +<tt class="docutils literal">merkle_trees</tt> is the hash for that node. This is an optimization
│ │ │ │ +to avoid storing a lot of zeros.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="verified_leaf_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bverified_leaf_hashes%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bverified_leaf_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>verified_leaf_hashes</dt>
│ │ │ │ +<dd>bit-fields indicating which v2 leaf hashes have been verified
│ │ │ │ +against the root hash. If this vector is empty and merkle_trees is
│ │ │ │ +non-empty it implies that all hashes in merkle_trees are verified.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="renamed_files"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Brenamed_files%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Brenamed_files%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>renamed_files</dt>
│ │ │ │ +<dd>this is a map of file indices in the torrent and new filenames to be
│ │ │ │ +applied before the torrent is added.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="last_download"></a>
│ │ │ │ +<a name="last_upload"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Blast_download+last_upload%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Blast_download+last_upload%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>last_download last_upload</dt>
│ │ │ │ +<dd>the posix time of the last time payload was received or sent for this
│ │ │ │ +torrent, respectively. A value of 0 means we don't know when we last
│ │ │ │ +uploaded or downloaded, or we have never uploaded or downloaded any
│ │ │ │ +payload for this torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="client_data_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+client_data_t&labels=documentation&body=Documentation+under+heading+%22class+client_data_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="client-data-t">
│ │ │ │ +<h1>client_data_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/client_data.hpp">libtorrent/client_data.hpp</a>&quot;</p>
│ │ │ │ +<p>A thin wrapper around a void pointer used as &quot;user data&quot;. i.e. an opaque
│ │ │ │ +cookie passed in to libtorrent and returned on demand. It adds type-safety by
│ │ │ │ +requiring the same type be requested out of it as was assigned to it.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>flush_cache</strong> () const;
│ │ │ │ +struct client_data_t
│ │ │ │ +{
│ │ │ │ +   <strong>client_data_t</strong> () = default;
│ │ │ │ +   explicit <strong>client_data_t</strong> (T* v);
│ │ │ │ +   client_data_t&amp; <strong>operator=</strong> (T* v);
│ │ │ │ +   explicit operator <strong>T</strong> () const;
│ │ │ │ +   T* <strong>get</strong> () const;
│ │ │ │ +   operator <strong>void*</strong> () const = delete;
│ │ │ │ +   client_data_t&amp; <strong>operator=</strong> (void const*) = delete;
│ │ │ │ +   client_data_t&amp; <strong>operator=</strong> (void*) = delete;
│ │ │ │ +   operator void <strong>const*</strong> () const = delete;
│ │ │ │ +
│ │ │ │ +   template &lt;typename T, typename <strong>U</strong>  = typename std::enable_if&lt;std::is_pointer&lt;T&gt;::value&gt;::type&gt;
│ │ │ │ +};
│ │ │ │  </pre>
│ │ │ │ -<p>Instructs libtorrent to flush all the disk caches for this torrent and
│ │ │ │ -close all file handles. This is done asynchronously and you will be
│ │ │ │ -notified that it's complete through <a class="reference external" href="reference-Alerts.html#cache_flushed_alert">cache_flushed_alert</a>.</p>
│ │ │ │ -<p>Note that by the time you get the <a class="reference external" href="reference-Alerts.html#alert">alert</a>, libtorrent may have cached
│ │ │ │ -more data for the torrent, but you are guaranteed that whatever cached
│ │ │ │ -data libtorrent had by the time you called
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_handle::flush_cache()</span></tt> has been written to disk.</p>
│ │ │ │ -<a name="force_recheck()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bforce_recheck%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bforce_recheck%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="force-recheck">
│ │ │ │ -<h2>force_recheck()</h2>
│ │ │ │ +<a name="client_data_t()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:client_data_t%3A%3A%5Bclient_data_t%28%29%5D&labels=documentation&body=Documentation+under+heading+%22client_data_t%3A%3A%5Bclient_data_t%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="client-data-t-1">
│ │ │ │ +<h2>client_data_t()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>force_recheck</strong> () const;
│ │ │ │ +<strong>client_data_t</strong> () = default;
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">force_recheck</tt> puts the torrent back in a state where it assumes to
│ │ │ │ -have no resume data. All peers will be disconnected and the torrent
│ │ │ │ -will stop announcing to the tracker. The torrent will be added to the
│ │ │ │ -checking queue, and will be checked (all the files will be read and
│ │ │ │ -compared to the piece hashes). Once the check is complete, the torrent
│ │ │ │ -will start connecting to peers again, as normal.
│ │ │ │ -The torrent will be placed last in queue, i.e. its queue position
│ │ │ │ -will be the highest of all torrents in the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │ -<a name="save_resume_data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bsave_resume_data%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bsave_resume_data%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="save-resume-data">
│ │ │ │ -<h2>save_resume_data()</h2>
│ │ │ │ +<p>construct a nullptr client data</p>
│ │ │ │ +<a name="operator=()"></a>
│ │ │ │ +<a name="const*()"></a>
│ │ │ │ +<a name="void*()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:client_data_t%3A%3A%5Boperator%3D%28%29+const%2A%28%29+void%2A%28%29%5D&labels=documentation&body=Documentation+under+heading+%22client_data_t%3A%3A%5Boperator%3D%28%29+const%2A%28%29+void%2A%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="operator-const-void">
│ │ │ │ +<h2>operator=() const*() void*()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>save_resume_data</strong> (resume_data_flags_t flags = {}) const;
│ │ │ │ +operator <strong>void*</strong> () const = delete;
│ │ │ │ +client_data_t&amp; <strong>operator=</strong> (void const*) = delete;
│ │ │ │ +client_data_t&amp; <strong>operator=</strong> (void*) = delete;
│ │ │ │ +operator void <strong>const*</strong> () const = delete;
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">save_resume_data()</tt> asks libtorrent to generate fast-resume data for
│ │ │ │ -this torrent. The fast resume data (stored in an <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>
│ │ │ │ -object) can be used to resume a torrent in the next <a class="reference external" href="reference-Session.html#session">session</a> without
│ │ │ │ -having to check all files for which pieces have been downloaded. It
│ │ │ │ -can also be used to save a .torrent file for a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>.</p>
│ │ │ │ -<p>This operation is asynchronous, <tt class="docutils literal">save_resume_data</tt> will return
│ │ │ │ -immediately. The resume data is delivered when it's done through a
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a>.</p>
│ │ │ │ -<p>The operation will fail, and post a <a class="reference external" href="reference-Alerts.html#save_resume_data_failed_alert">save_resume_data_failed_alert</a>
│ │ │ │ -instead, in the following cases:</p>
│ │ │ │ -<blockquote>
│ │ │ │ -<ol class="arabic simple">
│ │ │ │ -<li>The torrent is in the process of being removed.</li>
│ │ │ │ -<li>No torrent state has changed since the last saving of resume
│ │ │ │ -data, and the only_if_modified flag is set.
│ │ │ │ -metadata (see libtorrent's <a class="reference external" href="manual-ref.html#metadata-from-peers">metadata from peers</a> extension)</li>
│ │ │ │ -</ol>
│ │ │ │ -</blockquote>
│ │ │ │ -<p>Note that some <a class="reference external" href="reference-Stats.html#counters">counters</a> may be outdated by the time you receive the fast resume data</p>
│ │ │ │ -<p>When saving resume data because of shutting down, make sure not to
│ │ │ │ -<a class="reference external" href="reference-Custom_Storage.html#remove_torrent()">remove_torrent()</a> before you receive the <a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a>.
│ │ │ │ -There's no need to pause the <a class="reference external" href="reference-Session.html#session">session</a> or torrent when saving resume
│ │ │ │ -data.</p>
│ │ │ │ -<p>The paused state of a torrent is saved in the resume data, so pausing
│ │ │ │ -all torrents before saving resume data will all torrents be restored
│ │ │ │ -in a paused state.</p>
│ │ │ │ -<div class="admonition note">
│ │ │ │ -<p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">It is typically a good idea to save resume data whenever a torrent
│ │ │ │ -is completed or paused. If you save resume data for torrents when they are
│ │ │ │ -paused, you can accelerate the shutdown process by not saving resume
│ │ │ │ -data again for those torrents. Completed torrents should have their
│ │ │ │ -resume data saved when they complete and on exit, since their
│ │ │ │ -statistics might be updated.</p>
│ │ │ │ -</div>
│ │ │ │ -<p>Example code to pause and save resume data for all torrents and wait
│ │ │ │ -for the alerts:</p>
│ │ │ │ +<p>we don't allow type-unsafe operations</p>
│ │ │ │ +<p>The disk I/O can be customized in libtorrent. In previous versions, the
│ │ │ │ +customization was at the level of each torrent. Now, the customization point
│ │ │ │ +is at the <a class="reference external" href="reference-Session.html#session">session</a> level. All torrents added to a <a class="reference external" href="reference-Session.html#session">session</a> will use the same
│ │ │ │ +disk I/O subsystem, as determined by the disk_io_constructor (in
│ │ │ │ +<a class="reference external" href="reference-Session.html#session_params">session_params</a>).</p>
│ │ │ │ +<p>This allows the disk subsystem to also customize threading and disk job
│ │ │ │ +management.</p>
│ │ │ │ +<p>To customize the disk subsystem, implement <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a> and provide a
│ │ │ │ +factory function to the <a class="reference external" href="reference-Session.html#session">session</a> constructor (via <a class="reference external" href="reference-Session.html#session_params">session_params</a>).</p>
│ │ │ │ +<p>Example use:</p>
│ │ │ │  <pre class="code c++ literal-block">
│ │ │ │ -<span class="keyword">extern</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="name">outstanding_resume_data</span><span class="punctuation">;</span><span class="whitespace"> </span><span class="comment single">// global counter of outstanding resume data
│ │ │ │ -</span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">torrent_handle</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handles</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">get_torrents</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ -</span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">torrent_handle</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">h</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">handles</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">try</span><span class="whitespace">
│ │ │ │ +<span class="keyword">struct</span><span class="whitespace"> </span><span class="name class">temp_storage</span><span class="whitespace">
│ │ │ │  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -        </span><span class="name">h</span><span class="punctuation">.</span><span class="name">save_resume_data</span><span class="punctuation">(</span><span class="name">torrent_handle</span><span class="operator">::</span><span class="name">only_if_modified</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -        </span><span class="operator">++</span><span class="name">outstanding_resume_data</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -</span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ -</span><span class="keyword">catch</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">system_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">e</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword">explicit</span><span class="whitespace"> </span><span class="name">temp_storage</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">file_storage</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">fs</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">(</span><span class="name">fs</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">readv</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">peer_request</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">auto</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">i</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">find</span><span class="punctuation">(</span><span class="name">r</span><span class="punctuation">.</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">i</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">end</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">operation</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">operation_t</span><span class="operator">::</span><span class="name">file_read</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">ec</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">boost</span><span class="operator">::</span><span class="name">asio</span><span class="operator">::</span><span class="name">error</span><span class="operator">::</span><span class="name">eof</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{};</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="keyword type">int</span><span class="punctuation">(</span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="operator">&lt;=</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">start</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">operation</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">operation_t</span><span class="operator">::</span><span class="name">file_read</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">ec</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">boost</span><span class="operator">::</span><span class="name">asio</span><span class="operator">::</span><span class="name">error</span><span class="operator">::</span><span class="name">eof</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{};</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace"> </span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">start</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">min</span><span class="punctuation">(</span><span class="name">r</span><span class="punctuation">.</span><span class="name">length</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="punctuation">(</span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">start</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">};</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">writev</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">b</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">auto</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">data</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">[</span><span class="name">piece</span><span class="punctuation">];</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">data</span><span class="punctuation">.</span><span class="name">empty</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="comment single">// allocate the whole piece, otherwise we'll invalidate the pointers
│ │ │ │ +</span><span class="whitespace">      </span><span class="comment single">// we have returned back to libtorrent
│ │ │ │ +</span><span class="whitespace">      </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">size</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">piece_size</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">data</span><span class="punctuation">.</span><span class="name">resize</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="keyword type">size_t</span><span class="punctuation">(</span><span class="name">size</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">TORRENT_ASSERT</span><span class="punctuation">(</span><span class="name">offset</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">b</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">&lt;=</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="punctuation">(</span><span class="name">data</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">()));</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">std</span><span class="operator">::</span><span class="name">memcpy</span><span class="punctuation">(</span><span class="name">data</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">b</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="keyword type">size_t</span><span class="punctuation">(</span><span class="name">b</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">()));</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha1_hash</span><span class="whitespace"> </span><span class="name">hash</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">sha256_hash</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">block_hashes</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">auto</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">i</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">find</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">i</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">end</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">operation</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">operation_t</span><span class="operator">::</span><span class="name">file_read</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">ec</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">boost</span><span class="operator">::</span><span class="name">asio</span><span class="operator">::</span><span class="name">error</span><span class="operator">::</span><span class="name">eof</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{};</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="operator">!</span><span class="name">block_hashes</span><span class="punctuation">.</span><span class="name">empty</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece_size2</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_size2</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">blocks_in_piece2</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">blocks_in_piece2</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">buf</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">std</span><span class="operator">::</span><span class="keyword type">int64_t</span><span class="whitespace"> </span><span class="name">offset</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="literal number integer">0</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="keyword type">int</span><span class="whitespace"> </span><span class="name">k</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="literal number integer">0</span><span class="punctuation">;</span><span class="whitespace"> </span><span class="name">k</span><span class="whitespace"> </span><span class="operator">&lt;</span><span class="whitespace"> </span><span class="name">blocks_in_piece2</span><span class="punctuation">;</span><span class="whitespace"> </span><span class="operator">++</span><span class="name">k</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +      </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">lt</span><span class="operator">::</span><span class="name">hasher256</span><span class="whitespace"> </span><span class="name">h2</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">std</span><span class="operator">::</span><span class="keyword type">ptrdiff_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">len2</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">min</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">default_block_size</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="punctuation">(</span><span class="name">piece_size2</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">h2</span><span class="punctuation">.</span><span class="name">update</span><span class="punctuation">({</span><span class="whitespace"> </span><span class="name">buf</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">len2</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">buf</span><span class="whitespace"> </span><span class="operator">+=</span><span class="whitespace"> </span><span class="name">len2</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">offset</span><span class="whitespace"> </span><span class="operator">+=</span><span class="whitespace"> </span><span class="name">len2</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">block_hashes</span><span class="punctuation">[</span><span class="name">k</span><span class="punctuation">]</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">h2</span><span class="punctuation">.</span><span class="keyword">final</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +      </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">hasher</span><span class="punctuation">(</span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">).</span><span class="keyword">final</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha256_hash</span><span class="whitespace"> </span><span class="name">hash2</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">auto</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">i</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">find</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">i</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">.</span><span class="name">end</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">operation</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">operation_t</span><span class="operator">::</span><span class="name">file_read</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">ec</span><span class="punctuation">.</span><span class="name">ec</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">boost</span><span class="operator">::</span><span class="name">asio</span><span class="operator">::</span><span class="name">error</span><span class="operator">::</span><span class="name">eof</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +      </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{};</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece_size</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_size2</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="name">std</span><span class="operator">::</span><span class="keyword type">ptrdiff_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">len</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">min</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">default_block_size</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">piece_size</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">b</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">len</span><span class="punctuation">};</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">hasher256</span><span class="punctuation">(</span><span class="name">b</span><span class="punctuation">).</span><span class="keyword">final</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="keyword">private</span><span class="operator">:</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="name">piece_size</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="name">piece</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">num_pieces</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="keyword type">int</span><span class="operator">&gt;</span><span class="punctuation">((</span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">total_size</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_length</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="operator">/</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_length</span><span class="punctuation">());</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="keyword type">int</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="operator">&lt;</span><span class="whitespace"> </span><span class="name">num_pieces</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="whitespace">
│ │ │ │ +      </span><span class="operator">?</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_length</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="keyword type">int</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">total_size</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="keyword type">int64_t</span><span class="punctuation">(</span><span class="name">num_pieces</span><span class="whitespace"> </span><span class="operator">-</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="operator">*</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">.</span><span class="name">piece_length</span><span class="punctuation">());</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_storage</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">m_files</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">std</span><span class="operator">::</span><span class="name">map</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;&gt;</span><span class="whitespace"> </span><span class="name">m_file_data</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">};</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="name function">pop</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="operator">&gt;&amp;</span><span class="whitespace"> </span><span class="name">q</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -        </span><span class="comment single">// the handle was invalid, ignore this one and move to the next
│ │ │ │ +  </span><span class="name">TORRENT_ASSERT</span><span class="punctuation">(</span><span class="operator">!</span><span class="name">q</span><span class="punctuation">.</span><span class="name">empty</span><span class="punctuation">());</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">ret</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">q</span><span class="punctuation">.</span><span class="name">back</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">q</span><span class="punctuation">.</span><span class="name">pop_back</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name">ret</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │  
│ │ │ │ -</span><span class="keyword">while</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">outstanding_resume_data</span><span class="whitespace"> </span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="literal number integer">0</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +</span><span class="keyword">struct</span><span class="whitespace"> </span><span class="name class">temp_disk_io</span><span class="whitespace"> </span><span class="keyword">final</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_interface</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">buffer_allocator_interface</span><span class="whitespace">
│ │ │ │  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -        </span><span class="name">alert</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">a</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">wait_for_alert</span><span class="punctuation">(</span><span class="name">seconds</span><span class="punctuation">(</span><span class="literal number integer">30</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ -
│ │ │ │ -        </span><span class="comment single">// if we don't get an alert within 30 seconds, abort
│ │ │ │ -</span><span class="whitespace">        </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">a</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="keyword">nullptr</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -
│ │ │ │ -        </span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">alert</span><span class="operator">*&gt;</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -        </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">pop_alerts</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">alerts</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword">explicit</span><span class="whitespace"> </span><span class="name">temp_disk_io</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">io_context</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">ioc</span><span class="punctuation">)</span><span class="operator">:</span><span class="whitespace"> </span><span class="name">m_ioc</span><span class="punctuation">(</span><span class="name">ioc</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │  
│ │ │ │ -        </span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">alert</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">i</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ -        </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -                </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">alert_cast</span><span class="operator">&lt;</span><span class="name">save_resume_data_failed_alert</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">i</span><span class="punctuation">))</span><span class="whitespace">
│ │ │ │ -                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -                        </span><span class="name">process_alert</span><span class="punctuation">(</span><span class="name">i</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -                        </span><span class="operator">--</span><span class="name">outstanding_resume_data</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -                        </span><span class="keyword">continue</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">settings_updated</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │  
│ │ │ │ -                </span><span class="name">save_resume_data_alert</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">rd</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">alert_cast</span><span class="operator">&lt;</span><span class="name">save_resume_data_alert</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">i</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -                </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">rd</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="keyword">nullptr</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ -                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -                        </span><span class="name">process_alert</span><span class="punctuation">(</span><span class="name">i</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -                        </span><span class="keyword">continue</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_holder</span><span class="whitespace"> </span><span class="name">new_torrent</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_params</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">params</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">idx</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_free_slots</span><span class="punctuation">.</span><span class="name">empty</span><span class="punctuation">()</span><span class="whitespace">
│ │ │ │ +      </span><span class="operator">?</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">.</span><span class="name">end_index</span><span class="punctuation">()</span><span class="whitespace">
│ │ │ │ +      </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">pop</span><span class="punctuation">(</span><span class="name">m_free_slots</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">auto</span><span class="whitespace"> </span><span class="name">storage</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">make_unique</span><span class="operator">&lt;</span><span class="name">temp_storage</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">params</span><span class="punctuation">.</span><span class="name">files</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">idx</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">.</span><span class="name">end_index</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">.</span><span class="name">emplace_back</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">move</span><span class="punctuation">(</span><span class="name">storage</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">else</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">idx</span><span class="punctuation">]</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">move</span><span class="punctuation">(</span><span class="name">storage</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_holder</span><span class="punctuation">(</span><span class="name">idx</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="operator">*</span><span class="keyword">this</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">remove_torrent</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">idx</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">idx</span><span class="punctuation">].</span><span class="name">reset</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">m_free_slots</span><span class="punctuation">.</span><span class="name">push_back</span><span class="punctuation">(</span><span class="name">idx</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">abort</span><span class="punctuation">(</span><span class="keyword type">bool</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_read</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="name">storage</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">peer_request</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">r</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_buffer_holder</span><span class="whitespace"> </span><span class="name">block</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">se</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_job_flags_t</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="comment single">// this buffer is owned by the storage. It will remain valid for as
│ │ │ │ +</span><span class="whitespace">    </span><span class="comment single">// long as the torrent remains in the session. We don't need any lifetime
│ │ │ │ +</span><span class="whitespace">    </span><span class="comment single">// management of it.
│ │ │ │ +</span><span class="whitespace">    </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">b</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">storage</span><span class="punctuation">]</span><span class="operator">-&gt;</span><span class="name">readv</span><span class="punctuation">(</span><span class="name">r</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="name">handler</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">b</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword">this</span><span class="punctuation">]</span><span class="whitespace">
│ │ │ │ +      </span><span class="punctuation">{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_buffer_holder</span><span class="punctuation">(</span><span class="operator">*</span><span class="keyword">this</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword">const_cast</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">*&gt;</span><span class="punctuation">(</span><span class="name">b</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">()),</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="punctuation">(</span><span class="name">b</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">())),</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">bool</span><span class="whitespace"> </span><span class="name">async_write</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="name">storage</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">peer_request</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">r</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">buf</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_observer</span><span class="operator">&gt;</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_job_flags_t</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">b</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace"> </span><span class="name">buf</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">length</span><span class="whitespace"> </span><span class="punctuation">};</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">storage</span><span class="punctuation">]</span><span class="operator">-&gt;</span><span class="name">writev</span><span class="punctuation">(</span><span class="name">b</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">r</span><span class="punctuation">.</span><span class="name">start</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">());</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +    </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name builtin">false</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_hash</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="name">storage</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">span</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">sha256_hash</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">block_hashes</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_job_flags_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha1_hash</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha1_hash</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">hash</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">storage</span><span class="punctuation">]</span><span class="operator">-&gt;</span><span class="name">hash</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">block_hashes</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">hash</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_hash2</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace"> </span><span class="name">storage</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">piece</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_job_flags_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha256_hash</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">lt</span><span class="operator">::</span><span class="name">sha256_hash</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">hash</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">[</span><span class="name">storage</span><span class="punctuation">]</span><span class="operator">-&gt;</span><span class="name">hash2</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">offset</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">piece</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">hash</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">error</span><span class="punctuation">);</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_move_storage</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="name">p</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">move_flags_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">status_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">status_t</span><span class="operator">::</span><span class="name">fatal_disk_error</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">p</span><span class="whitespace">
│ │ │ │ +        </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">error_code</span><span class="punctuation">(</span><span class="name">boost</span><span class="operator">::</span><span class="name">system</span><span class="operator">::</span><span class="name">errc</span><span class="operator">::</span><span class="name">operation_not_supported</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">system_category</span><span class="punctuation">())));</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_release_files</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">()</span><span class="operator">&gt;</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_delete_files</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">remove_flags_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">());</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_check_files</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">add_torrent_params</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">*</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">aux</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_index_t</span><span class="operator">&gt;</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">status_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">status_t</span><span class="operator">::</span><span class="name">no_error</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">());</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_rename_file</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_index_t</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">idx</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="name">name</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">name</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">idx</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">());</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_stop_torrent</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">()</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_set_file_priority</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">aux</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">download_priority_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_index_t</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">prio</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace">
│ │ │ │ +      </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">aux</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">download_priority_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">file_index_t</span><span class="operator">&gt;</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace">
│ │ │ │ +      </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_error</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">error_code</span><span class="punctuation">(</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">boost</span><span class="operator">::</span><span class="name">system</span><span class="operator">::</span><span class="name">errc</span><span class="operator">::</span><span class="name">operation_not_supported</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">system_category</span><span class="punctuation">())),</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">move</span><span class="punctuation">(</span><span class="name">prio</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">async_clear_piece</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="whitespace"> </span><span class="name">index</span><span class="whitespace">
│ │ │ │ +    </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">function</span><span class="operator">&lt;</span><span class="keyword type">void</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">piece_index_t</span><span class="punctuation">)</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="name">post</span><span class="punctuation">(</span><span class="name">m_ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="punctuation">[</span><span class="operator">=</span><span class="punctuation">]{</span><span class="whitespace"> </span><span class="name">handler</span><span class="punctuation">(</span><span class="name">index</span><span class="punctuation">);</span><span class="whitespace"> </span><span class="punctuation">});</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="comment single">// implements buffer_allocator_interface
│ │ │ │ +</span><span class="whitespace">  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">free_disk_buffer</span><span class="punctuation">(</span><span class="keyword type">char</span><span class="operator">*</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +    </span><span class="comment single">// never free any buffer. We only return buffers owned by the storage
│ │ │ │ +</span><span class="whitespace">    </span><span class="comment single">// object
│ │ │ │ +</span><span class="whitespace">  </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">update_stats_counters</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">counters</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">open_file_state</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">get_status</span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">const</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace">
│ │ │ │ +  </span><span class="punctuation">{</span><span class="whitespace"> </span><span class="keyword">return</span><span class="whitespace"> </span><span class="punctuation">{};</span><span class="whitespace"> </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="keyword type">void</span><span class="whitespace"> </span><span class="name">submit_jobs</span><span class="punctuation">()</span><span class="whitespace"> </span><span class="keyword">override</span><span class="whitespace"> </span><span class="punctuation">{}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="keyword">private</span><span class="operator">:</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">aux</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="name">temp_storage</span><span class="operator">&gt;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">m_torrents</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="comment single">// slots that are unused in the m_torrents vector
│ │ │ │ +</span><span class="whitespace">  </span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">storage_index_t</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">m_free_slots</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +  </span><span class="comment single">// callbacks are posted on this
│ │ │ │ +</span><span class="whitespace">  </span><span class="name">lt</span><span class="operator">::</span><span class="name">io_context</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">m_ioc</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">};</span><span class="whitespace">
│ │ │ │  
│ │ │ │ -                </span><span class="name">std</span><span class="operator">::</span><span class="name">ofstream</span><span class="whitespace"> </span><span class="name">out</span><span class="punctuation">((</span><span class="name">rd</span><span class="operator">-&gt;</span><span class="name">params</span><span class="punctuation">.</span><span class="name">save_path</span><span class="whitespace">
│ │ │ │ -                        </span><span class="operator">+</span><span class="whitespace"> </span><span class="literal string">&quot;/&quot;</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">rd</span><span class="operator">-&gt;</span><span class="name">params</span><span class="punctuation">.</span><span class="name">name</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="literal string">&quot;.fastresume&quot;</span><span class="punctuation">).</span><span class="name">c_str</span><span class="punctuation">()</span><span class="whitespace">
│ │ │ │ -                        </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">ios_base</span><span class="operator">::</span><span class="name">binary</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -                </span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">buf</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">write_resume_data_buf</span><span class="punctuation">(</span><span class="name">rd</span><span class="operator">-&gt;</span><span class="name">params</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -                </span><span class="name">out</span><span class="punctuation">.</span><span class="name">write</span><span class="punctuation">(</span><span class="name">buf</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="name">buf</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">());</span><span class="whitespace">
│ │ │ │ -                </span><span class="operator">--</span><span class="name">outstanding_resume_data</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -        </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +</span><span class="name">std</span><span class="operator">::</span><span class="name">unique_ptr</span><span class="operator">&lt;</span><span class="name">lt</span><span class="operator">::</span><span class="name">disk_interface</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">temp_disk_constructor</span><span class="punctuation">(</span><span class="whitespace">
│ │ │ │ +  </span><span class="name">lt</span><span class="operator">::</span><span class="name">io_context</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">ioc</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">settings_interface</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">lt</span><span class="operator">::</span><span class="name">counters</span><span class="operator">&amp;</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +  </span><span class="keyword">return</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">make_unique</span><span class="operator">&lt;</span><span class="name">temp_disk_io</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">ioc</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │  </span><span class="punctuation">}</span>
│ │ │ │  </pre>
│ │ │ │ -<div class="admonition note">
│ │ │ │ -<p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">Note how <tt class="docutils literal">outstanding_resume_data</tt> is a global counter in this
│ │ │ │ -example. This is deliberate, otherwise there is a race condition for
│ │ │ │ -torrents that was just asked to save their resume data, they posted
│ │ │ │ -the <a class="reference external" href="reference-Alerts.html#alert">alert</a>, but it has not been received yet. Those torrents would
│ │ │ │ -report that they don't need to save resume data again, and skipped by
│ │ │ │ -the initial loop, and thwart the counter otherwise.</p>
│ │ │ │ +<a name="settings_interface"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+settings_interface&labels=documentation&body=Documentation+under+heading+%22class+settings_interface%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │ -<a name="need_save_resume_data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bneed_save_resume_data%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bneed_save_resume_data%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="need-save-resume-data">
│ │ │ │ -<h2>need_save_resume_data()</h2>
│ │ │ │ +<div class="section" id="settings-interface">
│ │ │ │ +<h1>settings_interface</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<p>the common interface to <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> and the internal representation of
│ │ │ │ +settings.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>need_save_resume_data</strong> (resume_data_flags_t flags) const;
│ │ │ │ -bool <strong>need_save_resume_data</strong> () const;
│ │ │ │ +struct settings_interface
│ │ │ │ +{
│ │ │ │ +   virtual void <strong>set_int</strong> (int name, int val) = 0;
│ │ │ │ +   virtual bool <strong>has_val</strong> (int name) const = 0;
│ │ │ │ +   virtual void <strong>set_bool</strong> (int name, bool val) = 0;
│ │ │ │ +   virtual void <strong>set_str</strong> (int name, std::string val) = 0;
│ │ │ │ +   virtual bool <strong>get_bool</strong> (int name) const = 0;
│ │ │ │ +   virtual int <strong>get_int</strong> (int name) const = 0;
│ │ │ │ +   virtual std::string const&amp; <strong>get_str</strong> (int name) const = 0;
│ │ │ │ +};
│ │ │ │  </pre>
│ │ │ │ -<p>This function returns true if anything that is stored in the resume
│ │ │ │ -data has changed since the last time resume data was saved.
│ │ │ │ -The overload that takes <tt class="docutils literal">flags</tt> let you ask if specific categories
│ │ │ │ -of properties have changed. These flags have the same behavior as in
│ │ │ │ -the <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> call.</p>
│ │ │ │ -<p>This is a <em>blocking</em> call. It will wait for a response from
│ │ │ │ -libtorrent's main thread. A way to avoid blocking is to instead
│ │ │ │ -call <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> directly, specifying the conditions under
│ │ │ │ -which resume data should be saved.</p>
│ │ │ │ -<div class="admonition note">
│ │ │ │ -<p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">A torrent's resume data is considered saved as soon as the
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a> is posted. It is important to make sure this
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#alert">alert</a> is received and handled in order for this function to be
│ │ │ │ -meaningful.</p>
│ │ │ │ -</div>
│ │ │ │ -<a name="queue_position_bottom()"></a>
│ │ │ │ -<a name="queue_position_up()"></a>
│ │ │ │ -<a name="queue_position_top()"></a>
│ │ │ │ -<a name="queue_position_down()"></a>
│ │ │ │ -<a name="queue_position()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bqueue_position_bottom%28%29+queue_position_up%28%29+queue_position_top%28%29+queue_position_down%28%29+queue_position%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bqueue_position_bottom%28%29+queue_position_up%28%29+queue_position_top%28%29+queue_position_down%28%29+queue_position%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="queue-position-bottom-queue-position-up-queue-position-top-queue-position-down-queue-position">
│ │ │ │ -<h2>queue_position_bottom() queue_position_up() queue_position_top() queue_position_down() queue_position()</h2>
│ │ │ │ +<a name="buffer_allocator_interface"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+buffer_allocator_interface&labels=documentation&body=Documentation+under+heading+%22class+buffer_allocator_interface%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="buffer-allocator-interface">
│ │ │ │ +<h1>buffer_allocator_interface</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_buffer_holder.hpp">libtorrent/disk_buffer_holder.hpp</a>&quot;</p>
│ │ │ │ +<p>the interface for freeing disk buffers, used by the <a class="reference external" href="reference-Custom_Storage.html#disk_buffer_holder">disk_buffer_holder</a>.
│ │ │ │ +when implementing <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a>, this must also be implemented in order
│ │ │ │ +to return disk buffers back to libtorrent</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>queue_position_up</strong> () const;
│ │ │ │ -void <strong>queue_position_top</strong> () const;
│ │ │ │ -void <strong>queue_position_bottom</strong> () const;
│ │ │ │ -void <strong>queue_position_down</strong> () const;
│ │ │ │ -queue_position_t <strong>queue_position</strong> () const;
│ │ │ │ +struct buffer_allocator_interface
│ │ │ │ +{
│ │ │ │ +   virtual void <strong>free_disk_buffer</strong> (char* b) = 0;
│ │ │ │ +};
│ │ │ │  </pre>
│ │ │ │ -<p>Every torrent that is added is assigned a queue position exactly one
│ │ │ │ -greater than the greatest queue position of all existing torrents.
│ │ │ │ -Torrents that are being seeded have -1 as their queue position, since
│ │ │ │ -they're no longer in line to be downloaded.</p>
│ │ │ │ -<p>When a torrent is removed or turns into a seed, all torrents with
│ │ │ │ -greater queue positions have their positions decreased to fill in the
│ │ │ │ -space in the sequence.</p>
│ │ │ │ -<p><tt class="docutils literal">queue_position()</tt> returns the torrent's position in the download
│ │ │ │ -queue. The torrents with the smallest numbers are the ones that are
│ │ │ │ -being downloaded. The smaller number, the closer the torrent is to the
│ │ │ │ -front of the line to be started.</p>
│ │ │ │ -<p>The queue position is also available in the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a>.</p>
│ │ │ │ -<p>The <tt class="docutils literal"><span class="pre">queue_position_*()</span></tt> functions adjust the torrents position in
│ │ │ │ -the queue. Up means closer to the front and down means closer to the
│ │ │ │ -back of the queue. Top and bottom refers to the front and the back of
│ │ │ │ -the queue respectively.</p>
│ │ │ │ -<a name="queue_position_set()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bqueue_position_set%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bqueue_position_set%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="queue-position-set">
│ │ │ │ -<h2>queue_position_set()</h2>
│ │ │ │ +<a name="disk_buffer_holder"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+disk_buffer_holder&labels=documentation&body=Documentation+under+heading+%22class+disk_buffer_holder%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="disk-buffer-holder">
│ │ │ │ +<h1>disk_buffer_holder</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_buffer_holder.hpp">libtorrent/disk_buffer_holder.hpp</a>&quot;</p>
│ │ │ │ +<p>The disk buffer holder acts like a <tt class="docutils literal">unique_ptr</tt> that frees a disk buffer
│ │ │ │ +when it's destructed</p>
│ │ │ │ +<p>If this buffer holder is moved-from, default constructed or reset,
│ │ │ │ +<tt class="docutils literal">data()</tt> will return nullptr.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>queue_position_set</strong> (queue_position_t p) const;
│ │ │ │ +struct disk_buffer_holder
│ │ │ │ +{
│ │ │ │ +   disk_buffer_holder&amp; <strong>operator=</strong> (disk_buffer_holder&amp;&amp;) &amp; noexcept;
│ │ │ │ +   <strong>disk_buffer_holder</strong> (disk_buffer_holder&amp;&amp;) noexcept;
│ │ │ │ +   <strong>disk_buffer_holder</strong> (disk_buffer_holder const&amp;) = delete;
│ │ │ │ +   disk_buffer_holder&amp; <strong>operator=</strong> (disk_buffer_holder const&amp;) = delete;
│ │ │ │ +   <strong>disk_buffer_holder</strong> (buffer_allocator_interface&amp; alloc
│ │ │ │ +      , char* buf, int sz) noexcept;
│ │ │ │ +   <strong>disk_buffer_holder</strong> () noexcept = default;
│ │ │ │ +   <strong>~disk_buffer_holder</strong> ();
│ │ │ │ +   char* <strong>data</strong> () const noexcept;
│ │ │ │ +   void <strong>reset</strong> ();
│ │ │ │ +   void <strong>swap</strong> (disk_buffer_holder&amp; h) noexcept;
│ │ │ │ +   bool <strong>is_mutable</strong> () const noexcept;
│ │ │ │ +   explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ +   std::ptrdiff_t <strong>size</strong> () const;
│ │ │ │ +};
│ │ │ │  </pre>
│ │ │ │ -<p>updates the position in the queue for this torrent. The relative order
│ │ │ │ -of all other torrents remain intact but their numerical queue position
│ │ │ │ -shifts to make space for this torrent's new position</p>
│ │ │ │ -<a name="set_ssl_certificate_buffer()"></a>
│ │ │ │ -<a name="set_ssl_certificate()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_ssl_certificate_buffer%28%29+set_ssl_certificate%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_ssl_certificate_buffer%28%29+set_ssl_certificate%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-ssl-certificate-buffer-set-ssl-certificate">
│ │ │ │ -<h2>set_ssl_certificate_buffer() set_ssl_certificate()</h2>
│ │ │ │ +<a name="disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="disk-buffer-holder-1">
│ │ │ │ +<h2>disk_buffer_holder()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_ssl_certificate_buffer</strong> (std::string const&amp; certificate
│ │ │ │ -      , std::string const&amp; private_key
│ │ │ │ -      , std::string const&amp; dh_params);
│ │ │ │ -void <strong>set_ssl_certificate</strong> (std::string const&amp; certificate
│ │ │ │ -      , std::string const&amp; private_key
│ │ │ │ -      , std::string const&amp; dh_params
│ │ │ │ -      , std::string const&amp; passphrase = &quot;&quot;);
│ │ │ │ +<strong>disk_buffer_holder</strong> (buffer_allocator_interface&amp; alloc
│ │ │ │ +      , char* buf, int sz) noexcept;
│ │ │ │  </pre>
│ │ │ │ -<p>For SSL torrents, use this to specify a path to a .pem file to use as
│ │ │ │ -this client's certificate. The certificate must be signed by the
│ │ │ │ -certificate in the .torrent file to be valid.</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Torrent_Handle.html#set_ssl_certificate_buffer()">set_ssl_certificate_buffer()</a> overload takes the actual certificate,
│ │ │ │ -private key and DH params as strings, rather than paths to files.</p>
│ │ │ │ -<p><tt class="docutils literal">cert</tt> is a path to the (signed) certificate in .pem format
│ │ │ │ -corresponding to this torrent.</p>
│ │ │ │ -<p><tt class="docutils literal">private_key</tt> is a path to the private key for the specified
│ │ │ │ -certificate. This must be in .pem format.</p>
│ │ │ │ -<p><tt class="docutils literal">dh_params</tt> is a path to the Diffie-Hellman parameter file, which
│ │ │ │ -needs to be in .pem format. You can generate this file using the
│ │ │ │ -openssl command like this: <tt class="docutils literal">openssl dhparam <span class="pre">-outform</span> PEM <span class="pre">-out</span>
│ │ │ │ -dhparams.pem 512</tt>.</p>
│ │ │ │ -<p><tt class="docutils literal">passphrase</tt> may be specified if the private key is encrypted and
│ │ │ │ -requires a passphrase to be decrypted.</p>
│ │ │ │ -<p>Note that when a torrent first starts up, and it needs a certificate,
│ │ │ │ -it will suspend connecting to any peers until it has one. It's
│ │ │ │ -typically desirable to resume the torrent after setting the SSL
│ │ │ │ -certificate.</p>
│ │ │ │ -<p>If you receive a <a class="reference external" href="reference-Alerts.html#torrent_need_cert_alert">torrent_need_cert_alert</a>, you need to call this to
│ │ │ │ -provide a valid cert. If you don't have a cert you won't be allowed to
│ │ │ │ -connect to any peers.</p>
│ │ │ │ -<a name="torrent_file()"></a>
│ │ │ │ -<a name="torrent_file_with_hashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Btorrent_file%28%29+torrent_file_with_hashes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Btorrent_file%28%29+torrent_file_with_hashes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-file-torrent-file-with-hashes">
│ │ │ │ -<h2>torrent_file() torrent_file_with_hashes()</h2>
│ │ │ │ +<p>construct a buffer holder that will free the held buffer
│ │ │ │ +using a disk buffer pool directly (there's only one
│ │ │ │ +disk_buffer_pool per <a class="reference external" href="reference-Session.html#session">session</a>)</p>
│ │ │ │ +<a name="disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="disk-buffer-holder-2">
│ │ │ │ +<h2>disk_buffer_holder()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::shared_ptr&lt;torrent_info&gt; <strong>torrent_file_with_hashes</strong> () const;
│ │ │ │ -std::shared_ptr&lt;const torrent_info&gt; <strong>torrent_file</strong> () const;
│ │ │ │ +<strong>disk_buffer_holder</strong> () noexcept = default;
│ │ │ │  </pre>
│ │ │ │ -<p><a class="reference external" href="reference-Torrent_Handle.html#torrent_file()">torrent_file()</a> returns a pointer to the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object
│ │ │ │ -associated with this torrent. The <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object may be a copy
│ │ │ │ -of the internal object. If the torrent doesn't have metadata, the
│ │ │ │ -pointer will not be initialized (i.e. a nullptr). The torrent may be
│ │ │ │ -in a state without metadata only if it was started without a .torrent
│ │ │ │ -file, e.g. by being added by magnet link.</p>
│ │ │ │ -<p>Note that the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object returned here may be a different
│ │ │ │ -instance than the one added to the <a class="reference external" href="reference-Session.html#session">session</a>, with different attributes
│ │ │ │ -like piece layers, dht nodes and trackers. A <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object does
│ │ │ │ -not round-trip cleanly when added to a <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │ -<p>If you want to save a .torrent file from the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>, instead
│ │ │ │ -call <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> and <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a> the
│ │ │ │ -<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object passed back in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ -<p><a class="reference external" href="reference-Torrent_Handle.html#torrent_file_with_hashes()">torrent_file_with_hashes()</a> returns a <em>copy</em> of the internal
│ │ │ │ -<a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> and piece layer hashes (if it's a v2 torrent). The piece
│ │ │ │ -layers will only be included if they are available. If this torrent
│ │ │ │ -was added from a .torrent file with piece layers or if it's seeding,
│ │ │ │ -the piece layers are available. This function is more expensive than
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#torrent_file()">torrent_file()</a> since it needs to make copies of this information.</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Torrent_Handle.html#torrent_file_with_hashes()">torrent_file_with_hashes()</a> is here for backwards compatibility
│ │ │ │ -when constructing a <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> object from a <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> that's
│ │ │ │ -in a <a class="reference external" href="reference-Session.html#session">session</a>. Prefer <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> + <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a>.</p>
│ │ │ │ -<p>Note that a torrent added from a magnet link may not have the full
│ │ │ │ -merkle trees for all files, and hence not have the complete piece
│ │ │ │ -layers. In that state, you cannot create a .torrent file even from
│ │ │ │ -the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> returned from <a class="reference external" href="reference-Torrent_Handle.html#torrent_file_with_hashes()">torrent_file_with_hashes()</a>. Once the
│ │ │ │ -torrent completes downloading all files, becoming a seed, you can
│ │ │ │ -make a .torrent file from it.</p>
│ │ │ │ -<a name="piece_layers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpiece_layers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpiece_layers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-layers">
│ │ │ │ -<h2>piece_layers()</h2>
│ │ │ │ +<p>default construct a holder that does not own any buffer</p>
│ │ │ │ +<a name="~disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5B~disk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5B~disk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="disk-buffer-holder-3">
│ │ │ │ +<h2>~disk_buffer_holder()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::vector&lt;std::vector&lt;sha256_hash&gt;&gt; <strong>piece_layers</strong> () const;
│ │ │ │ +<strong>~disk_buffer_holder</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>returns the piece layers for all files in the torrent. If this is a
│ │ │ │ -v1 torrent (and doesn't have any piece layers) it returns an empty
│ │ │ │ -vector. This is a blocking call that will synchronize with the
│ │ │ │ -libtorrent network thread.</p>
│ │ │ │ -<a name="piece_availability()"></a>
│ │ │ │ -<a name="post_piece_availability()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpiece_availability%28%29+post_piece_availability%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpiece_availability%28%29+post_piece_availability%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-availability-post-piece-availability">
│ │ │ │ -<h2>piece_availability() post_piece_availability()</h2>
│ │ │ │ +<p>frees disk buffer held by this object</p>
│ │ │ │ +<a name="data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdata%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdata%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="data">
│ │ │ │ +<h2>data()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>piece_availability</strong> (std::vector&lt;int&gt;&amp; avail) const;
│ │ │ │ -void <strong>post_piece_availability</strong> () const;
│ │ │ │ +char* <strong>data</strong> () const noexcept;
│ │ │ │  </pre>
│ │ │ │ -<p>The piece availability is the number of peers that we are connected
│ │ │ │ -that has advertised having a particular piece. This is the information
│ │ │ │ -that libtorrent uses in order to prefer picking rare pieces.</p>
│ │ │ │ -<p><tt class="docutils literal">post_piece_availability()</tt> will trigger a <a class="reference external" href="reference-Alerts.html#piece_availability_alert">piece_availability_alert</a>
│ │ │ │ -to be posted.</p>
│ │ │ │ -<p><tt class="docutils literal">piece_availability()</tt> fills the specified <tt class="docutils literal"><span class="pre">std::vector&lt;int&gt;</span></tt>
│ │ │ │ -with the availability for each piece in this torrent. libtorrent does
│ │ │ │ -not keep track of availability for seeds, so if the torrent is
│ │ │ │ -seeding the availability for all pieces is reported as 0.</p>
│ │ │ │ -<a name="get_piece_priorities()"></a>
│ │ │ │ -<a name="piece_priority()"></a>
│ │ │ │ -<a name="prioritize_pieces()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bget_piece_priorities%28%29+piece_priority%28%29+prioritize_pieces%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bget_piece_priorities%28%29+piece_priority%28%29+prioritize_pieces%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-piece-priorities-piece-priority-prioritize-pieces">
│ │ │ │ -<h2>get_piece_priorities() piece_priority() prioritize_pieces()</h2>
│ │ │ │ +<p>return a pointer to the held buffer, if any. Otherwise returns nullptr.</p>
│ │ │ │ +<a name="reset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Breset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Breset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="reset">
│ │ │ │ +<h2>reset()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::vector&lt;download_priority_t&gt; <strong>get_piece_priorities</strong> () const;
│ │ │ │ -void <strong>piece_priority</strong> (piece_index_t index, download_priority_t priority) const;
│ │ │ │ -download_priority_t <strong>piece_priority</strong> (piece_index_t index) const;
│ │ │ │ -void <strong>prioritize_pieces</strong> (std::vector&lt;download_priority_t&gt; const&amp; pieces) const;
│ │ │ │ -void <strong>prioritize_pieces</strong> (std::vector&lt;std::pair&lt;piece_index_t, download_priority_t&gt;&gt; const&amp; pieces) const;
│ │ │ │ +void <strong>reset</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>These functions are used to set and get the priority of individual
│ │ │ │ -pieces. By default all pieces have priority 4. That means that the
│ │ │ │ -random rarest first algorithm is effectively active for all pieces.
│ │ │ │ -You may however change the priority of individual pieces. There are 8
│ │ │ │ -priority levels. 0 means not to download the piece at all. Otherwise,
│ │ │ │ -lower priority values means less likely to be picked. Piece priority
│ │ │ │ -takes precedence over piece availability. Every piece with priority 7
│ │ │ │ -will be attempted to be picked before a priority 6 piece and so on.</p>
│ │ │ │ -<p>The default priority of pieces is 4.</p>
│ │ │ │ -<p>Piece priorities can not be changed for torrents that have not
│ │ │ │ -downloaded the metadata yet. Magnet links won't have metadata
│ │ │ │ -immediately. see the <a class="reference external" href="reference-Alerts.html#metadata_received_alert">metadata_received_alert</a>.</p>
│ │ │ │ -<p><tt class="docutils literal">piece_priority</tt> sets or gets the priority for an individual piece,
│ │ │ │ -specified by <tt class="docutils literal">index</tt>.</p>
│ │ │ │ -<p><tt class="docutils literal">prioritize_pieces</tt> takes a vector of integers, one integer per
│ │ │ │ -piece in the torrent. All the piece priorities will be updated with
│ │ │ │ -the priorities in the vector.
│ │ │ │ -The second overload of <tt class="docutils literal">prioritize_pieces</tt> that takes a vector of pairs
│ │ │ │ -will update the priorities of only select pieces, and leave all other
│ │ │ │ -unaffected. Each pair is (piece, priority). That is, the first item is
│ │ │ │ -the piece index and the second item is the priority of that piece.
│ │ │ │ -Invalid entries, where the piece index or priority is out of range, are
│ │ │ │ -not allowed.</p>
│ │ │ │ -<p><tt class="docutils literal">get_piece_priorities</tt> returns a vector with one element for each piece
│ │ │ │ -in the torrent. Each element is the current priority of that piece.</p>
│ │ │ │ -<p>It's possible to cancel the effect of <em>file</em> priorities by setting the
│ │ │ │ -priorities for the affected pieces. Care has to be taken when mixing
│ │ │ │ -usage of file- and piece priorities.</p>
│ │ │ │ -<a name="get_file_priorities()"></a>
│ │ │ │ -<a name="file_priority()"></a>
│ │ │ │ -<a name="prioritize_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bget_file_priorities%28%29+file_priority%28%29+prioritize_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bget_file_priorities%28%29+file_priority%28%29+prioritize_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-file-priorities-file-priority-prioritize-files">
│ │ │ │ -<h2>get_file_priorities() file_priority() prioritize_files()</h2>
│ │ │ │ +<p>free the held disk buffer, if any, and clear the holder. This sets the
│ │ │ │ +holder object to a default-constructed state</p>
│ │ │ │ +<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="swap">
│ │ │ │ +<h2>swap()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::vector&lt;download_priority_t&gt; <strong>get_file_priorities</strong> () const;
│ │ │ │ -download_priority_t <strong>file_priority</strong> (file_index_t index) const;
│ │ │ │ -void <strong>prioritize_files</strong> (std::vector&lt;download_priority_t&gt; const&amp; files) const;
│ │ │ │ -void <strong>file_priority</strong> (file_index_t index, download_priority_t priority) const;
│ │ │ │ +void <strong>swap</strong> (disk_buffer_holder&amp; h) noexcept;
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">index</tt> must be in the range [0, number_of_files).</p>
│ │ │ │ -<p><tt class="docutils literal">file_priority()</tt> queries or sets the priority of file <tt class="docutils literal">index</tt>.</p>
│ │ │ │ -<p><tt class="docutils literal">prioritize_files()</tt> takes a vector that has at as many elements as
│ │ │ │ -there are files in the torrent. Each <a class="reference external" href="reference-Bencoding.html#entry">entry</a> is the priority of that
│ │ │ │ -file. The function sets the priorities of all the pieces in the
│ │ │ │ -torrent based on the vector.</p>
│ │ │ │ -<p><tt class="docutils literal">get_file_priorities()</tt> returns a vector with the priorities of all
│ │ │ │ -files.</p>
│ │ │ │ -<p>The priority values are the same as for <a class="reference external" href="reference-Torrent_Handle.html#piece_priority()">piece_priority()</a>. See
│ │ │ │ -<a class="reference external" href="reference-Core.html#download_priority_t">download_priority_t</a>.</p>
│ │ │ │ -<p>Whenever a file priority is changed, all other piece priorities are
│ │ │ │ -reset to match the file priorities. In order to maintain special
│ │ │ │ -priorities for particular pieces, <a class="reference external" href="reference-Torrent_Handle.html#piece_priority()">piece_priority()</a> has to be called
│ │ │ │ -again for those pieces.</p>
│ │ │ │ -<p>You cannot set the file priorities on a torrent that does not yet have
│ │ │ │ -metadata or a torrent that is a seed. <tt class="docutils literal">file_priority(int, int)</tt> and
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#prioritize_files()">prioritize_files()</a> are both no-ops for such torrents.</p>
│ │ │ │ -<p>Since changing file priorities may involve disk operations (of moving
│ │ │ │ -files in- and out of the part file), the internal accounting of file
│ │ │ │ -priorities happen asynchronously. i.e. setting file priorities and then
│ │ │ │ -immediately querying them may not yield the same priorities just set.
│ │ │ │ -To synchronize with the priorities taking effect, wait for the
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#file_prio_alert">file_prio_alert</a>.</p>
│ │ │ │ -<p>When combining file- and piece priorities, the resume file will record
│ │ │ │ -both. When loading the resume data, the file priorities will be applied
│ │ │ │ -first, then the piece priorities.</p>
│ │ │ │ -<p>Moving data from a file into the part file is currently not
│ │ │ │ -supported. If a file has its priority set to 0 <em>after</em> it has already
│ │ │ │ -been created, it will not be moved into the partfile.</p>
│ │ │ │ -<a name="force_reannounce()"></a>
│ │ │ │ -<a name="force_dht_announce()"></a>
│ │ │ │ -<a name="force_lsd_announce()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bforce_reannounce%28%29+force_dht_announce%28%29+force_lsd_announce%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bforce_reannounce%28%29+force_dht_announce%28%29+force_lsd_announce%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="force-reannounce-force-dht-announce-force-lsd-announce">
│ │ │ │ -<h2>force_reannounce() force_dht_announce() force_lsd_announce()</h2>
│ │ │ │ +<p>swap pointers of two disk buffer holders.</p>
│ │ │ │ +<a name="is_mutable()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bis_mutable%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bis_mutable%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="is-mutable">
│ │ │ │ +<h2>is_mutable()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>force_reannounce</strong> (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
│ │ │ │ -void <strong>force_dht_announce</strong> () const;
│ │ │ │ -void <strong>force_lsd_announce</strong> () const;
│ │ │ │ +bool <strong>is_mutable</strong> () const noexcept;
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">force_reannounce()</tt> will force this torrent to do another tracker
│ │ │ │ -request, to receive new peers. The <tt class="docutils literal">seconds</tt> argument specifies how
│ │ │ │ -many seconds from now to issue the tracker announces.</p>
│ │ │ │ -<p>If the tracker's <tt class="docutils literal">min_interval</tt> has not passed since the last
│ │ │ │ -announce, the forced announce will be scheduled to happen immediately
│ │ │ │ -as the <tt class="docutils literal">min_interval</tt> expires. This is to honor trackers minimum
│ │ │ │ -re-announce interval settings.</p>
│ │ │ │ -<p>The <tt class="docutils literal">tracker_index</tt> argument specifies which tracker to re-announce.
│ │ │ │ -If set to -1 (which is the default), all trackers are re-announce.</p>
│ │ │ │ -<p>The <tt class="docutils literal">flags</tt> argument can be used to affect the re-announce. See
│ │ │ │ -ignore_min_interval.</p>
│ │ │ │ -<p><tt class="docutils literal">force_dht_announce</tt> will announce the torrent to the DHT
│ │ │ │ -immediately.</p>
│ │ │ │ -<p><tt class="docutils literal">force_lsd_announce</tt> will announce the torrent on LSD
│ │ │ │ -immediately.</p>
│ │ │ │ -<a name="scrape_tracker()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bscrape_tracker%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bscrape_tracker%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="scrape-tracker">
│ │ │ │ -<h2>scrape_tracker()</h2>
│ │ │ │ +<p>if this returns true, the buffer may not be modified in place</p>
│ │ │ │ +<a name="bool()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bbool%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bbool%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="bool">
│ │ │ │ +<h2>bool()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>scrape_tracker</strong> (int idx = -1) const;
│ │ │ │ +explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">scrape_tracker()</tt> will send a scrape request to a tracker. By
│ │ │ │ -default (<tt class="docutils literal">idx</tt> = -1) it will scrape the last working tracker. If
│ │ │ │ -<tt class="docutils literal">idx</tt> is &gt;= 0, the tracker with the specified index will scraped.</p>
│ │ │ │ -<p>A scrape request queries the tracker for statistics such as total
│ │ │ │ -number of incomplete peers, complete peers, number of downloads etc.</p>
│ │ │ │ -<p>This request will specifically update the <tt class="docutils literal">num_complete</tt> and
│ │ │ │ -<tt class="docutils literal">num_incomplete</tt> fields in the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> struct once it
│ │ │ │ -completes. When it completes, it will generate a <a class="reference external" href="reference-Alerts.html#scrape_reply_alert">scrape_reply_alert</a>.
│ │ │ │ -If it fails, it will generate a <a class="reference external" href="reference-Alerts.html#scrape_failed_alert">scrape_failed_alert</a>.</p>
│ │ │ │ -<a name="set_download_limit()"></a>
│ │ │ │ -<a name="download_limit()"></a>
│ │ │ │ -<a name="upload_limit()"></a>
│ │ │ │ -<a name="set_upload_limit()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_download_limit%28%29+download_limit%28%29+upload_limit%28%29+set_upload_limit%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_download_limit%28%29+download_limit%28%29+upload_limit%28%29+set_upload_limit%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-download-limit-download-limit-upload-limit-set-upload-limit">
│ │ │ │ -<h2>set_download_limit() download_limit() upload_limit() set_upload_limit()</h2>
│ │ │ │ +<p>implicitly convertible to true if the object is currently holding a
│ │ │ │ +buffer</p>
│ │ │ │ +<a name="open_file_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+open_file_state&labels=documentation&body=Documentation+under+heading+%22class+open_file_state%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="open-file-state">
│ │ │ │ +<h1>open_file_state</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_interface.hpp">libtorrent/disk_interface.hpp</a>&quot;</p>
│ │ │ │ +<p>this contains information about a file that's currently open by the
│ │ │ │ +libtorrent disk I/O subsystem. It's associated with a single torrent.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_download_limit</strong> (int limit) const;
│ │ │ │ -void <strong>set_upload_limit</strong> (int limit) const;
│ │ │ │ -int <strong>upload_limit</strong> () const;
│ │ │ │ -int <strong>download_limit</strong> () const;
│ │ │ │ +struct open_file_state
│ │ │ │ +{
│ │ │ │ +   file_index_t file_index;
│ │ │ │ +   file_open_mode_t open_mode;
│ │ │ │ +   time_point last_use;
│ │ │ │ +};
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">set_upload_limit</tt> 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.
│ │ │ │ -<tt class="docutils literal">set_download_limit</tt> works the same way but for download bandwidth
│ │ │ │ -instead of upload bandwidth. Note that setting a higher limit on a
│ │ │ │ -torrent then the global limit
│ │ │ │ -(<tt class="docutils literal"><span class="pre">settings_pack::upload_rate_limit</span></tt>) will not override the global
│ │ │ │ -rate limit. The torrent can never upload more than the global rate
│ │ │ │ -limit.</p>
│ │ │ │ -<p><tt class="docutils literal">upload_limit</tt> and <tt class="docutils literal">download_limit</tt> will return the current limit
│ │ │ │ -setting, for upload and download, respectively.</p>
│ │ │ │ -<p>Local peers are not rate limited by default. see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ -<a name="connect_peer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bconnect_peer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bconnect_peer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="connect-peer">
│ │ │ │ -<h2>connect_peer()</h2>
│ │ │ │ +<a name="file_index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:open_file_state%3A%3A%5Bfile_index%5D&labels=documentation&body=Documentation+under+heading+%22open_file_state%3A%3A%5Bfile_index%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>file_index</dt>
│ │ │ │ +<dd>the index of the file this <a class="reference external" href="reference-Bencoding.html#entry">entry</a> refers to into the <tt class="docutils literal">file_storage</tt>
│ │ │ │ +file list of this torrent. This starts indexing at 0.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="open_mode"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:open_file_state%3A%3A%5Bopen_mode%5D&labels=documentation&body=Documentation+under+heading+%22open_file_state%3A%3A%5Bopen_mode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>open_mode</dt>
│ │ │ │ +<dd><p class="first"><tt class="docutils literal">open_mode</tt> is a bitmask of the file flags this file is currently
│ │ │ │ +opened with. For possible flags, see <a class="reference external" href="reference-Custom_Storage.html#file_open_mode_t">file_open_mode_t</a>.</p>
│ │ │ │ +<p class="last">Note that the read/write mode is not a bitmask. The two least significant bits are used
│ │ │ │ +to represent the read/write mode. Those bits can be masked out using the <tt class="docutils literal">rw_mask</tt> constant.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="last_use"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:open_file_state%3A%3A%5Blast_use%5D&labels=documentation&body=Documentation+under+heading+%22open_file_state%3A%3A%5Blast_use%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>last_use</dt>
│ │ │ │ +<dd>a (high precision) timestamp of when the file was last used.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="disk_interface"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+disk_interface&labels=documentation&body=Documentation+under+heading+%22class+disk_interface%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="disk-interface">
│ │ │ │ +<h1>disk_interface</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_interface.hpp">libtorrent/disk_interface.hpp</a>&quot;</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a> is the customization point for disk I/O in libtorrent.
│ │ │ │ +implement this interface and provide a factory function to the <a class="reference external" href="reference-Session.html#session">session</a> constructor
│ │ │ │ +use custom disk I/O. All functions on the disk subsystem (implementing
│ │ │ │ +<a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a>) are called from within libtorrent's network thread. For
│ │ │ │ +disk I/O to be performed in a separate thread, the disk subsystem has to
│ │ │ │ +manage that itself.</p>
│ │ │ │ +<p>Although the functions are called <tt class="docutils literal">async_*</tt>, they do not technically
│ │ │ │ +<em>have</em> to be asynchronous, but they support being asynchronous, by
│ │ │ │ +expecting the result passed back into a callback. The callbacks must be
│ │ │ │ +posted back onto the network thread via the io_context object passed into
│ │ │ │ +the constructor. The callbacks will be run in the network thread.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>connect_peer</strong> (tcp::endpoint const&amp; adr, peer_source_flags_t source = {}
│ │ │ │ -      , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
│ │ │ │ +struct disk_interface
│ │ │ │ +{
│ │ │ │ +   virtual storage_holder <strong>new_torrent</strong> (storage_params const&amp; p
│ │ │ │ +      , std::shared_ptr&lt;void&gt; const&amp; torrent) = 0;
│ │ │ │ +   virtual void <strong>remove_torrent</strong> (storage_index_t) = 0;
│ │ │ │ +   virtual void <strong>async_read</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ +      , std::function&lt;void(disk_buffer_holder, storage_error const&amp;)&gt; handler
│ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ +   virtual bool <strong>async_write</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ +      , char const* buf, std::shared_ptr&lt;disk_observer&gt; o
│ │ │ │ +      , std::function&lt;void(storage_error const&amp;)&gt; handler
│ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ +   virtual void <strong>async_hash</strong> (storage_index_t storage, piece_index_t piece, span&lt;sha256_hash&gt; v2
│ │ │ │ +      , disk_job_flags_t flags
│ │ │ │ +      , std::function&lt;void(piece_index_t, sha1_hash const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ +   virtual void <strong>async_hash2</strong> (storage_index_t storage, piece_index_t piece, int offset, disk_job_flags_t flags
│ │ │ │ +      , std::function&lt;void(piece_index_t, sha256_hash const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ +   virtual void <strong>async_move_storage</strong> (storage_index_t storage, std::string p, move_flags_t flags
│ │ │ │ +      , std::function&lt;void(status_t, std::string const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ +   virtual void <strong>async_release_files</strong> (storage_index_t storage
│ │ │ │ +      , std::function&lt;void()&gt; handler = std::function&lt;void()&gt;()) = 0;
│ │ │ │ +   virtual void <strong>async_check_files</strong> (storage_index_t storage
│ │ │ │ +      , add_torrent_params const* resume_data
│ │ │ │ +      , aux::vector&lt;std::string, file_index_t&gt; links
│ │ │ │ +      , std::function&lt;void(status_t, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ +   virtual void <strong>async_stop_torrent</strong> (storage_index_t storage
│ │ │ │ +      , std::function&lt;void()&gt; handler = std::function&lt;void()&gt;()) = 0;
│ │ │ │ +   virtual void <strong>async_rename_file</strong> (storage_index_t storage
│ │ │ │ +      , file_index_t index, std::string name
│ │ │ │ +      , std::function&lt;void(std::string const&amp;, file_index_t, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ +   virtual void <strong>async_delete_files</strong> (storage_index_t storage, remove_flags_t options
│ │ │ │ +      , std::function&lt;void(storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ +   virtual void <strong>async_set_file_priority</strong> (storage_index_t storage
│ │ │ │ +      , aux::vector&lt;download_priority_t, file_index_t&gt; prio
│ │ │ │ +      , std::function&lt;void(storage_error const&amp;
│ │ │ │ +      , aux::vector&lt;download_priority_t, file_index_t&gt;)&gt; handler) = 0;
│ │ │ │ +   virtual void <strong>async_clear_piece</strong> (storage_index_t storage, piece_index_t index
│ │ │ │ +      , std::function&lt;void(piece_index_t)&gt; handler) = 0;
│ │ │ │ +   virtual void <strong>update_stats_counters</strong> (counters&amp; c) const = 0;
│ │ │ │ +   virtual std::vector&lt;open_file_state&gt; <strong>get_status</strong> (storage_index_t) const = 0;
│ │ │ │ +   virtual void <strong>abort</strong> (bool wait) = 0;
│ │ │ │ +   virtual void <strong>submit_jobs</strong> () = 0;
│ │ │ │ +   virtual void <strong>settings_updated</strong> () = 0;
│ │ │ │ +
│ │ │ │ +   static constexpr disk_job_flags_t <strong>force_copy</strong>  = 0_bit;
│ │ │ │ +   static constexpr disk_job_flags_t <strong>sequential_access</strong>  = 3_bit;
│ │ │ │ +   static constexpr disk_job_flags_t <strong>volatile_read</strong>  = 4_bit;
│ │ │ │ +   static constexpr disk_job_flags_t <strong>v1_hash</strong>  = 5_bit;
│ │ │ │ +   static constexpr disk_job_flags_t <strong>flush_piece</strong>  = 7_bit;
│ │ │ │ +};
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">connect_peer()</tt> is a way to manually connect to peers that one
│ │ │ │ -believe is a part of the torrent. If the peer does not respond, or is
│ │ │ │ -not a member of this torrent, it will simply be disconnected. No harm
│ │ │ │ -can be done by using this other than an unnecessary connection attempt
│ │ │ │ -is made. If the torrent is uninitialized or in queued or checking
│ │ │ │ -mode, this will throw system_error. The second (optional)
│ │ │ │ -argument will be bitwise ORed into the source mask of this peer.
│ │ │ │ -Typically this is one of the source flags in <a class="reference external" href="reference-Core.html#peer_info">peer_info</a>. i.e.
│ │ │ │ -<tt class="docutils literal">tracker</tt>, <tt class="docutils literal">pex</tt>, <tt class="docutils literal">dht</tt> etc.</p>
│ │ │ │ -<p>For possible values of <tt class="docutils literal">flags</tt>, see <a class="reference external" href="reference-Core.html#pex_flags_t">pex_flags_t</a>.</p>
│ │ │ │ -<a name="clear_peers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bclear_peers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bclear_peers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="clear-peers">
│ │ │ │ -<h2>clear_peers()</h2>
│ │ │ │ +<a name="new_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bnew_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bnew_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="new-torrent-1">
│ │ │ │ +<h2>new_torrent()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>clear_peers</strong> ();
│ │ │ │ +virtual storage_holder <strong>new_torrent</strong> (storage_params const&amp; p
│ │ │ │ +      , std::shared_ptr&lt;void&gt; const&amp; torrent) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>This will disconnect all peers and clear the peer list for this
│ │ │ │ -torrent. New peers will have to be acquired before resuming, from
│ │ │ │ -trackers, DHT or local service discovery, for example.</p>
│ │ │ │ -<a name="set_max_uploads()"></a>
│ │ │ │ -<a name="max_uploads()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_max_uploads%28%29+max_uploads%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_max_uploads%28%29+max_uploads%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-max-uploads-max-uploads">
│ │ │ │ -<h2>set_max_uploads() max_uploads()</h2>
│ │ │ │ +<p>this is called when a new torrent is added. The shared_ptr can be
│ │ │ │ +used to hold the internal torrent object alive as long as there are
│ │ │ │ +outstanding disk operations on the storage.
│ │ │ │ +The returned <a class="reference external" href="reference-Custom_Storage.html#storage_holder">storage_holder</a> is an owning reference to the underlying
│ │ │ │ +storage that was just created. It is fundamentally a storage_index_t</p>
│ │ │ │ +<a name="remove_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bremove_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bremove_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="remove-torrent">
│ │ │ │ +<h2>remove_torrent()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_max_uploads</strong> (int max_uploads) const;
│ │ │ │ -int <strong>max_uploads</strong> () const;
│ │ │ │ +virtual void <strong>remove_torrent</strong> (storage_index_t) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">set_max_uploads()</tt> sets the maximum number of peers that's unchoked
│ │ │ │ -at the same time on this torrent. If you set this to -1, there will be
│ │ │ │ -no limit. This defaults to infinite. The primary setting controlling
│ │ │ │ -this is the global unchoke slots limit, set by unchoke_slots_limit in
│ │ │ │ -<a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>.</p>
│ │ │ │ -<p><tt class="docutils literal">max_uploads()</tt> returns the current settings.</p>
│ │ │ │ -<a name="max_connections()"></a>
│ │ │ │ -<a name="set_max_connections()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bmax_connections%28%29+set_max_connections%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bmax_connections%28%29+set_max_connections%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="max-connections-set-max-connections">
│ │ │ │ -<h2>max_connections() set_max_connections()</h2>
│ │ │ │ +<p>remove the storage with the specified index. This is not expected to
│ │ │ │ +delete any files from disk, just to clean up any resources associated
│ │ │ │ +with the specified storage.</p>
│ │ │ │ +<a name="async_read()"></a>
│ │ │ │ +<a name="async_write()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_read%28%29+async_write%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_read%28%29+async_write%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-read-async-write">
│ │ │ │ +<h2>async_read() async_write()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -int <strong>max_connections</strong> () const;
│ │ │ │ -void <strong>set_max_connections</strong> (int max_connections) const;
│ │ │ │ +virtual void <strong>async_read</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ +      , std::function&lt;void(disk_buffer_holder, storage_error const&amp;)&gt; handler
│ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ +virtual bool <strong>async_write</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ +      , char const* buf, std::shared_ptr&lt;disk_observer&gt; o
│ │ │ │ +      , std::function&lt;void(storage_error const&amp;)&gt; handler
│ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p><tt class="docutils literal">set_max_connections()</tt> sets the maximum number of connection this
│ │ │ │ -torrent will open. If all connections are used up, incoming
│ │ │ │ -connections may be refused or poor connections may be closed. This
│ │ │ │ -must be at least 2. The default is unlimited number of connections. If
│ │ │ │ --1 is given to the function, it means unlimited. There is also a
│ │ │ │ -global limit of the number of connections, set by
│ │ │ │ -<tt class="docutils literal">connections_limit</tt> in <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>.</p>
│ │ │ │ -<p><tt class="docutils literal">max_connections()</tt> returns the current settings.</p>
│ │ │ │ -<a name="move_storage()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bmove_storage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bmove_storage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="move-storage">
│ │ │ │ -<h2>move_storage()</h2>
│ │ │ │ +<p>perform a read or write operation from/to the specified storage
│ │ │ │ +index and the specified request. When the operation completes, call
│ │ │ │ +handler possibly with a <a class="reference external" href="reference-Custom_Storage.html#disk_buffer_holder">disk_buffer_holder</a>, holding the buffer with
│ │ │ │ +the result. Flags may be set to affect the read operation. See
│ │ │ │ +disk_job_flags_t.</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Custom_Storage.html#disk_observer">disk_observer</a> is a callback to indicate that
│ │ │ │ +the store buffer/disk write queue is below the watermark to let peers
│ │ │ │ +start writing buffers to disk again. When <tt class="docutils literal">async_write()</tt> returns
│ │ │ │ +<tt class="docutils literal">true</tt>, indicating the write queue is full, the peer will stop
│ │ │ │ +further writes and wait for the passed-in <tt class="docutils literal">disk_observer</tt> to be
│ │ │ │ +notified before resuming.</p>
│ │ │ │ +<p>Note that for <tt class="docutils literal">async_read</tt>, the <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> (<tt class="docutils literal">r</tt>) is not
│ │ │ │ +necessarily aligned to blocks (but it is most of the time). However,
│ │ │ │ +all writes (passed to <tt class="docutils literal">async_write</tt>) are guaranteed to be block
│ │ │ │ +aligned.</p>
│ │ │ │ +<a name="async_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-hash">
│ │ │ │ +<h2>async_hash()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>move_storage</strong> (std::string const&amp; save_path
│ │ │ │ -      , move_flags_t flags = move_flags_t::always_replace_files
│ │ │ │ -      ) const;
│ │ │ │ +virtual void <strong>async_hash</strong> (storage_index_t storage, piece_index_t piece, span&lt;sha256_hash&gt; v2
│ │ │ │ +      , disk_job_flags_t flags
│ │ │ │ +      , std::function&lt;void(piece_index_t, sha1_hash const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>Moves the file(s) that this torrent are currently seeding from or
│ │ │ │ -downloading to. If the given <tt class="docutils literal">save_path</tt> is not located on the same
│ │ │ │ -drive as the original save path, the files will be copied to the new
│ │ │ │ -drive and removed from their original location. This will block all
│ │ │ │ -other disk IO, and other torrents download and upload rates may drop
│ │ │ │ -while copying the file.</p>
│ │ │ │ -<p>Since disk IO is performed in a separate thread, this operation is
│ │ │ │ -also asynchronous. Once the operation completes, the
│ │ │ │ -<tt class="docutils literal">storage_moved_alert</tt> is generated, with the new path as the
│ │ │ │ -message. If the move fails for some reason,
│ │ │ │ -<tt class="docutils literal">storage_moved_failed_alert</tt> is generated instead, containing the
│ │ │ │ -error message.</p>
│ │ │ │ -<p>The <tt class="docutils literal">flags</tt> argument determines the behavior of the copying/moving
│ │ │ │ -of the files in the torrent. see <a class="reference external" href="reference-Storage.html#move_flags_t">move_flags_t</a>.</p>
│ │ │ │ -<p><tt class="docutils literal">always_replace_files</tt> is the default and replaces any file that
│ │ │ │ -exist in both the source directory and the target directory.</p>
│ │ │ │ -<p><tt class="docutils literal">fail_if_exist</tt> first check to see that none of the copy operations
│ │ │ │ -would cause an overwrite. If it would, it will fail. Otherwise it will
│ │ │ │ -proceed as if it was in <tt class="docutils literal">always_replace_files</tt> mode. Note that there
│ │ │ │ -is an inherent race condition here. If the files in the target
│ │ │ │ -directory appear after the check but before the copy or move
│ │ │ │ -completes, they will be overwritten. When failing because of files
│ │ │ │ -already existing in the target path, the <tt class="docutils literal">error</tt> of
│ │ │ │ -<tt class="docutils literal">move_storage_failed_alert</tt> is set to
│ │ │ │ -<tt class="docutils literal"><span class="pre">boost::system::errc::file_exists</span></tt>.</p>
│ │ │ │ -<p>The intention is that a client may use this as a probe, and if it
│ │ │ │ -fails, ask the user which mode to use. The client may then re-issue
│ │ │ │ -the <tt class="docutils literal">move_storage</tt> call with one of the other modes.</p>
│ │ │ │ -<p><tt class="docutils literal">dont_replace</tt> always keeps the existing file in the target
│ │ │ │ -directory, if there is one. The source files will still be removed in
│ │ │ │ -that case. Note that it won't automatically re-check files. If an
│ │ │ │ -incomplete torrent is moved into a directory with the complete files,
│ │ │ │ -pause, move, force-recheck and resume. Without the re-checking, the
│ │ │ │ -torrent will keep downloading and files in the new download directory
│ │ │ │ -will be overwritten.</p>
│ │ │ │ -<p>Files that have been renamed to have absolute paths are not moved by
│ │ │ │ -this function. Keep in mind that files that don't belong to the
│ │ │ │ -torrent but are stored in the torrent's directory may be moved as
│ │ │ │ -well. This goes for files that have been renamed to absolute paths
│ │ │ │ -that still end up inside the save path.</p>
│ │ │ │ -<p>When copying files, sparse regions are not likely to be preserved.
│ │ │ │ -This makes it proportionally more expensive to move a large torrent
│ │ │ │ -when only few pieces have been downloaded, since the files are then
│ │ │ │ -allocated with zeros in the destination directory.</p>
│ │ │ │ -<a name="rename_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Brename_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Brename_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="rename-file">
│ │ │ │ -<h2>rename_file()</h2>
│ │ │ │ +<p>Compute hash(es) for the specified piece. Unless the v1_hash flag is
│ │ │ │ +set (in <tt class="docutils literal">flags</tt>), the SHA-1 hash of the whole piece does not need
│ │ │ │ +to be computed.</p>
│ │ │ │ +<p>The <cite>v2</cite> span is optional and can be empty, which means v2 hashes
│ │ │ │ +should not be computed. If v2 is non-empty it must be at least large
│ │ │ │ +enough to hold all v2 blocks in the piece, and this function will
│ │ │ │ +fill in the span with the SHA-256 block hashes of the piece.</p>
│ │ │ │ +<a name="async_hash2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_hash2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_hash2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-hash2">
│ │ │ │ +<h2>async_hash2()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_name) const;
│ │ │ │ +virtual void <strong>async_hash2</strong> (storage_index_t storage, piece_index_t piece, int offset, disk_job_flags_t flags
│ │ │ │ +      , std::function&lt;void(piece_index_t, sha256_hash const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>Renames the file with the given index asynchronously. The rename
│ │ │ │ -operation is complete when either a <a class="reference external" href="reference-Alerts.html#file_renamed_alert">file_renamed_alert</a> or
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#file_rename_failed_alert">file_rename_failed_alert</a> is posted.</p>
│ │ │ │ -<a name="info_hashes()"></a>
│ │ │ │ -<a name="info_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="info-hashes-info-hash">
│ │ │ │ -<h2>info_hashes() info_hash()</h2>
│ │ │ │ +<p>computes the v2 hash (SHA-256) of a single block. The block at
│ │ │ │ +<tt class="docutils literal">offset</tt> in piece <tt class="docutils literal">piece</tt>.</p>
│ │ │ │ +<a name="async_move_storage()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_move_storage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_move_storage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-move-storage">
│ │ │ │ +<h2>async_move_storage()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -info_hash_t <strong>info_hashes</strong> () const;
│ │ │ │ -sha1_hash <strong>info_hash</strong> () const;
│ │ │ │ +virtual void <strong>async_move_storage</strong> (storage_index_t storage, std::string p, move_flags_t flags
│ │ │ │ +      , std::function&lt;void(status_t, std::string const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>returns the info-hash(es) of the torrent. If this handle is to a
│ │ │ │ -torrent that hasn't loaded yet (for instance by being added) by a
│ │ │ │ -URL, the returned value is undefined.
│ │ │ │ -The <tt class="docutils literal">info_hash()</tt> returns the SHA-1 info-hash for v1 torrents and a
│ │ │ │ -truncated hash for v2 torrents. For the full v2 info-hash, use
│ │ │ │ -<tt class="docutils literal">info_hashes()</tt> instead.</p>
│ │ │ │ -<a name="operator!=()"></a>
│ │ │ │ -<a name="operator==()"></a>
│ │ │ │ -<a name="operator<()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Boperator%21%3D%28%29+operator%3D%3D%28%29+operator%3C%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Boperator%21%3D%28%29+operator%3D%3D%28%29+operator%3C%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="operator-operator-operator">
│ │ │ │ -<h2>operator!=() operator==() operator&lt;()</h2>
│ │ │ │ +<p>called to request the files for the specified storage/torrent be
│ │ │ │ +moved to a new location. It is the disk I/O object's responsibility
│ │ │ │ +to synchronize this with any currently outstanding disk operations to
│ │ │ │ +the storage. Whether files are replaced at the destination path or
│ │ │ │ +not is controlled by <tt class="docutils literal">flags</tt> (see <a class="reference external" href="reference-Storage.html#move_flags_t">move_flags_t</a>).</p>
│ │ │ │ +<a name="async_release_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_release_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_release_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-release-files">
│ │ │ │ +<h2>async_release_files()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>operator!=</strong> (const torrent_handle&amp; h) const;
│ │ │ │ -bool <strong>operator&lt;</strong> (const torrent_handle&amp; h) const;
│ │ │ │ -bool <strong>operator==</strong> (const torrent_handle&amp; h) const;
│ │ │ │ +virtual void <strong>async_release_files</strong> (storage_index_t storage
│ │ │ │ +      , std::function&lt;void()&gt; handler = std::function&lt;void()&gt;()) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>comparison operators. The order of the torrents is unspecified
│ │ │ │ -but stable.</p>
│ │ │ │ -<a name="id()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bid%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="id">
│ │ │ │ -<h2>id()</h2>
│ │ │ │ +<p>This is called on disk I/O objects to request they close all open
│ │ │ │ +files for the specified storage/torrent. If file handles are not
│ │ │ │ +pooled/cached, it can be a no-op. For truly asynchronous disk I/O,
│ │ │ │ +this should provide at least one point in time when all files are
│ │ │ │ +closed. It is possible that later asynchronous operations will
│ │ │ │ +re-open some of the files, by the time this completion handler is
│ │ │ │ +called, that's fine.</p>
│ │ │ │ +<a name="async_check_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_check_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_check_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-check-files">
│ │ │ │ +<h2>async_check_files()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::uint32_t <strong>id</strong> () const;
│ │ │ │ +virtual void <strong>async_check_files</strong> (storage_index_t storage
│ │ │ │ +      , add_torrent_params const* resume_data
│ │ │ │ +      , aux::vector&lt;std::string, file_index_t&gt; links
│ │ │ │ +      , std::function&lt;void(status_t, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>returns a unique identifier for this torrent. It's not a dense index.
│ │ │ │ -It's not preserved across sessions.</p>
│ │ │ │ -<a name="native_handle()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bnative_handle%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bnative_handle%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="native-handle">
│ │ │ │ -<h2>native_handle()</h2>
│ │ │ │ +<p>this is called when torrents are added to validate their resume data
│ │ │ │ +against the files on disk. This function is expected to do a few things:</p>
│ │ │ │ +<p>if <tt class="docutils literal">links</tt> is non-empty, it contains a string for each file in the
│ │ │ │ +torrent. The string being a path to an existing identical file. The
│ │ │ │ +default behavior is to create hard links of those files into the
│ │ │ │ +storage of the new torrent (specified by <tt class="docutils literal">storage</tt>). An empty
│ │ │ │ +string indicates that there is no known identical file. This is part
│ │ │ │ +of the &quot;mutable torrent&quot; feature, where files can be reused from
│ │ │ │ +other torrents.</p>
│ │ │ │ +<p>The <tt class="docutils literal">resume_data</tt> points the resume data passed in by the client.</p>
│ │ │ │ +<p>If the <tt class="docutils literal"><span class="pre">resume_data-&gt;flags</span></tt> field has the seed_mode flag set, all
│ │ │ │ +files/pieces are expected to be on disk already. This should be
│ │ │ │ +verified. Not just the existence of the file, but also that it has
│ │ │ │ +the correct size.</p>
│ │ │ │ +<p>Any file with a piece set in the <tt class="docutils literal"><span class="pre">resume_data-&gt;have_pieces</span></tt> bitmask
│ │ │ │ +should exist on disk, this should be verified. Pad files and files
│ │ │ │ +with zero priority may be skipped.</p>
│ │ │ │ +<a name="async_stop_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_stop_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_stop_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-stop-torrent">
│ │ │ │ +<h2>async_stop_torrent()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::shared_ptr&lt;torrent&gt; <strong>native_handle</strong> () const;
│ │ │ │ +virtual void <strong>async_stop_torrent</strong> (storage_index_t storage
│ │ │ │ +      , std::function&lt;void()&gt; handler = std::function&lt;void()&gt;()) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>This function is intended only for use by plugins and the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -dispatch function. This type does not have a stable ABI and should
│ │ │ │ -be relied on as little as possible. Accessing the handle returned by
│ │ │ │ -this function is not thread safe outside of libtorrent's internal
│ │ │ │ -thread (which is used to invoke <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> callbacks).
│ │ │ │ -The <tt class="docutils literal">torrent</tt> class is not only eligible for changing ABI across
│ │ │ │ -minor versions of libtorrent, its layout is also dependent on build
│ │ │ │ -configuration. This adds additional requirements on a client to be
│ │ │ │ -built with the exact same build configuration as libtorrent itself.
│ │ │ │ -i.e. the <tt class="docutils literal">TORRENT_</tt> macros must match between libtorrent and the
│ │ │ │ -client builds.</p>
│ │ │ │ -<a name="userdata()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Buserdata%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Buserdata%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="userdata">
│ │ │ │ -<h2>userdata()</h2>
│ │ │ │ +<p>This is called when a torrent is stopped. It gives the disk I/O
│ │ │ │ +object an opportunity to flush any data to disk that's currently kept
│ │ │ │ +cached. This function should at least do the same thing as
│ │ │ │ +<a class="reference external" href="reference-Custom_Storage.html#async_release_files()">async_release_files()</a>.</p>
│ │ │ │ +<a name="async_rename_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_rename_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_rename_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-rename-file">
│ │ │ │ +<h2>async_rename_file()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -client_data_t <strong>userdata</strong> () const;
│ │ │ │ +virtual void <strong>async_rename_file</strong> (storage_index_t storage
│ │ │ │ +      , file_index_t index, std::string name
│ │ │ │ +      , std::function&lt;void(std::string const&amp;, file_index_t, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>returns the userdata pointer as set in <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a></p>
│ │ │ │ -<a name="in_session()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bin_session%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bin_session%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="in-session">
│ │ │ │ -<h2>in_session()</h2>
│ │ │ │ +<p>This function is called when the name of a file in the specified
│ │ │ │ +storage has been requested to be renamed. The disk I/O object is
│ │ │ │ +responsible for renaming the file without racing with other
│ │ │ │ +potentially outstanding operations against the file (such as read,
│ │ │ │ +write, move, etc.).</p>
│ │ │ │ +<a name="async_delete_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_delete_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_delete_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-delete-files">
│ │ │ │ +<h2>async_delete_files()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>in_session</strong> () const;
│ │ │ │ +virtual void <strong>async_delete_files</strong> (storage_index_t storage, remove_flags_t options
│ │ │ │ +      , std::function&lt;void(storage_error const&amp;)&gt; handler) = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>Returns true if the torrent is in the <a class="reference external" href="reference-Session.html#session">session</a>. It returns true before
│ │ │ │ -session::remove_torrent() is called, and false afterward.</p>
│ │ │ │ -<p>Note that this is a blocking function, unlike <a class="reference external" href="reference-Torrent_Handle.html#is_valid()">torrent_handle::is_valid()</a>
│ │ │ │ -which returns immediately.</p>
│ │ │ │ -<a name="overwrite_existing"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Boverwrite_existing%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Boverwrite_existing%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>overwrite_existing</dt>
│ │ │ │ -<dd>instruct libtorrent to overwrite any data that may already have been
│ │ │ │ -downloaded with the data of the new piece being added. Using this
│ │ │ │ -flag when adding a piece that is actively being downloaded from other
│ │ │ │ -peers may have some unexpected consequences, as blocks currently
│ │ │ │ -being downloaded from peers may not be replaced.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="query_distributed_copies"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_distributed_copies%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_distributed_copies%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>query_distributed_copies</dt>
│ │ │ │ -<dd>calculates <tt class="docutils literal">distributed_copies</tt>, <tt class="docutils literal">distributed_full_copies</tt> and
│ │ │ │ -<tt class="docutils literal">distributed_fraction</tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="query_accurate_download_counters"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_accurate_download_counters%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_accurate_download_counters%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>query_accurate_download_counters</dt>
│ │ │ │ -<dd>includes partial downloaded blocks in <tt class="docutils literal">total_done</tt> and
│ │ │ │ -<tt class="docutils literal">total_wanted_done</tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="query_last_seen_complete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_last_seen_complete%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_last_seen_complete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>query_last_seen_complete</dt>
│ │ │ │ -<dd>includes <tt class="docutils literal">last_seen_complete</tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="query_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_pieces%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>query_pieces</dt>
│ │ │ │ -<dd>populate the <tt class="docutils literal">pieces</tt> field in <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="query_verified_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_verified_pieces%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_verified_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>query_verified_pieces</dt>
│ │ │ │ -<dd>includes <tt class="docutils literal">verified_pieces</tt> (only applies to torrents in <em>seed
│ │ │ │ -mode</em>).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="query_torrent_file"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_torrent_file%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_torrent_file%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>query_torrent_file</dt>
│ │ │ │ -<dd>includes <tt class="docutils literal">torrent_file</tt>, which is all the static information from
│ │ │ │ -the .torrent file.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="query_name"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_name%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_name%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>query_name</dt>
│ │ │ │ -<dd>includes <tt class="docutils literal">name</tt>, the name of the torrent. This is either derived
│ │ │ │ -from the .torrent file, or from the <tt class="docutils literal">&amp;dn=</tt> magnet link argument
│ │ │ │ -or possibly some other source. If the name of the torrent is not
│ │ │ │ -known, this is an empty string.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="query_save_path"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_save_path%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_save_path%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>query_save_path</dt>
│ │ │ │ -<dd>includes <tt class="docutils literal">save_path</tt>, the path to the directory the files of the
│ │ │ │ -torrent are saved to.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_when_available"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Balert_when_available%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Balert_when_available%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>alert_when_available</dt>
│ │ │ │ -<dd>used to ask libtorrent to send an <a class="reference external" href="reference-Alerts.html#alert">alert</a> once the piece has been
│ │ │ │ -downloaded, by passing alert_when_available. When set, the
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#read_piece_alert">read_piece_alert</a> <a class="reference external" href="reference-Alerts.html#alert">alert</a> will be delivered, with the piece data, when
│ │ │ │ -it's downloaded.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="piece_granularity"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpiece_granularity%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpiece_granularity%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>piece_granularity</dt>
│ │ │ │ -<dd>only calculate file progress at piece granularity. This makes
│ │ │ │ -the <a class="reference external" href="reference-Torrent_Handle.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.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="graceful_pause"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bgraceful_pause%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bgraceful_pause%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>graceful_pause</dt>
│ │ │ │ -<dd>will delay the disconnect of peers that we're still downloading
│ │ │ │ -outstanding requests from. The torrent will not accept any more
│ │ │ │ -requests and will disconnect all idle peers. As soon as a peer is done
│ │ │ │ -transferring the blocks that were requested from it, it is
│ │ │ │ -disconnected. This is a graceful shut down of the torrent in the sense
│ │ │ │ -that no downloaded bytes are wasted.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="flush_disk_cache"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bflush_disk_cache%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bflush_disk_cache%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>flush_disk_cache</dt>
│ │ │ │ -<dd>the disk cache will be flushed before creating the resume data.
│ │ │ │ -This avoids a problem with file timestamps in the resume data in
│ │ │ │ -case the cache hasn't been flushed yet.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="save_info_dict"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bsave_info_dict%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bsave_info_dict%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>save_info_dict</dt>
│ │ │ │ -<dd>the resume data will contain the metadata from the torrent file as
│ │ │ │ -well. This is useful for clients that don't keep .torrent files
│ │ │ │ -around separately, or for torrents that were added via a magnet link.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="only_if_modified"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bonly_if_modified%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bonly_if_modified%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>only_if_modified</dt>
│ │ │ │ -<dd>this flag has the same behavior as the combination of:
│ │ │ │ -if_counters_changed | if_download_progress | if_config_changed |
│ │ │ │ -if_state_changed | if_metadata_changed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="if_counters_changed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bif_counters_changed%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bif_counters_changed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>if_counters_changed</dt>
│ │ │ │ -<dd>save resume data if any <a class="reference external" href="reference-Stats.html#counters">counters</a> has changed since the last time
│ │ │ │ -resume data was saved. This includes upload/download <a class="reference external" href="reference-Stats.html#counters">counters</a>, active
│ │ │ │ -time <a class="reference external" href="reference-Stats.html#counters">counters</a> and scrape data. A torrent that is not paused will have
│ │ │ │ -its active time <a class="reference external" href="reference-Stats.html#counters">counters</a> incremented continuously.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="if_download_progress"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bif_download_progress%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bif_download_progress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>if_download_progress</dt>
│ │ │ │ -<dd>save the resume data if any blocks have been downloaded since the
│ │ │ │ -last time resume data was saved. This includes:
│ │ │ │ -* checking existing files on disk
│ │ │ │ -* downloading a block from a peer</dd>
│ │ │ │ +<p>This function is called when some file(s) on disk have been requested
│ │ │ │ +to be removed by the client. <tt class="docutils literal">storage</tt> indicates which torrent is
│ │ │ │ +referred to. See <a class="reference external" href="reference-Session.html#session_handle">session_handle</a> for <tt class="docutils literal">remove_flags_t</tt> flags
│ │ │ │ +indicating which files are to be removed.
│ │ │ │ +e.g. <a class="reference external" href="reference-Session.html#delete_files">session_handle::delete_files</a> - delete all files
│ │ │ │ +<a class="reference external" href="reference-Session.html#delete_partfile">session_handle::delete_partfile</a> - only delete part file.</p>
│ │ │ │ +<a name="async_set_file_priority()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_set_file_priority%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_set_file_priority%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-set-file-priority">
│ │ │ │ +<h2>async_set_file_priority()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual void <strong>async_set_file_priority</strong> (storage_index_t storage
│ │ │ │ +      , aux::vector&lt;download_priority_t, file_index_t&gt; prio
│ │ │ │ +      , std::function&lt;void(storage_error const&amp;
│ │ │ │ +      , aux::vector&lt;download_priority_t, file_index_t&gt;)&gt; handler) = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>This is called to set the priority of some or all files. Changing the
│ │ │ │ +priority from or to 0 may involve moving data to and from the
│ │ │ │ +partfile. The disk I/O object is responsible for correctly
│ │ │ │ +synchronizing this work to not race with any potentially outstanding
│ │ │ │ +asynchronous operations affecting these files.</p>
│ │ │ │ +<p><tt class="docutils literal">prio</tt> is a vector of the file priority for all files. If it's
│ │ │ │ +shorter than the total number of files in the torrent, they are
│ │ │ │ +assumed to be set to the default priority.</p>
│ │ │ │ +<a name="async_clear_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_clear_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_clear_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-clear-piece">
│ │ │ │ +<h2>async_clear_piece()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual void <strong>async_clear_piece</strong> (storage_index_t storage, piece_index_t index
│ │ │ │ +      , std::function&lt;void(piece_index_t)&gt; handler) = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>This is called when a piece fails the hash check, to ensure there are
│ │ │ │ +no outstanding disk operations to the piece before blocks are
│ │ │ │ +re-requested from peers to overwrite the existing blocks. The disk I/O
│ │ │ │ +object does not need to perform any action other than synchronize
│ │ │ │ +with all outstanding disk operations to the specified piece before
│ │ │ │ +posting the result back.</p>
│ │ │ │ +<a name="update_stats_counters()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bupdate_stats_counters%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bupdate_stats_counters%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="update-stats-counters">
│ │ │ │ +<h2>update_stats_counters()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual void <strong>update_stats_counters</strong> (counters&amp; c) const = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p><a class="reference external" href="reference-Custom_Storage.html#update_stats_counters()">update_stats_counters()</a> is called to give the disk storage an
│ │ │ │ +opportunity to update gauges in the <tt class="docutils literal">c</tt> stats <a class="reference external" href="reference-Stats.html#counters">counters</a>, that aren't
│ │ │ │ +updated continuously as operations are performed. This is called
│ │ │ │ +before a snapshot of the <a class="reference external" href="reference-Stats.html#counters">counters</a> are passed to the client.</p>
│ │ │ │ +<a name="get_status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bget_status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bget_status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-status">
│ │ │ │ +<h2>get_status()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual std::vector&lt;open_file_state&gt; <strong>get_status</strong> (storage_index_t) const = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>Return a list of all the files that are currently open for the
│ │ │ │ +specified storage/torrent. This is is just used for the client to
│ │ │ │ +query the currently open files, and which modes those files are open
│ │ │ │ +in.</p>
│ │ │ │ +<a name="abort()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Babort%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Babort%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="abort-1">
│ │ │ │ +<h2>abort()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual void <strong>abort</strong> (bool wait) = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>this is called when the <a class="reference external" href="reference-Session.html#session">session</a> is starting to shut down. The disk
│ │ │ │ +I/O object is expected to flush any outstanding write jobs, cancel
│ │ │ │ +hash jobs and initiate tearing down of any internal threads. If
│ │ │ │ +<tt class="docutils literal">wait</tt> is true, this should be asynchronous. i.e. this call should
│ │ │ │ +not return until all threads have stopped and all jobs have either
│ │ │ │ +been aborted or completed and the disk I/O object is ready to be
│ │ │ │ +destructed.</p>
│ │ │ │ +<a name="submit_jobs()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bsubmit_jobs%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bsubmit_jobs%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="submit-jobs">
│ │ │ │ +<h2>submit_jobs()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual void <strong>submit_jobs</strong> () = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>This will be called after a batch of disk jobs has been issues (via
│ │ │ │ +the <tt class="docutils literal">async_*</tt> ). It gives the disk I/O object an opportunity to
│ │ │ │ +notify any potential condition variables to wake up the disk
│ │ │ │ +thread(s). The <tt class="docutils literal">async_*</tt> calls can of course also notify condition
│ │ │ │ +variables, but doing it in this call allows for batching jobs, by
│ │ │ │ +issuing the notification once for a collection of jobs.</p>
│ │ │ │ +<a name="settings_updated()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bsettings_updated%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bsettings_updated%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="settings-updated">
│ │ │ │ +<h2>settings_updated()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual void <strong>settings_updated</strong> () = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>This is called to notify the disk I/O object that the settings have
│ │ │ │ +been updated. In the disk io constructor, a <a class="reference external" href="reference-Custom_Storage.html#settings_interface">settings_interface</a>
│ │ │ │ +reference is passed in. Whenever these settings are updated, this
│ │ │ │ +function is called to allow the disk I/O object to react to any
│ │ │ │ +changed settings relevant to its operations.</p>
│ │ │ │ +<a name="force_copy"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bforce_copy%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bforce_copy%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>force_copy</dt>
│ │ │ │ +<dd>force making a copy of the cached block, rather than getting a
│ │ │ │ +reference to a block already in the cache. This is used the block is
│ │ │ │ +expected to be overwritten very soon, by async_write()`, and we need
│ │ │ │ +access to the previous content.</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="if_config_changed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bif_config_changed%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bif_config_changed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>if_config_changed</dt>
│ │ │ │ -<dd>save the resume data if configuration options changed since last time
│ │ │ │ -the resume data was saved. This includes:
│ │ │ │ -* file- or piece priorities
│ │ │ │ -* upload- and download rate limits
│ │ │ │ -* change max-uploads (unchoke slots)
│ │ │ │ -* change max connection limit
│ │ │ │ -* enable/disable peer-exchange, local service discovery or DHT
│ │ │ │ -* enable/disable apply IP-filter
│ │ │ │ -* enable/disable auto-managed
│ │ │ │ -* enable/disable share-mode
│ │ │ │ -* enable/disable sequential-mode
│ │ │ │ -* files renamed
│ │ │ │ -* storage moved (save_path changed)</dd>
│ │ │ │ +<a name="sequential_access"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bsequential_access%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bsequential_access%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>sequential_access</dt>
│ │ │ │ +<dd>hint that there may be more disk operations with sequential access to
│ │ │ │ +the file</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="if_state_changed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bif_state_changed%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bif_state_changed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>if_state_changed</dt>
│ │ │ │ -<dd>save the resume data if torrent state has changed since last time the
│ │ │ │ -resume data was saved. This includes:
│ │ │ │ -* upload mode
│ │ │ │ -* paused state
│ │ │ │ -* super-seeding
│ │ │ │ -* seed-mode</dd>
│ │ │ │ +<a name="volatile_read"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bvolatile_read%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bvolatile_read%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>volatile_read</dt>
│ │ │ │ +<dd>don't keep the read block in cache. This is a hint that this block is
│ │ │ │ +unlikely to be read again anytime soon, and caching it would be
│ │ │ │ +wasteful.</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="if_metadata_changed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bif_metadata_changed%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bif_metadata_changed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>if_metadata_changed</dt>
│ │ │ │ -<dd>save the resume data if any <em>metadata</em> changed since the last time
│ │ │ │ -resume data was saved. This includes:
│ │ │ │ -* add/remove web seeds
│ │ │ │ -* add/remove trackers
│ │ │ │ -* receiving metadata for a magnet link</dd>
│ │ │ │ +<a name="v1_hash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bv1_hash%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bv1_hash%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>v1_hash</dt>
│ │ │ │ +<dd>compute a v1 piece hash. This is only used by the <a class="reference external" href="reference-Custom_Storage.html#async_hash()">async_hash()</a> call.
│ │ │ │ +If this flag is not set in the <a class="reference external" href="reference-Custom_Storage.html#async_hash()">async_hash()</a> call, the SHA-1 piece
│ │ │ │ +hash does not need to be computed.</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="ignore_min_interval"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bignore_min_interval%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bignore_min_interval%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>ignore_min_interval</dt>
│ │ │ │ -<dd>by default, force-reannounce will still honor the min-interval
│ │ │ │ -published by the tracker. If this flag is set, it will be ignored
│ │ │ │ -and the tracker is announced immediately.</dd>
│ │ │ │ +<a name="flush_piece"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bflush_piece%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bflush_piece%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>flush_piece</dt>
│ │ │ │ +<dd>this flag instructs a hash job that we just completed this piece, and
│ │ │ │ +it should be flushed to disk</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="hash_value()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hash_value%28%29&labels=documentation&body=Documentation+under+heading+%22hash_value%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<a name="storage_holder"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_holder&labels=documentation&body=Documentation+under+heading+%22class+storage_holder%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │ -<div class="section" id="hash-value">
│ │ │ │ -<h1>hash_value()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::size_t <strong>hash_value</strong> (torrent_handle const&amp; h);
│ │ │ │ -</pre>
│ │ │ │ -<p>for std::hash (and to support using this type in unordered_map etc.)</p>
│ │ │ │ -<a name="web_seed_entry"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+web_seed_entry&labels=documentation&body=Documentation+under+heading+%22class+web_seed_entry%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="web-seed-entry">
│ │ │ │ -<h1>web_seed_entry</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_info.hpp">libtorrent/torrent_info.hpp</a>&quot;</p>
│ │ │ │ -<p>the <a class="reference external" href="reference-Torrent_Info.html#web_seed_entry">web_seed_entry</a> holds information about a web seed (also known
│ │ │ │ -as URL seed or HTTP seed). It is essentially a URL with some state
│ │ │ │ -associated with it. For more information, see <a class="reference external" href="https://www.bittorrent.org/beps/bep_0017.html">BEP 17</a> and <a class="reference external" href="https://www.bittorrent.org/beps/bep_0019.html">BEP 19</a>.</p>
│ │ │ │ +<div class="section" id="storage-holder">
│ │ │ │ +<h1>storage_holder</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_interface.hpp">libtorrent/disk_interface.hpp</a>&quot;</p>
│ │ │ │ +<p>a unique, owning, reference to the storage of a torrent in a disk io
│ │ │ │ +subsystem (class that implements <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a>). This is held by the
│ │ │ │ +internal libtorrent torrent object to tie the storage object allocated
│ │ │ │ +for a torrent to the lifetime of the internal torrent object. When a
│ │ │ │ +torrent is removed from the <a class="reference external" href="reference-Session.html#session">session</a>, this holder is destructed and will
│ │ │ │ +inform the disk object.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct web_seed_entry
│ │ │ │ +struct storage_holder
│ │ │ │  {
│ │ │ │ -   bool <strong>operator==</strong> (web_seed_entry const&amp; e) const;
│ │ │ │ -   bool <strong>operator&lt;</strong> (web_seed_entry const&amp; e) const;
│ │ │ │ -
│ │ │ │ -   enum type_t
│ │ │ │ -   {
│ │ │ │ -      url_seed,
│ │ │ │ -      http_seed,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   std::string url;
│ │ │ │ -   std::string auth;
│ │ │ │ -   headers_t extra_headers;
│ │ │ │ -   std::uint8_t type;
│ │ │ │ +   <strong>storage_holder</strong> () = default;
│ │ │ │ +   <strong>storage_holder</strong> (storage_index_t idx, disk_interface&amp; disk_io);
│ │ │ │ +   <strong>~storage_holder</strong> ();
│ │ │ │ +   explicit operator <strong>bool</strong> () const;
│ │ │ │ +   operator <strong>storage_index_t</strong> () const;
│ │ │ │ +   void <strong>reset</strong> ();
│ │ │ │ +   <strong>storage_holder</strong> (storage_holder const&amp;) = delete;
│ │ │ │ +   storage_holder&amp; <strong>operator=</strong> (storage_holder const&amp;) = delete;
│ │ │ │ +   <strong>storage_holder</strong> (storage_holder&amp;&amp; rhs) noexcept;
│ │ │ │ +   storage_holder&amp; <strong>operator=</strong> (storage_holder&amp;&amp; rhs) noexcept;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="operator==()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Boperator%3D%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Boperator%3D%3D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-1">
│ │ │ │ -<h2>operator==()</h2>
│ │ │ │ +<a name="disk_observer"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+disk_observer&labels=documentation&body=Documentation+under+heading+%22class+disk_observer%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="disk-observer">
│ │ │ │ +<h1>disk_observer</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_observer.hpp">libtorrent/disk_observer.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>operator==</strong> (web_seed_entry const&amp; e) const;
│ │ │ │ +struct disk_observer
│ │ │ │ +{
│ │ │ │ +   virtual void <strong>on_disk</strong> () = 0;
│ │ │ │ +};
│ │ │ │  </pre>
│ │ │ │ -<p>URL and type comparison</p>
│ │ │ │ -<a name="operator<()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Boperator%3C%28%29%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Boperator%3C%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="operator-2">
│ │ │ │ -<h2>operator&lt;()</h2>
│ │ │ │ +<a name="on_disk()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_observer%3A%3A%5Bon_disk%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_observer%3A%3A%5Bon_disk%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="on-disk">
│ │ │ │ +<h2>on_disk()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>operator&lt;</strong> (web_seed_entry const&amp; e) const;
│ │ │ │ +virtual void <strong>on_disk</strong> () = 0;
│ │ │ │  </pre>
│ │ │ │ -<p>URL and type less-than comparison</p>
│ │ │ │ -<a name="type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+type_t&labels=documentation&body=Documentation+under+heading+%22enum+type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-type-t">
│ │ │ │ -<h2>enum type_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_info.hpp">libtorrent/torrent_info.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ +<p>called when the disk cache size has dropped
│ │ │ │ +below the low watermark again and we can
│ │ │ │ +resume downloading from peers</p>
│ │ │ │ +<a name="file_open_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_open_mode_t&labels=documentation&body=Documentation+under+heading+%22file_open_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="file-open-mode-t">
│ │ │ │ +<h1>file_open_mode_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_interface.hpp">libtorrent/disk_interface.hpp</a>&quot;</p>
│ │ │ │ +<a name="file_open_mode_t::read_only"></a><dl class="docutils">
│ │ │ │ +<dt>read_only</dt>
│ │ │ │ +<dd>open the file for reading only</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_open_mode_t::write_only"></a><dl class="docutils">
│ │ │ │ +<dt>write_only</dt>
│ │ │ │ +<dd>open the file for writing only</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_open_mode_t::read_write"></a><dl class="docutils">
│ │ │ │ +<dt>read_write</dt>
│ │ │ │ +<dd>open the file for reading and writing</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_open_mode_t::rw_mask"></a><dl class="docutils">
│ │ │ │ +<dt>rw_mask</dt>
│ │ │ │ +<dd>the mask for the bits determining read or write mode</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_open_mode_t::sparse"></a><dl class="docutils">
│ │ │ │ +<dt>sparse</dt>
│ │ │ │ +<dd>open the file in sparse mode (if supported by the
│ │ │ │ +filesystem).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_open_mode_t::no_atime"></a><dl class="docutils">
│ │ │ │ +<dt>no_atime</dt>
│ │ │ │ +<dd>don't update the access timestamps on the file (if
│ │ │ │ +supported by the operating system and filesystem).
│ │ │ │ +this generally improves disk performance.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_open_mode_t::random_access"></a><dl class="docutils">
│ │ │ │ +<dt>random_access</dt>
│ │ │ │ +<dd>When this is not set, the kernel is hinted that access to this file will
│ │ │ │ +be made sequentially.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_open_mode_t::mmapped"></a><dl class="docutils">
│ │ │ │ +<dt>mmapped</dt>
│ │ │ │ +<dd>the file is memory mapped</dd>
│ │ │ │ +</dl>
│ │ │ │ +<p>You have some control over <a class="reference external" href="reference-Session.html#session">session</a> configuration through the session::apply_settings()
│ │ │ │ +member function. To change one or more configuration options, create a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>
│ │ │ │ +object and fill it with the settings to be set and pass it in to session::apply_settings().</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> object is a collection of settings updates that are applied
│ │ │ │ +to the <a class="reference external" href="reference-Session.html#session">session</a> when passed to session::apply_settings(). It's empty when
│ │ │ │ +constructed.</p>
│ │ │ │ +<p>You have control over proxy and authorization settings and also the user-agent
│ │ │ │ +that will be sent to the tracker. The user-agent will also be used to identify the
│ │ │ │ +client with other peers.</p>
│ │ │ │ +<p>Each configuration option is named with an enum value inside the
│ │ │ │ +<a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> class. These are the available settings:</p>
│ │ │ │ +<a name="settings_pack"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+settings_pack&labels=documentation&body=Documentation+under+heading+%22class+settings_pack%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="settings-pack">
│ │ │ │ +<h1>settings_pack</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<p>The <tt class="docutils literal">settings_pack</tt> struct, contains the names of all settings as
│ │ │ │ +enum values. These values are passed in to the <tt class="docutils literal">set_str()</tt>,
│ │ │ │ +<tt class="docutils literal">set_int()</tt>, <tt class="docutils literal">set_bool()</tt> functions, to specify the setting to
│ │ │ │ +change.</p>
│ │ │ │ +<p>The <tt class="docutils literal">settings_pack</tt> only stores values for settings that have been
│ │ │ │ +explicitly set on this object. However, it can still be queried for
│ │ │ │ +settings that have not been set and returns the default value for those
│ │ │ │ +settings.</p>
│ │ │ │ +<a name="user_agent"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="35%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ -<col width="42%" />
│ │ │ │ +<col width="36%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +<col width="39%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">value</th>
│ │ │ │ -<th class="head">description</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>url_seed</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ +<tr><td>user_agent</td>
│ │ │ │ +<td>string</td>
│ │ │ │ +<td>libtorrent/</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>http_seed</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>this is the client identification to the tracker. The recommended
│ │ │ │ +format of this string is: &quot;client-name/client-version
│ │ │ │ +libtorrent/libtorrent-version&quot;. This name will not only be used when
│ │ │ │ +making HTTP requests, but also when sending extended headers to
│ │ │ │ +peers that support that extension. It may not contain r or n</p>
│ │ │ │ +<a name="announce_ip"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="43%" />
│ │ │ │ +<col width="27%" />
│ │ │ │ +<col width="30%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>announce_ip</td>
│ │ │ │ +<td>string</td>
│ │ │ │ +<td>nullptr</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="url"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Burl%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Burl%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>url</dt>
│ │ │ │ -<dd>The URL of the web seed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="auth"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Bauth%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Bauth%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>auth</dt>
│ │ │ │ -<dd>Optional authentication. If this is set, it's passed
│ │ │ │ -in as HTTP basic auth to the web seed. The format is:
│ │ │ │ -username:password.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="extra_headers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Bextra_headers%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Bextra_headers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>extra_headers</dt>
│ │ │ │ -<dd>Any extra HTTP headers that need to be passed to the web seed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Btype%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Btype%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>type</dt>
│ │ │ │ -<dd>The type of web seed (see <a class="reference external" href="reference-Bdecoding.html#type_t">type_t</a>)</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="load_torrent_limits"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+load_torrent_limits&labels=documentation&body=Documentation+under+heading+%22class+load_torrent_limits%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="load-torrent-limits">
│ │ │ │ -<h1>load_torrent_limits</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_info.hpp">libtorrent/torrent_info.hpp</a>&quot;</p>
│ │ │ │ -<p>this object holds configuration options for limits to use when loading
│ │ │ │ -torrents. They are meant to prevent loading potentially malicious torrents
│ │ │ │ -that cause excessive memory allocations.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct load_torrent_limits
│ │ │ │ -{
│ │ │ │ -   int <strong>max_buffer_size</strong>  = 10000000;
│ │ │ │ -   int <strong>max_pieces</strong>  = 0x200000;
│ │ │ │ -   int <strong>max_decode_depth</strong>  = 100;
│ │ │ │ -   int <strong>max_decode_tokens</strong>  = 3000000;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="max_buffer_size"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_limits%3A%3A%5Bmax_buffer_size%5D&labels=documentation&body=Documentation+under+heading+%22load_torrent_limits%3A%3A%5Bmax_buffer_size%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>max_buffer_size</dt>
│ │ │ │ -<dd>the max size of a .torrent file to load into RAM</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="max_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_limits%3A%3A%5Bmax_pieces%5D&labels=documentation&body=Documentation+under+heading+%22load_torrent_limits%3A%3A%5Bmax_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>max_pieces</dt>
│ │ │ │ -<dd>the max number of pieces allowed in the torrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="max_decode_depth"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_limits%3A%3A%5Bmax_decode_depth%5D&labels=documentation&body=Documentation+under+heading+%22load_torrent_limits%3A%3A%5Bmax_decode_depth%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>max_decode_depth</dt>
│ │ │ │ -<dd>the max recursion depth in the bdecoded structure</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="max_decode_tokens"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_limits%3A%3A%5Bmax_decode_tokens%5D&labels=documentation&body=Documentation+under+heading+%22load_torrent_limits%3A%3A%5Bmax_decode_tokens%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>max_decode_tokens</dt>
│ │ │ │ -<dd>the max number of bdecode tokens</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_info&labels=documentation&body=Documentation+under+heading+%22class+torrent_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-info">
│ │ │ │ -<h1>torrent_info</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_info.hpp">libtorrent/torrent_info.hpp</a>&quot;</p>
│ │ │ │ -<p>the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> class holds the information found in a .torrent file.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -class torrent_info
│ │ │ │ -{
│ │ │ │ -   explicit <strong>torrent_info</strong> (span&lt;char const&gt; buffer, from_span_t);
│ │ │ │ -   <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg);
│ │ │ │ -   <strong>torrent_info</strong> (std::string const&amp; filename, error_code&amp; ec);
│ │ │ │ -   <strong>torrent_info</strong> (char const* buffer, int size);
│ │ │ │ -   explicit <strong>torrent_info</strong> (std::string const&amp; filename);
│ │ │ │ -   explicit <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file);
│ │ │ │ -   explicit <strong>torrent_info</strong> (info_hash_t const&amp; info_hash);
│ │ │ │ -   <strong>torrent_info</strong> (std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ -   <strong>torrent_info</strong> (span&lt;char const&gt; buffer, error_code&amp; ec, from_span_t);
│ │ │ │ -   <strong>torrent_info</strong> (char const* buffer, int size, error_code&amp; ec);
│ │ │ │ -   <strong>torrent_info</strong> (span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg, from_span_t);
│ │ │ │ -   <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, error_code&amp; ec);
│ │ │ │ -   <strong>torrent_info</strong> (torrent_info const&amp; t);
│ │ │ │ -   <strong>~torrent_info</strong> ();
│ │ │ │ -   file_storage const&amp; <strong>files</strong> () const;
│ │ │ │ -   file_storage const&amp; <strong>orig_files</strong> () const;
│ │ │ │ -   void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │ -   void <strong>remap_files</strong> (file_storage const&amp; f);
│ │ │ │ -   void <strong>add_tracker</strong> (std::string const&amp; url, int tier
│ │ │ │ -      , announce_entry::tracker_source source);
│ │ │ │ -   void <strong>add_tracker</strong> (std::string const&amp; url, int tier = 0);
│ │ │ │ -   std::vector&lt;announce_entry&gt; const&amp; <strong>trackers</strong> () const;
│ │ │ │ -   void <strong>clear_trackers</strong> ();
│ │ │ │ -   std::vector&lt;sha1_hash&gt; <strong>similar_torrents</strong> () const;
│ │ │ │ -   std::vector&lt;std::string&gt; <strong>collections</strong> () const;
│ │ │ │ -   void <strong>set_web_seeds</strong> (std::vector&lt;web_seed_entry&gt; seeds);
│ │ │ │ -   void <strong>add_http_seed</strong> (std::string const&amp; url
│ │ │ │ -      , std::string const&amp; extern_auth = std::string()
│ │ │ │ -      , web_seed_entry::headers_t const&amp; extra_headers = web_seed_entry::headers_t());
│ │ │ │ -   std::vector&lt;web_seed_entry&gt; const&amp; <strong>web_seeds</strong> () const;
│ │ │ │ -   void <strong>add_url_seed</strong> (std::string const&amp; url
│ │ │ │ -      , std::string const&amp; ext_auth = std::string()
│ │ │ │ -      , web_seed_entry::headers_t const&amp; ext_headers = web_seed_entry::headers_t());
│ │ │ │ -   std::int64_t <strong>total_size</strong> () const;
│ │ │ │ -   int <strong>piece_length</strong> () const;
│ │ │ │ -   int <strong>num_pieces</strong> () const;
│ │ │ │ -   int <strong>blocks_per_piece</strong> () const;
│ │ │ │ -   piece_index_t <strong>last_piece</strong> () const;
│ │ │ │ -   piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ -   index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const;
│ │ │ │ -   sha1_hash <strong>info_hash</strong> () const noexcept;
│ │ │ │ -   info_hash_t const&amp; <strong>info_hashes</strong> () const;
│ │ │ │ -   bool <strong>v2</strong> () const;
│ │ │ │ -   bool <strong>v1</strong> () const;
│ │ │ │ -   int <strong>num_files</strong> () const;
│ │ │ │ -   std::vector&lt;file_slice&gt; <strong>map_block</strong> (piece_index_t const piece
│ │ │ │ -      , std::int64_t offset, int size) const;
│ │ │ │ -   peer_request <strong>map_file</strong> (file_index_t const file, std::int64_t offset, int size) const;
│ │ │ │ -   string_view <strong>ssl_cert</strong> () const;
│ │ │ │ -   bool <strong>is_valid</strong> () const;
│ │ │ │ -   bool <strong>priv</strong> () const;
│ │ │ │ -   bool <strong>is_i2p</strong> () const;
│ │ │ │ -   int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │ -   sha1_hash <strong>hash_for_piece</strong> (piece_index_t index) const;
│ │ │ │ -   char const* <strong>hash_for_piece_ptr</strong> (piece_index_t const index) const;
│ │ │ │ -   bool <strong>is_loaded</strong> () const;
│ │ │ │ -   const std::string&amp; <strong>name</strong> () const;
│ │ │ │ -   std::time_t <strong>creation_date</strong> () const;
│ │ │ │ -   const std::string&amp; <strong>creator</strong> () const;
│ │ │ │ -   const std::string&amp; <strong>comment</strong> () const;
│ │ │ │ -   std::vector&lt;std::pair&lt;std::string, int&gt;&gt; const&amp; <strong>nodes</strong> () const;
│ │ │ │ -   void <strong>add_node</strong> (std::pair&lt;std::string, int&gt; const&amp; node);
│ │ │ │ -   bool <strong>parse_info_section</strong> (bdecode_node const&amp; info, error_code&amp; ec, int max_pieces);
│ │ │ │ -   bdecode_node <strong>info</strong> (char const* key) const;
│ │ │ │ -   span&lt;char const&gt; <strong>info_section</strong> () const;
│ │ │ │ -   span&lt;char const&gt; <strong>piece_layer</strong> (file_index_t) const;
│ │ │ │ -   void <strong>free_piece_layers</strong> ();
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="torrent_info()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Btorrent_info%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Btorrent_info%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="torrent-info-1">
│ │ │ │ -<h2>torrent_info()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -explicit <strong>torrent_info</strong> (span&lt;char const&gt; buffer, from_span_t);
│ │ │ │ -<strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg);
│ │ │ │ -<strong>torrent_info</strong> (std::string const&amp; filename, error_code&amp; ec);
│ │ │ │ -<strong>torrent_info</strong> (char const* buffer, int size);
│ │ │ │ -explicit <strong>torrent_info</strong> (std::string const&amp; filename);
│ │ │ │ -explicit <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file);
│ │ │ │ -explicit <strong>torrent_info</strong> (info_hash_t const&amp; info_hash);
│ │ │ │ -<strong>torrent_info</strong> (std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ -<strong>torrent_info</strong> (span&lt;char const&gt; buffer, error_code&amp; ec, from_span_t);
│ │ │ │ -<strong>torrent_info</strong> (char const* buffer, int size, error_code&amp; ec);
│ │ │ │ -<strong>torrent_info</strong> (span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg, from_span_t);
│ │ │ │ -<strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, error_code&amp; ec);
│ │ │ │ -<strong>torrent_info</strong> (torrent_info const&amp; t);
│ │ │ │ -</pre>
│ │ │ │ -<p>The constructor that takes an info-hash will initialize the info-hash
│ │ │ │ -to the given value, but leave all other fields empty. This is used
│ │ │ │ -internally when downloading torrents without the metadata. The
│ │ │ │ -metadata will be created by libtorrent as soon as it has been
│ │ │ │ -downloaded from the swarm.</p>
│ │ │ │ -<p>The constructor that takes a <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> will create a <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>
│ │ │ │ -object from the information found in the given torrent_file. The
│ │ │ │ -<a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> represents a tree node in an bencoded file. To load an
│ │ │ │ -ordinary .torrent file into a <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>, use <a class="reference external" href="reference-Bdecoding.html#bdecode()">bdecode()</a>.</p>
│ │ │ │ -<p>The version that takes a buffer pointer and a size will decode it as a
│ │ │ │ -.torrent file and initialize the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object for you.</p>
│ │ │ │ -<p>The version that takes a filename will simply load the torrent file
│ │ │ │ -and decode it inside the constructor, for convenience. This might not
│ │ │ │ -be the most suitable for applications that want to be able to report
│ │ │ │ -detailed errors on what might go wrong.</p>
│ │ │ │ -<p>There is an upper limit on the size of the torrent file that will be
│ │ │ │ -loaded by the overload taking a filename. If it's important that even
│ │ │ │ -very large torrent files are loaded, use one of the other overloads.</p>
│ │ │ │ -<p>The overloads that takes an <tt class="docutils literal">error_code const&amp;</tt> never throws if an
│ │ │ │ -error occur, they will simply set the error code to describe what went
│ │ │ │ -wrong and not fully initialize the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object. The overloads
│ │ │ │ -that do not take the extra error_code parameter will always throw if
│ │ │ │ -an error occurs. These overloads are not available when building
│ │ │ │ -without exception support.</p>
│ │ │ │ -<p>The overload that takes a <tt class="docutils literal">span</tt> also needs an extra parameter of
│ │ │ │ -type <tt class="docutils literal">from_span_t</tt> to disambiguate the <tt class="docutils literal"><span class="pre">std::string</span></tt> overload for
│ │ │ │ -string literals. There is an object in the libtorrent namespace of this
│ │ │ │ -type called <tt class="docutils literal">from_span</tt>.</p>
│ │ │ │ -<a name="~torrent_info()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5B~torrent_info%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5B~torrent_info%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-info-2">
│ │ │ │ -<h2>~torrent_info()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>~torrent_info</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>frees all storage associated with this <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object</p>
│ │ │ │ -<a name="files()"></a>
│ │ │ │ -<a name="orig_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bfiles%28%29+orig_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bfiles%28%29+orig_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="files-orig-files">
│ │ │ │ -<h2>files() orig_files()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -file_storage const&amp; <strong>files</strong> () const;
│ │ │ │ -file_storage const&amp; <strong>orig_files</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>The <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object contains the information on how to map the
│ │ │ │ -pieces to files. It is separated from the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object because
│ │ │ │ -when creating torrents a storage object needs to be created without
│ │ │ │ -having a torrent file. When renaming files in a storage, the storage
│ │ │ │ -needs to make its own copy of the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> in order to make its
│ │ │ │ -mapping differ from the one in the torrent file.</p>
│ │ │ │ -<p><tt class="docutils literal">orig_files()</tt> returns the original (unmodified) file storage for
│ │ │ │ -this torrent. This is used by the web server connection, which needs
│ │ │ │ -to request files with the original names. Filename may be changed using
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_info::rename_file()</span></tt>.</p>
│ │ │ │ -<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><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Brename_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Brename_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="rename-file-1">
│ │ │ │ -<h2>rename_file()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │ -</pre>
│ │ │ │ -<p>Renames the file with the specified index to the new name. The new
│ │ │ │ -filename is reflected by the <tt class="docutils literal">file_storage</tt> returned by <tt class="docutils literal">files()</tt>
│ │ │ │ -but not by the one returned by <tt class="docutils literal">orig_files()</tt>.</p>
│ │ │ │ -<p>If you want to rename the base name of the torrent (for a multi file
│ │ │ │ -torrent), you can copy the <tt class="docutils literal">file_storage</tt> (see <a class="reference external" href="reference-Create_Torrents.html#files()">files()</a> and
│ │ │ │ -<a class="reference external" href="reference-Torrent_Info.html#orig_files()">orig_files()</a> ), change the name, and then use <a class="reference internal" href="#remap-files">remap_files()</a>.</p>
│ │ │ │ -<p>The <tt class="docutils literal">new_filename</tt> can both be a relative path, in which case the
│ │ │ │ -file name is relative to the <tt class="docutils literal">save_path</tt> of the torrent. If the
│ │ │ │ -<tt class="docutils literal">new_filename</tt> is an absolute path (i.e. <tt class="docutils literal">is_complete(new_filename)
│ │ │ │ -== true</tt>), then the file is detached from the <tt class="docutils literal">save_path</tt> of the
│ │ │ │ -torrent. In this case the file is not moved when <a class="reference external" href="reference-Torrent_Handle.html#move_storage()">move_storage()</a> is
│ │ │ │ -invoked.</p>
│ │ │ │ -<a name="remap_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bremap_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bremap_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="remap-files">
│ │ │ │ -<h2>remap_files()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>remap_files</strong> (file_storage const&amp; f);
│ │ │ │ -</pre>
│ │ │ │ -<div class="admonition warning">
│ │ │ │ -<p class="first admonition-title">Warning</p>
│ │ │ │ -<p class="last">Using <cite>remap_files()</cite> is discouraged as it's incompatible with v2
│ │ │ │ -torrents. This is because the piece boundaries and piece hashes in
│ │ │ │ -v2 torrents are intimately tied to the file boundaries. Instead,
│ │ │ │ -just rename individual files, or implement a custom <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a>
│ │ │ │ -to customize how to store files.</p>
│ │ │ │ -</div>
│ │ │ │ -<p>Remaps the file storage to a new file layout. This can be used to, for
│ │ │ │ -instance, download all data in a torrent to a single file, or to a
│ │ │ │ -number of fixed size sector aligned files, regardless of the number
│ │ │ │ -and sizes of the files in the torrent.</p>
│ │ │ │ -<p>The new specified <tt class="docutils literal">file_storage</tt> must have the exact same size as
│ │ │ │ -the current one.</p>
│ │ │ │ -<a name="add_tracker()"></a>
│ │ │ │ -<a name="clear_trackers()"></a>
│ │ │ │ -<a name="trackers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Badd_tracker%28%29+clear_trackers%28%29+trackers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Badd_tracker%28%29+clear_trackers%28%29+trackers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-tracker-clear-trackers-trackers">
│ │ │ │ -<h2>add_tracker() clear_trackers() trackers()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_tracker</strong> (std::string const&amp; url, int tier
│ │ │ │ -      , announce_entry::tracker_source source);
│ │ │ │ -void <strong>add_tracker</strong> (std::string const&amp; url, int tier = 0);
│ │ │ │ -std::vector&lt;announce_entry&gt; const&amp; <strong>trackers</strong> () const;
│ │ │ │ -void <strong>clear_trackers</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">add_tracker()</tt> adds a tracker to the announce-list. The <tt class="docutils literal">tier</tt>
│ │ │ │ -determines the order in which the trackers are to be tried.
│ │ │ │ -The <tt class="docutils literal">trackers()</tt> function will return a sorted vector of
│ │ │ │ -<a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a>. Each announce <a class="reference external" href="reference-Bencoding.html#entry">entry</a> contains a string, which is
│ │ │ │ -the tracker url, and a tier index. The tier index is the high-level
│ │ │ │ -priority. No matter which trackers that works or not, the ones with
│ │ │ │ -lower tier will always be tried before the one with higher tier
│ │ │ │ -number. For more information, see <a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a>.</p>
│ │ │ │ -<p><tt class="docutils literal">trackers()</tt> returns all entries from announce-list.</p>
│ │ │ │ -<p><tt class="docutils literal">clear_trackers()</tt> removes all trackers from announce-list.</p>
│ │ │ │ -<a name="collections()"></a>
│ │ │ │ -<a name="similar_torrents()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bcollections%28%29+similar_torrents%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bcollections%28%29+similar_torrents%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="collections-similar-torrents">
│ │ │ │ -<h2>collections() similar_torrents()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::vector&lt;sha1_hash&gt; <strong>similar_torrents</strong> () const;
│ │ │ │ -std::vector&lt;std::string&gt; <strong>collections</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>These two functions are related to <a class="reference external" href="https://www.bittorrent.org/beps/bep_0038.html">BEP 38</a> (mutable torrents). The
│ │ │ │ -vectors returned from these correspond to the &quot;similar&quot; and
│ │ │ │ -&quot;collections&quot; keys in the .torrent file. Both info-hashes and
│ │ │ │ -collections from within the info-dict and from outside of it are
│ │ │ │ -included.</p>
│ │ │ │ -<a name="add_http_seed()"></a>
│ │ │ │ -<a name="set_web_seeds()"></a>
│ │ │ │ -<a name="add_url_seed()"></a>
│ │ │ │ -<a name="web_seeds()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Badd_http_seed%28%29+set_web_seeds%28%29+add_url_seed%28%29+web_seeds%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Badd_http_seed%28%29+set_web_seeds%28%29+add_url_seed%28%29+web_seeds%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-http-seed-set-web-seeds-add-url-seed-web-seeds">
│ │ │ │ -<h2>add_http_seed() set_web_seeds() add_url_seed() web_seeds()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_web_seeds</strong> (std::vector&lt;web_seed_entry&gt; seeds);
│ │ │ │ -void <strong>add_http_seed</strong> (std::string const&amp; url
│ │ │ │ -      , std::string const&amp; extern_auth = std::string()
│ │ │ │ -      , web_seed_entry::headers_t const&amp; extra_headers = web_seed_entry::headers_t());
│ │ │ │ -std::vector&lt;web_seed_entry&gt; const&amp; <strong>web_seeds</strong> () const;
│ │ │ │ -void <strong>add_url_seed</strong> (std::string const&amp; url
│ │ │ │ -      , std::string const&amp; ext_auth = std::string()
│ │ │ │ -      , web_seed_entry::headers_t const&amp; ext_headers = web_seed_entry::headers_t());
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">web_seeds()</tt> returns all url seeds and http seeds in the torrent.
│ │ │ │ -Each <a class="reference external" href="reference-Bencoding.html#entry">entry</a> is a <tt class="docutils literal">web_seed_entry</tt> and may refer to either a url seed
│ │ │ │ -or http seed.</p>
│ │ │ │ -<p><tt class="docutils literal">add_url_seed()</tt> and <tt class="docutils literal">add_http_seed()</tt> adds one url to the list of
│ │ │ │ -url/http seeds.</p>
│ │ │ │ -<p><tt class="docutils literal">set_web_seeds()</tt> replaces all web seeds with the ones specified in
│ │ │ │ -the <tt class="docutils literal">seeds</tt> vector.</p>
│ │ │ │ -<p>The <tt class="docutils literal">extern_auth</tt> argument can be used for other authorization
│ │ │ │ -schemes than basic HTTP authorization. If set, it will override any
│ │ │ │ -username and password found in the URL itself. The string will be sent
│ │ │ │ -as the HTTP authorization header's value (without specifying &quot;Basic&quot;).</p>
│ │ │ │ -<p>The <tt class="docutils literal">extra_headers</tt> argument defaults to an empty list, but can be
│ │ │ │ -used to insert custom HTTP headers in the requests to a specific web
│ │ │ │ -seed.</p>
│ │ │ │ -<p>See <a class="reference external" href="manual-ref.html#http-seeding">http seeding</a> for more information.</p>
│ │ │ │ -<a name="total_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Btotal_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Btotal_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="total-size">
│ │ │ │ -<h2>total_size()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::int64_t <strong>total_size</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">total_size()</tt> returns the total number of bytes the torrent-file
│ │ │ │ -represents. Note that this is the number of pieces times the piece
│ │ │ │ -size (modulo the last piece possibly being smaller). With pad files,
│ │ │ │ -the total size will be larger than the sum of all (regular) file
│ │ │ │ -sizes.</p>
│ │ │ │ -<a name="piece_length()"></a>
│ │ │ │ -<a name="num_pieces()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpiece_length%28%29+num_pieces%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpiece_length%28%29+num_pieces%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-length-num-pieces">
│ │ │ │ -<h2>piece_length() num_pieces()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>piece_length</strong> () const;
│ │ │ │ -int <strong>num_pieces</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">piece_length()</tt> and <tt class="docutils literal">num_pieces()</tt> returns the number of byte
│ │ │ │ -for each piece and the total number of pieces, respectively. The
│ │ │ │ -difference between <tt class="docutils literal">piece_size()</tt> and <tt class="docutils literal">piece_length()</tt> is that
│ │ │ │ -<tt class="docutils literal">piece_size()</tt> takes the piece index as argument and gives you the
│ │ │ │ -exact size of that piece. It will always 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="blocks_per_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bblocks_per_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bblocks_per_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="blocks-per-piece">
│ │ │ │ -<h2>blocks_per_piece()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>blocks_per_piece</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the number of blocks there are in the typical piece. There
│ │ │ │ -may be fewer in the last piece)</p>
│ │ │ │ -<a name="last_piece()"></a>
│ │ │ │ -<a name="end_piece()"></a>
│ │ │ │ -<a name="piece_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Blast_piece%28%29+end_piece%28%29+piece_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Blast_piece%28%29+end_piece%28%29+piece_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="last-piece-end-piece-piece-range">
│ │ │ │ -<h2>last_piece() end_piece() piece_range()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -piece_index_t <strong>last_piece</strong> () const;
│ │ │ │ -piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ -index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">last_piece()</tt> returns the index to the last piece in the torrent and
│ │ │ │ -<tt class="docutils literal">end_piece()</tt> returns the index to the one-past-end piece in the
│ │ │ │ -torrent
│ │ │ │ -<tt class="docutils literal">piece_range()</tt> returns an implementation-defined type that can be
│ │ │ │ -used as the container in a range-for loop. Where the values are the
│ │ │ │ -indices of all pieces in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │ -<a name="info_hashes()"></a>
│ │ │ │ -<a name="info_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="info-hashes-info-hash-1">
│ │ │ │ -<h2>info_hashes() info_hash()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -sha1_hash <strong>info_hash</strong> () const noexcept;
│ │ │ │ -info_hash_t const&amp; <strong>info_hashes</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the info-hash of the torrent. For BitTorrent v2 support, use
│ │ │ │ -<tt class="docutils literal">info_hashes()</tt> to get an object that may hold both a v1 and v2
│ │ │ │ -info-hash</p>
│ │ │ │ -<a name="v1()"></a>
│ │ │ │ -<a name="v2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bv1%28%29+v2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bv1%28%29+v2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="v1-v2">
│ │ │ │ -<h2>v1() v2()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>v2</strong> () const;
│ │ │ │ -bool <strong>v1</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns whether this torrent has v1 and/or v2 metadata, respectively.
│ │ │ │ -Hybrid torrents have both. These are shortcuts for
│ │ │ │ -info_hashes().has_v1() and info_hashes().has_v2() calls.</p>
│ │ │ │ -<a name="num_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bnum_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bnum_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="num-files">
│ │ │ │ -<h2>num_files()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>num_files</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>If you need index-access to files you can use the <tt class="docutils literal">num_files()</tt> along
│ │ │ │ -with the <tt class="docutils literal">file_path()</tt>, <tt class="docutils literal">file_size()</tt>-family of functions to access
│ │ │ │ -files using indices.</p>
│ │ │ │ -<a name="map_block()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bmap_block%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bmap_block%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="map-block">
│ │ │ │ -<h2>map_block()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::vector&lt;file_slice&gt; <strong>map_block</strong> (piece_index_t const piece
│ │ │ │ -      , std::int64_t offset, int size) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>This function will map a piece index, a byte offset within that piece
│ │ │ │ -and a size (in bytes) into the corresponding files with offsets where
│ │ │ │ -that data for that piece is supposed to be stored. See <a class="reference external" href="reference-Storage.html#file_slice">file_slice</a>.</p>
│ │ │ │ -<a name="map_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bmap_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bmap_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="map-file">
│ │ │ │ -<h2>map_file()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -peer_request <strong>map_file</strong> (file_index_t const file, std::int64_t offset, int size) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>This function will map a range in a specific file into a range in the
│ │ │ │ -torrent. The <tt class="docutils literal">file_offset</tt> parameter is the offset in the file,
│ │ │ │ -given in bytes, where 0 is the start of the file. See <a class="reference external" href="reference-Core.html#peer_request">peer_request</a>.</p>
│ │ │ │ -<p>The input range is assumed to be valid within the torrent.
│ │ │ │ -<tt class="docutils literal">file_offset</tt> + <tt class="docutils literal">size</tt> is not allowed to be greater than the file
│ │ │ │ -size. <tt class="docutils literal">file_index</tt> must refer to a valid file, i.e. it cannot be &gt;=
│ │ │ │ -<tt class="docutils literal">num_files()</tt>.</p>
│ │ │ │ -<a name="ssl_cert()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bssl_cert%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bssl_cert%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="ssl-cert">
│ │ │ │ -<h2>ssl_cert()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -string_view <strong>ssl_cert</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>Returns the SSL root certificate for the torrent, if it is an SSL
│ │ │ │ -torrent. Otherwise returns an empty string. The certificate is
│ │ │ │ -the public certificate in x509 format.</p>
│ │ │ │ -<a name="is_valid()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bis_valid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bis_valid%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="is-valid-1">
│ │ │ │ -<h2>is_valid()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>is_valid</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if this <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object has a torrent loaded.
│ │ │ │ -This is primarily used to determine if a magnet link has had its
│ │ │ │ -metadata resolved yet or not.</p>
│ │ │ │ -<a name="priv()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpriv%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpriv%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="priv">
│ │ │ │ -<h2>priv()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>priv</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if this torrent is private. i.e., the client should not
│ │ │ │ -advertise itself on the trackerless network (the Kademlia DHT) for this torrent.</p>
│ │ │ │ -<a name="is_i2p()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bis_i2p%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bis_i2p%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="is-i2p">
│ │ │ │ -<h2>is_i2p()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>is_i2p</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if this is an i2p torrent. This is determined by whether
│ │ │ │ -or not it has a tracker whose URL domain name ends with &quot;.i2p&quot;. i2p
│ │ │ │ -torrents disable the DHT and local peer discovery as well as talking
│ │ │ │ -to peers over anything other than the i2p network.</p>
│ │ │ │ -<a name="piece_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpiece_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpiece_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-size">
│ │ │ │ -<h2>piece_size()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the piece size of file with <tt class="docutils literal">index</tt>. This will be the same as <a class="reference external" href="reference-Create_Torrents.html#piece_length()">piece_length()</a>,
│ │ │ │ -except for the last piece, which may be shorter.</p>
│ │ │ │ -<a name="hash_for_piece_ptr()"></a>
│ │ │ │ -<a name="hash_for_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bhash_for_piece_ptr%28%29+hash_for_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bhash_for_piece_ptr%28%29+hash_for_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="hash-for-piece-ptr-hash-for-piece">
│ │ │ │ -<h2>hash_for_piece_ptr() hash_for_piece()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -sha1_hash <strong>hash_for_piece</strong> (piece_index_t index) const;
│ │ │ │ -char const* <strong>hash_for_piece_ptr</strong> (piece_index_t const index) const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">hash_for_piece()</tt> takes a piece-index and returns the 20-bytes
│ │ │ │ -sha1-hash for that piece and <tt class="docutils literal">info_hash()</tt> returns the 20-bytes
│ │ │ │ -sha1-hash for the info-section of the torrent file.
│ │ │ │ -<tt class="docutils literal">hash_for_piece_ptr()</tt> returns a pointer to the 20 byte sha1 digest
│ │ │ │ -for the piece. Note that the string is not 0-terminated.</p>
│ │ │ │ -<a name="name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bname%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bname%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="name">
│ │ │ │ -<h2>name()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -const std::string&amp; <strong>name</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">name()</tt> returns the name of the torrent.
│ │ │ │ -name contains UTF-8 encoded string.</p>
│ │ │ │ -<a name="creation_date()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bcreation_date%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bcreation_date%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="creation-date">
│ │ │ │ -<h2>creation_date()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::time_t <strong>creation_date</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">creation_date()</tt> returns the creation date of the torrent as time_t
│ │ │ │ -(<a class="reference internal" href="#posix-time">posix time</a>). If there's no time stamp in the torrent file, 0 is
│ │ │ │ -returned.
│ │ │ │ -.. <span class="target" id="posix-time">posix time</span>: <a class="reference external" href="http://www.opengroup.org/onlinepubs/009695399/functions/time.html">http://www.opengroup.org/onlinepubs/009695399/functions/time.html</a></p>
│ │ │ │ -<a name="creator()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bcreator%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bcreator%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="creator">
│ │ │ │ -<h2>creator()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -const std::string&amp; <strong>creator</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">creator()</tt> returns the creator string in the torrent. If there is
│ │ │ │ -no creator string it will return an empty string.</p>
│ │ │ │ -<a name="comment()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bcomment%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bcomment%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="comment">
│ │ │ │ -<h2>comment()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -const std::string&amp; <strong>comment</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">comment()</tt> returns the comment associated with the torrent. If
│ │ │ │ -there's no comment, it will return an empty string.
│ │ │ │ -comment contains UTF-8 encoded string.</p>
│ │ │ │ -<a name="nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bnodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bnodes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="nodes">
│ │ │ │ -<h2>nodes()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::vector&lt;std::pair&lt;std::string, int&gt;&gt; const&amp; <strong>nodes</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>If this torrent contains any DHT nodes, they are put in this vector in
│ │ │ │ -their original form (host name and port number).</p>
│ │ │ │ -<a name="add_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Badd_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Badd_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-node">
│ │ │ │ -<h2>add_node()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_node</strong> (std::pair&lt;std::string, int&gt; const&amp; node);
│ │ │ │ -</pre>
│ │ │ │ -<p>This is used when creating torrent. Use this to add a known DHT node.
│ │ │ │ -It may be used, by the client, to bootstrap into the DHT network.</p>
│ │ │ │ -<a name="parse_info_section()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bparse_info_section%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bparse_info_section%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="parse-info-section">
│ │ │ │ -<h2>parse_info_section()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>parse_info_section</strong> (bdecode_node const&amp; info, error_code&amp; ec, int max_pieces);
│ │ │ │ -</pre>
│ │ │ │ -<p>populates the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> by providing just the info-dict buffer.
│ │ │ │ -This is used when loading a torrent from a magnet link for instance,
│ │ │ │ -where we only have the info-dict. The <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> <tt class="docutils literal">e</tt> points to a
│ │ │ │ -parsed info-dictionary. <tt class="docutils literal">ec</tt> returns an error code if something
│ │ │ │ -fails (typically if the info dictionary is malformed).
│ │ │ │ -The <cite>max_pieces</cite> parameter allows limiting the amount of memory
│ │ │ │ -dedicated to loading the torrent, and fails for torrents that exceed
│ │ │ │ -the limit. To load large torrents, this limit may also need to be
│ │ │ │ -raised in <a class="reference external" href="reference-Settings.html#max_piece_count">settings_pack::max_piece_count</a> and in calls to
│ │ │ │ -<a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a>.</p>
│ │ │ │ -<a name="info()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Binfo%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Binfo%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="info">
│ │ │ │ -<h2>info()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bdecode_node <strong>info</strong> (char const* key) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>This function looks up keys from the info-dictionary of the loaded
│ │ │ │ -torrent file. It can be used to access extension values put in the
│ │ │ │ -.torrent file. If the specified key cannot be found, it returns nullptr.</p>
│ │ │ │ -<a name="info_section()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Binfo_section%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Binfo_section%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="info-section">
│ │ │ │ -<h2>info_section()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -span&lt;char const&gt; <strong>info_section</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a the raw info section of the torrent file.
│ │ │ │ -The underlying buffer is still owned by the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object</p>
│ │ │ │ -<a name="piece_layer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpiece_layer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpiece_layer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-layer">
│ │ │ │ -<h2>piece_layer()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -span&lt;char const&gt; <strong>piece_layer</strong> (file_index_t) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>return the bytes of the piece layer hashes for the specified file. If
│ │ │ │ -the file doesn't have a piece layer, an empty span is returned.
│ │ │ │ -The span size is divisible by 32, the size of a SHA-256 hash.
│ │ │ │ -If the size of the file is smaller than or equal to the piece size,
│ │ │ │ -the files &quot;root hash&quot; is the hash of the file and is not saved
│ │ │ │ -separately in the &quot;piece layers&quot; field, but this function still
│ │ │ │ -returns the root hash of the file in that case.</p>
│ │ │ │ -<a name="free_piece_layers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bfree_piece_layers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bfree_piece_layers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="free-piece-layers">
│ │ │ │ -<h2>free_piece_layers()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>free_piece_layers</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>clears the piece layers from the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>. This is done by the
│ │ │ │ -<a class="reference external" href="reference-Session.html#session">session</a> when a torrent is added, to avoid storing it twice. The piece
│ │ │ │ -layer (or other hashes part of the merkle tree) are stored in the
│ │ │ │ -internal torrent object.</p>
│ │ │ │ -<a name="hasher"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+hasher&labels=documentation&body=Documentation+under+heading+%22class+hasher%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="hasher">
│ │ │ │ -<h1>hasher</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/hasher.hpp">libtorrent/hasher.hpp</a>&quot;</p>
│ │ │ │ -<p>this is a SHA-1 hash class.</p>
│ │ │ │ -<p>You use it by first instantiating it, then call <tt class="docutils literal">update()</tt> to feed it
│ │ │ │ -with data. i.e. you don't have to keep the entire buffer of which you want to
│ │ │ │ -create the hash in memory. You can feed the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> parts of it at a time. When
│ │ │ │ -You have fed the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> with all the data, you call <tt class="docutils literal">final()</tt> and it
│ │ │ │ -will return the sha1-hash of the data.</p>
│ │ │ │ -<p>The constructor that takes a <tt class="docutils literal">char const*</tt> and an integer will construct the
│ │ │ │ -sha1 context and feed it the data passed in.</p>
│ │ │ │ -<p>If you want to reuse the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> object once you have created a hash, you have to
│ │ │ │ -call <tt class="docutils literal">reset()</tt> to reinitialize it.</p>
│ │ │ │ -<p>The built-in software version of sha1-algorithm was implemented
│ │ │ │ -by Steve Reid and released as public domain.
│ │ │ │ -For more info, see <tt class="docutils literal">src/sha1.cpp</tt>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -class hasher
│ │ │ │ -{
│ │ │ │ -   <strong>hasher</strong> ();
│ │ │ │ -   hasher&amp; <strong>operator=</strong> (hasher const&amp;) &amp;;
│ │ │ │ -   <strong>hasher</strong> (char const* data, int len);
│ │ │ │ -   explicit <strong>hasher</strong> (span&lt;char const&gt; data);
│ │ │ │ -   <strong>hasher</strong> (hasher const&amp;);
│ │ │ │ -   hasher&amp; <strong>update</strong> (span&lt;char const&gt; data);
│ │ │ │ -   hasher&amp; <strong>update</strong> (char const* data, int len);
│ │ │ │ -   sha1_hash <strong>final</strong> ();
│ │ │ │ -   void <strong>reset</strong> ();
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="operator=()"></a>
│ │ │ │ -<a name="hasher()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Boperator%3D%28%29+hasher%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Boperator%3D%28%29+hasher%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-hasher">
│ │ │ │ -<h2>operator=() hasher()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -hasher&amp; <strong>operator=</strong> (hasher const&amp;) &amp;;
│ │ │ │ -<strong>hasher</strong> (char const* data, int len);
│ │ │ │ -explicit <strong>hasher</strong> (span&lt;char const&gt; data);
│ │ │ │ -<strong>hasher</strong> (hasher const&amp;);
│ │ │ │ -</pre>
│ │ │ │ -<p>this is the same as default constructing followed by a call to
│ │ │ │ -<tt class="docutils literal">update(data, len)</tt>.</p>
│ │ │ │ -<a name="update()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Bupdate%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Bupdate%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="update">
│ │ │ │ -<h2>update()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -hasher&amp; <strong>update</strong> (span&lt;char const&gt; data);
│ │ │ │ -hasher&amp; <strong>update</strong> (char const* data, int len);
│ │ │ │ -</pre>
│ │ │ │ -<p>append the following bytes to what is being hashed</p>
│ │ │ │ -<a name="final()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Bfinal%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Bfinal%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="final">
│ │ │ │ -<h2>final()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -sha1_hash <strong>final</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the SHA-1 digest of the buffers previously passed to
│ │ │ │ -<a class="reference external" href="reference-Utility.html#update()">update()</a> and the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> constructor.</p>
│ │ │ │ -<a name="reset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Breset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Breset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="reset">
│ │ │ │ -<h2>reset()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>reset</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>restore the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> state to be as if the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> has just been
│ │ │ │ -default constructed.</p>
│ │ │ │ -<a name="hasher256"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+hasher256&labels=documentation&body=Documentation+under+heading+%22class+hasher256%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="hasher256">
│ │ │ │ -<h1>hasher256</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/hasher.hpp">libtorrent/hasher.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -class hasher256
│ │ │ │ -{
│ │ │ │ -   <strong>hasher256</strong> ();
│ │ │ │ -   <strong>hasher256</strong> (hasher256 const&amp;);
│ │ │ │ -   explicit <strong>hasher256</strong> (span&lt;char const&gt; data);
│ │ │ │ -   <strong>hasher256</strong> (char const* data, int len);
│ │ │ │ -   hasher256&amp; <strong>operator=</strong> (hasher256 const&amp;) &amp;;
│ │ │ │ -   hasher256&amp; <strong>update</strong> (span&lt;char const&gt; data);
│ │ │ │ -   hasher256&amp; <strong>update</strong> (char const* data, int len);
│ │ │ │ -   sha256_hash <strong>final</strong> ();
│ │ │ │ -   void <strong>reset</strong> ();
│ │ │ │ -   <strong>~hasher256</strong> ();
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="operator=()"></a>
│ │ │ │ -<a name="hasher256()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Boperator%3D%28%29+hasher256%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Boperator%3D%28%29+hasher256%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-hasher256">
│ │ │ │ -<h2>operator=() hasher256()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>hasher256</strong> (hasher256 const&amp;);
│ │ │ │ -explicit <strong>hasher256</strong> (span&lt;char const&gt; data);
│ │ │ │ -<strong>hasher256</strong> (char const* data, int len);
│ │ │ │ -hasher256&amp; <strong>operator=</strong> (hasher256 const&amp;) &amp;;
│ │ │ │ -</pre>
│ │ │ │ -<p>this is the same as default constructing followed by a call to
│ │ │ │ -<tt class="docutils literal">update(data, len)</tt>.</p>
│ │ │ │ -<a name="update()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Bupdate%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Bupdate%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="update-1">
│ │ │ │ -<h2>update()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -hasher256&amp; <strong>update</strong> (span&lt;char const&gt; data);
│ │ │ │ -hasher256&amp; <strong>update</strong> (char const* data, int len);
│ │ │ │ -</pre>
│ │ │ │ -<p>append the following bytes to what is being hashed</p>
│ │ │ │ -<a name="final()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Bfinal%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Bfinal%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="final-1">
│ │ │ │ -<h2>final()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -sha256_hash <strong>final</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the SHA-1 digest of the buffers previously passed to
│ │ │ │ -<a class="reference external" href="reference-Utility.html#update()">update()</a> and the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> constructor.</p>
│ │ │ │ -<a name="reset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Breset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Breset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="reset-1">
│ │ │ │ -<h2>reset()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>reset</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>restore the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> state to be as if the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> has just been
│ │ │ │ -default constructed.</p>
│ │ │ │ -<a name="bitfield"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+bitfield&labels=documentation&body=Documentation+under+heading+%22class+bitfield%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="bitfield">
│ │ │ │ -<h1>bitfield</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bitfield.hpp">libtorrent/bitfield.hpp</a>&quot;</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> type stores any number of bits as a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>
│ │ │ │ -in a heap allocated array.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct bitfield
│ │ │ │ -{
│ │ │ │ -   <strong>bitfield</strong> (int bits, bool val);
│ │ │ │ -   <strong>bitfield</strong> () noexcept = default;
│ │ │ │ -   explicit <strong>bitfield</strong> (int bits);
│ │ │ │ -   <strong>bitfield</strong> (char const* b, int bits);
│ │ │ │ -   <strong>bitfield</strong> (bitfield const&amp; rhs);
│ │ │ │ -   <strong>bitfield</strong> (bitfield&amp;&amp; rhs) noexcept = default;
│ │ │ │ -   void <strong>assign</strong> (char const* b, int const bits);
│ │ │ │ -   bool <strong>operator[]</strong> (int index) const noexcept;
│ │ │ │ -   bool <strong>get_bit</strong> (int index) const noexcept;
│ │ │ │ -   void <strong>clear_bit</strong> (int index) noexcept;
│ │ │ │ -   void <strong>set_bit</strong> (int index) noexcept;
│ │ │ │ -   bool <strong>all_set</strong> () const noexcept;
│ │ │ │ -   bool <strong>none_set</strong> () const noexcept;
│ │ │ │ -   int <strong>size</strong> () const noexcept;
│ │ │ │ -   int <strong>num_words</strong> () const noexcept;
│ │ │ │ -   int <strong>num_bytes</strong> () const noexcept;
│ │ │ │ -   bool <strong>empty</strong> () const noexcept;
│ │ │ │ -   char* <strong>data</strong> () noexcept;
│ │ │ │ -   char const* <strong>data</strong> () const noexcept;
│ │ │ │ -   void <strong>swap</strong> (bitfield&amp; rhs) noexcept;
│ │ │ │ -   int <strong>count</strong> () const noexcept;
│ │ │ │ -   int <strong>find_first_set</strong> () const noexcept;
│ │ │ │ -   int <strong>find_last_clear</strong> () const noexcept;
│ │ │ │ -   bool <strong>operator==</strong> (lt::bitfield const&amp; rhs) const;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="bitfield()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bbitfield%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bbitfield%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="bitfield-1">
│ │ │ │ -<h2>bitfield()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>bitfield</strong> (int bits, bool val);
│ │ │ │ -<strong>bitfield</strong> () noexcept = default;
│ │ │ │ -explicit <strong>bitfield</strong> (int bits);
│ │ │ │ -<strong>bitfield</strong> (char const* b, int bits);
│ │ │ │ -<strong>bitfield</strong> (bitfield const&amp; rhs);
│ │ │ │ -<strong>bitfield</strong> (bitfield&amp;&amp; rhs) noexcept = default;
│ │ │ │ -</pre>
│ │ │ │ -<p>constructs a new <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>. The default constructor creates an empty
│ │ │ │ -<a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>. <tt class="docutils literal">bits</tt> is the size of the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> (specified in bits).
│ │ │ │ -<tt class="docutils literal">val</tt> is the value to initialize the bits to. If not specified
│ │ │ │ -all bits are initialized to 0.</p>
│ │ │ │ -<p>The constructor taking a pointer <tt class="docutils literal">b</tt> and <tt class="docutils literal">bits</tt> copies a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>
│ │ │ │ -from the specified buffer, and <tt class="docutils literal">bits</tt> number of bits (rounded up to
│ │ │ │ -the nearest byte boundary).</p>
│ │ │ │ -<a name="assign()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bassign%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bassign%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="assign">
│ │ │ │ -<h2>assign()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>assign</strong> (char const* b, int const bits);
│ │ │ │ -</pre>
│ │ │ │ -<p>copy <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> from buffer <tt class="docutils literal">b</tt> of <tt class="docutils literal">bits</tt> number of bits, rounded up to
│ │ │ │ -the nearest byte boundary.</p>
│ │ │ │ -<a name="operator[]()"></a>
│ │ │ │ -<a name="get_bit()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Boperator%5B%5D%28%29+get_bit%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Boperator%5B%5D%28%29+get_bit%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="operator-get-bit">
│ │ │ │ -<h2>operator[]() get_bit()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>operator[]</strong> (int index) const noexcept;
│ │ │ │ -bool <strong>get_bit</strong> (int index) const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>query bit at <tt class="docutils literal">index</tt>. Returns true if bit is 1, otherwise false.</p>
│ │ │ │ -<a name="clear_bit()"></a>
│ │ │ │ -<a name="set_bit()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bclear_bit%28%29+set_bit%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bclear_bit%28%29+set_bit%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="clear-bit-set-bit">
│ │ │ │ -<h2>clear_bit() set_bit()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>clear_bit</strong> (int index) noexcept;
│ │ │ │ -void <strong>set_bit</strong> (int index) noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>set bit at <tt class="docutils literal">index</tt> to 0 (clear_bit) or 1 (set_bit).</p>
│ │ │ │ -<a name="all_set()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Ball_set%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Ball_set%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="all-set">
│ │ │ │ -<h2>all_set()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>all_set</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if all bits in the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> are set</p>
│ │ │ │ -<a name="none_set()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bnone_set%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bnone_set%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="none-set">
│ │ │ │ -<h2>none_set()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>none_set</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if no bit in the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> is set</p>
│ │ │ │ -<a name="size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bsize%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bsize%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="size">
│ │ │ │ -<h2>size()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>size</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the size of the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> in bits.</p>
│ │ │ │ -<a name="num_words()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bnum_words%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bnum_words%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="num-words">
│ │ │ │ -<h2>num_words()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>num_words</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the number of 32 bit words are needed to represent all bits in
│ │ │ │ -this <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>.</p>
│ │ │ │ -<a name="num_bytes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bnum_bytes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bnum_bytes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="num-bytes">
│ │ │ │ -<h2>num_bytes()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>num_bytes</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the number of bytes needed to represent all bits in this
│ │ │ │ -<a class="reference external" href="reference-Utility.html#bitfield">bitfield</a></p>
│ │ │ │ -<a name="empty()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bempty%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bempty%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="empty">
│ │ │ │ -<h2>empty()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>empty</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> has zero size.</p>
│ │ │ │ -<a name="data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bdata%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bdata%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="data">
│ │ │ │ -<h2>data()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char* <strong>data</strong> () noexcept;
│ │ │ │ -char const* <strong>data</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a pointer to the internal buffer of the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>, or
│ │ │ │ -<tt class="docutils literal">nullptr</tt> if it's empty.</p>
│ │ │ │ -<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="swap">
│ │ │ │ -<h2>swap()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>swap</strong> (bitfield&amp; rhs) noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>swaps the bit-fields two variables refer to</p>
│ │ │ │ -<a name="count()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bcount%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bcount%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="count">
│ │ │ │ -<h2>count()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>count</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>count the number of bits in the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> that are set to 1.</p>
│ │ │ │ -<a name="find_first_set()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bfind_first_set%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bfind_first_set%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="find-first-set">
│ │ │ │ -<h2>find_first_set()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>find_first_set</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the index of the first set bit in the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>, i.e. 1 bit.</p>
│ │ │ │ -<a name="find_last_clear()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bfind_last_clear%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bfind_last_clear%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="find-last-clear">
│ │ │ │ -<h2>find_last_clear()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>find_last_clear</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the index to the last cleared bit in the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>, i.e. 0 bit.</p>
│ │ │ │ -<a name="session_proxy"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_proxy&labels=documentation&body=Documentation+under+heading+%22class+session_proxy%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="session-proxy">
│ │ │ │ -<h1>session_proxy</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session.hpp">libtorrent/session.hpp</a>&quot;</p>
│ │ │ │ -<p>this is a holder for the internal <a class="reference external" href="reference-Session.html#session">session</a> implementation object. Once the
│ │ │ │ -<a class="reference external" href="reference-Session.html#session">session</a> destruction is explicitly initiated, this holder is used to
│ │ │ │ -synchronize the completion of the shutdown. The lifetime of this object
│ │ │ │ -may outlive <a class="reference external" href="reference-Session.html#session">session</a>, causing the <a class="reference external" href="reference-Session.html#session">session</a> destructor to not block. The
│ │ │ │ -<a class="reference external" href="reference-Session.html#session_proxy">session_proxy</a> destructor will block however, until the underlying <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │ -is done shutting down.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct session_proxy
│ │ │ │ -{
│ │ │ │ -   session_proxy&amp; <strong>operator=</strong> (session_proxy const&amp;) &amp;;
│ │ │ │ -   <strong>session_proxy</strong> (session_proxy&amp;&amp;) noexcept;
│ │ │ │ -   <strong>~session_proxy</strong> ();
│ │ │ │ -   <strong>session_proxy</strong> ();
│ │ │ │ -   <strong>session_proxy</strong> (session_proxy const&amp;);
│ │ │ │ -   session_proxy&amp; <strong>operator=</strong> (session_proxy&amp;&amp;) &amp; noexcept;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="operator=()"></a>
│ │ │ │ -<a name="session_proxy()"></a>
│ │ │ │ -<a name="~session_proxy()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_proxy%3A%3A%5Boperator%3D%28%29+session_proxy%28%29+~session_proxy%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_proxy%3A%3A%5Boperator%3D%28%29+session_proxy%28%29+~session_proxy%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-session-proxy-session-proxy">
│ │ │ │ -<h2>operator=() session_proxy() ~session_proxy()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -session_proxy&amp; <strong>operator=</strong> (session_proxy const&amp;) &amp;;
│ │ │ │ -<strong>session_proxy</strong> (session_proxy&amp;&amp;) noexcept;
│ │ │ │ -<strong>~session_proxy</strong> ();
│ │ │ │ -<strong>session_proxy</strong> ();
│ │ │ │ -<strong>session_proxy</strong> (session_proxy const&amp;);
│ │ │ │ -session_proxy&amp; <strong>operator=</strong> (session_proxy&amp;&amp;) &amp; noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>default constructor, does not refer to any <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │ -implementation object.</p>
│ │ │ │ -<a name="session"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session&labels=documentation&body=Documentation+under+heading+%22class+session%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="session">
│ │ │ │ -<h1>session</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session.hpp">libtorrent/session.hpp</a>&quot;</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Session.html#session">session</a> holds all state that spans multiple torrents. Among other
│ │ │ │ -things it runs the network loop and manages all torrents. Once it's
│ │ │ │ -created, the <a class="reference external" href="reference-Session.html#session">session</a> object will spawn the main thread that will do all
│ │ │ │ -the work. The main thread will be idle as long it doesn't have any
│ │ │ │ -torrents to participate in.</p>
│ │ │ │ -<p>You have some control over <a class="reference external" href="reference-Session.html#session">session</a> configuration through the
│ │ │ │ -<tt class="docutils literal"><span class="pre">session_handle::apply_settings()</span></tt> member function. To change one or more
│ │ │ │ -configuration options, create a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>. object and fill it with
│ │ │ │ -the settings to be set and pass it in to <tt class="docutils literal"><span class="pre">session::apply_settings()</span></tt>.</p>
│ │ │ │ -<p>see <a class="reference external" href="reference-Session.html#apply_settings()">apply_settings()</a>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct session : session_handle
│ │ │ │ -{
│ │ │ │ -   <strong>session</strong> (session_params const&amp; params, session_flags_t flags);
│ │ │ │ -   <strong>session</strong> ();
│ │ │ │ -   explicit <strong>session</strong> (session_params const&amp; params);
│ │ │ │ -   explicit <strong>session</strong> (session_params&amp;&amp; params);
│ │ │ │ -   <strong>session</strong> (session_params&amp;&amp; params, session_flags_t flags);
│ │ │ │ -   <strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios);
│ │ │ │ -   <strong>session</strong> (session_params const&amp; params, io_context&amp; ios);
│ │ │ │ -   <strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │ -   <strong>session</strong> (session_params const&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │ -   <strong>~session</strong> ();
│ │ │ │ -   session_proxy <strong>abort</strong> ();
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="session()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session%3A%3A%5Bsession%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session%3A%3A%5Bsession%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="session-1">
│ │ │ │ -<h2>session()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>session</strong> (session_params const&amp; params, session_flags_t flags);
│ │ │ │ -<strong>session</strong> ();
│ │ │ │ -explicit <strong>session</strong> (session_params const&amp; params);
│ │ │ │ -explicit <strong>session</strong> (session_params&amp;&amp; params);
│ │ │ │ -<strong>session</strong> (session_params&amp;&amp; params, session_flags_t flags);
│ │ │ │ -</pre>
│ │ │ │ -<p>Constructs the <a class="reference external" href="reference-Session.html#session">session</a> objects which acts as the container of torrents.
│ │ │ │ -In order to avoid a race condition between starting the <a class="reference external" href="reference-Session.html#session">session</a> and
│ │ │ │ -configuring it, you can pass in a <a class="reference external" href="reference-Session.html#session_params">session_params</a> object. Its settings
│ │ │ │ -will take effect before the <a class="reference external" href="reference-Session.html#session">session</a> starts up.</p>
│ │ │ │ -<p>The overloads taking <tt class="docutils literal">flags</tt> can be used to start a <a class="reference external" href="reference-Session.html#session">session</a> in
│ │ │ │ -paused mode (by passing in <tt class="docutils literal"><span class="pre">session::paused</span></tt>). Note that
│ │ │ │ -<tt class="docutils literal">add_default_plugins</tt> do not have an affect on constructors that
│ │ │ │ -take a <a class="reference external" href="reference-Session.html#session_params">session_params</a> object. It already contains the plugins to use.</p>
│ │ │ │ -<a name="session()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session%3A%3A%5Bsession%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session%3A%3A%5Bsession%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="session-2">
│ │ │ │ -<h2>session()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios);
│ │ │ │ -<strong>session</strong> (session_params const&amp; params, io_context&amp; ios);
│ │ │ │ -<strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │ -<strong>session</strong> (session_params const&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │ -</pre>
│ │ │ │ -<p>Overload of the constructor that takes an external io_context to run
│ │ │ │ -the <a class="reference external" href="reference-Session.html#session">session</a> object on. This is primarily useful for tests that may want
│ │ │ │ -to run multiple sessions on a single io_context, or low resource
│ │ │ │ -systems where additional threads are expensive and sharing an
│ │ │ │ -io_context with other events is fine.</p>
│ │ │ │ -<div class="admonition warning">
│ │ │ │ -<p class="first admonition-title">Warning</p>
│ │ │ │ -<p class="last">The <a class="reference external" href="reference-Session.html#session">session</a> object does not cleanly terminate with an external
│ │ │ │ -<tt class="docutils literal">io_context</tt>. The <tt class="docutils literal"><span class="pre">io_context::run()</span></tt> call <em>must</em> have returned
│ │ │ │ -before it's safe to destruct the <a class="reference external" href="reference-Session.html#session">session</a>. Which means you <em>MUST</em>
│ │ │ │ -call <a class="reference external" href="reference-Session.html#abort()">session::abort()</a> and save the <a class="reference external" href="reference-Session.html#session_proxy">session_proxy</a> first, then
│ │ │ │ -destruct the <a class="reference external" href="reference-Session.html#session">session</a> object, then sync with the io_context, then
│ │ │ │ -destruct the <a class="reference external" href="reference-Session.html#session_proxy">session_proxy</a> object.</p>
│ │ │ │ -</div>
│ │ │ │ -<a name="~session()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session%3A%3A%5B~session%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session%3A%3A%5B~session%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="session-3">
│ │ │ │ -<h2>~session()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>~session</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>The destructor of <a class="reference external" href="reference-Session.html#session">session</a> will notify all trackers that our torrents
│ │ │ │ -have been shut down. If some trackers are down, they will time out.
│ │ │ │ -All this before the destructor of <a class="reference external" href="reference-Session.html#session">session</a> returns. So, it's advised
│ │ │ │ -that any kind of interface (such as windows) are closed before
│ │ │ │ -destructing the <a class="reference external" href="reference-Session.html#session">session</a> object. Because it can take a few second for
│ │ │ │ -it to finish. The timeout can be set with <a class="reference external" href="reference-Session.html#apply_settings()">apply_settings()</a>.</p>
│ │ │ │ -<a name="abort()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session%3A%3A%5Babort%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session%3A%3A%5Babort%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="abort">
│ │ │ │ -<h2>abort()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -session_proxy <strong>abort</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>In case you want to destruct the <a class="reference external" href="reference-Session.html#session">session</a> asynchronously, you can
│ │ │ │ -request a <a class="reference external" href="reference-Session.html#session">session</a> destruction proxy. If you don't do this, the
│ │ │ │ -destructor of the <a class="reference external" href="reference-Session.html#session">session</a> object will block while the trackers are
│ │ │ │ -contacted. If you keep one <tt class="docutils literal">session_proxy</tt> to the <a class="reference external" href="reference-Session.html#session">session</a> when
│ │ │ │ -destructing it, the destructor will not block, but start to close down
│ │ │ │ -the <a class="reference external" href="reference-Session.html#session">session</a>, the destructor of the proxy will then synchronize the
│ │ │ │ -threads. So, the destruction of the <a class="reference external" href="reference-Session.html#session">session</a> is performed from the
│ │ │ │ -<tt class="docutils literal">session</tt> destructor call until the <tt class="docutils literal">session_proxy</tt> destructor
│ │ │ │ -call. The <tt class="docutils literal">session_proxy</tt> does not have any operations on it (since
│ │ │ │ -the <a class="reference external" href="reference-Session.html#session">session</a> is being closed down, no operations are allowed on it).
│ │ │ │ -The only valid operation is calling the destructor:</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct session_proxy {};
│ │ │ │ -</pre>
│ │ │ │ -<a name="session_params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_params&labels=documentation&body=Documentation+under+heading+%22class+session_params%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="session-params">
│ │ │ │ -<h1>session_params</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_params.hpp">libtorrent/session_params.hpp</a>&quot;</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Session.html#session_params">session_params</a> is a parameters pack for configuring the <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │ -before it's started.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct session_params
│ │ │ │ -{
│ │ │ │ -   <strong>session_params</strong> (settings_pack const&amp; sp);
│ │ │ │ -   <strong>session_params</strong> (settings_pack&amp;&amp; sp);
│ │ │ │ -   <strong>session_params</strong> ();
│ │ │ │ -   <strong>session_params</strong> (settings_pack const&amp; sp
│ │ │ │ -      , std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; exts);
│ │ │ │ -   <strong>session_params</strong> (settings_pack&amp;&amp; sp
│ │ │ │ -      , std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; exts);
│ │ │ │ -
│ │ │ │ -   settings_pack settings;
│ │ │ │ -   std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; extensions;
│ │ │ │ -   dht::dht_state dht_state;
│ │ │ │ -   dht::dht_storage_constructor_type dht_storage_constructor;
│ │ │ │ -   disk_io_constructor_type disk_io_constructor;
│ │ │ │ -   std::map&lt;std::string, std::string&gt; ext_state;
│ │ │ │ -   libtorrent::ip_filter ip_filter;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="session_params()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bsession_params%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bsession_params%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="session-params-1">
│ │ │ │ -<h2>session_params()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>session_params</strong> (settings_pack const&amp; sp);
│ │ │ │ -<strong>session_params</strong> (settings_pack&amp;&amp; sp);
│ │ │ │ -<strong>session_params</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>This constructor can be used to start with the default plugins
│ │ │ │ -(ut_metadata, ut_pex and smart_ban). Pass a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> to set the
│ │ │ │ -initial settings when the <a class="reference external" href="reference-Session.html#session">session</a> starts.</p>
│ │ │ │ -<a name="session_params()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bsession_params%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bsession_params%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="session-params-2">
│ │ │ │ -<h2>session_params()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>session_params</strong> (settings_pack const&amp; sp
│ │ │ │ -      , std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; exts);
│ │ │ │ -<strong>session_params</strong> (settings_pack&amp;&amp; sp
│ │ │ │ -      , std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; exts);
│ │ │ │ -</pre>
│ │ │ │ -<p>This constructor helps to configure the set of initial plugins
│ │ │ │ -to be added to the <a class="reference external" href="reference-Session.html#session">session</a> before it's started.</p>
│ │ │ │ -<a name="settings"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bsettings%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bsettings%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>settings</dt>
│ │ │ │ -<dd>The settings to configure the <a class="reference external" href="reference-Session.html#session">session</a> with</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="extensions"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bextensions%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bextensions%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>extensions</dt>
│ │ │ │ -<dd>the plugins to add to the <a class="reference external" href="reference-Session.html#session">session</a> as it is constructed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bdht_state%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bdht_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>dht_state</dt>
│ │ │ │ -<dd>DHT node ID and node addresses to bootstrap the DHT with.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_storage_constructor"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bdht_storage_constructor%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bdht_storage_constructor%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>dht_storage_constructor</dt>
│ │ │ │ -<dd>function object to construct the storage object for DHT items.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="disk_io_constructor"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bdisk_io_constructor%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bdisk_io_constructor%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>disk_io_constructor</dt>
│ │ │ │ -<dd>function object to create the disk I/O subsystem. Defaults to
│ │ │ │ -default_disk_io_constructor.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="ext_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bext_state%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bext_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>ext_state</dt>
│ │ │ │ -<dd>this container can be used by extensions/plugins to store settings. It's
│ │ │ │ -primarily here to make it convenient to save and restore state across
│ │ │ │ -sessions, using <a class="reference external" href="reference-Session.html#read_session_params()">read_session_params()</a> and <a class="reference external" href="reference-Session.html#write_session_params()">write_session_params()</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="ip_filter"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bip_filter%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bip_filter%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>ip_filter</dt>
│ │ │ │ -<dd>the IP filter to use for the <a class="reference external" href="reference-Session.html#session">session</a>. This restricts which peers are allowed
│ │ │ │ -to connect. As if passed to <a class="reference external" href="reference-Session.html#set_ip_filter()">set_ip_filter()</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="session_handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_handle&labels=documentation&body=Documentation+under+heading+%22class+session_handle%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="session-handle">
│ │ │ │ -<h1>session_handle</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_handle.hpp">libtorrent/session_handle.hpp</a>&quot;</p>
│ │ │ │ -<p>this class provides a non-owning handle to a <a class="reference external" href="reference-Session.html#session">session</a> and a subset of the
│ │ │ │ -interface of the <a class="reference external" href="reference-Session.html#session">session</a> class. If the underlying <a class="reference external" href="reference-Session.html#session">session</a> is destructed
│ │ │ │ -any handle to it will no longer be valid. <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a> will return false and
│ │ │ │ -any operation on it will throw a system_error exception, with error code
│ │ │ │ -invalid_session_handle.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct session_handle
│ │ │ │ -{
│ │ │ │ -   bool <strong>is_valid</strong> () const;
│ │ │ │ -   session_params <strong>session_state</strong> (save_state_flags_t flags = save_state_flags_t::all()) const;
│ │ │ │ -   void <strong>refresh_torrent_status</strong> (std::vector&lt;torrent_status&gt;* ret
│ │ │ │ -      , status_flags_t flags = {}) const;
│ │ │ │ -   std::vector&lt;torrent_status&gt; <strong>get_torrent_status</strong> (
│ │ │ │ -      std::function&lt;bool(torrent_status const&amp;)&gt; const&amp; pred
│ │ │ │ -      , status_flags_t flags = {}) const;
│ │ │ │ -   void <strong>post_torrent_updates</strong> (status_flags_t flags = status_flags_t::all());
│ │ │ │ -   void <strong>post_session_stats</strong> ();
│ │ │ │ -   void <strong>post_dht_stats</strong> ();
│ │ │ │ -   void <strong>set_dht_state</strong> (dht::dht_state&amp;&amp; st);
│ │ │ │ -   void <strong>set_dht_state</strong> (dht::dht_state const&amp; st);
│ │ │ │ -   torrent_handle <strong>find_torrent</strong> (sha1_hash const&amp; info_hash) const;
│ │ │ │ -   std::vector&lt;torrent_handle&gt; <strong>get_torrents</strong> () const;
│ │ │ │ -   torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params, error_code&amp; ec);
│ │ │ │ -   torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params, error_code&amp; ec);
│ │ │ │ -   torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ -   void <strong>async_add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ -   torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │ -   void <strong>async_add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │ -   void <strong>resume</strong> ();
│ │ │ │ -   void <strong>pause</strong> ();
│ │ │ │ -   bool <strong>is_paused</strong> () const;
│ │ │ │ -   bool <strong>is_dht_running</strong> () const;
│ │ │ │ -   void <strong>set_dht_storage</strong> (dht::dht_storage_constructor_type sc);
│ │ │ │ -   void <strong>add_dht_node</strong> (std::pair&lt;std::string, int&gt; const&amp; node);
│ │ │ │ -   void <strong>dht_get_item</strong> (sha1_hash const&amp; target);
│ │ │ │ -   void <strong>dht_get_item</strong> (std::array&lt;char, 32&gt; key
│ │ │ │ -      , std::string salt = std::string());
│ │ │ │ -   sha1_hash <strong>dht_put_item</strong> (entry data);
│ │ │ │ -   void <strong>dht_put_item</strong> (std::array&lt;char, 32&gt; key
│ │ │ │ -      , std::function&lt;void(entry&amp;, std::array&lt;char, 64&gt;&amp;
│ │ │ │ -      , std::int64_t&amp;, std::string const&amp;)&gt; cb
│ │ │ │ -      , std::string salt = std::string());
│ │ │ │ -   void <strong>dht_get_peers</strong> (sha1_hash const&amp; info_hash);
│ │ │ │ -   void <strong>dht_announce</strong> (sha1_hash const&amp; info_hash, int port = 0, dht::announce_flags_t flags = {});
│ │ │ │ -   void <strong>dht_live_nodes</strong> (sha1_hash const&amp; nid);
│ │ │ │ -   void <strong>dht_sample_infohashes</strong> (udp::endpoint const&amp; ep, sha1_hash const&amp; target);
│ │ │ │ -   void <strong>dht_direct_request</strong> (udp::endpoint const&amp; ep, entry const&amp; e, client_data_t userdata = {});
│ │ │ │ -   void <strong>add_extension</strong> (std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(
│ │ │ │ -      torrent_handle const&amp;, client_data_t)&gt; ext);
│ │ │ │ -   void <strong>add_extension</strong> (std::shared_ptr&lt;plugin&gt; ext);
│ │ │ │ -   ip_filter <strong>get_ip_filter</strong> () const;
│ │ │ │ -   void <strong>set_ip_filter</strong> (ip_filter f);
│ │ │ │ -   void <strong>set_port_filter</strong> (port_filter const&amp; f);
│ │ │ │ -   unsigned short <strong>listen_port</strong> () const;
│ │ │ │ -   bool <strong>is_listening</strong> () const;
│ │ │ │ -   unsigned short <strong>ssl_listen_port</strong> () const;
│ │ │ │ -   void <strong>set_peer_class_filter</strong> (ip_filter const&amp; f);
│ │ │ │ -   ip_filter <strong>get_peer_class_filter</strong> () const;
│ │ │ │ -   void <strong>set_peer_class_type_filter</strong> (peer_class_type_filter const&amp; f);
│ │ │ │ -   peer_class_type_filter <strong>get_peer_class_type_filter</strong> () const;
│ │ │ │ -   peer_class_t <strong>create_peer_class</strong> (char const* name);
│ │ │ │ -   void <strong>delete_peer_class</strong> (peer_class_t cid);
│ │ │ │ -   void <strong>set_peer_class</strong> (peer_class_t cid, peer_class_info const&amp; pci);
│ │ │ │ -   peer_class_info <strong>get_peer_class</strong> (peer_class_t cid) const;
│ │ │ │ -   void <strong>remove_torrent</strong> (const torrent_handle&amp;, remove_flags_t = {});
│ │ │ │ -   void <strong>apply_settings</strong> (settings_pack&amp;&amp;);
│ │ │ │ -   settings_pack <strong>get_settings</strong> () const;
│ │ │ │ -   void <strong>apply_settings</strong> (settings_pack const&amp;);
│ │ │ │ -   void <strong>set_alert_notify</strong> (std::function&lt;void()&gt; const&amp; fun);
│ │ │ │ -   alert* <strong>wait_for_alert</strong> (time_duration max_wait);
│ │ │ │ -   void <strong>pop_alerts</strong> (std::vector&lt;alert*&gt;* alerts);
│ │ │ │ -   void <strong>delete_port_mapping</strong> (port_mapping_t handle);
│ │ │ │ -   std::vector&lt;port_mapping_t&gt; <strong>add_port_mapping</strong> (portmap_protocol t, int external_port, int local_port);
│ │ │ │ -   void <strong>reopen_network_sockets</strong> (reopen_network_flags_t options = reopen_map_ports);
│ │ │ │ -   std::shared_ptr&lt;aux::session_impl&gt; <strong>native_handle</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr save_state_flags_t <strong>save_settings</strong>  = 0_bit;
│ │ │ │ -   static constexpr save_state_flags_t <strong>save_dht_state</strong>  = 2_bit;
│ │ │ │ -   static constexpr save_state_flags_t <strong>save_extension_state</strong>  = 11_bit;
│ │ │ │ -   static constexpr save_state_flags_t <strong>save_ip_filter</strong>  = 12_bit;
│ │ │ │ -   static constexpr peer_class_t <strong>global_peer_class_id</strong> {0};
│ │ │ │ -   static constexpr peer_class_t <strong>tcp_peer_class_id</strong> {1};
│ │ │ │ -   static constexpr peer_class_t <strong>local_peer_class_id</strong> {2};
│ │ │ │ -   static constexpr remove_flags_t <strong>delete_files</strong>  = 0_bit;
│ │ │ │ -   static constexpr remove_flags_t <strong>delete_partfile</strong>  = 1_bit;
│ │ │ │ -   static constexpr session_flags_t <strong>paused</strong>  = 2_bit;
│ │ │ │ -   static constexpr portmap_protocol <strong>udp</strong>  = portmap_protocol::udp;
│ │ │ │ -   static constexpr portmap_protocol <strong>tcp</strong>  = portmap_protocol::tcp;
│ │ │ │ -   static constexpr reopen_network_flags_t <strong>reopen_map_ports</strong>  = 0_bit;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="is_valid()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bis_valid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bis_valid%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="is-valid-2">
│ │ │ │ -<h2>is_valid()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>is_valid</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if this handle refers to a valid <a class="reference external" href="reference-Session.html#session">session</a> object. If the
│ │ │ │ -<a class="reference external" href="reference-Session.html#session">session</a> has been destroyed, all <a class="reference external" href="reference-Session.html#session_handle">session_handle</a> objects will expire and
│ │ │ │ -not be valid.</p>
│ │ │ │ -<a name="session_state()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bsession_state%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bsession_state%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="session-state">
│ │ │ │ -<h2>session_state()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -session_params <strong>session_state</strong> (save_state_flags_t flags = save_state_flags_t::all()) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the current <a class="reference external" href="reference-Session.html#session">session</a> state. This can be passed to
│ │ │ │ -<a class="reference external" href="reference-Session.html#write_session_params()">write_session_params()</a> to save the state to disk and restored using
│ │ │ │ -<a class="reference external" href="reference-Session.html#read_session_params()">read_session_params()</a> when constructing a new <a class="reference external" href="reference-Session.html#session">session</a>. The kind of
│ │ │ │ -state that's included is all settings, the DHT routing table, possibly
│ │ │ │ -plugin-specific state.
│ │ │ │ -the flags parameter can be used to only save certain parts of the
│ │ │ │ -<a class="reference external" href="reference-Session.html#session">session</a> state</p>
│ │ │ │ -<a name="refresh_torrent_status()"></a>
│ │ │ │ -<a name="get_torrent_status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Brefresh_torrent_status%28%29+get_torrent_status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Brefresh_torrent_status%28%29+get_torrent_status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="refresh-torrent-status-get-torrent-status">
│ │ │ │ -<h2>refresh_torrent_status() get_torrent_status()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>refresh_torrent_status</strong> (std::vector&lt;torrent_status&gt;* ret
│ │ │ │ -      , status_flags_t flags = {}) const;
│ │ │ │ -std::vector&lt;torrent_status&gt; <strong>get_torrent_status</strong> (
│ │ │ │ -      std::function&lt;bool(torrent_status const&amp;)&gt; const&amp; pred
│ │ │ │ -      , status_flags_t flags = {}) const;
│ │ │ │ -</pre>
│ │ │ │ -<div class="admonition note">
│ │ │ │ -<p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">these calls are potentially expensive and won't scale well with
│ │ │ │ -lots of torrents. If you're concerned about performance, consider
│ │ │ │ -using <tt class="docutils literal">post_torrent_updates()</tt> instead.</p>
│ │ │ │ -</div>
│ │ │ │ -<p><tt class="docutils literal">get_torrent_status</tt> returns a vector of the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> for
│ │ │ │ -every torrent which satisfies <tt class="docutils literal">pred</tt>, which is a predicate function
│ │ │ │ -which determines if a torrent should be included in the returned set
│ │ │ │ -or not. Returning true means it should be included and false means
│ │ │ │ -excluded. The <tt class="docutils literal">flags</tt> argument is the same as to
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a>. Since <tt class="docutils literal">pred</tt> is guaranteed to be
│ │ │ │ -called for every torrent, it may be used to count the number of
│ │ │ │ -torrents of different categories as well.</p>
│ │ │ │ -<p><tt class="docutils literal">refresh_torrent_status</tt> takes a vector of <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> structs
│ │ │ │ -(for instance the same vector that was returned by
│ │ │ │ -<a class="reference external" href="reference-Session.html#get_torrent_status()">get_torrent_status()</a> ) and refreshes the status based on the
│ │ │ │ -<tt class="docutils literal">handle</tt> member. It is possible to use this function by first
│ │ │ │ -setting up a vector of default constructed <tt class="docutils literal">torrent_status</tt> objects,
│ │ │ │ -only initializing the <tt class="docutils literal">handle</tt> member, in order to request the
│ │ │ │ -torrent status for multiple torrents in a single call. This can save a
│ │ │ │ -significant amount of time if you have a lot of torrents.</p>
│ │ │ │ -<p>Any <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> object whose <tt class="docutils literal">handle</tt> member is not referring to
│ │ │ │ -a valid torrent are ignored.</p>
│ │ │ │ -<p>The intended use of these functions is to start off by calling
│ │ │ │ -<tt class="docutils literal">get_torrent_status()</tt> to get a list of all torrents that match your
│ │ │ │ -criteria. Then call <tt class="docutils literal">refresh_torrent_status()</tt> on that list. This
│ │ │ │ -will only refresh the status for the torrents in your list, and thus
│ │ │ │ -ignore all other torrents you might be running. This may save a
│ │ │ │ -significant amount of time, especially if the number of torrents you're
│ │ │ │ -interested in is small. In order to keep your list of interested
│ │ │ │ -torrents up to date, you can either call <tt class="docutils literal">get_torrent_status()</tt> from
│ │ │ │ -time to time, to include torrents you might have become interested in
│ │ │ │ -since the last time. In order to stop refreshing a certain torrent,
│ │ │ │ -simply remove it from the list.</p>
│ │ │ │ -<a name="post_torrent_updates()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bpost_torrent_updates%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bpost_torrent_updates%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="post-torrent-updates">
│ │ │ │ -<h2>post_torrent_updates()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>post_torrent_updates</strong> (status_flags_t flags = status_flags_t::all());
│ │ │ │ -</pre>
│ │ │ │ -<p>This functions instructs the <a class="reference external" href="reference-Session.html#session">session</a> to post the <a class="reference external" href="reference-Alerts.html#state_update_alert">state_update_alert</a>,
│ │ │ │ -containing the status of all torrents whose state changed since the
│ │ │ │ -last time this function was called.</p>
│ │ │ │ -<p>Only torrents who has the state subscription flag set will be
│ │ │ │ -included. This flag is on by default. See <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>.
│ │ │ │ -the <tt class="docutils literal">flags</tt> argument is the same as for <a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a>.
│ │ │ │ -see status_flags_t in <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>.</p>
│ │ │ │ -<a name="post_session_stats()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bpost_session_stats%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bpost_session_stats%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="post-session-stats">
│ │ │ │ -<h2>post_session_stats()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>post_session_stats</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>This function will post a <a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a> object, containing a
│ │ │ │ -snapshot of the performance <a class="reference external" href="reference-Stats.html#counters">counters</a> from the internals of libtorrent.
│ │ │ │ -To interpret these <a class="reference external" href="reference-Stats.html#counters">counters</a>, query the <a class="reference external" href="reference-Session.html#session">session</a> via
│ │ │ │ -<a class="reference external" href="reference-Stats.html#session_stats_metrics()">session_stats_metrics()</a>.</p>
│ │ │ │ -<p>For more information, see the <a class="reference external" href="manual-ref.html#session-statistics">session statistics</a> section.</p>
│ │ │ │ -<a name="post_dht_stats()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bpost_dht_stats%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bpost_dht_stats%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="post-dht-stats">
│ │ │ │ -<h2>post_dht_stats()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>post_dht_stats</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>This will cause a <a class="reference external" href="reference-Alerts.html#dht_stats_alert">dht_stats_alert</a> to be posted.</p>
│ │ │ │ -<a name="set_dht_state()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_dht_state%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_dht_state%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-dht-state">
│ │ │ │ -<h2>set_dht_state()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_dht_state</strong> (dht::dht_state&amp;&amp; st);
│ │ │ │ -void <strong>set_dht_state</strong> (dht::dht_state const&amp; st);
│ │ │ │ -</pre>
│ │ │ │ -<p>set the DHT state for the <a class="reference external" href="reference-Session.html#session">session</a>. This will be taken into account the
│ │ │ │ -next time the DHT is started, as if it had been passed in via the
│ │ │ │ -<a class="reference external" href="reference-Session.html#session_params">session_params</a> on startup.</p>
│ │ │ │ -<a name="find_torrent()"></a>
│ │ │ │ -<a name="get_torrents()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bfind_torrent%28%29+get_torrents%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bfind_torrent%28%29+get_torrents%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="find-torrent-get-torrents">
│ │ │ │ -<h2>find_torrent() get_torrents()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -torrent_handle <strong>find_torrent</strong> (sha1_hash const&amp; info_hash) const;
│ │ │ │ -std::vector&lt;torrent_handle&gt; <strong>get_torrents</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">find_torrent()</tt> looks for a torrent with the given info-hash. In
│ │ │ │ -case there is such a torrent in the <a class="reference external" href="reference-Session.html#session">session</a>, a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> to that
│ │ │ │ -torrent is returned. In case the torrent cannot be found, an invalid
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is returned.</p>
│ │ │ │ -<p>See <tt class="docutils literal"><span class="pre">torrent_handle::is_valid()</span></tt> to know if the torrent was found or
│ │ │ │ -not.</p>
│ │ │ │ -<p><tt class="docutils literal">get_torrents()</tt> returns a vector of torrent_handles to all the
│ │ │ │ -torrents currently in the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │ -<a name="add_torrent()"></a>
│ │ │ │ -<a name="async_add_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Badd_torrent%28%29+async_add_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Badd_torrent%28%29+async_add_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-torrent-async-add-torrent">
│ │ │ │ -<h2>add_torrent() async_add_torrent()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params, error_code&amp; ec);
│ │ │ │ -torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params, error_code&amp; ec);
│ │ │ │ -torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ -void <strong>async_add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ -torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │ -void <strong>async_add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │ -</pre>
│ │ │ │ -<p>You add torrents through the <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> function where you give an
│ │ │ │ -object with all the parameters. The <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> overloads will block
│ │ │ │ -until the torrent has been added (or failed to be added) and returns
│ │ │ │ -an error code and a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>. In order to add torrents more
│ │ │ │ -efficiently, consider using <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a> which returns
│ │ │ │ -immediately, without waiting for the torrent to add. Notification of
│ │ │ │ -the torrent being added is sent as <a class="reference external" href="reference-Alerts.html#add_torrent_alert">add_torrent_alert</a>.</p>
│ │ │ │ -<p>The <tt class="docutils literal">save_path</tt> field in <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> must be set to a valid
│ │ │ │ -path where the files for the torrent will be saved. Even when using a
│ │ │ │ -custom storage, this needs to be set to something. If the save_path
│ │ │ │ -is empty, the call to <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> will throw a system_error
│ │ │ │ -exception.</p>
│ │ │ │ -<p>The overload that does not take an error_code throws an exception on
│ │ │ │ -error and is not available when building without exception support.
│ │ │ │ -The <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> returned by <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> can be used to retrieve
│ │ │ │ -information about the torrent's progress, its peers etc. It is also
│ │ │ │ -used to abort a torrent.</p>
│ │ │ │ -<p>If the torrent you are trying to add already exists in the <a class="reference external" href="reference-Session.html#session">session</a> (is
│ │ │ │ -either queued for checking, being checked or downloading)
│ │ │ │ -<tt class="docutils literal">add_torrent()</tt> will throw system_error which derives from
│ │ │ │ -<tt class="docutils literal"><span class="pre">std::exception</span></tt> unless duplicate_is_error is set to false. In that
│ │ │ │ -case, <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> will return the handle to the existing torrent.</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> class has a flags field. It can be used to
│ │ │ │ -control what state the new torrent will be added in. Common flags to
│ │ │ │ -want to control are torrent_flags::paused and
│ │ │ │ -torrent_flags::auto_managed. In order to add a magnet link that will
│ │ │ │ -just download the metadata, but no payload, set the
│ │ │ │ -torrent_flags::upload_mode flag.</p>
│ │ │ │ -<p>Special consideration has to be taken when adding hybrid torrents
│ │ │ │ -(i.e. torrents that are BitTorrent v2 torrents that are backwards
│ │ │ │ -compatible with v1). For more details, see <a class="reference external" href="manual-ref.html#bittorrent-v2-torrents">BitTorrent v2 torrents</a>.</p>
│ │ │ │ -<a name="is_paused()"></a>
│ │ │ │ -<a name="resume()"></a>
│ │ │ │ -<a name="pause()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bis_paused%28%29+resume%28%29+pause%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bis_paused%28%29+resume%28%29+pause%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="is-paused-resume-pause">
│ │ │ │ -<h2>is_paused() resume() pause()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>resume</strong> ();
│ │ │ │ -void <strong>pause</strong> ();
│ │ │ │ -bool <strong>is_paused</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>Pausing the <a class="reference external" href="reference-Session.html#session">session</a> has the same effect as pausing every torrent in
│ │ │ │ -it, except that torrents will not be resumed by the auto-manage
│ │ │ │ -mechanism. Resuming will restore the torrents to their previous paused
│ │ │ │ -state. i.e. the <a class="reference external" href="reference-Session.html#session">session</a> pause state is separate from the torrent pause
│ │ │ │ -state. A torrent is inactive if it is paused or if the <a class="reference external" href="reference-Session.html#session">session</a> is
│ │ │ │ -paused.</p>
│ │ │ │ -<a name="is_dht_running()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bis_dht_running%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bis_dht_running%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="is-dht-running">
│ │ │ │ -<h2>is_dht_running()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>is_dht_running</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">is_dht_running()</tt> returns true if the DHT support has been started
│ │ │ │ -and false otherwise.</p>
│ │ │ │ -<a name="set_dht_storage()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_dht_storage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_dht_storage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-dht-storage">
│ │ │ │ -<h2>set_dht_storage()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_dht_storage</strong> (dht::dht_storage_constructor_type sc);
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">set_dht_storage</tt> set a dht custom storage constructor function
│ │ │ │ -to be used internally when the dht is created.</p>
│ │ │ │ -<p>Since the dht storage is a critical component for the dht behavior,
│ │ │ │ -this function will only be effective the next time the dht is started.
│ │ │ │ -If you never touch this feature, a default map-memory based storage
│ │ │ │ -is used.</p>
│ │ │ │ -<p>If you want to make sure the dht is initially created with your
│ │ │ │ -custom storage, create a <a class="reference external" href="reference-Session.html#session">session</a> with the setting
│ │ │ │ -<tt class="docutils literal"><span class="pre">settings_pack::enable_dht</span></tt> to false, set your constructor function
│ │ │ │ -and call <tt class="docutils literal">apply_settings</tt> with <tt class="docutils literal"><span class="pre">settings_pack::enable_dht</span></tt> to true.</p>
│ │ │ │ -<a name="add_dht_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Badd_dht_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Badd_dht_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-dht-node">
│ │ │ │ -<h2>add_dht_node()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_dht_node</strong> (std::pair&lt;std::string, int&gt; const&amp; node);
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">add_dht_node</tt> takes a host name and port pair. That endpoint will be
│ │ │ │ -pinged, and if a valid DHT reply is received, the node will be added to
│ │ │ │ -the routing table.</p>
│ │ │ │ -<a name="dht_get_item()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_get_item%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_get_item%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-get-item">
│ │ │ │ -<h2>dht_get_item()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>dht_get_item</strong> (sha1_hash const&amp; target);
│ │ │ │ -</pre>
│ │ │ │ -<p>query the DHT for an immutable item at the <tt class="docutils literal">target</tt> hash.
│ │ │ │ -the result is posted as a <a class="reference external" href="reference-Alerts.html#dht_immutable_item_alert">dht_immutable_item_alert</a>.</p>
│ │ │ │ -<a name="dht_get_item()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_get_item%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_get_item%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-get-item-1">
│ │ │ │ -<h2>dht_get_item()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>dht_get_item</strong> (std::array&lt;char, 32&gt; key
│ │ │ │ -      , std::string salt = std::string());
│ │ │ │ -</pre>
│ │ │ │ -<p>query the DHT for a mutable item under the public key <tt class="docutils literal">key</tt>.
│ │ │ │ -this is an ed25519 key. <tt class="docutils literal">salt</tt> is optional and may be left
│ │ │ │ -as an empty string if no salt is to be used.
│ │ │ │ -if the item is found in the DHT, a <a class="reference external" href="reference-Alerts.html#dht_mutable_item_alert">dht_mutable_item_alert</a> is
│ │ │ │ -posted.</p>
│ │ │ │ -<a name="dht_put_item()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_put_item%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_put_item%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-put-item">
│ │ │ │ -<h2>dht_put_item()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -sha1_hash <strong>dht_put_item</strong> (entry data);
│ │ │ │ -</pre>
│ │ │ │ -<p>store the given bencoded data as an immutable item in the DHT.
│ │ │ │ -the returned hash is the key that is to be used to look the item
│ │ │ │ -up again. It's just the SHA-1 hash of the bencoded form of the
│ │ │ │ -structure.</p>
│ │ │ │ -<a name="dht_put_item()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_put_item%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_put_item%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-put-item-1">
│ │ │ │ -<h2>dht_put_item()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>dht_put_item</strong> (std::array&lt;char, 32&gt; key
│ │ │ │ -      , std::function&lt;void(entry&amp;, std::array&lt;char, 64&gt;&amp;
│ │ │ │ -      , std::int64_t&amp;, std::string const&amp;)&gt; cb
│ │ │ │ -      , std::string salt = std::string());
│ │ │ │ -</pre>
│ │ │ │ -<p>store a mutable item. The <tt class="docutils literal">key</tt> is the public key the blob is
│ │ │ │ -to be stored under. The optional <tt class="docutils literal">salt</tt> argument is a string that
│ │ │ │ -is to be mixed in with the key when determining where in the DHT
│ │ │ │ -the value is to be stored. The callback function is called from within
│ │ │ │ -the libtorrent network thread once we've found where to store the blob,
│ │ │ │ -possibly with the current value stored under the key.
│ │ │ │ -The values passed to the callback functions are:</p>
│ │ │ │ -<dl class="docutils">
│ │ │ │ -<dt>entry&amp; value</dt>
│ │ │ │ -<dd>the current value stored under the key (may be empty). Also expected
│ │ │ │ -to be set to the value to be stored by the function.</dd>
│ │ │ │ -<dt>std::array&lt;char,64&gt;&amp; signature</dt>
│ │ │ │ -<dd>the signature authenticating the current value. This may be zeros
│ │ │ │ -if there is currently no value stored. The function is expected to
│ │ │ │ -fill in this buffer with the signature of the new value to store.
│ │ │ │ -To generate the signature, you may want to use the
│ │ │ │ -<tt class="docutils literal">sign_mutable_item</tt> function.</dd>
│ │ │ │ -<dt>std::int64_t&amp; seq</dt>
│ │ │ │ -<dd>current sequence number. May be zero if there is no current value.
│ │ │ │ -The function is expected to set this to the new sequence number of
│ │ │ │ -the value that is to be stored. Sequence numbers must be monotonically
│ │ │ │ -increasing. Attempting to overwrite a value with a lower or equal
│ │ │ │ -sequence number will fail, even if the signature is correct.</dd>
│ │ │ │ -<dt>std::string const&amp; salt</dt>
│ │ │ │ -<dd>this is the salt that was used for this put call.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<p>Since the callback function <tt class="docutils literal">cb</tt> is called from within libtorrent,
│ │ │ │ -it is critical to not perform any blocking operations. Ideally not
│ │ │ │ -even locking a mutex. Pass any data required for this function along
│ │ │ │ -with the function object's context and make the function entirely
│ │ │ │ -self-contained. The only reason data blob's value is computed
│ │ │ │ -via a function instead of just passing in the new value is to avoid
│ │ │ │ -race conditions. If you want to <em>update</em> the value in the DHT, you
│ │ │ │ -must first retrieve it, then modify it, then write it back. The way
│ │ │ │ -the DHT works, it is natural to always do a lookup before storing and
│ │ │ │ -calling the callback in between is convenient.</p>
│ │ │ │ -<a name="dht_get_peers()"></a>
│ │ │ │ -<a name="dht_announce()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_get_peers%28%29+dht_announce%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_get_peers%28%29+dht_announce%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-get-peers-dht-announce">
│ │ │ │ -<h2>dht_get_peers() dht_announce()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>dht_get_peers</strong> (sha1_hash const&amp; info_hash);
│ │ │ │ -void <strong>dht_announce</strong> (sha1_hash const&amp; info_hash, int port = 0, dht::announce_flags_t flags = {});
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">dht_get_peers()</tt> will issue a DHT get_peer request to the DHT for the
│ │ │ │ -specified info-hash. The response (the peers) will be posted back in a
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#dht_get_peers_reply_alert">dht_get_peers_reply_alert</a>.</p>
│ │ │ │ -<p><tt class="docutils literal">dht_announce()</tt> will issue a DHT announce request to the DHT to the
│ │ │ │ -specified info-hash, advertising the specified port. If the port is
│ │ │ │ -left at its default, 0, the port will be implied by the DHT message's
│ │ │ │ -source port (which may improve connectivity through a NAT).
│ │ │ │ -<tt class="docutils literal">dht_announce()</tt> is not affected by the <tt class="docutils literal">announce_port</tt> override setting.</p>
│ │ │ │ -<p>Both these functions are exposed for advanced custom use of the DHT.
│ │ │ │ -All torrents eligible to be announce to the DHT will be automatically,
│ │ │ │ -by libtorrent.</p>
│ │ │ │ -<p>For possible flags, see <a class="reference external" href="reference-DHT.html#announce_flags_t">announce_flags_t</a>.</p>
│ │ │ │ -<a name="dht_live_nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_live_nodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_live_nodes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-live-nodes">
│ │ │ │ -<h2>dht_live_nodes()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>dht_live_nodes</strong> (sha1_hash const&amp; nid);
│ │ │ │ -</pre>
│ │ │ │ -<p>Retrieve all the live DHT (identified by <tt class="docutils literal">nid</tt>) nodes. All the
│ │ │ │ -nodes id and endpoint will be returned in the list of nodes in the
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#alert">alert</a> <tt class="docutils literal">dht_live_nodes_alert</tt>.
│ │ │ │ -Since this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is a response to an explicit call, it will always be
│ │ │ │ -posted, regardless of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
│ │ │ │ -<a name="dht_sample_infohashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_sample_infohashes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_sample_infohashes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-sample-infohashes">
│ │ │ │ -<h2>dht_sample_infohashes()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>dht_sample_infohashes</strong> (udp::endpoint const&amp; ep, sha1_hash const&amp; target);
│ │ │ │ -</pre>
│ │ │ │ -<p>Query the DHT node specified by <tt class="docutils literal">ep</tt> to retrieve a sample of the
│ │ │ │ -info-hashes that the node currently have in their storage.
│ │ │ │ -The <tt class="docutils literal">target</tt> is included for iterative lookups so that indexing nodes
│ │ │ │ -can perform a key space traversal with a single RPC per node by adjusting
│ │ │ │ -the target value for each RPC. It has no effect on the returned sample value.
│ │ │ │ -The result is posted as a <tt class="docutils literal">dht_sample_infohashes_alert</tt>.</p>
│ │ │ │ -<a name="dht_direct_request()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_direct_request%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_direct_request%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-direct-request">
│ │ │ │ -<h2>dht_direct_request()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>dht_direct_request</strong> (udp::endpoint const&amp; ep, entry const&amp; e, client_data_t userdata = {});
│ │ │ │ -</pre>
│ │ │ │ -<p>Send an arbitrary DHT request directly to the specified endpoint. This
│ │ │ │ -function is intended for use by plugins. When a response is received
│ │ │ │ -or the request times out, a <a class="reference external" href="reference-Alerts.html#dht_direct_response_alert">dht_direct_response_alert</a> will be posted
│ │ │ │ -with the response (if any) and the userdata pointer passed in here.
│ │ │ │ -Since this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is a response to an explicit call, it will always be
│ │ │ │ -posted, regardless of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
│ │ │ │ -<a name="add_extension()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Badd_extension%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Badd_extension%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-extension-1">
│ │ │ │ -<h2>add_extension()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_extension</strong> (std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(
│ │ │ │ -      torrent_handle const&amp;, client_data_t)&gt; ext);
│ │ │ │ -void <strong>add_extension</strong> (std::shared_ptr&lt;plugin&gt; ext);
│ │ │ │ -</pre>
│ │ │ │ -<p>This function adds an extension to this <a class="reference external" href="reference-Session.html#session">session</a>. The argument is a
│ │ │ │ -function object that is called with a <tt class="docutils literal">torrent_handle</tt> and which should
│ │ │ │ -return a <tt class="docutils literal"><span class="pre">std::shared_ptr&lt;torrent_plugin&gt;</span></tt>. To write custom
│ │ │ │ -plugins, see <a class="reference external" href="reference-Plugins.html">libtorrent plugins</a>. For the typical bittorrent client
│ │ │ │ -all of these extensions should be added. The main plugins implemented
│ │ │ │ -in libtorrent are:</p>
│ │ │ │ -<dl class="docutils">
│ │ │ │ -<dt>uTorrent metadata</dt>
│ │ │ │ -<dd>Allows peers to download the metadata (.torrent files) from the swarm
│ │ │ │ -directly. Makes it possible to join a swarm with just a tracker and
│ │ │ │ -info-hash.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="comment preproc">#include</span><span class="whitespace"> </span><span class="comment preprocfile">&lt;libtorrent/extensions/ut_metadata.hpp&gt;</span><span class="comment preproc">
│ │ │ │ -</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">add_extension</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">lt</span><span class="operator">::</span><span class="name">create_ut_metadata_plugin</span><span class="punctuation">);</span>
│ │ │ │ -</pre>
│ │ │ │ -<dl class="docutils">
│ │ │ │ -<dt>uTorrent peer exchange</dt>
│ │ │ │ -<dd>Exchanges peers between clients.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="comment preproc">#include</span><span class="whitespace"> </span><span class="comment preprocfile">&lt;libtorrent/extensions/ut_pex.hpp&gt;</span><span class="comment preproc">
│ │ │ │ -</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">add_extension</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">lt</span><span class="operator">::</span><span class="name">create_ut_pex_plugin</span><span class="punctuation">);</span>
│ │ │ │ -</pre>
│ │ │ │ -<dl class="docutils">
│ │ │ │ -<dt>smart ban <a class="reference external" href="reference-Plugins.html#plugin">plugin</a></dt>
│ │ │ │ -<dd>A <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> that, with a small overhead, can ban peers
│ │ │ │ -that sends bad data with very high accuracy. Should
│ │ │ │ -eliminate most problems on poisoned torrents.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="comment preproc">#include</span><span class="whitespace"> </span><span class="comment preprocfile">&lt;libtorrent/extensions/smart_ban.hpp&gt;</span><span class="comment preproc">
│ │ │ │ -</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">add_extension</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">lt</span><span class="operator">::</span><span class="name">create_smart_ban_plugin</span><span class="punctuation">);</span>
│ │ │ │ -</pre>
│ │ │ │ -<a name="set_ip_filter()"></a>
│ │ │ │ -<a name="get_ip_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_ip_filter%28%29+get_ip_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_ip_filter%28%29+get_ip_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-ip-filter-get-ip-filter">
│ │ │ │ -<h2>set_ip_filter() get_ip_filter()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -ip_filter <strong>get_ip_filter</strong> () const;
│ │ │ │ -void <strong>set_ip_filter</strong> (ip_filter f);
│ │ │ │ -</pre>
│ │ │ │ -<p>Sets a filter that will be used to reject and accept incoming as well
│ │ │ │ -as outgoing connections based on their originating ip address. The
│ │ │ │ -default filter will allow connections to any ip address. To build a
│ │ │ │ -set of rules for which addresses are accepted and not, see <a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a>.</p>
│ │ │ │ -<p>Each time a peer is blocked because of the IP filter, a
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#peer_blocked_alert">peer_blocked_alert</a> is generated. <tt class="docutils literal">get_ip_filter()</tt> Returns the
│ │ │ │ -<a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a> currently in the <a class="reference external" href="reference-Session.html#session">session</a>. See <a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a>.</p>
│ │ │ │ -<a name="set_port_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_port_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_port_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-port-filter">
│ │ │ │ -<h2>set_port_filter()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_port_filter</strong> (port_filter const&amp; f);
│ │ │ │ -</pre>
│ │ │ │ -<p>apply <a class="reference external" href="reference-Filter.html#port_filter">port_filter</a> <tt class="docutils literal">f</tt> to incoming and outgoing peers. a port filter
│ │ │ │ -will reject making outgoing peer connections to certain remote ports.
│ │ │ │ -The main intention is to be able to avoid triggering certain
│ │ │ │ -anti-virus software by connecting to SMTP, FTP ports.</p>
│ │ │ │ -<a name="listen_port()"></a>
│ │ │ │ -<a name="is_listening()"></a>
│ │ │ │ -<a name="ssl_listen_port()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Blisten_port%28%29+is_listening%28%29+ssl_listen_port%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Blisten_port%28%29+is_listening%28%29+ssl_listen_port%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="listen-port-is-listening-ssl-listen-port">
│ │ │ │ -<h2>listen_port() is_listening() ssl_listen_port()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -unsigned short <strong>listen_port</strong> () const;
│ │ │ │ -bool <strong>is_listening</strong> () const;
│ │ │ │ -unsigned short <strong>ssl_listen_port</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">is_listening()</tt> will tell you whether or not the <a class="reference external" href="reference-Session.html#session">session</a> has
│ │ │ │ -successfully opened a listening port. If it hasn't, this function will
│ │ │ │ -return false, and then you can set a new
│ │ │ │ -<a class="reference external" href="reference-Settings.html#listen_interfaces">settings_pack::listen_interfaces</a> to try another interface and port to
│ │ │ │ -bind to.</p>
│ │ │ │ -<p><tt class="docutils literal">listen_port()</tt> returns the port we ended up listening on.</p>
│ │ │ │ -<a name="get_peer_class_filter()"></a>
│ │ │ │ -<a name="set_peer_class_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bget_peer_class_filter%28%29+set_peer_class_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bget_peer_class_filter%28%29+set_peer_class_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-peer-class-filter-set-peer-class-filter">
│ │ │ │ -<h2>get_peer_class_filter() set_peer_class_filter()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_peer_class_filter</strong> (ip_filter const&amp; f);
│ │ │ │ -ip_filter <strong>get_peer_class_filter</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>Sets the peer class filter for this <a class="reference external" href="reference-Session.html#session">session</a>. All new peer connections
│ │ │ │ -will take this into account and be added to the peer classes specified
│ │ │ │ -by this filter, based on the peer's IP address.</p>
│ │ │ │ -<p>The ip-filter essentially maps an IP -&gt; uint32. Each bit in that 32
│ │ │ │ -bit integer represents a peer class. The least significant bit
│ │ │ │ -represents class 0, the next bit class 1 and so on.</p>
│ │ │ │ -<p>For more info, see <a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a>.</p>
│ │ │ │ -<p>For example, to make all peers in the range 200.1.1.0 - 200.1.255.255
│ │ │ │ -belong to their own peer class, apply the following filter:</p>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="name">ip_filter</span><span class="whitespace"> </span><span class="name">f</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">get_peer_class_filter</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ -</span><span class="name">peer_class_t</span><span class="whitespace"> </span><span class="name">my_class</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">create_peer_class</span><span class="punctuation">(</span><span class="literal string">&quot;200.1.x.x IP range&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="name">f</span><span class="punctuation">.</span><span class="name">add_rule</span><span class="punctuation">(</span><span class="name">make_address</span><span class="punctuation">(</span><span class="literal string">&quot;200.1.1.0&quot;</span><span class="punctuation">),</span><span class="whitespace"> </span><span class="name">make_address</span><span class="punctuation">(</span><span class="literal string">&quot;200.1.255.255&quot;</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ -        </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="whitespace"> </span><span class="operator">&lt;&lt;</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="name">std</span><span class="operator">::</span><span class="keyword type">uint32_t</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">my_class</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ -</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">set_peer_class_filter</span><span class="punctuation">(</span><span class="name">f</span><span class="punctuation">);</span>
│ │ │ │ -</pre>
│ │ │ │ -<p>This setting only applies to new connections, it won't affect existing
│ │ │ │ -peer connections.</p>
│ │ │ │ -<p>This function is limited to only peer class 0-31, since there are only
│ │ │ │ -32 bits in the IP range mapping. Only the set bits matter; no peer
│ │ │ │ -class will be removed from a peer as a result of this call, peer
│ │ │ │ -classes are only added.</p>
│ │ │ │ -<p>The <tt class="docutils literal">peer_class</tt> argument cannot be greater than 31. The bitmasks
│ │ │ │ -representing peer classes in the <tt class="docutils literal">peer_class_filter</tt> are 32 bits.</p>
│ │ │ │ -<p>The <tt class="docutils literal">get_peer_class_filter()</tt> function returns the current filter.</p>
│ │ │ │ -<p>For more information, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ -<a name="set_peer_class_type_filter()"></a>
│ │ │ │ -<a name="get_peer_class_type_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_peer_class_type_filter%28%29+get_peer_class_type_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_peer_class_type_filter%28%29+get_peer_class_type_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-peer-class-type-filter-get-peer-class-type-filter">
│ │ │ │ -<h2>set_peer_class_type_filter() get_peer_class_type_filter()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_peer_class_type_filter</strong> (peer_class_type_filter const&amp; f);
│ │ │ │ -peer_class_type_filter <strong>get_peer_class_type_filter</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>Sets and gets the <em>peer class type filter</em>. This is controls automatic
│ │ │ │ -peer class assignments to peers based on what kind of socket it is.</p>
│ │ │ │ -<p>It does not only support assigning peer classes, it also supports
│ │ │ │ -removing peer classes based on socket type.</p>
│ │ │ │ -<p>The order of these rules being applied are:</p>
│ │ │ │ -<ol class="arabic simple">
│ │ │ │ -<li>peer-class IP filter</li>
│ │ │ │ -<li>peer-class type filter, removing classes</li>
│ │ │ │ -<li>peer-class type filter, adding classes</li>
│ │ │ │ -</ol>
│ │ │ │ -<p>For more information, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ -<a name="create_peer_class()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bcreate_peer_class%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bcreate_peer_class%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="create-peer-class">
│ │ │ │ -<h2>create_peer_class()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -peer_class_t <strong>create_peer_class</strong> (char const* name);
│ │ │ │ -</pre>
│ │ │ │ -<p>Creates a new peer class (see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>) with the given name. The
│ │ │ │ -returned integer is the new peer class identifier. Peer classes may
│ │ │ │ -have the same name, so each invocation of this function creates a new
│ │ │ │ -class and returns a unique identifier.</p>
│ │ │ │ -<p>Identifiers are assigned from low numbers to higher. So if you plan on
│ │ │ │ -using certain peer classes in a call to <a class="reference external" href="reference-Session.html#set_peer_class_filter()">set_peer_class_filter()</a>,
│ │ │ │ -make sure to create those early on, to get low identifiers.</p>
│ │ │ │ -<p>For more information on peer classes, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ -<a name="delete_peer_class()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdelete_peer_class%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdelete_peer_class%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="delete-peer-class">
│ │ │ │ -<h2>delete_peer_class()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>delete_peer_class</strong> (peer_class_t cid);
│ │ │ │ -</pre>
│ │ │ │ -<p>This call dereferences the reference count of the specified peer
│ │ │ │ -class. When creating a peer class it's automatically referenced by 1.
│ │ │ │ -If you want to recycle a peer class, you may call this function. You
│ │ │ │ -may only call this function <strong>once</strong> per peer class you create.
│ │ │ │ -Calling it more than once for the same class will lead to memory
│ │ │ │ -corruption.</p>
│ │ │ │ -<p>Since peer classes are reference counted, this function will not
│ │ │ │ -remove the peer class if it's still assigned to torrents or peers. It
│ │ │ │ -will however remove it once the last peer and torrent drops their
│ │ │ │ -references to it.</p>
│ │ │ │ -<p>There is no need to call this function for custom peer classes. All
│ │ │ │ -peer classes will be properly destructed when the <a class="reference external" href="reference-Session.html#session">session</a> object
│ │ │ │ -destructs.</p>
│ │ │ │ -<p>For more information on peer classes, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ -<a name="get_peer_class()"></a>
│ │ │ │ -<a name="set_peer_class()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bget_peer_class%28%29+set_peer_class%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bget_peer_class%28%29+set_peer_class%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-peer-class-set-peer-class">
│ │ │ │ -<h2>get_peer_class() set_peer_class()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_peer_class</strong> (peer_class_t cid, peer_class_info const&amp; pci);
│ │ │ │ -peer_class_info <strong>get_peer_class</strong> (peer_class_t cid) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>These functions queries information from a peer class and updates the
│ │ │ │ -configuration of a peer class, respectively.</p>
│ │ │ │ -<p><tt class="docutils literal">cid</tt> must refer to an existing peer class. If it does not, the
│ │ │ │ -return value of <tt class="docutils literal">get_peer_class()</tt> is undefined.</p>
│ │ │ │ -<p><tt class="docutils literal">set_peer_class()</tt> sets all the information in the
│ │ │ │ -<a class="reference external" href="reference-PeerClass.html#peer_class_info">peer_class_info</a> object in the specified peer class. There is no
│ │ │ │ -option to only update a single property.</p>
│ │ │ │ -<p>A peer or torrent belonging to more than one class, the highest
│ │ │ │ -priority among any of its classes is the one that is taken into
│ │ │ │ -account.</p>
│ │ │ │ -<p>For more information, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ -<a name="remove_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bremove_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bremove_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="remove-torrent">
│ │ │ │ -<h2>remove_torrent()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>remove_torrent</strong> (const torrent_handle&amp;, remove_flags_t = {});
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">remove_torrent()</tt> will close all peer connections associated with
│ │ │ │ -the torrent and tell the tracker that we've stopped participating in
│ │ │ │ -the swarm. This operation cannot fail. When it completes, you will
│ │ │ │ -receive a <a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a>.</p>
│ │ │ │ -<p><a class="reference external" href="reference-Custom_Storage.html#remove_torrent()">remove_torrent()</a> is non-blocking, but will remove the torrent from the
│ │ │ │ -<a class="reference external" href="reference-Session.html#session">session</a> synchronously. Calling <a class="reference external" href="reference-Session.html#add_torrent()">session_handle::add_torrent()</a> immediately
│ │ │ │ -afterward with the same torrent will succeed. Note that this creates a
│ │ │ │ -new handle which is not equal to the removed one.</p>
│ │ │ │ -<p>The optional second argument <tt class="docutils literal">options</tt> can be used to delete all the
│ │ │ │ -files downloaded by this torrent. To do so, pass in the value
│ │ │ │ -<tt class="docutils literal"><span class="pre">session_handle::delete_files</span></tt>. Once the torrent is deleted, a
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#torrent_deleted_alert">torrent_deleted_alert</a> is posted.</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> remains valid for some time after <a class="reference external" href="reference-Custom_Storage.html#remove_torrent()">remove_torrent()</a> is
│ │ │ │ -called. It will become invalid only after all libtorrent tasks (such as
│ │ │ │ -I/O tasks) release their references to the torrent. Until this happens,
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#is_valid()">torrent_handle::is_valid()</a> will return true, and other calls such
│ │ │ │ -as <a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a> will succeed. Because of this, and because
│ │ │ │ -<a class="reference external" href="reference-Custom_Storage.html#remove_torrent()">remove_torrent()</a> is non-blocking, the following sequence usually
│ │ │ │ -succeeds (does not throw system_error):
│ │ │ │ -.. code:: c++</p>
│ │ │ │ -<blockquote>
│ │ │ │ -session.remove_handle(handle);
│ │ │ │ -handle.save_resume_data();</blockquote>
│ │ │ │ -<p>Note that when a queued or downloading torrent is removed, its position
│ │ │ │ -in the download queue is vacated and every subsequent torrent in the
│ │ │ │ -queue has their queue positions updated. This can potentially cause a
│ │ │ │ -large state_update to be posted. When removing all torrents, it is
│ │ │ │ -advised to remove them from the back of the queue, to minimize the
│ │ │ │ -shifting.</p>
│ │ │ │ -<a name="apply_settings()"></a>
│ │ │ │ -<a name="get_settings()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bapply_settings%28%29+get_settings%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bapply_settings%28%29+get_settings%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="apply-settings-get-settings">
│ │ │ │ -<h2>apply_settings() get_settings()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>apply_settings</strong> (settings_pack&amp;&amp;);
│ │ │ │ -settings_pack <strong>get_settings</strong> () const;
│ │ │ │ -void <strong>apply_settings</strong> (settings_pack const&amp;);
│ │ │ │ -</pre>
│ │ │ │ -<p>Applies the settings specified by the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> <tt class="docutils literal">s</tt>. This is an
│ │ │ │ -asynchronous operation that will return immediately and actually apply
│ │ │ │ -the settings to the main thread of libtorrent some time later.</p>
│ │ │ │ -<a name="pop_alerts()"></a>
│ │ │ │ -<a name="wait_for_alert()"></a>
│ │ │ │ -<a name="set_alert_notify()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bpop_alerts%28%29+wait_for_alert%28%29+set_alert_notify%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bpop_alerts%28%29+wait_for_alert%28%29+set_alert_notify%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="pop-alerts-wait-for-alert-set-alert-notify">
│ │ │ │ -<h2>pop_alerts() wait_for_alert() set_alert_notify()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_alert_notify</strong> (std::function&lt;void()&gt; const&amp; fun);
│ │ │ │ -alert* <strong>wait_for_alert</strong> (time_duration max_wait);
│ │ │ │ -void <strong>pop_alerts</strong> (std::vector&lt;alert*&gt;* alerts);
│ │ │ │ -</pre>
│ │ │ │ -<p>Alerts is the main mechanism for libtorrent to report errors and
│ │ │ │ -events. <tt class="docutils literal">pop_alerts</tt> fills in the vector passed to it with pointers
│ │ │ │ -to new alerts. The <a class="reference external" href="reference-Session.html#session">session</a> still owns these alerts and they will stay
│ │ │ │ -valid until the next time <tt class="docutils literal">pop_alerts</tt> is called. You may not delete
│ │ │ │ -the <a class="reference external" href="reference-Alerts.html#alert">alert</a> objects.</p>
│ │ │ │ -<p>It is safe to call <tt class="docutils literal">pop_alerts</tt> from multiple different threads, as
│ │ │ │ -long as the alerts themselves are not accessed once another thread
│ │ │ │ -calls <tt class="docutils literal">pop_alerts</tt>. Doing this requires manual synchronization
│ │ │ │ -between the popping threads.</p>
│ │ │ │ -<p><tt class="docutils literal">wait_for_alert</tt> will block the current thread for <tt class="docutils literal">max_wait</tt> time
│ │ │ │ -duration, or until another <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted. If an <a class="reference external" href="reference-Alerts.html#alert">alert</a> is available
│ │ │ │ -at the time of the call, it returns immediately. The returned <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -pointer is the head of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue. <tt class="docutils literal">wait_for_alert</tt> does not
│ │ │ │ -pop alerts from the queue, it merely peeks at it. The returned <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -will stay valid until <tt class="docutils literal">pop_alerts</tt> is called twice. The first time
│ │ │ │ -will pop it and the second will free it.</p>
│ │ │ │ -<p>If there is no <a class="reference external" href="reference-Alerts.html#alert">alert</a> in the queue and no <a class="reference external" href="reference-Alerts.html#alert">alert</a> arrives within the
│ │ │ │ -specified timeout, <tt class="docutils literal">wait_for_alert</tt> returns nullptr.</p>
│ │ │ │ -<p>In the python binding, <tt class="docutils literal">wait_for_alert</tt> takes the number of
│ │ │ │ -milliseconds to wait as an integer.</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue in the <a class="reference external" href="reference-Session.html#session">session</a> will not grow indefinitely. Make sure
│ │ │ │ -to pop periodically to not miss notifications. To control the max
│ │ │ │ -number of alerts that's queued by the <a class="reference external" href="reference-Session.html#session">session</a>, see
│ │ │ │ -<tt class="docutils literal"><span class="pre">settings_pack::alert_queue_size</span></tt>.</p>
│ │ │ │ -<p>Some alerts are considered so important that they are posted even when
│ │ │ │ -the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue is full. Some alerts are considered mandatory and cannot
│ │ │ │ -be disabled by the <tt class="docutils literal">alert_mask</tt>. For instance,
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a> and <a class="reference external" href="reference-Alerts.html#save_resume_data_failed_alert">save_resume_data_failed_alert</a> are always
│ │ │ │ -posted, regardless of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
│ │ │ │ -<p>To control which alerts are posted, set the alert_mask
│ │ │ │ -(<a class="reference external" href="reference-Settings.html#alert_mask">settings_pack::alert_mask</a>).</p>
│ │ │ │ -<p>If the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue fills up to the point where alerts are dropped, this
│ │ │ │ -will be indicated by a <a class="reference external" href="reference-Alerts.html#alerts_dropped_alert">alerts_dropped_alert</a>, which contains a bitmask
│ │ │ │ -of which types of alerts were dropped. Generally it is a good idea to
│ │ │ │ -make sure the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue is large enough, the alert_mask doesn't have
│ │ │ │ -unnecessary categories enabled and to call pop_alert() frequently, to
│ │ │ │ -avoid alerts being dropped.</p>
│ │ │ │ -<p>the <tt class="docutils literal">set_alert_notify</tt> function lets the client set a function object
│ │ │ │ -to be invoked every time the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue goes from having 0 alerts to
│ │ │ │ -1 <a class="reference external" href="reference-Alerts.html#alert">alert</a>. This function is called from within libtorrent, it may be the
│ │ │ │ -main thread, or it may be from within a user call. The intention of
│ │ │ │ -of the function is that the client wakes up its main thread, to poll
│ │ │ │ -for more alerts using <tt class="docutils literal">pop_alerts()</tt>. If the notify function fails
│ │ │ │ -to do so, it won't be called again, until <tt class="docutils literal">pop_alerts</tt> is called for
│ │ │ │ -some other reason. For instance, it could signal an eventfd, post a
│ │ │ │ -message to an HWND or some other main message pump. The actual
│ │ │ │ -retrieval of alerts should not be done in the callback. In fact, the
│ │ │ │ -callback should not block. It should not perform any expensive work.
│ │ │ │ -It really should just notify the main application thread.</p>
│ │ │ │ -<p>The type of an <a class="reference external" href="reference-Alerts.html#alert">alert</a> is returned by the polymorphic function
│ │ │ │ -<tt class="docutils literal"><span class="pre">alert::type()</span></tt> but can also be queries from a concrete type via
│ │ │ │ -<tt class="docutils literal"><span class="pre">T::alert_type</span></tt>, as a static constant.</p>
│ │ │ │ -<a name="add_port_mapping()"></a>
│ │ │ │ -<a name="delete_port_mapping()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Badd_port_mapping%28%29+delete_port_mapping%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Badd_port_mapping%28%29+delete_port_mapping%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-port-mapping-delete-port-mapping">
│ │ │ │ -<h2>add_port_mapping() delete_port_mapping()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>delete_port_mapping</strong> (port_mapping_t handle);
│ │ │ │ -std::vector&lt;port_mapping_t&gt; <strong>add_port_mapping</strong> (portmap_protocol t, int external_port, int local_port);
│ │ │ │ -</pre>
│ │ │ │ -<p>add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP,
│ │ │ │ -whichever is enabled. A mapping is created for each listen socket
│ │ │ │ -in the <a class="reference external" href="reference-Session.html#session">session</a>. The return values are all handles referring to the
│ │ │ │ -port mappings that were just created. Pass them to <a class="reference external" href="reference-Session.html#delete_port_mapping()">delete_port_mapping()</a>
│ │ │ │ -to remove them.</p>
│ │ │ │ -<a name="reopen_network_sockets()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Breopen_network_sockets%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Breopen_network_sockets%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="reopen-network-sockets">
│ │ │ │ -<h2>reopen_network_sockets()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>reopen_network_sockets</strong> (reopen_network_flags_t options = reopen_map_ports);
│ │ │ │ -</pre>
│ │ │ │ -<p>Instructs the <a class="reference external" href="reference-Session.html#session">session</a> to reopen all listen and outgoing sockets.</p>
│ │ │ │ -<p>It's useful in the case your platform doesn't support the built in
│ │ │ │ -IP notifier mechanism, or if you have a better more reliable way to
│ │ │ │ -detect changes in the IP routing table.</p>
│ │ │ │ -<a name="native_handle()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bnative_handle%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bnative_handle%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="native-handle-1">
│ │ │ │ -<h2>native_handle()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::shared_ptr&lt;aux::session_impl&gt; <strong>native_handle</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>This function is intended only for use by plugins. This type does
│ │ │ │ -not have a stable API and should be relied on as little as possible.</p>
│ │ │ │ -<a name="save_settings"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bsave_settings%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bsave_settings%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>save_settings</dt>
│ │ │ │ -<dd>saves settings (i.e. the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>)</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="save_dht_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bsave_dht_state%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bsave_dht_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>save_dht_state</dt>
│ │ │ │ -<dd>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.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="save_extension_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bsave_extension_state%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bsave_extension_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>save_extension_state</dt>
│ │ │ │ -<dd>load or save state from plugins</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="save_ip_filter"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bsave_ip_filter%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bsave_ip_filter%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>save_ip_filter</dt>
│ │ │ │ -<dd>load or save the IP filter set on the <a class="reference external" href="reference-Session.html#session">session</a></dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="global_peer_class_id"></a>
│ │ │ │ -<a name="tcp_peer_class_id"></a>
│ │ │ │ -<a name="local_peer_class_id"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bglobal_peer_class_id+tcp_peer_class_id+local_peer_class_id%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bglobal_peer_class_id+tcp_peer_class_id+local_peer_class_id%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>global_peer_class_id tcp_peer_class_id local_peer_class_id</dt>
│ │ │ │ -<dd>built-in peer classes</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="delete_files"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdelete_files%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdelete_files%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>delete_files</dt>
│ │ │ │ -<dd>delete the files belonging to the torrent from disk.
│ │ │ │ -including the part-file, if there is one</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="delete_partfile"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdelete_partfile%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdelete_partfile%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>delete_partfile</dt>
│ │ │ │ -<dd>delete just the part-file associated with this torrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="paused"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bpaused%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bpaused%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>paused</dt>
│ │ │ │ -<dd>when set, the <a class="reference external" href="reference-Session.html#session">session</a> will start paused. Call
│ │ │ │ -<a class="reference external" href="reference-Session.html#resume()">session_handle::resume()</a> to start</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="udp"></a>
│ │ │ │ -<a name="tcp"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Budp+tcp%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Budp+tcp%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>udp tcp</dt>
│ │ │ │ -<dd>protocols used by <a class="reference external" href="reference-Session.html#add_port_mapping()">add_port_mapping()</a></dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="reopen_map_ports"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Breopen_map_ports%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Breopen_map_ports%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>reopen_map_ports</dt>
│ │ │ │ -<dd>This option indicates if the ports are mapped using natpmp
│ │ │ │ -and upnp. If mapping was already made, they are deleted and added
│ │ │ │ -again. This only works if natpmp and/or upnp are configured to be
│ │ │ │ -enable.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="write_session_params_buf()"></a>
│ │ │ │ -<a name="read_session_params()"></a>
│ │ │ │ -<a name="write_session_params()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:write_session_params_buf%28%29+read_session_params%28%29+write_session_params%28%29&labels=documentation&body=Documentation+under+heading+%22write_session_params_buf%28%29+read_session_params%28%29+write_session_params%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="write-session-params-buf-read-session-params-write-session-params">
│ │ │ │ -<h1>write_session_params_buf() read_session_params() write_session_params()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_params.hpp">libtorrent/session_params.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -session_params <strong>read_session_params</strong> (span&lt;char const&gt; buf
│ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ -session_params <strong>read_session_params</strong> (bdecode_node const&amp; e
│ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ -std::vector&lt;char&gt; <strong>write_session_params_buf</strong> (session_params const&amp; sp
│ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ -entry <strong>write_session_params</strong> (session_params const&amp; sp
│ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ -</pre>
│ │ │ │ -<p>These functions serialize and de-serialize a <tt class="docutils literal">session_params</tt> object to and
│ │ │ │ -from bencoded form. The <a class="reference external" href="reference-Session.html#session_params">session_params</a> object is used to initialize a new
│ │ │ │ -<a class="reference external" href="reference-Session.html#session">session</a> using the state from a previous one (or by programmatically configure
│ │ │ │ -the <a class="reference external" href="reference-Session.html#session">session</a> up-front).
│ │ │ │ -The flags parameter can be used to only save and load certain aspects of the
│ │ │ │ -session's state.
│ │ │ │ -The <tt class="docutils literal">_buf</tt> suffix indicates the function operates on buffer rather than the
│ │ │ │ -bencoded structure.
│ │ │ │ -The torrents in a <a class="reference external" href="reference-Session.html#session">session</a> are not part of the <a class="reference external" href="reference-Session.html#session_params">session_params</a> state, they have
│ │ │ │ -to be restored separately.</p>
│ │ │ │ -<a name="stats_metric"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+stats_metric&labels=documentation&body=Documentation+under+heading+%22class+stats_metric%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="stats-metric">
│ │ │ │ -<h1>stats_metric</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_stats.hpp">libtorrent/session_stats.hpp</a>&quot;</p>
│ │ │ │ -<p>describes one statistics metric from the <a class="reference external" href="reference-Session.html#session">session</a>. For more information,
│ │ │ │ -see the <a class="reference external" href="manual-ref.html#session-statistics">session statistics</a> section.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct stats_metric
│ │ │ │ -{
│ │ │ │ -   char const* name;
│ │ │ │ -   int value_index;
│ │ │ │ -   metric_type_t type;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="name"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:stats_metric%3A%3A%5Bname%5D&labels=documentation&body=Documentation+under+heading+%22stats_metric%3A%3A%5Bname%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>name</dt>
│ │ │ │ -<dd>the name of the counter or gauge</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="value_index"></a>
│ │ │ │ -<a name="type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:stats_metric%3A%3A%5Bvalue_index+type%5D&labels=documentation&body=Documentation+under+heading+%22stats_metric%3A%3A%5Bvalue_index+type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>value_index type</dt>
│ │ │ │ -<dd>the index into the <a class="reference external" href="reference-Session.html#session">session</a> stats array, where the underlying value of
│ │ │ │ -this counter or gauge is found. The <a class="reference external" href="reference-Session.html#session">session</a> stats array is part of the
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a> object.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="counters"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+counters&labels=documentation&body=Documentation+under+heading+%22class+counters%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="counters">
│ │ │ │ -<h1>counters</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/performance_counters.hpp">libtorrent/performance_counters.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct counters
│ │ │ │ -{
│ │ │ │ -   <strong>counters</strong> () ;
│ │ │ │ -   <strong>counters</strong> (counters const&amp;) ;
│ │ │ │ -   counters&amp; <strong>operator=</strong> (counters const&amp;) &amp; ;
│ │ │ │ -   std::int64_t <strong>inc_stats_counter</strong> (int c, std::int64_t value = 1) ;
│ │ │ │ -   std::int64_t <strong>operator[]</strong> (int i) const ;
│ │ │ │ -   void <strong>blend_stats_counter</strong> (int c, std::int64_t value, int ratio) ;
│ │ │ │ -   void <strong>set_value</strong> (int c, std::int64_t value) ;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="operator[]()"></a>
│ │ │ │ -<a name="inc_stats_counter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:counters%3A%3A%5Boperator%5B%5D%28%29+inc_stats_counter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22counters%3A%3A%5Boperator%5B%5D%28%29+inc_stats_counter%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-inc-stats-counter">
│ │ │ │ -<h2>operator[]() inc_stats_counter()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::int64_t <strong>inc_stats_counter</strong> (int c, std::int64_t value = 1) ;
│ │ │ │ -std::int64_t <strong>operator[]</strong> (int i) const ;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the new value</p>
│ │ │ │ -<a name="session_stats_metrics()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_stats_metrics%28%29&labels=documentation&body=Documentation+under+heading+%22session_stats_metrics%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="session-stats-metrics">
│ │ │ │ -<h1>session_stats_metrics()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_stats.hpp">libtorrent/session_stats.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::vector&lt;stats_metric&gt; <strong>session_stats_metrics</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>This free function returns the list of available metrics exposed by
│ │ │ │ -libtorrent's statistics API. Each metric has a name and a <em>value index</em>.
│ │ │ │ -The value index is the index into the array in <a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a> where
│ │ │ │ -this metric's value can be found when the <a class="reference external" href="reference-Session.html#session">session</a> stats is sampled (by
│ │ │ │ -calling <a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a>).</p>
│ │ │ │ -<a name="find_metric_idx()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:find_metric_idx%28%29&labels=documentation&body=Documentation+under+heading+%22find_metric_idx%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="find-metric-idx">
│ │ │ │ -<h1>find_metric_idx()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_stats.hpp">libtorrent/session_stats.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>find_metric_idx</strong> (string_view name);
│ │ │ │ -</pre>
│ │ │ │ -<p>given a name of a metric, this function returns the counter index of it,
│ │ │ │ -or -1 if it could not be found. The counter index is the index into the
│ │ │ │ -values array returned by <a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a>.</p>
│ │ │ │ -<a name="metric_type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+metric_type_t&labels=documentation&body=Documentation+under+heading+%22enum+metric_type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-metric-type-t">
│ │ │ │ -<h1>enum metric_type_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_stats.hpp">libtorrent/session_stats.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="31%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -<col width="45%" />
│ │ │ │ -</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>counter</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>gauge</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="ip_filter"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+ip_filter&labels=documentation&body=Documentation+under+heading+%22class+ip_filter%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="ip-filter">
│ │ │ │ -<h1>ip_filter</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/ip_filter.hpp">libtorrent/ip_filter.hpp</a>&quot;</p>
│ │ │ │ -<p>The <tt class="docutils literal">ip_filter</tt> class is a set of rules that uniquely categorizes all
│ │ │ │ -ip addresses as allowed or disallowed. The default constructor creates
│ │ │ │ -a single rule that allows all addresses (0.0.0.0 - 255.255.255.255 for
│ │ │ │ -the IPv4 range, and the equivalent range covering all addresses for the
│ │ │ │ -IPv6 range).</p>
│ │ │ │ -<p>A default constructed <a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a> does not filter any address.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct ip_filter
│ │ │ │ -{
│ │ │ │ -   <strong>ip_filter</strong> ();
│ │ │ │ -   <strong>ip_filter</strong> (ip_filter&amp;&amp;);
│ │ │ │ -   <strong>ip_filter</strong> (ip_filter const&amp;);
│ │ │ │ -   <strong>~ip_filter</strong> ();
│ │ │ │ -   ip_filter&amp; <strong>operator=</strong> (ip_filter const&amp;);
│ │ │ │ -   ip_filter&amp; <strong>operator=</strong> (ip_filter&amp;&amp;);
│ │ │ │ -   bool <strong>empty</strong> () const;
│ │ │ │ -   void <strong>add_rule</strong> (address const&amp; first, address const&amp; last, std::uint32_t flags);
│ │ │ │ -   std::uint32_t <strong>access</strong> (address const&amp; addr) const;
│ │ │ │ -   filter_tuple_t <strong>export_filter</strong> () const;
│ │ │ │ -
│ │ │ │ -   enum access_flags
│ │ │ │ -   {
│ │ │ │ -      blocked,
│ │ │ │ -   };
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="empty()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:ip_filter%3A%3A%5Bempty%28%29%5D&labels=documentation&body=Documentation+under+heading+%22ip_filter%3A%3A%5Bempty%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="empty-1">
│ │ │ │ -<h2>empty()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>empty</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if the filter does not contain any rules</p>
│ │ │ │ -<a name="add_rule()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:ip_filter%3A%3A%5Badd_rule%28%29%5D&labels=documentation&body=Documentation+under+heading+%22ip_filter%3A%3A%5Badd_rule%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-rule">
│ │ │ │ -<h2>add_rule()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_rule</strong> (address const&amp; first, address const&amp; last, std::uint32_t flags);
│ │ │ │ -</pre>
│ │ │ │ -<p>Adds a rule to the filter. <tt class="docutils literal">first</tt> and <tt class="docutils literal">last</tt> defines a range of
│ │ │ │ -ip addresses that will be marked with the given flags. The <tt class="docutils literal">flags</tt>
│ │ │ │ -can currently be 0, which means allowed, or <tt class="docutils literal"><span class="pre">ip_filter::blocked</span></tt>, which
│ │ │ │ -means disallowed.</p>
│ │ │ │ -<p>precondition:
│ │ │ │ -<tt class="docutils literal">first.is_v4() == last.is_v4() &amp;&amp; first.is_v6() == last.is_v6()</tt></p>
│ │ │ │ -<p>postcondition:
│ │ │ │ -<tt class="docutils literal">access(x) == flags</tt> for every <tt class="docutils literal">x</tt> in the range [<tt class="docutils literal">first</tt>, <tt class="docutils literal">last</tt>]</p>
│ │ │ │ -<p>This means that in a case of overlapping ranges, the last one applied takes
│ │ │ │ -precedence.</p>
│ │ │ │ -<a name="access()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:ip_filter%3A%3A%5Baccess%28%29%5D&labels=documentation&body=Documentation+under+heading+%22ip_filter%3A%3A%5Baccess%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="access">
│ │ │ │ -<h2>access()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::uint32_t <strong>access</strong> (address const&amp; addr) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>Returns the access permissions for the given address (<tt class="docutils literal">addr</tt>). The permission
│ │ │ │ -can currently be 0 or <tt class="docutils literal"><span class="pre">ip_filter::blocked</span></tt>. The complexity of this operation
│ │ │ │ -is O(<tt class="docutils literal">log</tt> n), where n is the minimum number of non-overlapping ranges to describe
│ │ │ │ -the current filter.</p>
│ │ │ │ -<a name="export_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:ip_filter%3A%3A%5Bexport_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22ip_filter%3A%3A%5Bexport_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="export-filter">
│ │ │ │ -<h2>export_filter()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -filter_tuple_t <strong>export_filter</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>This function will return the current state of the filter in the minimum number of
│ │ │ │ -ranges possible. They are sorted from ranges in low addresses to high addresses. Each
│ │ │ │ -<a class="reference external" href="reference-Bencoding.html#entry">entry</a> in the returned vector is a range with the access control specified in its
│ │ │ │ -<tt class="docutils literal">flags</tt> field.</p>
│ │ │ │ -<p>The return value is a tuple containing two range-lists. One for IPv4 addresses
│ │ │ │ -and one for IPv6 addresses.</p>
│ │ │ │ -<a name="access_flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+access_flags&labels=documentation&body=Documentation+under+heading+%22enum+access_flags%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-access-flags">
│ │ │ │ -<h2>enum access_flags</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/ip_filter.hpp">libtorrent/ip_filter.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="12%" />
│ │ │ │ -<col width="9%" />
│ │ │ │ -<col width="78%" />
│ │ │ │ -</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>blocked</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>indicates that IPs in this range should not be connected
│ │ │ │ -to nor accepted as incoming connections</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="port_filter"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+port_filter&labels=documentation&body=Documentation+under+heading+%22class+port_filter%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="port-filter">
│ │ │ │ -<h1>port_filter</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/ip_filter.hpp">libtorrent/ip_filter.hpp</a>&quot;</p>
│ │ │ │ -<p>the port filter maps non-overlapping port ranges to flags. This
│ │ │ │ -is primarily used to indicate whether a range of ports should
│ │ │ │ -be connected to or not. The default is to have the full port
│ │ │ │ -range (0-65535) set to flag 0.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -class port_filter
│ │ │ │ -{
│ │ │ │ -   <strong>~port_filter</strong> ();
│ │ │ │ -   port_filter&amp; <strong>operator=</strong> (port_filter const&amp;);
│ │ │ │ -   <strong>port_filter</strong> (port_filter const&amp;);
│ │ │ │ -   <strong>port_filter</strong> ();
│ │ │ │ -   port_filter&amp; <strong>operator=</strong> (port_filter&amp;&amp;);
│ │ │ │ -   <strong>port_filter</strong> (port_filter&amp;&amp;);
│ │ │ │ -   void <strong>add_rule</strong> (std::uint16_t first, std::uint16_t last, std::uint32_t flags);
│ │ │ │ -   std::uint32_t <strong>access</strong> (std::uint16_t port) const;
│ │ │ │ -
│ │ │ │ -   enum access_flags
│ │ │ │ -   {
│ │ │ │ -      blocked,
│ │ │ │ -   };
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="add_rule()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:port_filter%3A%3A%5Badd_rule%28%29%5D&labels=documentation&body=Documentation+under+heading+%22port_filter%3A%3A%5Badd_rule%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="add-rule-1">
│ │ │ │ -<h2>add_rule()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_rule</strong> (std::uint16_t first, std::uint16_t last, std::uint32_t flags);
│ │ │ │ -</pre>
│ │ │ │ -<p>set the flags for the specified port range (<tt class="docutils literal">first</tt>, <tt class="docutils literal">last</tt>) to
│ │ │ │ -<tt class="docutils literal">flags</tt> overwriting any existing rule for those ports. The range
│ │ │ │ -is inclusive, i.e. the port <tt class="docutils literal">last</tt> also has the flag set on it.</p>
│ │ │ │ -<a name="access()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:port_filter%3A%3A%5Baccess%28%29%5D&labels=documentation&body=Documentation+under+heading+%22port_filter%3A%3A%5Baccess%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="access-1">
│ │ │ │ -<h2>access()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::uint32_t <strong>access</strong> (std::uint16_t port) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>test the specified port (<tt class="docutils literal">port</tt>) for whether it is blocked
│ │ │ │ -or not. The returned value is the flags set for this port.
│ │ │ │ -see <a class="reference external" href="reference-Filter.html#access_flags">access_flags</a>.</p>
│ │ │ │ -<a name="access_flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+access_flags&labels=documentation&body=Documentation+under+heading+%22enum+access_flags%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-access-flags-1">
│ │ │ │ -<h2>enum access_flags</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/ip_filter.hpp">libtorrent/ip_filter.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="10%" />
│ │ │ │ -<col width="76%" />
│ │ │ │ -</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>blocked</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>this flag indicates that destination ports in the
│ │ │ │ -range should not be connected to</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="client_data_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+client_data_t&labels=documentation&body=Documentation+under+heading+%22class+client_data_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="client-data-t">
│ │ │ │ -<h1>client_data_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/client_data.hpp">libtorrent/client_data.hpp</a>&quot;</p>
│ │ │ │ -<p>A thin wrapper around a void pointer used as &quot;user data&quot;. i.e. an opaque
│ │ │ │ -cookie passed in to libtorrent and returned on demand. It adds type-safety by
│ │ │ │ -requiring the same type be requested out of it as was assigned to it.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct client_data_t
│ │ │ │ -{
│ │ │ │ -   <strong>client_data_t</strong> () = default;
│ │ │ │ -   explicit <strong>client_data_t</strong> (T* v);
│ │ │ │ -   client_data_t&amp; <strong>operator=</strong> (T* v);
│ │ │ │ -   explicit operator <strong>T</strong> () const;
│ │ │ │ -   T* <strong>get</strong> () const;
│ │ │ │ -   client_data_t&amp; <strong>operator=</strong> (void const*) = delete;
│ │ │ │ -   client_data_t&amp; <strong>operator=</strong> (void*) = delete;
│ │ │ │ -   operator <strong>void*</strong> () const = delete;
│ │ │ │ -   operator void <strong>const*</strong> () const = delete;
│ │ │ │ -
│ │ │ │ -   template &lt;typename T, typename <strong>U</strong>  = typename std::enable_if&lt;std::is_pointer&lt;T&gt;::value&gt;::type&gt;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="client_data_t()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:client_data_t%3A%3A%5Bclient_data_t%28%29%5D&labels=documentation&body=Documentation+under+heading+%22client_data_t%3A%3A%5Bclient_data_t%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="client-data-t-1">
│ │ │ │ -<h2>client_data_t()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>client_data_t</strong> () = default;
│ │ │ │ -</pre>
│ │ │ │ -<p>construct a nullptr client data</p>
│ │ │ │ -<a name="const*()"></a>
│ │ │ │ -<a name="void*()"></a>
│ │ │ │ -<a name="operator=()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:client_data_t%3A%3A%5Bconst%2A%28%29+void%2A%28%29+operator%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22client_data_t%3A%3A%5Bconst%2A%28%29+void%2A%28%29+operator%3D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="const-void-operator">
│ │ │ │ -<h2>const*() void*() operator=()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -client_data_t&amp; <strong>operator=</strong> (void const*) = delete;
│ │ │ │ -client_data_t&amp; <strong>operator=</strong> (void*) = delete;
│ │ │ │ -operator <strong>void*</strong> () const = delete;
│ │ │ │ -operator void <strong>const*</strong> () const = delete;
│ │ │ │ -</pre>
│ │ │ │ -<p>we don't allow type-unsafe operations</p>
│ │ │ │ -<a name="add_torrent_params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+add_torrent_params&labels=documentation&body=Documentation+under+heading+%22class+add_torrent_params%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="add-torrent-params">
│ │ │ │ -<h1>add_torrent_params</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/add_torrent_params.hpp">libtorrent/add_torrent_params.hpp</a>&quot;</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> contains all the information in a .torrent file
│ │ │ │ -along with all information necessary to add that torrent to a <a class="reference external" href="reference-Session.html#session">session</a>.
│ │ │ │ -The key fields when adding a torrent are:</p>
│ │ │ │ -<ul class="simple">
│ │ │ │ -<li>ti - the immutable info-dict part of the torrent</li>
│ │ │ │ -<li>info_hash - when you don't have the metadata (.torrent file). This
│ │ │ │ -uniquely identifies the torrent and can validate the info-dict when
│ │ │ │ -received from the swarm.</li>
│ │ │ │ -</ul>
│ │ │ │ -<p>In order to add a torrent to a <a class="reference external" href="reference-Session.html#session">session</a>, one of those fields must be set
│ │ │ │ -in addition to <tt class="docutils literal">save_path</tt>. The <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object can then be
│ │ │ │ -passed into one of the <tt class="docutils literal"><span class="pre">session::add_torrent()</span></tt> overloads or
│ │ │ │ -<tt class="docutils literal"><span class="pre">session::async_add_torrent()</span></tt>.</p>
│ │ │ │ -<p>If you only specify the info-hash, the torrent file will be downloaded
│ │ │ │ -from peers, which requires them to support the metadata extension. For
│ │ │ │ -the metadata extension to work, libtorrent must be built with extensions
│ │ │ │ -enabled (<tt class="docutils literal">TORRENT_DISABLE_EXTENSIONS</tt> must not be defined). It also
│ │ │ │ -takes an optional <tt class="docutils literal">name</tt> argument. This may be left empty in case no
│ │ │ │ -name should be assigned to the torrent. In case it's not, the name is
│ │ │ │ -used for the torrent as long as it doesn't have metadata. See
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_handle::name</span></tt>.</p>
│ │ │ │ -<p>The <tt class="docutils literal">add_torrent_params</tt> is also used when requesting resume data for a
│ │ │ │ -torrent. It can be saved to and restored from a file and added back to a
│ │ │ │ -new <a class="reference external" href="reference-Session.html#session">session</a>. For serialization and de-serialization of
│ │ │ │ -<tt class="docutils literal">add_torrent_params</tt> objects, see <a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a> and
│ │ │ │ -<a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a>.</p>
│ │ │ │ -<p>The <tt class="docutils literal">add_torrent_params</tt> is also used to represent a parsed .torrent
│ │ │ │ -file. It can be loaded via <a class="reference external" href="reference-Core.html#load_torrent_file()">load_torrent_file()</a>, <a class="reference external" href="reference-Core.html#load_torrent_buffer()">load_torrent_buffer()</a> and
│ │ │ │ -<a class="reference external" href="reference-Core.html#load_torrent_parsed()">load_torrent_parsed()</a>. It can be saved via <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct add_torrent_params
│ │ │ │ -{
│ │ │ │ -   int <strong>version</strong>  = LIBTORRENT_VERSION_NUM;
│ │ │ │ -   std::shared_ptr&lt;torrent_info&gt; ti;
│ │ │ │ -   aux::noexcept_movable&lt;std::vector&lt;std::string&gt;&gt; trackers;
│ │ │ │ -   aux::noexcept_movable&lt;std::vector&lt;int&gt;&gt; tracker_tiers;
│ │ │ │ -   aux::noexcept_movable&lt;std::vector&lt;std::pair&lt;std::string, int&gt;&gt;&gt; dht_nodes;
│ │ │ │ -   std::string name;
│ │ │ │ -   std::string save_path;
│ │ │ │ -   storage_mode_t <strong>storage_mode</strong>  = storage_mode_sparse;
│ │ │ │ -   client_data_t userdata;
│ │ │ │ -   aux::noexcept_movable&lt;std::vector&lt;download_priority_t&gt;&gt; file_priorities;
│ │ │ │ -   std::string trackerid;
│ │ │ │ -   torrent_flags_t <strong>flags</strong>  = torrent_flags::default_flags;
│ │ │ │ -   info_hash_t info_hashes;
│ │ │ │ -   int <strong>max_uploads</strong>  = -1;
│ │ │ │ -   int <strong>max_connections</strong>  = -1;
│ │ │ │ -   int <strong>upload_limit</strong>  = -1;
│ │ │ │ -   int <strong>download_limit</strong>  = -1;
│ │ │ │ -   std::int64_t <strong>total_uploaded</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>total_downloaded</strong>  = 0;
│ │ │ │ -   int <strong>active_time</strong>  = 0;
│ │ │ │ -   int <strong>finished_time</strong>  = 0;
│ │ │ │ -   int <strong>seeding_time</strong>  = 0;
│ │ │ │ -   std::time_t <strong>added_time</strong>  = 0;
│ │ │ │ -   std::time_t <strong>completed_time</strong>  = 0;
│ │ │ │ -   std::time_t <strong>last_seen_complete</strong>  = 0;
│ │ │ │ -   int <strong>num_complete</strong>  = -1;
│ │ │ │ -   int <strong>num_incomplete</strong>  = -1;
│ │ │ │ -   int <strong>num_downloaded</strong>  = -1;
│ │ │ │ -   aux::noexcept_movable&lt;std::vector&lt;std::string&gt;&gt; http_seeds;
│ │ │ │ -   aux::noexcept_movable&lt;std::vector&lt;std::string&gt;&gt; url_seeds;
│ │ │ │ -   aux::noexcept_movable&lt;std::vector&lt;tcp::endpoint&gt;&gt; peers;
│ │ │ │ -   aux::noexcept_movable&lt;std::vector&lt;tcp::endpoint&gt;&gt; banned_peers;
│ │ │ │ -   aux::noexcept_movable&lt;std::map&lt;piece_index_t, bitfield&gt;&gt; unfinished_pieces;
│ │ │ │ -   typed_bitfield&lt;piece_index_t&gt; have_pieces;
│ │ │ │ -   typed_bitfield&lt;piece_index_t&gt; verified_pieces;
│ │ │ │ -   aux::noexcept_movable&lt;std::vector&lt;download_priority_t&gt;&gt; piece_priorities;
│ │ │ │ -   aux::vector&lt;std::vector&lt;sha256_hash&gt;, file_index_t&gt; merkle_trees;
│ │ │ │ -   aux::vector&lt;std::vector&lt;bool&gt;, file_index_t&gt; merkle_tree_mask;
│ │ │ │ -   aux::vector&lt;std::vector&lt;bool&gt;, file_index_t&gt; verified_leaf_hashes;
│ │ │ │ -   aux::noexcept_movable&lt;std::map&lt;file_index_t, std::string&gt;&gt; renamed_files;
│ │ │ │ -   std::time_t <strong>last_download</strong>  = 0;
│ │ │ │ -   std::time_t <strong>last_upload</strong>  = 0;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>version</dt>
│ │ │ │ -<dd>filled in by the constructor and should be left untouched. It is used
│ │ │ │ -for forward binary compatibility.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="ti"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bti%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bti%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>ti</dt>
│ │ │ │ -<dd><a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object with the torrent to add. Unless the
│ │ │ │ -info_hash is set, this is required to be initialized.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="trackers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Btrackers%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Btrackers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>trackers</dt>
│ │ │ │ -<dd>If the torrent doesn't have a tracker, but relies on the DHT to find
│ │ │ │ -peers, the <tt class="docutils literal">trackers</tt> can specify tracker URLs for the torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="tracker_tiers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Btracker_tiers%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Btracker_tiers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>tracker_tiers</dt>
│ │ │ │ -<dd>the tiers the URLs in <tt class="docutils literal">trackers</tt> belong to. Trackers belonging to
│ │ │ │ -different tiers may be treated differently, as defined by the multi
│ │ │ │ -tracker extension. This is optional, if not specified trackers are
│ │ │ │ -assumed to be part of tier 0, or whichever the last tier was as
│ │ │ │ -iterating over the trackers.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_nodes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bdht_nodes%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bdht_nodes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>dht_nodes</dt>
│ │ │ │ -<dd>a list of hostname and port pairs, representing DHT nodes to be added
│ │ │ │ -to the <a class="reference external" href="reference-Session.html#session">session</a> (if DHT is enabled). The hostname may be an IP address.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="name"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bname%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bname%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>name</dt>
│ │ │ │ -<dd>in case there's no other name in this torrent, this name will be used.
│ │ │ │ -The name out of the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object takes precedence if available.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="save_path"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bsave_path%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bsave_path%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>save_path</dt>
│ │ │ │ -<dd><p class="first">the path where the torrent is or will be stored.</p>
│ │ │ │ -<div class="admonition note">
│ │ │ │ -<p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">On windows this path (and other paths) are interpreted as UNC
│ │ │ │ -paths. This means they must use backslashes as directory separators
│ │ │ │ -and may not contain the special directories &quot;.&quot; or &quot;..&quot;.</p>
│ │ │ │ -</div>
│ │ │ │ -<p class="last">Setting this to an absolute path performs slightly better than a
│ │ │ │ -relative path.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="storage_mode"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bstorage_mode%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bstorage_mode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>storage_mode</dt>
│ │ │ │ -<dd>One of the values from <a class="reference external" href="reference-Storage.html#storage_mode_t">storage_mode_t</a>. For more information, see
│ │ │ │ -<a class="reference external" href="manual-ref.html#storage-allocation">storage allocation</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="userdata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Buserdata%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Buserdata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>userdata</dt>
│ │ │ │ -<dd>The <tt class="docutils literal">userdata</tt> parameter is optional and will be passed on to the
│ │ │ │ -extension constructor functions, if any
│ │ │ │ -(see <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>). It will also be stored in the
│ │ │ │ -torrent object and can be retrieved by calling <a class="reference external" href="reference-Torrent_Handle.html#userdata()">userdata()</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_priorities"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bfile_priorities%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bfile_priorities%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>file_priorities</dt>
│ │ │ │ -<dd>can be set to control the initial file priorities when adding a
│ │ │ │ -torrent. The semantics are the same as for
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_handle::prioritize_files()</span></tt>. The file priorities specified
│ │ │ │ -in here take precedence over those specified in the resume data, if
│ │ │ │ -any.
│ │ │ │ -If this vector of file priorities is shorter than the number of files
│ │ │ │ -in the torrent, the remaining files (not covered by this) will still
│ │ │ │ -have the default download priority. This default can be changed by
│ │ │ │ -setting the default_dont_download torrent_flag.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="trackerid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Btrackerid%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Btrackerid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>trackerid</dt>
│ │ │ │ -<dd>the default tracker id to be used when announcing to trackers. By
│ │ │ │ -default this is empty, and no tracker ID is used, since this is an
│ │ │ │ -optional argument. If a tracker returns a tracker ID, that ID is used
│ │ │ │ -instead of this.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bflags%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bflags%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>flags</dt>
│ │ │ │ -<dd><p class="first">flags controlling aspects of this torrent and how it's added. See
│ │ │ │ -<a class="reference external" href="reference-Core.html#torrent_flags_t">torrent_flags_t</a> for details.</p>
│ │ │ │ -<div class="admonition note last">
│ │ │ │ -<p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">The <tt class="docutils literal">flags</tt> field is initialized with default flags by the
│ │ │ │ -constructor. In order to preserve default behavior when clearing or
│ │ │ │ -setting other flags, make sure to bitwise OR or in a flag or bitwise
│ │ │ │ -AND the inverse of a flag to clear it.</p>
│ │ │ │ -</div>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>info_hashes</dt>
│ │ │ │ -<dd>set this to the info hash of the torrent to add in case the info-hash
│ │ │ │ -is the only known property of the torrent. i.e. you don't have a
│ │ │ │ -.torrent file nor a magnet link.
│ │ │ │ -To add a magnet link, use <a class="reference external" href="reference-Core.html#parse_magnet_uri()">parse_magnet_uri()</a> to populate fields in the
│ │ │ │ -<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="max_uploads"></a>
│ │ │ │ -<a name="max_connections"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bmax_uploads+max_connections%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bmax_uploads+max_connections%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>max_uploads max_connections</dt>
│ │ │ │ -<dd><p class="first"><tt class="docutils literal">max_uploads</tt>, <tt class="docutils literal">max_connections</tt>, <tt class="docutils literal">upload_limit</tt>,
│ │ │ │ -<tt class="docutils literal">download_limit</tt> correspond to the <tt class="docutils literal">set_max_uploads()</tt>,
│ │ │ │ -<tt class="docutils literal">set_max_connections()</tt>, <tt class="docutils literal">set_upload_limit()</tt> and
│ │ │ │ -<tt class="docutils literal">set_download_limit()</tt> functions on <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>. These values let
│ │ │ │ -you initialize these settings when the torrent is added, instead of
│ │ │ │ -calling these functions immediately following adding it.</p>
│ │ │ │ -<p>-1 means unlimited on these settings just like their counterpart
│ │ │ │ -functions on <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a></p>
│ │ │ │ -<p class="last">For fine grained control over rate limits, including making them apply
│ │ │ │ -to local peers, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="upload_limit"></a>
│ │ │ │ -<a name="download_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bupload_limit+download_limit%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bupload_limit+download_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>upload_limit download_limit</dt>
│ │ │ │ -<dd>the upload and download rate limits for this torrent, specified in
│ │ │ │ -bytes per second. -1 means unlimited.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="total_uploaded"></a>
│ │ │ │ -<a name="total_downloaded"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Btotal_uploaded+total_downloaded%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Btotal_uploaded+total_downloaded%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>total_uploaded total_downloaded</dt>
│ │ │ │ -<dd>the total number of bytes uploaded and downloaded by this torrent so
│ │ │ │ -far.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="active_time"></a>
│ │ │ │ -<a name="finished_time"></a>
│ │ │ │ -<a name="seeding_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bactive_time+finished_time+seeding_time%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bactive_time+finished_time+seeding_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>active_time finished_time seeding_time</dt>
│ │ │ │ -<dd>the number of seconds this torrent has spent in started, finished and
│ │ │ │ -seeding state so far, respectively.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="added_time"></a>
│ │ │ │ -<a name="completed_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Badded_time+completed_time%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Badded_time+completed_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>added_time completed_time</dt>
│ │ │ │ -<dd>if set to a non-zero value, this is the posix time of when this torrent
│ │ │ │ -was first added, including previous runs/sessions. If set to zero, the
│ │ │ │ -internal added_time will be set to the time of when <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> is
│ │ │ │ -called.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="last_seen_complete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Blast_seen_complete%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Blast_seen_complete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>last_seen_complete</dt>
│ │ │ │ -<dd>if set to non-zero, initializes the time (expressed in posix time) when
│ │ │ │ -we last saw a seed or peers that together formed a complete copy of the
│ │ │ │ -torrent. If left set to zero, the internal counterpart to this field
│ │ │ │ -will be updated when we see a seed or a distributed copies &gt;= 1.0.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_complete"></a>
│ │ │ │ -<a name="num_incomplete"></a>
│ │ │ │ -<a name="num_downloaded"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bnum_complete+num_incomplete+num_downloaded%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bnum_complete+num_incomplete+num_downloaded%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_complete num_incomplete num_downloaded</dt>
│ │ │ │ -<dd><p class="first">these field can be used to initialize the torrent's cached scrape data.
│ │ │ │ -The scrape data is high level metadata about the current state of the
│ │ │ │ -swarm, as returned by the tracker (either when announcing to it or by
│ │ │ │ -sending a specific scrape request). <tt class="docutils literal">num_complete</tt> is the number of
│ │ │ │ -peers in the swarm that are seeds, or have every piece in the torrent.
│ │ │ │ -<tt class="docutils literal">num_incomplete</tt> is the number of peers in the swarm that do not have
│ │ │ │ -every piece. <tt class="docutils literal">num_downloaded</tt> is the number of times the torrent has
│ │ │ │ -been downloaded (not initiated, but the number of times a download has
│ │ │ │ -completed).</p>
│ │ │ │ -<p class="last">Leaving any of these values set to -1 indicates we don't know, or we
│ │ │ │ -have not received any scrape data.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="http_seeds"></a>
│ │ │ │ -<a name="url_seeds"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bhttp_seeds+url_seeds%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bhttp_seeds+url_seeds%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>http_seeds url_seeds</dt>
│ │ │ │ -<dd><p class="first">URLs can be added to these two lists to specify additional web
│ │ │ │ -seeds to be used by the torrent. If the <tt class="docutils literal">flag_override_web_seeds</tt>
│ │ │ │ -is set, these will be the _only_ ones to be used. i.e. any web seeds
│ │ │ │ -found in the .torrent file will be overridden.</p>
│ │ │ │ -<p>http_seeds expects URLs to web servers implementing the original HTTP
│ │ │ │ -seed specification <a class="reference external" href="https://www.bittorrent.org/beps/bep_0017.html">BEP 17</a>.</p>
│ │ │ │ -<p class="last">url_seeds expects URLs to regular web servers, aka &quot;get right&quot; style,
│ │ │ │ -specified in <a class="reference external" href="https://www.bittorrent.org/beps/bep_0019.html">BEP 19</a>.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bpeers%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bpeers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>peers</dt>
│ │ │ │ -<dd>peers to add to the torrent, to be tried to be connected to as
│ │ │ │ -bittorrent peers.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="banned_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bbanned_peers%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bbanned_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>banned_peers</dt>
│ │ │ │ -<dd>peers banned from this torrent. The will not be connected to</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="unfinished_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bunfinished_pieces%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bunfinished_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>unfinished_pieces</dt>
│ │ │ │ -<dd>this is a map of partially downloaded piece. The key is the piece index
│ │ │ │ -and the value is a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> where each bit represents a 16 kiB block.
│ │ │ │ -A set bit means we have that block.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="have_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bhave_pieces%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bhave_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>have_pieces</dt>
│ │ │ │ -<dd>this is a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> indicating which pieces we already have of this
│ │ │ │ -torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="verified_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bverified_pieces%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bverified_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>verified_pieces</dt>
│ │ │ │ -<dd>when in seed_mode, pieces with a set bit in this <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> have been
│ │ │ │ -verified to be valid. Other pieces will be verified the first time a
│ │ │ │ -peer requests it.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="piece_priorities"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bpiece_priorities%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bpiece_priorities%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>piece_priorities</dt>
│ │ │ │ -<dd>this sets the priorities for each individual piece in the torrent. Each
│ │ │ │ -element in the vector represent the piece with the same index. If you
│ │ │ │ -set both file- and piece priorities, file priorities will take
│ │ │ │ -precedence.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="merkle_trees"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bmerkle_trees%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bmerkle_trees%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>merkle_trees</dt>
│ │ │ │ -<dd>v2 hashes, if known</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="merkle_tree_mask"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bmerkle_tree_mask%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bmerkle_tree_mask%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>merkle_tree_mask</dt>
│ │ │ │ -<dd>if set, indicates which hashes are included in the corresponding
│ │ │ │ -vector of <tt class="docutils literal">merkle_trees</tt>. These bitmasks always cover the full
│ │ │ │ -tree, a cleared bit means the hash is all zeros (i.e. not set) and
│ │ │ │ -set bit means the next hash in the corresponding vector in
│ │ │ │ -<tt class="docutils literal">merkle_trees</tt> is the hash for that node. This is an optimization
│ │ │ │ -to avoid storing a lot of zeros.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="verified_leaf_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Bverified_leaf_hashes%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Bverified_leaf_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>verified_leaf_hashes</dt>
│ │ │ │ -<dd>bit-fields indicating which v2 leaf hashes have been verified
│ │ │ │ -against the root hash. If this vector is empty and merkle_trees is
│ │ │ │ -non-empty it implies that all hashes in merkle_trees are verified.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="renamed_files"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Brenamed_files%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Brenamed_files%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>renamed_files</dt>
│ │ │ │ -<dd>this is a map of file indices in the torrent and new filenames to be
│ │ │ │ -applied before the torrent is added.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="last_download"></a>
│ │ │ │ -<a name="last_upload"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_params%3A%3A%5Blast_download+last_upload%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_params%3A%3A%5Blast_download+last_upload%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>last_download last_upload</dt>
│ │ │ │ -<dd>the posix time of the last time payload was received or sent for this
│ │ │ │ -torrent, respectively. A value of 0 means we don't know when we last
│ │ │ │ -uploaded or downloaded, or we have never uploaded or downloaded any
│ │ │ │ -payload for this torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="announce_infohash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+announce_infohash&labels=documentation&body=Documentation+under+heading+%22class+announce_infohash%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="announce-infohash">
│ │ │ │ -<h1>announce_infohash</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/announce_entry.hpp">libtorrent/announce_entry.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct announce_infohash
│ │ │ │ -{
│ │ │ │ -   std::string message;
│ │ │ │ -   error_code last_error;
│ │ │ │ -   int <strong>scrape_incomplete</strong>  = -1;
│ │ │ │ -   int <strong>scrape_complete</strong>  = -1;
│ │ │ │ -   int <strong>scrape_downloaded</strong>  = -1;
│ │ │ │ -   std::uint8_t fails : 7;
│ │ │ │ -   bool updating : 1;
│ │ │ │ -   bool start_sent : 1;
│ │ │ │ -   bool complete_sent : 1;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="message"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bmessage%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bmessage%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>message</dt>
│ │ │ │ -<dd>if this tracker has returned an error or warning message
│ │ │ │ -that message is stored here</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="last_error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Blast_error%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Blast_error%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>last_error</dt>
│ │ │ │ -<dd>if this tracker failed the last time it was contacted
│ │ │ │ -this error code specifies what error occurred</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="scrape_incomplete"></a>
│ │ │ │ -<a name="scrape_complete"></a>
│ │ │ │ -<a name="scrape_downloaded"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bscrape_incomplete+scrape_complete+scrape_downloaded%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bscrape_incomplete+scrape_complete+scrape_downloaded%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>scrape_incomplete scrape_complete scrape_downloaded</dt>
│ │ │ │ -<dd>if this tracker has returned scrape data, these fields are filled in
│ │ │ │ -with valid numbers. Otherwise they are set to -1. <tt class="docutils literal">incomplete</tt> counts
│ │ │ │ -the number of current downloaders. <tt class="docutils literal">complete</tt> counts the number of
│ │ │ │ -current peers completed the download, or &quot;seeds&quot;. <tt class="docutils literal">downloaded</tt> is the
│ │ │ │ -cumulative number of completed downloads.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="fails"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bfails%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bfails%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>fails</dt>
│ │ │ │ -<dd>the number of times in a row we have failed to announce to this
│ │ │ │ -tracker.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="updating"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bupdating%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bupdating%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>updating</dt>
│ │ │ │ -<dd>true while we're waiting for a response from the tracker.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="start_sent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bstart_sent%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bstart_sent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>start_sent</dt>
│ │ │ │ -<dd>set to true when we get a valid response from an announce
│ │ │ │ -with event=started. If it is set, we won't send start in the subsequent
│ │ │ │ -announces.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="complete_sent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bcomplete_sent%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bcomplete_sent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>complete_sent</dt>
│ │ │ │ -<dd>set to true when we send a event=completed.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="announce_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+announce_endpoint&labels=documentation&body=Documentation+under+heading+%22class+announce_endpoint%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="announce-endpoint">
│ │ │ │ -<h1>announce_endpoint</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/announce_entry.hpp">libtorrent/announce_entry.hpp</a>&quot;</p>
│ │ │ │ -<p>announces are sent to each tracker using every listen socket
│ │ │ │ -this class holds information about one listen socket for one tracker</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct announce_endpoint
│ │ │ │ -{
│ │ │ │ -   <strong>announce_endpoint</strong> ();
│ │ │ │ -
│ │ │ │ -   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> local_endpoint;
│ │ │ │ -   aux::array&lt;announce_infohash, num_protocols, protocol_version&gt; info_hashes;
│ │ │ │ -   bool <strong>enabled</strong>  = true;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="local_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_endpoint%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22announce_endpoint%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>local_endpoint</dt>
│ │ │ │ -<dd>the local endpoint of the listen interface associated with this endpoint</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_endpoint%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22announce_endpoint%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>info_hashes</dt>
│ │ │ │ -<dd>info_hashes[0] is the v1 info hash (SHA1)
│ │ │ │ -info_hashes[1] is the v2 info hash (truncated SHA-256)</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="enabled"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_endpoint%3A%3A%5Benabled%5D&labels=documentation&body=Documentation+under+heading+%22announce_endpoint%3A%3A%5Benabled%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>enabled</dt>
│ │ │ │ -<dd>set to false to not announce from this endpoint</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="announce_entry"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+announce_entry&labels=documentation&body=Documentation+under+heading+%22class+announce_entry%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="announce-entry">
│ │ │ │ -<h1>announce_entry</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/announce_entry.hpp">libtorrent/announce_entry.hpp</a>&quot;</p>
│ │ │ │ -<p>this class holds information about one bittorrent tracker, as it
│ │ │ │ -relates to a specific torrent.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct announce_entry
│ │ │ │ -{
│ │ │ │ -   <strong>announce_entry</strong> (announce_entry const&amp;);
│ │ │ │ -   announce_entry&amp; <strong>operator=</strong> (announce_entry const&amp;) &amp;;
│ │ │ │ -   <strong>~announce_entry</strong> ();
│ │ │ │ -   <strong>announce_entry</strong> ();
│ │ │ │ -   explicit <strong>announce_entry</strong> (string_view u);
│ │ │ │ -
│ │ │ │ -   enum tracker_source
│ │ │ │ -   {
│ │ │ │ -      source_torrent,
│ │ │ │ -      source_client,
│ │ │ │ -      source_magnet_link,
│ │ │ │ -      source_tex,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   std::string url;
│ │ │ │ -   std::string trackerid;
│ │ │ │ -   std::vector&lt;announce_endpoint&gt; endpoints;
│ │ │ │ -   std::uint8_t <strong>tier</strong>  = 0;
│ │ │ │ -   std::uint8_t <strong>fail_limit</strong>  = 0;
│ │ │ │ -   std::uint8_t source:4;
│ │ │ │ -   bool verified:1;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="operator=()"></a>
│ │ │ │ -<a name="~announce_entry()"></a>
│ │ │ │ -<a name="announce_entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Boperator%3D%28%29+~announce_entry%28%29+announce_entry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Boperator%3D%28%29+~announce_entry%28%29+announce_entry%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-announce-entry-announce-entry">
│ │ │ │ -<h2>operator=() ~announce_entry() announce_entry()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>announce_entry</strong> (announce_entry const&amp;);
│ │ │ │ -announce_entry&amp; <strong>operator=</strong> (announce_entry const&amp;) &amp;;
│ │ │ │ -<strong>~announce_entry</strong> ();
│ │ │ │ -<strong>announce_entry</strong> ();
│ │ │ │ -explicit <strong>announce_entry</strong> (string_view u);
│ │ │ │ -</pre>
│ │ │ │ -<p>constructs a tracker announce <a class="reference external" href="reference-Bencoding.html#entry">entry</a> with <tt class="docutils literal">u</tt> as the URL.</p>
│ │ │ │ -<a name="tracker_source"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+tracker_source&labels=documentation&body=Documentation+under+heading+%22enum+tracker_source%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-tracker-source">
│ │ │ │ -<h2>enum tracker_source</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/announce_entry.hpp">libtorrent/announce_entry.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="20%" />
│ │ │ │ -<col width="7%" />
│ │ │ │ -<col width="74%" />
│ │ │ │ -</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>source_torrent</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>the tracker was part of the .torrent file</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>source_client</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>the tracker was added programmatically via the <a class="reference external" href="reference-Create_Torrents.html#add_tracker()">add_tracker()</a> function</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>source_magnet_link</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>the tracker was part of a magnet link</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>source_tex</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>the tracker was received from the swarm via tracker exchange</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="url"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Burl%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Burl%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>url</dt>
│ │ │ │ -<dd>tracker URL as it appeared in the torrent file</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="trackerid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Btrackerid%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Btrackerid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>trackerid</dt>
│ │ │ │ -<dd>the current <tt class="docutils literal">&amp;trackerid=</tt> argument passed to the tracker.
│ │ │ │ -this is optional and is normally empty (in which case no
│ │ │ │ -trackerid is sent).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="endpoints"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bendpoints%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bendpoints%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>endpoints</dt>
│ │ │ │ -<dd>each local listen socket (endpoint) will announce to the tracker. This
│ │ │ │ -list contains state per endpoint.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="tier"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Btier%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Btier%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>tier</dt>
│ │ │ │ -<dd>the tier this tracker belongs to</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="fail_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bfail_limit%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bfail_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>fail_limit</dt>
│ │ │ │ -<dd>the max number of failures to announce to this tracker in
│ │ │ │ -a row, before this tracker is not used anymore. 0 means unlimited</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="source"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bsource%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bsource%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>source</dt>
│ │ │ │ -<dd>a bitmask specifying which sources we got this tracker from.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="verified"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bverified%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bverified%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>verified</dt>
│ │ │ │ -<dd>set to true the first time we receive a valid response
│ │ │ │ -from this tracker.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<p>The <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> function on <a class="reference external" href="reference-Session.html#session">session</a> is the main interface for retrieving
│ │ │ │ -alerts (warnings, messages and errors from libtorrent). If no alerts have
│ │ │ │ -been posted by libtorrent <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> will return an empty list.</p>
│ │ │ │ -<p>By default, only errors are reported. <a class="reference external" href="reference-Settings.html#alert_mask">settings_pack::alert_mask</a> can be
│ │ │ │ -used to specify which kinds of events should be reported. The <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask is
│ │ │ │ -a combination of the <a class="reference external" href="reference-Alerts.html#alert_category_t">alert_category_t</a> flags in the <a class="reference external" href="reference-Alerts.html#alert">alert</a> class.</p>
│ │ │ │ -<p>Every <a class="reference external" href="reference-Alerts.html#alert">alert</a> belongs to one or more category. There is a cost associated with
│ │ │ │ -posting alerts. Only alerts that belong to an enabled category are
│ │ │ │ -posted. Setting the <a class="reference external" href="reference-Alerts.html#alert">alert</a> bitmask to 0 will disable all alerts (except those
│ │ │ │ -that are non-discardable). Alerts that are responses to API calls such as
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> and <a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a> are non-discardable and will be
│ │ │ │ -posted even if their category is disabled.</p>
│ │ │ │ -<p>There are other <a class="reference external" href="reference-Alerts.html#alert">alert</a> base classes that some alerts derive from, all the
│ │ │ │ -alerts that are generated for a specific torrent are derived from
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a>, and tracker events derive from <a class="reference external" href="reference-Alerts.html#tracker_alert">tracker_alert</a>.</p>
│ │ │ │ -<p>Alerts returned by <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> are only valid until the next call to
│ │ │ │ -<a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a>. You may not copy an <a class="reference external" href="reference-Alerts.html#alert">alert</a> object to access it after the next
│ │ │ │ -call to <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a>. Internal members of alerts also become invalid once
│ │ │ │ -<a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> is called again.</p>
│ │ │ │ -<a name="alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+alert&labels=documentation&body=Documentation+under+heading+%22class+alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="alert">
│ │ │ │ -<h1>alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
│ │ │ │ -<p>The <tt class="docutils literal">alert</tt> class is the base class that specific messages are derived from.
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#alert">alert</a> types are not copyable, and cannot be constructed by the client. The
│ │ │ │ -pointers returned by libtorrent are short lived (the details are described
│ │ │ │ -under <a class="reference external" href="reference-Session.html#pop_alerts()">session_handle::pop_alerts()</a>)</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct alert
│ │ │ │ -{
│ │ │ │ -   time_point <strong>timestamp</strong> () const;
│ │ │ │ -   virtual int <strong>type</strong> () const noexcept = 0;
│ │ │ │ -   virtual char const* <strong>what</strong> () const noexcept = 0;
│ │ │ │ -   virtual std::string <strong>message</strong> () const = 0;
│ │ │ │ -   virtual alert_category_t <strong>category</strong> () const noexcept = 0;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>error_notification</strong>  = 0_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>peer_notification</strong>  = 1_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>port_mapping_notification</strong>  = 2_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>storage_notification</strong>  = 3_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>tracker_notification</strong>  = 4_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>connect_notification</strong>  = 5_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>status_notification</strong>  = 6_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>ip_block_notification</strong>  = 8_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>performance_warning</strong>  = 9_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>dht_notification</strong>  = 10_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>session_log_notification</strong>  = 13_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>torrent_log_notification</strong>  = 14_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>peer_log_notification</strong>  = 15_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>incoming_request_notification</strong>  = 16_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>dht_log_notification</strong>  = 17_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>dht_operation_notification</strong>  = 18_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>port_mapping_log_notification</strong>  = 19_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>picker_log_notification</strong>  = 20_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>file_progress_notification</strong>  = 21_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>piece_progress_notification</strong>  = 22_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>upload_notification</strong>  = 23_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>block_progress_notification</strong>  = 24_bit;
│ │ │ │ -   static constexpr alert_category_t <strong>all_categories</strong>  = alert_category_t::all();
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="timestamp()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Btimestamp%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Btimestamp%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="timestamp">
│ │ │ │ -<h2>timestamp()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -time_point <strong>timestamp</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>a timestamp is automatically created in the constructor</p>
│ │ │ │ -<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="type">
│ │ │ │ -<h2>type()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual int <strong>type</strong> () const noexcept = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns an integer that is unique to this <a class="reference external" href="reference-Alerts.html#alert">alert</a> type. It can be
│ │ │ │ -compared against a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> by querying a static constant called <tt class="docutils literal">alert_type</tt>
│ │ │ │ -in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>. It can be used to determine the run-time type of an alert* in
│ │ │ │ -order to cast to that <a class="reference external" href="reference-Alerts.html#alert">alert</a> type and access specific members.</p>
│ │ │ │ -<p>e.g:</p>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">alert</span><span class="operator">*&gt;</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">pop_alerts</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">alerts</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">alert</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">a</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -        </span><span class="keyword">switch</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">a</span><span class="operator">-&gt;</span><span class="name">type</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -
│ │ │ │ -                </span><span class="keyword">case</span><span class="whitespace"> </span><span class="name constant">read_piece_alert</span><span class="operator">::</span><span class="name constant">alert_type</span><span class="punctuation">:</span><span class="whitespace">
│ │ │ │ -                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -                        </span><span class="keyword">auto</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">p</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="name">read_piece_alert</span><span class="operator">*&gt;</span><span class="punctuation">(</span><span class="name">a</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -                        </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">p</span><span class="operator">-&gt;</span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -                                </span><span class="comment single">// read_piece failed
│ │ │ │ -</span><span class="whitespace">                                </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -                        </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ -                        </span><span class="comment single">// use p
│ │ │ │ -</span><span class="whitespace">                        </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ -                </span><span class="keyword">case</span><span class="whitespace"> </span><span class="name constant">file_renamed_alert</span><span class="operator">::</span><span class="name constant">alert_type</span><span class="punctuation">:</span><span class="whitespace">
│ │ │ │ -                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -                        </span><span class="comment single">// etc...
│ │ │ │ -</span><span class="whitespace">                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ -        </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ -</span><span class="punctuation">}</span>
│ │ │ │ -</pre>
│ │ │ │ -<a name="what()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bwhat%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bwhat%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="what">
│ │ │ │ -<h2>what()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual char const* <strong>what</strong> () const noexcept = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a string literal describing the type of the <a class="reference external" href="reference-Alerts.html#alert">alert</a>. It does
│ │ │ │ -not include any information that might be bundled with the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ -<a name="message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bmessage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bmessage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="message">
│ │ │ │ -<h2>message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual std::string <strong>message</strong> () const = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>generate a string describing the <a class="reference external" href="reference-Alerts.html#alert">alert</a> and the information bundled
│ │ │ │ -with it. This is mainly intended for debug and development use. It is not suitable
│ │ │ │ -to use this for applications that may be localized. Instead, handle each <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -type individually and extract and render the information from the <a class="reference external" href="reference-Alerts.html#alert">alert</a> depending
│ │ │ │ -on the locale.</p>
│ │ │ │ -<a name="category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bcategory%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bcategory%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="category">
│ │ │ │ -<h2>category()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual alert_category_t <strong>category</strong> () const noexcept = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a bitmask specifying which categories this <a class="reference external" href="reference-Alerts.html#alert">alert</a> belong to.</p>
│ │ │ │ -<a name="dht_routing_bucket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_routing_bucket&labels=documentation&body=Documentation+under+heading+%22class+dht_routing_bucket%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="dht-routing-bucket">
│ │ │ │ -<h1>dht_routing_bucket</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>struct to hold information about a single DHT routing table bucket</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_routing_bucket
│ │ │ │ -{
│ │ │ │ -   int num_nodes;
│ │ │ │ -   int num_replacements;
│ │ │ │ -   int last_active;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="num_nodes"></a>
│ │ │ │ -<a name="num_replacements"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_routing_bucket%3A%3A%5Bnum_nodes+num_replacements%5D&labels=documentation&body=Documentation+under+heading+%22dht_routing_bucket%3A%3A%5Bnum_nodes+num_replacements%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_nodes num_replacements</dt>
│ │ │ │ -<dd>the total number of nodes and replacement nodes
│ │ │ │ -in the routing table</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="last_active"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_routing_bucket%3A%3A%5Blast_active%5D&labels=documentation&body=Documentation+under+heading+%22dht_routing_bucket%3A%3A%5Blast_active%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>last_active</dt>
│ │ │ │ -<dd>number of seconds since last activity</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-alert">
│ │ │ │ -<h1>torrent_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This is a base class for alerts that are associated with a
│ │ │ │ -specific torrent. It contains a handle to the torrent.</p>
│ │ │ │ -<p>Note that by the time the client receives a <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a>, its
│ │ │ │ -<tt class="docutils literal">handle</tt> member may be invalid.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_alert : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>torrent_name</strong> () const;
│ │ │ │ -
│ │ │ │ -   torrent_handle handle;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_alert%3A%3A%5Bmessage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_alert%3A%3A%5Bmessage%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="message-1">
│ │ │ │ -<h2>message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::string <strong>message</strong> () const override;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the message associated with this <a class="reference external" href="reference-Alerts.html#alert">alert</a></p>
│ │ │ │ -<a name="handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_alert%3A%3A%5Bhandle%5D&labels=documentation&body=Documentation+under+heading+%22torrent_alert%3A%3A%5Bhandle%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>handle</dt>
│ │ │ │ -<dd>The <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> pointing to the torrent this
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#alert">alert</a> is associated with.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="peer_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="peer-alert">
│ │ │ │ -<h1>peer_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>The peer <a class="reference external" href="reference-Alerts.html#alert">alert</a> is a base class for alerts that refer to a specific peer. It includes all
│ │ │ │ -the information to identify the peer. i.e. <tt class="docutils literal">ip</tt> and <tt class="docutils literal"><span class="pre">peer-id</span></tt>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_alert : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; endpoint;
│ │ │ │ -   peer_id pid;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22peer_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>endpoint</dt>
│ │ │ │ -<dd>The peer's IP address and port.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_alert%3A%3A%5Bpid%5D&labels=documentation&body=Documentation+under+heading+%22peer_alert%3A%3A%5Bpid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>pid</dt>
│ │ │ │ -<dd>the peer ID, if known.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="tracker_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="tracker-alert">
│ │ │ │ -<h1>tracker_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This is a base class used for alerts that are associated with a
│ │ │ │ -specific tracker. It derives from <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a> since a tracker
│ │ │ │ -is also associated with a specific torrent.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct tracker_alert : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>tracker_url</strong> () const;
│ │ │ │ -
│ │ │ │ -   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; local_endpoint;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="tracker_url()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_alert%3A%3A%5Btracker_url%28%29%5D&labels=documentation&body=Documentation+under+heading+%22tracker_alert%3A%3A%5Btracker_url%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="tracker-url">
│ │ │ │ -<h2>tracker_url()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>tracker_url</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a 0-terminated string of the tracker's URL</p>
│ │ │ │ -<a name="local_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_alert%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22tracker_alert%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>local_endpoint</dt>
│ │ │ │ -<dd>endpoint of the listen interface being announced</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_removed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_removed_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_removed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="torrent-removed-alert">
│ │ │ │ -<h1>torrent_removed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>The <tt class="docutils literal">torrent_removed_alert</tt> is posted whenever a torrent is removed. Since
│ │ │ │ -the torrent handle in its base class will usually be invalid (since the torrent
│ │ │ │ -is already removed) it has the info hash as a member, to identify it.
│ │ │ │ -It's posted when the <tt class="docutils literal"><span class="pre">alert_category::status</span></tt> bit is set in the alert_mask.</p>
│ │ │ │ -<p>Note that the <tt class="docutils literal">handle</tt> remains valid for some time after
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a> is posted, as long as some internal libtorrent
│ │ │ │ -task (such as an I/O task) refers to it. Additionally, other alerts like
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a> may be posted after <a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a>.
│ │ │ │ -To synchronize on whether the torrent has been removed or not, call
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#in_session()">torrent_handle::in_session()</a>. This will return true before
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a> is posted, and false afterward.</p>
│ │ │ │ -<p>Even though the <tt class="docutils literal">handle</tt> member doesn't point to an existing torrent anymore,
│ │ │ │ -it is still useful for comparing to other handles, which may also no
│ │ │ │ -longer point to existing torrents, but to the same non-existing torrents.</p>
│ │ │ │ -<p>The <tt class="docutils literal">torrent_handle</tt> acts as a <tt class="docutils literal">weak_ptr</tt>, even though its object no
│ │ │ │ -longer exists, it can still compare equal to another weak pointer which
│ │ │ │ -points to the same non-existent object.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_removed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -   info_hash_t info_hashes;
│ │ │ │ -   client_data_t userdata;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="userdata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_removed_alert%3A%3A%5Buserdata%5D&labels=documentation&body=Documentation+under+heading+%22torrent_removed_alert%3A%3A%5Buserdata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>userdata</dt>
│ │ │ │ -<dd>'<cite>userdata`</cite> as set in <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> at torrent creation.
│ │ │ │ -This can be used to associate this torrent with related data
│ │ │ │ -in the client application more efficiently than info_hashes.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="read_piece_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+read_piece_alert&labels=documentation&body=Documentation+under+heading+%22class+read_piece_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="read-piece-alert">
│ │ │ │ -<h1>read_piece_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the asynchronous read operation initiated by
│ │ │ │ -a call to <a class="reference external" href="reference-Torrent_Handle.html#read_piece()">torrent_handle::read_piece()</a> is completed. If the read failed, the torrent
│ │ │ │ -is paused and an error state is set and the buffer member of the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -is 0. If successful, <tt class="docutils literal">buffer</tt> points to a buffer containing all the data
│ │ │ │ -of the piece. <tt class="docutils literal">piece</tt> is the piece index that was read. <tt class="docutils literal">size</tt> is the
│ │ │ │ -number of bytes that was read.</p>
│ │ │ │ -<p>If the operation fails, <tt class="docutils literal">error</tt> will indicate what went wrong.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct read_piece_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ -   error_code const error;
│ │ │ │ -   boost::shared_array&lt;char&gt; const buffer;
│ │ │ │ -   piece_index_t const piece;
│ │ │ │ -   int const size;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="file_completed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_completed_alert&labels=documentation&body=Documentation+under+heading+%22class+file_completed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-completed-alert">
│ │ │ │ -<h1>file_completed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This is posted whenever an individual file completes its download. i.e.
│ │ │ │ -All pieces overlapping this file have passed their hash check.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct file_completed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   file_index_t const index;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_completed_alert%3A%3A%5Bindex%5D&labels=documentation&body=Documentation+under+heading+%22file_completed_alert%3A%3A%5Bindex%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>index</dt>
│ │ │ │ -<dd>refers to the index of the file that completed.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_renamed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_renamed_alert&labels=documentation&body=Documentation+under+heading+%22class+file_renamed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-renamed-alert">
│ │ │ │ -<h1>file_renamed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This is posted as a response to a <a class="reference external" href="reference-Torrent_Handle.html#rename_file()">torrent_handle::rename_file()</a> call, if the rename
│ │ │ │ -operation succeeds.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct file_renamed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>new_name</strong> () const;
│ │ │ │ -   char const* <strong>old_name</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ -   file_index_t const index;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="new_name()"></a>
│ │ │ │ -<a name="old_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_renamed_alert%3A%3A%5Bnew_name%28%29+old_name%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_renamed_alert%3A%3A%5Bnew_name%28%29+old_name%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="new-name-old-name">
│ │ │ │ -<h2>new_name() old_name()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>new_name</strong> () const;
│ │ │ │ -char const* <strong>old_name</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the new and previous file name, respectively.</p>
│ │ │ │ -<a name="index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_renamed_alert%3A%3A%5Bindex%5D&labels=documentation&body=Documentation+under+heading+%22file_renamed_alert%3A%3A%5Bindex%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>index</dt>
│ │ │ │ -<dd>refers to the index of the file that was renamed,</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_rename_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_rename_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+file_rename_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="file-rename-failed-alert">
│ │ │ │ -<h1>file_rename_failed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This is posted as a response to a <a class="reference external" href="reference-Torrent_Handle.html#rename_file()">torrent_handle::rename_file()</a> call, if the rename
│ │ │ │ -operation failed.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct file_rename_failed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ -   file_index_t const index;
│ │ │ │ -   error_code const error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="index"></a>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_rename_failed_alert%3A%3A%5Bindex+error%5D&labels=documentation&body=Documentation+under+heading+%22file_rename_failed_alert%3A%3A%5Bindex+error%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>index error</dt>
│ │ │ │ -<dd>refers to the index of the file that was supposed to be renamed,
│ │ │ │ -<tt class="docutils literal">error</tt> is the error code returned from the filesystem.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="performance_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+performance_alert&labels=documentation&body=Documentation+under+heading+%22class+performance_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="performance-alert">
│ │ │ │ -<h1>performance_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a limit is reached that might have a negative impact on
│ │ │ │ -upload or download rate performance.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct performance_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   enum performance_warning_t
│ │ │ │ -   {
│ │ │ │ -      outstanding_disk_buffer_limit_reached,
│ │ │ │ -      outstanding_request_limit_reached,
│ │ │ │ -      upload_limit_too_low,
│ │ │ │ -      download_limit_too_low,
│ │ │ │ -      send_buffer_watermark_too_low,
│ │ │ │ -      too_many_optimistic_unchoke_slots,
│ │ │ │ -      too_high_disk_queue_limit,
│ │ │ │ -      aio_limit_reached,
│ │ │ │ -      deprecated_bittyrant_with_no_uplimit,
│ │ │ │ -      too_few_outgoing_ports,
│ │ │ │ -      too_few_file_descriptors,
│ │ │ │ -      num_warnings,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::performance_warning;
│ │ │ │ -   performance_warning_t const warning_code;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="performance_warning_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+performance_warning_t&labels=documentation&body=Documentation+under+heading+%22enum+performance_warning_t%22+could+be+improved">report issue</a>]</span><div class="section" id="enum-performance-warning-t">
│ │ │ │ -<h2>enum performance_warning_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="27%" />
│ │ │ │ -<col width="5%" />
│ │ │ │ -<col width="68%" />
│ │ │ │ -</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>outstanding_disk_buffer_limit_reached</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>This warning means that the number of bytes queued to be written to disk
│ │ │ │ -exceeds the max disk byte queue setting (<tt class="docutils literal"><span class="pre">settings_pack::max_queued_disk_bytes</span></tt>).
│ │ │ │ -This might restrict the download rate, by not queuing up enough write jobs
│ │ │ │ -to the disk I/O thread. When this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted, peer connections are
│ │ │ │ -temporarily stopped from downloading, until the queued disk bytes have fallen
│ │ │ │ -below the limit again. Unless your <tt class="docutils literal">max_queued_disk_bytes</tt> setting is already
│ │ │ │ -high, you might want to increase it to get better performance.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>outstanding_request_limit_reached</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>This is posted when libtorrent would like to send more requests to a peer,
│ │ │ │ -but it's limited by <tt class="docutils literal"><span class="pre">settings_pack::max_out_request_queue</span></tt>. The queue length
│ │ │ │ -libtorrent is trying to achieve is determined by the download rate and the
│ │ │ │ -assumed round-trip-time (<tt class="docutils literal"><span class="pre">settings_pack::request_queue_time</span></tt>). The assumed
│ │ │ │ -round-trip-time is not limited to just the network RTT, but also the remote disk
│ │ │ │ -access time and message handling time. It defaults to 3 seconds. The target number
│ │ │ │ -of outstanding requests is set to fill the bandwidth-delay product (assumed RTT
│ │ │ │ -times download rate divided by number of bytes per request). When this <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -is posted, there is a risk that the number of outstanding requests is too low
│ │ │ │ -and limits the download rate. You might want to increase the <tt class="docutils literal">max_out_request_queue</tt>
│ │ │ │ -setting.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>upload_limit_too_low</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>This warning is posted when the amount of TCP/IP overhead is greater than the
│ │ │ │ -upload rate limit. When this happens, the TCP/IP overhead is caused by a much
│ │ │ │ -faster download rate, triggering TCP ACK packets. These packets eat into the
│ │ │ │ -rate limit specified to libtorrent. When the overhead traffic is greater than
│ │ │ │ -the rate limit, libtorrent will not be able to send any actual payload, such
│ │ │ │ -as piece requests. This means the download rate will suffer, and new requests
│ │ │ │ -can be sent again. There will be an equilibrium where the download rate, on
│ │ │ │ -average, is about 20 times the upload rate limit. If you want to maximize the
│ │ │ │ -download rate, increase the upload rate limit above 5% of your download capacity.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>download_limit_too_low</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>This is the same warning as <tt class="docutils literal">upload_limit_too_low</tt> but referring to the download
│ │ │ │ -limit instead of upload. This suggests that your download rate limit is much lower
│ │ │ │ -than your upload capacity. Your upload rate will suffer. To maximize upload rate,
│ │ │ │ -make sure your download rate limit is above 5% of your upload capacity.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>send_buffer_watermark_too_low</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td><p class="first">We're stalled on the disk. We want to write to the socket, and we can write
│ │ │ │ -but our send buffer is empty, waiting to be refilled from the disk.
│ │ │ │ -This either means the disk is slower than the network connection
│ │ │ │ -or that our send buffer watermark is too small, because we can
│ │ │ │ -send it all before the disk gets back to us.
│ │ │ │ -The number of bytes that we keep outstanding, requested from the disk, is calculated
│ │ │ │ -as follows:</p>
│ │ │ │ -<pre class="code C++ literal-block">
│ │ │ │ -<span class="name">min</span><span class="punctuation">(</span><span class="literal number integer">512</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">max</span><span class="punctuation">(</span><span class="name">upload_rate</span><span class="whitespace"> </span><span class="operator">*</span><span class="whitespace"> </span><span class="name">send_buffer_watermark_factor</span><span class="whitespace"> </span><span class="operator">/</span><span class="whitespace"> </span><span class="literal number integer">100</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">send_buffer_watermark</span><span class="punctuation">))</span>
│ │ │ │ -</pre>
│ │ │ │ -<p class="last">If you receive this <a class="reference external" href="reference-Alerts.html#alert">alert</a>, you might want to either increase your <tt class="docutils literal">send_buffer_watermark</tt>
│ │ │ │ -or <tt class="docutils literal">send_buffer_watermark_factor</tt>.</p>
│ │ │ │ -</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>too_many_optimistic_unchoke_slots</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>If the half (or more) of all upload slots are set as optimistic unchoke slots, this
│ │ │ │ -warning is issued. You probably want more regular (rate based) unchoke slots.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>too_high_disk_queue_limit</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>If the disk write queue ever grows larger than half of the cache size, this warning
│ │ │ │ -is posted. The disk write queue eats into the total disk cache and leaves very little
│ │ │ │ -left for the actual cache. This causes the disk cache to oscillate in evicting large
│ │ │ │ -portions of the cache before allowing peers to download any more, onto the disk write
│ │ │ │ -queue. Either lower <tt class="docutils literal">max_queued_disk_bytes</tt> or increase <tt class="docutils literal">cache_size</tt>.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>aio_limit_reached</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>deprecated_bittyrant_with_no_uplimit</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>too_few_outgoing_ports</td>
│ │ │ │ -<td>9</td>
│ │ │ │ -<td>This is generated if outgoing peer connections are failing because of <em>address in use</em>
│ │ │ │ -errors, indicating that <tt class="docutils literal"><span class="pre">settings_pack::outgoing_ports</span></tt> is set and is too small of
│ │ │ │ -a range. Consider not using the <tt class="docutils literal">outgoing_ports</tt> setting at all, or widen the range to
│ │ │ │ -include more ports.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>too_few_file_descriptors</td>
│ │ │ │ -<td>10</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>num_warnings</td>
│ │ │ │ -<td>11</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="state_changed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+state_changed_alert&labels=documentation&body=Documentation+under+heading+%22class+state_changed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="state-changed-alert">
│ │ │ │ -<h1>state_changed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>Generated whenever a torrent changes its state.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct state_changed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -   torrent_status::state_t const state;
│ │ │ │ -   torrent_status::state_t const prev_state;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:state_changed_alert%3A%3A%5Bstate%5D&labels=documentation&body=Documentation+under+heading+%22state_changed_alert%3A%3A%5Bstate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>state</dt>
│ │ │ │ -<dd>the new state of the torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="prev_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:state_changed_alert%3A%3A%5Bprev_state%5D&labels=documentation&body=Documentation+under+heading+%22state_changed_alert%3A%3A%5Bprev_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>prev_state</dt>
│ │ │ │ -<dd>the previous state.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="tracker_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_error_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="tracker-error-alert">
│ │ │ │ -<h1>tracker_error_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated on tracker time outs, premature disconnects,
│ │ │ │ -invalid response or a HTTP response other than &quot;200 OK&quot;. From the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -you can get the handle to the torrent the tracker belongs to.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct tracker_error_alert final : tracker_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>failure_reason</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker | alert_category::error;
│ │ │ │ -   int const times_in_row;
│ │ │ │ -   error_code const error;
│ │ │ │ -   operation_t op;
│ │ │ │ -   protocol_version version;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="failure_reason()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Bfailure_reason%28%29%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Bfailure_reason%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="failure-reason">
│ │ │ │ -<h2>failure_reason()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>failure_reason</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>if the tracker sent a &quot;failure reason&quot; string, it will be returned
│ │ │ │ -here.</p>
│ │ │ │ -<a name="times_in_row"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Btimes_in_row%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Btimes_in_row%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>times_in_row</dt>
│ │ │ │ -<dd>This member says how many times in a row this tracker has failed.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error code indicating why the tracker announce failed. If it is
│ │ │ │ -is <tt class="docutils literal"><span class="pre">lt::errors::tracker_failure</span></tt> the <a class="reference external" href="reference-Alerts.html#failure_reason()">failure_reason()</a> might contain
│ │ │ │ -a more detailed description of why the tracker rejected the request.
│ │ │ │ -HTTP status codes indicating errors are also set in this field.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>version</dt>
│ │ │ │ -<dd>the bittorrent protocol version that was announced</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="tracker_warning_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_warning_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_warning_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="tracker-warning-alert">
│ │ │ │ -<h1>tracker_warning_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is triggered if the tracker reply contains a warning field.
│ │ │ │ -Usually this means that the tracker announce was successful, but the
│ │ │ │ -tracker has a message to the client.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct tracker_warning_alert final : tracker_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>warning_message</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker | alert_category::error;
│ │ │ │ -   protocol_version version;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="warning_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_warning_alert%3A%3A%5Bwarning_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22tracker_warning_alert%3A%3A%5Bwarning_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="warning-message">
│ │ │ │ -<h2>warning_message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>warning_message</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>the message associated with this warning</p>
│ │ │ │ -<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_warning_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_warning_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>version</dt>
│ │ │ │ -<dd>the bittorrent protocol version that was announced</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="scrape_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+scrape_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+scrape_reply_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="scrape-reply-alert">
│ │ │ │ -<h1>scrape_reply_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a scrape request succeeds.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct scrape_reply_alert final : tracker_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker;
│ │ │ │ -   int const incomplete;
│ │ │ │ -   int const complete;
│ │ │ │ -   protocol_version version;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="incomplete"></a>
│ │ │ │ -<a name="complete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_reply_alert%3A%3A%5Bincomplete+complete%5D&labels=documentation&body=Documentation+under+heading+%22scrape_reply_alert%3A%3A%5Bincomplete+complete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>incomplete complete</dt>
│ │ │ │ -<dd>the data returned in the scrape response. These numbers
│ │ │ │ -may be -1 if the response was malformed.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_reply_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22scrape_reply_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>version</dt>
│ │ │ │ -<dd>the bittorrent protocol version that was scraped</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="scrape_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+scrape_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+scrape_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="scrape-failed-alert">
│ │ │ │ -<h1>scrape_failed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>If a scrape request fails, this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated. This might be due
│ │ │ │ -to the tracker timing out, refusing connection or returning an http response
│ │ │ │ -code indicating an error.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct scrape_failed_alert final : tracker_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>error_message</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker | alert_category::error;
│ │ │ │ -   error_code const error;
│ │ │ │ -   protocol_version version;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="error_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_failed_alert%3A%3A%5Berror_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22scrape_failed_alert%3A%3A%5Berror_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="error-message">
│ │ │ │ -<h2>error_message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>error_message</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>if the error indicates there is an associated message, this returns
│ │ │ │ -that message. Otherwise and empty string.</p>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22scrape_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error itself. This may indicate that the tracker sent an error
│ │ │ │ -message (<tt class="docutils literal"><span class="pre">error::tracker_failure</span></tt>), in which case it can be
│ │ │ │ -retrieved by calling <tt class="docutils literal">error_message()</tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_failed_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22scrape_failed_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>version</dt>
│ │ │ │ -<dd>the bittorrent protocol version that was scraped</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="tracker_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_reply_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="tracker-reply-alert">
│ │ │ │ -<h1>tracker_reply_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only for informational purpose. It is generated when a tracker announce
│ │ │ │ -succeeds. It is generated regardless what kind of tracker was used, be it UDP, HTTP or
│ │ │ │ -the DHT.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct tracker_reply_alert final : tracker_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker;
│ │ │ │ -   int const num_peers;
│ │ │ │ -   protocol_version version;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="num_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_reply_alert%3A%3A%5Bnum_peers%5D&labels=documentation&body=Documentation+under+heading+%22tracker_reply_alert%3A%3A%5Bnum_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_peers</dt>
│ │ │ │ -<dd>tells how many peers the tracker returned in this response. This is
│ │ │ │ -not expected to be greater than the <tt class="docutils literal">num_want</tt> settings. These are not necessarily
│ │ │ │ -all new peers, some of them may already be connected.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_reply_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_reply_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>version</dt>
│ │ │ │ -<dd>the bittorrent protocol version that was announced</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_reply_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-reply-alert">
│ │ │ │ -<h1>dht_reply_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated each time the DHT receives peers from a node. <tt class="docutils literal">num_peers</tt>
│ │ │ │ -is the number of peers we received in this packet. Typically these packets are
│ │ │ │ -received from multiple DHT nodes, and so the alerts are typically generated
│ │ │ │ -a few at a time.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_reply_alert final : tracker_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht | alert_category::tracker;
│ │ │ │ -   int const num_peers;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="tracker_announce_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_announce_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_announce_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="tracker-announce-alert">
│ │ │ │ -<h1>tracker_announce_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated each time a tracker announce is sent (or attempted to be sent).
│ │ │ │ -There are no extra data members in this <a class="reference external" href="reference-Alerts.html#alert">alert</a>. The url can be found in the base class
│ │ │ │ -however.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct tracker_announce_alert final : tracker_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker;
│ │ │ │ -   event_t const event;
│ │ │ │ -   protocol_version version;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="event"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_announce_alert%3A%3A%5Bevent%5D&labels=documentation&body=Documentation+under+heading+%22tracker_announce_alert%3A%3A%5Bevent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>event</dt>
│ │ │ │ -<dd>specifies what event was sent to the tracker. See <a class="reference external" href="reference-Core.html#event_t">event_t</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_announce_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_announce_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>version</dt>
│ │ │ │ -<dd>the bittorrent protocol version that is announced</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="hash_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+hash_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+hash_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="hash-failed-alert">
│ │ │ │ -<h1>hash_failed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a finished piece fails its hash check. You can get the handle
│ │ │ │ -to the torrent which got the failed piece and the index of the piece itself from the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct hash_failed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -   piece_index_t const piece_index;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="peer_ban_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_ban_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_ban_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="peer-ban-alert">
│ │ │ │ -<h1>peer_ban_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is banned because it has sent too many corrupt pieces
│ │ │ │ -to us. <tt class="docutils literal">ip</tt> is the endpoint to the peer that was banned.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_ban_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="peer_unsnubbed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_unsnubbed_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_unsnubbed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="peer-unsnubbed-alert">
│ │ │ │ -<h1>peer_unsnubbed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is un-snubbed. Essentially when it was snubbed for stalling
│ │ │ │ -sending data, and now it started sending data again.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_unsnubbed_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="peer_snubbed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_snubbed_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_snubbed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="peer-snubbed-alert">
│ │ │ │ -<h1>peer_snubbed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is snubbed, when it stops sending data when we request
│ │ │ │ -it.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_snubbed_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="peer_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_error_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="peer-error-alert">
│ │ │ │ -<h1>peer_error_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer sends invalid data over the peer-peer protocol. The peer
│ │ │ │ -will be disconnected, but you get its ip address from the <a class="reference external" href="reference-Alerts.html#alert">alert</a>, to identify it.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_error_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ -   operation_t op;
│ │ │ │ -   error_code const error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_error_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22peer_error_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>op</dt>
│ │ │ │ -<dd>a 0-terminated string of the low-level operation that failed, or nullptr if
│ │ │ │ -there was no low level disk operation.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22peer_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>tells you what error caused this <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="peer_connect_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_connect_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_connect_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="peer-connect-alert">
│ │ │ │ -<h1>peer_connect_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time an incoming peer connection both
│ │ │ │ -successfully passes the protocol handshake and is associated with a
│ │ │ │ -torrent, or an outgoing peer connection attempt succeeds. For arbitrary
│ │ │ │ -incoming connections, see <a class="reference external" href="reference-Alerts.html#incoming_connection_alert">incoming_connection_alert</a>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_connect_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   enum direction_t
│ │ │ │ -   {
│ │ │ │ -      in,
│ │ │ │ -      out,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::connect;
│ │ │ │ -   direction_t direction;
│ │ │ │ -   socket_type_t socket_type;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="direction_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+direction_t&labels=documentation&body=Documentation+under+heading+%22enum+direction_t%22+could+be+improved">report issue</a>]</span><div class="section" id="enum-direction-t">
│ │ │ │ -<h2>enum direction_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="23%" />
│ │ │ │ -<col width="27%" />
│ │ │ │ -<col width="50%" />
│ │ │ │ -</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>in</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>out</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="direction"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_connect_alert%3A%3A%5Bdirection%5D&labels=documentation&body=Documentation+under+heading+%22peer_connect_alert%3A%3A%5Bdirection%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>direction</dt>
│ │ │ │ -<dd>Tells you if the peer was incoming or outgoing</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="peer_disconnected_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_disconnected_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_disconnected_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="peer-disconnected-alert">
│ │ │ │ -<h1>peer_disconnected_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is disconnected for any reason (other than the ones
│ │ │ │ -covered by <a class="reference external" href="reference-Alerts.html#peer_error_alert">peer_error_alert</a> ).</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_disconnected_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::connect;
│ │ │ │ -   socket_type_t const socket_type;
│ │ │ │ -   operation_t const op;
│ │ │ │ -   error_code const error;
│ │ │ │ -   close_reason_t const reason;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>socket_type</dt>
│ │ │ │ -<dd>the kind of socket this peer was connected over</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>op</dt>
│ │ │ │ -<dd>the operation or level where the error occurred. Specified as an
│ │ │ │ -value from the <a class="reference external" href="reference-Alerts.html#operation_t">operation_t</a> enum. Defined in operations.hpp.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>tells you what error caused peer to disconnect.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="reason"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Breason%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Breason%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>reason</dt>
│ │ │ │ -<dd>the reason the peer disconnected (if specified)</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="invalid_request_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+invalid_request_alert&labels=documentation&body=Documentation+under+heading+%22class+invalid_request_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="invalid-request-alert">
│ │ │ │ -<h1>invalid_request_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This is a debug <a class="reference external" href="reference-Alerts.html#alert">alert</a> that is generated by an incoming invalid piece request.
│ │ │ │ -<tt class="docutils literal">ip</tt> is the address of the peer and the <tt class="docutils literal">request</tt> is the actual incoming
│ │ │ │ -request from the peer. See <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> for more info.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct invalid_request_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ -   peer_request const request;
│ │ │ │ -   bool const we_have;
│ │ │ │ -   bool const peer_interested;
│ │ │ │ -   bool const withheld;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="request"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Brequest%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Brequest%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>request</dt>
│ │ │ │ -<dd>the request we received from the peer</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="we_have"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Bwe_have%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Bwe_have%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>we_have</dt>
│ │ │ │ -<dd>true if we have this piece</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="peer_interested"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Bpeer_interested%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Bpeer_interested%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>peer_interested</dt>
│ │ │ │ -<dd>true if the peer indicated that it was interested to download before
│ │ │ │ -sending the request</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="withheld"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Bwithheld%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Bwithheld%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>withheld</dt>
│ │ │ │ -<dd>if this is true, the peer is not allowed to download this piece because
│ │ │ │ -of super-seeding rules.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_finished_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_finished_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_finished_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-finished-alert">
│ │ │ │ -<h1>torrent_finished_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a torrent switches from being a downloader to a seed.
│ │ │ │ -It will only be generated once per torrent. It contains a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> to the
│ │ │ │ -torrent in question.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_finished_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="piece_finished_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_finished_alert&labels=documentation&body=Documentation+under+heading+%22class+piece_finished_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-finished-alert">
│ │ │ │ -<h1>piece_finished_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time a piece completes downloading
│ │ │ │ -and passes the hash check. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> derives from <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a>
│ │ │ │ -which contains the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> to the torrent the piece belongs to.
│ │ │ │ -Note that being downloaded and passing the hash check may happen before
│ │ │ │ -the piece is also fully flushed to disk. So <a class="reference external" href="reference-Torrent_Handle.html#have_piece()">torrent_handle::have_piece()</a>
│ │ │ │ -may still return false</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct piece_finished_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   piece_index_t const piece_index;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="piece_index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_finished_alert%3A%3A%5Bpiece_index%5D&labels=documentation&body=Documentation+under+heading+%22piece_finished_alert%3A%3A%5Bpiece_index%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>piece_index</dt>
│ │ │ │ -<dd>the index of the piece that finished</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="request_dropped_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+request_dropped_alert&labels=documentation&body=Documentation+under+heading+%22class+request_dropped_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="request-dropped-alert">
│ │ │ │ -<h1>request_dropped_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer rejects or ignores a piece request.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct request_dropped_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   int const block_index;
│ │ │ │ -   piece_index_t const piece_index;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="block_timeout_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_timeout_alert&labels=documentation&body=Documentation+under+heading+%22class+block_timeout_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="block-timeout-alert">
│ │ │ │ -<h1>block_timeout_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block request times out.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct block_timeout_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   int const block_index;
│ │ │ │ -   piece_index_t const piece_index;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="block_finished_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_finished_alert&labels=documentation&body=Documentation+under+heading+%22class+block_finished_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="block-finished-alert">
│ │ │ │ -<h1>block_finished_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block request receives a response.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct block_finished_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   int const block_index;
│ │ │ │ -   piece_index_t const piece_index;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="block_downloading_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_downloading_alert&labels=documentation&body=Documentation+under+heading+%22class+block_downloading_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="block-downloading-alert">
│ │ │ │ -<h1>block_downloading_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block request is sent to a peer.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct block_downloading_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   int const block_index;
│ │ │ │ -   piece_index_t const piece_index;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="unwanted_block_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+unwanted_block_alert&labels=documentation&body=Documentation+under+heading+%22class+unwanted_block_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="unwanted-block-alert">
│ │ │ │ -<h1>unwanted_block_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block is received that was not requested or
│ │ │ │ -whose request timed out.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct unwanted_block_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ -   int const block_index;
│ │ │ │ -   piece_index_t const piece_index;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="storage_moved_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_moved_alert&labels=documentation&body=Documentation+under+heading+%22class+storage_moved_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="storage-moved-alert">
│ │ │ │ -<h1>storage_moved_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>The <tt class="docutils literal">storage_moved_alert</tt> is generated when all the disk IO has
│ │ │ │ -completed and the files have been moved, as an effect of a call to
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_handle::move_storage</span></tt>. This is useful to synchronize with the
│ │ │ │ -actual disk. The <tt class="docutils literal">storage_path()</tt> member return the new path of the
│ │ │ │ -storage.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct storage_moved_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>storage_path</strong> () const;
│ │ │ │ -   char const* <strong>old_path</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="storage_path()"></a>
│ │ │ │ -<a name="old_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_moved_alert%3A%3A%5Bstorage_path%28%29+old_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22storage_moved_alert%3A%3A%5Bstorage_path%28%29+old_path%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="storage-path-old-path">
│ │ │ │ -<h2>storage_path() old_path()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>storage_path</strong> () const;
│ │ │ │ -char const* <strong>old_path</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>the path the torrent was moved to and from, respectively.</p>
│ │ │ │ -<a name="storage_moved_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_moved_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+storage_moved_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="storage-moved-failed-alert">
│ │ │ │ -<h1>storage_moved_failed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>The <tt class="docutils literal">storage_moved_failed_alert</tt> is generated when an attempt to move the storage,
│ │ │ │ -via <a class="reference external" href="reference-Torrent_Handle.html#move_storage()">torrent_handle::move_storage()</a>, fails.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct storage_moved_failed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>file_path</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ -   error_code const error;
│ │ │ │ -   operation_t op;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="file_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_moved_failed_alert%3A%3A%5Bfile_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22storage_moved_failed_alert%3A%3A%5Bfile_path%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="file-path">
│ │ │ │ -<h2>file_path()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>file_path</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>If the error happened for a specific file, this returns its path.</p>
│ │ │ │ -<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_moved_failed_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22storage_moved_failed_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>op</dt>
│ │ │ │ -<dd>this indicates what underlying operation caused the error</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_deleted_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_deleted_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_deleted_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="torrent-deleted-alert">
│ │ │ │ -<h1>torrent_deleted_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a request to delete the files of a torrent complete.</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted in the <tt class="docutils literal"><span class="pre">alert_category::storage</span></tt> category, and that bit
│ │ │ │ -needs to be set in the alert_mask.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_deleted_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ -   info_hash_t info_hashes;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_deleted_alert%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_deleted_alert%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>info_hashes</dt>
│ │ │ │ -<dd>The info-hash of the torrent that was just deleted. Most of
│ │ │ │ -the time the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> in the <tt class="docutils literal">torrent_alert</tt> will be invalid by the time
│ │ │ │ -this <a class="reference external" href="reference-Alerts.html#alert">alert</a> arrives, since the torrent is being deleted. The <tt class="docutils literal">info_hashes</tt> member
│ │ │ │ -is hence the main way of identifying which torrent just completed the delete.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_delete_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_delete_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_delete_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-delete-failed-alert">
│ │ │ │ -<h1>torrent_delete_failed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a request to delete the files of a torrent fails.
│ │ │ │ -Just removing a torrent from the <a class="reference external" href="reference-Session.html#session">session</a> cannot fail</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_delete_failed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage
│ │ │ │ -   | alert_category::error;
│ │ │ │ -   error_code const error;
│ │ │ │ -   info_hash_t info_hashes;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_delete_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22torrent_delete_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>tells you why it failed.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_delete_failed_alert%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_delete_failed_alert%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>info_hashes</dt>
│ │ │ │ -<dd>the info hash of the torrent whose files failed to be deleted</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="save_resume_data_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+save_resume_data_alert&labels=documentation&body=Documentation+under+heading+%22class+save_resume_data_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="save-resume-data-alert">
│ │ │ │ -<h1>save_resume_data_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated as a response to a <tt class="docutils literal"><span class="pre">torrent_handle::save_resume_data</span></tt> request.
│ │ │ │ -It is generated once the disk IO thread is done writing the state for this torrent.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct save_resume_data_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ -   add_torrent_params params;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:save_resume_data_alert%3A%3A%5Bparams%5D&labels=documentation&body=Documentation+under+heading+%22save_resume_data_alert%3A%3A%5Bparams%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>params</dt>
│ │ │ │ -<dd><p class="first">the <tt class="docutils literal">params</tt> object is populated with the torrent file whose resume
│ │ │ │ -data was saved. It is suitable to be:</p>
│ │ │ │ -<ul class="last simple">
│ │ │ │ -<li>added to a <a class="reference external" href="reference-Session.html#session">session</a> with <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> or <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a></li>
│ │ │ │ -<li>saved to disk with <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a></li>
│ │ │ │ -<li>turned into a magnet link with <a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a></li>
│ │ │ │ -<li>saved as a .torrent file with <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a></li>
│ │ │ │ -</ul>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="save_resume_data_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+save_resume_data_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+save_resume_data_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="save-resume-data-failed-alert">
│ │ │ │ -<h1>save_resume_data_failed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated instead of <tt class="docutils literal">save_resume_data_alert</tt> if there was an error
│ │ │ │ -generating the resume data. <tt class="docutils literal">error</tt> describes what went wrong.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct save_resume_data_failed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage
│ │ │ │ -   | alert_category::error;
│ │ │ │ -   error_code const error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:save_resume_data_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22save_resume_data_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error code from the resume_data failure</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_paused_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_paused_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_paused_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-paused-alert">
│ │ │ │ -<h1>torrent_paused_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated as a response to a <tt class="docutils literal"><span class="pre">torrent_handle::pause</span></tt> 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.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_paused_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="torrent_resumed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_resumed_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_resumed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-resumed-alert">
│ │ │ │ -<h1>torrent_resumed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated as a response to a <a class="reference external" href="reference-Torrent_Handle.html#resume()">torrent_handle::resume()</a> request. It is
│ │ │ │ -generated when a torrent goes from a paused state to an active state.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_resumed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="torrent_checked_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_checked_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_checked_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-checked-alert">
│ │ │ │ -<h1>torrent_checked_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when a torrent completes checking. i.e. when it transitions
│ │ │ │ -out of the <tt class="docutils literal">checking files</tt> state into a state where it is ready to start downloading</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_checked_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="url_seed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+url_seed_alert&labels=documentation&body=Documentation+under+heading+%22class+url_seed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="url-seed-alert">
│ │ │ │ -<h1>url_seed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a HTTP seed name lookup fails.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct url_seed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>server_url</strong> () const;
│ │ │ │ -   char const* <strong>error_message</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer | alert_category::error;
│ │ │ │ -   error_code const error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="server_url()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:url_seed_alert%3A%3A%5Bserver_url%28%29%5D&labels=documentation&body=Documentation+under+heading+%22url_seed_alert%3A%3A%5Bserver_url%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="server-url">
│ │ │ │ -<h2>server_url()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>server_url</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>the URL the error is associated with</p>
│ │ │ │ -<a name="error_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:url_seed_alert%3A%3A%5Berror_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22url_seed_alert%3A%3A%5Berror_message%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="error-message-1">
│ │ │ │ -<h2>error_message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>error_message</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>in case the web server sent an error message, this function returns
│ │ │ │ -it.</p>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:url_seed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22url_seed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error the web seed encountered. If this is not set, the server
│ │ │ │ -sent an error message, call <tt class="docutils literal">error_message()</tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_error_alert&labels=documentation&body=Documentation+under+heading+%22class+file_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="file-error-alert">
│ │ │ │ -<h1>file_error_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>If the storage fails to read or write files that it needs access to, this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is
│ │ │ │ -generated and the torrent is paused.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct file_error_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>filename</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status
│ │ │ │ -   | alert_category::storage;
│ │ │ │ -   error_code const error;
│ │ │ │ -   operation_t op;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="filename()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_error_alert%3A%3A%5Bfilename%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_error_alert%3A%3A%5Bfilename%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="filename">
│ │ │ │ -<h2>filename()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>filename</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>the file that experienced the error</p>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22file_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error code describing the error.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_error_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22file_error_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>op</dt>
│ │ │ │ -<dd>indicates which underlying operation caused the error</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="metadata_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+metadata_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+metadata_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="metadata-failed-alert">
│ │ │ │ -<h1>metadata_failed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when the metadata has been completely received and the info-hash
│ │ │ │ -failed to match it. i.e. the metadata that was received was corrupt. libtorrent will
│ │ │ │ -automatically retry to fetch it in this case. This is only relevant when running a
│ │ │ │ -torrent-less download, with the metadata extension provided by libtorrent.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct metadata_failed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ -   error_code const error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:metadata_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22metadata_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>indicates what failed when parsing the metadata. This error is
│ │ │ │ -what's returned from lazy_bdecode().</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="metadata_received_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+metadata_received_alert&labels=documentation&body=Documentation+under+heading+%22class+metadata_received_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="metadata-received-alert">
│ │ │ │ -<h1>metadata_received_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when the metadata has been completely received and the torrent
│ │ │ │ -can start downloading. It is not generated on torrents that are started with metadata, but
│ │ │ │ -only those that needs to download it from peers (when utilizing the libtorrent extension).</p>
│ │ │ │ -<p>There are no additional data members in this <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ -<p>Typically, when receiving this <a class="reference external" href="reference-Alerts.html#alert">alert</a>, you would want to save the torrent file in order
│ │ │ │ -to load it back up again when the <a class="reference external" href="reference-Session.html#session">session</a> is restarted. Here's an example snippet of
│ │ │ │ -code to do that:</p>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="name">torrent_handle</span><span class="whitespace"> </span><span class="name">h</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">alert</span><span class="operator">-&gt;</span><span class="name">handle</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -</span><span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="name">torrent_info</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">ti</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">h</span><span class="punctuation">.</span><span class="name">torrent_file</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ -</span><span class="name">create_torrent</span><span class="whitespace"> </span><span class="name function">ct</span><span class="punctuation">(</span><span class="operator">*</span><span class="name">ti</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="name">entry</span><span class="whitespace"> </span><span class="name">te</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ct</span><span class="punctuation">.</span><span class="name">generate</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ -</span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">buffer</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -</span><span class="name">bencode</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">back_inserter</span><span class="punctuation">(</span><span class="name">buffer</span><span class="punctuation">),</span><span class="whitespace"> </span><span class="name">te</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="keyword type">FILE</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">f</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">fopen</span><span class="punctuation">((</span><span class="name">to_hex</span><span class="punctuation">(</span><span class="name">ti</span><span class="operator">-&gt;</span><span class="name">info_hashes</span><span class="punctuation">().</span><span class="name">get_best</span><span class="punctuation">().</span><span class="name">to_string</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="literal string">&quot;.torrent&quot;</span><span class="punctuation">).</span><span class="name">c_str</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="literal string">&quot;wb+&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">f</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -        </span><span class="name">fwrite</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">buffer</span><span class="punctuation">[</span><span class="literal number integer">0</span><span class="punctuation">],</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">buffer</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="name">f</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -        </span><span class="name">fclose</span><span class="punctuation">(</span><span class="name">f</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="punctuation">}</span>
│ │ │ │ -</pre>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct metadata_received_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="udp_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+udp_error_alert&labels=documentation&body=Documentation+under+heading+%22class+udp_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="udp-error-alert">
│ │ │ │ -<h1>udp_error_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when there is an error on a UDP socket. The
│ │ │ │ -UDP sockets are used for all uTP, DHT and UDP tracker traffic. They are
│ │ │ │ -global to the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct udp_error_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ -   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
│ │ │ │ -   operation_t operation;
│ │ │ │ -   error_code const error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:udp_error_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22udp_error_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>endpoint</dt>
│ │ │ │ -<dd>the source address associated with the error (if any)</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="operation"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:udp_error_alert%3A%3A%5Boperation%5D&labels=documentation&body=Documentation+under+heading+%22udp_error_alert%3A%3A%5Boperation%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>operation</dt>
│ │ │ │ -<dd>the operation that failed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:udp_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22udp_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error code describing the error</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="external_ip_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+external_ip_alert&labels=documentation&body=Documentation+under+heading+%22class+external_ip_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="external-ip-alert">
│ │ │ │ -<h1>external_ip_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>Whenever libtorrent learns about the machines external IP, this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is
│ │ │ │ -generated. The external IP address can be acquired from the tracker (if it
│ │ │ │ -supports that) or from peers that supports the extension protocol.
│ │ │ │ -The address can be accessed through the <tt class="docutils literal">external_address</tt> member.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct external_ip_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -   aux::noexcept_movable&lt;address&gt; external_address;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="external_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:external_ip_alert%3A%3A%5Bexternal_address%5D&labels=documentation&body=Documentation+under+heading+%22external_ip_alert%3A%3A%5Bexternal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>external_address</dt>
│ │ │ │ -<dd>the IP address that is believed to be our external IP</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="listen_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+listen_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+listen_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="listen-failed-alert">
│ │ │ │ -<h1>listen_failed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when none of the ports, given in the port range, to
│ │ │ │ -<a class="reference external" href="reference-Session.html#session">session</a> can be opened for listening. The <tt class="docutils literal">listen_interface</tt> member is the
│ │ │ │ -interface that failed, <tt class="docutils literal">error</tt> is the error code describing the failure.</p>
│ │ │ │ -<p>In the case an endpoint was created before generating the <a class="reference external" href="reference-Alerts.html#alert">alert</a>, it is
│ │ │ │ -represented by <tt class="docutils literal">address</tt> and <tt class="docutils literal">port</tt>. The combinations of socket type
│ │ │ │ -and operation in which such address and port are not valid are:
│ │ │ │ -accept  - i2p
│ │ │ │ -accept  - socks5
│ │ │ │ -enum_if - tcp</p>
│ │ │ │ -<p>libtorrent may sometimes try to listen on port 0, if all other ports failed.
│ │ │ │ -Port 0 asks the operating system to pick a port that's free). If that fails
│ │ │ │ -you may see a <a class="reference external" href="reference-Alerts.html#listen_failed_alert">listen_failed_alert</a> with port 0 even if you didn't ask to
│ │ │ │ -listen on it.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct listen_failed_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>listen_interface</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status | alert_category::error;
│ │ │ │ -   error_code const error;
│ │ │ │ -   operation_t op;
│ │ │ │ -   lt::socket_type_t const socket_type;
│ │ │ │ -   aux::noexcept_movable&lt;lt::address&gt; address;
│ │ │ │ -   int const port;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="listen_interface()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Blisten_interface%28%29%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Blisten_interface%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="listen-interface">
│ │ │ │ -<h2>listen_interface()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>listen_interface</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>the network device libtorrent attempted to listen on, or the IP address</p>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error the system returned</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>op</dt>
│ │ │ │ -<dd>the underlying operation that failed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>socket_type</dt>
│ │ │ │ -<dd>the type of listen socket this <a class="reference external" href="reference-Alerts.html#alert">alert</a> refers to.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Baddress%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Baddress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>address</dt>
│ │ │ │ -<dd>the address libtorrent attempted to listen on
│ │ │ │ -see <a class="reference external" href="reference-Alerts.html#alert">alert</a> documentation for validity of this value</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="port"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Bport%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Bport%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>port</dt>
│ │ │ │ -<dd>the port libtorrent attempted to listen on
│ │ │ │ -see <a class="reference external" href="reference-Alerts.html#alert">alert</a> documentation for validity of this value</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="listen_succeeded_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+listen_succeeded_alert&labels=documentation&body=Documentation+under+heading+%22class+listen_succeeded_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="listen-succeeded-alert">
│ │ │ │ -<h1>listen_succeeded_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the listen port succeeds to be opened on a
│ │ │ │ -particular interface. <tt class="docutils literal">address</tt> and <tt class="docutils literal">port</tt> is the endpoint that
│ │ │ │ -successfully was opened for listening.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct listen_succeeded_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -   aux::noexcept_movable&lt;lt::address&gt; address;
│ │ │ │ -   int const port;
│ │ │ │ -   lt::socket_type_t const socket_type;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_succeeded_alert%3A%3A%5Baddress%5D&labels=documentation&body=Documentation+under+heading+%22listen_succeeded_alert%3A%3A%5Baddress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>address</dt>
│ │ │ │ -<dd>the address libtorrent ended up listening on. This address
│ │ │ │ -refers to the local interface.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="port"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_succeeded_alert%3A%3A%5Bport%5D&labels=documentation&body=Documentation+under+heading+%22listen_succeeded_alert%3A%3A%5Bport%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>port</dt>
│ │ │ │ -<dd>the port libtorrent ended up listening on.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_succeeded_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22listen_succeeded_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>socket_type</dt>
│ │ │ │ -<dd>the type of listen socket this <a class="reference external" href="reference-Alerts.html#alert">alert</a> refers to.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="portmap_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+portmap_error_alert&labels=documentation&body=Documentation+under+heading+%22class+portmap_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="portmap-error-alert">
│ │ │ │ -<h1>portmap_error_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a NAT router was successfully found but some
│ │ │ │ -part of the port mapping request failed. It contains a text message that
│ │ │ │ -may help the user figure out what is wrong. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is not generated in
│ │ │ │ -case it appears the client is not running on a NAT:ed network or if it
│ │ │ │ -appears there is no NAT router that can be remote controlled to add port
│ │ │ │ -mappings.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct portmap_error_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::port_mapping
│ │ │ │ -   | alert_category::error;
│ │ │ │ -   port_mapping_t const mapping;
│ │ │ │ -   portmap_transport map_transport;
│ │ │ │ -   aux::noexcept_movable&lt;address&gt; local_address;
│ │ │ │ -   error_code const error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="mapping"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Bmapping%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Bmapping%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>mapping</dt>
│ │ │ │ -<dd>refers to the mapping index of the port map that failed, i.e.
│ │ │ │ -the index returned from add_mapping().</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="map_transport"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Bmap_transport%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Bmap_transport%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>map_transport</dt>
│ │ │ │ -<dd>UPnP or NAT-PMP</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>local_address</dt>
│ │ │ │ -<dd>the local network the port mapper is running on</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>tells you what failed.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="portmap_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+portmap_alert&labels=documentation&body=Documentation+under+heading+%22class+portmap_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="portmap-alert">
│ │ │ │ -<h1>portmap_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a NAT router was successfully found and
│ │ │ │ -a port was successfully mapped on it. On a NAT:ed network with a NAT-PMP
│ │ │ │ -capable router, this is typically generated once when mapping the TCP
│ │ │ │ -port and, if DHT is enabled, when the UDP port is mapped.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct portmap_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::port_mapping;
│ │ │ │ -   port_mapping_t const mapping;
│ │ │ │ -   int const external_port;
│ │ │ │ -   portmap_protocol const map_protocol;
│ │ │ │ -   portmap_transport const map_transport;
│ │ │ │ -   aux::noexcept_movable&lt;address&gt; local_address;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="mapping"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_alert%3A%3A%5Bmapping%5D&labels=documentation&body=Documentation+under+heading+%22portmap_alert%3A%3A%5Bmapping%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>mapping</dt>
│ │ │ │ -<dd>refers to the mapping index of the port map that failed, i.e.
│ │ │ │ -the index returned from add_mapping().</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="external_port"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_alert%3A%3A%5Bexternal_port%5D&labels=documentation&body=Documentation+under+heading+%22portmap_alert%3A%3A%5Bexternal_port%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>external_port</dt>
│ │ │ │ -<dd>the external port allocated for the mapping.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22portmap_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>local_address</dt>
│ │ │ │ -<dd>the local network the port mapper is running on</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="portmap_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+portmap_log_alert&labels=documentation&body=Documentation+under+heading+%22class+portmap_log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="portmap-log-alert">
│ │ │ │ -<h1>portmap_log_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated to log informational events related to either
│ │ │ │ -UPnP or NAT-PMP. They contain a log line and the type (0 = NAT-PMP
│ │ │ │ -and 1 = UPnP). Displaying these messages to an end user is only useful
│ │ │ │ -for debugging the UPnP or NAT-PMP implementation. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only
│ │ │ │ -posted if the alert_category::port_mapping_log flag is enabled in
│ │ │ │ -the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct portmap_log_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>log_message</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::port_mapping_log;
│ │ │ │ -   portmap_transport const map_transport;
│ │ │ │ -   aux::noexcept_movable&lt;address&gt; local_address;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22portmap_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message">
│ │ │ │ -<h2>log_message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>log_message</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>the message associated with this log line</p>
│ │ │ │ -<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_log_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22portmap_log_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>local_address</dt>
│ │ │ │ -<dd>the local network the port mapper is running on</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="fastresume_rejected_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+fastresume_rejected_alert&labels=documentation&body=Documentation+under+heading+%22class+fastresume_rejected_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="fastresume-rejected-alert">
│ │ │ │ -<h1>fastresume_rejected_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a fast resume file has been passed to
│ │ │ │ -<a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> but the files on disk did not match the fast resume file.
│ │ │ │ -The error_code explains the reason why the resume file was rejected.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct fastresume_rejected_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>file_path</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status
│ │ │ │ -   | alert_category::error;
│ │ │ │ -   error_code error;
│ │ │ │ -   operation_t op;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="file_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:fastresume_rejected_alert%3A%3A%5Bfile_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22fastresume_rejected_alert%3A%3A%5Bfile_path%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="file-path-1">
│ │ │ │ -<h2>file_path()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>file_path</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>If the error happened to a specific file, this returns the path to it.</p>
│ │ │ │ -<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:fastresume_rejected_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22fastresume_rejected_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>op</dt>
│ │ │ │ -<dd>the underlying operation that failed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="peer_blocked_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_blocked_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_blocked_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="peer-blocked-alert">
│ │ │ │ -<h1>peer_blocked_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when an incoming peer connection, or a peer that's about to be added
│ │ │ │ -to our peer list, is blocked for some reason. This could be any of:</p>
│ │ │ │ -<ul class="simple">
│ │ │ │ -<li>the IP filter</li>
│ │ │ │ -<li>i2p mixed mode restrictions (a normal peer is not allowed on an i2p swarm)</li>
│ │ │ │ -<li>the port filter</li>
│ │ │ │ -<li>the peer has a low port and <tt class="docutils literal">no_connect_privileged_ports</tt> is enabled</li>
│ │ │ │ -<li>the protocol of the peer is blocked (uTP/TCP blocking)</li>
│ │ │ │ -</ul>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_blocked_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   enum reason_t
│ │ │ │ -   {
│ │ │ │ -      ip_filter,
│ │ │ │ -      port_filter,
│ │ │ │ -      i2p_mixed,
│ │ │ │ -      privileged_ports,
│ │ │ │ -      utp_disabled,
│ │ │ │ -      tcp_disabled,
│ │ │ │ -      invalid_local_interface,
│ │ │ │ -      ssrf_mitigation,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::ip_block;
│ │ │ │ -   int const reason;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="reason_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+reason_t&labels=documentation&body=Documentation+under+heading+%22enum+reason_t%22+could+be+improved">report issue</a>]</span><div class="section" id="enum-reason-t">
│ │ │ │ -<h2>enum reason_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="56%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="29%" />
│ │ │ │ -</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>ip_filter</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>port_filter</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>i2p_mixed</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>privileged_ports</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>utp_disabled</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>tcp_disabled</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_local_interface</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>ssrf_mitigation</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="reason"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_blocked_alert%3A%3A%5Breason%5D&labels=documentation&body=Documentation+under+heading+%22peer_blocked_alert%3A%3A%5Breason%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>reason</dt>
│ │ │ │ -<dd>the reason for the peer being blocked. Is one of the values from the
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#reason_t">reason_t</a> enum.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_announce_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_announce_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_announce_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="dht-announce-alert">
│ │ │ │ -<h1>dht_announce_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a DHT node announces to an info-hash on our
│ │ │ │ -DHT node. It belongs to the <tt class="docutils literal"><span class="pre">alert_category::dht</span></tt> category.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_announce_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ -   aux::noexcept_movable&lt;address&gt; ip;
│ │ │ │ -   int port;
│ │ │ │ -   sha1_hash info_hash;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="dht_get_peers_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_get_peers_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_get_peers_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-get-peers-alert">
│ │ │ │ -<h1>dht_get_peers_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a DHT node sends a <tt class="docutils literal">get_peers</tt> message to
│ │ │ │ -our DHT node. It belongs to the <tt class="docutils literal"><span class="pre">alert_category::dht</span></tt> category.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_get_peers_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ -   sha1_hash info_hash;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="cache_flushed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+cache_flushed_alert&labels=documentation&body=Documentation+under+heading+%22class+cache_flushed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="cache-flushed-alert">
│ │ │ │ -<h1>cache_flushed_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the disk cache has been flushed for a specific
│ │ │ │ -torrent as a result of a call to <a class="reference external" href="reference-Torrent_Handle.html#flush_cache()">torrent_handle::flush_cache()</a>. This
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#alert">alert</a> belongs to the <tt class="docutils literal"><span class="pre">alert_category::storage</span></tt> category, which must be
│ │ │ │ -enabled to let this <a class="reference external" href="reference-Alerts.html#alert">alert</a> through. The <a class="reference external" href="reference-Alerts.html#alert">alert</a> is also posted when removing
│ │ │ │ -a torrent from the <a class="reference external" href="reference-Session.html#session">session</a>, once the outstanding cache flush is complete
│ │ │ │ -and the torrent does no longer have any files open.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct cache_flushed_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="lsd_peer_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+lsd_peer_alert&labels=documentation&body=Documentation+under+heading+%22class+lsd_peer_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="lsd-peer-alert">
│ │ │ │ -<h1>lsd_peer_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when we receive a local service discovery message
│ │ │ │ -from a peer for a torrent we're currently participating in.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct lsd_peer_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="trackerid_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+trackerid_alert&labels=documentation&body=Documentation+under+heading+%22class+trackerid_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="trackerid-alert">
│ │ │ │ -<h1>trackerid_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted whenever a tracker responds with a <tt class="docutils literal">trackerid</tt>.
│ │ │ │ -The tracker ID is like a cookie. libtorrent will store the tracker ID
│ │ │ │ -for this tracker and repeat it in subsequent announces.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct trackerid_alert final : tracker_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>tracker_id</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="tracker_id()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:trackerid_alert%3A%3A%5Btracker_id%28%29%5D&labels=documentation&body=Documentation+under+heading+%22trackerid_alert%3A%3A%5Btracker_id%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="tracker-id">
│ │ │ │ -<h2>tracker_id()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>tracker_id</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>The tracker ID returned by the tracker</p>
│ │ │ │ -<a name="dht_bootstrap_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_bootstrap_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_bootstrap_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="dht-bootstrap-alert">
│ │ │ │ -<h1>dht_bootstrap_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the initial DHT bootstrap is done.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_bootstrap_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="torrent_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_error_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-error-alert">
│ │ │ │ -<h1>torrent_error_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This is posted whenever a torrent is transitioned into the error state.
│ │ │ │ -If the error code is duplicate_torrent (<a class="reference external" href="reference-Error_Codes.html#error_code_enum">error_code_enum</a>) error, it suggests two magnet
│ │ │ │ -links ended up resolving to the same hybrid torrent. For more details,
│ │ │ │ -see <a class="reference external" href="manual-ref.html#bittorrent-v2-torrents">BitTorrent v2 torrents</a>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_error_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>filename</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error | alert_category::status;
│ │ │ │ -   error_code const error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="filename()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_error_alert%3A%3A%5Bfilename%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_error_alert%3A%3A%5Bfilename%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="filename-1">
│ │ │ │ -<h2>filename()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>filename</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>the filename (or object) the error occurred on.</p>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22torrent_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>specifies which error the torrent encountered.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_need_cert_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_need_cert_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_need_cert_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="torrent-need-cert-alert">
│ │ │ │ -<h1>torrent_need_cert_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This is always posted for SSL torrents. This is a reminder to the client that
│ │ │ │ -the torrent won't work unless <a class="reference external" href="reference-Torrent_Handle.html#set_ssl_certificate()">torrent_handle::set_ssl_certificate()</a> is called with
│ │ │ │ -a valid certificate. Valid certificates MUST be signed by the SSL certificate
│ │ │ │ -in the .torrent file.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_need_cert_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="incoming_connection_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+incoming_connection_alert&labels=documentation&body=Documentation+under+heading+%22class+incoming_connection_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="incoming-connection-alert">
│ │ │ │ -<h1>incoming_connection_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>The incoming connection <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time we successfully accept
│ │ │ │ -an incoming connection, through any mean. The most straight-forward ways
│ │ │ │ -of accepting incoming connections are through the TCP listen socket and
│ │ │ │ -the UDP listen socket for uTP sockets. However, connections may also be
│ │ │ │ -accepted through a Socks5 or i2p listen socket, or via an SSL listen
│ │ │ │ -socket.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct incoming_connection_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ -   socket_type_t socket_type;
│ │ │ │ -   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; endpoint;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:incoming_connection_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22incoming_connection_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>socket_type</dt>
│ │ │ │ -<dd>tells you what kind of socket the connection was accepted</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:incoming_connection_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22incoming_connection_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>endpoint</dt>
│ │ │ │ -<dd>is the IP address and port the connection came from.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="add_torrent_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+add_torrent_alert&labels=documentation&body=Documentation+under+heading+%22class+add_torrent_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-torrent-alert">
│ │ │ │ -<h1>add_torrent_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is always posted when a torrent was attempted to be added
│ │ │ │ -and contains the return status of the add operation. The torrent handle of the new
│ │ │ │ -torrent can be found as the <tt class="docutils literal">handle</tt> member in the base class. If adding
│ │ │ │ -the torrent failed, <tt class="docutils literal">error</tt> contains the error code.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct add_torrent_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -   add_torrent_params params;
│ │ │ │ -   error_code error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_alert%3A%3A%5Bparams%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_alert%3A%3A%5Bparams%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>params</dt>
│ │ │ │ -<dd><p class="first">This contains copies of the most important fields from the original
│ │ │ │ -<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object, passed to <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> or
│ │ │ │ -<a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a>. Specifically, these fields are copied:</p>
│ │ │ │ -<ul class="simple">
│ │ │ │ -<li>version</li>
│ │ │ │ -<li>ti</li>
│ │ │ │ -<li>name</li>
│ │ │ │ -<li>save_path</li>
│ │ │ │ -<li>userdata</li>
│ │ │ │ -<li>tracker_id</li>
│ │ │ │ -<li>flags</li>
│ │ │ │ -<li>info_hash</li>
│ │ │ │ -</ul>
│ │ │ │ -<p class="last">the info_hash field will be updated with the info-hash of the torrent
│ │ │ │ -specified by <tt class="docutils literal">ti</tt>.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>set to the error, if one occurred while adding the torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="state_update_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+state_update_alert&labels=documentation&body=Documentation+under+heading+%22class+state_update_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="state-update-alert">
│ │ │ │ -<h1>state_update_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only posted when requested by the user, by calling
│ │ │ │ -session::post_torrent_updates() on the <a class="reference external" href="reference-Session.html#session">session</a>. It contains the torrent
│ │ │ │ -status of all torrents that changed since last time this message was
│ │ │ │ -posted. Its category is <tt class="docutils literal"><span class="pre">alert_category::status</span></tt>, but it's not subject to
│ │ │ │ -filtering, since it's only manually posted anyway.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct state_update_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -   std::vector&lt;torrent_status&gt; status;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="status"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:state_update_alert%3A%3A%5Bstatus%5D&labels=documentation&body=Documentation+under+heading+%22state_update_alert%3A%3A%5Bstatus%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>status</dt>
│ │ │ │ -<dd>contains the torrent status of all torrents that changed since last
│ │ │ │ -time this message was posted. Note that you can map a torrent status
│ │ │ │ -to a specific torrent via its <tt class="docutils literal">handle</tt> member. The receiving end is
│ │ │ │ -suggested to have all torrents sorted by the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> or hashed
│ │ │ │ -by it, for efficient updates.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="session_stats_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_stats_alert&labels=documentation&body=Documentation+under+heading+%22class+session_stats_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="session-stats-alert">
│ │ │ │ -<h1>session_stats_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a> is posted when the user requests <a class="reference external" href="reference-Session.html#session">session</a> statistics by
│ │ │ │ -calling <a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a> on the <a class="reference external" href="reference-Session.html#session">session</a> object. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> does not
│ │ │ │ -have a category, since it's only posted in response to an API call. It
│ │ │ │ -is not subject to the alert_mask filter.</p>
│ │ │ │ -<p>the <tt class="docutils literal">message()</tt> member function returns a string representation of the values that
│ │ │ │ -properly match the line returned in <tt class="docutils literal"><span class="pre">session_stats_header_alert::message()</span></tt>.</p>
│ │ │ │ -<p>this specific output is parsed by tools/parse_session_stats.py
│ │ │ │ -if this is changed, that parser should also be changed</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct session_stats_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   span&lt;std::int64_t const&gt; <strong>counters</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = {};
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="counters()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_stats_alert%3A%3A%5Bcounters%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_stats_alert%3A%3A%5Bcounters%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="counters-1">
│ │ │ │ -<h2>counters()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -span&lt;std::int64_t const&gt; <strong>counters</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>An array are a mix of <em>counters</em> and <em>gauges</em>, which meanings can be
│ │ │ │ -queries via the <a class="reference external" href="reference-Stats.html#session_stats_metrics()">session_stats_metrics()</a> function on the <a class="reference external" href="reference-Session.html#session">session</a>. The
│ │ │ │ -mapping from a specific metric to an index into this array is constant
│ │ │ │ -for a specific version of libtorrent, but may differ for other
│ │ │ │ -versions. The intended usage is to request the mapping, i.e. call
│ │ │ │ -<a class="reference external" href="reference-Stats.html#session_stats_metrics()">session_stats_metrics()</a>, once on startup, and then use that mapping to
│ │ │ │ -interpret these values throughout the process' runtime.</p>
│ │ │ │ -<p>For more information, see the <a class="reference external" href="manual-ref.html#session-statistics">session statistics</a> section.</p>
│ │ │ │ -<a name="dht_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_error_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="dht-error-alert">
│ │ │ │ -<h1>dht_error_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted when something fails in the DHT. This is not necessarily a fatal
│ │ │ │ -error, but it could prevent proper operation</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_error_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error | alert_category::dht;
│ │ │ │ -   error_code error;
│ │ │ │ -   operation_t op;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22dht_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error code</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_error_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22dht_error_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>op</dt>
│ │ │ │ -<dd>the operation that failed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_immutable_item_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_immutable_item_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_immutable_item_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-immutable-item-alert">
│ │ │ │ -<h1>dht_immutable_item_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted as a response to a call to session::get_item(),
│ │ │ │ -specifically the overload for looking up immutable items in the DHT.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_immutable_item_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ -   sha1_hash target;
│ │ │ │ -   entry item;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="target"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_immutable_item_alert%3A%3A%5Btarget%5D&labels=documentation&body=Documentation+under+heading+%22dht_immutable_item_alert%3A%3A%5Btarget%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>target</dt>
│ │ │ │ -<dd>the target hash of the immutable item. This must
│ │ │ │ -match the SHA-1 hash of the bencoded form of <tt class="docutils literal">item</tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="item"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_immutable_item_alert%3A%3A%5Bitem%5D&labels=documentation&body=Documentation+under+heading+%22dht_immutable_item_alert%3A%3A%5Bitem%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>item</dt>
│ │ │ │ -<dd>the data for this item</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_mutable_item_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_mutable_item_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_mutable_item_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-mutable-item-alert">
│ │ │ │ -<h1>dht_mutable_item_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted as a response to a call to session::get_item(),
│ │ │ │ -specifically the overload for looking up mutable items in the DHT.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_mutable_item_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ -   std::array&lt;char, 32&gt; key;
│ │ │ │ -   std::array&lt;char, 64&gt; signature;
│ │ │ │ -   std::int64_t seq;
│ │ │ │ -   std::string salt;
│ │ │ │ -   entry item;
│ │ │ │ -   bool authoritative;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="key"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bkey%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bkey%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>key</dt>
│ │ │ │ -<dd>the public key that was looked up</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="signature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bsignature%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bsignature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>signature</dt>
│ │ │ │ -<dd>the signature of the data. This is not the signature of the
│ │ │ │ -plain encoded form of the item, but it includes the sequence number
│ │ │ │ -and possibly the hash as well. See the dht_store document for more
│ │ │ │ -information. This is primarily useful for echoing back in a store
│ │ │ │ -request.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="seq"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bseq%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bseq%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>seq</dt>
│ │ │ │ -<dd>the sequence number of this item</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="salt"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bsalt%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bsalt%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>salt</dt>
│ │ │ │ -<dd>the salt, if any, used to lookup and store this item. If no
│ │ │ │ -salt was used, this is an empty string</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="item"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bitem%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bitem%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>item</dt>
│ │ │ │ -<dd>the data for this item</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="authoritative"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bauthoritative%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bauthoritative%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>authoritative</dt>
│ │ │ │ -<dd>the last response for mutable data is authoritative.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_put_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_put_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_put_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-put-alert">
│ │ │ │ -<h1>dht_put_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this is posted when a DHT put operation completes. This is useful if the
│ │ │ │ -client is waiting for a put to complete before shutting down for instance.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_put_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ -   sha1_hash target;
│ │ │ │ -   std::array&lt;char, 32&gt; public_key;
│ │ │ │ -   std::array&lt;char, 64&gt; signature;
│ │ │ │ -   std::string salt;
│ │ │ │ -   std::int64_t seq;
│ │ │ │ -   int num_success;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="target"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_put_alert%3A%3A%5Btarget%5D&labels=documentation&body=Documentation+under+heading+%22dht_put_alert%3A%3A%5Btarget%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>target</dt>
│ │ │ │ -<dd>the target hash the item was stored under if this was an <em>immutable</em>
│ │ │ │ -item.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="public_key"></a>
│ │ │ │ -<a name="signature"></a>
│ │ │ │ -<a name="salt"></a>
│ │ │ │ -<a name="seq"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_put_alert%3A%3A%5Bpublic_key+signature+salt+seq%5D&labels=documentation&body=Documentation+under+heading+%22dht_put_alert%3A%3A%5Bpublic_key+signature+salt+seq%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>public_key signature salt seq</dt>
│ │ │ │ -<dd>if a mutable item was stored, these are the public key, signature,
│ │ │ │ -salt and sequence number the item was stored under.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_success"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_put_alert%3A%3A%5Bnum_success%5D&labels=documentation&body=Documentation+under+heading+%22dht_put_alert%3A%3A%5Bnum_success%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_success</dt>
│ │ │ │ -<dd>DHT put operation usually writes item to k nodes, maybe the node
│ │ │ │ -is stale so no response, or the node doesn't support 'put', or the
│ │ │ │ -token for write is out of date, etc. num_success is the number of
│ │ │ │ -successful responses we got from the puts.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="i2p_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+i2p_alert&labels=documentation&body=Documentation+under+heading+%22class+i2p_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="i2p-alert">
│ │ │ │ -<h1>i2p_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is used to report errors in the i2p SAM connection</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct i2p_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ -   error_code error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:i2p_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22i2p_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error that occurred in the i2p SAM connection</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_outgoing_get_peers_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_outgoing_get_peers_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_outgoing_get_peers_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-outgoing-get-peers-alert">
│ │ │ │ -<h1>dht_outgoing_get_peers_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when we send a get_peers request
│ │ │ │ -It belongs to the <tt class="docutils literal"><span class="pre">alert_category::dht</span></tt> category.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_outgoing_get_peers_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ -   sha1_hash info_hash;
│ │ │ │ -   sha1_hash obfuscated_info_hash;
│ │ │ │ -   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="info_hash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_outgoing_get_peers_alert%3A%3A%5Binfo_hash%5D&labels=documentation&body=Documentation+under+heading+%22dht_outgoing_get_peers_alert%3A%3A%5Binfo_hash%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>info_hash</dt>
│ │ │ │ -<dd>the info_hash of the torrent we're looking for peers for.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="obfuscated_info_hash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_outgoing_get_peers_alert%3A%3A%5Bobfuscated_info_hash%5D&labels=documentation&body=Documentation+under+heading+%22dht_outgoing_get_peers_alert%3A%3A%5Bobfuscated_info_hash%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>obfuscated_info_hash</dt>
│ │ │ │ -<dd>if this was an obfuscated lookup, this is the info-hash target
│ │ │ │ -actually sent to the node.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_outgoing_get_peers_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22dht_outgoing_get_peers_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>endpoint</dt>
│ │ │ │ -<dd>the endpoint we're sending this query to</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+log_alert&labels=documentation&body=Documentation+under+heading+%22class+log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="log-alert">
│ │ │ │ -<h1>log_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted by some <a class="reference external" href="reference-Session.html#session">session</a> wide event. Its main purpose is
│ │ │ │ -trouble shooting and debugging. It's not enabled by the default <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -mask and is enabled by the <tt class="docutils literal"><span class="pre">alert_category::session_log</span></tt> bit.
│ │ │ │ -Furthermore, it's by default disabled as a build configuration.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct log_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>log_message</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::session_log;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-1">
│ │ │ │ -<h2>log_message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>log_message</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the log message</p>
│ │ │ │ -<a name="torrent_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_log_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="torrent-log-alert">
│ │ │ │ -<h1>torrent_log_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted by torrent wide events. It's meant to be used for
│ │ │ │ -trouble shooting and debugging. It's not enabled by the default <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -mask and is enabled by the <tt class="docutils literal"><span class="pre">alert_category::torrent_log</span></tt> bit. By
│ │ │ │ -default it is disabled as a build configuration.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_log_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>log_message</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::torrent_log;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-2">
│ │ │ │ -<h2>log_message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>log_message</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the log message</p>
│ │ │ │ -<a name="peer_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_log_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="peer-log-alert">
│ │ │ │ -<h1>peer_log_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted by events specific to a peer. It's meant to be used
│ │ │ │ -for trouble shooting and debugging. It's not enabled by the default <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -mask and is enabled by the <tt class="docutils literal"><span class="pre">alert_category::peer_log</span></tt> bit. By
│ │ │ │ -default it is disabled as a build configuration.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_log_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>log_message</strong> () const;
│ │ │ │ -
│ │ │ │ -   enum direction_t
│ │ │ │ -   {
│ │ │ │ -      incoming_message,
│ │ │ │ -      outgoing_message,
│ │ │ │ -      incoming,
│ │ │ │ -      outgoing,
│ │ │ │ -      info,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer_log;
│ │ │ │ -   char const* event_type;
│ │ │ │ -   direction_t direction;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-3">
│ │ │ │ -<h2>log_message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>log_message</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the log message</p>
│ │ │ │ -<a name="direction_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+direction_t&labels=documentation&body=Documentation+under+heading+%22enum+direction_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-direction-t-1">
│ │ │ │ -<h2>enum direction_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="47%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="34%" />
│ │ │ │ -</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>incoming_message</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>outgoing_message</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>incoming</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>outgoing</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>info</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="event_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_log_alert%3A%3A%5Bevent_type%5D&labels=documentation&body=Documentation+under+heading+%22peer_log_alert%3A%3A%5Bevent_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>event_type</dt>
│ │ │ │ -<dd>string literal indicating the kind of event. For messages, this is the
│ │ │ │ -message name.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="lsd_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+lsd_error_alert&labels=documentation&body=Documentation+under+heading+%22class+lsd_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="lsd-error-alert">
│ │ │ │ -<h1>lsd_error_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted if the local service discovery socket fails to start properly.
│ │ │ │ -it's categorized as <tt class="docutils literal"><span class="pre">alert_category::error</span></tt>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct lsd_error_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ -   aux::noexcept_movable&lt;address&gt; local_address;
│ │ │ │ -   error_code error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:lsd_error_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22lsd_error_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>local_address</dt>
│ │ │ │ -<dd>the local network the corresponding local service discovery is running
│ │ │ │ -on</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:lsd_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22lsd_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>The error code</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_lookup"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_lookup&labels=documentation&body=Documentation+under+heading+%22class+dht_lookup%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-lookup">
│ │ │ │ -<h1>dht_lookup</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>holds statistics about a current <a class="reference external" href="reference-Alerts.html#dht_lookup">dht_lookup</a> operation.
│ │ │ │ -a DHT lookup is the traversal of nodes, looking up a
│ │ │ │ -set of target nodes in the DHT for retrieving and possibly
│ │ │ │ -storing information in the DHT</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_lookup
│ │ │ │ -{
│ │ │ │ -   char const* type;
│ │ │ │ -   int outstanding_requests;
│ │ │ │ -   int timeouts;
│ │ │ │ -   int responses;
│ │ │ │ -   int branch_factor;
│ │ │ │ -   int nodes_left;
│ │ │ │ -   int last_sent;
│ │ │ │ -   int first_timeout;
│ │ │ │ -   sha1_hash target;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Btype%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Btype%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>type</dt>
│ │ │ │ -<dd>string literal indicating which kind of lookup this is</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="outstanding_requests"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Boutstanding_requests%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Boutstanding_requests%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>outstanding_requests</dt>
│ │ │ │ -<dd>the number of outstanding request to individual nodes
│ │ │ │ -this lookup has right now</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="timeouts"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Btimeouts%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Btimeouts%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>timeouts</dt>
│ │ │ │ -<dd>the total number of requests that have timed out so far
│ │ │ │ -for this lookup</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="responses"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bresponses%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bresponses%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>responses</dt>
│ │ │ │ -<dd>the total number of responses we have received for this
│ │ │ │ -lookup so far for this lookup</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="branch_factor"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bbranch_factor%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bbranch_factor%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>branch_factor</dt>
│ │ │ │ -<dd>the branch factor for this lookup. This is the number of
│ │ │ │ -nodes we keep outstanding requests to in parallel by default.
│ │ │ │ -when nodes time out we may increase this.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="nodes_left"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bnodes_left%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bnodes_left%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>nodes_left</dt>
│ │ │ │ -<dd>the number of nodes left that could be queries for this
│ │ │ │ -lookup. Many of these are likely to be part of the trail
│ │ │ │ -while performing the lookup and would never end up actually
│ │ │ │ -being queried.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="last_sent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Blast_sent%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Blast_sent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>last_sent</dt>
│ │ │ │ -<dd>the number of seconds ago the
│ │ │ │ -last message was sent that's still
│ │ │ │ -outstanding</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="first_timeout"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bfirst_timeout%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bfirst_timeout%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>first_timeout</dt>
│ │ │ │ -<dd>the number of outstanding requests
│ │ │ │ -that have exceeded the short timeout
│ │ │ │ -and are considered timed out in the
│ │ │ │ -sense that they increased the branch
│ │ │ │ -factor</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="target"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Btarget%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Btarget%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>target</dt>
│ │ │ │ -<dd>the node-id or info-hash target for this lookup</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_stats_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_stats_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_stats_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-stats-alert">
│ │ │ │ -<h1>dht_stats_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>contains current DHT state. Posted in response to session::post_dht_stats().</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_stats_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = {};
│ │ │ │ -   std::vector&lt;dht_lookup&gt; active_requests;
│ │ │ │ -   std::vector&lt;dht_routing_bucket&gt; routing_table;
│ │ │ │ -   sha1_hash nid;
│ │ │ │ -   aux::noexcept_movable&lt;udp::endpoint&gt; local_endpoint;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="active_requests"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Bactive_requests%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Bactive_requests%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>active_requests</dt>
│ │ │ │ -<dd>a vector of the currently running DHT lookups.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="routing_table"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Brouting_table%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Brouting_table%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>routing_table</dt>
│ │ │ │ -<dd>contains information about every bucket in the DHT routing
│ │ │ │ -table.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="nid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Bnid%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Bnid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>nid</dt>
│ │ │ │ -<dd>the node ID of the DHT node instance</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="local_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>local_endpoint</dt>
│ │ │ │ -<dd>the local socket this DHT node is running on</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="incoming_request_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+incoming_request_alert&labels=documentation&body=Documentation+under+heading+%22class+incoming_request_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="incoming-request-alert">
│ │ │ │ -<h1>incoming_request_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted every time an incoming request from a peer is accepted and queued
│ │ │ │ -up for being serviced. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only posted if
│ │ │ │ -the alert_category::incoming_request flag is enabled in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -mask.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct incoming_request_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::incoming_request;
│ │ │ │ -   peer_request req;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="req"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:incoming_request_alert%3A%3A%5Breq%5D&labels=documentation&body=Documentation+under+heading+%22incoming_request_alert%3A%3A%5Breq%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>req</dt>
│ │ │ │ -<dd>the request this peer sent to us</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_log_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-log-alert">
│ │ │ │ -<h1>dht_log_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>debug logging of the DHT when alert_category::dht_log is set in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -mask.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_log_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   char const* <strong>log_message</strong> () const;
│ │ │ │ -
│ │ │ │ -   enum dht_module_t
│ │ │ │ -   {
│ │ │ │ -      tracker,
│ │ │ │ -      node,
│ │ │ │ -      routing_table,
│ │ │ │ -      rpc_manager,
│ │ │ │ -      traversal,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_log;
│ │ │ │ -   dht_module_t module;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-4">
│ │ │ │ -<h2>log_message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>log_message</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>the log message</p>
│ │ │ │ -<a name="dht_module_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+dht_module_t&labels=documentation&body=Documentation+under+heading+%22enum+dht_module_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-dht-module-t">
│ │ │ │ -<h2>enum dht_module_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="43%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -<col width="37%" />
│ │ │ │ -</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>tracker</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>node</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>routing_table</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>rpc_manager</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>traversal</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="module"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_log_alert%3A%3A%5Bmodule%5D&labels=documentation&body=Documentation+under+heading+%22dht_log_alert%3A%3A%5Bmodule%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>module</dt>
│ │ │ │ -<dd>the module, or part, of the DHT that produced this log message.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_pkt_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_pkt_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_pkt_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="dht-pkt-alert">
│ │ │ │ -<h1>dht_pkt_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time a DHT message is sent or received. It is
│ │ │ │ -only posted if the <tt class="docutils literal"><span class="pre">alert_category::dht_log</span></tt> <a class="reference external" href="reference-Alerts.html#alert">alert</a> category is
│ │ │ │ -enabled. It contains a verbatim copy of the message.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_pkt_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   span&lt;char const&gt; <strong>pkt_buf</strong> () const;
│ │ │ │ -
│ │ │ │ -   enum direction_t
│ │ │ │ -   {
│ │ │ │ -      incoming,
│ │ │ │ -      outgoing,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_log;
│ │ │ │ -   direction_t direction;
│ │ │ │ -   aux::noexcept_movable&lt;udp::endpoint&gt; node;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="pkt_buf()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_pkt_alert%3A%3A%5Bpkt_buf%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_pkt_alert%3A%3A%5Bpkt_buf%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="pkt-buf">
│ │ │ │ -<h2>pkt_buf()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -span&lt;char const&gt; <strong>pkt_buf</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a pointer to the packet buffer and size of the packet,
│ │ │ │ -respectively. This buffer is only valid for as long as the <a class="reference external" href="reference-Alerts.html#alert">alert</a> itself
│ │ │ │ -is valid, which is owned by libtorrent and reclaimed whenever
│ │ │ │ -<a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> is called on the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │ -<a name="direction_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+direction_t&labels=documentation&body=Documentation+under+heading+%22enum+direction_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-direction-t-2">
│ │ │ │ -<h2>enum direction_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="33%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ -<col width="43%" />
│ │ │ │ -</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>incoming</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>outgoing</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="direction"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_pkt_alert%3A%3A%5Bdirection%5D&labels=documentation&body=Documentation+under+heading+%22dht_pkt_alert%3A%3A%5Bdirection%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>direction</dt>
│ │ │ │ -<dd>whether this is an incoming or outgoing packet.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="node"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_pkt_alert%3A%3A%5Bnode%5D&labels=documentation&body=Documentation+under+heading+%22dht_pkt_alert%3A%3A%5Bnode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>node</dt>
│ │ │ │ -<dd>the DHT node we received this packet from, or sent this packet to
│ │ │ │ -(depending on <tt class="docutils literal">direction</tt>).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_get_peers_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_get_peers_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_get_peers_reply_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="dht-get-peers-reply-alert">
│ │ │ │ -<h1>dht_get_peers_reply_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>Posted when we receive a response to a DHT get_peers request.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_get_peers_reply_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   int <strong>num_peers</strong> () const;
│ │ │ │ -   std::vector&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; <strong>peers</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_operation;
│ │ │ │ -   sha1_hash info_hash;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="dht_direct_response_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_direct_response_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_direct_response_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-direct-response-alert">
│ │ │ │ -<h1>dht_direct_response_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This is posted exactly once for every call to session_handle::dht_direct_request.
│ │ │ │ -If the request failed, <a class="reference external" href="reference-Alerts.html#response()">response()</a> will return a default constructed <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_direct_response_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   bdecode_node <strong>response</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ -   client_data_t userdata;
│ │ │ │ -   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="picker_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+picker_log_alert&labels=documentation&body=Documentation+under+heading+%22class+picker_log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="picker-log-alert">
│ │ │ │ -<h1>picker_log_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this is posted when one or more blocks are picked by the piece picker,
│ │ │ │ -assuming the verbose piece picker logging is enabled (see
│ │ │ │ -alert_category::picker_log).</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct picker_log_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   std::vector&lt;piece_block&gt; <strong>blocks</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::picker_log;
│ │ │ │ -   static constexpr picker_flags_t <strong>partial_ratio</strong>  = 0_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>prioritize_partials</strong>  = 1_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>rarest_first_partials</strong>  = 2_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>rarest_first</strong>  = 3_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>reverse_rarest_first</strong>  = 4_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>suggested_pieces</strong>  = 5_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>prio_sequential_pieces</strong>  = 6_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>sequential_pieces</strong>  = 7_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>reverse_pieces</strong>  = 8_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>time_critical</strong>  = 9_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>random_pieces</strong>  = 10_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>prefer_contiguous</strong>  = 11_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>reverse_sequential</strong>  = 12_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>backup1</strong>  = 13_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>backup2</strong>  = 14_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>end_game</strong>  = 15_bit;
│ │ │ │ -   static constexpr picker_flags_t <strong>extent_affinity</strong>  = 16_bit;
│ │ │ │ -   picker_flags_t const picker_flags;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="picker_flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:picker_log_alert%3A%3A%5Bpicker_flags%5D&labels=documentation&body=Documentation+under+heading+%22picker_log_alert%3A%3A%5Bpicker_flags%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>picker_flags</dt>
│ │ │ │ -<dd>this is a bitmask of which features were enabled for this particular
│ │ │ │ -pick. The bits are defined in the picker_flags_t enum.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="session_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_error_alert&labels=documentation&body=Documentation+under+heading+%22class+session_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="session-error-alert">
│ │ │ │ -<h1>session_error_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the <a class="reference external" href="reference-Session.html#session">session</a> encounters a serious error,
│ │ │ │ -potentially fatal</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct session_error_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ -   error_code const error;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22session_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>The error code, if one is associated with this error</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_live_nodes_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_live_nodes_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_live_nodes_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-live-nodes-alert">
│ │ │ │ -<h1>dht_live_nodes_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted in response to a call to session::dht_live_nodes(). It contains the
│ │ │ │ -live nodes from the DHT routing table of one of the DHT nodes running
│ │ │ │ -locally.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_live_nodes_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
│ │ │ │ -   int <strong>num_nodes</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ -   sha1_hash node_id;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="num_nodes()"></a>
│ │ │ │ -<a name="nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_live_nodes_alert%3A%3A%5Bnum_nodes%28%29+nodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_live_nodes_alert%3A%3A%5Bnum_nodes%28%29+nodes%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="num-nodes-nodes">
│ │ │ │ -<h2>num_nodes() nodes()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
│ │ │ │ -int <strong>num_nodes</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>the number of nodes in the routing table and the actual nodes.</p>
│ │ │ │ -<a name="node_id"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_live_nodes_alert%3A%3A%5Bnode_id%5D&labels=documentation&body=Documentation+under+heading+%22dht_live_nodes_alert%3A%3A%5Bnode_id%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>node_id</dt>
│ │ │ │ -<dd>the local DHT node's node-ID this routing table belongs to</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="session_stats_header_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_stats_header_alert&labels=documentation&body=Documentation+under+heading+%22class+session_stats_header_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="session-stats-header-alert">
│ │ │ │ -<h1>session_stats_header_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>The session_stats_header <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted the first time
│ │ │ │ -<a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a> is called</p>
│ │ │ │ -<p>the <tt class="docutils literal">message()</tt> member function returns a string representation of the
│ │ │ │ -header that properly match the stats values string returned in
│ │ │ │ -<tt class="docutils literal"><span class="pre">session_stats_alert::message()</span></tt>.</p>
│ │ │ │ -<p>this specific output is parsed by tools/parse_session_stats.py
│ │ │ │ -if this is changed, that parser should also be changed</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct session_stats_header_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = {};
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="dht_sample_infohashes_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_sample_infohashes_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_sample_infohashes_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dht-sample-infohashes-alert">
│ │ │ │ -<h1>dht_sample_infohashes_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted as a response to a call to session::dht_sample_infohashes() with
│ │ │ │ -the information from the DHT response message.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_sample_infohashes_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   int <strong>num_samples</strong> () const;
│ │ │ │ -   std::vector&lt;sha1_hash&gt; <strong>samples</strong> () const;
│ │ │ │ -   int <strong>num_nodes</strong> () const;
│ │ │ │ -   std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_operation;
│ │ │ │ -   sha1_hash node_id;
│ │ │ │ -   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
│ │ │ │ -   time_duration const interval;
│ │ │ │ -   int const num_infohashes;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="samples()"></a>
│ │ │ │ -<a name="num_samples()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bsamples%28%29+num_samples%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bsamples%28%29+num_samples%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="samples-num-samples">
│ │ │ │ -<h2>samples() num_samples()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>num_samples</strong> () const;
│ │ │ │ -std::vector&lt;sha1_hash&gt; <strong>samples</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the number of info-hashes returned by the node, as well as the
│ │ │ │ -actual info-hashes. <tt class="docutils literal">num_samples()</tt> is more efficient than
│ │ │ │ -<tt class="docutils literal"><span class="pre">samples().size()</span></tt>.</p>
│ │ │ │ -<a name="num_nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnum_nodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnum_nodes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="num-nodes">
│ │ │ │ -<h2>num_nodes()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>num_nodes</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>The total number of nodes returned by <tt class="docutils literal">nodes()</tt>.</p>
│ │ │ │ -<a name="nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnodes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="nodes-1">
│ │ │ │ -<h2>nodes()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>This is the set of more DHT nodes returned by the request.</p>
│ │ │ │ -<p>The information is included so that indexing nodes can perform a key
│ │ │ │ -space traversal with a single RPC per node by adjusting the target
│ │ │ │ -value for each RPC.</p>
│ │ │ │ -<a name="node_id"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnode_id%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnode_id%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>node_id</dt>
│ │ │ │ -<dd>id of the node the request was sent to (and this response was received from)</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>endpoint</dt>
│ │ │ │ -<dd>the node the request was sent to (and this response was received from)</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="interval"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Binterval%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Binterval%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>interval</dt>
│ │ │ │ -<dd>the interval to wait before making another request to this node</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_infohashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnum_infohashes%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnum_infohashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_infohashes</dt>
│ │ │ │ -<dd>This field indicates how many info-hash keys are currently in the node's storage.
│ │ │ │ -If the value is larger than the number of returned samples it indicates that the
│ │ │ │ -indexer may obtain additional samples after waiting out the interval.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="block_uploaded_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_uploaded_alert&labels=documentation&body=Documentation+under+heading+%22class+block_uploaded_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="block-uploaded-alert">
│ │ │ │ -<h1>block_uploaded_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when a block intended to be sent to a peer is placed in the
│ │ │ │ -send buffer. Note that if the connection is closed before the send buffer is sent,
│ │ │ │ -the <a class="reference external" href="reference-Alerts.html#alert">alert</a> may be posted without the bytes having been sent to the peer.
│ │ │ │ -It belongs to the <tt class="docutils literal"><span class="pre">alert_category::upload</span></tt> category.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct block_uploaded_alert final : peer_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   int const block_index;
│ │ │ │ -   piece_index_t const piece_index;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="alerts_dropped_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+alerts_dropped_alert&labels=documentation&body=Documentation+under+heading+%22class+alerts_dropped_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="alerts-dropped-alert">
│ │ │ │ -<h1>alerts_dropped_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted to indicate to the client that some alerts were
│ │ │ │ -dropped. Dropped meaning that the <a class="reference external" href="reference-Alerts.html#alert">alert</a> failed to be delivered to the
│ │ │ │ -client. The most common cause of such failure is that the internal <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -queue grew too big (controlled by alert_queue_size).</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct alerts_dropped_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -   <strong>static_assert</strong> (num_alert_types &lt;= abi_alert_count, &quot;need to increase bitset. This is an ABI break&quot;);
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ -   std::bitset&lt;abi_alert_count&gt; dropped_alerts;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="dropped_alerts"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alerts_dropped_alert%3A%3A%5Bdropped_alerts%5D&labels=documentation&body=Documentation+under+heading+%22alerts_dropped_alert%3A%3A%5Bdropped_alerts%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>dropped_alerts</dt>
│ │ │ │ -<dd>a bitmask indicating which alerts were dropped. Each bit represents the
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#alert">alert</a> type ID, where bit 0 represents whether any <a class="reference external" href="reference-Alerts.html#alert">alert</a> of type 0 has
│ │ │ │ -been dropped, and so on.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="socks5_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+socks5_alert&labels=documentation&body=Documentation+under+heading+%22class+socks5_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="socks5-alert">
│ │ │ │ -<h1>socks5_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted with SOCKS5 related errors, when a SOCKS5 proxy is
│ │ │ │ -configured. It's enabled with the alert_category::error <a class="reference external" href="reference-Alerts.html#alert">alert</a> category.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct socks5_alert final : alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ -   error_code error;
│ │ │ │ -   operation_t op;
│ │ │ │ -   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; ip;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks5_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22socks5_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks5_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22socks5_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>op</dt>
│ │ │ │ -<dd>the operation that failed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="ip"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks5_alert%3A%3A%5Bip%5D&labels=documentation&body=Documentation+under+heading+%22socks5_alert%3A%3A%5Bip%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>ip</dt>
│ │ │ │ -<dd>the endpoint configured as the proxy</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_prio_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_prio_alert&labels=documentation&body=Documentation+under+heading+%22class+file_prio_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-prio-alert">
│ │ │ │ -<h1>file_prio_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted when a <a class="reference external" href="reference-Torrent_Handle.html#prioritize_files()">prioritize_files()</a> or <a class="reference external" href="reference-Torrent_Handle.html#file_priority()">file_priority()</a> update of the file
│ │ │ │ -priorities complete, which requires a round-trip to the disk thread.</p>
│ │ │ │ -<p>If the disk operation fails this <a class="reference external" href="reference-Alerts.html#alert">alert</a> won't be posted, but a
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#file_error_alert">file_error_alert</a> is posted instead, and the torrent is stopped.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct file_prio_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ -   error_code error;
│ │ │ │ -   operation_t op;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_prio_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22file_prio_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd>the error</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_prio_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22file_prio_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>op</dt>
│ │ │ │ -<dd>the operation that failed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="oversized_file_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+oversized_file_alert&labels=documentation&body=Documentation+under+heading+%22class+oversized_file_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="oversized-file-alert">
│ │ │ │ -<h1>oversized_file_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> may be posted when the initial checking of resume data and files
│ │ │ │ -on disk (just existence, not piece hashes) completes. If a file belonging
│ │ │ │ -to the torrent is found on disk, but is larger than the file in the
│ │ │ │ -torrent, that's when this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted.
│ │ │ │ -the client may want to call <a class="reference external" href="reference-Core.html#truncate_files()">truncate_files()</a> in that case, or perhaps
│ │ │ │ -interpret it as a sign that some other file is in the way, that shouldn't
│ │ │ │ -be overwritten.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct oversized_file_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="torrent_conflict_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_conflict_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_conflict_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-conflict-alert">
│ │ │ │ -<h1>torrent_conflict_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when two separate torrents (magnet links) resolve to
│ │ │ │ -the same torrent, thus causing the same torrent being added twice. In
│ │ │ │ -that case, both torrents enter an error state with <tt class="docutils literal">duplicate_torrent</tt>
│ │ │ │ -as the error code. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted containing the metadata. For more
│ │ │ │ -information, see <a class="reference external" href="manual-ref.html#bittorrent-v2-torrents">BitTorrent v2 torrents</a>.
│ │ │ │ -The torrent this <a class="reference external" href="reference-Alerts.html#alert">alert</a> originated from was the one that downloaded the</p>
│ │ │ │ -<p>metadata (i.e. the <cite>handle</cite> member from the <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a> base class).</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_conflict_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ -   torrent_handle conflicting_torrent;
│ │ │ │ -   std::shared_ptr&lt;torrent_info&gt; metadata;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="conflicting_torrent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_conflict_alert%3A%3A%5Bconflicting_torrent%5D&labels=documentation&body=Documentation+under+heading+%22torrent_conflict_alert%3A%3A%5Bconflicting_torrent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>conflicting_torrent</dt>
│ │ │ │ -<dd>the handle to the torrent in conflict. The swarm associated with this
│ │ │ │ -torrent handle did not download the metadata, but the downloaded
│ │ │ │ -metadata collided with this swarm's info-hash.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="metadata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_conflict_alert%3A%3A%5Bmetadata%5D&labels=documentation&body=Documentation+under+heading+%22torrent_conflict_alert%3A%3A%5Bmetadata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>metadata</dt>
│ │ │ │ -<dd>the metadata that was received by one of the torrents in conflict.
│ │ │ │ -One way to resolve the conflict is to remove both failing torrents
│ │ │ │ -and re-add it using this metadata</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="peer_info_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_info_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_info_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="peer-info-alert">
│ │ │ │ -<h1>peer_info_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_peer_info()">torrent_handle::post_peer_info()</a> is called</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_info_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -   std::vector&lt;lt::peer_info&gt; peer_info;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="peer_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info_alert%3A%3A%5Bpeer_info%5D&labels=documentation&body=Documentation+under+heading+%22peer_info_alert%3A%3A%5Bpeer_info%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>peer_info</dt>
│ │ │ │ -<dd>the list of the currently connected peers</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_progress_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_progress_alert&labels=documentation&body=Documentation+under+heading+%22class+file_progress_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-progress-alert">
│ │ │ │ -<h1>file_progress_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_file_progress()">torrent_handle::post_file_progress()</a> is called</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct file_progress_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::file_progress;
│ │ │ │ -   aux::vector&lt;std::int64_t, file_index_t&gt; files;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="files"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_progress_alert%3A%3A%5Bfiles%5D&labels=documentation&body=Documentation+under+heading+%22file_progress_alert%3A%3A%5Bfiles%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>files</dt>
│ │ │ │ -<dd>the list of the files in the torrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="piece_info_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_info_alert&labels=documentation&body=Documentation+under+heading+%22class+piece_info_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-info-alert">
│ │ │ │ -<h1>piece_info_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_download_queue()">torrent_handle::post_download_queue()</a> is called</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct piece_info_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::piece_progress;
│ │ │ │ -   std::vector&lt;partial_piece_info&gt; piece_info;
│ │ │ │ -   std::vector&lt;block_info&gt; block_data;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="piece_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_info_alert%3A%3A%5Bpiece_info%5D&labels=documentation&body=Documentation+under+heading+%22piece_info_alert%3A%3A%5Bpiece_info%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>piece_info</dt>
│ │ │ │ -<dd>info about pieces being downloaded for the torrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="block_data"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_info_alert%3A%3A%5Bblock_data%5D&labels=documentation&body=Documentation+under+heading+%22piece_info_alert%3A%3A%5Bblock_data%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>block_data</dt>
│ │ │ │ -<dd>storage for <a class="reference external" href="reference-Torrent_Handle.html#block_info">block_info</a> pointers in <a class="reference external" href="reference-Torrent_Handle.html#partial_piece_info">partial_piece_info</a> objects</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="piece_availability_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_availability_alert&labels=documentation&body=Documentation+under+heading+%22class+piece_availability_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-availability-alert">
│ │ │ │ -<h1>piece_availability_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_piece_availability()">torrent_handle::post_piece_availability()</a> is called</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct piece_availability_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -   std::vector&lt;int&gt; piece_availability;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="piece_availability"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_availability_alert%3A%3A%5Bpiece_availability%5D&labels=documentation&body=Documentation+under+heading+%22piece_availability_alert%3A%3A%5Bpiece_availability%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>piece_availability</dt>
│ │ │ │ -<dd>info about pieces being downloaded for the torrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="tracker_list_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_list_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_list_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="tracker-list-alert">
│ │ │ │ -<h1>tracker_list_alert</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_trackers()">torrent_handle::post_trackers()</a> is called</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct tracker_list_alert final : torrent_alert
│ │ │ │ -{
│ │ │ │ -   std::string <strong>message</strong> () const override;
│ │ │ │ -
│ │ │ │ -   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ -   std::vector&lt;announce_entry&gt; trackers;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="trackers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_list_alert%3A%3A%5Btrackers%5D&labels=documentation&body=Documentation+under+heading+%22tracker_list_alert%3A%3A%5Btrackers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>trackers</dt>
│ │ │ │ -<dd>list of trackers and their status for the torrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_cast()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert_cast%28%29&labels=documentation&body=Documentation+under+heading+%22alert_cast%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="alert-cast">
│ │ │ │ -<h1>alert_cast()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -template &lt;typename T&gt; T const* <strong>alert_cast</strong> (alert const* a);
│ │ │ │ -template &lt;typename T&gt; T* <strong>alert_cast</strong> (alert* a);
│ │ │ │ -</pre>
│ │ │ │ -<p>When you get an <a class="reference external" href="reference-Alerts.html#alert">alert</a>, you can use <tt class="docutils literal">alert_cast&lt;&gt;</tt> to attempt to cast the
│ │ │ │ -pointer to a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> type, in order to query it for more
│ │ │ │ -information.</p>
│ │ │ │ -<div class="admonition note">
│ │ │ │ -<p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last"><tt class="docutils literal">alert_cast&lt;&gt;</tt> can only cast to an exact <a class="reference external" href="reference-Alerts.html#alert">alert</a> type, not a base class</p>
│ │ │ │ -</div>
│ │ │ │ -<a name="operation_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:operation_name%28%29&labels=documentation&body=Documentation+under+heading+%22operation_name%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="operation-name">
│ │ │ │ -<h1>operation_name()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/operations.hpp">libtorrent/operations.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char const* <strong>operation_name</strong> (operation_t op);
│ │ │ │ -</pre>
│ │ │ │ -<p>maps an operation id (from <a class="reference external" href="reference-Alerts.html#peer_error_alert">peer_error_alert</a> and <a class="reference external" href="reference-Alerts.html#peer_disconnected_alert">peer_disconnected_alert</a>)
│ │ │ │ -to its name. See <a class="reference external" href="reference-Alerts.html#operation_t">operation_t</a> for the constants</p>
│ │ │ │ -<a name="operation_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+operation_t&labels=documentation&body=Documentation+under+heading+%22enum+operation_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-operation-t">
│ │ │ │ -<h1>enum operation_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/operations.hpp">libtorrent/operations.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="21%" />
│ │ │ │ -<col width="7%" />
│ │ │ │ -<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>unknown</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>the error was unexpected and it is unknown which operation caused it</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>bittorrent</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>this is used when the bittorrent logic
│ │ │ │ -determines to disconnect</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>iocontrol</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>a call to iocontrol failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>getpeername</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>a call to <tt class="docutils literal">getpeername()</tt> failed (querying the remote IP of a
│ │ │ │ -connection)</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>getname</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>a call to getname failed (querying the local IP of a
│ │ │ │ -connection)</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>alloc_recvbuf</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>an attempt to allocate a receive buffer failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>alloc_sndbuf</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>an attempt to allocate a send buffer failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_write</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>writing to a file failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_read</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>reading from a file failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file</td>
│ │ │ │ -<td>9</td>
│ │ │ │ -<td>a non-read and non-write file operation failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>sock_write</td>
│ │ │ │ -<td>10</td>
│ │ │ │ -<td>a socket write operation failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>sock_read</td>
│ │ │ │ -<td>11</td>
│ │ │ │ -<td>a socket read operation failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>sock_open</td>
│ │ │ │ -<td>12</td>
│ │ │ │ -<td>a call to open(), to create a socket socket failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>sock_bind</td>
│ │ │ │ -<td>13</td>
│ │ │ │ -<td>a call to bind() on a socket failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>available</td>
│ │ │ │ -<td>14</td>
│ │ │ │ -<td>an attempt to query the number of bytes available to read from a socket
│ │ │ │ -failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>encryption</td>
│ │ │ │ -<td>15</td>
│ │ │ │ -<td>a call related to bittorrent protocol encryption failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>connect</td>
│ │ │ │ -<td>16</td>
│ │ │ │ -<td>an attempt to connect a socket failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>ssl_handshake</td>
│ │ │ │ -<td>17</td>
│ │ │ │ -<td>establishing an SSL connection failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>get_interface</td>
│ │ │ │ -<td>18</td>
│ │ │ │ -<td>a connection failed to satisfy the bind interface setting</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>sock_listen</td>
│ │ │ │ -<td>19</td>
│ │ │ │ -<td>a call to listen() on a socket</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>sock_bind_to_device</td>
│ │ │ │ -<td>20</td>
│ │ │ │ -<td>a call to the ioctl to bind a socket to a specific network device or
│ │ │ │ -adapter</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>sock_accept</td>
│ │ │ │ -<td>21</td>
│ │ │ │ -<td>a call to accept() on a socket</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>parse_address</td>
│ │ │ │ -<td>22</td>
│ │ │ │ -<td>convert a string into a valid network address</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>enum_if</td>
│ │ │ │ -<td>23</td>
│ │ │ │ -<td>enumeration network devices or adapters</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_stat</td>
│ │ │ │ -<td>24</td>
│ │ │ │ -<td>invoking stat() on a file</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_copy</td>
│ │ │ │ -<td>25</td>
│ │ │ │ -<td>copying a file</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_fallocate</td>
│ │ │ │ -<td>26</td>
│ │ │ │ -<td>allocating storage for a file</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_hard_link</td>
│ │ │ │ -<td>27</td>
│ │ │ │ -<td>creating a hard link</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_remove</td>
│ │ │ │ -<td>28</td>
│ │ │ │ -<td>removing a file</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_rename</td>
│ │ │ │ -<td>29</td>
│ │ │ │ -<td>renaming a file</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_open</td>
│ │ │ │ -<td>30</td>
│ │ │ │ -<td>opening a file</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>mkdir</td>
│ │ │ │ -<td>31</td>
│ │ │ │ -<td>creating a directory</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>check_resume</td>
│ │ │ │ -<td>32</td>
│ │ │ │ -<td>check fast resume data against files on disk</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>exception</td>
│ │ │ │ -<td>33</td>
│ │ │ │ -<td>an unknown exception</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>alloc_cache_piece</td>
│ │ │ │ -<td>34</td>
│ │ │ │ -<td>allocate space for a piece in the cache</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>partfile_move</td>
│ │ │ │ -<td>35</td>
│ │ │ │ -<td>move a part-file</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>partfile_read</td>
│ │ │ │ -<td>36</td>
│ │ │ │ -<td>read from a part file</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>partfile_write</td>
│ │ │ │ -<td>37</td>
│ │ │ │ -<td>write to a part-file</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>hostname_lookup</td>
│ │ │ │ -<td>38</td>
│ │ │ │ -<td>a hostname lookup</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>symlink</td>
│ │ │ │ -<td>39</td>
│ │ │ │ -<td>create or read a symlink</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>handshake</td>
│ │ │ │ -<td>40</td>
│ │ │ │ -<td>handshake with a peer or server</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>sock_option</td>
│ │ │ │ -<td>41</td>
│ │ │ │ -<td>set socket option</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>enum_route</td>
│ │ │ │ -<td>42</td>
│ │ │ │ -<td>enumeration of network routes</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_seek</td>
│ │ │ │ -<td>43</td>
│ │ │ │ -<td>moving read/write position in a file, <a class="reference external" href="reference-Alerts.html#hostname_lookup">operation_t::hostname_lookup</a></td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>timer</td>
│ │ │ │ -<td>44</td>
│ │ │ │ -<td>an async wait operation on a timer</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_mmap</td>
│ │ │ │ -<td>45</td>
│ │ │ │ -<td>call to mmap() (or windows counterpart)</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_truncate</td>
│ │ │ │ -<td>46</td>
│ │ │ │ -<td>call to ftruncate() (or SetEndOfFile() on windows)</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="alert_category_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert_category_t&labels=documentation&body=Documentation+under+heading+%22alert_category_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="alert-category-t">
│ │ │ │ -<h1>alert_category_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
│ │ │ │ -<a name="alert_category_t::error"></a><dl class="docutils">
│ │ │ │ -<dt>error</dt>
│ │ │ │ -<dd><p class="first">Enables alerts that report an error. This includes:</p>
│ │ │ │ -<ul class="last simple">
│ │ │ │ -<li>tracker errors</li>
│ │ │ │ -<li>tracker warnings</li>
│ │ │ │ -<li>file errors</li>
│ │ │ │ -<li>resume data failures</li>
│ │ │ │ -<li>web seed errors</li>
│ │ │ │ -<li>.torrent files errors</li>
│ │ │ │ -<li>listen socket errors</li>
│ │ │ │ -<li>port mapping errors</li>
│ │ │ │ -</ul>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::peer"></a><dl class="docutils">
│ │ │ │ -<dt>peer</dt>
│ │ │ │ -<dd>Enables alerts when peers send invalid requests, get banned or
│ │ │ │ -snubbed.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::port_mapping"></a><dl class="docutils">
│ │ │ │ -<dt>port_mapping</dt>
│ │ │ │ -<dd>Enables alerts for port mapping events. For NAT-PMP and UPnP.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::storage"></a><dl class="docutils">
│ │ │ │ -<dt>storage</dt>
│ │ │ │ -<dd>Enables alerts for events related to the storage. File errors and
│ │ │ │ -synchronization events for moving the storage, renaming files etc.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::tracker"></a><dl class="docutils">
│ │ │ │ -<dt>tracker</dt>
│ │ │ │ -<dd>Enables all tracker events. Includes announcing to trackers,
│ │ │ │ -receiving responses, warnings and errors.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::connect"></a><dl class="docutils">
│ │ │ │ -<dt>connect</dt>
│ │ │ │ -<dd>Low level alerts for when peers are connected and disconnected.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::status"></a><dl class="docutils">
│ │ │ │ -<dt>status</dt>
│ │ │ │ -<dd>Enables alerts for when a torrent or the <a class="reference external" href="reference-Session.html#session">session</a> changes state.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::ip_block"></a><dl class="docutils">
│ │ │ │ -<dt>ip_block</dt>
│ │ │ │ -<dd>Alerts when a peer is blocked by the ip blocker or port blocker.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::performance_warning"></a><dl class="docutils">
│ │ │ │ -<dt>performance_warning</dt>
│ │ │ │ -<dd>Alerts when some limit is reached that might limit the download
│ │ │ │ -or upload rate.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::dht"></a><dl class="docutils">
│ │ │ │ -<dt>dht</dt>
│ │ │ │ -<dd>Alerts on events in the DHT node. For incoming searches or
│ │ │ │ -bootstrapping being done etc.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::stats"></a><dl class="docutils">
│ │ │ │ -<dt>stats</dt>
│ │ │ │ -<dd>If you enable these alerts, you will receive a stats_alert
│ │ │ │ -approximately once every second, for every active torrent.
│ │ │ │ -These alerts contain all statistics <a class="reference external" href="reference-Stats.html#counters">counters</a> for the interval since
│ │ │ │ -the lasts stats <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::session_log"></a><dl class="docutils">
│ │ │ │ -<dt>session_log</dt>
│ │ │ │ -<dd>Enables debug logging alerts. These are available unless libtorrent
│ │ │ │ -was built with logging disabled (<tt class="docutils literal">TORRENT_DISABLE_LOGGING</tt>). The
│ │ │ │ -alerts being posted are <a class="reference external" href="reference-Alerts.html#log_alert">log_alert</a> and are <a class="reference external" href="reference-Session.html#session">session</a> wide.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::torrent_log"></a><dl class="docutils">
│ │ │ │ -<dt>torrent_log</dt>
│ │ │ │ -<dd>Enables debug logging alerts for torrents. These are available
│ │ │ │ -unless libtorrent was built with logging disabled
│ │ │ │ -(<tt class="docutils literal">TORRENT_DISABLE_LOGGING</tt>). The alerts being posted are
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#torrent_log_alert">torrent_log_alert</a> and are torrent wide debug events.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::peer_log"></a><dl class="docutils">
│ │ │ │ -<dt>peer_log</dt>
│ │ │ │ -<dd>Enables debug logging alerts for peers. These are available unless
│ │ │ │ -libtorrent was built with logging disabled
│ │ │ │ -(<tt class="docutils literal">TORRENT_DISABLE_LOGGING</tt>). The alerts being posted are
│ │ │ │ -<a class="reference external" href="reference-Alerts.html#peer_log_alert">peer_log_alert</a> and low-level peer events and messages.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::incoming_request"></a><dl class="docutils">
│ │ │ │ -<dt>incoming_request</dt>
│ │ │ │ -<dd>enables the <a class="reference external" href="reference-Alerts.html#incoming_request_alert">incoming_request_alert</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::dht_log"></a><dl class="docutils">
│ │ │ │ -<dt>dht_log</dt>
│ │ │ │ -<dd>enables <a class="reference external" href="reference-Alerts.html#dht_log_alert">dht_log_alert</a>, debug logging for the DHT</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::dht_operation"></a><dl class="docutils">
│ │ │ │ -<dt>dht_operation</dt>
│ │ │ │ -<dd>enable events from pure dht operations not related to torrents</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::port_mapping_log"></a><dl class="docutils">
│ │ │ │ -<dt>port_mapping_log</dt>
│ │ │ │ -<dd>enables port mapping log events. This log is useful
│ │ │ │ -for debugging the UPnP or NAT-PMP implementation</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::picker_log"></a><dl class="docutils">
│ │ │ │ -<dt>picker_log</dt>
│ │ │ │ -<dd>enables verbose logging from the piece picker.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::file_progress"></a><dl class="docutils">
│ │ │ │ -<dt>file_progress</dt>
│ │ │ │ -<dd>alerts when files complete downloading</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::piece_progress"></a><dl class="docutils">
│ │ │ │ -<dt>piece_progress</dt>
│ │ │ │ -<dd>alerts when pieces complete downloading or fail hash check</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::upload"></a><dl class="docutils">
│ │ │ │ -<dt>upload</dt>
│ │ │ │ -<dd>alerts when we upload blocks to other peers</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::block_progress"></a><dl class="docutils">
│ │ │ │ -<dt>block_progress</dt>
│ │ │ │ -<dd>alerts on individual blocks being requested, downloading, finished,
│ │ │ │ -rejected, time-out and cancelled. This is likely to post alerts at a
│ │ │ │ -high rate.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_category_t::all"></a><dl class="docutils">
│ │ │ │ -<dt>all</dt>
│ │ │ │ -<dd><p class="first">The full bitmask, representing all available categories.</p>
│ │ │ │ -<p class="last">since the enum is signed, make sure this isn't
│ │ │ │ -interpreted as -1. For instance, boost.python
│ │ │ │ -does that and fails when assigning it to an
│ │ │ │ -unsigned parameter.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="int"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:int&labels=documentation&body=Documentation+under+heading+%22int%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="int-1">
│ │ │ │ -<h1>int</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ -<a name="int::user_alert_id"></a><dl class="docutils">
│ │ │ │ -<dt>user_alert_id</dt>
│ │ │ │ -<dd>user defined alerts should use IDs greater than this</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="int::num_alert_types"></a><dl class="docutils">
│ │ │ │ -<dt>num_alert_types</dt>
│ │ │ │ -<dd>this constant represents &quot;max_alert_index&quot; + 1</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="storage_params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_params&labels=documentation&body=Documentation+under+heading+%22class+storage_params%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="storage-params">
│ │ │ │ -<h1>storage_params</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/storage_defs.hpp">libtorrent/storage_defs.hpp</a>&quot;</p>
│ │ │ │ -<p>a parameter pack used to construct the storage for a torrent, used in
│ │ │ │ -<a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a></p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct storage_params
│ │ │ │ -{
│ │ │ │ -   <strong>storage_params</strong> (file_storage const&amp; f, file_storage const* mf
│ │ │ │ -      , std::string const&amp; sp, storage_mode_t const sm
│ │ │ │ -      , aux::vector&lt;download_priority_t, file_index_t&gt; const&amp; prio
│ │ │ │ -      , sha1_hash const&amp; ih);
│ │ │ │ -
│ │ │ │ -   file_storage const&amp; files;
│ │ │ │ -   file_storage const* <strong>mapped_files</strong>  = nullptr;
│ │ │ │ -   std::string const&amp; path;
│ │ │ │ -   storage_mode_t <strong>mode</strong> {storage_mode_sparse};
│ │ │ │ -   aux::vector&lt;download_priority_t, file_index_t&gt; const&amp; priorities;
│ │ │ │ -   sha1_hash info_hash;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="file_slice"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_slice&labels=documentation&body=Documentation+under+heading+%22class+file_slice%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-slice">
│ │ │ │ -<h1>file_slice</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/file_storage.hpp">libtorrent/file_storage.hpp</a>&quot;</p>
│ │ │ │ -<p>represents a window of a file in a torrent.</p>
│ │ │ │ -<p>The <tt class="docutils literal">file_index</tt> refers to the index of the file (in the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>).
│ │ │ │ -To get the path and filename, use <tt class="docutils literal">file_path()</tt> and give the <tt class="docutils literal">file_index</tt>
│ │ │ │ -as argument. The <tt class="docutils literal">offset</tt> is the byte offset in the file where the range
│ │ │ │ -starts, and <tt class="docutils literal">size</tt> is the number of bytes this range is. The size + offset
│ │ │ │ -will never be greater than the file size.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct file_slice
│ │ │ │ -{
│ │ │ │ -   file_index_t file_index;
│ │ │ │ -   std::int64_t offset;
│ │ │ │ -   std::int64_t size;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="file_index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_slice%3A%3A%5Bfile_index%5D&labels=documentation&body=Documentation+under+heading+%22file_slice%3A%3A%5Bfile_index%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>file_index</dt>
│ │ │ │ -<dd>the index of the file</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="offset"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_slice%3A%3A%5Boffset%5D&labels=documentation&body=Documentation+under+heading+%22file_slice%3A%3A%5Boffset%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>offset</dt>
│ │ │ │ -<dd>the offset from the start of the file, in bytes</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="size"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_slice%3A%3A%5Bsize%5D&labels=documentation&body=Documentation+under+heading+%22file_slice%3A%3A%5Bsize%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>size</dt>
│ │ │ │ -<dd>the size of the window, in bytes</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_storage"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_storage&labels=documentation&body=Documentation+under+heading+%22class+file_storage%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-storage">
│ │ │ │ -<h1>file_storage</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/file_storage.hpp">libtorrent/file_storage.hpp</a>&quot;</p>
│ │ │ │ -<p>The <tt class="docutils literal">file_storage</tt> class represents a file list and the piece
│ │ │ │ -size. Everything necessary to interpret a regular bittorrent storage
│ │ │ │ -file structure.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -class file_storage
│ │ │ │ -{
│ │ │ │ -   bool <strong>is_valid</strong> () const;
│ │ │ │ -   void <strong>reserve</strong> (int num_files);
│ │ │ │ -   void <strong>add_file_borrow</strong> (string_view filename
│ │ │ │ -      , std::string const&amp; path, std::int64_t file_size
│ │ │ │ -      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ -      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ -   void <strong>add_file_borrow</strong> (error_code&amp; ec, string_view filename
│ │ │ │ -      , std::string const&amp; path, std::int64_t file_size
│ │ │ │ -      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ -      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ -   void <strong>add_file</strong> (std::string const&amp; path, std::int64_t file_size
│ │ │ │ -      , file_flags_t file_flags = {}
│ │ │ │ -      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ -   void <strong>add_file</strong> (error_code&amp; ec, std::string const&amp; path, std::int64_t file_size
│ │ │ │ -      , file_flags_t file_flags = {}
│ │ │ │ -      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ -   void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │ -   std::vector&lt;file_slice&gt; <strong>map_block</strong> (piece_index_t piece, std::int64_t offset
│ │ │ │ -      , std::int64_t size) const;
│ │ │ │ -   peer_request <strong>map_file</strong> (file_index_t file, std::int64_t offset, int size) const;
│ │ │ │ -   int <strong>num_files</strong> () const noexcept;
│ │ │ │ -   file_index_t <strong>end_file</strong> () const noexcept;
│ │ │ │ -   index_range&lt;file_index_t&gt; <strong>file_range</strong> () const noexcept;
│ │ │ │ -   std::int64_t <strong>total_size</strong> () const;
│ │ │ │ -   int <strong>num_pieces</strong> () const;
│ │ │ │ -   void <strong>set_num_pieces</strong> (int n);
│ │ │ │ -   piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ -   piece_index_t <strong>last_piece</strong> () const;
│ │ │ │ -   index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │ -   int <strong>piece_length</strong> () const;
│ │ │ │ -   void <strong>set_piece_length</strong> (int l);
│ │ │ │ -   int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │ -   int <strong>piece_size2</strong> (piece_index_t index) const;
│ │ │ │ -   int <strong>blocks_in_piece2</strong> (piece_index_t index) const;
│ │ │ │ -   int <strong>blocks_per_piece</strong> () const;
│ │ │ │ -   std::string const&amp; <strong>name</strong> () const;
│ │ │ │ -   void <strong>set_name</strong> (std::string const&amp; n);
│ │ │ │ -   void <strong>swap</strong> (file_storage&amp; ti) noexcept;
│ │ │ │ -   void <strong>canonicalize</strong> ();
│ │ │ │ -   bool <strong>pad_file_at</strong> (file_index_t index) const;
│ │ │ │ -   std::int64_t <strong>file_size</strong> (file_index_t index) const;
│ │ │ │ -   std::int64_t <strong>file_offset</strong> (file_index_t index) const;
│ │ │ │ -   std::string <strong>symlink</strong> (file_index_t index) const;
│ │ │ │ -   sha256_hash <strong>root</strong> (file_index_t index) const;
│ │ │ │ -   string_view <strong>file_name</strong> (file_index_t index) const;
│ │ │ │ -   std::string <strong>file_path</strong> (file_index_t index, std::string const&amp; save_path = &quot;&quot;) const;
│ │ │ │ -   std::time_t <strong>mtime</strong> (file_index_t index) const;
│ │ │ │ -   char const* <strong>root_ptr</strong> (file_index_t const index) const;
│ │ │ │ -   sha1_hash <strong>hash</strong> (file_index_t index) const;
│ │ │ │ -   index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t) const;
│ │ │ │ -   int <strong>file_num_pieces</strong> (file_index_t index) const;
│ │ │ │ -   int <strong>file_num_blocks</strong> (file_index_t index) const;
│ │ │ │ -   int <strong>file_first_block_node</strong> (file_index_t index) const;
│ │ │ │ -   int <strong>file_first_piece_node</strong> (file_index_t index) const;
│ │ │ │ -   std::uint32_t <strong>file_path_hash</strong> (file_index_t index, std::string const&amp; save_path) const;
│ │ │ │ -   void <strong>all_path_hashes</strong> (std::unordered_set&lt;std::uint32_t&gt;&amp; table) const;
│ │ │ │ -   file_flags_t <strong>file_flags</strong> (file_index_t index) const;
│ │ │ │ -   bool <strong>file_absolute_path</strong> (file_index_t index) const;
│ │ │ │ -   file_index_t <strong>file_index_at_offset</strong> (std::int64_t offset) const;
│ │ │ │ -   file_index_t <strong>file_index_at_piece</strong> (piece_index_t piece) const;
│ │ │ │ -   file_index_t <strong>file_index_for_root</strong> (sha256_hash const&amp; root_hash) const;
│ │ │ │ -   piece_index_t <strong>piece_index_at_file</strong> (file_index_t f) const;
│ │ │ │ -   void <strong>sanitize_symlinks</strong> ();
│ │ │ │ -   bool <strong>v2</strong> () const;
│ │ │ │ -
│ │ │ │ -   static constexpr file_flags_t <strong>flag_pad_file</strong>  = 0_bit;
│ │ │ │ -   static constexpr file_flags_t <strong>flag_hidden</strong>  = 1_bit;
│ │ │ │ -   static constexpr file_flags_t <strong>flag_executable</strong>  = 2_bit;
│ │ │ │ -   static constexpr file_flags_t <strong>flag_symlink</strong>  = 3_bit;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="is_valid()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bis_valid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bis_valid%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="is-valid-3">
│ │ │ │ -<h2>is_valid()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>is_valid</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if the piece length has been initialized
│ │ │ │ -on the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>. This is typically taken as a proxy
│ │ │ │ -of whether the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> as a whole is initialized or
│ │ │ │ -not.</p>
│ │ │ │ -<a name="reserve()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Breserve%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Breserve%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="reserve">
│ │ │ │ -<h2>reserve()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>reserve</strong> (int num_files);
│ │ │ │ -</pre>
│ │ │ │ -<p>allocates space for <tt class="docutils literal">num_files</tt> in the internal file list. This can
│ │ │ │ -be used to avoid reallocating the internal file list when the number
│ │ │ │ -of files to be added is known up-front.</p>
│ │ │ │ -<a name="add_file()"></a>
│ │ │ │ -<a name="add_file_borrow()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Badd_file%28%29+add_file_borrow%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Badd_file%28%29+add_file_borrow%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-file-add-file-borrow">
│ │ │ │ -<h2>add_file() add_file_borrow()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_file_borrow</strong> (string_view filename
│ │ │ │ -      , std::string const&amp; path, std::int64_t file_size
│ │ │ │ -      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ -      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ -void <strong>add_file_borrow</strong> (error_code&amp; ec, string_view filename
│ │ │ │ -      , std::string const&amp; path, std::int64_t file_size
│ │ │ │ -      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ -      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ -void <strong>add_file</strong> (std::string const&amp; path, std::int64_t file_size
│ │ │ │ -      , file_flags_t file_flags = {}
│ │ │ │ -      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ -void <strong>add_file</strong> (error_code&amp; ec, std::string const&amp; path, std::int64_t file_size
│ │ │ │ -      , file_flags_t file_flags = {}
│ │ │ │ -      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ -</pre>
│ │ │ │ -<p>Adds a file to the file storage. The <tt class="docutils literal">add_file_borrow</tt> version
│ │ │ │ -expects that <tt class="docutils literal">filename</tt> is the file name (without a path) of
│ │ │ │ -the file that's being added.
│ │ │ │ -This memory is <em>borrowed</em>, i.e. it is the caller's
│ │ │ │ -responsibility to make sure it stays valid throughout the lifetime
│ │ │ │ -of this <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object or any copy of it. The same thing applies
│ │ │ │ -to <tt class="docutils literal">filehash</tt>, which is an optional pointer to a 20 byte binary
│ │ │ │ -SHA-1 hash of the file.</p>
│ │ │ │ -<p>if <tt class="docutils literal">filename</tt> is empty, the filename from <tt class="docutils literal">path</tt> is used and not
│ │ │ │ -borrowed.</p>
│ │ │ │ -<p>The <tt class="docutils literal">path</tt> argument is the full path (in the torrent file) to
│ │ │ │ -the file to add. Note that this is not supposed to be an absolute
│ │ │ │ -path, but it is expected to include the name of the torrent as the
│ │ │ │ -first path element.</p>
│ │ │ │ -<p><tt class="docutils literal">file_size</tt> is the size of the file in bytes.</p>
│ │ │ │ -<p>The <tt class="docutils literal">file_flags</tt> argument sets attributes on the file. The file
│ │ │ │ -attributes is an extension and may not work in all bittorrent clients.</p>
│ │ │ │ -<p>For possible file attributes, see file_storage::flags_t.</p>
│ │ │ │ -<p>The <tt class="docutils literal">mtime</tt> argument is optional and can be set to 0. If non-zero,
│ │ │ │ -it is the posix time of the last modification time of this file.</p>
│ │ │ │ -<p><tt class="docutils literal">symlink_path</tt> is the path the file is a symlink to. To make this a
│ │ │ │ -symlink you also need to set the <a class="reference external" href="reference-Storage.html#flag_symlink">file_storage::flag_symlink</a> file flag.</p>
│ │ │ │ -<p><tt class="docutils literal">root_hash</tt> is an optional pointer to a 32 byte SHA-256 hash, being
│ │ │ │ -the merkle tree root hash for this file. This is only used for v2
│ │ │ │ -torrents. If the <tt class="docutils literal">root hash</tt> is specified for one file, it has to
│ │ │ │ -be specified for all, otherwise this function will fail.
│ │ │ │ -Note that the buffer <tt class="docutils literal">root_hash</tt> points to must out-live the
│ │ │ │ -<a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object, it will not be copied. This parameter is only
│ │ │ │ -used when <em>loading</em> torrents, that already have their file hashes
│ │ │ │ -computed. When creating torrents, the file hashes will be computed by
│ │ │ │ -the piece hashes.</p>
│ │ │ │ -<p>If more files than one are added, certain restrictions to their paths
│ │ │ │ -apply. In a multi-file file storage (torrent), all files must share
│ │ │ │ -the same root directory.</p>
│ │ │ │ -<p>That is, the first path element of all files must be the same.
│ │ │ │ -This shared path element is also set to the name of the torrent. It
│ │ │ │ -can be changed by calling <tt class="docutils literal">set_name</tt>.</p>
│ │ │ │ -<p>The overloads that take an <cite>error_code</cite> reference will report failures
│ │ │ │ -via that variable, otherwise <cite>system_error</cite> is thrown.</p>
│ │ │ │ -<a name="rename_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Brename_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Brename_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="rename-file-2">
│ │ │ │ -<h2>rename_file()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │ -</pre>
│ │ │ │ -<p>renames the file at <tt class="docutils literal">index</tt> to <tt class="docutils literal">new_filename</tt>. Keep in mind
│ │ │ │ -that filenames are expected to be UTF-8 encoded.</p>
│ │ │ │ -<a name="map_block()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bmap_block%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bmap_block%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="map-block-1">
│ │ │ │ -<h2>map_block()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::vector&lt;file_slice&gt; <strong>map_block</strong> (piece_index_t piece, std::int64_t offset
│ │ │ │ -      , std::int64_t size) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a list of <a class="reference external" href="reference-Storage.html#file_slice">file_slice</a> objects representing the portions of
│ │ │ │ -files the specified piece index, byte offset and size range overlaps.
│ │ │ │ -this is the inverse mapping of <a class="reference external" href="reference-Storage.html#map_file()">map_file()</a>.</p>
│ │ │ │ -<p>Preconditions of this function is that the input range is within the
│ │ │ │ -torrents address space. <tt class="docutils literal">piece</tt> may not be negative and</p>
│ │ │ │ -<blockquote>
│ │ │ │ -<tt class="docutils literal">piece</tt> * piece_size + <tt class="docutils literal">offset</tt> + <tt class="docutils literal">size</tt></blockquote>
│ │ │ │ -<p>may not exceed the total size of the torrent.</p>
│ │ │ │ -<a name="map_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bmap_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bmap_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="map-file-1">
│ │ │ │ -<h2>map_file()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -peer_request <strong>map_file</strong> (file_index_t file, std::int64_t offset, int size) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> representing the piece index, byte offset
│ │ │ │ -and size the specified file range overlaps. This is the inverse
│ │ │ │ -mapping over <a class="reference external" href="reference-Storage.html#map_block()">map_block()</a>. Note that the <tt class="docutils literal">peer_request</tt> return type
│ │ │ │ -is meant to hold bittorrent block requests, which may not be larger
│ │ │ │ -than 16 kiB. Mapping a range larger than that may return an overflown
│ │ │ │ -integer.</p>
│ │ │ │ -<a name="num_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bnum_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bnum_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="num-files-1">
│ │ │ │ -<h2>num_files()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>num_files</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the number of files in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a></p>
│ │ │ │ -<a name="end_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bend_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bend_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="end-file">
│ │ │ │ -<h2>end_file()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -file_index_t <strong>end_file</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the index of the one-past-end file in the file storage</p>
│ │ │ │ -<a name="file_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-range">
│ │ │ │ -<h2>file_range()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -index_range&lt;file_index_t&gt; <strong>file_range</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns an implementation-defined type that can be used as the
│ │ │ │ -container in a range-for loop. Where the values are the indices of all
│ │ │ │ -files in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │ -<a name="total_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Btotal_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Btotal_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="total-size-1">
│ │ │ │ -<h2>total_size()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::int64_t <strong>total_size</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the total number of bytes all the files in this torrent spans</p>
│ │ │ │ -<a name="num_pieces()"></a>
│ │ │ │ -<a name="set_num_pieces()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bnum_pieces%28%29+set_num_pieces%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bnum_pieces%28%29+set_num_pieces%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="num-pieces-set-num-pieces">
│ │ │ │ -<h2>num_pieces() set_num_pieces()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>num_pieces</strong> () const;
│ │ │ │ -void <strong>set_num_pieces</strong> (int n);
│ │ │ │ -</pre>
│ │ │ │ -<p>set and get the number of pieces in the torrent</p>
│ │ │ │ -<a name="end_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bend_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bend_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="end-piece">
│ │ │ │ -<h2>end_piece()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the index of the one-past-end piece in the file storage</p>
│ │ │ │ -<a name="last_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Blast_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Blast_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="last-piece">
│ │ │ │ -<h2>last_piece()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -piece_index_t <strong>last_piece</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the index of the last piece in the torrent. The last piece is
│ │ │ │ -special in that it may be smaller than the other pieces (and the other
│ │ │ │ -pieces are all the same size).</p>
│ │ │ │ -<a name="piece_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-range">
│ │ │ │ -<h2>piece_range()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns an implementation-defined type that can be used as the
│ │ │ │ -container in a range-for loop. Where the values are the indices of all
│ │ │ │ -pieces in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │ -<a name="set_piece_length()"></a>
│ │ │ │ -<a name="piece_length()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bset_piece_length%28%29+piece_length%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bset_piece_length%28%29+piece_length%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-piece-length-piece-length">
│ │ │ │ -<h2>set_piece_length() piece_length()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>piece_length</strong> () const;
│ │ │ │ -void <strong>set_piece_length</strong> (int l);
│ │ │ │ -</pre>
│ │ │ │ -<p>set and get the size of each piece in this torrent. It must be a power of two
│ │ │ │ -and at least 16 kiB.</p>
│ │ │ │ -<a name="piece_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-size-1">
│ │ │ │ -<h2>piece_size()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the piece size of <tt class="docutils literal">index</tt>. This will be the same as <a class="reference external" href="reference-Create_Torrents.html#piece_length()">piece_length()</a>, except
│ │ │ │ -for the last piece, which may be shorter.</p>
│ │ │ │ -<a name="piece_size2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_size2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_size2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-size2">
│ │ │ │ -<h2>piece_size2()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>piece_size2</strong> (piece_index_t index) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>Returns the size of the given piece. If the piece spans multiple files,
│ │ │ │ -only the first file is considered part of the piece. This is used for
│ │ │ │ -v2 torrents, where all files are piece aligned and padded. i.e. The pad
│ │ │ │ -files are not considered part of the piece for this purpose.</p>
│ │ │ │ -<a name="blocks_in_piece2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bblocks_in_piece2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bblocks_in_piece2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="blocks-in-piece2">
│ │ │ │ -<h2>blocks_in_piece2()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>blocks_in_piece2</strong> (piece_index_t index) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the number of blocks in the specified piece, for v2 torrents.</p>
│ │ │ │ -<a name="blocks_per_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bblocks_per_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bblocks_per_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="blocks-per-piece-1">
│ │ │ │ -<h2>blocks_per_piece()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>blocks_per_piece</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the number of blocks there are in the typical piece. There
│ │ │ │ -may be fewer in the last piece)</p>
│ │ │ │ -<a name="name()"></a>
│ │ │ │ -<a name="set_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bname%28%29+set_name%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bname%28%29+set_name%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="name-set-name">
│ │ │ │ -<h2>name() set_name()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::string const&amp; <strong>name</strong> () const;
│ │ │ │ -void <strong>set_name</strong> (std::string const&amp; n);
│ │ │ │ -</pre>
│ │ │ │ -<p>set and get the name of this torrent. For multi-file torrents, this is also
│ │ │ │ -the name of the root directory all the files are stored in.</p>
│ │ │ │ -<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="swap-1">
│ │ │ │ -<h2>swap()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>swap</strong> (file_storage&amp; ti) noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>swap all content of <em>this</em> with <em>ti</em>.</p>
│ │ │ │ -<a name="canonicalize()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bcanonicalize%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bcanonicalize%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="canonicalize">
│ │ │ │ -<h2>canonicalize()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>canonicalize</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>arrange files and padding to match the canonical form required
│ │ │ │ -by BEP 52</p>
│ │ │ │ -<a name="root()"></a>
│ │ │ │ -<a name="mtime()"></a>
│ │ │ │ -<a name="symlink()"></a>
│ │ │ │ -<a name="file_offset()"></a>
│ │ │ │ -<a name="hash()"></a>
│ │ │ │ -<a name="pad_file_at()"></a>
│ │ │ │ -<a name="root_ptr()"></a>
│ │ │ │ -<a name="file_name()"></a>
│ │ │ │ -<a name="file_path()"></a>
│ │ │ │ -<a name="file_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Broot%28%29+mtime%28%29+symlink%28%29+file_offset%28%29+hash%28%29+pad_file_at%28%29+root_ptr%28%29+file_name%28%29+file_path%28%29+file_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Broot%28%29+mtime%28%29+symlink%28%29+file_offset%28%29+hash%28%29+pad_file_at%28%29+root_ptr%28%29+file_name%28%29+file_path%28%29+file_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="root-mtime-symlink-file-offset-hash-pad-file-at-root-ptr-file-name-file-path-file-size">
│ │ │ │ -<h2>root() mtime() symlink() file_offset() hash() pad_file_at() root_ptr() file_name() file_path() file_size()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>pad_file_at</strong> (file_index_t index) const;
│ │ │ │ -std::int64_t <strong>file_size</strong> (file_index_t index) const;
│ │ │ │ -std::int64_t <strong>file_offset</strong> (file_index_t index) const;
│ │ │ │ -std::string <strong>symlink</strong> (file_index_t index) const;
│ │ │ │ -sha256_hash <strong>root</strong> (file_index_t index) const;
│ │ │ │ -string_view <strong>file_name</strong> (file_index_t index) const;
│ │ │ │ -std::string <strong>file_path</strong> (file_index_t index, std::string const&amp; save_path = &quot;&quot;) const;
│ │ │ │ -std::time_t <strong>mtime</strong> (file_index_t index) const;
│ │ │ │ -char const* <strong>root_ptr</strong> (file_index_t const index) const;
│ │ │ │ -sha1_hash <strong>hash</strong> (file_index_t index) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>These functions are used to query attributes of files at
│ │ │ │ -a given index.</p>
│ │ │ │ -<p>The <tt class="docutils literal">hash()</tt> is a SHA-1 hash of the file, or 0 if none was
│ │ │ │ -provided in the torrent file. This can potentially be used to
│ │ │ │ -join a bittorrent network with other file sharing networks.</p>
│ │ │ │ -<p><tt class="docutils literal">root()</tt> returns the SHA-256 merkle tree root of the specified file,
│ │ │ │ -in case this is a v2 torrent. Otherwise returns zeros.
│ │ │ │ -<tt class="docutils literal">root_ptr()</tt> returns a pointer to the SHA-256 merkle tree root hash
│ │ │ │ -for the specified file. The pointer points into storage referred to
│ │ │ │ -when the file was added, it is not owned by this object. Torrents
│ │ │ │ -that are not v2 torrents return nullptr.</p>
│ │ │ │ -<p>The <tt class="docutils literal">mtime()</tt> is the modification time is the posix
│ │ │ │ -time when a file was last modified when the torrent
│ │ │ │ -was created, or 0 if it was not included in the torrent file.</p>
│ │ │ │ -<p><tt class="docutils literal">file_path()</tt> returns the full path to a file.</p>
│ │ │ │ -<p><tt class="docutils literal">file_size()</tt> returns the size of a file.</p>
│ │ │ │ -<p><tt class="docutils literal">pad_file_at()</tt> returns true if the file at the given
│ │ │ │ -index is a pad-file.</p>
│ │ │ │ -<p><tt class="docutils literal">file_name()</tt> returns <em>just</em> the name of the file, whereas
│ │ │ │ -<tt class="docutils literal">file_path()</tt> returns the path (inside the torrent file) with
│ │ │ │ -the filename appended.</p>
│ │ │ │ -<p><tt class="docutils literal">file_offset()</tt> returns the byte offset within the torrent file
│ │ │ │ -where this file starts. It can be used to map the file to a piece
│ │ │ │ -index (given the piece size).</p>
│ │ │ │ -<a name="file_piece_range()"></a>
│ │ │ │ -<a name="file_num_blocks()"></a>
│ │ │ │ -<a name="file_num_pieces()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_piece_range%28%29+file_num_blocks%28%29+file_num_pieces%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_piece_range%28%29+file_num_blocks%28%29+file_num_pieces%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-piece-range-file-num-blocks-file-num-pieces">
│ │ │ │ -<h2>file_piece_range() file_num_blocks() file_num_pieces()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t) const;
│ │ │ │ -int <strong>file_num_pieces</strong> (file_index_t index) const;
│ │ │ │ -int <strong>file_num_blocks</strong> (file_index_t index) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>Returns the number of pieces or blocks the file at <cite>index</cite> spans,
│ │ │ │ -under the assumption that the file is aligned to the start of a piece.
│ │ │ │ -This is only meaningful for v2 torrents, where files are guaranteed
│ │ │ │ -such alignment.
│ │ │ │ -These numbers are used to size and navigate the merkle hash tree for
│ │ │ │ -each file.</p>
│ │ │ │ -<a name="file_first_piece_node()"></a>
│ │ │ │ -<a name="file_first_block_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_first_piece_node%28%29+file_first_block_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_first_piece_node%28%29+file_first_block_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-first-piece-node-file-first-block-node">
│ │ │ │ -<h2>file_first_piece_node() file_first_block_node()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>file_first_block_node</strong> (file_index_t index) const;
│ │ │ │ -int <strong>file_first_piece_node</strong> (file_index_t index) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>index of first piece node in the merkle tree</p>
│ │ │ │ -<a name="file_path_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_path_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_path_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-path-hash">
│ │ │ │ -<h2>file_path_hash()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::uint32_t <strong>file_path_hash</strong> (file_index_t index, std::string const&amp; save_path) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the crc32 hash of file_path(index)</p>
│ │ │ │ -<a name="all_path_hashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Ball_path_hashes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Ball_path_hashes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="all-path-hashes">
│ │ │ │ -<h2>all_path_hashes()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>all_path_hashes</strong> (std::unordered_set&lt;std::uint32_t&gt;&amp; table) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>this will add the CRC32 hash of all directory entries to the table. No
│ │ │ │ -filename will be included, just directories. Every depth of directories
│ │ │ │ -are added separately to allow test for collisions with files at all
│ │ │ │ -levels. i.e. if one path in the torrent is <tt class="docutils literal">foo/bar/baz</tt>, the CRC32
│ │ │ │ -hashes for <tt class="docutils literal">foo</tt>, <tt class="docutils literal">foo/bar</tt> and <tt class="docutils literal">foo/bar/baz</tt> will be added to
│ │ │ │ -the set.</p>
│ │ │ │ -<a name="file_flags()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_flags%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_flags%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-flags">
│ │ │ │ -<h2>file_flags()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -file_flags_t <strong>file_flags</strong> (file_index_t index) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a bitmask of flags from file_flags_t that apply
│ │ │ │ -to file at <tt class="docutils literal">index</tt>.</p>
│ │ │ │ -<a name="file_absolute_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_absolute_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_absolute_path%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-absolute-path">
│ │ │ │ -<h2>file_absolute_path()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>file_absolute_path</strong> (file_index_t index) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if the file at the specified index has been renamed to
│ │ │ │ -have an absolute path, i.e. is not anchored in the save path of the
│ │ │ │ -torrent.</p>
│ │ │ │ -<a name="file_index_at_offset()"></a>
│ │ │ │ -<a name="file_index_at_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_index_at_offset%28%29+file_index_at_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_index_at_offset%28%29+file_index_at_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-index-at-offset-file-index-at-piece">
│ │ │ │ -<h2>file_index_at_offset() file_index_at_piece()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -file_index_t <strong>file_index_at_offset</strong> (std::int64_t offset) const;
│ │ │ │ -file_index_t <strong>file_index_at_piece</strong> (piece_index_t piece) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the index of the file at the given offset in the torrent</p>
│ │ │ │ -<a name="file_index_for_root()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_index_for_root%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_index_for_root%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-index-for-root">
│ │ │ │ -<h2>file_index_for_root()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -file_index_t <strong>file_index_for_root</strong> (sha256_hash const&amp; root_hash) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>finds the file with the given root hash and returns its index
│ │ │ │ -if there is no file with the root hash, file_index_t{-1} is returned</p>
│ │ │ │ -<a name="piece_index_at_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_index_at_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_index_at_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-index-at-file">
│ │ │ │ -<h2>piece_index_at_file()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -piece_index_t <strong>piece_index_at_file</strong> (file_index_t f) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the piece index the given file starts at</p>
│ │ │ │ -<a name="sanitize_symlinks()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bsanitize_symlinks%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bsanitize_symlinks%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="sanitize-symlinks">
│ │ │ │ -<h2>sanitize_symlinks()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>sanitize_symlinks</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>validate any symlinks, to ensure they all point to
│ │ │ │ -other files or directories inside this storage. Any invalid symlinks
│ │ │ │ -are updated to point to themselves.</p>
│ │ │ │ -<a name="v2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bv2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bv2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="v2">
│ │ │ │ -<h2>v2()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>v2</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if this torrent contains v2 metadata.</p>
│ │ │ │ -<a name="flag_pad_file"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bflag_pad_file%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bflag_pad_file%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>flag_pad_file</dt>
│ │ │ │ -<dd>the file is a pad file. It's required to contain zeros
│ │ │ │ -at it will not be saved to disk. Its purpose is to make
│ │ │ │ -the following file start on a piece boundary.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="flag_hidden"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bflag_hidden%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bflag_hidden%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>flag_hidden</dt>
│ │ │ │ -<dd>this file has the hidden attribute set. This is primarily
│ │ │ │ -a windows attribute</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="flag_executable"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bflag_executable%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bflag_executable%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>flag_executable</dt>
│ │ │ │ -<dd>this file has the executable attribute set.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="flag_symlink"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bflag_symlink%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bflag_symlink%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>flag_symlink</dt>
│ │ │ │ -<dd>this file is a symbolic link. It should have a link
│ │ │ │ -target string associated with it.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="default_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:default_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22default_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="default-disk-io-constructor">
│ │ │ │ -<h1>default_disk_io_constructor()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session.hpp">libtorrent/session.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::unique_ptr&lt;disk_interface&gt; <strong>default_disk_io_constructor</strong> (
│ │ │ │ -   io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │ -</pre>
│ │ │ │ -<p>the constructor function for the default storage. On systems that support
│ │ │ │ -memory mapped files (and a 64 bit address space) the memory mapped storage
│ │ │ │ -will be constructed, otherwise the portable posix storage.</p>
│ │ │ │ -<a name="posix_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:posix_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22posix_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="posix-disk-io-constructor">
│ │ │ │ -<h1>posix_disk_io_constructor()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/posix_disk_io.hpp">libtorrent/posix_disk_io.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::unique_ptr&lt;disk_interface&gt; <strong>posix_disk_io_constructor</strong> (
│ │ │ │ -   io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │ -</pre>
│ │ │ │ -<p>this is a simple posix disk I/O back-end, used for systems that don't
│ │ │ │ -have a 64 bit virtual address space or don't support memory mapped files.
│ │ │ │ -It's implemented using portable C file functions and is single-threaded.</p>
│ │ │ │ -<a name="disabled_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disabled_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22disabled_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="disabled-disk-io-constructor">
│ │ │ │ -<h1>disabled_disk_io_constructor()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disabled_disk_io.hpp">libtorrent/disabled_disk_io.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::unique_ptr&lt;disk_interface&gt; <strong>disabled_disk_io_constructor</strong> (
│ │ │ │ -   io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │ -</pre>
│ │ │ │ -<p>creates a disk io object that discards all data written to it, and only
│ │ │ │ -returns zero-buffers when read from. May be useful for testing and
│ │ │ │ -benchmarking.</p>
│ │ │ │ -<a name="mmap_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:mmap_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22mmap_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="mmap-disk-io-constructor">
│ │ │ │ -<h1>mmap_disk_io_constructor()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/mmap_disk_io.hpp">libtorrent/mmap_disk_io.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::unique_ptr&lt;disk_interface&gt; <strong>mmap_disk_io_constructor</strong> (
│ │ │ │ -   io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │ -</pre>
│ │ │ │ -<p>constructs a memory mapped file disk I/O object.</p>
│ │ │ │ -<a name="storage_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+storage_mode_t&labels=documentation&body=Documentation+under+heading+%22enum+storage_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-storage-mode-t">
│ │ │ │ -<h1>enum storage_mode_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/storage_defs.hpp">libtorrent/storage_defs.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="7%" />
│ │ │ │ -<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>storage_mode_allocate</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>All pieces will be written to their final position, all files will be
│ │ │ │ -allocated in full when the torrent is first started. This mode minimizes
│ │ │ │ -fragmentation but could be a costly operation.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>storage_mode_sparse</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>All pieces will be written to the place where they belong and sparse files
│ │ │ │ -will be used. This is the recommended, and default mode.</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="status_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+status_t&labels=documentation&body=Documentation+under+heading+%22enum+status_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-status-t">
│ │ │ │ -<h1>enum status_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/storage_defs.hpp">libtorrent/storage_defs.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="7%" />
│ │ │ │ -<col width="74%" />
│ │ │ │ -</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>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>fatal_disk_error</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>need_full_check</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>file_exist</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>oversized_file</td>
│ │ │ │ -<td>16</td>
│ │ │ │ -<td>this is not an enum value, but a flag that can be set in the return
│ │ │ │ -from async_check_files, in case an existing file was found larger than
│ │ │ │ -specified in the torrent. i.e. it has garbage at the end
│ │ │ │ -the <a class="reference external" href="reference-Storage.html#status_t">status_t</a> field is used for this to preserve ABI.</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="move_flags_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+move_flags_t&labels=documentation&body=Documentation+under+heading+%22enum+move_flags_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-move-flags-t">
│ │ │ │ -<h1>enum move_flags_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/storage_defs.hpp">libtorrent/storage_defs.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="29%" />
│ │ │ │ -<col width="7%" />
│ │ │ │ -<col width="64%" />
│ │ │ │ -</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>always_replace_files</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>replace any files in the destination when copying
│ │ │ │ -or moving the storage</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>fail_if_exist</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>if any files that we want to copy exist in the destination
│ │ │ │ -exist, fail the whole operation and don't perform
│ │ │ │ -any copy or move. There is an inherent race condition
│ │ │ │ -in this mode. The files are checked for existence before
│ │ │ │ -the operation starts. In between the check and performing
│ │ │ │ -the copy, the destination files may be created, in which
│ │ │ │ -case they are replaced.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>dont_replace</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>if any file exist in the target, take those files instead
│ │ │ │ -of the ones we may have in the source.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>reset_save_path</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>don't move any source files, just forget about them
│ │ │ │ -and begin checking files at new save path</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>reset_save_path_unchecked</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>don't move any source files, just change save path
│ │ │ │ -and continue working without any checks</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>libtorrent has a <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> interface for implementing extensions to the protocol.
│ │ │ │ -These can be general extensions for transferring metadata or peer exchange
│ │ │ │ -extensions, or it could be used to provide a way to customize the protocol
│ │ │ │ -to fit a particular (closed) network.</p>
│ │ │ │ -<p>In short, the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> interface makes it possible to:</p>
│ │ │ │ -<ul class="simple">
│ │ │ │ -<li>register extension messages (sent in the extension handshake), see
│ │ │ │ -<a class="reference external" href="manual-ref.html#extensions">extensions</a>.</li>
│ │ │ │ -<li>add data and parse data from the extension handshake.</li>
│ │ │ │ -<li>send extension messages and standard bittorrent messages.</li>
│ │ │ │ -<li>override or block the handling of standard bittorrent messages.</li>
│ │ │ │ -<li>save and restore state via the <a class="reference external" href="reference-Session.html#session">session</a> state</li>
│ │ │ │ -<li>see all alerts that are posted</li>
│ │ │ │ -</ul>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="a-word-of-caution">
│ │ │ │ -<h1>a word of caution</h1>
│ │ │ │ -<p>Writing your own <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> is a very easy way to introduce serious bugs such as
│ │ │ │ -dead locks and race conditions. Since a <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> has access to internal
│ │ │ │ -structures it is also quite easy to sabotage libtorrent's operation.</p>
│ │ │ │ -<p>All the callbacks are always called from the libtorrent network thread. In
│ │ │ │ -case portions of your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> are called from other threads, typically the main
│ │ │ │ -thread, you cannot use any of the member functions on the internal structures
│ │ │ │ -in libtorrent, since those require being called from the libtorrent network
│ │ │ │ -thread . Furthermore, you also need to synchronize your own shared data
│ │ │ │ -within the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a>, to make sure it is not accessed at the same time from the
│ │ │ │ -libtorrent thread (through a callback). If you need to send out a message
│ │ │ │ -from another thread, it is advised to use an internal queue, and do the
│ │ │ │ -actual sending in <tt class="docutils literal">tick()</tt>.</p>
│ │ │ │ -<p>Since the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> interface gives you easy access to internal structures, it
│ │ │ │ -is not supported as a stable API. Plugins should be considered specific to a
│ │ │ │ -specific version of libtorrent. Although, in practice the internals mostly
│ │ │ │ -don't change that dramatically.</p>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="plugin-interface">
│ │ │ │ -<h1>plugin-interface</h1>
│ │ │ │ -<p>The <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> interface consists of three base classes that the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> may
│ │ │ │ -implement. These are called <a class="reference external" href="reference-Plugins.html#plugin">plugin</a>, <a class="reference external" href="reference-Plugins.html#torrent_plugin">torrent_plugin</a> and <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a>.
│ │ │ │ -They are found in the <tt class="docutils literal">&lt;libtorrent/extensions.hpp&gt;</tt> header.</p>
│ │ │ │ -<p>These plugins are instantiated for each <a class="reference external" href="reference-Session.html#session">session</a>, torrent and possibly each peer,
│ │ │ │ -respectively.</p>
│ │ │ │ -<p>For plugins that only need per torrent state, it is enough to only implement
│ │ │ │ -<tt class="docutils literal">torrent_plugin</tt> and pass a constructor function or function object to
│ │ │ │ -<tt class="docutils literal"><span class="pre">session::add_extension()</span></tt> or <tt class="docutils literal"><span class="pre">torrent_handle::add_extension()</span></tt> (if the
│ │ │ │ -torrent has already been started and you want to hook in the extension at
│ │ │ │ -run-time).</p>
│ │ │ │ -<p>The signature of the function is:</p>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="name">torrent_plugin</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="operator">*</span><span class="punctuation">)(</span><span class="name">torrent_handle</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">client_data_t</span><span class="punctuation">);</span>
│ │ │ │ -</pre>
│ │ │ │ -<p>The second argument is the userdata passed to <tt class="docutils literal"><span class="pre">session::add_torrent()</span></tt> or
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_handle::add_extension()</span></tt>.</p>
│ │ │ │ -<p>The function should return a <tt class="docutils literal"><span class="pre">std::shared_ptr&lt;torrent_plugin&gt;</span></tt> which
│ │ │ │ -may or may not be 0. If it is a nullptr, the extension is simply ignored
│ │ │ │ -for this torrent. If it is a valid pointer (to a class inheriting
│ │ │ │ -<tt class="docutils literal">torrent_plugin</tt>), it will be associated with this torrent and callbacks
│ │ │ │ -will be made on torrent events.</p>
│ │ │ │ -<p>For more elaborate plugins which require <a class="reference external" href="reference-Session.html#session">session</a> wide state, you would
│ │ │ │ -implement <tt class="docutils literal">plugin</tt>, construct an object (in a <tt class="docutils literal"><span class="pre">std::shared_ptr</span></tt>) and pass
│ │ │ │ -it in to <tt class="docutils literal"><span class="pre">session::add_extension()</span></tt>.</p>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="custom-alerts">
│ │ │ │ -<h1>custom alerts</h1>
│ │ │ │ -<p>Since plugins are running within internal libtorrent threads, one convenient
│ │ │ │ -way to communicate with the client is to post custom alerts.</p>
│ │ │ │ -<p>The expected interface of any <a class="reference external" href="reference-Alerts.html#alert">alert</a>, apart from deriving from the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ -base class, looks like this:</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -static const int alert_type = <em>&lt;unique alert ID&gt;</em>;
│ │ │ │ -virtual int type() const { return alert_type; }
│ │ │ │ -
│ │ │ │ -virtual std::string message() const;
│ │ │ │ -
│ │ │ │ -static const alert_category_t static_category = <em>&lt;bitmask of alert::category_t flags&gt;</em>;
│ │ │ │ -virtual alert_category_t category() const { return static_category; }
│ │ │ │ -
│ │ │ │ -virtual char const* what() const { return <em>&lt;string literal of the name of this alert&gt;</em>; }
│ │ │ │ -</pre>
│ │ │ │ -<p>The <tt class="docutils literal">alert_type</tt> is used for the type-checking in <tt class="docutils literal">alert_cast</tt>. It must
│ │ │ │ -not collide with any other <a class="reference external" href="reference-Alerts.html#alert">alert</a>. The built-in alerts in libtorrent will
│ │ │ │ -not use <a class="reference external" href="reference-Alerts.html#alert">alert</a> type IDs greater than <tt class="docutils literal">user_alert_id</tt>. When defining your
│ │ │ │ -own <a class="reference external" href="reference-Alerts.html#alert">alert</a>, make sure it's greater than this constant.</p>
│ │ │ │ -<p><tt class="docutils literal">type()</tt> is the run-time equivalence of the <tt class="docutils literal">alert_type</tt>.</p>
│ │ │ │ -<p>The <tt class="docutils literal">message()</tt> virtual function is expected to construct a useful
│ │ │ │ -string representation of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> and the event or data it represents.
│ │ │ │ -Something convenient to put in a log file for instance.</p>
│ │ │ │ -<p><tt class="docutils literal">clone()</tt> is used internally to copy alerts. The suggested implementation
│ │ │ │ -of simply allocating a new instance as a copy of <tt class="docutils literal">*this</tt> is all that's
│ │ │ │ -expected.</p>
│ │ │ │ -<p>The static category is required for checking whether or not the category
│ │ │ │ -for a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> is enabled or not, without instantiating the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.
│ │ │ │ -The <tt class="docutils literal">category</tt> virtual function is the run-time equivalence.</p>
│ │ │ │ -<p>The <tt class="docutils literal">what()</tt> virtual function may simply be a string literal of the class
│ │ │ │ -name of your <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ -<p>For more information, see the <a class="reference external" href="reference-Alerts.html">alert section</a>.</p>
│ │ │ │ -<a name="peer_connection_handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_connection_handle&labels=documentation&body=Documentation+under+heading+%22class+peer_connection_handle%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="peer-connection-handle">
│ │ │ │ -<h1>peer_connection_handle</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_connection_handle.hpp">libtorrent/peer_connection_handle.hpp</a>&quot;</p>
│ │ │ │ -<p>the <a class="reference external" href="reference-Plugins.html#peer_connection_handle">peer_connection_handle</a> class provides a handle to the internal peer
│ │ │ │ -connection object, to be used by plugins. This is a low level interface that
│ │ │ │ -may not be stable across libtorrent versions</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_connection_handle
│ │ │ │ -{
│ │ │ │ -   explicit <strong>peer_connection_handle</strong> (std::weak_ptr&lt;peer_connection&gt; impl);
│ │ │ │ -   connection_type <strong>type</strong> () const;
│ │ │ │ -   void <strong>add_extension</strong> (std::shared_ptr&lt;peer_plugin&gt;);
│ │ │ │ -   peer_plugin const* <strong>find_plugin</strong> (string_view type) const;
│ │ │ │ -   bool <strong>is_seed</strong> () const;
│ │ │ │ -   bool <strong>upload_only</strong> () const;
│ │ │ │ -   bool <strong>has_piece</strong> (piece_index_t i) const;
│ │ │ │ -   peer_id const&amp; <strong>pid</strong> () const;
│ │ │ │ -   bool <strong>is_choked</strong> () const;
│ │ │ │ -   bool <strong>is_interesting</strong> () const;
│ │ │ │ -   bool <strong>has_peer_choked</strong> () const;
│ │ │ │ -   bool <strong>is_peer_interested</strong> () const;
│ │ │ │ -   void <strong>maybe_unchoke_this_peer</strong> ();
│ │ │ │ -   void <strong>choke_this_peer</strong> ();
│ │ │ │ -   void <strong>get_peer_info</strong> (peer_info&amp; p) const;
│ │ │ │ -   torrent_handle <strong>associated_torrent</strong> () const;
│ │ │ │ -   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> const&amp; <strong>remote</strong> () const;
│ │ │ │ -   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>local_endpoint</strong> () const;
│ │ │ │ -   void <strong>disconnect</strong> (error_code const&amp; ec, operation_t op
│ │ │ │ -      , disconnect_severity_t = peer_connection_interface::normal);
│ │ │ │ -   bool <strong>is_outgoing</strong> () const;
│ │ │ │ -   bool <strong>is_disconnecting</strong> () const;
│ │ │ │ -   bool <strong>is_connecting</strong> () const;
│ │ │ │ -   bool <strong>ignore_unchoke_slots</strong> () const;
│ │ │ │ -   bool <strong>on_local_network</strong> () const;
│ │ │ │ -   bool <strong>failed</strong> () const;
│ │ │ │ -   void <strong>peer_log</strong> (peer_log_alert::direction_t direction
│ │ │ │ -      , char const* event, char const* fmt = &quot;&quot;, ...) const TORRENT_FORMAT(4,5);
│ │ │ │ -   bool <strong>should_log</strong> (peer_log_alert::direction_t direction) const;
│ │ │ │ -   bool <strong>can_disconnect</strong> (error_code const&amp; ec) const;
│ │ │ │ -   bool <strong>has_metadata</strong> () const;
│ │ │ │ -   bool <strong>in_handshake</strong> () const;
│ │ │ │ -   void <strong>send_buffer</strong> (char const* begin, int size);
│ │ │ │ -   std::time_t <strong>last_seen_complete</strong> () const;
│ │ │ │ -   time_point <strong>time_of_last_unchoke</strong> () const;
│ │ │ │ -   bool <strong>operator&lt;</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │ -   bool <strong>operator!=</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │ -   bool <strong>operator==</strong> (peer_connection_handle const&amp; o) const;
│ │ │ │ -   std::shared_ptr&lt;peer_connection&gt; <strong>native_handle</strong> () const;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="bt_peer_connection_handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+bt_peer_connection_handle&labels=documentation&body=Documentation+under+heading+%22class+bt_peer_connection_handle%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="bt-peer-connection-handle">
│ │ │ │ -<h1>bt_peer_connection_handle</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_connection_handle.hpp">libtorrent/peer_connection_handle.hpp</a>&quot;</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Plugins.html#bt_peer_connection_handle">bt_peer_connection_handle</a> provides a handle to the internal bittorrent
│ │ │ │ -peer connection object to plugins. It's low level and may not be a stable API
│ │ │ │ -across libtorrent versions.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct bt_peer_connection_handle : peer_connection_handle
│ │ │ │ -{
│ │ │ │ -   explicit <strong>bt_peer_connection_handle</strong> (peer_connection_handle pc);
│ │ │ │ -   bool <strong>packet_finished</strong> () const;
│ │ │ │ -   bool <strong>support_extensions</strong> () const;
│ │ │ │ -   bool <strong>supports_encryption</strong> () const;
│ │ │ │ -   void <strong>switch_send_crypto</strong> (std::shared_ptr&lt;crypto_plugin&gt; crypto);
│ │ │ │ -   void <strong>switch_recv_crypto</strong> (std::shared_ptr&lt;crypto_plugin&gt; crypto);
│ │ │ │ -   std::shared_ptr&lt;bt_peer_connection&gt; <strong>native_handle</strong> () const;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="plugin"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+plugin&labels=documentation&body=Documentation+under+heading+%22class+plugin%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="plugin">
│ │ │ │ -<h1>plugin</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions.hpp">libtorrent/extensions.hpp</a>&quot;</p>
│ │ │ │ -<p>this is the base class for a <a class="reference external" href="reference-Session.html#session">session</a> <a class="reference external" href="reference-Plugins.html#plugin">plugin</a>. One primary feature
│ │ │ │ -is that it is notified of all torrents that are added to the <a class="reference external" href="reference-Session.html#session">session</a>,
│ │ │ │ -and can add its own torrent_plugins.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct plugin
│ │ │ │ -{
│ │ │ │ -   virtual feature_flags_t <strong>implemented_features</strong> ();
│ │ │ │ -   virtual std::shared_ptr&lt;torrent_plugin&gt; <strong>new_torrent</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │ -   virtual void <strong>added</strong> (session_handle const&amp;);
│ │ │ │ -   virtual void <strong>abort</strong> ();
│ │ │ │ -   virtual bool <strong>on_dht_request</strong> (string_view <em>/* query */</em>
│ │ │ │ -      , udp::endpoint const&amp; <em>/* source */</em>, bdecode_node const&amp; <em>/* message */</em>
│ │ │ │ -      , entry&amp; <em>/* response */</em>);
│ │ │ │ -   virtual void <strong>on_alert</strong> (alert const*);
│ │ │ │ -   virtual bool <strong>on_unknown_torrent</strong> (info_hash_t const&amp; <em>/* info_hash */</em>
│ │ │ │ -      , peer_connection_handle const&amp; <em>/* pc */</em>, add_torrent_params&amp; <em>/* p */</em>);
│ │ │ │ -   virtual void <strong>on_tick</strong> ();
│ │ │ │ -   virtual uint64_t <strong>get_unchoke_priority</strong> (peer_connection_handle const&amp; <em>/* peer */</em>);
│ │ │ │ -   virtual std::map&lt;std::string, std::string&gt; <strong>save_state</strong> () const;
│ │ │ │ -   virtual void <strong>load_state</strong> (std::map&lt;std::string, std::string&gt; const&amp;);
│ │ │ │ -
│ │ │ │ -   static constexpr feature_flags_t <strong>optimistic_unchoke_feature</strong>  = 1_bit;
│ │ │ │ -   static constexpr feature_flags_t <strong>tick_feature</strong>  = 2_bit;
│ │ │ │ -   static constexpr feature_flags_t <strong>dht_request_feature</strong>  = 3_bit;
│ │ │ │ -   static constexpr feature_flags_t <strong>alert_feature</strong>  = 4_bit;
│ │ │ │ -   static constexpr feature_flags_t <strong>unknown_torrent_feature</strong>  = 5_bit;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="implemented_features()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bimplemented_features%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bimplemented_features%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="implemented-features">
│ │ │ │ -<h2>implemented_features()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual feature_flags_t <strong>implemented_features</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>This function is expected to return a bitmask indicating which features
│ │ │ │ -this <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> implements. Some callbacks on this object may not be called
│ │ │ │ -unless the corresponding feature flag is returned here. Note that
│ │ │ │ -callbacks may still be called even if the corresponding feature is not
│ │ │ │ -specified in the return value here. See feature_flags_t for possible
│ │ │ │ -flags to return.</p>
│ │ │ │ -<a name="new_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bnew_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bnew_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="new-torrent">
│ │ │ │ -<h2>new_torrent()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual std::shared_ptr&lt;torrent_plugin&gt; <strong>new_torrent</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │ -</pre>
│ │ │ │ -<p>this is called by the <a class="reference external" href="reference-Session.html#session">session</a> every time a new torrent is added.
│ │ │ │ -The <tt class="docutils literal">torrent*</tt> points to the internal torrent object created
│ │ │ │ -for the new torrent. The <a class="reference external" href="reference-Add_Torrent.html#client_data_t">client_data_t</a> is the userdata pointer as
│ │ │ │ -passed in via <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>.</p>
│ │ │ │ -<p>If the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> returns a <a class="reference external" href="reference-Plugins.html#torrent_plugin">torrent_plugin</a> instance, it will be added
│ │ │ │ -to the new torrent. Otherwise, return an empty shared_ptr to a
│ │ │ │ -<a class="reference external" href="reference-Plugins.html#torrent_plugin">torrent_plugin</a> (the default).</p>
│ │ │ │ -<a name="added()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Badded%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Badded%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="added">
│ │ │ │ -<h2>added()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>added</strong> (session_handle const&amp;);
│ │ │ │ -</pre>
│ │ │ │ -<p>called when <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> is added to a <a class="reference external" href="reference-Session.html#session">session</a></p>
│ │ │ │ -<a name="abort()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Babort%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Babort%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="abort-1">
│ │ │ │ -<h2>abort()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>abort</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>called when the <a class="reference external" href="reference-Session.html#session">session</a> is aborted
│ │ │ │ -the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> should perform any cleanup necessary to allow the session's
│ │ │ │ -destruction (e.g. cancel outstanding async operations)</p>
│ │ │ │ -<a name="on_dht_request()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bon_dht_request%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bon_dht_request%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-dht-request">
│ │ │ │ -<h2>on_dht_request()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>on_dht_request</strong> (string_view <em>/* query */</em>
│ │ │ │ -      , udp::endpoint const&amp; <em>/* source */</em>, bdecode_node const&amp; <em>/* message */</em>
│ │ │ │ -      , entry&amp; <em>/* response */</em>);
│ │ │ │ -</pre>
│ │ │ │ -<p>called when a dht request is received.
│ │ │ │ -If your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> expects this to be called, make sure to include the flag
│ │ │ │ -<tt class="docutils literal">dht_request_feature</tt> in the return value from <a class="reference external" href="reference-Plugins.html#implemented_features()">implemented_features()</a>.</p>
│ │ │ │ -<a name="on_alert()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bon_alert%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bon_alert%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-alert">
│ │ │ │ -<h2>on_alert()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>on_alert</strong> (alert const*);
│ │ │ │ -</pre>
│ │ │ │ -<p>called when an <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted alerts that are filtered are not posted.
│ │ │ │ -If your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> expects this to be called, make sure to include the flag
│ │ │ │ -<tt class="docutils literal">alert_feature</tt> in the return value from <a class="reference external" href="reference-Plugins.html#implemented_features()">implemented_features()</a>.</p>
│ │ │ │ -<a name="on_unknown_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bon_unknown_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bon_unknown_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-unknown-torrent">
│ │ │ │ -<h2>on_unknown_torrent()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>on_unknown_torrent</strong> (info_hash_t const&amp; <em>/* info_hash */</em>
│ │ │ │ -      , peer_connection_handle const&amp; <em>/* pc */</em>, add_torrent_params&amp; <em>/* p */</em>);
│ │ │ │ -</pre>
│ │ │ │ -<p>return true if the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> should be added</p>
│ │ │ │ -<a name="on_tick()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bon_tick%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bon_tick%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-tick">
│ │ │ │ -<h2>on_tick()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>on_tick</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>called once per second.
│ │ │ │ -If your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> expects this to be called, make sure to include the flag
│ │ │ │ -<tt class="docutils literal">tick_feature</tt> in the return value from <a class="reference external" href="reference-Plugins.html#implemented_features()">implemented_features()</a>.</p>
│ │ │ │ -<a name="get_unchoke_priority()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bget_unchoke_priority%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bget_unchoke_priority%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-unchoke-priority">
│ │ │ │ -<h2>get_unchoke_priority()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual uint64_t <strong>get_unchoke_priority</strong> (peer_connection_handle const&amp; <em>/* peer */</em>);
│ │ │ │ -</pre>
│ │ │ │ -<p>called when choosing peers to optimistically unchoke. The return value
│ │ │ │ -indicates the peer's priority for unchoking. Lower return values
│ │ │ │ -correspond to higher priority. Priorities above 2^63-1 are reserved.
│ │ │ │ -If your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> has no priority to assign a peer it should return 2^64-1.
│ │ │ │ -If your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> expects this to be called, make sure to include the flag
│ │ │ │ -<tt class="docutils literal">optimistic_unchoke_feature</tt> in the return value from <a class="reference external" href="reference-Plugins.html#implemented_features()">implemented_features()</a>.
│ │ │ │ -If multiple plugins implement this function the lowest return value
│ │ │ │ -(i.e. the highest priority) is used.</p>
│ │ │ │ -<a name="load_state()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bload_state%28%29%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bload_state%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="load-state">
│ │ │ │ -<h2>load_state()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>load_state</strong> (std::map&lt;std::string, std::string&gt; const&amp;);
│ │ │ │ -</pre>
│ │ │ │ -<p>called on startup while loading settings state from the <a class="reference external" href="reference-Session.html#session_params">session_params</a></p>
│ │ │ │ -<a name="optimistic_unchoke_feature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Boptimistic_unchoke_feature%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Boptimistic_unchoke_feature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>optimistic_unchoke_feature</dt>
│ │ │ │ -<dd>include this bit if your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> needs to alter the order of the
│ │ │ │ -optimistic unchoke of peers. i.e. have the on_optimistic_unchoke()
│ │ │ │ -callback be called.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="tick_feature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Btick_feature%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Btick_feature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>tick_feature</dt>
│ │ │ │ -<dd>include this bit if your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> needs to have <a class="reference external" href="reference-Plugins.html#on_tick()">on_tick()</a> called</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="dht_request_feature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bdht_request_feature%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bdht_request_feature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>dht_request_feature</dt>
│ │ │ │ -<dd>include this bit if your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> needs to have <a class="reference external" href="reference-Plugins.html#on_dht_request()">on_dht_request()</a>
│ │ │ │ -called</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="alert_feature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Balert_feature%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Balert_feature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>alert_feature</dt>
│ │ │ │ -<dd>include this bit if your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> needs to have <a class="reference external" href="reference-Plugins.html#on_alert()">on_alert()</a>
│ │ │ │ -called</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="unknown_torrent_feature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:plugin%3A%3A%5Bunknown_torrent_feature%5D&labels=documentation&body=Documentation+under+heading+%22plugin%3A%3A%5Bunknown_torrent_feature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>unknown_torrent_feature</dt>
│ │ │ │ -<dd>include this bit if your <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> needs to have <a class="reference external" href="reference-Plugins.html#on_unknown_torrent()">on_unknown_torrent()</a>
│ │ │ │ -called even if there is no active torrent in the <a class="reference external" href="reference-Session.html#session">session</a></dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_plugin"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_plugin&labels=documentation&body=Documentation+under+heading+%22class+torrent_plugin%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="torrent-plugin">
│ │ │ │ -<h1>torrent_plugin</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions.hpp">libtorrent/extensions.hpp</a>&quot;</p>
│ │ │ │ -<p>Torrent plugins are associated with a single torrent and have a number
│ │ │ │ -of functions called at certain events. Many of its functions have the
│ │ │ │ -ability to change or override the default libtorrent behavior.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_plugin
│ │ │ │ -{
│ │ │ │ -   virtual std::shared_ptr&lt;peer_plugin&gt; <strong>new_connection</strong> (peer_connection_handle const&amp;);
│ │ │ │ -   virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │ -   virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │ -   virtual void <strong>tick</strong> ();
│ │ │ │ -   virtual bool <strong>on_resume</strong> ();
│ │ │ │ -   virtual bool <strong>on_pause</strong> ();
│ │ │ │ -   virtual void <strong>on_files_checked</strong> ();
│ │ │ │ -   virtual void <strong>on_state</strong> (torrent_status::state_t);
│ │ │ │ -   virtual void <strong>on_add_peer</strong> (tcp::endpoint const&amp;,
│ │ │ │ -      peer_source_flags_t, add_peer_flags_t);
│ │ │ │ -
│ │ │ │ -   static constexpr add_peer_flags_t <strong>first_time</strong>  = 1_bit;
│ │ │ │ -   static constexpr add_peer_flags_t <strong>filtered</strong>  = 2_bit;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="new_connection()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bnew_connection%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bnew_connection%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="new-connection">
│ │ │ │ -<h2>new_connection()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual std::shared_ptr&lt;peer_plugin&gt; <strong>new_connection</strong> (peer_connection_handle const&amp;);
│ │ │ │ -</pre>
│ │ │ │ -<p>This function is called each time a new peer is connected to the torrent. You
│ │ │ │ -may choose to ignore this by just returning a default constructed
│ │ │ │ -<tt class="docutils literal">shared_ptr</tt> (in which case you don't need to override this member
│ │ │ │ -function).</p>
│ │ │ │ -<p>If you need an extension to the peer connection (which most plugins do) you
│ │ │ │ -are supposed to return an instance of your <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a> class. Which in
│ │ │ │ -turn will have its hook functions called on event specific to that peer.</p>
│ │ │ │ -<p>The <tt class="docutils literal">peer_connection_handle</tt> will be valid as long as the <tt class="docutils literal">shared_ptr</tt>
│ │ │ │ -is being held by the torrent object. So, it is generally a good idea to not
│ │ │ │ -keep a <tt class="docutils literal">shared_ptr</tt> to your own <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a>. If you want to keep references
│ │ │ │ -to it, use <tt class="docutils literal">weak_ptr</tt>.</p>
│ │ │ │ -<p>If this function throws an exception, the connection will be closed.</p>
│ │ │ │ -<a name="on_piece_failed()"></a>
│ │ │ │ -<a name="on_piece_pass()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_piece_failed%28%29+on_piece_pass%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_piece_failed%28%29+on_piece_pass%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-piece-failed-on-piece-pass">
│ │ │ │ -<h2>on_piece_failed() on_piece_pass()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │ -virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │ -</pre>
│ │ │ │ -<p>These hooks are called when a piece passes the hash check or fails the hash
│ │ │ │ -check, respectively. The <tt class="docutils literal">index</tt> is the piece index that was downloaded.
│ │ │ │ -It is possible to access the list of peers that participated in sending the
│ │ │ │ -piece through the <tt class="docutils literal">torrent</tt> and the <tt class="docutils literal">piece_picker</tt>.</p>
│ │ │ │ -<a name="tick()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Btick%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Btick%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="tick">
│ │ │ │ -<h2>tick()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>tick</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>This hook is called approximately once per second. It is a way of making it
│ │ │ │ -easy for plugins to do timed events, for sending messages or whatever.</p>
│ │ │ │ -<a name="on_resume()"></a>
│ │ │ │ -<a name="on_pause()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_resume%28%29+on_pause%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_resume%28%29+on_pause%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-resume-on-pause">
│ │ │ │ -<h2>on_resume() on_pause()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>on_resume</strong> ();
│ │ │ │ -virtual bool <strong>on_pause</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>These hooks are called when the torrent is paused and resumed respectively.
│ │ │ │ -The return value indicates if the event was handled. A return value of
│ │ │ │ -<tt class="docutils literal">true</tt> indicates that it was handled, and no other <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> after this one
│ │ │ │ -will have this hook function called, and the standard handler will also not be
│ │ │ │ -invoked. So, returning true effectively overrides the standard behavior of
│ │ │ │ -pause or resume.</p>
│ │ │ │ -<p>Note that if you call <tt class="docutils literal">pause()</tt> or <tt class="docutils literal">resume()</tt> on the torrent from your
│ │ │ │ -handler it will recurse back into your handler, so in order to invoke the
│ │ │ │ -standard handler, you have to keep your own state on whether you want standard
│ │ │ │ -behavior or overridden behavior.</p>
│ │ │ │ -<a name="on_files_checked()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_files_checked%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_files_checked%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-files-checked">
│ │ │ │ -<h2>on_files_checked()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>on_files_checked</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>This function is called when the initial files of the torrent have been
│ │ │ │ -checked. If there are no files to check, this function is called immediately.</p>
│ │ │ │ -<p>i.e. This function is always called when the torrent is in a state where it
│ │ │ │ -can start downloading.</p>
│ │ │ │ -<a name="on_state()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_state%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_state%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-state">
│ │ │ │ -<h2>on_state()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>on_state</strong> (torrent_status::state_t);
│ │ │ │ -</pre>
│ │ │ │ -<p>called when the torrent changes state
│ │ │ │ -the state is one of <a class="reference external" href="reference-Torrent_Status.html#state_t">torrent_status::state_t</a>
│ │ │ │ -enum members</p>
│ │ │ │ -<a name="on_add_peer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bon_add_peer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bon_add_peer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-add-peer">
│ │ │ │ -<h2>on_add_peer()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>on_add_peer</strong> (tcp::endpoint const&amp;,
│ │ │ │ -      peer_source_flags_t, add_peer_flags_t);
│ │ │ │ -</pre>
│ │ │ │ -<p>called every time a new peer is added to the peer list.
│ │ │ │ -This is before the peer is connected to. For <tt class="docutils literal">flags</tt>, see
│ │ │ │ -torrent_plugin::flags_t. The <tt class="docutils literal">source</tt> argument refers to
│ │ │ │ -the source where we learned about this peer from. It's a
│ │ │ │ -bitmask, because many sources may have told us about the same
│ │ │ │ -peer. For peer source flags, see peer_info::peer_source_flags.</p>
│ │ │ │ -<a name="first_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bfirst_time%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bfirst_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>first_time</dt>
│ │ │ │ -<dd>this is the first time we see this peer</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="filtered"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_plugin%3A%3A%5Bfiltered%5D&labels=documentation&body=Documentation+under+heading+%22torrent_plugin%3A%3A%5Bfiltered%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>filtered</dt>
│ │ │ │ -<dd>this peer was not added because it was
│ │ │ │ -filtered by the IP filter</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="peer_plugin"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_plugin&labels=documentation&body=Documentation+under+heading+%22class+peer_plugin%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="peer-plugin">
│ │ │ │ -<h1>peer_plugin</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions.hpp">libtorrent/extensions.hpp</a>&quot;</p>
│ │ │ │ -<p>peer plugins are associated with a specific peer. A peer could be
│ │ │ │ -both a regular bittorrent peer (<tt class="docutils literal">bt_peer_connection</tt>) or one of the
│ │ │ │ -web seed connections (<tt class="docutils literal">web_peer_connection</tt> or <tt class="docutils literal">http_seed_connection</tt>).
│ │ │ │ -In order to only attach to certain peers, make your
│ │ │ │ -torrent_plugin::new_connection only return a <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> for certain peer
│ │ │ │ -connection types</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_plugin
│ │ │ │ -{
│ │ │ │ -   virtual string_view <strong>type</strong> () const;
│ │ │ │ -   virtual void <strong>add_handshake</strong> (entry&amp;);
│ │ │ │ -   virtual void <strong>on_disconnect</strong> (error_code const&amp;);
│ │ │ │ -   virtual void <strong>on_connected</strong> ();
│ │ │ │ -   virtual bool <strong>on_handshake</strong> (span&lt;char const&gt;);
│ │ │ │ -   virtual bool <strong>on_extension_handshake</strong> (bdecode_node const&amp;);
│ │ │ │ -   virtual bool <strong>on_not_interested</strong> ();
│ │ │ │ -   virtual bool <strong>on_have</strong> (piece_index_t);
│ │ │ │ -   virtual bool <strong>on_choke</strong> ();
│ │ │ │ -   virtual bool <strong>on_interested</strong> ();
│ │ │ │ -   virtual bool <strong>on_request</strong> (peer_request const&amp;);
│ │ │ │ -   virtual bool <strong>on_have_none</strong> ();
│ │ │ │ -   virtual bool <strong>on_allowed_fast</strong> (piece_index_t);
│ │ │ │ -   virtual bool <strong>on_unchoke</strong> ();
│ │ │ │ -   virtual bool <strong>on_dont_have</strong> (piece_index_t);
│ │ │ │ -   virtual bool <strong>on_have_all</strong> ();
│ │ │ │ -   virtual bool <strong>on_bitfield</strong> (bitfield const&amp; <em>/*bitfield*/</em>);
│ │ │ │ -   virtual bool <strong>on_piece</strong> (peer_request const&amp; <em>/*piece*/</em>
│ │ │ │ -      , span&lt;char const&gt; <em>/*buf*/</em>);
│ │ │ │ -   virtual bool <strong>on_cancel</strong> (peer_request const&amp;);
│ │ │ │ -   virtual bool <strong>on_suggest</strong> (piece_index_t);
│ │ │ │ -   virtual bool <strong>on_reject</strong> (peer_request const&amp;);
│ │ │ │ -   virtual void <strong>sent_suggest</strong> (piece_index_t);
│ │ │ │ -   virtual void <strong>sent_cancel</strong> (peer_request const&amp;);
│ │ │ │ -   virtual void <strong>sent_choke</strong> ();
│ │ │ │ -   virtual void <strong>sent_request</strong> (peer_request const&amp;);
│ │ │ │ -   virtual void <strong>sent_allow_fast</strong> (piece_index_t);
│ │ │ │ -   virtual void <strong>sent_have_none</strong> ();
│ │ │ │ -   virtual void <strong>sent_reject_request</strong> (peer_request const&amp;);
│ │ │ │ -   virtual void <strong>sent_have_all</strong> ();
│ │ │ │ -   virtual void <strong>sent_unchoke</strong> ();
│ │ │ │ -   virtual void <strong>sent_interested</strong> ();
│ │ │ │ -   virtual void <strong>sent_piece</strong> (peer_request const&amp;);
│ │ │ │ -   virtual void <strong>sent_have</strong> (piece_index_t);
│ │ │ │ -   virtual void <strong>sent_not_interested</strong> ();
│ │ │ │ -   virtual void <strong>sent_payload</strong> (int <em>/* bytes */</em>);
│ │ │ │ -   virtual bool <strong>can_disconnect</strong> (error_code const&amp; <em>/*ec*/</em>);
│ │ │ │ -   virtual bool <strong>on_extended</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │ -      span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │ -   virtual bool <strong>on_unknown_message</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │ -      span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │ -   virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │ -   virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │ -   virtual void <strong>tick</strong> ();
│ │ │ │ -   virtual bool <strong>write_request</strong> (peer_request const&amp;);
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="type-1">
│ │ │ │ -<h2>type()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual string_view <strong>type</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>This function is expected to return the name of
│ │ │ │ -the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a>.</p>
│ │ │ │ -<a name="add_handshake()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Badd_handshake%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Badd_handshake%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-handshake">
│ │ │ │ -<h2>add_handshake()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>add_handshake</strong> (entry&amp;);
│ │ │ │ -</pre>
│ │ │ │ -<p>can add entries to the extension handshake
│ │ │ │ -this is not called for web seeds</p>
│ │ │ │ -<a name="on_disconnect()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_disconnect%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_disconnect%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-disconnect">
│ │ │ │ -<h2>on_disconnect()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>on_disconnect</strong> (error_code const&amp;);
│ │ │ │ -</pre>
│ │ │ │ -<p>called when the peer is being disconnected.</p>
│ │ │ │ -<a name="on_connected()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_connected%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_connected%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-connected">
│ │ │ │ -<h2>on_connected()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>on_connected</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>called when the peer is successfully connected. Note that
│ │ │ │ -incoming connections will have been connected by the time
│ │ │ │ -the peer <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> is attached to it, and won't have this hook
│ │ │ │ -called.</p>
│ │ │ │ -<a name="on_handshake()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_handshake%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_handshake%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-handshake">
│ │ │ │ -<h2>on_handshake()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>on_handshake</strong> (span&lt;char const&gt;);
│ │ │ │ -</pre>
│ │ │ │ -<p>this is called when the initial bittorrent handshake is received.
│ │ │ │ -Returning false means that the other end doesn't support this extension
│ │ │ │ -and will remove it from the list of plugins. this is not called for web
│ │ │ │ -seeds</p>
│ │ │ │ -<a name="on_extension_handshake()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_extension_handshake%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_extension_handshake%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-extension-handshake">
│ │ │ │ -<h2>on_extension_handshake()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>on_extension_handshake</strong> (bdecode_node const&amp;);
│ │ │ │ -</pre>
│ │ │ │ -<p>called when the extension handshake from the other end is received
│ │ │ │ -if this returns false, it means that this extension isn't
│ │ │ │ -supported by this peer. It will result in this <a class="reference external" href="reference-Plugins.html#peer_plugin">peer_plugin</a>
│ │ │ │ -being removed from the peer_connection and destructed.
│ │ │ │ -this is not called for web seeds</p>
│ │ │ │ -<a name="on_choke()"></a>
│ │ │ │ -<a name="on_unchoke()"></a>
│ │ │ │ -<a name="on_have_all()"></a>
│ │ │ │ -<a name="on_have_none()"></a>
│ │ │ │ -<a name="on_bitfield()"></a>
│ │ │ │ -<a name="on_not_interested()"></a>
│ │ │ │ -<a name="on_request()"></a>
│ │ │ │ -<a name="on_have()"></a>
│ │ │ │ -<a name="on_dont_have()"></a>
│ │ │ │ -<a name="on_interested()"></a>
│ │ │ │ -<a name="on_allowed_fast()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_choke%28%29+on_unchoke%28%29+on_have_all%28%29+on_have_none%28%29+on_bitfield%28%29+on_not_interested%28%29+on_request%28%29+on_have%28%29+on_dont_have%28%29+on_interested%28%29+on_allowed_fast%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_choke%28%29+on_unchoke%28%29+on_have_all%28%29+on_have_none%28%29+on_bitfield%28%29+on_not_interested%28%29+on_request%28%29+on_have%28%29+on_dont_have%28%29+on_interested%28%29+on_allowed_fast%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-choke-on-unchoke-on-have-all-on-have-none-on-bitfield-on-not-interested-on-request-on-have-on-dont-have-on-interested-on-allowed-fast">
│ │ │ │ -<h2>on_choke() on_unchoke() on_have_all() on_have_none() on_bitfield() on_not_interested() on_request() on_have() on_dont_have() on_interested() on_allowed_fast()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>on_not_interested</strong> ();
│ │ │ │ -virtual bool <strong>on_have</strong> (piece_index_t);
│ │ │ │ -virtual bool <strong>on_choke</strong> ();
│ │ │ │ -virtual bool <strong>on_interested</strong> ();
│ │ │ │ -virtual bool <strong>on_request</strong> (peer_request const&amp;);
│ │ │ │ -virtual bool <strong>on_have_none</strong> ();
│ │ │ │ -virtual bool <strong>on_allowed_fast</strong> (piece_index_t);
│ │ │ │ -virtual bool <strong>on_unchoke</strong> ();
│ │ │ │ -virtual bool <strong>on_dont_have</strong> (piece_index_t);
│ │ │ │ -virtual bool <strong>on_have_all</strong> ();
│ │ │ │ -virtual bool <strong>on_bitfield</strong> (bitfield const&amp; <em>/*bitfield*/</em>);
│ │ │ │ -</pre>
│ │ │ │ -<p>returning true from any of the message handlers
│ │ │ │ -indicates that the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> has handled the message.
│ │ │ │ -it will break the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> chain traversing and not let
│ │ │ │ -anyone else handle the message, including the default
│ │ │ │ -handler.</p>
│ │ │ │ -<a name="on_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-piece">
│ │ │ │ -<h2>on_piece()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>on_piece</strong> (peer_request const&amp; <em>/*piece*/</em>
│ │ │ │ -      , span&lt;char const&gt; <em>/*buf*/</em>);
│ │ │ │ -</pre>
│ │ │ │ -<p>This function is called when the peer connection is receiving
│ │ │ │ -a piece. <tt class="docutils literal">buf</tt> points (non-owning pointer) to the data in an
│ │ │ │ -internal immutable disk buffer. The length of the data is specified
│ │ │ │ -in the <tt class="docutils literal">length</tt> member of the <tt class="docutils literal">piece</tt> parameter.
│ │ │ │ -returns true to indicate that the piece is handled and the
│ │ │ │ -rest of the logic should be ignored.</p>
│ │ │ │ -<a name="sent_interested()"></a>
│ │ │ │ -<a name="sent_have()"></a>
│ │ │ │ -<a name="sent_not_interested()"></a>
│ │ │ │ -<a name="sent_piece()"></a>
│ │ │ │ -<a name="sent_unchoke()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bsent_interested%28%29+sent_have%28%29+sent_not_interested%28%29+sent_piece%28%29+sent_unchoke%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bsent_interested%28%29+sent_have%28%29+sent_not_interested%28%29+sent_piece%28%29+sent_unchoke%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="sent-interested-sent-have-sent-not-interested-sent-piece-sent-unchoke">
│ │ │ │ -<h2>sent_interested() sent_have() sent_not_interested() sent_piece() sent_unchoke()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>sent_unchoke</strong> ();
│ │ │ │ -virtual void <strong>sent_interested</strong> ();
│ │ │ │ -virtual void <strong>sent_piece</strong> (peer_request const&amp;);
│ │ │ │ -virtual void <strong>sent_have</strong> (piece_index_t);
│ │ │ │ -virtual void <strong>sent_not_interested</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>called after a choke message has been sent to the peer</p>
│ │ │ │ -<a name="sent_payload()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bsent_payload%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bsent_payload%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="sent-payload">
│ │ │ │ -<h2>sent_payload()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>sent_payload</strong> (int <em>/* bytes */</em>);
│ │ │ │ -</pre>
│ │ │ │ -<p>called after piece data has been sent to the peer
│ │ │ │ -this can be used for stats book keeping</p>
│ │ │ │ -<a name="can_disconnect()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bcan_disconnect%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bcan_disconnect%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="can-disconnect">
│ │ │ │ -<h2>can_disconnect()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>can_disconnect</strong> (error_code const&amp; <em>/*ec*/</em>);
│ │ │ │ -</pre>
│ │ │ │ -<p>called when libtorrent think this peer should be disconnected.
│ │ │ │ -if the <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> returns false, the peer will not be disconnected.</p>
│ │ │ │ -<a name="on_extended()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_extended%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_extended%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-extended">
│ │ │ │ -<h2>on_extended()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>on_extended</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │ -      span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │ -</pre>
│ │ │ │ -<p>called when an extended message is received. If returning true,
│ │ │ │ -the message is not processed by any other <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> and if false
│ │ │ │ -is returned the next <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> in the chain will receive it to
│ │ │ │ -be able to handle it. This is not called for web seeds.
│ │ │ │ -thus function may be called more than once per incoming message, but
│ │ │ │ -only the last of the calls will the <tt class="docutils literal">body</tt> size equal the <tt class="docutils literal">length</tt>.
│ │ │ │ -i.e. Every time another fragment of the message is received, this
│ │ │ │ -function will be called, until finally the whole message has been
│ │ │ │ -received. The purpose of this is to allow early disconnects for invalid
│ │ │ │ -messages and for reporting progress of receiving large messages.</p>
│ │ │ │ -<a name="on_unknown_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_unknown_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_unknown_message%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-unknown-message">
│ │ │ │ -<h2>on_unknown_message()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>on_unknown_message</strong> (int <em>/*length*/</em>, int <em>/*msg*/</em>,
│ │ │ │ -      span&lt;char const&gt; <em>/*body*/</em>);
│ │ │ │ -</pre>
│ │ │ │ -<p>this is not called for web seeds</p>
│ │ │ │ -<a name="on_piece_failed()"></a>
│ │ │ │ -<a name="on_piece_pass()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bon_piece_failed%28%29+on_piece_pass%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bon_piece_failed%28%29+on_piece_pass%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="on-piece-failed-on-piece-pass-1">
│ │ │ │ -<h2>on_piece_failed() on_piece_pass()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>on_piece_pass</strong> (piece_index_t);
│ │ │ │ -virtual void <strong>on_piece_failed</strong> (piece_index_t);
│ │ │ │ -</pre>
│ │ │ │ -<p>called when a piece that this peer participated in either
│ │ │ │ -fails or passes the hash_check</p>
│ │ │ │ -<a name="tick()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Btick%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Btick%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="tick-1">
│ │ │ │ -<h2>tick()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>tick</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>called approximately once every second</p>
│ │ │ │ -<a name="write_request()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_plugin%3A%3A%5Bwrite_request%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_plugin%3A%3A%5Bwrite_request%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="write-request">
│ │ │ │ -<h2>write_request()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual bool <strong>write_request</strong> (peer_request const&amp;);
│ │ │ │ -</pre>
│ │ │ │ -<p>called each time a request message is to be sent. If true
│ │ │ │ -is returned, the original request message won't be sent and
│ │ │ │ -no other <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> will have this function called.</p>
│ │ │ │ -<a name="crypto_plugin"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+crypto_plugin&labels=documentation&body=Documentation+under+heading+%22class+crypto_plugin%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="crypto-plugin">
│ │ │ │ -<h1>crypto_plugin</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions.hpp">libtorrent/extensions.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct crypto_plugin
│ │ │ │ -{
│ │ │ │ -   virtual void <strong>set_outgoing_key</strong> (span&lt;char const&gt; key) = 0;
│ │ │ │ -   virtual void <strong>set_incoming_key</strong> (span&lt;char const&gt; key) = 0;
│ │ │ │ -   <strong>encrypt</strong> (span&lt;span&lt;char&gt;&gt; <em>/*send_vec*/</em>) = 0;
│ │ │ │ -   virtual std::tuple&lt;int, int, int&gt; <strong>decrypt</strong> (span&lt;span&lt;char&gt;&gt; <em>/*receive_vec*/</em>) = 0;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="decrypt()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:crypto_plugin%3A%3A%5Bdecrypt%28%29%5D&labels=documentation&body=Documentation+under+heading+%22crypto_plugin%3A%3A%5Bdecrypt%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="decrypt">
│ │ │ │ -<h2>decrypt()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual std::tuple&lt;int, int, int&gt; <strong>decrypt</strong> (span&lt;span&lt;char&gt;&gt; <em>/*receive_vec*/</em>) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>decrypt the provided buffers.
│ │ │ │ -returns is a tuple representing the values
│ │ │ │ -(consume, produce, packet_size)</p>
│ │ │ │ -<p>consume is set to the number of bytes which should be trimmed from the
│ │ │ │ -head of the buffers, default is 0</p>
│ │ │ │ -<p>produce is set to the number of bytes of payload which are now ready to
│ │ │ │ -be sent to the upper layer. default is the number of bytes passed in receive_vec</p>
│ │ │ │ -<p>packet_size is set to the minimum number of bytes which must be read to
│ │ │ │ -advance the next step of decryption. default is 0</p>
│ │ │ │ -<a name="create_smart_ban_plugin()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_smart_ban_plugin%28%29&labels=documentation&body=Documentation+under+heading+%22create_smart_ban_plugin%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="create-smart-ban-plugin">
│ │ │ │ -<h1>create_smart_ban_plugin()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions/smart_ban.hpp">libtorrent/extensions/smart_ban.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::shared_ptr&lt;torrent_plugin&gt; <strong>create_smart_ban_plugin</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │ -</pre>
│ │ │ │ -<p>constructor function for the smart ban extension. The extension keeps
│ │ │ │ -track of the data peers have sent us for failing pieces and once the
│ │ │ │ -piece completes and passes the hash check bans the peers that turned
│ │ │ │ -out to have sent corrupt data.
│ │ │ │ -This function can either be passed in the add_torrent_params::extensions
│ │ │ │ -field, or via <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>.</p>
│ │ │ │ -<a name="create_ut_pex_plugin()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_ut_pex_plugin%28%29&labels=documentation&body=Documentation+under+heading+%22create_ut_pex_plugin%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="create-ut-pex-plugin">
│ │ │ │ -<h1>create_ut_pex_plugin()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions/ut_pex.hpp">libtorrent/extensions/ut_pex.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::shared_ptr&lt;torrent_plugin&gt; <strong>create_ut_pex_plugin</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │ -</pre>
│ │ │ │ -<p>constructor function for the ut_pex extension. The ut_pex
│ │ │ │ -extension allows peers to gossip about their connections, allowing
│ │ │ │ -the swarm stay well connected and peers aware of more peers in the
│ │ │ │ -swarm. This extension is enabled by default unless explicitly disabled in
│ │ │ │ -the <a class="reference external" href="reference-Session.html#session">session</a> constructor.</p>
│ │ │ │ -<p>This can either be passed in the add_torrent_params::extensions field, or
│ │ │ │ -via <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>.</p>
│ │ │ │ -<a name="create_ut_metadata_plugin()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_ut_metadata_plugin%28%29&labels=documentation&body=Documentation+under+heading+%22create_ut_metadata_plugin%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="create-ut-metadata-plugin">
│ │ │ │ -<h1>create_ut_metadata_plugin()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/extensions/ut_metadata.hpp">libtorrent/extensions/ut_metadata.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::shared_ptr&lt;torrent_plugin&gt; <strong>create_ut_metadata_plugin</strong> (torrent_handle const&amp;, client_data_t);
│ │ │ │ -</pre>
│ │ │ │ -<p>constructor function for the ut_metadata extension. The ut_metadata
│ │ │ │ -extension allows peers to request the .torrent file (or more
│ │ │ │ -specifically the info-dictionary of the .torrent file) from each
│ │ │ │ -other. This is the main building block in making magnet links work.
│ │ │ │ -This extension is enabled by default unless explicitly disabled in
│ │ │ │ -the <a class="reference external" href="reference-Session.html#session">session</a> constructor.</p>
│ │ │ │ -<p>This can either be passed in the add_torrent_params::extensions field, or
│ │ │ │ -via <a class="reference external" href="reference-Torrent_Handle.html#add_extension()">torrent_handle::add_extension()</a>.</p>
│ │ │ │ -<a name="torrent_status"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_status&labels=documentation&body=Documentation+under+heading+%22class+torrent_status%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="torrent-status">
│ │ │ │ -<h1>torrent_status</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_status.hpp">libtorrent/torrent_status.hpp</a>&quot;</p>
│ │ │ │ -<p>holds a snapshot of the status of a torrent, as queried by
│ │ │ │ -<a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct torrent_status
│ │ │ │ -{
│ │ │ │ -   bool <strong>operator==</strong> (torrent_status const&amp; st) const;
│ │ │ │ -
│ │ │ │ -   enum state_t
│ │ │ │ -   {
│ │ │ │ -      checking_files,
│ │ │ │ -      downloading_metadata,
│ │ │ │ -      downloading,
│ │ │ │ -      finished,
│ │ │ │ -      seeding,
│ │ │ │ -      unused_enum_for_backwards_compatibility_allocating,
│ │ │ │ -      checking_resume_data,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   torrent_handle handle;
│ │ │ │ -   error_code errc;
│ │ │ │ -   file_index_t <strong>error_file</strong>  = torrent_status::error_file_none;
│ │ │ │ -   static constexpr file_index_t <strong>error_file_none</strong> {-1};
│ │ │ │ -   static constexpr file_index_t <strong>error_file_ssl_ctx</strong> {-3};
│ │ │ │ -   static constexpr file_index_t <strong>error_file_metadata</strong> {-4};
│ │ │ │ -   static constexpr file_index_t <strong>error_file_exception</strong> {-5};
│ │ │ │ -   static constexpr file_index_t <strong>error_file_partfile</strong> {-6};
│ │ │ │ -   std::string save_path;
│ │ │ │ -   std::string name;
│ │ │ │ -   std::weak_ptr&lt;const torrent_info&gt; torrent_file;
│ │ │ │ -   time_duration <strong>next_announce</strong>  = seconds{0};
│ │ │ │ -   std::string current_tracker;
│ │ │ │ -   std::int64_t <strong>total_download</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>total_upload</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>total_payload_download</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>total_payload_upload</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>total_failed_bytes</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>total_redundant_bytes</strong>  = 0;
│ │ │ │ -   typed_bitfield&lt;piece_index_t&gt; pieces;
│ │ │ │ -   typed_bitfield&lt;piece_index_t&gt; verified_pieces;
│ │ │ │ -   std::int64_t <strong>total_done</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>total</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>total_wanted_done</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>total_wanted</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>all_time_upload</strong>  = 0;
│ │ │ │ -   std::int64_t <strong>all_time_download</strong>  = 0;
│ │ │ │ -   std::time_t <strong>added_time</strong>  = 0;
│ │ │ │ -   std::time_t <strong>completed_time</strong>  = 0;
│ │ │ │ -   std::time_t <strong>last_seen_complete</strong>  = 0;
│ │ │ │ -   storage_mode_t <strong>storage_mode</strong>  = storage_mode_sparse;
│ │ │ │ -   float <strong>progress</strong>  = 0.f;
│ │ │ │ -   int <strong>progress_ppm</strong>  = 0;
│ │ │ │ -   queue_position_t <strong>queue_position</strong> {};
│ │ │ │ -   int <strong>download_rate</strong>  = 0;
│ │ │ │ -   int <strong>upload_rate</strong>  = 0;
│ │ │ │ -   int <strong>download_payload_rate</strong>  = 0;
│ │ │ │ -   int <strong>upload_payload_rate</strong>  = 0;
│ │ │ │ -   int <strong>num_seeds</strong>  = 0;
│ │ │ │ -   int <strong>num_peers</strong>  = 0;
│ │ │ │ -   int <strong>num_complete</strong>  = -1;
│ │ │ │ -   int <strong>num_incomplete</strong>  = -1;
│ │ │ │ -   int <strong>list_seeds</strong>  = 0;
│ │ │ │ -   int <strong>list_peers</strong>  = 0;
│ │ │ │ -   int <strong>connect_candidates</strong>  = 0;
│ │ │ │ -   int <strong>num_pieces</strong>  = 0;
│ │ │ │ -   int <strong>distributed_full_copies</strong>  = 0;
│ │ │ │ -   int <strong>distributed_fraction</strong>  = 0;
│ │ │ │ -   float <strong>distributed_copies</strong>  = 0.f;
│ │ │ │ -   int <strong>block_size</strong>  = 0;
│ │ │ │ -   int <strong>num_uploads</strong>  = 0;
│ │ │ │ -   int <strong>num_connections</strong>  = 0;
│ │ │ │ -   int <strong>uploads_limit</strong>  = 0;
│ │ │ │ -   int <strong>connections_limit</strong>  = 0;
│ │ │ │ -   int <strong>up_bandwidth_queue</strong>  = 0;
│ │ │ │ -   int <strong>down_bandwidth_queue</strong>  = 0;
│ │ │ │ -   int <strong>seed_rank</strong>  = 0;
│ │ │ │ -   state_t <strong>state</strong>  = checking_resume_data;
│ │ │ │ -   bool <strong>need_save_resume</strong>  = false;
│ │ │ │ -   bool <strong>is_seeding</strong>  = false;
│ │ │ │ -   bool <strong>is_finished</strong>  = false;
│ │ │ │ -   bool <strong>has_metadata</strong>  = false;
│ │ │ │ -   bool <strong>has_incoming</strong>  = false;
│ │ │ │ -   bool <strong>moving_storage</strong>  = false;
│ │ │ │ -   bool <strong>announcing_to_trackers</strong>  = false;
│ │ │ │ -   bool <strong>announcing_to_lsd</strong>  = false;
│ │ │ │ -   bool <strong>announcing_to_dht</strong>  = false;
│ │ │ │ -   info_hash_t info_hashes;
│ │ │ │ -   time_point last_upload;
│ │ │ │ -   time_point last_download;
│ │ │ │ -   seconds active_duration;
│ │ │ │ -   seconds finished_duration;
│ │ │ │ -   seconds seeding_duration;
│ │ │ │ -   torrent_flags_t <strong>flags</strong> {};
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="operator==()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Boperator%3D%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Boperator%3D%3D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-3">
│ │ │ │ -<h2>operator==()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>operator==</strong> (torrent_status const&amp; st) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>compares if the torrent status objects come from the same torrent. i.e.
│ │ │ │ -only the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> field is compared.</p>
│ │ │ │ -<a name="state_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+state_t&labels=documentation&body=Documentation+under+heading+%22enum+state_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-state-t">
│ │ │ │ -<h2>enum state_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_status.hpp">libtorrent/torrent_status.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="44%" />
│ │ │ │ -<col width="6%" />
│ │ │ │ -<col width="50%" />
│ │ │ │ -</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>checking_files</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>The torrent has not started its download yet, and is
│ │ │ │ -currently checking existing files.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>downloading_metadata</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>The torrent is trying to download metadata from peers.
│ │ │ │ -This implies the ut_metadata extension is in use.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>downloading</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>The torrent is being downloaded. This is the state
│ │ │ │ -most torrents will be in most of the time. The progress
│ │ │ │ -meter will tell how much of the files that has been
│ │ │ │ -downloaded.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>finished</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>In this state the torrent has finished downloading but
│ │ │ │ -still doesn't have the entire torrent. i.e. some pieces
│ │ │ │ -are filtered and won't get downloaded.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>seeding</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>In this state the torrent has finished downloading and
│ │ │ │ -is a pure seeder.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>unused_enum_for_backwards_compatibility_allocating</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>If the torrent was started in full allocation mode, this
│ │ │ │ -indicates that the (disk) storage for the torrent is
│ │ │ │ -allocated.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>checking_resume_data</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>The torrent is currently checking the fast resume data and
│ │ │ │ -comparing it to the files on disk. This is typically
│ │ │ │ -completed in a fraction of a second, but if you add a
│ │ │ │ -large number of torrents at once, they will queue up.</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bhandle%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bhandle%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>handle</dt>
│ │ │ │ -<dd>a handle to the torrent whose status the object represents.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="errc"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berrc%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berrc%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>errc</dt>
│ │ │ │ -<dd>may be set to an error code describing why the torrent was paused, in
│ │ │ │ -case it was paused by an error. If the torrent is not paused or if it's
│ │ │ │ -paused but not because of an error, this error_code is not set.
│ │ │ │ -if the error is attributed specifically to a file, error_file is set to
│ │ │ │ -the index of that file in the .torrent file.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error_file"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error_file</dt>
│ │ │ │ -<dd>if the torrent is stopped because of an disk I/O error, this field
│ │ │ │ -contains the index of the file in the torrent that encountered the
│ │ │ │ -error. If the error did not originate in a file in the torrent, there
│ │ │ │ -are a few special values this can be set to: error_file_none,
│ │ │ │ -error_file_ssl_ctx, error_file_exception, error_file_partfile or
│ │ │ │ -error_file_metadata;</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error_file_none"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file_none%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file_none%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error_file_none</dt>
│ │ │ │ -<dd>special values for error_file to describe which file or component
│ │ │ │ -encountered the error (<tt class="docutils literal">errc</tt>).
│ │ │ │ -the error did not occur on a file</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error_file_ssl_ctx"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file_ssl_ctx%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file_ssl_ctx%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error_file_ssl_ctx</dt>
│ │ │ │ -<dd>the error occurred setting up the SSL context</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error_file_metadata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file_metadata%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file_metadata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error_file_metadata</dt>
│ │ │ │ -<dd>the error occurred while loading the metadata for the torrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error_file_exception"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file_exception%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file_exception%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error_file_exception</dt>
│ │ │ │ -<dd>there was a serious error reported in this torrent. The error code
│ │ │ │ -or a torrent log <a class="reference external" href="reference-Alerts.html#alert">alert</a> may provide more information.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="error_file_partfile"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file_partfile%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file_partfile%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>error_file_partfile</dt>
│ │ │ │ -<dd>the error occurred with the partfile</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="save_path"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bsave_path%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bsave_path%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>save_path</dt>
│ │ │ │ -<dd>the path to the directory where this torrent's files are stored.
│ │ │ │ -It's typically the path as was given to <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a> or
│ │ │ │ -<a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> when this torrent was started. This field is only
│ │ │ │ -included if the torrent status is queried with
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_handle::query_save_path</span></tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="name"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bname%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bname%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>name</dt>
│ │ │ │ -<dd>the name of the torrent. Typically this is derived from the
│ │ │ │ -.torrent file. In case the torrent was started without metadata,
│ │ │ │ -and hasn't completely received it yet, it returns the name given
│ │ │ │ -to it when added to the <a class="reference external" href="reference-Session.html#session">session</a>. See <tt class="docutils literal"><span class="pre">session::add_torrent</span></tt>.
│ │ │ │ -This field is only included if the torrent status is queried
│ │ │ │ -with <tt class="docutils literal"><span class="pre">torrent_handle::query_name</span></tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="torrent_file"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btorrent_file%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btorrent_file%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>torrent_file</dt>
│ │ │ │ -<dd>set to point to the <tt class="docutils literal">torrent_info</tt> object for this torrent. It's
│ │ │ │ -only included if the torrent status is queried with
│ │ │ │ -<tt class="docutils literal"><span class="pre">torrent_handle::query_torrent_file</span></tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="next_announce"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnext_announce%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnext_announce%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>next_announce</dt>
│ │ │ │ -<dd>the time until the torrent will announce itself to the tracker.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="current_tracker"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bcurrent_tracker%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bcurrent_tracker%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>current_tracker</dt>
│ │ │ │ -<dd>the URL of the last working tracker. If no tracker request has
│ │ │ │ -been successful yet, it's set to an empty string.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="total_download"></a>
│ │ │ │ -<a name="total_upload"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_download+total_upload%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_download+total_upload%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>total_download total_upload</dt>
│ │ │ │ -<dd>the number of bytes downloaded and uploaded to all peers, accumulated,
│ │ │ │ -<em>this session</em> only. The <a class="reference external" href="reference-Session.html#session">session</a> is considered to restart when a
│ │ │ │ -torrent is paused and restarted again. When a torrent is paused, these
│ │ │ │ -<a class="reference external" href="reference-Stats.html#counters">counters</a> are reset to 0. If you want complete, persistent, stats, see
│ │ │ │ -<tt class="docutils literal">all_time_upload</tt> and <tt class="docutils literal">all_time_download</tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="total_payload_download"></a>
│ │ │ │ -<a name="total_payload_upload"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_payload_download+total_payload_upload%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_payload_download+total_payload_upload%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>total_payload_download total_payload_upload</dt>
│ │ │ │ -<dd>counts the amount of bytes send and received this <a class="reference external" href="reference-Session.html#session">session</a>, but only
│ │ │ │ -the actual payload data (i.e the interesting data), these <a class="reference external" href="reference-Stats.html#counters">counters</a>
│ │ │ │ -ignore any protocol overhead. The <a class="reference external" href="reference-Session.html#session">session</a> is considered to restart
│ │ │ │ -when a torrent is paused and restarted again. When a torrent is
│ │ │ │ -paused, these <a class="reference external" href="reference-Stats.html#counters">counters</a> are reset to 0.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="total_failed_bytes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_failed_bytes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_failed_bytes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>total_failed_bytes</dt>
│ │ │ │ -<dd>the number of bytes that has been downloaded and that has failed the
│ │ │ │ -piece hash test. In other words, this is just how much crap that has
│ │ │ │ -been downloaded since the torrent was last started. If a torrent is
│ │ │ │ -paused and then restarted again, this counter will be reset.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="total_redundant_bytes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_redundant_bytes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_redundant_bytes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>total_redundant_bytes</dt>
│ │ │ │ -<dd>the number of bytes that has been downloaded even though that data
│ │ │ │ -already was downloaded. The reason for this is that in some situations
│ │ │ │ -the same data can be downloaded by mistake. When libtorrent sends
│ │ │ │ -requests to a peer, and the peer doesn't send a response within a
│ │ │ │ -certain timeout, libtorrent will re-request that block. Another
│ │ │ │ -situation when libtorrent may re-request blocks is when the requests
│ │ │ │ -it sends out are not replied in FIFO-order (it will re-request blocks
│ │ │ │ -that are skipped by an out of order block). This is supposed to be as
│ │ │ │ -low as possible. This only counts bytes since the torrent was last
│ │ │ │ -started. If a torrent is paused and then restarted again, this counter
│ │ │ │ -will be reset.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bpieces%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bpieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>pieces</dt>
│ │ │ │ -<dd>a bitmask that represents which pieces we have (set to true) and the
│ │ │ │ -pieces we don't have. It's a pointer and may be set to 0 if the
│ │ │ │ -torrent isn't downloading or seeding.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="verified_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bverified_pieces%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bverified_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>verified_pieces</dt>
│ │ │ │ -<dd>a bitmask representing which pieces has had their hash checked. This
│ │ │ │ -only applies to torrents in <em>seed mode</em>. If the torrent is not in seed
│ │ │ │ -mode, this bitmask may be empty.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="total_done"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_done%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_done%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>total_done</dt>
│ │ │ │ -<dd>the total number of bytes of the file(s) that we have. All this does
│ │ │ │ -not necessarily has to be downloaded during this <a class="reference external" href="reference-Session.html#session">session</a> (that's
│ │ │ │ -<tt class="docutils literal">total_payload_download</tt>).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="total"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>total</dt>
│ │ │ │ -<dd>the total number of bytes to download for this torrent. This
│ │ │ │ -may be less than the size of the torrent in case there are
│ │ │ │ -pad files. This number only counts bytes that will actually
│ │ │ │ -be requested from peers.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="total_wanted_done"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_wanted_done%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_wanted_done%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>total_wanted_done</dt>
│ │ │ │ -<dd>the number of bytes we have downloaded, only counting the pieces that
│ │ │ │ -we actually want to download. i.e. excluding any pieces that we have
│ │ │ │ -but have priority 0 (i.e. not wanted).
│ │ │ │ -Once a torrent becomes seed, any piece- and file priorities are
│ │ │ │ -forgotten and all bytes are considered &quot;wanted&quot;.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="total_wanted"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_wanted%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_wanted%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>total_wanted</dt>
│ │ │ │ -<dd>The total number of bytes we want to download. This may be smaller
│ │ │ │ -than the total torrent size in case any pieces are prioritized to 0,
│ │ │ │ -i.e.  not wanted.
│ │ │ │ -Once a torrent becomes seed, any piece- and file priorities are
│ │ │ │ -forgotten and all bytes are considered &quot;wanted&quot;.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="all_time_upload"></a>
│ │ │ │ -<a name="all_time_download"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Ball_time_upload+all_time_download%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Ball_time_upload+all_time_download%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>all_time_upload all_time_download</dt>
│ │ │ │ -<dd>are accumulated upload and download payload byte <a class="reference external" href="reference-Stats.html#counters">counters</a>. They are
│ │ │ │ -saved in and restored from resume data to keep totals across sessions.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="added_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Badded_time%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Badded_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>added_time</dt>
│ │ │ │ -<dd>the posix-time when this torrent was added. i.e. what <tt class="docutils literal">time(nullptr)</tt>
│ │ │ │ -returned at the time.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="completed_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bcompleted_time%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bcompleted_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>completed_time</dt>
│ │ │ │ -<dd>the posix-time when this torrent was finished. If the torrent is not
│ │ │ │ -yet finished, this is 0.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="last_seen_complete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Blast_seen_complete%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Blast_seen_complete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>last_seen_complete</dt>
│ │ │ │ -<dd>the time when we, or one of our peers, last saw a complete copy of
│ │ │ │ -this torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="storage_mode"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bstorage_mode%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bstorage_mode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>storage_mode</dt>
│ │ │ │ -<dd>The allocation mode for the torrent. See <a class="reference external" href="reference-Storage.html#storage_mode_t">storage_mode_t</a> for the
│ │ │ │ -options. For more information, see <a class="reference external" href="manual-ref.html#storage-allocation">storage allocation</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="progress"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bprogress%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bprogress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>progress</dt>
│ │ │ │ -<dd>a value in the range [0, 1], that represents the progress of the
│ │ │ │ -torrent's current task. It may be checking files or downloading.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="progress_ppm"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bprogress_ppm%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bprogress_ppm%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>progress_ppm</dt>
│ │ │ │ -<dd><p class="first">progress parts per million (progress * 1000000) when disabling
│ │ │ │ -floating point operations, this is the only option to query progress</p>
│ │ │ │ -<p class="last">reflects the same value as <tt class="docutils literal">progress</tt>, but instead in a range [0,
│ │ │ │ -1000000] (ppm = parts per million). When floating point operations are
│ │ │ │ -disabled, this is the only alternative to the floating point value in
│ │ │ │ -progress.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="queue_position"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bqueue_position%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bqueue_position%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>queue_position</dt>
│ │ │ │ -<dd>the position this torrent has in the download
│ │ │ │ -queue. If the torrent is a seed or finished, this is -1.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="download_rate"></a>
│ │ │ │ -<a name="upload_rate"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bdownload_rate+upload_rate%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bdownload_rate+upload_rate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>download_rate upload_rate</dt>
│ │ │ │ -<dd>the total rates for all peers for this torrent. These will usually
│ │ │ │ -have better precision than summing the rates from all peers. The rates
│ │ │ │ -are given as the number of bytes per second.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="download_payload_rate"></a>
│ │ │ │ -<a name="upload_payload_rate"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bdownload_payload_rate+upload_payload_rate%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bdownload_payload_rate+upload_payload_rate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>download_payload_rate upload_payload_rate</dt>
│ │ │ │ -<dd>the total transfer rate of payload only, not counting protocol
│ │ │ │ -chatter. This might be slightly smaller than the other rates, but if
│ │ │ │ -projected over a long time (e.g. when calculating ETA:s) the
│ │ │ │ -difference may be noticeable.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_seeds"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_seeds%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_seeds%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_seeds</dt>
│ │ │ │ -<dd>the number of peers that are seeding that this client is
│ │ │ │ -currently connected to.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_peers%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_peers</dt>
│ │ │ │ -<dd>the number of peers this torrent currently is connected to. Peer
│ │ │ │ -connections that are in the half-open state (is attempting to connect)
│ │ │ │ -or are queued for later connection attempt do not count. Although they
│ │ │ │ -are visible in the peer list when you call <a class="reference external" href="reference-Plugins.html#get_peer_info()">get_peer_info()</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_complete"></a>
│ │ │ │ -<a name="num_incomplete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_complete+num_incomplete%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_complete+num_incomplete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_complete num_incomplete</dt>
│ │ │ │ -<dd>if the tracker sends scrape info in its announce reply, these fields
│ │ │ │ -will be set to the total number of peers that have the whole file and
│ │ │ │ -the total number of peers that are still downloading. set to -1 if the
│ │ │ │ -tracker did not send any scrape data in its announce reply.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="list_seeds"></a>
│ │ │ │ -<a name="list_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Blist_seeds+list_peers%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Blist_seeds+list_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>list_seeds list_peers</dt>
│ │ │ │ -<dd>the number of seeds in our peer list and the total number of peers
│ │ │ │ -(including seeds). We are not necessarily connected to all the peers
│ │ │ │ -in our peer list. This is the number of peers we know of in total,
│ │ │ │ -including banned peers and peers that we have failed to connect to.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="connect_candidates"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bconnect_candidates%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bconnect_candidates%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>connect_candidates</dt>
│ │ │ │ -<dd>the number of peers in this torrent's peer list that is a candidate to
│ │ │ │ -be connected to. i.e. It has fewer connect attempts than the max fail
│ │ │ │ -count, it is not a seed if we are a seed, it is not banned etc. If
│ │ │ │ -this is 0, it means we don't know of any more peers that we can try.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_pieces%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_pieces</dt>
│ │ │ │ -<dd>the number of pieces that has been downloaded. It is equivalent to:
│ │ │ │ -<tt class="docutils literal"><span class="pre">std::accumulate(pieces-&gt;begin(),</span> <span class="pre">pieces-&gt;end())</span></tt>. So you don't have
│ │ │ │ -to count yourself. This can be used to see if anything has updated
│ │ │ │ -since last time if you want to keep a graph of the pieces up to date.
│ │ │ │ -Note that these pieces have not necessarily been written to disk yet,
│ │ │ │ -and there is a risk the write to disk will fail.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="distributed_full_copies"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bdistributed_full_copies%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bdistributed_full_copies%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>distributed_full_copies</dt>
│ │ │ │ -<dd>the number of distributed copies of the torrent. Note that one copy
│ │ │ │ -may be spread out among many peers. It tells how many copies there are
│ │ │ │ -currently of the rarest piece(s) among the peers this client is
│ │ │ │ -connected to.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="distributed_fraction"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bdistributed_fraction%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bdistributed_fraction%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>distributed_fraction</dt>
│ │ │ │ -<dd><p class="first">tells the share of pieces that have more copies than the rarest
│ │ │ │ -piece(s). Divide this number by 1000 to get the fraction.</p>
│ │ │ │ -<p>For example, if <tt class="docutils literal">distributed_full_copies</tt> is 2 and
│ │ │ │ -<tt class="docutils literal">distributed_fraction</tt> is 500, it means that the rarest pieces have
│ │ │ │ -only 2 copies among the peers this torrent is connected to, and that
│ │ │ │ -50% of all the pieces have more than two copies.</p>
│ │ │ │ -<p class="last">If we are a seed, the piece picker is deallocated as an optimization,
│ │ │ │ -and piece availability is no longer tracked. In this case the
│ │ │ │ -distributed copies members are set to -1.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="distributed_copies"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bdistributed_copies%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bdistributed_copies%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>distributed_copies</dt>
│ │ │ │ -<dd><p class="first">the number of distributed copies of the file. note that one copy may
│ │ │ │ -be spread out among many peers. This is a floating point
│ │ │ │ -representation of the distributed copies.</p>
│ │ │ │ -<dl class="last docutils">
│ │ │ │ -<dt>the integer part tells how many copies</dt>
│ │ │ │ -<dd>there are of the rarest piece(s)</dd>
│ │ │ │ -<dt>the fractional part tells the fraction of pieces that</dt>
│ │ │ │ -<dd>have more copies than the rarest piece(s).</dd>
│ │ │ │ -</dl>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="block_size"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bblock_size%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bblock_size%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>block_size</dt>
│ │ │ │ -<dd>the size of a block, in bytes. A block is a sub piece, it is the
│ │ │ │ -number of bytes that each piece request asks for and the number of
│ │ │ │ -bytes that each bit in the <tt class="docutils literal">partial_piece_info</tt>'s bitset represents,
│ │ │ │ -see <a class="reference external" href="reference-Torrent_Handle.html#get_download_queue()">get_download_queue()</a>. This is typically 16 kB, but it may be
│ │ │ │ -smaller, if the pieces are smaller.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_uploads"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_uploads%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_uploads%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_uploads</dt>
│ │ │ │ -<dd>the number of unchoked peers in this torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="num_connections"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_connections%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_connections%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>num_connections</dt>
│ │ │ │ -<dd>the number of peer connections this torrent has, including half-open
│ │ │ │ -connections that hasn't completed the bittorrent handshake yet. This
│ │ │ │ -is always &gt;= <tt class="docutils literal">num_peers</tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="uploads_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Buploads_limit%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Buploads_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>uploads_limit</dt>
│ │ │ │ -<dd>the set limit of upload slots (unchoked peers) for this torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="connections_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bconnections_limit%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bconnections_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>connections_limit</dt>
│ │ │ │ -<dd>the set limit of number of connections for this torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="up_bandwidth_queue"></a>
│ │ │ │ -<a name="down_bandwidth_queue"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bup_bandwidth_queue+down_bandwidth_queue%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bup_bandwidth_queue+down_bandwidth_queue%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>up_bandwidth_queue down_bandwidth_queue</dt>
│ │ │ │ -<dd>the number of peers in this torrent that are waiting for more
│ │ │ │ -bandwidth quota from the torrent rate limiter. This can determine if
│ │ │ │ -the rate you get from this torrent is bound by the torrents limit or
│ │ │ │ -not. If there is no limit set on this torrent, the peers might still
│ │ │ │ -be waiting for bandwidth quota from the global limiter, but then they
│ │ │ │ -are counted in the <tt class="docutils literal">session_status</tt> object.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="seed_rank"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bseed_rank%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bseed_rank%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>seed_rank</dt>
│ │ │ │ -<dd>A rank of how important it is to seed the torrent, it is used to
│ │ │ │ -determine which torrents to seed and which to queue. It is based on
│ │ │ │ -the peer to seed ratio from the tracker scrape. For more information,
│ │ │ │ -see <a class="reference external" href="manual-ref.html#queuing">queuing</a>. Higher value means more important to seed</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bstate%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bstate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>state</dt>
│ │ │ │ -<dd>the main state the torrent is in. See <a class="reference external" href="reference-Torrent_Status.html#state_t">torrent_status::state_t</a>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="need_save_resume"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bneed_save_resume%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bneed_save_resume%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>need_save_resume</dt>
│ │ │ │ -<dd>true if this torrent has unsaved changes
│ │ │ │ -to its download state and statistics since the last resume data
│ │ │ │ -was saved.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="is_seeding"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bis_seeding%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bis_seeding%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>is_seeding</dt>
│ │ │ │ -<dd>true if all pieces have been downloaded.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="is_finished"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bis_finished%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bis_finished%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>is_finished</dt>
│ │ │ │ -<dd>true if all pieces that have a priority &gt; 0 are downloaded. There is
│ │ │ │ -only a distinction between finished and seeding if some pieces or
│ │ │ │ -files have been set to priority 0, i.e. are not downloaded.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="has_metadata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bhas_metadata%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bhas_metadata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>has_metadata</dt>
│ │ │ │ -<dd>true if this torrent has metadata (either it was started from a
│ │ │ │ -.torrent file or the metadata has been downloaded). The only scenario
│ │ │ │ -where this can be false is when the torrent was started torrent-less
│ │ │ │ -(i.e. with just an info-hash and tracker ip, a magnet link for
│ │ │ │ -instance).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="has_incoming"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bhas_incoming%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bhas_incoming%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>has_incoming</dt>
│ │ │ │ -<dd>true if there has ever been an incoming connection attempt to this
│ │ │ │ -torrent.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="moving_storage"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bmoving_storage%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bmoving_storage%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>moving_storage</dt>
│ │ │ │ -<dd>this is true if this torrent's storage is currently being moved from
│ │ │ │ -one location to another. This may potentially be a long operation
│ │ │ │ -if a large file ends up being copied from one drive to another.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="announcing_to_trackers"></a>
│ │ │ │ -<a name="announcing_to_lsd"></a>
│ │ │ │ -<a name="announcing_to_dht"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bannouncing_to_trackers+announcing_to_lsd+announcing_to_dht%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bannouncing_to_trackers+announcing_to_lsd+announcing_to_dht%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>announcing_to_trackers announcing_to_lsd announcing_to_dht</dt>
│ │ │ │ -<dd>these are set to true if this torrent is allowed to announce to the
│ │ │ │ -respective peer source. Whether they are true or false is determined by
│ │ │ │ -the queue logic/auto manager. Torrents that are not auto managed will
│ │ │ │ -always be allowed to announce to all peer sources.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>info_hashes</dt>
│ │ │ │ -<dd>the info-hash for this torrent</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="last_upload"></a>
│ │ │ │ -<a name="last_download"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Blast_upload+last_download%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Blast_upload+last_download%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>last_upload last_download</dt>
│ │ │ │ -<dd>the timestamps of the last time this torrent uploaded or downloaded
│ │ │ │ -payload to any peer.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="active_duration"></a>
│ │ │ │ -<a name="finished_duration"></a>
│ │ │ │ -<a name="seeding_duration"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bactive_duration+finished_duration+seeding_duration%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bactive_duration+finished_duration+seeding_duration%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>active_duration finished_duration seeding_duration</dt>
│ │ │ │ -<dd>these are cumulative <a class="reference external" href="reference-Stats.html#counters">counters</a> of for how long the torrent has been in
│ │ │ │ -different states. active means not paused and added to <a class="reference external" href="reference-Session.html#session">session</a>. Whether
│ │ │ │ -it has found any peers or not is not relevant.
│ │ │ │ -finished means all selected files/pieces were downloaded and available
│ │ │ │ -to other peers (this is always a subset of active time).
│ │ │ │ -seeding means all files/pieces were downloaded and available to
│ │ │ │ -peers. Being available to peers does not imply there are other peers
│ │ │ │ -asking for the payload.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bflags%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bflags%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>flags</dt>
│ │ │ │ -<dd>reflects several of the torrent's flags. For more
│ │ │ │ -information, see <tt class="docutils literal"><span class="pre">torrent_handle::flags()</span></tt>.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="peer_class_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_class_info&labels=documentation&body=Documentation+under+heading+%22class+peer_class_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="peer-class-info">
│ │ │ │ -<h1>peer_class_info</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_class.hpp">libtorrent/peer_class.hpp</a>&quot;</p>
│ │ │ │ -<p>holds settings for a peer class. Used in <a class="reference external" href="reference-Session.html#set_peer_class()">set_peer_class()</a> and
│ │ │ │ -<a class="reference external" href="reference-Session.html#get_peer_class()">get_peer_class()</a> calls.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_class_info
│ │ │ │ -{
│ │ │ │ -   bool ignore_unchoke_slots;
│ │ │ │ -   int connection_limit_factor;
│ │ │ │ -   std::string label;
│ │ │ │ -   int upload_limit;
│ │ │ │ -   int download_limit;
│ │ │ │ -   int upload_priority;
│ │ │ │ -   int download_priority;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="ignore_unchoke_slots"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_info%3A%3A%5Bignore_unchoke_slots%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_info%3A%3A%5Bignore_unchoke_slots%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>ignore_unchoke_slots</dt>
│ │ │ │ -<dd><tt class="docutils literal">ignore_unchoke_slots</tt> determines whether peers should always
│ │ │ │ -unchoke a peer, regardless of the choking algorithm, or if it should
│ │ │ │ -honor the unchoke slot limits. It's used for local peers by default.
│ │ │ │ -If <em>any</em> of the peer classes a peer belongs to has this set to true,
│ │ │ │ -that peer will be unchoked at all times.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="connection_limit_factor"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_info%3A%3A%5Bconnection_limit_factor%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_info%3A%3A%5Bconnection_limit_factor%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>connection_limit_factor</dt>
│ │ │ │ -<dd>adjusts the connection limit (global and per torrent) that applies to
│ │ │ │ -this peer class. By default, local peers are allowed to exceed the
│ │ │ │ -normal connection limit for instance. This is specified as a percent
│ │ │ │ -factor. 100 makes the peer class apply normally to the limit. 200
│ │ │ │ -means as long as there are fewer connections than twice the limit, we
│ │ │ │ -accept this peer. This factor applies both to the global connection
│ │ │ │ -limit and the per-torrent limit. Note that if not used carefully one
│ │ │ │ -peer class can potentially completely starve out all other over time.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="label"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_info%3A%3A%5Blabel%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_info%3A%3A%5Blabel%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>label</dt>
│ │ │ │ -<dd>not used by libtorrent. It's intended as a potentially user-facing
│ │ │ │ -identifier of this peer class.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="upload_limit"></a>
│ │ │ │ -<a name="download_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_info%3A%3A%5Bupload_limit+download_limit%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_info%3A%3A%5Bupload_limit+download_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>upload_limit download_limit</dt>
│ │ │ │ -<dd>transfer rates limits for the whole peer class. They are specified in
│ │ │ │ -bytes per second and apply to the sum of all peers that are members of
│ │ │ │ -this class.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="upload_priority"></a>
│ │ │ │ -<a name="download_priority"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_info%3A%3A%5Bupload_priority+download_priority%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_info%3A%3A%5Bupload_priority+download_priority%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>upload_priority download_priority</dt>
│ │ │ │ -<dd>relative priorities used by the bandwidth allocator in the rate
│ │ │ │ -limiter. If no rate limits are in use, the priority is not used
│ │ │ │ -either. Priorities start at 1 (0 is not a valid priority) and may not
│ │ │ │ -exceed 255.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="peer_class_type_filter"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_class_type_filter&labels=documentation&body=Documentation+under+heading+%22class+peer_class_type_filter%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="peer-class-type-filter">
│ │ │ │ -<h1>peer_class_type_filter</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_class_type_filter.hpp">libtorrent/peer_class_type_filter.hpp</a>&quot;</p>
│ │ │ │ -<p><tt class="docutils literal">peer_class_type_filter</tt> is a simple container for rules for adding and subtracting
│ │ │ │ -peer-classes from peers. It is applied <em>after</em> the peer class filter is applied (which
│ │ │ │ -is based on the peer's IP address).</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct peer_class_type_filter
│ │ │ │ -{
│ │ │ │ -   void <strong>add</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ -   void <strong>remove</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ -   void <strong>allow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ -   void <strong>disallow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ -   std::uint32_t <strong>apply</strong> (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ │ -   friend bool <strong>operator==</strong> (peer_class_type_filter const&amp; lhs
│ │ │ │ -      , peer_class_type_filter const&amp; rhs);
│ │ │ │ -
│ │ │ │ -   enum socket_type_t
│ │ │ │ -   {
│ │ │ │ -      tcp_socket,
│ │ │ │ -      utp_socket,
│ │ │ │ -      ssl_tcp_socket,
│ │ │ │ -      ssl_utp_socket,
│ │ │ │ -      i2p_socket,
│ │ │ │ -      num_socket_types,
│ │ │ │ -   };
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="remove()"></a>
│ │ │ │ -<a name="add()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_type_filter%3A%3A%5Bremove%28%29+add%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_type_filter%3A%3A%5Bremove%28%29+add%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="remove-add">
│ │ │ │ -<h2>remove() add()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ -void <strong>remove</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">add()</tt> and <tt class="docutils literal">remove()</tt> adds and removes a peer class to be added
│ │ │ │ -to new peers based on socket type.</p>
│ │ │ │ -<a name="disallow()"></a>
│ │ │ │ -<a name="allow()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_type_filter%3A%3A%5Bdisallow%28%29+allow%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_type_filter%3A%3A%5Bdisallow%28%29+allow%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="disallow-allow">
│ │ │ │ -<h2>disallow() allow()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>allow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ -void <strong>disallow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">disallow()</tt> and <tt class="docutils literal">allow()</tt> adds and removes a peer class to be
│ │ │ │ -removed from new peers based on socket type.</p>
│ │ │ │ -<p>The <tt class="docutils literal">peer_class</tt> argument cannot be greater than 31. The bitmasks representing
│ │ │ │ -peer classes in the <tt class="docutils literal">peer_class_type_filter</tt> are 32 bits.</p>
│ │ │ │ -<a name="apply()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_type_filter%3A%3A%5Bapply%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_type_filter%3A%3A%5Bapply%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="apply">
│ │ │ │ -<h2>apply()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::uint32_t <strong>apply</strong> (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ │ -</pre>
│ │ │ │ -<p>takes a bitmask of peer classes and returns a new bitmask of
│ │ │ │ -peer classes after the rules have been applied, based on the socket type argument
│ │ │ │ -(<tt class="docutils literal">st</tt>).</p>
│ │ │ │ -<a name="socket_type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+socket_type_t&labels=documentation&body=Documentation+under+heading+%22enum+socket_type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-socket-type-t-1">
│ │ │ │ -<h2>enum socket_type_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_class_type_filter.hpp">libtorrent/peer_class_type_filter.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="24%" />
│ │ │ │ -<col width="9%" />
│ │ │ │ -<col width="67%" />
│ │ │ │ -</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>tcp_socket</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>these match the socket types from socket_type.hpp
│ │ │ │ -shifted one down</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>utp_socket</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>ssl_tcp_socket</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>ssl_utp_socket</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>i2p_socket</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>num_socket_types</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>You have some control over <a class="reference external" href="reference-Session.html#session">session</a> configuration through the session::apply_settings()
│ │ │ │ -member function. To change one or more configuration options, create a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>
│ │ │ │ -object and fill it with the settings to be set and pass it in to session::apply_settings().</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> object is a collection of settings updates that are applied
│ │ │ │ -to the <a class="reference external" href="reference-Session.html#session">session</a> when passed to session::apply_settings(). It's empty when
│ │ │ │ -constructed.</p>
│ │ │ │ -<p>You have control over proxy and authorization settings and also the user-agent
│ │ │ │ -that will be sent to the tracker. The user-agent will also be used to identify the
│ │ │ │ -client with other peers.</p>
│ │ │ │ -<p>Each configuration option is named with an enum value inside the
│ │ │ │ -<a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> class. These are the available settings:</p>
│ │ │ │ -<a name="disk_observer"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+disk_observer&labels=documentation&body=Documentation+under+heading+%22class+disk_observer%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="disk-observer">
│ │ │ │ -<h1>disk_observer</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_observer.hpp">libtorrent/disk_observer.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct disk_observer
│ │ │ │ -{
│ │ │ │ -   virtual void <strong>on_disk</strong> () = 0;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="on_disk()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_observer%3A%3A%5Bon_disk%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_observer%3A%3A%5Bon_disk%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="on-disk">
│ │ │ │ -<h2>on_disk()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>on_disk</strong> () = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>called when the disk cache size has dropped
│ │ │ │ -below the low watermark again and we can
│ │ │ │ -resume downloading from peers</p>
│ │ │ │ -<a name="open_file_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+open_file_state&labels=documentation&body=Documentation+under+heading+%22class+open_file_state%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="open-file-state">
│ │ │ │ -<h1>open_file_state</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_interface.hpp">libtorrent/disk_interface.hpp</a>&quot;</p>
│ │ │ │ -<p>this contains information about a file that's currently open by the
│ │ │ │ -libtorrent disk I/O subsystem. It's associated with a single torrent.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct open_file_state
│ │ │ │ -{
│ │ │ │ -   file_index_t file_index;
│ │ │ │ -   file_open_mode_t open_mode;
│ │ │ │ -   time_point last_use;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="file_index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:open_file_state%3A%3A%5Bfile_index%5D&labels=documentation&body=Documentation+under+heading+%22open_file_state%3A%3A%5Bfile_index%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>file_index</dt>
│ │ │ │ -<dd>the index of the file this <a class="reference external" href="reference-Bencoding.html#entry">entry</a> refers to into the <tt class="docutils literal">file_storage</tt>
│ │ │ │ -file list of this torrent. This starts indexing at 0.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="open_mode"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:open_file_state%3A%3A%5Bopen_mode%5D&labels=documentation&body=Documentation+under+heading+%22open_file_state%3A%3A%5Bopen_mode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>open_mode</dt>
│ │ │ │ -<dd><p class="first"><tt class="docutils literal">open_mode</tt> is a bitmask of the file flags this file is currently
│ │ │ │ -opened with. For possible flags, see <a class="reference external" href="reference-Custom_Storage.html#file_open_mode_t">file_open_mode_t</a>.</p>
│ │ │ │ -<p class="last">Note that the read/write mode is not a bitmask. The two least significant bits are used
│ │ │ │ -to represent the read/write mode. Those bits can be masked out using the <tt class="docutils literal">rw_mask</tt> constant.</p>
│ │ │ │ -</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="last_use"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:open_file_state%3A%3A%5Blast_use%5D&labels=documentation&body=Documentation+under+heading+%22open_file_state%3A%3A%5Blast_use%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>last_use</dt>
│ │ │ │ -<dd>a (high precision) timestamp of when the file was last used.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="disk_interface"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+disk_interface&labels=documentation&body=Documentation+under+heading+%22class+disk_interface%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="disk-interface">
│ │ │ │ -<h1>disk_interface</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_interface.hpp">libtorrent/disk_interface.hpp</a>&quot;</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a> is the customization point for disk I/O in libtorrent.
│ │ │ │ -implement this interface and provide a factory function to the <a class="reference external" href="reference-Session.html#session">session</a> constructor
│ │ │ │ -use custom disk I/O. All functions on the disk subsystem (implementing
│ │ │ │ -<a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a>) are called from within libtorrent's network thread. For
│ │ │ │ -disk I/O to be performed in a separate thread, the disk subsystem has to
│ │ │ │ -manage that itself.</p>
│ │ │ │ -<p>Although the functions are called <tt class="docutils literal">async_*</tt>, they do not technically
│ │ │ │ -<em>have</em> to be asynchronous, but they support being asynchronous, by
│ │ │ │ -expecting the result passed back into a callback. The callbacks must be
│ │ │ │ -posted back onto the network thread via the io_context object passed into
│ │ │ │ -the constructor. The callbacks will be run in the network thread.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct disk_interface
│ │ │ │ -{
│ │ │ │ -   virtual storage_holder <strong>new_torrent</strong> (storage_params const&amp; p
│ │ │ │ -      , std::shared_ptr&lt;void&gt; const&amp; torrent) = 0;
│ │ │ │ -   virtual void <strong>remove_torrent</strong> (storage_index_t) = 0;
│ │ │ │ -   virtual void <strong>async_read</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ -      , std::function&lt;void(disk_buffer_holder, storage_error const&amp;)&gt; handler
│ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ -   virtual bool <strong>async_write</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ -      , char const* buf, std::shared_ptr&lt;disk_observer&gt; o
│ │ │ │ -      , std::function&lt;void(storage_error const&amp;)&gt; handler
│ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ -   virtual void <strong>async_hash</strong> (storage_index_t storage, piece_index_t piece, span&lt;sha256_hash&gt; v2
│ │ │ │ -      , disk_job_flags_t flags
│ │ │ │ -      , std::function&lt;void(piece_index_t, sha1_hash const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -   virtual void <strong>async_hash2</strong> (storage_index_t storage, piece_index_t piece, int offset, disk_job_flags_t flags
│ │ │ │ -      , std::function&lt;void(piece_index_t, sha256_hash const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -   virtual void <strong>async_move_storage</strong> (storage_index_t storage, std::string p, move_flags_t flags
│ │ │ │ -      , std::function&lt;void(status_t, std::string const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -   virtual void <strong>async_release_files</strong> (storage_index_t storage
│ │ │ │ -      , std::function&lt;void()&gt; handler = std::function&lt;void()&gt;()) = 0;
│ │ │ │ -   virtual void <strong>async_check_files</strong> (storage_index_t storage
│ │ │ │ -      , add_torrent_params const* resume_data
│ │ │ │ -      , aux::vector&lt;std::string, file_index_t&gt; links
│ │ │ │ -      , std::function&lt;void(status_t, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -   virtual void <strong>async_stop_torrent</strong> (storage_index_t storage
│ │ │ │ -      , std::function&lt;void()&gt; handler = std::function&lt;void()&gt;()) = 0;
│ │ │ │ -   virtual void <strong>async_rename_file</strong> (storage_index_t storage
│ │ │ │ -      , file_index_t index, std::string name
│ │ │ │ -      , std::function&lt;void(std::string const&amp;, file_index_t, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -   virtual void <strong>async_delete_files</strong> (storage_index_t storage, remove_flags_t options
│ │ │ │ -      , std::function&lt;void(storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -   virtual void <strong>async_set_file_priority</strong> (storage_index_t storage
│ │ │ │ -      , aux::vector&lt;download_priority_t, file_index_t&gt; prio
│ │ │ │ -      , std::function&lt;void(storage_error const&amp;
│ │ │ │ -      , aux::vector&lt;download_priority_t, file_index_t&gt;)&gt; handler) = 0;
│ │ │ │ -   virtual void <strong>async_clear_piece</strong> (storage_index_t storage, piece_index_t index
│ │ │ │ -      , std::function&lt;void(piece_index_t)&gt; handler) = 0;
│ │ │ │ -   virtual void <strong>update_stats_counters</strong> (counters&amp; c) const = 0;
│ │ │ │ -   virtual std::vector&lt;open_file_state&gt; <strong>get_status</strong> (storage_index_t) const = 0;
│ │ │ │ -   virtual void <strong>abort</strong> (bool wait) = 0;
│ │ │ │ -   virtual void <strong>submit_jobs</strong> () = 0;
│ │ │ │ -   virtual void <strong>settings_updated</strong> () = 0;
│ │ │ │ -
│ │ │ │ -   static constexpr disk_job_flags_t <strong>force_copy</strong>  = 0_bit;
│ │ │ │ -   static constexpr disk_job_flags_t <strong>sequential_access</strong>  = 3_bit;
│ │ │ │ -   static constexpr disk_job_flags_t <strong>volatile_read</strong>  = 4_bit;
│ │ │ │ -   static constexpr disk_job_flags_t <strong>v1_hash</strong>  = 5_bit;
│ │ │ │ -   static constexpr disk_job_flags_t <strong>flush_piece</strong>  = 7_bit;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="new_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bnew_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bnew_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="new-torrent-1">
│ │ │ │ -<h2>new_torrent()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual storage_holder <strong>new_torrent</strong> (storage_params const&amp; p
│ │ │ │ -      , std::shared_ptr&lt;void&gt; const&amp; torrent) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>this is called when a new torrent is added. The shared_ptr can be
│ │ │ │ -used to hold the internal torrent object alive as long as there are
│ │ │ │ -outstanding disk operations on the storage.
│ │ │ │ -The returned <a class="reference external" href="reference-Custom_Storage.html#storage_holder">storage_holder</a> is an owning reference to the underlying
│ │ │ │ -storage that was just created. It is fundamentally a storage_index_t</p>
│ │ │ │ -<a name="remove_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bremove_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bremove_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="remove-torrent-1">
│ │ │ │ -<h2>remove_torrent()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>remove_torrent</strong> (storage_index_t) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>remove the storage with the specified index. This is not expected to
│ │ │ │ -delete any files from disk, just to clean up any resources associated
│ │ │ │ -with the specified storage.</p>
│ │ │ │ -<a name="async_read()"></a>
│ │ │ │ -<a name="async_write()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_read%28%29+async_write%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_read%28%29+async_write%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-read-async-write">
│ │ │ │ -<h2>async_read() async_write()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_read</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ -      , std::function&lt;void(disk_buffer_holder, storage_error const&amp;)&gt; handler
│ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ -virtual bool <strong>async_write</strong> (storage_index_t storage, peer_request const&amp; r
│ │ │ │ -      , char const* buf, std::shared_ptr&lt;disk_observer&gt; o
│ │ │ │ -      , std::function&lt;void(storage_error const&amp;)&gt; handler
│ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>perform a read or write operation from/to the specified storage
│ │ │ │ -index and the specified request. When the operation completes, call
│ │ │ │ -handler possibly with a <a class="reference external" href="reference-Custom_Storage.html#disk_buffer_holder">disk_buffer_holder</a>, holding the buffer with
│ │ │ │ -the result. Flags may be set to affect the read operation. See
│ │ │ │ -disk_job_flags_t.</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Custom_Storage.html#disk_observer">disk_observer</a> is a callback to indicate that
│ │ │ │ -the store buffer/disk write queue is below the watermark to let peers
│ │ │ │ -start writing buffers to disk again. When <tt class="docutils literal">async_write()</tt> returns
│ │ │ │ -<tt class="docutils literal">true</tt>, indicating the write queue is full, the peer will stop
│ │ │ │ -further writes and wait for the passed-in <tt class="docutils literal">disk_observer</tt> to be
│ │ │ │ -notified before resuming.</p>
│ │ │ │ -<p>Note that for <tt class="docutils literal">async_read</tt>, the <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> (<tt class="docutils literal">r</tt>) is not
│ │ │ │ -necessarily aligned to blocks (but it is most of the time). However,
│ │ │ │ -all writes (passed to <tt class="docutils literal">async_write</tt>) are guaranteed to be block
│ │ │ │ -aligned.</p>
│ │ │ │ -<a name="async_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-hash">
│ │ │ │ -<h2>async_hash()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_hash</strong> (storage_index_t storage, piece_index_t piece, span&lt;sha256_hash&gt; v2
│ │ │ │ -      , disk_job_flags_t flags
│ │ │ │ -      , std::function&lt;void(piece_index_t, sha1_hash const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>Compute hash(es) for the specified piece. Unless the v1_hash flag is
│ │ │ │ -set (in <tt class="docutils literal">flags</tt>), the SHA-1 hash of the whole piece does not need
│ │ │ │ -to be computed.</p>
│ │ │ │ -<p>The <cite>v2</cite> span is optional and can be empty, which means v2 hashes
│ │ │ │ -should not be computed. If v2 is non-empty it must be at least large
│ │ │ │ -enough to hold all v2 blocks in the piece, and this function will
│ │ │ │ -fill in the span with the SHA-256 block hashes of the piece.</p>
│ │ │ │ -<a name="async_hash2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_hash2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_hash2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-hash2">
│ │ │ │ -<h2>async_hash2()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_hash2</strong> (storage_index_t storage, piece_index_t piece, int offset, disk_job_flags_t flags
│ │ │ │ -      , std::function&lt;void(piece_index_t, sha256_hash const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>computes the v2 hash (SHA-256) of a single block. The block at
│ │ │ │ -<tt class="docutils literal">offset</tt> in piece <tt class="docutils literal">piece</tt>.</p>
│ │ │ │ -<a name="async_move_storage()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_move_storage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_move_storage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-move-storage">
│ │ │ │ -<h2>async_move_storage()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_move_storage</strong> (storage_index_t storage, std::string p, move_flags_t flags
│ │ │ │ -      , std::function&lt;void(status_t, std::string const&amp;, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>called to request the files for the specified storage/torrent be
│ │ │ │ -moved to a new location. It is the disk I/O object's responsibility
│ │ │ │ -to synchronize this with any currently outstanding disk operations to
│ │ │ │ -the storage. Whether files are replaced at the destination path or
│ │ │ │ -not is controlled by <tt class="docutils literal">flags</tt> (see <a class="reference external" href="reference-Storage.html#move_flags_t">move_flags_t</a>).</p>
│ │ │ │ -<a name="async_release_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_release_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_release_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-release-files">
│ │ │ │ -<h2>async_release_files()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_release_files</strong> (storage_index_t storage
│ │ │ │ -      , std::function&lt;void()&gt; handler = std::function&lt;void()&gt;()) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>This is called on disk I/O objects to request they close all open
│ │ │ │ -files for the specified storage/torrent. If file handles are not
│ │ │ │ -pooled/cached, it can be a no-op. For truly asynchronous disk I/O,
│ │ │ │ -this should provide at least one point in time when all files are
│ │ │ │ -closed. It is possible that later asynchronous operations will
│ │ │ │ -re-open some of the files, by the time this completion handler is
│ │ │ │ -called, that's fine.</p>
│ │ │ │ -<a name="async_check_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_check_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_check_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-check-files">
│ │ │ │ -<h2>async_check_files()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_check_files</strong> (storage_index_t storage
│ │ │ │ -      , add_torrent_params const* resume_data
│ │ │ │ -      , aux::vector&lt;std::string, file_index_t&gt; links
│ │ │ │ -      , std::function&lt;void(status_t, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>this is called when torrents are added to validate their resume data
│ │ │ │ -against the files on disk. This function is expected to do a few things:</p>
│ │ │ │ -<p>if <tt class="docutils literal">links</tt> is non-empty, it contains a string for each file in the
│ │ │ │ -torrent. The string being a path to an existing identical file. The
│ │ │ │ -default behavior is to create hard links of those files into the
│ │ │ │ -storage of the new torrent (specified by <tt class="docutils literal">storage</tt>). An empty
│ │ │ │ -string indicates that there is no known identical file. This is part
│ │ │ │ -of the &quot;mutable torrent&quot; feature, where files can be reused from
│ │ │ │ -other torrents.</p>
│ │ │ │ -<p>The <tt class="docutils literal">resume_data</tt> points the resume data passed in by the client.</p>
│ │ │ │ -<p>If the <tt class="docutils literal"><span class="pre">resume_data-&gt;flags</span></tt> field has the seed_mode flag set, all
│ │ │ │ -files/pieces are expected to be on disk already. This should be
│ │ │ │ -verified. Not just the existence of the file, but also that it has
│ │ │ │ -the correct size.</p>
│ │ │ │ -<p>Any file with a piece set in the <tt class="docutils literal"><span class="pre">resume_data-&gt;have_pieces</span></tt> bitmask
│ │ │ │ -should exist on disk, this should be verified. Pad files and files
│ │ │ │ -with zero priority may be skipped.</p>
│ │ │ │ -<a name="async_stop_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_stop_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_stop_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-stop-torrent">
│ │ │ │ -<h2>async_stop_torrent()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_stop_torrent</strong> (storage_index_t storage
│ │ │ │ -      , std::function&lt;void()&gt; handler = std::function&lt;void()&gt;()) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>This is called when a torrent is stopped. It gives the disk I/O
│ │ │ │ -object an opportunity to flush any data to disk that's currently kept
│ │ │ │ -cached. This function should at least do the same thing as
│ │ │ │ -<a class="reference external" href="reference-Custom_Storage.html#async_release_files()">async_release_files()</a>.</p>
│ │ │ │ -<a name="async_rename_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_rename_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_rename_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-rename-file">
│ │ │ │ -<h2>async_rename_file()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_rename_file</strong> (storage_index_t storage
│ │ │ │ -      , file_index_t index, std::string name
│ │ │ │ -      , std::function&lt;void(std::string const&amp;, file_index_t, storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>This function is called when the name of a file in the specified
│ │ │ │ -storage has been requested to be renamed. The disk I/O object is
│ │ │ │ -responsible for renaming the file without racing with other
│ │ │ │ -potentially outstanding operations against the file (such as read,
│ │ │ │ -write, move, etc.).</p>
│ │ │ │ -<a name="async_delete_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_delete_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_delete_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-delete-files">
│ │ │ │ -<h2>async_delete_files()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_delete_files</strong> (storage_index_t storage, remove_flags_t options
│ │ │ │ -      , std::function&lt;void(storage_error const&amp;)&gt; handler) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>This function is called when some file(s) on disk have been requested
│ │ │ │ -to be removed by the client. <tt class="docutils literal">storage</tt> indicates which torrent is
│ │ │ │ -referred to. See <a class="reference external" href="reference-Session.html#session_handle">session_handle</a> for <tt class="docutils literal">remove_flags_t</tt> flags
│ │ │ │ -indicating which files are to be removed.
│ │ │ │ -e.g. <a class="reference external" href="reference-Session.html#delete_files">session_handle::delete_files</a> - delete all files
│ │ │ │ -<a class="reference external" href="reference-Session.html#delete_partfile">session_handle::delete_partfile</a> - only delete part file.</p>
│ │ │ │ -<a name="async_set_file_priority()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_set_file_priority%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_set_file_priority%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-set-file-priority">
│ │ │ │ -<h2>async_set_file_priority()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_set_file_priority</strong> (storage_index_t storage
│ │ │ │ -      , aux::vector&lt;download_priority_t, file_index_t&gt; prio
│ │ │ │ -      , std::function&lt;void(storage_error const&amp;
│ │ │ │ -      , aux::vector&lt;download_priority_t, file_index_t&gt;)&gt; handler) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>This is called to set the priority of some or all files. Changing the
│ │ │ │ -priority from or to 0 may involve moving data to and from the
│ │ │ │ -partfile. The disk I/O object is responsible for correctly
│ │ │ │ -synchronizing this work to not race with any potentially outstanding
│ │ │ │ -asynchronous operations affecting these files.</p>
│ │ │ │ -<p><tt class="docutils literal">prio</tt> is a vector of the file priority for all files. If it's
│ │ │ │ -shorter than the total number of files in the torrent, they are
│ │ │ │ -assumed to be set to the default priority.</p>
│ │ │ │ -<a name="async_clear_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Basync_clear_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Basync_clear_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="async-clear-piece">
│ │ │ │ -<h2>async_clear_piece()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>async_clear_piece</strong> (storage_index_t storage, piece_index_t index
│ │ │ │ -      , std::function&lt;void(piece_index_t)&gt; handler) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>This is called when a piece fails the hash check, to ensure there are
│ │ │ │ -no outstanding disk operations to the piece before blocks are
│ │ │ │ -re-requested from peers to overwrite the existing blocks. The disk I/O
│ │ │ │ -object does not need to perform any action other than synchronize
│ │ │ │ -with all outstanding disk operations to the specified piece before
│ │ │ │ -posting the result back.</p>
│ │ │ │ -<a name="update_stats_counters()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bupdate_stats_counters%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bupdate_stats_counters%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="update-stats-counters">
│ │ │ │ -<h2>update_stats_counters()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>update_stats_counters</strong> (counters&amp; c) const = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p><a class="reference external" href="reference-Custom_Storage.html#update_stats_counters()">update_stats_counters()</a> is called to give the disk storage an
│ │ │ │ -opportunity to update gauges in the <tt class="docutils literal">c</tt> stats <a class="reference external" href="reference-Stats.html#counters">counters</a>, that aren't
│ │ │ │ -updated continuously as operations are performed. This is called
│ │ │ │ -before a snapshot of the <a class="reference external" href="reference-Stats.html#counters">counters</a> are passed to the client.</p>
│ │ │ │ -<a name="get_status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bget_status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bget_status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-status">
│ │ │ │ -<h2>get_status()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual std::vector&lt;open_file_state&gt; <strong>get_status</strong> (storage_index_t) const = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>Return a list of all the files that are currently open for the
│ │ │ │ -specified storage/torrent. This is is just used for the client to
│ │ │ │ -query the currently open files, and which modes those files are open
│ │ │ │ -in.</p>
│ │ │ │ -<a name="abort()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Babort%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Babort%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="abort-2">
│ │ │ │ -<h2>abort()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>abort</strong> (bool wait) = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>this is called when the <a class="reference external" href="reference-Session.html#session">session</a> is starting to shut down. The disk
│ │ │ │ -I/O object is expected to flush any outstanding write jobs, cancel
│ │ │ │ -hash jobs and initiate tearing down of any internal threads. If
│ │ │ │ -<tt class="docutils literal">wait</tt> is true, this should be asynchronous. i.e. this call should
│ │ │ │ -not return until all threads have stopped and all jobs have either
│ │ │ │ -been aborted or completed and the disk I/O object is ready to be
│ │ │ │ -destructed.</p>
│ │ │ │ -<a name="submit_jobs()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bsubmit_jobs%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bsubmit_jobs%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="submit-jobs">
│ │ │ │ -<h2>submit_jobs()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>submit_jobs</strong> () = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>This will be called after a batch of disk jobs has been issues (via
│ │ │ │ -the <tt class="docutils literal">async_*</tt> ). It gives the disk I/O object an opportunity to
│ │ │ │ -notify any potential condition variables to wake up the disk
│ │ │ │ -thread(s). The <tt class="docutils literal">async_*</tt> calls can of course also notify condition
│ │ │ │ -variables, but doing it in this call allows for batching jobs, by
│ │ │ │ -issuing the notification once for a collection of jobs.</p>
│ │ │ │ -<a name="settings_updated()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bsettings_updated%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bsettings_updated%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="settings-updated">
│ │ │ │ -<h2>settings_updated()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -virtual void <strong>settings_updated</strong> () = 0;
│ │ │ │ -</pre>
│ │ │ │ -<p>This is called to notify the disk I/O object that the settings have
│ │ │ │ -been updated. In the disk io constructor, a <a class="reference external" href="reference-Custom_Storage.html#settings_interface">settings_interface</a>
│ │ │ │ -reference is passed in. Whenever these settings are updated, this
│ │ │ │ -function is called to allow the disk I/O object to react to any
│ │ │ │ -changed settings relevant to its operations.</p>
│ │ │ │ -<a name="force_copy"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bforce_copy%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bforce_copy%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>force_copy</dt>
│ │ │ │ -<dd>force making a copy of the cached block, rather than getting a
│ │ │ │ -reference to a block already in the cache. This is used the block is
│ │ │ │ -expected to be overwritten very soon, by async_write()`, and we need
│ │ │ │ -access to the previous content.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="sequential_access"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bsequential_access%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bsequential_access%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>sequential_access</dt>
│ │ │ │ -<dd>hint that there may be more disk operations with sequential access to
│ │ │ │ -the file</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="volatile_read"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bvolatile_read%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bvolatile_read%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>volatile_read</dt>
│ │ │ │ -<dd>don't keep the read block in cache. This is a hint that this block is
│ │ │ │ -unlikely to be read again anytime soon, and caching it would be
│ │ │ │ -wasteful.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="v1_hash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bv1_hash%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bv1_hash%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>v1_hash</dt>
│ │ │ │ -<dd>compute a v1 piece hash. This is only used by the <a class="reference external" href="reference-Custom_Storage.html#async_hash()">async_hash()</a> call.
│ │ │ │ -If this flag is not set in the <a class="reference external" href="reference-Custom_Storage.html#async_hash()">async_hash()</a> call, the SHA-1 piece
│ │ │ │ -hash does not need to be computed.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="flush_piece"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_interface%3A%3A%5Bflush_piece%5D&labels=documentation&body=Documentation+under+heading+%22disk_interface%3A%3A%5Bflush_piece%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>flush_piece</dt>
│ │ │ │ -<dd>this flag instructs a hash job that we just completed this piece, and
│ │ │ │ -it should be flushed to disk</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="storage_holder"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_holder&labels=documentation&body=Documentation+under+heading+%22class+storage_holder%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="storage-holder">
│ │ │ │ -<h1>storage_holder</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_interface.hpp">libtorrent/disk_interface.hpp</a>&quot;</p>
│ │ │ │ -<p>a unique, owning, reference to the storage of a torrent in a disk io
│ │ │ │ -subsystem (class that implements <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a>). This is held by the
│ │ │ │ -internal libtorrent torrent object to tie the storage object allocated
│ │ │ │ -for a torrent to the lifetime of the internal torrent object. When a
│ │ │ │ -torrent is removed from the <a class="reference external" href="reference-Session.html#session">session</a>, this holder is destructed and will
│ │ │ │ -inform the disk object.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct storage_holder
│ │ │ │ -{
│ │ │ │ -   <strong>~storage_holder</strong> ();
│ │ │ │ -   <strong>storage_holder</strong> () = default;
│ │ │ │ -   <strong>storage_holder</strong> (storage_index_t idx, disk_interface&amp; disk_io);
│ │ │ │ -   explicit operator <strong>bool</strong> () const;
│ │ │ │ -   operator <strong>storage_index_t</strong> () const;
│ │ │ │ -   void <strong>reset</strong> ();
│ │ │ │ -   storage_holder&amp; <strong>operator=</strong> (storage_holder const&amp;) = delete;
│ │ │ │ -   <strong>storage_holder</strong> (storage_holder const&amp;) = delete;
│ │ │ │ -   <strong>storage_holder</strong> (storage_holder&amp;&amp; rhs) noexcept;
│ │ │ │ -   storage_holder&amp; <strong>operator=</strong> (storage_holder&amp;&amp; rhs) noexcept;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="settings_interface"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+settings_interface&labels=documentation&body=Documentation+under+heading+%22class+settings_interface%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="settings-interface">
│ │ │ │ -<h1>settings_interface</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ -<p>the common interface to <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> and the internal representation of
│ │ │ │ -settings.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct settings_interface
│ │ │ │ -{
│ │ │ │ -   virtual void <strong>set_str</strong> (int name, std::string val) = 0;
│ │ │ │ -   virtual void <strong>set_int</strong> (int name, int val) = 0;
│ │ │ │ -   virtual void <strong>set_bool</strong> (int name, bool val) = 0;
│ │ │ │ -   virtual bool <strong>has_val</strong> (int name) const = 0;
│ │ │ │ -   virtual bool <strong>get_bool</strong> (int name) const = 0;
│ │ │ │ -   virtual std::string const&amp; <strong>get_str</strong> (int name) const = 0;
│ │ │ │ -   virtual int <strong>get_int</strong> (int name) const = 0;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="buffer_allocator_interface"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+buffer_allocator_interface&labels=documentation&body=Documentation+under+heading+%22class+buffer_allocator_interface%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="buffer-allocator-interface">
│ │ │ │ -<h1>buffer_allocator_interface</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_buffer_holder.hpp">libtorrent/disk_buffer_holder.hpp</a>&quot;</p>
│ │ │ │ -<p>the interface for freeing disk buffers, used by the <a class="reference external" href="reference-Custom_Storage.html#disk_buffer_holder">disk_buffer_holder</a>.
│ │ │ │ -when implementing <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a>, this must also be implemented in order
│ │ │ │ -to return disk buffers back to libtorrent</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct buffer_allocator_interface
│ │ │ │ -{
│ │ │ │ -   virtual void <strong>free_disk_buffer</strong> (char* b) = 0;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="disk_buffer_holder"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+disk_buffer_holder&labels=documentation&body=Documentation+under+heading+%22class+disk_buffer_holder%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="disk-buffer-holder">
│ │ │ │ -<h1>disk_buffer_holder</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_buffer_holder.hpp">libtorrent/disk_buffer_holder.hpp</a>&quot;</p>
│ │ │ │ -<p>The disk buffer holder acts like a <tt class="docutils literal">unique_ptr</tt> that frees a disk buffer
│ │ │ │ -when it's destructed</p>
│ │ │ │ -<p>If this buffer holder is moved-from, default constructed or reset,
│ │ │ │ -<tt class="docutils literal">data()</tt> will return nullptr.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct disk_buffer_holder
│ │ │ │ -{
│ │ │ │ -   disk_buffer_holder&amp; <strong>operator=</strong> (disk_buffer_holder&amp;&amp;) &amp; noexcept;
│ │ │ │ -   <strong>disk_buffer_holder</strong> (disk_buffer_holder&amp;&amp;) noexcept;
│ │ │ │ -   disk_buffer_holder&amp; <strong>operator=</strong> (disk_buffer_holder const&amp;) = delete;
│ │ │ │ -   <strong>disk_buffer_holder</strong> (disk_buffer_holder const&amp;) = delete;
│ │ │ │ -   <strong>disk_buffer_holder</strong> (buffer_allocator_interface&amp; alloc
│ │ │ │ -      , char* buf, int sz) noexcept;
│ │ │ │ -   <strong>disk_buffer_holder</strong> () noexcept = default;
│ │ │ │ -   <strong>~disk_buffer_holder</strong> ();
│ │ │ │ -   char* <strong>data</strong> () const noexcept;
│ │ │ │ -   void <strong>reset</strong> ();
│ │ │ │ -   void <strong>swap</strong> (disk_buffer_holder&amp; h) noexcept;
│ │ │ │ -   bool <strong>is_mutable</strong> () const noexcept;
│ │ │ │ -   explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ -   std::ptrdiff_t <strong>size</strong> () const;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="disk-buffer-holder-1">
│ │ │ │ -<h2>disk_buffer_holder()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>disk_buffer_holder</strong> (buffer_allocator_interface&amp; alloc
│ │ │ │ -      , char* buf, int sz) noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>construct a buffer holder that will free the held buffer
│ │ │ │ -using a disk buffer pool directly (there's only one
│ │ │ │ -disk_buffer_pool per <a class="reference external" href="reference-Session.html#session">session</a>)</p>
│ │ │ │ -<a name="disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdisk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="disk-buffer-holder-2">
│ │ │ │ -<h2>disk_buffer_holder()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>disk_buffer_holder</strong> () noexcept = default;
│ │ │ │ -</pre>
│ │ │ │ -<p>default construct a holder that does not own any buffer</p>
│ │ │ │ -<a name="~disk_buffer_holder()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5B~disk_buffer_holder%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5B~disk_buffer_holder%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="disk-buffer-holder-3">
│ │ │ │ -<h2>~disk_buffer_holder()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>~disk_buffer_holder</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>frees disk buffer held by this object</p>
│ │ │ │ -<a name="data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bdata%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bdata%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="data-1">
│ │ │ │ -<h2>data()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -char* <strong>data</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>return a pointer to the held buffer, if any. Otherwise returns nullptr.</p>
│ │ │ │ -<a name="reset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Breset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Breset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="reset-2">
│ │ │ │ -<h2>reset()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>reset</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>free the held disk buffer, if any, and clear the holder. This sets the
│ │ │ │ -holder object to a default-constructed state</p>
│ │ │ │ -<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="swap-2">
│ │ │ │ -<h2>swap()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>swap</strong> (disk_buffer_holder&amp; h) noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>swap pointers of two disk buffer holders.</p>
│ │ │ │ -<a name="is_mutable()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bis_mutable%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bis_mutable%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="is-mutable">
│ │ │ │ -<h2>is_mutable()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>is_mutable</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>if this returns true, the buffer may not be modified in place</p>
│ │ │ │ -<a name="bool()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disk_buffer_holder%3A%3A%5Bbool%28%29%5D&labels=documentation&body=Documentation+under+heading+%22disk_buffer_holder%3A%3A%5Bbool%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="bool">
│ │ │ │ -<h2>bool()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>implicitly convertible to true if the object is currently holding a
│ │ │ │ -buffer</p>
│ │ │ │ -<a name="file_open_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_open_mode_t&labels=documentation&body=Documentation+under+heading+%22file_open_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="file-open-mode-t">
│ │ │ │ -<h1>file_open_mode_t</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disk_interface.hpp">libtorrent/disk_interface.hpp</a>&quot;</p>
│ │ │ │ -<a name="file_open_mode_t::read_only"></a><dl class="docutils">
│ │ │ │ -<dt>read_only</dt>
│ │ │ │ -<dd>open the file for reading only</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_open_mode_t::write_only"></a><dl class="docutils">
│ │ │ │ -<dt>write_only</dt>
│ │ │ │ -<dd>open the file for writing only</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_open_mode_t::read_write"></a><dl class="docutils">
│ │ │ │ -<dt>read_write</dt>
│ │ │ │ -<dd>open the file for reading and writing</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_open_mode_t::rw_mask"></a><dl class="docutils">
│ │ │ │ -<dt>rw_mask</dt>
│ │ │ │ -<dd>the mask for the bits determining read or write mode</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_open_mode_t::sparse"></a><dl class="docutils">
│ │ │ │ -<dt>sparse</dt>
│ │ │ │ -<dd>open the file in sparse mode (if supported by the
│ │ │ │ -filesystem).</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_open_mode_t::no_atime"></a><dl class="docutils">
│ │ │ │ -<dt>no_atime</dt>
│ │ │ │ -<dd>don't update the access timestamps on the file (if
│ │ │ │ -supported by the operating system and filesystem).
│ │ │ │ -this generally improves disk performance.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_open_mode_t::random_access"></a><dl class="docutils">
│ │ │ │ -<dt>random_access</dt>
│ │ │ │ -<dd>When this is not set, the kernel is hinted that access to this file will
│ │ │ │ -be made sequentially.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="file_open_mode_t::mmapped"></a><dl class="docutils">
│ │ │ │ -<dt>mmapped</dt>
│ │ │ │ -<dd>the file is memory mapped</dd>
│ │ │ │ -</dl>
│ │ │ │ -<p>You have some control over <a class="reference external" href="reference-Session.html#session">session</a> configuration through the session::apply_settings()
│ │ │ │ -member function. To change one or more configuration options, create a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>
│ │ │ │ -object and fill it with the settings to be set and pass it in to session::apply_settings().</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> object is a collection of settings updates that are applied
│ │ │ │ -to the <a class="reference external" href="reference-Session.html#session">session</a> when passed to session::apply_settings(). It's empty when
│ │ │ │ -constructed.</p>
│ │ │ │ -<p>You have control over proxy and authorization settings and also the user-agent
│ │ │ │ -that will be sent to the tracker. The user-agent will also be used to identify the
│ │ │ │ -client with other peers.</p>
│ │ │ │ -<p>Each configuration option is named with an enum value inside the
│ │ │ │ -<a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> class. These are the available settings:</p>
│ │ │ │ -<a name="settings_pack"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+settings_pack&labels=documentation&body=Documentation+under+heading+%22class+settings_pack%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="settings-pack">
│ │ │ │ -<h1>settings_pack</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ -<p>The <tt class="docutils literal">settings_pack</tt> struct, contains the names of all settings as
│ │ │ │ -enum values. These values are passed in to the <tt class="docutils literal">set_str()</tt>,
│ │ │ │ -<tt class="docutils literal">set_int()</tt>, <tt class="docutils literal">set_bool()</tt> functions, to specify the setting to
│ │ │ │ -change.</p>
│ │ │ │ -<p>The <tt class="docutils literal">settings_pack</tt> only stores values for settings that have been
│ │ │ │ -explicitly set on this object. However, it can still be queried for
│ │ │ │ -settings that have not been set and returns the default value for those
│ │ │ │ -settings.</p>
│ │ │ │ -<a name="user_agent"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="36%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -<col width="39%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>user_agent</td>
│ │ │ │ -<td>string</td>
│ │ │ │ -<td>libtorrent/</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>this is the client identification to the tracker. The recommended
│ │ │ │ -format of this string is: &quot;client-name/client-version
│ │ │ │ -libtorrent/libtorrent-version&quot;. This name will not only be used when
│ │ │ │ -making HTTP requests, but also when sending extended headers to
│ │ │ │ -peers that support that extension. It may not contain r or n</p>
│ │ │ │ -<a name="announce_ip"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="43%" />
│ │ │ │ -<col width="27%" />
│ │ │ │ -<col width="30%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>announce_ip</td>
│ │ │ │ -<td>string</td>
│ │ │ │ -<td>nullptr</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">announce_ip</tt> is the ip address passed along to trackers as the
│ │ │ │ -<tt class="docutils literal">&amp;ip=</tt> parameter. If left as the default, that parameter is
│ │ │ │ -omitted.</p>
│ │ │ │ -<div class="admonition note">
│ │ │ │ -<p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">This setting is only meant for very special cases where a seed is
│ │ │ │ -running on the same host as the tracker, and the tracker accepts
│ │ │ │ -the IP parameter (which normal trackers don't). Do not set this
│ │ │ │ -option unless you also control the tracker.</p>
│ │ │ │ +<p><tt class="docutils literal">announce_ip</tt> is the ip address passed along to trackers as the
│ │ │ │ +<tt class="docutils literal">&amp;ip=</tt> parameter. If left as the default, that parameter is
│ │ │ │ +omitted.</p>
│ │ │ │ +<div class="admonition note">
│ │ │ │ +<p class="first admonition-title">Note</p>
│ │ │ │ +<p class="last">This setting is only meant for very special cases where a seed is
│ │ │ │ +running on the same host as the tracker, and the tracker accepts
│ │ │ │ +the IP parameter (which normal trackers don't). Do not set this
│ │ │ │ +option unless you also control the tracker.</p>
│ │ │ │  </div>
│ │ │ │  <a name="handshake_client_version"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │  <col width="60%" />
│ │ │ │  <col width="19%" />
│ │ │ │  <col width="21%" />
│ │ │ │  </colgroup>
│ │ │ │ @@ -13385,4395 +3619,15836 @@
│ │ │ │  parameters to private trackers.</li>
│ │ │ │  <li>If announce_ip is configured, it will not be sent to trackers</li>
│ │ │ │  <li>The client version will not be sent to peers in the extension
│ │ │ │  handshake.</li>
│ │ │ │  </ul>
│ │ │ │  <a name="report_web_seed_downloads"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="64%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="21%" />
│ │ │ │ +<col width="64%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>report_web_seed_downloads</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>specifies whether downloads from web seeds is reported to the
│ │ │ │ +tracker or not. Turning it off also excludes web
│ │ │ │ +seed traffic from other stats and download rate reporting via the
│ │ │ │ +libtorrent API.</p>
│ │ │ │ +<a name="seeding_outgoing_connections"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="67%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>seeding_outgoing_connections</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">seeding_outgoing_connections</tt> determines if seeding (and
│ │ │ │ +finished) torrents should attempt to make outgoing connections or
│ │ │ │ +not. It may be set to false in very
│ │ │ │ +specific applications where the cost of making outgoing connections
│ │ │ │ +is high, and there are no or small benefits of doing so. For
│ │ │ │ +instance, if no nodes are behind a firewall or a NAT, seeds don't
│ │ │ │ +need to make outgoing connections.</p>
│ │ │ │ +<a name="no_connect_privileged_ports"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="66%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>no_connect_privileged_ports</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>false</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when this is true, libtorrent will not attempt to make outgoing
│ │ │ │ +connections to peers whose port is &lt; 1024. This is a safety
│ │ │ │ +precaution to avoid being part of a DDoS attack</p>
│ │ │ │ +<a name="smooth_connects"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="53%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="28%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>smooth_connects</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">smooth_connects</tt> means the number of
│ │ │ │ +connection attempts per second may be limited to below the
│ │ │ │ +<tt class="docutils literal">connection_speed</tt>, in case we're close to bump up against the
│ │ │ │ +limit of number of connections. The intention of this setting is to
│ │ │ │ +more evenly distribute our connection attempts over time, instead
│ │ │ │ +of attempting to connect in batches, and timing them out in
│ │ │ │ +batches.</p>
│ │ │ │ +<a name="always_send_user_agent"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="62%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>always_send_user_agent</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>false</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>always send user-agent in every web seed request. If false, only
│ │ │ │ +the first request per http connection will include the user agent</p>
│ │ │ │ +<a name="apply_ip_filter_to_trackers"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="66%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>apply_ip_filter_to_trackers</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">apply_ip_filter_to_trackers</tt> determines
│ │ │ │ +whether the IP filter applies to trackers as well as peers. If this
│ │ │ │ +is set to false, trackers are exempt from the IP filter (if there
│ │ │ │ +is one). If no IP filter is set, this setting is irrelevant.</p>
│ │ │ │ +<a name="ban_web_seeds"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="50%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +<col width="30%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>ban_web_seeds</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when true, web seeds sending bad data will be banned</p>
│ │ │ │ +<a name="support_share_mode"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>support_share_mode</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if false, prevents libtorrent to advertise share-mode support</p>
│ │ │ │ +<a name="report_redundant_bytes"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="62%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>report_redundant_bytes</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if this is true, the number of redundant bytes is sent to the
│ │ │ │ +tracker</p>
│ │ │ │ +<a name="listen_system_port_fallback"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="66%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>listen_system_port_fallback</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if this is true, libtorrent will fall back to listening on a port
│ │ │ │ +chosen by the operating system (i.e. binding to port 0). If a
│ │ │ │ +failure is preferred, set this to false.</p>
│ │ │ │ +<a name="announce_crypto_support"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>announce_crypto_support</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when this is true, and incoming encrypted connections are enabled,
│ │ │ │ +&amp;supportcrypt=1 is included in http tracker announces</p>
│ │ │ │ +<a name="enable_upnp"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="46%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +<col width="32%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>enable_upnp</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>Starts and stops the UPnP service. When started, the listen port
│ │ │ │ +and the DHT port are attempted to be forwarded on local UPnP router
│ │ │ │ +devices.</p>
│ │ │ │ +<p>The upnp object returned by <tt class="docutils literal">start_upnp()</tt> can be used to add and
│ │ │ │ +remove arbitrary port mappings. Mapping status is returned through
│ │ │ │ +the <a class="reference external" href="reference-Alerts.html#portmap_alert">portmap_alert</a> and the <a class="reference external" href="reference-Alerts.html#portmap_error_alert">portmap_error_alert</a>. The object will be
│ │ │ │ +valid until <tt class="docutils literal">stop_upnp()</tt> is called. See <a class="reference external" href="manual-ref.html#upnp-and-nat-pmp">upnp and nat pmp</a>.</p>
│ │ │ │ +<a name="enable_natpmp"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="50%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +<col width="30%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>enable_natpmp</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>Starts and stops the NAT-PMP service. When started, the listen port
│ │ │ │ +and the DHT port are attempted to be forwarded on the router
│ │ │ │ +through NAT-PMP.</p>
│ │ │ │ +<p>The natpmp object returned by <tt class="docutils literal">start_natpmp()</tt> can be used to add
│ │ │ │ +and remove arbitrary port mappings. Mapping status is returned
│ │ │ │ +through the <a class="reference external" href="reference-Alerts.html#portmap_alert">portmap_alert</a> and the <a class="reference external" href="reference-Alerts.html#portmap_error_alert">portmap_error_alert</a>. The object
│ │ │ │ +will be valid until <tt class="docutils literal">stop_natpmp()</tt> is called. See
│ │ │ │ +<a class="reference external" href="manual-ref.html#upnp-and-nat-pmp">upnp and nat pmp</a>.</p>
│ │ │ │ +<a name="enable_lsd"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="44%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +<col width="33%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>enable_lsd</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>Starts and stops Local Service Discovery. This service will
│ │ │ │ +broadcast the info-hashes of all the non-private torrents on the
│ │ │ │ +local network to look for peers on the same swarm within multicast
│ │ │ │ +reach.</p>
│ │ │ │ +<a name="enable_dht"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="44%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +<col width="33%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>enable_dht</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>starts the dht node and makes the trackerless service available to
│ │ │ │ +torrents.</p>
│ │ │ │ +<a name="prefer_rc4"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="44%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +<col width="33%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>prefer_rc4</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>false</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if the allowed encryption level is both, setting this to true will
│ │ │ │ +prefer RC4 if both methods are offered, plain text otherwise</p>
│ │ │ │ +<a name="proxy_hostnames"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="53%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="28%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>proxy_hostnames</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if true, hostname lookups are done via the configured proxy (if
│ │ │ │ +any). This is only supported by SOCKS5 and HTTP.</p>
│ │ │ │ +<a name="proxy_peer_connections"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="62%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>proxy_peer_connections</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if true, peer connections are made (and accepted) over the
│ │ │ │ +configured proxy, if any. Web seeds as well as regular bittorrent
│ │ │ │ +peer connections are considered &quot;peer connections&quot;. Anything
│ │ │ │ +transporting actual torrent payload (trackers and DHT traffic are
│ │ │ │ +not considered peer connections).</p>
│ │ │ │ +<a name="auto_sequential"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="53%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="28%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>auto_sequential</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if this setting is true, torrents with a very high availability of
│ │ │ │ +pieces (and seeds) are downloaded sequentially. This is more
│ │ │ │ +efficient for the disk I/O. With many seeds, the download order is
│ │ │ │ +unlikely to matter anyway</p>
│ │ │ │ +<a name="proxy_tracker_connections"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="64%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>proxy_tracker_connections</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if true, tracker connections are made over the configured proxy, if
│ │ │ │ +any.</p>
│ │ │ │ +<a name="enable_ip_notifier"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>enable_ip_notifier</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>Starts and stops the internal IP table route changes notifier.</p>
│ │ │ │ +<p>The current implementation supports multiple platforms, and it is
│ │ │ │ +recommended to have it enable, but you may want to disable it if
│ │ │ │ +it's supported but unreliable, or if you have a better way to
│ │ │ │ +detect the changes. In the later case, you should manually call
│ │ │ │ +<tt class="docutils literal"><span class="pre">session_handle::reopen_network_sockets</span></tt> to ensure network
│ │ │ │ +changes are taken in consideration.</p>
│ │ │ │ +<a name="dht_prefer_verified_node_ids"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="67%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_prefer_verified_node_ids</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when this is true, nodes whose IDs are derived from their source
│ │ │ │ +IP according to <a class="reference external" href="https://www.bittorrent.org/beps/bep_0042.html">BEP 42</a> are preferred in the routing table.</p>
│ │ │ │ +<a name="dht_restrict_routing_ips"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_restrict_routing_ips</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>determines if the routing table entries should restrict entries to one
│ │ │ │ +per IP. This defaults to true, which helps mitigate some attacks on
│ │ │ │ +the DHT. It prevents adding multiple nodes with IPs with a very close
│ │ │ │ +CIDR distance.</p>
│ │ │ │ +<p>when set, nodes whose IP address that's in the same /24 (or /64 for
│ │ │ │ +IPv6) range in the same routing table bucket. This is an attempt to
│ │ │ │ +mitigate node ID spoofing attacks also restrict any IP to only have a
│ │ │ │ +single <a class="reference external" href="reference-Bencoding.html#entry">entry</a> in the whole routing table</p>
│ │ │ │ +<a name="dht_restrict_search_ips"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_restrict_search_ips</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>determines if DHT searches should prevent adding nodes with IPs with
│ │ │ │ +very close CIDR distance. This also defaults to true and helps
│ │ │ │ +mitigate certain attacks on the DHT.</p>
│ │ │ │ +<a name="dht_extended_routing_table"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="65%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_extended_routing_table</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>makes the first buckets in the DHT routing table fit 128, 64, 32 and
│ │ │ │ +16 nodes respectively, as opposed to the standard size of 8. All other
│ │ │ │ +buckets have size 8 still.</p>
│ │ │ │ +<a name="dht_aggressive_lookups"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="62%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_aggressive_lookups</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>slightly changes the lookup behavior in terms of how many outstanding
│ │ │ │ +requests we keep. Instead of having branch factor be a hard limit, we
│ │ │ │ +always keep <em>branch factor</em> outstanding requests to the closest nodes.
│ │ │ │ +i.e. every time we get results back with closer nodes, we query them
│ │ │ │ +right away. It lowers the lookup times at the cost of more outstanding
│ │ │ │ +queries.</p>
│ │ │ │ +<a name="dht_privacy_lookups"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_privacy_lookups</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>false</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when set, perform lookups in a way that is slightly more expensive,
│ │ │ │ +but which minimizes the amount of information leaked about you.</p>
│ │ │ │ +<a name="dht_enforce_node_id"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_enforce_node_id</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>false</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when set, node's whose IDs that are not correctly generated based on
│ │ │ │ +its external IP are ignored. When a query arrives from such node, an
│ │ │ │ +error message is returned with a message saying &quot;invalid node ID&quot;.</p>
│ │ │ │ +<a name="dht_ignore_dark_internet"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_ignore_dark_internet</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>ignore DHT messages from parts of the internet we wouldn't expect to
│ │ │ │ +see any traffic from</p>
│ │ │ │ +<a name="dht_read_only"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="50%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +<col width="30%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_read_only</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>false</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when set, the other nodes won't keep this node in their routing
│ │ │ │ +tables, it's meant for low-power and/or ephemeral devices that
│ │ │ │ +cannot support the DHT, it is also useful for mobile devices which
│ │ │ │ +are sensitive to network traffic and battery life.
│ │ │ │ +this node no longer responds to 'query' messages, and will place a
│ │ │ │ +'ro' key (value = 1) in the top-level message dictionary of outgoing
│ │ │ │ +query messages.</p>
│ │ │ │ +<a name="piece_extent_affinity"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>piece_extent_affinity</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>false</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when this is true, create an affinity for downloading 4 MiB extents
│ │ │ │ +of adjacent pieces. This is an attempt to achieve better disk I/O
│ │ │ │ +throughput by downloading larger extents of bytes, for torrents with
│ │ │ │ +small piece sizes</p>
│ │ │ │ +<a name="validate_https_trackers"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>validate_https_trackers</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when set to true, the certificate of HTTPS trackers and HTTPS web
│ │ │ │ +seeds will be validated against the system's certificate store
│ │ │ │ +(as defined by OpenSSL). If the system does not have a
│ │ │ │ +certificate store, this option may have to be disabled in order
│ │ │ │ +to get trackers and web seeds to work).</p>
│ │ │ │ +<a name="ssrf_mitigation"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="53%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="28%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>ssrf_mitigation</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>true</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when enabled, tracker and web seed requests are subject to
│ │ │ │ +certain restrictions.</p>
│ │ │ │ +<p>An HTTP(s) tracker requests to localhost (loopback)
│ │ │ │ +must have the request path start with &quot;/announce&quot;. This is the
│ │ │ │ +conventional bittorrent tracker request. Any other HTTP(S)
│ │ │ │ +tracker request to loopback will be rejected. This applies to
│ │ │ │ +trackers that redirect to loopback as well.</p>
│ │ │ │ +<p>Web seeds that end up on the client's local network (i.e. in a
│ │ │ │ +private IP address range) may not include query string arguments.
│ │ │ │ +This applies to web seeds redirecting to the local network as
│ │ │ │ +well.</p>
│ │ │ │ +<p>Web seeds on global IPs (i.e. not local network) may not redirect
│ │ │ │ +to a local network address</p>
│ │ │ │ +<a name="allow_idna"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="44%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +<col width="33%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>allow_idna</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>false</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when disabled, any tracker or web seed with an IDNA hostname
│ │ │ │ +(internationalized domain name) is ignored. This is a security
│ │ │ │ +precaution to avoid various unicode encoding attacks that might
│ │ │ │ +happen at the application level.</p>
│ │ │ │ +<a name="enable_set_file_valid_data"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="65%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>enable_set_file_valid_data</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>false</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when set to true, enables the attempt to use SetFileValidData()
│ │ │ │ +to pre-allocate disk space. This system call will only work when
│ │ │ │ +running with Administrator privileges on Windows, and so this
│ │ │ │ +setting is only relevant in that scenario. Using
│ │ │ │ +SetFileValidData() poses a security risk, as it may reveal
│ │ │ │ +previously deleted information from the disk.</p>
│ │ │ │ +<a name="socks5_udp_send_local_ep"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>socks5_udp_send_local_ep</td>
│ │ │ │ +<td>bool</td>
│ │ │ │ +<td>false</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>When using a SOCKS5 proxy, UDP traffic is routed through the
│ │ │ │ +proxy by sending a UDP ASSOCIATE command. If this option is true,
│ │ │ │ +the UDP ASSOCIATE command will include the IP address and
│ │ │ │ +listen port to the local UDP socket. This indicates to the proxy
│ │ │ │ +which source endpoint to expect our packets from. The benefit is
│ │ │ │ +that incoming packets can be forwarded correctly, before any
│ │ │ │ +outgoing packets are sent. The risk is that if there's a NAT
│ │ │ │ +between the client and the proxy, the IP address specified in the
│ │ │ │ +protocol may not be valid from the proxy's point of view.</p>
│ │ │ │ +<a name="tracker_completion_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="65%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>tracker_completion_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>30</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">tracker_completion_timeout</tt> is the number of seconds the tracker
│ │ │ │ +connection will wait from when it sent the request until it
│ │ │ │ +considers the tracker to have timed-out.</p>
│ │ │ │ +<a name="tracker_receive_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>tracker_receive_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">tracker_receive_timeout</tt> is the number of seconds to wait to
│ │ │ │ +receive any data from the tracker. If no data is received for this
│ │ │ │ +number of seconds, the tracker will be considered as having timed
│ │ │ │ +out. If a tracker is down, this is the kind of timeout that will
│ │ │ │ +occur.</p>
│ │ │ │ +<a name="stop_tracker_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="59%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>stop_tracker_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">stop_tracker_timeout</tt> is the number of seconds to wait when
│ │ │ │ +sending a stopped message before considering a tracker to have
│ │ │ │ +timed out. This is usually shorter, to make the client quit faster.
│ │ │ │ +If the value is set to 0, the connections to trackers with the
│ │ │ │ +stopped event are suppressed.</p>
│ │ │ │ +<a name="tracker_maximum_response_length"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="66%" />
│ │ │ │ +<col width="12%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>tracker_maximum_response_length</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>1024*1024</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>this is the maximum number of bytes in a tracker response. If a
│ │ │ │ +response size passes this number of bytes it will be rejected and
│ │ │ │ +the connection will be closed. On gzipped responses this size is
│ │ │ │ +measured on the uncompressed data. So, if you get 20 bytes of gzip
│ │ │ │ +response that'll expand to 2 megabytes, it will be interrupted
│ │ │ │ +before the entire response has been uncompressed (assuming the
│ │ │ │ +limit is lower than 2 MiB).</p>
│ │ │ │ +<a name="piece_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="50%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +<col width="30%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>piece_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>20</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the number of seconds from a request is sent until it times out if
│ │ │ │ +no piece response is returned.</p>
│ │ │ │ +<a name="request_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="53%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="28%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>request_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>60</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the number of seconds one block (16 kiB) is expected to be received
│ │ │ │ +within. If it's not, the block is requested from a different peer</p>
│ │ │ │ +<a name="request_queue_time"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>request_queue_time</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the length of the request queue given in the number of seconds it
│ │ │ │ +should take for the other end to send all the pieces. i.e. the
│ │ │ │ +actual number of requests depends on the download rate and this
│ │ │ │ +number.</p>
│ │ │ │ +<a name="max_allowed_in_request_queue"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="67%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_allowed_in_request_queue</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>2000</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the number of outstanding block requests a peer is allowed to queue
│ │ │ │ +up in the client. If a peer sends more requests than this (before
│ │ │ │ +the first one has been sent) the last request will be dropped. the
│ │ │ │ +higher this is, the faster upload speeds the client can get to a
│ │ │ │ +single peer.</p>
│ │ │ │ +<a name="max_out_request_queue"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_out_request_queue</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>500</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">max_out_request_queue</tt> is the maximum number of outstanding
│ │ │ │ +requests to send to a peer. This limit takes precedence over
│ │ │ │ +<tt class="docutils literal">request_queue_time</tt>. i.e. no matter the download speed, the
│ │ │ │ +number of outstanding requests will never exceed this limit.</p>
│ │ │ │ +<a name="whole_pieces_threshold"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="62%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>whole_pieces_threshold</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>20</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if a whole piece can be downloaded in this number of seconds, or
│ │ │ │ +less, the peer_connection will prefer to request whole pieces at a
│ │ │ │ +time from this peer. The benefit of this is to better utilize disk
│ │ │ │ +caches by doing localized accesses and also to make it easier to
│ │ │ │ +identify bad peers if a piece fails the hash check.</p>
│ │ │ │ +<a name="peer_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="48%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +<col width="31%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>peer_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>120</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">peer_timeout</tt> is the number of seconds the peer connection
│ │ │ │ +should wait (for any activity on the peer connection) before
│ │ │ │ +closing it due to time out. 120 seconds is
│ │ │ │ +specified in the protocol specification. After half
│ │ │ │ +the time out, a keep alive message is sent.</p>
│ │ │ │ +<a name="urlseed_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="53%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="28%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>urlseed_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>20</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>same as peer_timeout, but only applies to url-seeds. this is
│ │ │ │ +usually set lower, because web servers are expected to be more
│ │ │ │ +reliable.</p>
│ │ │ │ +<a name="urlseed_pipeline_size"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>urlseed_pipeline_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>controls the pipelining size of url and http seeds. i.e. the number of HTTP
│ │ │ │ +request to keep outstanding before waiting for the first one to
│ │ │ │ +complete. It's common for web servers to limit this to a relatively
│ │ │ │ +low number, like 5</p>
│ │ │ │ +<a name="urlseed_wait_retry"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>urlseed_wait_retry</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>30</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>number of seconds until a new retry of a url-seed takes place.
│ │ │ │ +Default retry value for http-seeds that don't provide
│ │ │ │ +a valid <tt class="docutils literal"><span class="pre">retry-after</span></tt> header.</p>
│ │ │ │ +<a name="file_pool_size"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="52%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="29%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>file_pool_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>40</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>sets the upper limit on the total number of files this <a class="reference external" href="reference-Session.html#session">session</a> will
│ │ │ │ +keep open. The reason why files are left open at all is that some
│ │ │ │ +anti virus software hooks on every file close, and scans the file
│ │ │ │ +for viruses. deferring the closing of the files will be the
│ │ │ │ +difference between a usable system and a completely hogged down
│ │ │ │ +system. Most operating systems also has a limit on the total number
│ │ │ │ +of file descriptors a process may have open.</p>
│ │ │ │ +<a name="max_failcount"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="50%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +<col width="30%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_failcount</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">max_failcount</tt> is the maximum times we try to
│ │ │ │ +connect to a peer before stop connecting again. If a
│ │ │ │ +peer succeeds, the failure counter is reset. If a
│ │ │ │ +peer is retrieved from a peer source (other than DHT)
│ │ │ │ +the failcount is decremented by one, allowing another
│ │ │ │ +try.</p>
│ │ │ │ +<a name="min_reconnect_time"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>min_reconnect_time</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>60</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the number of seconds to wait to reconnect to a peer. this time is
│ │ │ │ +multiplied with the failcount.</p>
│ │ │ │ +<a name="peer_connect_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="59%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>peer_connect_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>15</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">peer_connect_timeout</tt> the number of seconds to wait after a
│ │ │ │ +connection attempt is initiated to a peer until it is considered as
│ │ │ │ +having timed out. This setting is especially important in case the
│ │ │ │ +number of half-open connections are limited, since stale half-open
│ │ │ │ +connection may delay the connection of other peers considerably.</p>
│ │ │ │ +<a name="connection_speed"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="55%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="27%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>connection_speed</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>30</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">connection_speed</tt> is the number of connection attempts that are
│ │ │ │ +made per second. If a number &lt; 0 is specified, it will default to
│ │ │ │ +200 connections per second. If 0 is specified, it means don't make
│ │ │ │ +outgoing connections at all.</p>
│ │ │ │ +<a name="inactivity_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>inactivity_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>600</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if a peer is uninteresting and uninterested for longer than this
│ │ │ │ +number of seconds, it will be disconnected.</p>
│ │ │ │ +<a name="unchoke_interval"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="55%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="27%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>unchoke_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>15</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">unchoke_interval</tt> is the number of seconds between
│ │ │ │ +chokes/unchokes. On this interval, peers are re-evaluated for being
│ │ │ │ +choked/unchoked. This is defined as 30 seconds in the protocol, and
│ │ │ │ +it should be significantly longer than what it takes for TCP to
│ │ │ │ +ramp up to it's max rate.</p>
│ │ │ │ +<a name="optimistic_unchoke_interval"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="66%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>optimistic_unchoke_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>30</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">optimistic_unchoke_interval</tt> is the number of seconds between
│ │ │ │ +each <em>optimistic</em> unchoke. On this timer, the currently
│ │ │ │ +optimistically unchoked peer will change.</p>
│ │ │ │ +<a name="num_want"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="40%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +<col width="36%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>num_want</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>200</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">num_want</tt> is the number of peers we want from each tracker
│ │ │ │ +request. It defines what is sent as the <tt class="docutils literal">&amp;num_want=</tt> parameter to
│ │ │ │ +the tracker.</p>
│ │ │ │ +<a name="initial_picker_threshold"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>initial_picker_threshold</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">initial_picker_threshold</tt> specifies the number of pieces we need
│ │ │ │ +before we switch to rarest first picking. The first
│ │ │ │ +<tt class="docutils literal">initial_picker_threshold</tt> pieces in any torrent are picked at random
│ │ │ │ +, the following pieces are picked in rarest first order.</p>
│ │ │ │ +<a name="allowed_fast_set_size"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>allowed_fast_set_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the number of allowed pieces to send to peers that supports the
│ │ │ │ +fast extensions</p>
│ │ │ │ +<a name="suggest_mode"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="25%" />
│ │ │ │ +<col width="11%" />
│ │ │ │ +<col width="65%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>suggest_mode</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>settings_pack::no_piece_suggestions</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">suggest_mode</tt> controls whether or not libtorrent will send out
│ │ │ │ +suggest messages to create a bias of its peers to request certain
│ │ │ │ +pieces. The modes are:</p>
│ │ │ │ +<ul class="simple">
│ │ │ │ +<li><tt class="docutils literal">no_piece_suggestions</tt> which will not send out suggest messages.</li>
│ │ │ │ +<li><tt class="docutils literal">suggest_read_cache</tt> which will send out suggest messages for
│ │ │ │ +the most recent pieces that are in the read cache.</li>
│ │ │ │ +</ul>
│ │ │ │ +<a name="max_queued_disk_bytes"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="55%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="31%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_queued_disk_bytes</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>1024 * 1024</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">max_queued_disk_bytes</tt> is the maximum number of bytes, to
│ │ │ │ +be written to disk, that can wait in the disk I/O thread queue.
│ │ │ │ +This queue is only for waiting for the disk I/O thread to receive
│ │ │ │ +the job and either write it to disk or insert it in the write
│ │ │ │ +cache. When this limit is reached, the peer connections will stop
│ │ │ │ +reading data from their sockets, until the disk thread catches up.
│ │ │ │ +Setting this too low will severely limit your download rate.</p>
│ │ │ │ +<a name="handshake_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="56%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>handshake_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the number of seconds to wait for a handshake response from a peer.
│ │ │ │ +If no response is received within this time, the peer is
│ │ │ │ +disconnected.</p>
│ │ │ │ +<a name="send_buffer_low_watermark"></a>
│ │ │ │ +<a name="send_buffer_watermark"></a>
│ │ │ │ +<a name="send_buffer_watermark_factor"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="25%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>send_buffer_low_watermark</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>10 * 1024</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>send_buffer_watermark</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>500 * 1024</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>send_buffer_watermark_factor</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>50</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">send_buffer_low_watermark</tt> the minimum send buffer target size
│ │ │ │ +(send buffer includes bytes pending being read from disk). For good
│ │ │ │ +and snappy seeding performance, set this fairly high, to at least
│ │ │ │ +fit a few blocks. This is essentially the initial window size which
│ │ │ │ +will determine how fast we can ramp up the send rate</p>
│ │ │ │ +<p>if the send buffer has fewer bytes than <tt class="docutils literal">send_buffer_watermark</tt>,
│ │ │ │ +we'll read another 16 kiB block onto it. If set too small, upload
│ │ │ │ +rate capacity will suffer. If set too high, memory will be wasted.
│ │ │ │ +The actual watermark may be lower than this in case the upload rate
│ │ │ │ +is low, this is the upper limit.</p>
│ │ │ │ +<p>the current upload rate to a peer is multiplied by this factor to
│ │ │ │ +get the send buffer watermark. The factor is specified as a
│ │ │ │ +percentage. i.e. 50 -&gt; 0.5 This product is clamped to the
│ │ │ │ +<tt class="docutils literal">send_buffer_watermark</tt> setting to not exceed the max. For high
│ │ │ │ +speed upload, this should be set to a greater value than 100. For
│ │ │ │ +high capacity connections, setting this higher can improve upload
│ │ │ │ +performance and disk throughput. Setting it too high may waste RAM
│ │ │ │ +and create a bias towards read jobs over write jobs.</p>
│ │ │ │ +<a name="choking_algorithm"></a>
│ │ │ │ +<a name="seed_choking_algorithm"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="37%" />
│ │ │ │ +<col width="9%" />
│ │ │ │ +<col width="54%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>choking_algorithm</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>settings_pack::fixed_slots_choker</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>seed_choking_algorithm</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>settings_pack::round_robin</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">choking_algorithm</tt> specifies which algorithm to use to determine
│ │ │ │ +how many peers to unchoke. The unchoking algorithm for
│ │ │ │ +downloading torrents is always &quot;tit-for-tat&quot;, i.e. the peers we
│ │ │ │ +download the fastest from are unchoked.</p>
│ │ │ │ +<p>The options for choking algorithms are defined in the
│ │ │ │ +<a class="reference external" href="reference-Settings.html#choking_algorithm_t">choking_algorithm_t</a> enum.</p>
│ │ │ │ +<p><tt class="docutils literal">seed_choking_algorithm</tt> controls the seeding unchoke behavior.
│ │ │ │ +i.e. How we select which peers to unchoke for seeding torrents.
│ │ │ │ +Since a seeding torrent isn't downloading anything, the
│ │ │ │ +tit-for-tat mechanism cannot be used. The available options are
│ │ │ │ +defined in the <a class="reference external" href="reference-Settings.html#seed_choking_algorithm_t">seed_choking_algorithm_t</a> enum.</p>
│ │ │ │ +<a name="disk_io_write_mode"></a>
│ │ │ │ +<a name="disk_io_read_mode"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="34%" />
│ │ │ │ +<col width="10%" />
│ │ │ │ +<col width="55%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>disk_io_write_mode</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>DISK_WRITE_MODE</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>disk_io_read_mode</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>settings_pack::enable_os_cache</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>determines how files are opened when they're in read only mode
│ │ │ │ +versus read and write mode. The options are:</p>
│ │ │ │ +<dl class="docutils">
│ │ │ │ +<dt>enable_os_cache</dt>
│ │ │ │ +<dd>Files are opened normally, with the OS caching reads and writes.</dd>
│ │ │ │ +<dt>disable_os_cache</dt>
│ │ │ │ +<dd>This opens all files in no-cache mode. This corresponds to the
│ │ │ │ +OS not letting blocks for the files linger in the cache. This
│ │ │ │ +makes sense in order to avoid the bittorrent client to
│ │ │ │ +potentially evict all other processes' cache by simply handling
│ │ │ │ +high throughput and large files. If libtorrent's read cache is
│ │ │ │ +disabled, enabling this may reduce performance.</dd>
│ │ │ │ +<dt>write_through</dt>
│ │ │ │ +<dd>flush pieces to disk as they complete validation.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<p>One reason to disable caching is that it may help the operating
│ │ │ │ +system from growing its file cache indefinitely.</p>
│ │ │ │ +<a name="outgoing_port"></a>
│ │ │ │ +<a name="num_outgoing_ports"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>outgoing_port</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>num_outgoing_ports</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>this is the first port to use for binding outgoing connections to.
│ │ │ │ +This is useful for users that have routers that allow QoS settings
│ │ │ │ +based on local port. when binding outgoing connections to specific
│ │ │ │ +ports, <tt class="docutils literal">num_outgoing_ports</tt> is the size of the range. It should
│ │ │ │ +be more than a few</p>
│ │ │ │ +<div class="admonition warning">
│ │ │ │ +<p class="first admonition-title">Warning</p>
│ │ │ │ +<p class="last">setting outgoing ports will limit the ability to keep
│ │ │ │ +multiple connections to the same client, even for different
│ │ │ │ +torrents. It is not recommended to change this setting. Its main
│ │ │ │ +purpose is to use as an escape hatch for cheap routers with QoS
│ │ │ │ +capability but can only classify flows based on port numbers.</p>
│ │ │ │ +</div>
│ │ │ │ +<p>It is a range instead of a single port because of the problems with
│ │ │ │ +failing to reconnect to peers if a previous socket to that peer and
│ │ │ │ +port is in <tt class="docutils literal">TIME_WAIT</tt> state.</p>
│ │ │ │ +<a name="peer_dscp"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="42%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +<col width="35%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>peer_dscp</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0x04</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">peer_dscp</tt> determines the DSCP field in the IP header of every
│ │ │ │ +packet sent to peers (including web seeds). <tt class="docutils literal">0x0</tt> means no marking,
│ │ │ │ +<tt class="docutils literal">0x04</tt> represents Lower Effort. For more details see <a class="reference external" href="http://www.faqs.org/rfcs/rfc8622.html">RFC 8622</a>.</p>
│ │ │ │ +<p><tt class="docutils literal">peer_tos</tt> is the backwards compatible name for this setting.</p>
│ │ │ │ +<a name="active_downloads"></a>
│ │ │ │ +<a name="active_seeds"></a>
│ │ │ │ +<a name="active_checking"></a>
│ │ │ │ +<a name="active_dht_limit"></a>
│ │ │ │ +<a name="active_tracker_limit"></a>
│ │ │ │ +<a name="active_lsd_limit"></a>
│ │ │ │ +<a name="active_limit"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="59%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>active_downloads</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>active_seeds</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>active_checking</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>active_dht_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>88</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>active_tracker_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>1600</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>active_lsd_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>60</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>active_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>500</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>for auto managed torrents, these are the limits they are subject
│ │ │ │ +to. If there are too many torrents some of the auto managed ones
│ │ │ │ +will be paused until some slots free up. <tt class="docutils literal">active_downloads</tt> and
│ │ │ │ +<tt class="docutils literal">active_seeds</tt> controls how many active seeding and downloading
│ │ │ │ +torrents the queuing mechanism allows. The target number of active
│ │ │ │ +torrents is <tt class="docutils literal">min(active_downloads + active_seeds, active_limit)</tt>.
│ │ │ │ +<tt class="docutils literal">active_downloads</tt> and <tt class="docutils literal">active_seeds</tt> are upper limits on the
│ │ │ │ +number of downloading torrents and seeding torrents respectively.
│ │ │ │ +Setting the value to -1 means unlimited.</p>
│ │ │ │ +<p>For example if there are 10 seeding torrents and 10 downloading
│ │ │ │ +torrents, and <tt class="docutils literal">active_downloads</tt> is 4 and <tt class="docutils literal">active_seeds</tt> is 4,
│ │ │ │ +there will be 4 seeds active and 4 downloading torrents. If the
│ │ │ │ +settings are <tt class="docutils literal">active_downloads</tt> = 2 and <tt class="docutils literal">active_seeds</tt> = 4,
│ │ │ │ +then there will be 2 downloading torrents and 4 seeding torrents
│ │ │ │ +active. Torrents that are not auto managed are not counted against
│ │ │ │ +these limits.</p>
│ │ │ │ +<p><tt class="docutils literal">active_checking</tt> is the limit of number of simultaneous checking
│ │ │ │ +torrents.</p>
│ │ │ │ +<p><tt class="docutils literal">active_limit</tt> is a hard limit on the number of active (auto
│ │ │ │ +managed) torrents. This limit also applies to slow torrents.</p>
│ │ │ │ +<p><tt class="docutils literal">active_dht_limit</tt> is the max number of torrents to announce to
│ │ │ │ +the DHT.</p>
│ │ │ │ +<p><tt class="docutils literal">active_tracker_limit</tt> is the max number of torrents to announce
│ │ │ │ +to their trackers.</p>
│ │ │ │ +<p><tt class="docutils literal">active_lsd_limit</tt> is the max number of torrents to announce to
│ │ │ │ +the local network over the local service discovery protocol.</p>
│ │ │ │ +<p>You can have more torrents <em>active</em>, even though they are not
│ │ │ │ +announced to the DHT, lsd or their tracker. If some peer knows
│ │ │ │ +about you for any reason and tries to connect, it will still be
│ │ │ │ +accepted, unless the torrent is paused, which means it won't accept
│ │ │ │ +any connections.</p>
│ │ │ │ +<a name="auto_manage_interval"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="59%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>auto_manage_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>30</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">auto_manage_interval</tt> is the number of seconds between the
│ │ │ │ +torrent queue is updated, and rotated.</p>
│ │ │ │ +<a name="seed_time_limit"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="46%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="38%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>seed_time_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>24 * 60 * 60</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>this is the limit on the time a torrent has been an active seed
│ │ │ │ +(specified in seconds) before it is considered having met the seed
│ │ │ │ +limit criteria. See <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</p>
│ │ │ │ +<a name="auto_scrape_interval"></a>
│ │ │ │ +<a name="auto_scrape_min_interval"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>auto_scrape_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>1800</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>auto_scrape_min_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>300</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">auto_scrape_interval</tt> is the number of seconds between scrapes
│ │ │ │ +of queued torrents (auto managed and paused torrents). Auto managed
│ │ │ │ +torrents that are paused, are scraped regularly in order to keep
│ │ │ │ +track of their downloader/seed ratio. This ratio is used to
│ │ │ │ +determine which torrents to seed and which to pause.</p>
│ │ │ │ +<p><tt class="docutils literal">auto_scrape_min_interval</tt> is the minimum number of seconds
│ │ │ │ +between any automatic scrape (regardless of torrent). In case there
│ │ │ │ +are a large number of paused auto managed torrents, this puts a
│ │ │ │ +limit on how often a scrape request is sent.</p>
│ │ │ │ +<a name="max_peerlist_size"></a>
│ │ │ │ +<a name="max_paused_peerlist_size"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_peerlist_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3000</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>max_paused_peerlist_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>1000</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">max_peerlist_size</tt> is the maximum number of peers in the list of
│ │ │ │ +known peers. These peers are not necessarily connected, so this
│ │ │ │ +number should be much greater than the maximum number of connected
│ │ │ │ +peers. Peers are evicted from the cache when the list grows passed
│ │ │ │ +90% of this limit, and once the size hits the limit, peers are no
│ │ │ │ +longer added to the list. If this limit is set to 0, there is no
│ │ │ │ +limit on how many peers we'll keep in the peer list.</p>
│ │ │ │ +<p><tt class="docutils literal">max_paused_peerlist_size</tt> is the max peer list size used for
│ │ │ │ +torrents that are paused. This can be used to save memory for paused
│ │ │ │ +torrents, since it's not as important for them to keep a large peer
│ │ │ │ +list.</p>
│ │ │ │ +<a name="min_announce_interval"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>min_announce_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>5 * 60</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>this is the minimum allowed announce interval for a tracker. This
│ │ │ │ +is specified in seconds and is used as a sanity check on what is
│ │ │ │ +returned from a tracker. It mitigates hammering mis-configured
│ │ │ │ +trackers.</p>
│ │ │ │ +<a name="auto_manage_startup"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>auto_manage_startup</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>60</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>this is the number of seconds a torrent is considered active after
│ │ │ │ +it was started, regardless of upload and download speed. This is so
│ │ │ │ +that newly started torrents are not considered inactive until they
│ │ │ │ +have a fair chance to start downloading.</p>
│ │ │ │ +<a name="seeding_piece_quota"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>seeding_piece_quota</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>20</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">seeding_piece_quota</tt> is the number of pieces to send to a peer,
│ │ │ │ +when seeding, before rotating in another peer to the unchoke set.</p>
│ │ │ │ +<a name="max_rejects"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="46%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +<col width="32%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_rejects</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>50</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">max_rejects</tt> is the number of piece requests we will reject in a
│ │ │ │ +row while a peer is choked before the peer is considered abusive
│ │ │ │ +and is disconnected.</p>
│ │ │ │ +<a name="recv_socket_buffer_size"></a>
│ │ │ │ +<a name="send_socket_buffer_size"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>recv_socket_buffer_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>send_socket_buffer_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>specifies the buffer sizes set on peer sockets. 0 means the OS
│ │ │ │ +default (i.e. don't change the buffer sizes).
│ │ │ │ +The socket buffer sizes are changed using setsockopt() with
│ │ │ │ +SOL_SOCKET/SO_RCVBUF and SO_SNDBUFFER.</p>
│ │ │ │ +<p>Note that uTP peers share a single UDP socket buffer for each of the
│ │ │ │ +<tt class="docutils literal">listen_interfaces</tt>, along with DHT and UDP tracker traffic.
│ │ │ │ +If the buffer size is too small for the combined traffic through the
│ │ │ │ +socket, packets may be dropped.</p>
│ │ │ │ +<a name="max_peer_recv_buffer_size"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="54%" />
│ │ │ │ +<col width="12%" />
│ │ │ │ +<col width="34%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_peer_recv_buffer_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>2 * 1024 * 1024</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the max number of bytes a single peer connection's receive buffer is
│ │ │ │ +allowed to grow to.</p>
│ │ │ │ +<a name="optimistic_disk_retry"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>optimistic_disk_retry</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>10 * 60</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">optimistic_disk_retry</tt> is the number of seconds from a disk
│ │ │ │ +write errors occur on a torrent until libtorrent will take it out
│ │ │ │ +of the upload mode, to test if the error condition has been fixed.</p>
│ │ │ │ +<p>libtorrent will only do this automatically for auto managed
│ │ │ │ +torrents.</p>
│ │ │ │ +<p>You can explicitly take a torrent out of upload only mode using
│ │ │ │ +set_upload_mode().</p>
│ │ │ │ +<a name="max_suggest_pieces"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_suggest_pieces</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>16</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">max_suggest_pieces</tt> is the max number of suggested piece indices
│ │ │ │ +received from a peer that's remembered. If a peer floods suggest
│ │ │ │ +messages, this limit prevents libtorrent from using too much RAM.</p>
│ │ │ │ +<a name="local_service_announce_interval"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="69%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>local_service_announce_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>5 * 60</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">local_service_announce_interval</tt> is the time between local
│ │ │ │ +network announces for a torrent.
│ │ │ │ +This interval is specified in seconds.</p>
│ │ │ │ +<a name="dht_announce_interval"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_announce_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>15 * 60</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">dht_announce_interval</tt> is the number of seconds between
│ │ │ │ +announcing torrents to the distributed hash table (DHT).</p>
│ │ │ │ +<a name="udp_tracker_token_expiry"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>udp_tracker_token_expiry</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>60</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">udp_tracker_token_expiry</tt> is the number of seconds libtorrent
│ │ │ │ +will keep UDP tracker connection tokens around for. This is
│ │ │ │ +specified to be 60 seconds. The higher this
│ │ │ │ +value is, the fewer packets have to be sent to the UDP tracker. In
│ │ │ │ +order for higher values to work, the tracker needs to be configured
│ │ │ │ +to match the expiration time for tokens.</p>
│ │ │ │ +<a name="num_optimistic_unchoke_slots"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="67%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>num_optimistic_unchoke_slots</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">num_optimistic_unchoke_slots</tt> is the number of optimistic
│ │ │ │ +unchoke slots to use.
│ │ │ │ +Having a higher number of optimistic unchoke slots mean you will
│ │ │ │ +find the good peers faster but with the trade-off to use up more
│ │ │ │ +bandwidth. 0 means automatic, where libtorrent opens up 20% of your
│ │ │ │ +allowed upload slots as optimistic unchoke slots.</p>
│ │ │ │ +<a name="max_pex_peers"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="50%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +<col width="30%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_pex_peers</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>50</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the max number of peers we accept from pex messages from a single
│ │ │ │ +peer. this limits the number of concurrent peers any of our peers
│ │ │ │ +claims to be connected to. If they claim to be connected to more
│ │ │ │ +than this, we'll ignore any peer that exceeds this limit</p>
│ │ │ │ +<a name="tick_interval"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="50%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +<col width="30%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>tick_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>500</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">tick_interval</tt> specifies the number of milliseconds between
│ │ │ │ +internal ticks. This is the frequency with which bandwidth quota is
│ │ │ │ +distributed to peers. It should not be more than one second (i.e.
│ │ │ │ +1000 ms). Setting this to a low value (around 100) means higher
│ │ │ │ +resolution bandwidth quota distribution, setting it to a higher
│ │ │ │ +value saves CPU cycles.</p>
│ │ │ │ +<a name="share_mode_target"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="56%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>share_mode_target</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">share_mode_target</tt> specifies the target share ratio for share
│ │ │ │ +mode torrents. If set to 3, we'll try to upload 3
│ │ │ │ +times as much as we download. Setting this very high, will make it
│ │ │ │ +very conservative and you might end up not downloading anything
│ │ │ │ +ever (and not affecting your share ratio). It does not make any
│ │ │ │ +sense to set this any lower than 2. For instance, if only 3 peers
│ │ │ │ +need to download the rarest piece, it's impossible to download a
│ │ │ │ +single piece and upload it more than 3 times. If the
│ │ │ │ +share_mode_target is set to more than 3, nothing is downloaded.</p>
│ │ │ │ +<a name="upload_rate_limit"></a>
│ │ │ │ +<a name="download_rate_limit"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>upload_rate_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>download_rate_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">upload_rate_limit</tt> and <tt class="docutils literal">download_rate_limit</tt> sets
│ │ │ │ +the session-global limits of upload and download rate limits, in
│ │ │ │ +bytes per second. By default peers on the local network are not rate
│ │ │ │ +limited.</p>
│ │ │ │ +<p>A value of 0 means unlimited.</p>
│ │ │ │ +<p>For fine grained control over rate limits, including making them apply
│ │ │ │ +to local peers, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ +<a name="dht_upload_rate_limit"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>dht_upload_rate_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>8000</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the number of bytes per second (on average) the DHT is allowed to send.
│ │ │ │ +If the incoming requests causes to many bytes to be sent in responses,
│ │ │ │ +incoming requests will be dropped until the quota has been replenished.</p>
│ │ │ │ +<a name="unchoke_slots_limit"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>unchoke_slots_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">unchoke_slots_limit</tt> is the max number of unchoked peers in the
│ │ │ │ +<a class="reference external" href="reference-Session.html#session">session</a>. The number of unchoke slots may be ignored depending on
│ │ │ │ +what <tt class="docutils literal">choking_algorithm</tt> is set to. Setting this limit to -1
│ │ │ │ +means unlimited, i.e. all peers will always be unchoked.</p>
│ │ │ │ +<a name="connections_limit"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="56%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>connections_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>200</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">connections_limit</tt> sets a global limit on the number of
│ │ │ │ +connections opened. The number of connections is set to a hard
│ │ │ │ +minimum of at least two per torrent, so if you set a too low
│ │ │ │ +connections limit, and open too many torrents, the limit will not
│ │ │ │ +be met.</p>
│ │ │ │ +<a name="connections_slack"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="56%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>connections_slack</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">connections_slack</tt> is the number of incoming connections
│ │ │ │ +exceeding the connection limit to accept in order to potentially
│ │ │ │ +replace existing ones.</p>
│ │ │ │ +<a name="utp_target_delay"></a>
│ │ │ │ +<a name="utp_gain_factor"></a>
│ │ │ │ +<a name="utp_min_timeout"></a>
│ │ │ │ +<a name="utp_syn_resends"></a>
│ │ │ │ +<a name="utp_fin_resends"></a>
│ │ │ │ +<a name="utp_num_resends"></a>
│ │ │ │ +<a name="utp_connect_timeout"></a>
│ │ │ │ +<a name="utp_loss_multiplier"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>utp_target_delay</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>100</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>utp_gain_factor</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3000</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>utp_min_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>500</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>utp_syn_resends</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>utp_fin_resends</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>utp_num_resends</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>utp_connect_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3000</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>utp_loss_multiplier</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>50</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">utp_target_delay</tt> is the target delay for uTP sockets in
│ │ │ │ +milliseconds. A high value will make uTP connections more
│ │ │ │ +aggressive and cause longer queues in the upload bottleneck. It
│ │ │ │ +cannot be too low, since the noise in the measurements would cause
│ │ │ │ +it to send too slow.
│ │ │ │ +<tt class="docutils literal">utp_gain_factor</tt> is the number of bytes the uTP congestion
│ │ │ │ +window can increase at the most in one RTT.
│ │ │ │ +If this is set too high, the congestion controller reacts
│ │ │ │ +too hard to noise and will not be stable, if it's set too low, it
│ │ │ │ +will react slow to congestion and not back off as fast.</p>
│ │ │ │ +<p><tt class="docutils literal">utp_min_timeout</tt> is the shortest allowed uTP socket timeout,
│ │ │ │ +specified in milliseconds. The
│ │ │ │ +timeout depends on the RTT of the connection, but is never smaller
│ │ │ │ +than this value. A connection times out when every packet in a
│ │ │ │ +window is lost, or when a packet is lost twice in a row (i.e. the
│ │ │ │ +resent packet is lost as well).</p>
│ │ │ │ +<p>The shorter the timeout is, the faster the connection will recover
│ │ │ │ +from this situation, assuming the RTT is low enough.
│ │ │ │ +<tt class="docutils literal">utp_syn_resends</tt> is the number of SYN packets that are sent (and
│ │ │ │ +timed out) before giving up and closing the socket.
│ │ │ │ +<tt class="docutils literal">utp_num_resends</tt> is the number of times a packet is sent (and
│ │ │ │ +lost or timed out) before giving up and closing the connection.
│ │ │ │ +<tt class="docutils literal">utp_connect_timeout</tt> is the number of milliseconds of timeout
│ │ │ │ +for the initial SYN packet for uTP connections. For each timed out
│ │ │ │ +packet (in a row), the timeout is doubled. <tt class="docutils literal">utp_loss_multiplier</tt>
│ │ │ │ +controls how the congestion window is changed when a packet loss is
│ │ │ │ +experienced. It's specified as a percentage multiplier for
│ │ │ │ +<tt class="docutils literal">cwnd</tt>. Do not change this value unless you know what you're doing.
│ │ │ │ +Never set it higher than 100.</p>
│ │ │ │ +<a name="mixed_mode_algorithm"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="35%" />
│ │ │ │ +<col width="10%" />
│ │ │ │ +<col width="55%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>mixed_mode_algorithm</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>settings_pack::peer_proportional</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>The <tt class="docutils literal">mixed_mode_algorithm</tt> determines how to treat TCP
│ │ │ │ +connections when there are uTP connections. Since uTP is designed
│ │ │ │ +to yield to TCP, there's an inherent problem when using swarms that
│ │ │ │ +have both TCP and uTP connections. If nothing is done, uTP
│ │ │ │ +connections would often be starved out for bandwidth by the TCP
│ │ │ │ +connections. This mode is <tt class="docutils literal">prefer_tcp</tt>. The <tt class="docutils literal">peer_proportional</tt>
│ │ │ │ +mode simply looks at the current throughput and rate limits all TCP
│ │ │ │ +connections to their proportional share based on how many of the
│ │ │ │ +connections are TCP. This works best if uTP connections are not
│ │ │ │ +rate limited by the global rate limiter (which they aren't by
│ │ │ │ +default).</p>
│ │ │ │ +<a name="listen_queue_size"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="56%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>listen_queue_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">listen_queue_size</tt> is the value passed in to listen() for the
│ │ │ │ +listen socket. It is the number of outstanding incoming connections
│ │ │ │ +to queue up while we're not actively waiting for a connection to be
│ │ │ │ +accepted. 5 should be sufficient for any
│ │ │ │ +normal client. If this is a high performance server which expects
│ │ │ │ +to receive a lot of connections, or used in a simulator or test, it
│ │ │ │ +might make sense to raise this number. It will not take affect
│ │ │ │ +until the <tt class="docutils literal">listen_interfaces</tt> settings is updated.</p>
│ │ │ │ +<a name="torrent_connect_boost"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>torrent_connect_boost</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>30</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">torrent_connect_boost</tt> is the number of peers to try to connect
│ │ │ │ +to immediately when the first tracker response is received for a
│ │ │ │ +torrent. This is a boost to given to new torrents to accelerate
│ │ │ │ +them starting up. The normal connect scheduler is run once every
│ │ │ │ +second, this allows peers to be connected immediately instead of
│ │ │ │ +waiting for the <a class="reference external" href="reference-Session.html#session">session</a> tick to trigger connections.
│ │ │ │ +This may not be set higher than 255.</p>
│ │ │ │ +<a name="alert_queue_size"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="55%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="27%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>alert_queue_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>2000</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">alert_queue_size</tt> is the maximum number of alerts queued up
│ │ │ │ +internally. If alerts are not popped, the queue will eventually
│ │ │ │ +fill up to this level. Once the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue is full, additional
│ │ │ │ +alerts will be dropped, and not delivered to the client. Once the
│ │ │ │ +client drains the queue, new alerts may be delivered again. In order
│ │ │ │ +to know that alerts have been dropped, see
│ │ │ │ +session_handle::dropped_alerts().</p>
│ │ │ │ +<a name="max_metadata_size"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="44%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="42%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_metadata_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3 * 1024 * 10240</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">max_metadata_size</tt> is the maximum allowed size (in bytes) to be
│ │ │ │ +received by the metadata extension, i.e. magnet links.</p>
│ │ │ │ +<a name="hashing_threads"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="53%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="28%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>hashing_threads</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">hashing_threads</tt> is the number of disk I/O threads to use for
│ │ │ │ +piece hash verification. These threads are <em>in addition</em> to the
│ │ │ │ +regular disk I/O threads specified by <a class="reference external" href="reference-Settings.html#aio_threads">settings_pack::aio_threads</a>.
│ │ │ │ +These threads are only used for full checking of torrents. The
│ │ │ │ +hash checking done while downloading are done by the regular disk
│ │ │ │ +I/O threads.
│ │ │ │ +The <a class="reference external" href="reference-Utility.html#hasher">hasher</a> threads do not only compute hashes, but also perform
│ │ │ │ +the read from disk. On storage optimal for sequential access,
│ │ │ │ +such as hard drives, this setting should be set to 1, which is
│ │ │ │ +also the default.</p>
│ │ │ │ +<a name="checking_mem_usage"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>checking_mem_usage</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>256</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the number of blocks to keep outstanding at any given time when
│ │ │ │ +checking torrents. Higher numbers give faster re-checks but uses
│ │ │ │ +more memory. Specified in number of 16 kiB blocks</p>
│ │ │ │ +<a name="predictive_piece_announce"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="64%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>predictive_piece_announce</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if set to &gt; 0, pieces will be announced to other peers before they
│ │ │ │ +are fully downloaded (and before they are hash checked). The
│ │ │ │ +intention is to gain 1.5 potential round trip times per downloaded
│ │ │ │ +piece. When non-zero, this indicates how many milliseconds in
│ │ │ │ +advance pieces should be announced, before they are expected to be
│ │ │ │ +completed.</p>
│ │ │ │ +<a name="aio_threads"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="46%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +<col width="32%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>aio_threads</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>for some aio back-ends, <tt class="docutils literal">aio_threads</tt> specifies the number of
│ │ │ │ +io-threads to use.</p>
│ │ │ │ +<a name="tracker_backoff"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="53%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="28%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>tracker_backoff</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>250</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p><tt class="docutils literal">tracker_backoff</tt> determines how aggressively to back off from
│ │ │ │ +retrying failing trackers. This value determines <em>x</em> in the
│ │ │ │ +following formula, determining the number of seconds to wait until
│ │ │ │ +the next retry:</p>
│ │ │ │ +<blockquote>
│ │ │ │ +delay = 5 + 5 * x / 100 * fails^2</blockquote>
│ │ │ │ +<p>This setting may be useful to make libtorrent more or less
│ │ │ │ +aggressive in hitting trackers.</p>
│ │ │ │ +<a name="share_ratio_limit"></a>
│ │ │ │ +<a name="seed_time_ratio_limit"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>share_ratio_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>200</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>seed_time_ratio_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>700</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>when a seeding torrent reaches either the share ratio (bytes up /
│ │ │ │ +bytes down) or the seed time ratio (seconds as seed / seconds as
│ │ │ │ +downloader) or the seed time limit (seconds as seed) it is
│ │ │ │ +considered done, and it will leave room for other torrents. These
│ │ │ │ +are specified as percentages. Torrents that are considered done will
│ │ │ │ +still be allowed to be seeded, they just won't have priority anymore.
│ │ │ │ +For more, see <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</p>
│ │ │ │ +<a name="peer_turnover"></a>
│ │ │ │ +<a name="peer_turnover_cutoff"></a>
│ │ │ │ +<a name="peer_turnover_interval"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="62%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>peer_turnover</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>peer_turnover_cutoff</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>90</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>peer_turnover_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>300</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>peer_turnover is the percentage of peers to disconnect every
│ │ │ │ +turnover peer_turnover_interval (if we're at the peer limit), this
│ │ │ │ +is specified in percent when we are connected to more than limit *
│ │ │ │ +peer_turnover_cutoff peers disconnect peer_turnover fraction of the
│ │ │ │ +peers. It is specified in percent peer_turnover_interval is the
│ │ │ │ +interval (in seconds) between optimistic disconnects if the
│ │ │ │ +disconnects happen and how many peers are disconnected is
│ │ │ │ +controlled by peer_turnover and peer_turnover_cutoff</p>
│ │ │ │ +<a name="connect_seed_every_n_download"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="67%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>connect_seed_every_n_download</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>this setting controls the priority of downloading torrents over
│ │ │ │ +seeding or finished torrents when it comes to making peer
│ │ │ │ +connections. Peer connections are throttled by the connection_speed
│ │ │ │ +and the half-open connection limit. This makes peer connections a
│ │ │ │ +limited resource. Torrents that still have pieces to download are
│ │ │ │ +prioritized by default, to avoid having many seeding torrents use
│ │ │ │ +most of the connection attempts and only give one peer every now
│ │ │ │ +and then to the downloading torrent. libtorrent will loop over the
│ │ │ │ +downloading torrents to connect a peer each, and every n:th
│ │ │ │ +connection attempt, a finished torrent is picked to be allowed to
│ │ │ │ +connect to a peer. This setting controls n.</p>
│ │ │ │ +<a name="max_http_recv_buffer_size"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="60%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="27%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_http_recv_buffer_size</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>4*1024*204</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the max number of bytes to allow an HTTP response to be when
│ │ │ │ +announcing to trackers or downloading .torrent files via the
│ │ │ │ +<tt class="docutils literal">url</tt> provided in <tt class="docutils literal">add_torrent_params</tt>.</p>
│ │ │ │ +<a name="max_retry_port_bind"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>max_retry_port_bind</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>if binding to a specific port fails, should the port be incremented
│ │ │ │ +by one and tried again? This setting specifies how many times to
│ │ │ │ +retry a failed port bind</p>
│ │ │ │ +<a name="alert_mask"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="44%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +<col width="33%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>alert_mask</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>a bitmask combining flags from <a class="reference external" href="reference-Alerts.html#alert_category_t">alert_category_t</a> defining which
│ │ │ │ +kinds of alerts to receive</p>
│ │ │ │ +<a name="out_enc_policy"></a>
│ │ │ │ +<a name="in_enc_policy"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="33%" />
│ │ │ │ +<col width="12%" />
│ │ │ │ +<col width="55%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>out_enc_policy</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>settings_pack::pe_enabled</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>in_enc_policy</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>settings_pack::pe_enabled</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>control the settings for incoming and outgoing connections
│ │ │ │ +respectively. see <a class="reference external" href="reference-Settings.html#enc_policy">enc_policy</a> enum for the available options.
│ │ │ │ +Keep in mind that protocol encryption degrades performance in
│ │ │ │ +several respects:</p>
│ │ │ │ +<ol class="arabic simple">
│ │ │ │ +<li>It prevents &quot;zero copy&quot; disk buffers being sent to peers, since
│ │ │ │ +each peer needs to mutate the data (i.e. encrypt it) the data
│ │ │ │ +must be copied per peer connection rather than sending the same
│ │ │ │ +buffer to multiple peers.</li>
│ │ │ │ +<li>The encryption itself requires more CPU than plain bittorrent
│ │ │ │ +protocol. The highest cost is the Diffie Hellman exchange on
│ │ │ │ +connection setup.</li>
│ │ │ │ +<li>The encryption handshake adds several round-trips to the
│ │ │ │ +connection setup, and delays transferring data.</li>
│ │ │ │ +</ol>
│ │ │ │ +<a name="allowed_enc_level"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="39%" />
│ │ │ │ +<col width="12%" />
│ │ │ │ +<col width="49%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>allowed_enc_level</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>settings_pack::pe_both</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>determines the encryption level of the connections. This setting
│ │ │ │ +will adjust which encryption scheme is offered to the other peer,
│ │ │ │ +as well as which encryption scheme is selected by the client. See
│ │ │ │ +<a class="reference external" href="reference-Settings.html#enc_level">enc_level</a> enum for options.</p>
│ │ │ │ +<a name="inactive_down_rate"></a>
│ │ │ │ +<a name="inactive_up_rate"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +</colgroup>
│ │ │ │ +<thead valign="bottom">
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">type</th>
│ │ │ │ +<th class="head">default</th>
│ │ │ │ +</tr>
│ │ │ │ +</thead>
│ │ │ │ +<tbody valign="top">
│ │ │ │ +<tr><td>inactive_down_rate</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>2048</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>inactive_up_rate</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>2048</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<p>the download and upload rate limits for a torrent to be considered
│ │ │ │ +active by the queuing mechanism. A torrent whose download rate is
│ │ │ │ +less than <tt class="docutils literal">inactive_down_rate</tt> and whose upload rate is less than
│ │ │ │ +<tt class="docutils literal">inactive_up_rate</tt> for <tt class="docutils literal">auto_manage_startup</tt> seconds, is
│ │ │ │ +considered inactive, and another queued torrent may be started.
│ │ │ │ +This logic is disabled if <tt class="docutils literal">dont_count_slow_torrents</tt> is false.</p>
│ │ │ │ +<a name="proxy_type"></a><table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="31%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="54%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>report_web_seed_downloads</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>proxy_type</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>settings_pack::none</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>specifies whether downloads from web seeds is reported to the
│ │ │ │ -tracker or not. Turning it off also excludes web
│ │ │ │ -seed traffic from other stats and download rate reporting via the
│ │ │ │ -libtorrent API.</p>
│ │ │ │ -<a name="seeding_outgoing_connections"></a><table border="1" class="docutils">
│ │ │ │ +<p>proxy to use. see <a class="reference external" href="reference-Settings.html#proxy_type_t">proxy_type_t</a>.</p>
│ │ │ │ +<a name="proxy_port"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="67%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ +<col width="44%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +<col width="33%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>seeding_outgoing_connections</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>proxy_port</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">seeding_outgoing_connections</tt> determines if seeding (and
│ │ │ │ -finished) torrents should attempt to make outgoing connections or
│ │ │ │ -not. It may be set to false in very
│ │ │ │ -specific applications where the cost of making outgoing connections
│ │ │ │ -is high, and there are no or small benefits of doing so. For
│ │ │ │ -instance, if no nodes are behind a firewall or a NAT, seeds don't
│ │ │ │ -need to make outgoing connections.</p>
│ │ │ │ -<a name="no_connect_privileged_ports"></a><table border="1" class="docutils">
│ │ │ │ +<p>the port of the proxy server</p>
│ │ │ │ +<a name="i2p_port"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="66%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ +<col width="40%" />
│ │ │ │ +<col width="24%" />
│ │ │ │ +<col width="36%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>no_connect_privileged_ports</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>false</td>
│ │ │ │ +<tr><td>i2p_port</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when this is true, libtorrent will not attempt to make outgoing
│ │ │ │ -connections to peers whose port is &lt; 1024. This is a safety
│ │ │ │ -precaution to avoid being part of a DDoS attack</p>
│ │ │ │ -<a name="smooth_connects"></a><table border="1" class="docutils">
│ │ │ │ +<p>sets the <a class="reference external" href="http://www.i2p2.de">i2p</a> SAM bridge port to connect to. set the hostname with
│ │ │ │ +the <tt class="docutils literal">i2p_hostname</tt> setting.</p>
│ │ │ │ +<a name="urlseed_max_request_bytes"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │  <col width="53%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="28%" />
│ │ │ │ +<col width="12%" />
│ │ │ │ +<col width="35%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>smooth_connects</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>urlseed_max_request_bytes</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>16 * 1024 * 1024</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">smooth_connects</tt> means the number of
│ │ │ │ -connection attempts per second may be limited to below the
│ │ │ │ -<tt class="docutils literal">connection_speed</tt>, in case we're close to bump up against the
│ │ │ │ -limit of number of connections. The intention of this setting is to
│ │ │ │ -more evenly distribute our connection attempts over time, instead
│ │ │ │ -of attempting to connect in batches, and timing them out in
│ │ │ │ -batches.</p>
│ │ │ │ -<a name="always_send_user_agent"></a><table border="1" class="docutils">
│ │ │ │ +<p>The maximum request range of an url seed in bytes. This value
│ │ │ │ +defines the largest possible sequential web seed request. Lower values
│ │ │ │ +are possible but will be ignored if they are lower then piece size.
│ │ │ │ +This value should be related to your download speed to prevent
│ │ │ │ +libtorrent from creating too many expensive http requests per
│ │ │ │ +second. You can select a value as high as you want but keep in mind
│ │ │ │ +that libtorrent can't create parallel requests if the first request
│ │ │ │ +did already select the whole file.
│ │ │ │ +If you combine bittorrent seeds with web seeds and pick strategies
│ │ │ │ +like rarest first you may find your web seed requests split into
│ │ │ │ +smaller parts because we don't download already picked pieces
│ │ │ │ +twice.</p>
│ │ │ │ +<a name="web_seed_name_lookup_retry"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="62%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ +<col width="65%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="21%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>always_send_user_agent</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>false</td>
│ │ │ │ +<tr><td>web_seed_name_lookup_retry</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>1800</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>always send user-agent in every web seed request. If false, only
│ │ │ │ -the first request per http connection will include the user agent</p>
│ │ │ │ -<a name="apply_ip_filter_to_trackers"></a><table border="1" class="docutils">
│ │ │ │ +<p>time to wait until a new retry of a web seed name lookup</p>
│ │ │ │ +<a name="close_file_interval"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="66%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ +<col width="44%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="44%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>apply_ip_filter_to_trackers</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>close_file_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>CLOSE_FILE_INTERVAL</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">apply_ip_filter_to_trackers</tt> determines
│ │ │ │ -whether the IP filter applies to trackers as well as peers. If this
│ │ │ │ -is set to false, trackers are exempt from the IP filter (if there
│ │ │ │ -is one). If no IP filter is set, this setting is irrelevant.</p>
│ │ │ │ -<a name="ban_web_seeds"></a><table border="1" class="docutils">
│ │ │ │ +<p>the number of seconds between closing the file opened the longest
│ │ │ │ +ago. 0 means to disable the feature. The purpose of this is to
│ │ │ │ +periodically close files to trigger the operating system flushing
│ │ │ │ +disk cache. Specifically it has been observed to be required on
│ │ │ │ +windows to not have the disk cache grow indefinitely.
│ │ │ │ +This defaults to 240 seconds on windows, and disabled on other
│ │ │ │ +systems.</p>
│ │ │ │ +<a name="utp_cwnd_reduce_timer"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="50%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -<col width="30%" />
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>ban_web_seeds</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>utp_cwnd_reduce_timer</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>100</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when true, web seeds sending bad data will be banned</p>
│ │ │ │ -<a name="support_share_mode"></a><table border="1" class="docutils">
│ │ │ │ +<p>When uTP experiences packet loss, it will reduce the congestion
│ │ │ │ +window, and not reduce it again for this many milliseconds, even if
│ │ │ │ +experiencing another lost packet.</p>
│ │ │ │ +<a name="max_web_seed_connections"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ +<col width="63%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="22%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>support_share_mode</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>max_web_seed_connections</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>if false, prevents libtorrent to advertise share-mode support</p>
│ │ │ │ -<a name="report_redundant_bytes"></a><table border="1" class="docutils">
│ │ │ │ +<p>the max number of web seeds to have connected per torrent at any
│ │ │ │ +given time.</p>
│ │ │ │ +<a name="resolver_cache_timeout"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │  <col width="62%" />
│ │ │ │  <col width="15%" />
│ │ │ │  <col width="23%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>report_redundant_bytes</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>resolver_cache_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>1200</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>if this is true, the number of redundant bytes is sent to the
│ │ │ │ -tracker</p>
│ │ │ │ -<a name="listen_system_port_fallback"></a><table border="1" class="docutils">
│ │ │ │ +<p>the number of seconds before the internal host name resolver
│ │ │ │ +considers a cache value timed out, negative values are interpreted
│ │ │ │ +as zero.</p>
│ │ │ │ +<a name="send_not_sent_low_watermark"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │  <col width="66%" />
│ │ │ │  <col width="14%" />
│ │ │ │  <col width="20%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>listen_system_port_fallback</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>send_not_sent_low_watermark</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>16384</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>if this is true, libtorrent will fall back to listening on a port
│ │ │ │ -chosen by the operating system (i.e. binding to port 0). If a
│ │ │ │ -failure is preferred, set this to false.</p>
│ │ │ │ -<a name="announce_crypto_support"></a><table border="1" class="docutils">
│ │ │ │ +<p>specify the not-sent low watermark for socket send buffers. This
│ │ │ │ +corresponds to the, Linux-specific, <tt class="docutils literal">TCP_NOTSENT_LOWAT</tt> TCP socket
│ │ │ │ +option.</p>
│ │ │ │ +<a name="rate_choker_initial_threshold"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ +<col width="67%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="20%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>announce_crypto_support</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>rate_choker_initial_threshold</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>1024</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when this is true, and incoming encrypted connections are enabled,
│ │ │ │ -&amp;supportcrypt=1 is included in http tracker announces</p>
│ │ │ │ -<a name="enable_upnp"></a><table border="1" class="docutils">
│ │ │ │ +<p>the rate based choker compares the upload rate to peers against a
│ │ │ │ +threshold that increases proportionally by its size for every
│ │ │ │ +peer it visits, visiting peers in decreasing upload rate. The
│ │ │ │ +number of upload slots is determined by the number of peers whose
│ │ │ │ +upload rate exceeds the threshold. This option sets the start
│ │ │ │ +value for this threshold. A higher value leads to fewer unchoke
│ │ │ │ +slots, a lower value leads to more.</p>
│ │ │ │ +<a name="upnp_lease_duration"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="46%" />
│ │ │ │ -<col width="21%" />
│ │ │ │ -<col width="32%" />
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>enable_upnp</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>upnp_lease_duration</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3600</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>Starts and stops the UPnP service. When started, the listen port
│ │ │ │ -and the DHT port are attempted to be forwarded on local UPnP router
│ │ │ │ -devices.</p>
│ │ │ │ -<p>The upnp object returned by <tt class="docutils literal">start_upnp()</tt> can be used to add and
│ │ │ │ -remove arbitrary port mappings. Mapping status is returned through
│ │ │ │ -the <a class="reference external" href="reference-Alerts.html#portmap_alert">portmap_alert</a> and the <a class="reference external" href="reference-Alerts.html#portmap_error_alert">portmap_error_alert</a>. The object will be
│ │ │ │ -valid until <tt class="docutils literal">stop_upnp()</tt> is called. See <a class="reference external" href="manual-ref.html#upnp-and-nat-pmp">upnp and nat pmp</a>.</p>
│ │ │ │ -<a name="enable_natpmp"></a><table border="1" class="docutils">
│ │ │ │ +<p>The expiration time of UPnP port-mappings, specified in seconds. 0
│ │ │ │ +means permanent lease. Some routers do not support expiration times
│ │ │ │ +on port-maps (nor correctly returning an error indicating lack of
│ │ │ │ +support). In those cases, set this to 0. Otherwise, don't set it any
│ │ │ │ +lower than 5 minutes.</p>
│ │ │ │ +<a name="max_concurrent_http_announces"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="50%" />
│ │ │ │ +<col width="67%" />
│ │ │ │ +<col width="13%" />
│ │ │ │  <col width="20%" />
│ │ │ │ -<col width="30%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>enable_natpmp</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>max_concurrent_http_announces</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>50</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>Starts and stops the NAT-PMP service. When started, the listen port
│ │ │ │ -and the DHT port are attempted to be forwarded on the router
│ │ │ │ -through NAT-PMP.</p>
│ │ │ │ -<p>The natpmp object returned by <tt class="docutils literal">start_natpmp()</tt> can be used to add
│ │ │ │ -and remove arbitrary port mappings. Mapping status is returned
│ │ │ │ -through the <a class="reference external" href="reference-Alerts.html#portmap_alert">portmap_alert</a> and the <a class="reference external" href="reference-Alerts.html#portmap_error_alert">portmap_error_alert</a>. The object
│ │ │ │ -will be valid until <tt class="docutils literal">stop_natpmp()</tt> is called. See
│ │ │ │ -<a class="reference external" href="manual-ref.html#upnp-and-nat-pmp">upnp and nat pmp</a>.</p>
│ │ │ │ -<a name="enable_lsd"></a><table border="1" class="docutils">
│ │ │ │ +<p>limits the number of concurrent HTTP tracker announces. Once the
│ │ │ │ +limit is hit, tracker requests are queued and issued when an
│ │ │ │ +outstanding announce completes.</p>
│ │ │ │ +<a name="dht_max_peers_reply"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="44%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="33%" />
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>enable_lsd</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_max_peers_reply</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>100</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>Starts and stops Local Service Discovery. This service will
│ │ │ │ -broadcast the info-hashes of all the non-private torrents on the
│ │ │ │ -local network to look for peers on the same swarm within multicast
│ │ │ │ -reach.</p>
│ │ │ │ -<a name="enable_dht"></a><table border="1" class="docutils">
│ │ │ │ +<p>the maximum number of peers to send in a reply to <tt class="docutils literal">get_peers</tt></p>
│ │ │ │ +<a name="dht_search_branching"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="44%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="33%" />
│ │ │ │ +<col width="59%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>enable_dht</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_search_branching</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>5</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>starts the dht node and makes the trackerless service available to
│ │ │ │ -torrents.</p>
│ │ │ │ -<a name="prefer_rc4"></a><table border="1" class="docutils">
│ │ │ │ +<p>the number of concurrent search request the node will send when
│ │ │ │ +announcing and refreshing the routing table. This parameter is called
│ │ │ │ +alpha in the kademlia paper</p>
│ │ │ │ +<a name="dht_max_fail_count"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="44%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="33%" />
│ │ │ │ +<col width="57%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="26%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>prefer_rc4</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>false</td>
│ │ │ │ +<tr><td>dht_max_fail_count</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>20</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>if the allowed encryption level is both, setting this to true will
│ │ │ │ -prefer RC4 if both methods are offered, plain text otherwise</p>
│ │ │ │ -<a name="proxy_hostnames"></a><table border="1" class="docutils">
│ │ │ │ +<p>the maximum number of failed tries to contact a node before it is
│ │ │ │ +removed from the routing table. If there are known working nodes that
│ │ │ │ +are ready to replace a failing node, it will be replaced immediately,
│ │ │ │ +this limit is only used to clear out nodes that don't have any node
│ │ │ │ +that can replace them.</p>
│ │ │ │ +<a name="dht_max_torrents"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="53%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="28%" />
│ │ │ │ +<col width="55%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="27%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>proxy_hostnames</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_max_torrents</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>2000</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>if true, hostname lookups are done via the configured proxy (if
│ │ │ │ -any). This is only supported by SOCKS5 and HTTP.</p>
│ │ │ │ -<a name="proxy_peer_connections"></a><table border="1" class="docutils">
│ │ │ │ +<p>the total number of torrents to track from the DHT. This is simply an
│ │ │ │ +upper limit to make sure malicious DHT nodes cannot make us allocate
│ │ │ │ +an unbounded amount of memory.</p>
│ │ │ │ +<a name="dht_max_dht_items"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="62%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ +<col width="56%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="26%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>proxy_peer_connections</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_max_dht_items</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>700</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>if true, peer connections are made (and accepted) over the
│ │ │ │ -configured proxy, if any. Web seeds as well as regular bittorrent
│ │ │ │ -peer connections are considered &quot;peer connections&quot;. Anything
│ │ │ │ -transporting actual torrent payload (trackers and DHT traffic are
│ │ │ │ -not considered peer connections).</p>
│ │ │ │ -<a name="auto_sequential"></a><table border="1" class="docutils">
│ │ │ │ +<p>max number of items the DHT will store</p>
│ │ │ │ +<a name="dht_max_peers"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="53%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="28%" />
│ │ │ │ +<col width="50%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +<col width="30%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>auto_sequential</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_max_peers</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>500</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>if this setting is true, torrents with a very high availability of
│ │ │ │ -pieces (and seeds) are downloaded sequentially. This is more
│ │ │ │ -efficient for the disk I/O. With many seeds, the download order is
│ │ │ │ -unlikely to matter anyway</p>
│ │ │ │ -<a name="proxy_tracker_connections"></a><table border="1" class="docutils">
│ │ │ │ +<p>the max number of peers to store per torrent (for the DHT)</p>
│ │ │ │ +<a name="dht_max_torrent_search_reply"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="64%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="21%" />
│ │ │ │ +<col width="67%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="20%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>proxy_tracker_connections</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_max_torrent_search_reply</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>20</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>if true, tracker connections are made over the configured proxy, if
│ │ │ │ -any.</p>
│ │ │ │ -<a name="enable_ip_notifier"></a><table border="1" class="docutils">
│ │ │ │ +<p>the max number of torrents to return in a torrent search query to the
│ │ │ │ +DHT</p>
│ │ │ │ +<a name="dht_block_timeout"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ +<col width="56%" />
│ │ │ │ +<col width="18%" />
│ │ │ │  <col width="26%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>enable_ip_notifier</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_block_timeout</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>5 * 60</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>Starts and stops the internal IP table route changes notifier.</p>
│ │ │ │ -<p>The current implementation supports multiple platforms, and it is
│ │ │ │ -recommended to have it enable, but you may want to disable it if
│ │ │ │ -it's supported but unreliable, or if you have a better way to
│ │ │ │ -detect the changes. In the later case, you should manually call
│ │ │ │ -<tt class="docutils literal"><span class="pre">session_handle::reopen_network_sockets</span></tt> to ensure network
│ │ │ │ -changes are taken in consideration.</p>
│ │ │ │ -<a name="dht_prefer_verified_node_ids"></a><table border="1" class="docutils">
│ │ │ │ +<p>the number of seconds a DHT node is banned if it exceeds the rate
│ │ │ │ +limit. The rate limit is averaged over 10 seconds to allow for bursts
│ │ │ │ +above the limit.</p>
│ │ │ │ +<a name="dht_block_ratelimit"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="67%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ +<col width="58%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="25%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>dht_prefer_verified_node_ids</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_block_ratelimit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>5</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when this is true, nodes whose IDs are derived from their source
│ │ │ │ -IP according to <a class="reference external" href="https://www.bittorrent.org/beps/bep_0042.html">BEP 42</a> are preferred in the routing table.</p>
│ │ │ │ -<a name="dht_restrict_routing_ips"></a><table border="1" class="docutils">
│ │ │ │ +<p>the max number of packets per second a DHT node is allowed to send
│ │ │ │ +without getting banned.</p>
│ │ │ │ +<a name="dht_item_lifetime"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ +<col width="56%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="26%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>dht_restrict_routing_ips</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_item_lifetime</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>determines if the routing table entries should restrict entries to one
│ │ │ │ -per IP. This defaults to true, which helps mitigate some attacks on
│ │ │ │ -the DHT. It prevents adding multiple nodes with IPs with a very close
│ │ │ │ -CIDR distance.</p>
│ │ │ │ -<p>when set, nodes whose IP address that's in the same /24 (or /64 for
│ │ │ │ -IPv6) range in the same routing table bucket. This is an attempt to
│ │ │ │ -mitigate node ID spoofing attacks also restrict any IP to only have a
│ │ │ │ -single <a class="reference external" href="reference-Bencoding.html#entry">entry</a> in the whole routing table</p>
│ │ │ │ -<a name="dht_restrict_search_ips"></a><table border="1" class="docutils">
│ │ │ │ +<p>the number of seconds a immutable/mutable item will be expired.
│ │ │ │ +default is 0, means never expires.</p>
│ │ │ │ +<a name="dht_sample_infohashes_interval"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ +<col width="68%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="19%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>dht_restrict_search_ips</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_sample_infohashes_interval</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>21600</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>determines if DHT searches should prevent adding nodes with IPs with
│ │ │ │ -very close CIDR distance. This also defaults to true and helps
│ │ │ │ -mitigate certain attacks on the DHT.</p>
│ │ │ │ -<a name="dht_extended_routing_table"></a><table border="1" class="docutils">
│ │ │ │ +<p>the info-hashes sample recomputation interval (in seconds).
│ │ │ │ +The node will precompute a subset of the tracked info-hashes and return
│ │ │ │ +that instead of calculating it upon each request. The permissible range
│ │ │ │ +is between 0 and 21600 seconds (inclusive).</p>
│ │ │ │ +<a name="dht_max_infohashes_sample_count"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="65%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="21%" />
│ │ │ │ +<col width="69%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="19%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>dht_extended_routing_table</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>dht_max_infohashes_sample_count</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>20</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>makes the first buckets in the DHT routing table fit 128, 64, 32 and
│ │ │ │ -16 nodes respectively, as opposed to the standard size of 8. All other
│ │ │ │ -buckets have size 8 still.</p>
│ │ │ │ -<a name="dht_aggressive_lookups"></a><table border="1" class="docutils">
│ │ │ │ +<p>the maximum number of elements in the sampled subset of info-hashes.
│ │ │ │ +If this number is too big, expect the DHT storage implementations
│ │ │ │ +to clamp it in order to allow UDP packets go through</p>
│ │ │ │ +<a name="max_piece_count"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="62%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ +<col width="52%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="30%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>dht_aggressive_lookups</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>max_piece_count</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0x200000</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>slightly changes the lookup behavior in terms of how many outstanding
│ │ │ │ -requests we keep. Instead of having branch factor be a hard limit, we
│ │ │ │ -always keep <em>branch factor</em> outstanding requests to the closest nodes.
│ │ │ │ -i.e. every time we get results back with closer nodes, we query them
│ │ │ │ -right away. It lowers the lookup times at the cost of more outstanding
│ │ │ │ -queries.</p>
│ │ │ │ -<a name="dht_privacy_lookups"></a><table border="1" class="docutils">
│ │ │ │ +<p><tt class="docutils literal">max_piece_count</tt> is the maximum allowed number of pieces in
│ │ │ │ +metadata received via magnet links. Loading large torrents (with
│ │ │ │ +more pieces than the default limit) may also require passing in
│ │ │ │ +a higher limit to <a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a> and
│ │ │ │ +<a class="reference external" href="reference-Torrent_Info.html#parse_info_section()">torrent_info::parse_info_section()</a>, if those are used.</p>
│ │ │ │ +<a name="metadata_token_limit"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ +<col width="59%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>dht_privacy_lookups</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>false</td>
│ │ │ │ +<tr><td>metadata_token_limit</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>2500000</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when set, perform lookups in a way that is slightly more expensive,
│ │ │ │ -but which minimizes the amount of information leaked about you.</p>
│ │ │ │ -<a name="dht_enforce_node_id"></a><table border="1" class="docutils">
│ │ │ │ +<p>when receiving metadata (torrent file) from peers, this is the
│ │ │ │ +max number of bencoded tokens we're willing to parse. This limit
│ │ │ │ +is meant to prevent DoS attacks on peers. For very large
│ │ │ │ +torrents, this limit may have to be raised.</p>
│ │ │ │ +<a name="disk_write_mode"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +<col width="8%" />
│ │ │ │ +<col width="69%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>dht_enforce_node_id</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>false</td>
│ │ │ │ +<tr><td>disk_write_mode</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>settings_pack::mmap_write_mode_t::auto_mmap_write</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when set, node's whose IDs that are not correctly generated based on
│ │ │ │ -its external IP are ignored. When a query arrives from such node, an
│ │ │ │ -error message is returned with a message saying &quot;invalid node ID&quot;.</p>
│ │ │ │ -<a name="dht_ignore_dark_internet"></a><table border="1" class="docutils">
│ │ │ │ +<p>controls whether disk writes will be made through a memory mapped
│ │ │ │ +file or via normal write calls. This only affects the
│ │ │ │ +mmap_disk_io. When saving to a non-local drive (network share,
│ │ │ │ +NFS or NAS) using memory mapped files is most likely inferior.
│ │ │ │ +When writing to a local SSD (especially in DAX mode) using memory
│ │ │ │ +mapped files likely gives the best performance.
│ │ │ │ +The values for this setting are specified as <a class="reference external" href="reference-Settings.html#mmap_write_mode_t">mmap_write_mode_t</a>.</p>
│ │ │ │ +<a name="mmap_file_size_cutoff"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>dht_ignore_dark_internet</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>mmap_file_size_cutoff</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>40</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>ignore DHT messages from parts of the internet we wouldn't expect to
│ │ │ │ -see any traffic from</p>
│ │ │ │ -<a name="dht_read_only"></a><table border="1" class="docutils">
│ │ │ │ +<p>when using mmap_disk_io, files smaller than this number of blocks
│ │ │ │ +will not be memory mapped, but will use normal pread/pwrite
│ │ │ │ +operations. This file size limit is specified in 16 kiB blocks.</p>
│ │ │ │ +<a name="i2p_inbound_quantity"></a>
│ │ │ │ +<a name="i2p_outbound_quantity"></a>
│ │ │ │ +<a name="i2p_inbound_length"></a>
│ │ │ │ +<a name="i2p_outbound_length"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="50%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -<col width="30%" />
│ │ │ │ +<col width="61%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="24%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>dht_read_only</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>false</td>
│ │ │ │ +<tr><td>i2p_inbound_quantity</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>i2p_outbound_quantity</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>i2p_inbound_length</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>i2p_outbound_length</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>3</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when set, the other nodes won't keep this node in their routing
│ │ │ │ -tables, it's meant for low-power and/or ephemeral devices that
│ │ │ │ -cannot support the DHT, it is also useful for mobile devices which
│ │ │ │ -are sensitive to network traffic and battery life.
│ │ │ │ -this node no longer responds to 'query' messages, and will place a
│ │ │ │ -'ro' key (value = 1) in the top-level message dictionary of outgoing
│ │ │ │ -query messages.</p>
│ │ │ │ -<a name="piece_extent_affinity"></a><table border="1" class="docutils">
│ │ │ │ +<p>Configures the SAM <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │ +quantity of I2P inbound and outbound tunnels [1..16].
│ │ │ │ +number of hops for I2P inbound and outbound tunnels [0..7]
│ │ │ │ +Changing these will not trigger a reconnect to the SAM bridge,
│ │ │ │ +they will take effect the next time the SAM connection is
│ │ │ │ +re-established (by restarting or changing i2p_hostname or
│ │ │ │ +i2p_port).</p>
│ │ │ │ +<a name="announce_port"></a><table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ +<col width="50%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +<col width="30%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │  <th class="head">type</th>
│ │ │ │  <th class="head">default</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>piece_extent_affinity</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>false</td>
│ │ │ │ +<tr><td>announce_port</td>
│ │ │ │ +<td>int</td>
│ │ │ │ +<td>0</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when this is true, create an affinity for downloading 4 MiB extents
│ │ │ │ -of adjacent pieces. This is an attempt to achieve better disk I/O
│ │ │ │ -throughput by downloading larger extents of bytes, for torrents with
│ │ │ │ -small piece sizes</p>
│ │ │ │ -<a name="validate_https_trackers"></a><table border="1" class="docutils">
│ │ │ │ +<p><tt class="docutils literal">announce_port</tt> is the port passed along as the <tt class="docutils literal">port</tt> parameter
│ │ │ │ +to remote trackers such as HTTP or DHT. This setting does not affect
│ │ │ │ +the effective listening port nor local service discovery announcements.
│ │ │ │ +If left as zero (default), the listening port value is used.</p>
│ │ │ │ +<div class="admonition note">
│ │ │ │ +<p class="first admonition-title">Note</p>
│ │ │ │ +<p class="last">This setting is only meant for very special cases where a
│ │ │ │ +seed's listening port differs from the external port. As an
│ │ │ │ +example, if a local proxy is used and that the proxy supports
│ │ │ │ +reverse tunnels through NAT-PMP, the tracker must connect to
│ │ │ │ +the external NAT-PMP port (configured using <tt class="docutils literal">announce_port</tt>)
│ │ │ │ +instead of the actual local listening port.</p>
│ │ │ │ +</div>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct settings_pack final : settings_interface
│ │ │ │ +{
│ │ │ │ +   friend  void <strong>apply_pack_impl</strong> (settings_pack const*
│ │ │ │ +      , aux::session_settings_single_thread&amp;
│ │ │ │ +      , std::vector&lt;void(aux::session_impl::*)()&gt;*);
│ │ │ │ +   void <strong>set_int</strong> (int name, int val) override;
│ │ │ │ +   void <strong>set_bool</strong> (int name, bool val) override;
│ │ │ │ +   void <strong>set_int</strong> (int name, flags::bitfield_flag&lt;Type, Tag&gt; const val);
│ │ │ │ +   void <strong>set_str</strong> (int name, std::string val) override;
│ │ │ │ +   bool <strong>has_val</strong> (int name) const override;
│ │ │ │ +   void <strong>clear</strong> ();
│ │ │ │ +   void <strong>clear</strong> (int name);
│ │ │ │ +   std::string const&amp; <strong>get_str</strong> (int name) const override;
│ │ │ │ +   int <strong>get_int</strong> (int name) const override;
│ │ │ │ +   bool <strong>get_bool</strong> (int name) const override;
│ │ │ │ +   void <strong>for_each</strong> (Fun&amp;&amp; f) const;
│ │ │ │ +
│ │ │ │ +   enum type_bases
│ │ │ │ +   {
│ │ │ │ +      string_type_base,
│ │ │ │ +      int_type_base,
│ │ │ │ +      bool_type_base,
│ │ │ │ +      type_mask,
│ │ │ │ +      index_mask,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   enum mmap_write_mode_t
│ │ │ │ +   {
│ │ │ │ +      always_pwrite,
│ │ │ │ +      always_mmap_write,
│ │ │ │ +      auto_mmap_write,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   enum suggest_mode_t
│ │ │ │ +   {
│ │ │ │ +      no_piece_suggestions,
│ │ │ │ +      suggest_read_cache,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   enum choking_algorithm_t
│ │ │ │ +   {
│ │ │ │ +      fixed_slots_choker,
│ │ │ │ +      rate_based_choker,
│ │ │ │ +      deprecated_bittyrant_choker,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   enum seed_choking_algorithm_t
│ │ │ │ +   {
│ │ │ │ +      round_robin,
│ │ │ │ +      fastest_upload,
│ │ │ │ +      anti_leech,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   enum io_buffer_mode_t
│ │ │ │ +   {
│ │ │ │ +      enable_os_cache,
│ │ │ │ +      deprecated_disable_os_cache_for_aligned_files,
│ │ │ │ +      disable_os_cache,
│ │ │ │ +      write_through,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   enum bandwidth_mixed_algo_t
│ │ │ │ +   {
│ │ │ │ +      prefer_tcp,
│ │ │ │ +      peer_proportional,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   enum enc_policy
│ │ │ │ +   {
│ │ │ │ +      pe_forced,
│ │ │ │ +      pe_enabled,
│ │ │ │ +      pe_disabled,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   enum enc_level
│ │ │ │ +   {
│ │ │ │ +      pe_plaintext,
│ │ │ │ +      pe_rc4,
│ │ │ │ +      pe_both,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   enum proxy_type_t
│ │ │ │ +   {
│ │ │ │ +      none,
│ │ │ │ +      socks4,
│ │ │ │ +      socks5,
│ │ │ │ +      socks5_pw,
│ │ │ │ +      http,
│ │ │ │ +      http_pw,
│ │ │ │ +   };
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="set_str()"></a>
│ │ │ │ +<a name="set_int()"></a>
│ │ │ │ +<a name="set_bool()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bset_str%28%29+set_int%28%29+set_bool%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bset_str%28%29+set_int%28%29+set_bool%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="set-str-set-int-set-bool">
│ │ │ │ +<h2>set_str() set_int() set_bool()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_int</strong> (int name, int val) override;
│ │ │ │ +void <strong>set_bool</strong> (int name, bool val) override;
│ │ │ │ +void <strong>set_int</strong> (int name, flags::bitfield_flag&lt;Type, Tag&gt; const val);
│ │ │ │ +void <strong>set_str</strong> (int name, std::string val) override;
│ │ │ │ +</pre>
│ │ │ │ +<p>set a configuration option in the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>. <tt class="docutils literal">name</tt> is one of
│ │ │ │ +the enum values from string_types, int_types or bool_types. They must
│ │ │ │ +match the respective type of the set_* function.</p>
│ │ │ │ +<a name="has_val()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bhas_val%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bhas_val%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="has-val">
│ │ │ │ +<h2>has_val()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>has_val</strong> (int name) const override;
│ │ │ │ +</pre>
│ │ │ │ +<p>queries whether the specified configuration option has a value set in
│ │ │ │ +this pack. <tt class="docutils literal">name</tt> can be any enumeration value from string_types,
│ │ │ │ +int_types or bool_types.</p>
│ │ │ │ +<a name="clear()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bclear%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bclear%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="clear">
│ │ │ │ +<h2>clear()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>clear</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>clear the settings pack from all settings</p>
│ │ │ │ +<a name="clear()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bclear%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bclear%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="clear-1">
│ │ │ │ +<h2>clear()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>clear</strong> (int name);
│ │ │ │ +</pre>
│ │ │ │ +<p>clear a specific setting from the pack</p>
│ │ │ │ +<a name="get_int()"></a>
│ │ │ │ +<a name="get_bool()"></a>
│ │ │ │ +<a name="get_str()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bget_int%28%29+get_bool%28%29+get_str%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bget_int%28%29+get_bool%28%29+get_str%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-int-get-bool-get-str">
│ │ │ │ +<h2>get_int() get_bool() get_str()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::string const&amp; <strong>get_str</strong> (int name) const override;
│ │ │ │ +int <strong>get_int</strong> (int name) const override;
│ │ │ │ +bool <strong>get_bool</strong> (int name) const override;
│ │ │ │ +</pre>
│ │ │ │ +<p>queries the current configuration option from the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>.
│ │ │ │ +<tt class="docutils literal">name</tt> is one of the enumeration values from string_types, int_types
│ │ │ │ +or bool_types. The enum value must match the type of the get_*
│ │ │ │ +function. If the specified setting field has not been set, the default
│ │ │ │ +value is returned.</p>
│ │ │ │ +<a name="type_bases"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+type_bases&labels=documentation&body=Documentation+under+heading+%22enum+type_bases%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-type-bases">
│ │ │ │ +<h2>enum type_bases</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ +<col width="47%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="34%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>validate_https_trackers</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>string_type_base</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>int_type_base</td>
│ │ │ │ +<td>16384</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>bool_type_base</td>
│ │ │ │ +<td>32768</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>type_mask</td>
│ │ │ │ +<td>49152</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>index_mask</td>
│ │ │ │ +<td>16383</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when set to true, the certificate of HTTPS trackers and HTTPS web
│ │ │ │ -seeds will be validated against the system's certificate store
│ │ │ │ -(as defined by OpenSSL). If the system does not have a
│ │ │ │ -certificate store, this option may have to be disabled in order
│ │ │ │ -to get trackers and web seeds to work).</p>
│ │ │ │ -<a name="ssrf_mitigation"></a><table border="1" class="docutils">
│ │ │ │ +<a name="mmap_write_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+mmap_write_mode_t&labels=documentation&body=Documentation+under+heading+%22enum+mmap_write_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-mmap-write-mode-t">
│ │ │ │ +<h2>enum mmap_write_mode_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="53%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="28%" />
│ │ │ │ +<col width="21%" />
│ │ │ │ +<col width="8%" />
│ │ │ │ +<col width="71%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>ssrf_mitigation</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>true</td>
│ │ │ │ +<tr><td>always_pwrite</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>disable writing to disk via mmap, always use normal write calls</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>always_mmap_write</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>prefer using memory mapped files for disk writes (at least for
│ │ │ │ +large files where it might make sense)</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>auto_mmap_write</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>determine whether to use pwrite or memory mapped files for disk
│ │ │ │ +writes depending on the kind of storage behind the save path</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when enabled, tracker and web seed requests are subject to
│ │ │ │ -certain restrictions.</p>
│ │ │ │ -<p>An HTTP(s) tracker requests to localhost (loopback)
│ │ │ │ -must have the request path start with &quot;/announce&quot;. This is the
│ │ │ │ -conventional bittorrent tracker request. Any other HTTP(S)
│ │ │ │ -tracker request to loopback will be rejected. This applies to
│ │ │ │ -trackers that redirect to loopback as well.</p>
│ │ │ │ -<p>Web seeds that end up on the client's local network (i.e. in a
│ │ │ │ -private IP address range) may not include query string arguments.
│ │ │ │ -This applies to web seeds redirecting to the local network as
│ │ │ │ -well.</p>
│ │ │ │ -<p>Web seeds on global IPs (i.e. not local network) may not redirect
│ │ │ │ -to a local network address</p>
│ │ │ │ -<a name="allow_idna"></a><table border="1" class="docutils">
│ │ │ │ +<a name="suggest_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+suggest_mode_t&labels=documentation&body=Documentation+under+heading+%22enum+suggest_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-suggest-mode-t">
│ │ │ │ +<h2>enum suggest_mode_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="44%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="33%" />
│ │ │ │ +<col width="52%" />
│ │ │ │ +<col width="17%" />
│ │ │ │ +<col width="31%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>allow_idna</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>false</td>
│ │ │ │ +<tr><td>no_piece_suggestions</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>suggest_read_cache</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when disabled, any tracker or web seed with an IDNA hostname
│ │ │ │ -(internationalized domain name) is ignored. This is a security
│ │ │ │ -precaution to avoid various unicode encoding attacks that might
│ │ │ │ -happen at the application level.</p>
│ │ │ │ -<a name="enable_set_file_valid_data"></a><table border="1" class="docutils">
│ │ │ │ +<a name="choking_algorithm_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+choking_algorithm_t&labels=documentation&body=Documentation+under+heading+%22enum+choking_algorithm_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-choking-algorithm-t">
│ │ │ │ +<h2>enum choking_algorithm_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ +<col width="28%" />
│ │ │ │ +<col width="7%" />
│ │ │ │  <col width="65%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="21%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>enable_set_file_valid_data</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>false</td>
│ │ │ │ +<tr><td>fixed_slots_choker</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>This is the traditional choker with a fixed number of unchoke
│ │ │ │ +slots (as specified by <a class="reference external" href="reference-Settings.html#unchoke_slots_limit">settings_pack::unchoke_slots_limit</a>).</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>rate_based_choker</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td><p class="first">This opens up unchoke slots based on the upload rate achieved to
│ │ │ │ +peers. The more slots that are opened, the marginal upload rate
│ │ │ │ +required to open up another slot increases. Configure the initial
│ │ │ │ +threshold with <a class="reference external" href="reference-Settings.html#rate_choker_initial_threshold">settings_pack::rate_choker_initial_threshold</a>.</p>
│ │ │ │ +<p class="last">For more information, see <a class="reference external" href="manual-ref.html#rate-based-choking">rate based choking</a>.</p>
│ │ │ │ +</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>deprecated_bittyrant_choker</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when set to true, enables the attempt to use SetFileValidData()
│ │ │ │ -to pre-allocate disk space. This system call will only work when
│ │ │ │ -running with Administrator privileges on Windows, and so this
│ │ │ │ -setting is only relevant in that scenario. Using
│ │ │ │ -SetFileValidData() poses a security risk, as it may reveal
│ │ │ │ -previously deleted information from the disk.</p>
│ │ │ │ -<a name="socks5_udp_send_local_ep"></a><table border="1" class="docutils">
│ │ │ │ +<a name="seed_choking_algorithm_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+seed_choking_algorithm_t&labels=documentation&body=Documentation+under+heading+%22enum+seed_choking_algorithm_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-seed-choking-algorithm-t">
│ │ │ │ +<h2>enum seed_choking_algorithm_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="8%" />
│ │ │ │ +<col width="75%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>socks5_udp_send_local_ep</td>
│ │ │ │ -<td>bool</td>
│ │ │ │ -<td>false</td>
│ │ │ │ +<tr><td>round_robin</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>which round-robins the peers that are unchoked
│ │ │ │ +when seeding. This distributes the upload bandwidth uniformly and
│ │ │ │ +fairly. It minimizes the ability for a peer to download everything
│ │ │ │ +without redistributing it.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>fastest_upload</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>unchokes the peers we can send to the fastest. This might be a
│ │ │ │ +bit more reliable in utilizing all available capacity.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>anti_leech</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>prioritizes peers who have just started or are
│ │ │ │ +just about to finish the download. The intention is to force
│ │ │ │ +peers in the middle of the download to trade with each other.
│ │ │ │ +This does not just take into account the pieces a peer is
│ │ │ │ +reporting having downloaded, but also the pieces we have sent
│ │ │ │ +to it.</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>When using a SOCKS5 proxy, UDP traffic is routed through the
│ │ │ │ -proxy by sending a UDP ASSOCIATE command. If this option is true,
│ │ │ │ -the UDP ASSOCIATE command will include the IP address and
│ │ │ │ -listen port to the local UDP socket. This indicates to the proxy
│ │ │ │ -which source endpoint to expect our packets from. The benefit is
│ │ │ │ -that incoming packets can be forwarded correctly, before any
│ │ │ │ -outgoing packets are sent. The risk is that if there's a NAT
│ │ │ │ -between the client and the proxy, the IP address specified in the
│ │ │ │ -protocol may not be valid from the proxy's point of view.</p>
│ │ │ │ -<a name="tracker_completion_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<a name="io_buffer_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+io_buffer_mode_t&labels=documentation&body=Documentation+under+heading+%22enum+io_buffer_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-io-buffer-mode-t">
│ │ │ │ +<h2>enum io_buffer_mode_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="65%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="21%" />
│ │ │ │ +<col width="70%" />
│ │ │ │ +<col width="10%" />
│ │ │ │ +<col width="19%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>tracker_completion_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>30</td>
│ │ │ │ +<tr><td>enable_os_cache</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>deprecated_disable_os_cache_for_aligned_files</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>disable_os_cache</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>write_through</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">tracker_completion_timeout</tt> is the number of seconds the tracker
│ │ │ │ -connection will wait from when it sent the request until it
│ │ │ │ -considers the tracker to have timed-out.</p>
│ │ │ │ -<a name="tracker_receive_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<a name="bandwidth_mixed_algo_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+bandwidth_mixed_algo_t&labels=documentation&body=Documentation+under+heading+%22enum+bandwidth_mixed_algo_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-bandwidth-mixed-algo-t">
│ │ │ │ +<h2>enum bandwidth_mixed_algo_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +<col width="8%" />
│ │ │ │ +<col width="70%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>tracker_receive_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>10</td>
│ │ │ │ +<tr><td>prefer_tcp</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>disables the mixed mode bandwidth balancing</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>peer_proportional</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>does not throttle uTP, throttles TCP to the same proportion
│ │ │ │ +of throughput as there are TCP connections</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">tracker_receive_timeout</tt> is the number of seconds to wait to
│ │ │ │ -receive any data from the tracker. If no data is received for this
│ │ │ │ -number of seconds, the tracker will be considered as having timed
│ │ │ │ -out. If a tracker is down, this is the kind of timeout that will
│ │ │ │ -occur.</p>
│ │ │ │ -<a name="stop_tracker_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<a name="enc_policy"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+enc_policy&labels=documentation&body=Documentation+under+heading+%22enum+enc_policy%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-enc-policy">
│ │ │ │ +<h2>enum enc_policy</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="59%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ +<col width="15%" />
│ │ │ │ +<col width="8%" />
│ │ │ │ +<col width="78%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>stop_tracker_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>5</td>
│ │ │ │ +<tr><td>pe_forced</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>Only encrypted connections are allowed. Incoming connections that
│ │ │ │ +are not encrypted are closed and if the encrypted outgoing
│ │ │ │ +connection fails, a non-encrypted retry will not be made.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pe_enabled</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>encrypted connections are enabled, but non-encrypted connections
│ │ │ │ +are allowed. An incoming non-encrypted connection will be accepted,
│ │ │ │ +and if an outgoing encrypted connection fails, a non- encrypted
│ │ │ │ +connection will be tried.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pe_disabled</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>only non-encrypted connections are allowed.</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">stop_tracker_timeout</tt> is the number of seconds to wait when
│ │ │ │ -sending a stopped message before considering a tracker to have
│ │ │ │ -timed out. This is usually shorter, to make the client quit faster.
│ │ │ │ -If the value is set to 0, the connections to trackers with the
│ │ │ │ -stopped event are suppressed.</p>
│ │ │ │ -<a name="tracker_maximum_response_length"></a><table border="1" class="docutils">
│ │ │ │ +<a name="enc_level"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+enc_level&labels=documentation&body=Documentation+under+heading+%22enum+enc_level%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-enc-level">
│ │ │ │ +<h2>enum enc_level</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="66%" />
│ │ │ │ -<col width="12%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ +<col width="26%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="60%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>tracker_maximum_response_length</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>1024*1024</td>
│ │ │ │ +<tr><td>pe_plaintext</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>use only plain text encryption</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pe_rc4</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>use only RC4 encryption</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pe_both</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>allow both</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>this is the maximum number of bytes in a tracker response. If a
│ │ │ │ -response size passes this number of bytes it will be rejected and
│ │ │ │ -the connection will be closed. On gzipped responses this size is
│ │ │ │ -measured on the uncompressed data. So, if you get 20 bytes of gzip
│ │ │ │ -response that'll expand to 2 megabytes, it will be interrupted
│ │ │ │ -before the entire response has been uncompressed (assuming the
│ │ │ │ -limit is lower than 2 MiB).</p>
│ │ │ │ -<a name="piece_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<a name="proxy_type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+proxy_type_t&labels=documentation&body=Documentation+under+heading+%22enum+proxy_type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-proxy-type-t">
│ │ │ │ +<h2>enum proxy_type_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="50%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -<col width="30%" />
│ │ │ │ +<col width="11%" />
│ │ │ │ +<col width="7%" />
│ │ │ │ +<col width="81%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>piece_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>20</td>
│ │ │ │ +<tr><td>none</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>No proxy server is used and all other fields are ignored.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>socks4</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>The server is assumed to be a <a class="reference external" href="http://www.ufasoft.com/doc/socks4_protocol.htm">SOCKS4 server</a> that requires a
│ │ │ │ +username.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>socks5</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>The server is assumed to be a SOCKS5 server (<a class="reference external" href="http://www.faqs.org/rfcs/rfc1928.html">RFC 1928</a>) that does
│ │ │ │ +not require any authentication. The username and password are
│ │ │ │ +ignored.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>socks5_pw</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>The server is assumed to be a SOCKS5 server that supports plain
│ │ │ │ +text username and password authentication (<a class="reference external" href="http://www.faqs.org/rfcs/rfc1929.html">RFC 1929</a>). The
│ │ │ │ +username and password specified may be sent to the proxy if it
│ │ │ │ +requires.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>http</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>The server is assumed to be an HTTP proxy. If the transport used
│ │ │ │ +for the connection is non-HTTP, the server is assumed to support
│ │ │ │ +the <a class="reference external" href="http://tools.ietf.org/html/draft-luotonen-web-proxy-tunneling-01">CONNECT</a> method. i.e. for web seeds and HTTP trackers, a plain
│ │ │ │ +proxy will suffice. The proxy is assumed to not require
│ │ │ │ +authorization. The username and password will not be used.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>http_pw</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>The server is assumed to be an HTTP proxy that requires user
│ │ │ │ +authorization. The username and password will be sent to the proxy.</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>the number of seconds from a request is sent until it times out if
│ │ │ │ -no piece response is returned.</p>
│ │ │ │ -<a name="request_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<a name="setting_by_name()"></a>
│ │ │ │ +<a name="name_for_setting()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:setting_by_name%28%29+name_for_setting%28%29&labels=documentation&body=Documentation+under+heading+%22setting_by_name%28%29+name_for_setting%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="setting-by-name-name-for-setting">
│ │ │ │ +<h1>setting_by_name() name_for_setting()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>name_for_setting</strong> (int s);
│ │ │ │ +int <strong>setting_by_name</strong> (string_view name);
│ │ │ │ +</pre>
│ │ │ │ +<p>converts a setting integer (from the enums string_types, int_types or
│ │ │ │ +bool_types) to a string, and vice versa.</p>
│ │ │ │ +<a name="default_settings()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:default_settings%28%29&labels=documentation&body=Documentation+under+heading+%22default_settings%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="default-settings">
│ │ │ │ +<h1>default_settings()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +settings_pack <strong>default_settings</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> with every setting set to its default value</p>
│ │ │ │ +<a name="high_performance_seed()"></a>
│ │ │ │ +<a name="min_memory_usage()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:high_performance_seed%28%29+min_memory_usage%28%29&labels=documentation&body=Documentation+under+heading+%22high_performance_seed%28%29+min_memory_usage%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="high-performance-seed-min-memory-usage">
│ │ │ │ +<h1>high_performance_seed() min_memory_usage()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session.hpp">libtorrent/session.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +settings_pack <strong>min_memory_usage</strong> ();
│ │ │ │ +settings_pack <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 intended 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>
│ │ │ │ +<a name="generate_fingerprint()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:generate_fingerprint%28%29&labels=documentation&body=Documentation+under+heading+%22generate_fingerprint%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="generate-fingerprint">
│ │ │ │ +<h1>generate_fingerprint()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/fingerprint.hpp">libtorrent/fingerprint.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::string <strong>generate_fingerprint</strong> (std::string name
│ │ │ │ +   , int major, int minor = 0, int revision = 0, int tag = 0);
│ │ │ │ +</pre>
│ │ │ │ +<p>This is a utility function to produce a client ID fingerprint formatted to
│ │ │ │ +the most common convention. The fingerprint can be set via the
│ │ │ │ +<tt class="docutils literal">peer_fingerprint</tt> setting, in <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>.</p>
│ │ │ │ +<p>The name string should contain exactly two characters. These are the
│ │ │ │ +characters unique to your client, used to identify it. Make sure not to
│ │ │ │ +clash with anybody else. Here are some taken id's:</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="53%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="28%" />
│ │ │ │ +<col width="30%" />
│ │ │ │ +<col width="70%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><th class="head">id chars</th>
│ │ │ │ +<th class="head">client</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>request_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>60</td>
│ │ │ │ +<tr><td>LT</td>
│ │ │ │ +<td>libtorrent (default)</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>UT</td>
│ │ │ │ +<td>uTorrent</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>UM</td>
│ │ │ │ +<td>uTorrent Mac</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>qB</td>
│ │ │ │ +<td>qBittorrent</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>BP</td>
│ │ │ │ +<td>BitTorrent Pro</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>BT</td>
│ │ │ │ +<td>BitTorrent</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>DE</td>
│ │ │ │ +<td>Deluge</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>AZ</td>
│ │ │ │ +<td>Azureus</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>TL</td>
│ │ │ │ +<td>Tribler</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>the number of seconds one block (16 kiB) is expected to be received
│ │ │ │ -within. If it's not, the block is requested from a different peer</p>
│ │ │ │ -<a name="request_queue_time"></a><table border="1" class="docutils">
│ │ │ │ +<p>There's an informal directory of client id's <a class="reference external" href="http://wiki.theory.org/BitTorrentSpecification#peer_id">here</a>.</p>
│ │ │ │ +<p>The <tt class="docutils literal">major</tt>, <tt class="docutils literal">minor</tt>, <tt class="docutils literal">revision</tt> and <tt class="docutils literal">tag</tt> parameters are used to
│ │ │ │ +identify the version of your client.</p>
│ │ │ │ +<p>This section describes the functions and classes that are used
│ │ │ │ +to create torrent files. It is a layered API with low level classes
│ │ │ │ +and higher level convenience functions. A torrent is created in 4
│ │ │ │ +steps:</p>
│ │ │ │ +<ol class="arabic simple">
│ │ │ │ +<li>first the files that will be part of the torrent are determined.</li>
│ │ │ │ +<li>the torrent properties are set, such as tracker url, web seeds,
│ │ │ │ +DHT nodes etc.</li>
│ │ │ │ +<li>Read through all the files in the torrent, SHA-1 all the data
│ │ │ │ +and set the piece hashes.</li>
│ │ │ │ +<li>The torrent is bencoded into a file or buffer.</li>
│ │ │ │ +</ol>
│ │ │ │ +<p>If there are a lot of files and or deep directory hierarchies to
│ │ │ │ +traverse, step one can be time consuming.</p>
│ │ │ │ +<p>Typically step 3 is by far the most time consuming step, since it
│ │ │ │ +requires to read all the bytes from all the files in the torrent.</p>
│ │ │ │ +<p>All of these classes and functions are declared by including
│ │ │ │ +<tt class="docutils literal">libtorrent/create_torrent.hpp</tt>.</p>
│ │ │ │ +<p>example:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="name">file_storage</span><span class="whitespace"> </span><span class="name">fs</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="comment single">// recursively adds files in directories
│ │ │ │ +</span><span class="name">add_files</span><span class="punctuation">(</span><span class="name">fs</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="literal string">&quot;./my_torrent&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="name">create_torrent</span><span class="whitespace"> </span><span class="name function">t</span><span class="punctuation">(</span><span class="name">fs</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="name">t</span><span class="punctuation">.</span><span class="name">add_tracker</span><span class="punctuation">(</span><span class="literal string">&quot;http://my.tracker.com/announce&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="name">t</span><span class="punctuation">.</span><span class="name">set_creator</span><span class="punctuation">(</span><span class="literal string">&quot;libtorrent example&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="comment single">// reads the files and calculates the hashes
│ │ │ │ +</span><span class="name">set_piece_hashes</span><span class="punctuation">(</span><span class="name">t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="literal string">&quot;.&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="name">ofstream</span><span class="whitespace"> </span><span class="name">out</span><span class="punctuation">(</span><span class="literal string">&quot;my_torrent.torrent&quot;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">ios_base</span><span class="operator">::</span><span class="name">binary</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">buf</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">t</span><span class="punctuation">.</span><span class="name">generate_buf</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +</span><span class="name">out</span><span class="punctuation">.</span><span class="name">write</span><span class="punctuation">(</span><span class="name">buf</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="name">buf</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">());</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="comment single">// alternatively, generate an entry and encode it directly to an ostream
│ │ │ │ +// iterator
│ │ │ │ +</span><span class="name">bencode</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">ostream_iterator</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">out</span><span class="punctuation">),</span><span class="whitespace"> </span><span class="name">t</span><span class="punctuation">.</span><span class="name">generate</span><span class="punctuation">());</span>
│ │ │ │ +</pre>
│ │ │ │ +<a name="create_torrent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+create_torrent&labels=documentation&body=Documentation+under+heading+%22class+create_torrent%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="create-torrent">
│ │ │ │ +<h1>create_torrent</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/create_torrent.hpp">libtorrent/create_torrent.hpp</a>&quot;</p>
│ │ │ │ +<p>This class holds state for creating a torrent. After having added
│ │ │ │ +all information to it, call <a class="reference external" href="reference-Create_Torrents.html#generate()">create_torrent::generate()</a> to generate
│ │ │ │ +the torrent. The <a class="reference external" href="reference-Bencoding.html#entry">entry</a> that's returned can then be bencoded into a
│ │ │ │ +.torrent file using <a class="reference external" href="reference-Bencoding.html#bencode()">bencode()</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct create_torrent
│ │ │ │ +{
│ │ │ │ +   explicit <strong>create_torrent</strong> (file_storage&amp; fs, int piece_size = 0
│ │ │ │ +      , create_flags_t flags = {});
│ │ │ │ +   explicit <strong>create_torrent</strong> (torrent_info const&amp; ti);
│ │ │ │ +   entry <strong>generate</strong> () const;
│ │ │ │ +   std::vector&lt;char&gt; <strong>generate_buf</strong> () const;
│ │ │ │ +   file_storage const&amp; <strong>files</strong> () const;
│ │ │ │ +   void <strong>set_comment</strong> (char const* str);
│ │ │ │ +   void <strong>set_creator</strong> (char const* str);
│ │ │ │ +   void <strong>set_creation_date</strong> (std::time_t timestamp);
│ │ │ │ +   void <strong>set_hash</strong> (piece_index_t index, sha1_hash const&amp; h);
│ │ │ │ +   void <strong>set_hash2</strong> (file_index_t file, piece_index_t::diff_type piece, sha256_hash const&amp; h);
│ │ │ │ +   void <strong>add_http_seed</strong> (string_view url);
│ │ │ │ +   void <strong>add_url_seed</strong> (string_view url);
│ │ │ │ +   void <strong>add_node</strong> (std::pair&lt;std::string, int&gt; node);
│ │ │ │ +   void <strong>add_tracker</strong> (string_view url, int tier = 0);
│ │ │ │ +   void <strong>set_root_cert</strong> (string_view cert);
│ │ │ │ +   bool <strong>priv</strong> () const;
│ │ │ │ +   void <strong>set_priv</strong> (bool p);
│ │ │ │ +   bool <strong>is_v2_only</strong> () const;
│ │ │ │ +   bool <strong>is_v1_only</strong> () const;
│ │ │ │ +   int <strong>num_pieces</strong> () const;
│ │ │ │ +   piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ +   index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │ +   file_index_t <strong>end_file</strong> () const;
│ │ │ │ +   index_range&lt;file_index_t&gt; <strong>file_range</strong> () const noexcept;
│ │ │ │ +   index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t f);
│ │ │ │ +   std::int64_t <strong>total_size</strong> () const;
│ │ │ │ +   int <strong>piece_size</strong> (piece_index_t i) const;
│ │ │ │ +   int <strong>piece_length</strong> () const;
│ │ │ │ +   void <strong>add_collection</strong> (string_view c);
│ │ │ │ +   void <strong>add_similar_torrent</strong> (sha1_hash ih);
│ │ │ │ +
│ │ │ │ +   static constexpr create_flags_t <strong>modification_time</strong>  = 2_bit;
│ │ │ │ +   static constexpr create_flags_t <strong>symlinks</strong>  = 3_bit;
│ │ │ │ +   static constexpr create_flags_t <strong>v2_only</strong>  = 5_bit;
│ │ │ │ +   static constexpr create_flags_t <strong>v1_only</strong>  = 6_bit;
│ │ │ │ +   static constexpr create_flags_t <strong>canonical_files</strong>  = 7_bit;
│ │ │ │ +   static constexpr create_flags_t <strong>no_attributes</strong>  = 8_bit;
│ │ │ │ +   static constexpr create_flags_t <strong>canonical_files_no_tail_padding</strong>  = 9_bit;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="create_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bcreate_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bcreate_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="create-torrent-1">
│ │ │ │ +<h2>create_torrent()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +explicit <strong>create_torrent</strong> (file_storage&amp; fs, int piece_size = 0
│ │ │ │ +      , create_flags_t flags = {});
│ │ │ │ +explicit <strong>create_torrent</strong> (torrent_info const&amp; ti);
│ │ │ │ +</pre>
│ │ │ │ +<p>The <tt class="docutils literal">piece_size</tt> is the size of each piece in bytes. It must be a
│ │ │ │ +power of 2 and a minimum of 16 kiB. If a piece size of 0 is
│ │ │ │ +specified, a piece_size will be set automatically.
│ │ │ │ +Piece sizes greater than 128 MiB are considered unreasonable and will
│ │ │ │ +be rejected (with an lt::system_error exception).</p>
│ │ │ │ +<p>The <tt class="docutils literal">flags</tt> arguments specifies options for the torrent creation. It can
│ │ │ │ +be any combination of the flags defined by create_flags_t.</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> (<tt class="docutils literal">fs</tt>) parameter defines the files, sizes and
│ │ │ │ +their properties for the torrent to be created. Set this up first,
│ │ │ │ +before passing it to the <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> constructor.</p>
│ │ │ │ +<p>The overload that takes a <tt class="docutils literal">torrent_info</tt> object will make a verbatim
│ │ │ │ +copy of its info dictionary (to preserve the info-hash). The copy of
│ │ │ │ +the info dictionary will be used by <a class="reference external" href="reference-Create_Torrents.html#generate()">create_torrent::generate()</a>. This means
│ │ │ │ +that none of the member functions of <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> that affects
│ │ │ │ +the content of the info dictionary (such as <a class="reference external" href="reference-Create_Torrents.html#set_hash()">set_hash()</a>), will
│ │ │ │ +have any affect. Instead of using this overload, consider using
│ │ │ │ +<a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a> instead.</p>
│ │ │ │ +<div class="admonition warning">
│ │ │ │ +<p class="first admonition-title">Warning</p>
│ │ │ │ +<p class="last">The <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> and <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> objects must stay alive for the
│ │ │ │ +entire duration of the <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> object.</p>
│ │ │ │ +</div>
│ │ │ │ +<a name="generate()"></a>
│ │ │ │ +<a name="generate_buf()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bgenerate%28%29+generate_buf%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bgenerate%28%29+generate_buf%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="generate-generate-buf">
│ │ │ │ +<h2>generate() generate_buf()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +entry <strong>generate</strong> () const;
│ │ │ │ +std::vector&lt;char&gt; <strong>generate_buf</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function will generate the .torrent file as a bencode tree, or a
│ │ │ │ +bencoded into a buffer.
│ │ │ │ +In order to encode the <a class="reference external" href="reference-Bencoding.html#entry">entry</a> into a flat file, use the <a class="reference external" href="reference-Bencoding.html#bencode()">bencode()</a> function.</p>
│ │ │ │ +<p>The function returning an <a class="reference external" href="reference-Bencoding.html#entry">entry</a> may be useful to add custom entries
│ │ │ │ +to the torrent file before bencoding it and saving it to disk.</p>
│ │ │ │ +<p>Whether the resulting torrent object is v1, v2 or hybrid depends on
│ │ │ │ +whether any of the v1_only or v2_only flags were set on the
│ │ │ │ +constructor. If neither were set, the resulting torrent depends on
│ │ │ │ +which hashes were set. If both v1 and v2 hashes were set, a hybrid
│ │ │ │ +torrent is created.</p>
│ │ │ │ +<p>Any failure will cause this function to throw system_error, with an
│ │ │ │ +appropriate error message. These are the reasons this call may throw:</p>
│ │ │ │ +<ul class="simple">
│ │ │ │ +<li>the file storage has 0 files</li>
│ │ │ │ +<li>the total size of the file storage is 0 bytes (i.e. it only has
│ │ │ │ +empty files)</li>
│ │ │ │ +<li>not all v1 hashes (<a class="reference external" href="reference-Create_Torrents.html#set_hash()">set_hash()</a>) and not all v2 hashes (<a class="reference external" href="reference-Create_Torrents.html#set_hash2()">set_hash2()</a>)
│ │ │ │ +were set</li>
│ │ │ │ +<li>for v2 torrents, you may not have a directory with the same name as
│ │ │ │ +a file. If that's encountered in the file storage, <a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>
│ │ │ │ +fails.</li>
│ │ │ │ +</ul>
│ │ │ │ +<a name="files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bfiles%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bfiles%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="files">
│ │ │ │ +<h2>files()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +file_storage const&amp; <strong>files</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns an immutable reference to the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> used to create
│ │ │ │ +the torrent from.</p>
│ │ │ │ +<a name="set_comment()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_comment%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_comment%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-comment">
│ │ │ │ +<h2>set_comment()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_comment</strong> (char const* str);
│ │ │ │ +</pre>
│ │ │ │ +<p>Sets the comment for the torrent. The string <tt class="docutils literal">str</tt> should be utf-8 encoded.
│ │ │ │ +The comment in a torrent file is optional.</p>
│ │ │ │ +<a name="set_creator()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_creator%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_creator%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-creator">
│ │ │ │ +<h2>set_creator()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_creator</strong> (char const* str);
│ │ │ │ +</pre>
│ │ │ │ +<p>Sets the creator of the torrent. The string <tt class="docutils literal">str</tt> should be utf-8 encoded.
│ │ │ │ +This is optional.</p>
│ │ │ │ +<a name="set_creation_date()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_creation_date%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_creation_date%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-creation-date">
│ │ │ │ +<h2>set_creation_date()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_creation_date</strong> (std::time_t timestamp);
│ │ │ │ +</pre>
│ │ │ │ +<p>sets the &quot;creation time&quot; field. Defaults to the system clock at the
│ │ │ │ +time of construction of the <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> object. The timestamp is
│ │ │ │ +specified in seconds, posix time. If the creation date is set to 0,
│ │ │ │ +the &quot;creation date&quot; field will be omitted from the generated torrent.</p>
│ │ │ │ +<a name="set_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-hash">
│ │ │ │ +<h2>set_hash()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_hash</strong> (piece_index_t index, sha1_hash const&amp; h);
│ │ │ │ +</pre>
│ │ │ │ +<p>This sets the SHA-1 hash for the specified piece (<tt class="docutils literal">index</tt>). You are required
│ │ │ │ +to set the hash for every piece in the torrent before generating it. If you have
│ │ │ │ +the files on disk, you can use the high level convenience function to do this.
│ │ │ │ +See <a class="reference external" href="reference-Create_Torrents.html#set_piece_hashes()">set_piece_hashes()</a>.
│ │ │ │ +A SHA-1 hash of all zeros is internally used to indicate a hash that
│ │ │ │ +has not been set. Setting such hash will not be considered set when
│ │ │ │ +calling <a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>.
│ │ │ │ +This function will throw <tt class="docutils literal"><span class="pre">std::system_error</span></tt> if it is called on an
│ │ │ │ +object constructed with the v2_only flag.</p>
│ │ │ │ +<a name="set_hash2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_hash2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_hash2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-hash2">
│ │ │ │ +<h2>set_hash2()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_hash2</strong> (file_index_t file, piece_index_t::diff_type piece, sha256_hash const&amp; h);
│ │ │ │ +</pre>
│ │ │ │ +<p>sets the bittorrent v2 hash for file <cite>file</cite> of the piece <cite>piece</cite>.
│ │ │ │ +<cite>piece</cite> is relative to the first piece of the file, starting at 0. The
│ │ │ │ +first piece in the file can be computed with
│ │ │ │ +<a class="reference external" href="reference-Storage.html#file_index_at_piece()">file_storage::file_index_at_piece()</a>.
│ │ │ │ +The hash, <cite>h</cite>, is the root of the merkle tree formed by the piece's
│ │ │ │ +16 kiB blocks. Note that piece sizes must be powers-of-2, so all
│ │ │ │ +per-piece merkle trees are complete.
│ │ │ │ +A SHA-256 hash of all zeros is internally used to indicate a hash
│ │ │ │ +that has not been set. Setting such hash will not be considered set
│ │ │ │ +when calling <a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>.
│ │ │ │ +This function will throw <tt class="docutils literal"><span class="pre">std::system_error</span></tt> if it is called on an
│ │ │ │ +object constructed with the v1_only flag.</p>
│ │ │ │ +<a name="add_url_seed()"></a>
│ │ │ │ +<a name="add_http_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_url_seed%28%29+add_http_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_url_seed%28%29+add_http_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-url-seed-add-http-seed">
│ │ │ │ +<h2>add_url_seed() add_http_seed()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_http_seed</strong> (string_view url);
│ │ │ │ +void <strong>add_url_seed</strong> (string_view url);
│ │ │ │ +</pre>
│ │ │ │ +<p>This adds a url seed to the torrent. You can have any number of url seeds. For a
│ │ │ │ +single file torrent, this should be an HTTP url, pointing to a file with identical
│ │ │ │ +content as the file of the torrent. For a multi-file torrent, it should point to
│ │ │ │ +a directory containing a directory with the same name as this torrent, and all the
│ │ │ │ +files of the torrent in it.</p>
│ │ │ │ +<p>The second function, <tt class="docutils literal">add_http_seed()</tt> adds an HTTP seed instead.</p>
│ │ │ │ +<a name="add_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-node">
│ │ │ │ +<h2>add_node()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_node</strong> (std::pair&lt;std::string, int&gt; node);
│ │ │ │ +</pre>
│ │ │ │ +<p>This adds a DHT node to the torrent. This especially useful if you're creating a
│ │ │ │ +tracker less torrent. It can be used by clients to bootstrap their DHT node from.
│ │ │ │ +The node is a hostname and a port number where there is a DHT node running.
│ │ │ │ +You can have any number of DHT nodes in a torrent.</p>
│ │ │ │ +<a name="add_tracker()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_tracker%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_tracker%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-tracker">
│ │ │ │ +<h2>add_tracker()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_tracker</strong> (string_view url, int tier = 0);
│ │ │ │ +</pre>
│ │ │ │ +<p>Adds a tracker to the torrent. This is not strictly required, but most torrents
│ │ │ │ +use a tracker as their main source of peers. The url should be an <a class="reference external" href="http://">http://</a> or udp://
│ │ │ │ +url to a machine running a bittorrent tracker that accepts announces for this torrent's
│ │ │ │ +info-hash. The tier is the fallback priority of the tracker. All trackers with tier 0 are
│ │ │ │ +tried first (in any order). If all fail, trackers with tier 1 are tried. If all of those
│ │ │ │ +fail, trackers with tier 2 are tried, and so on.</p>
│ │ │ │ +<a name="set_root_cert()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_root_cert%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_root_cert%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-root-cert">
│ │ │ │ +<h2>set_root_cert()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_root_cert</strong> (string_view cert);
│ │ │ │ +</pre>
│ │ │ │ +<p>This function sets an X.509 certificate in PEM format to the torrent. This makes the
│ │ │ │ +torrent an <em>SSL torrent</em>. An SSL torrent requires that each peer has a valid certificate
│ │ │ │ +signed by this root certificate. For SSL torrents, all peers are connecting over SSL
│ │ │ │ +connections. For more information, see the section on <a class="reference external" href="manual-ref.html#ssl-torrents">ssl torrents</a>.</p>
│ │ │ │ +<p>The string is not the path to the cert, it's the actual content of the
│ │ │ │ +certificate.</p>
│ │ │ │ +<a name="priv()"></a>
│ │ │ │ +<a name="set_priv()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bpriv%28%29+set_priv%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bpriv%28%29+set_priv%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="priv-set-priv">
│ │ │ │ +<h2>priv() set_priv()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>priv</strong> () const;
│ │ │ │ +void <strong>set_priv</strong> (bool p);
│ │ │ │ +</pre>
│ │ │ │ +<p>Sets and queries the private flag of the torrent.
│ │ │ │ +Torrents with the private flag set ask the client to not use any other
│ │ │ │ +sources than the tracker for peers, and to not use DHT to advertise itself publicly,
│ │ │ │ +only the tracker.</p>
│ │ │ │ +<a name="num_pieces()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bnum_pieces%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bnum_pieces%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="num-pieces">
│ │ │ │ +<h2>num_pieces()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>num_pieces</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the number of pieces in the associated <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object.</p>
│ │ │ │ +<a name="piece_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bpiece_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bpiece_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-range">
│ │ │ │ +<h2>piece_range()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>all piece indices in the torrent to be created</p>
│ │ │ │ +<a name="file_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bfile_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bfile_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-range">
│ │ │ │ +<h2>file_range()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +index_range&lt;file_index_t&gt; <strong>file_range</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>all file indices in the torrent to be created</p>
│ │ │ │ +<a name="file_piece_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bfile_piece_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bfile_piece_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-piece-range">
│ │ │ │ +<h2>file_piece_range()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t f);
│ │ │ │ +</pre>
│ │ │ │ +<p>for v2 and hybrid torrents only, the pieces in the
│ │ │ │ +specified file, specified as delta from the first piece in the file.
│ │ │ │ +i.e. the first index is 0.</p>
│ │ │ │ +<a name="total_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Btotal_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Btotal_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="total-size">
│ │ │ │ +<h2>total_size()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::int64_t <strong>total_size</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>the total number of bytes of all files and pad files</p>
│ │ │ │ +<a name="piece_length()"></a>
│ │ │ │ +<a name="piece_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bpiece_length%28%29+piece_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bpiece_length%28%29+piece_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-length-piece-size">
│ │ │ │ +<h2>piece_length() piece_size()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>piece_size</strong> (piece_index_t i) const;
│ │ │ │ +int <strong>piece_length</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">piece_length()</tt> returns the piece size of all pieces but the
│ │ │ │ +last one. <tt class="docutils literal">piece_size()</tt> returns the size of the specified piece.
│ │ │ │ +these functions are just forwarding to the associated <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │ +<a name="add_collection()"></a>
│ │ │ │ +<a name="add_similar_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_collection%28%29+add_similar_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_collection%28%29+add_similar_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-collection-add-similar-torrent">
│ │ │ │ +<h2>add_collection() add_similar_torrent()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_collection</strong> (string_view c);
│ │ │ │ +void <strong>add_similar_torrent</strong> (sha1_hash ih);
│ │ │ │ +</pre>
│ │ │ │ +<p>Add similar torrents (by info-hash) or collections of similar torrents.
│ │ │ │ +Similar torrents are expected to share some files with this torrent.
│ │ │ │ +Torrents sharing a collection name with this torrent are also expected
│ │ │ │ +to share files with this torrent. A torrent may have more than one
│ │ │ │ +collection and more than one similar torrents. For more information,
│ │ │ │ +see <a class="reference external" href="https://www.bittorrent.org/beps/bep_0038.html">BEP 38</a>.</p>
│ │ │ │ +<a name="modification_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bmodification_time%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bmodification_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>modification_time</dt>
│ │ │ │ +<dd>This will include the file modification time as part of the torrent.
│ │ │ │ +This is not enabled by default, as it might cause problems when you
│ │ │ │ +create a torrent from separate files with the same content, hoping to
│ │ │ │ +yield the same info-hash. If the files have different modification times,
│ │ │ │ +with this option enabled, you would get different info-hashes for the
│ │ │ │ +files.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="symlinks"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bsymlinks%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bsymlinks%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>symlinks</dt>
│ │ │ │ +<dd>If this flag is set, files that are symlinks get a symlink attribute
│ │ │ │ +set on them and their data will not be included in the torrent. This
│ │ │ │ +is useful if you need to reconstruct a file hierarchy which contains
│ │ │ │ +symlinks.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="v2_only"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bv2_only%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bv2_only%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>v2_only</dt>
│ │ │ │ +<dd>Do not generate v1 metadata. The resulting torrent will only be usable by
│ │ │ │ +clients which support v2. This requires setting all v2 hashes, with
│ │ │ │ +<a class="reference external" href="reference-Create_Torrents.html#set_hash2()">set_hash2()</a> before calling <a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>. Setting v1 hashes (with
│ │ │ │ +<a class="reference external" href="reference-Create_Torrents.html#set_hash()">set_hash()</a>) is an error with this flag set.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="v1_only"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bv1_only%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bv1_only%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>v1_only</dt>
│ │ │ │ +<dd>do not generate v2 metadata or enforce v2 alignment and padding rules
│ │ │ │ +this is mainly for tests, not recommended for production use. This
│ │ │ │ +requires setting all v1 hashes, with <a class="reference external" href="reference-Create_Torrents.html#set_hash()">set_hash()</a>, before calling
│ │ │ │ +<a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>. Setting v2 hashes (with <a class="reference external" href="reference-Create_Torrents.html#set_hash2()">set_hash2()</a>) is an error with
│ │ │ │ +this flag set.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="canonical_files"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bcanonical_files%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bcanonical_files%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>canonical_files</dt>
│ │ │ │ +<dd>This flag only affects v1-only torrents, and is only relevant
│ │ │ │ +together with the v1_only_flag. This flag will force the
│ │ │ │ +same file order and padding as a v2 (or hybrid) torrent would have.
│ │ │ │ +It has the effect of ordering files and inserting pad files to align
│ │ │ │ +them with piece boundaries.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="no_attributes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bno_attributes%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bno_attributes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>no_attributes</dt>
│ │ │ │ +<dd>passing this flag to <a class="reference external" href="reference-Create_Torrents.html#add_files()">add_files()</a> will ignore file attributes (such as
│ │ │ │ +executable or hidden) when adding the files to the file storage.
│ │ │ │ +Since not all filesystems and operating systems support all file
│ │ │ │ +attributes the resulting torrent may differ depending on where it's
│ │ │ │ +created. If it's important for torrents to be created consistently
│ │ │ │ +across systems, this flag should be set.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="canonical_files_no_tail_padding"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bcanonical_files_no_tail_padding%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bcanonical_files_no_tail_padding%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>canonical_files_no_tail_padding</dt>
│ │ │ │ +<dd>this flag enforces the file layout to be canonical according to the
│ │ │ │ +bittorrent v2 specification (just like the <tt class="docutils literal">canonical_files</tt> flag)
│ │ │ │ +with the one exception that tail padding is not added to the last
│ │ │ │ +file.
│ │ │ │ +This behavior deviates from the specification but was the way
│ │ │ │ +libtorrent created torrents in version up to and including 2.0.7.
│ │ │ │ +This flag is here for backwards compatibility.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="add_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_files%28%29&labels=documentation&body=Documentation+under+heading+%22add_files%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="add-files">
│ │ │ │ +<h1>add_files()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/create_torrent.hpp">libtorrent/create_torrent.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_files</strong> (file_storage&amp; fs, std::string const&amp; file
│ │ │ │ +   , std::function&lt;bool(std::string)&gt; p, create_flags_t flags = {});
│ │ │ │ +void <strong>add_files</strong> (file_storage&amp; fs, std::string const&amp; file
│ │ │ │ +   , create_flags_t flags = {});
│ │ │ │ +</pre>
│ │ │ │ +<p>Adds the file specified by <tt class="docutils literal">path</tt> to the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object. In case <tt class="docutils literal">path</tt>
│ │ │ │ +refers to a directory, files will be added recursively from the directory.</p>
│ │ │ │ +<p>If specified, the predicate <tt class="docutils literal">p</tt> is called once for every file and directory that
│ │ │ │ +is encountered. Files for which <tt class="docutils literal">p</tt> returns true are added, and directories for
│ │ │ │ +which <tt class="docutils literal">p</tt> returns true are traversed. <tt class="docutils literal">p</tt> must have the following signature:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="keyword type">bool</span><span class="whitespace"> </span><span class="name function">Pred</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">p</span><span class="punctuation">);</span>
│ │ │ │ +</pre>
│ │ │ │ +<p>The path that is passed in to the predicate is the full path of the file or
│ │ │ │ +directory. If no predicate is specified, all files are added, and all directories
│ │ │ │ +are traversed.</p>
│ │ │ │ +<p>The &quot;..&quot; directory is never traversed.</p>
│ │ │ │ +<p>The <tt class="docutils literal">flags</tt> argument should be the same as the flags passed to the <a class="reference internal" href="#create-torrent">create_torrent</a>
│ │ │ │ +constructor.</p>
│ │ │ │ +<a name="set_piece_hashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:set_piece_hashes%28%29&labels=documentation&body=Documentation+under+heading+%22set_piece_hashes%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-piece-hashes">
│ │ │ │ +<h1>set_piece_hashes()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/create_torrent.hpp">libtorrent/create_torrent.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ +   , std::function&lt;void(piece_index_t)&gt; const&amp; f, error_code&amp; ec);
│ │ │ │ +void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ +   , settings_interface const&amp; settings
│ │ │ │ +   , std::function&lt;void(piece_index_t)&gt; const&amp; f, error_code&amp; ec);
│ │ │ │ +inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ +   , settings_interface const&amp; settings
│ │ │ │ +   , std::function&lt;void(piece_index_t)&gt; const&amp; f);
│ │ │ │ +inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ +   , std::function&lt;void(piece_index_t)&gt; const&amp; f);
│ │ │ │ +void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ +   , settings_interface const&amp; settings, disk_io_constructor_type disk_io
│ │ │ │ +   , std::function&lt;void(piece_index_t)&gt; const&amp; f, error_code&amp; ec);
│ │ │ │ +inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p, error_code&amp; ec);
│ │ │ │ +inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p);
│ │ │ │ +</pre>
│ │ │ │ +<p>This function will assume that the files added to the torrent file exists at path
│ │ │ │ +<tt class="docutils literal">p</tt>, read those files and hash the content and set the hashes in the <tt class="docutils literal">create_torrent</tt>
│ │ │ │ +object. The optional function <tt class="docutils literal">f</tt> is called in between every hash that is set. <tt class="docutils literal">f</tt>
│ │ │ │ +must have the following signature:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="keyword type">void</span><span class="whitespace"> </span><span class="name function">Fun</span><span class="punctuation">(</span><span class="name">piece_index_t</span><span class="punctuation">);</span>
│ │ │ │ +</pre>
│ │ │ │ +<p>The overloads taking a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> may be used to configure the
│ │ │ │ +underlying disk access. Such as <tt class="docutils literal"><span class="pre">settings_pack::aio_threads</span></tt>.</p>
│ │ │ │ +<p>The overloads that don't take an <tt class="docutils literal">error_code&amp;</tt> may throw an exception in case of a
│ │ │ │ +file error, the other overloads sets the error code to reflect the error, if any.</p>
│ │ │ │ +<a name="web_seed_entry"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+web_seed_entry&labels=documentation&body=Documentation+under+heading+%22class+web_seed_entry%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="web-seed-entry">
│ │ │ │ +<h1>web_seed_entry</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_info.hpp">libtorrent/torrent_info.hpp</a>&quot;</p>
│ │ │ │ +<p>the <a class="reference external" href="reference-Torrent_Info.html#web_seed_entry">web_seed_entry</a> holds information about a web seed (also known
│ │ │ │ +as URL seed or HTTP seed). It is essentially a URL with some state
│ │ │ │ +associated with it. For more information, see <a class="reference external" href="https://www.bittorrent.org/beps/bep_0017.html">BEP 17</a> and <a class="reference external" href="https://www.bittorrent.org/beps/bep_0019.html">BEP 19</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct web_seed_entry
│ │ │ │ +{
│ │ │ │ +   bool <strong>operator==</strong> (web_seed_entry const&amp; e) const;
│ │ │ │ +   bool <strong>operator&lt;</strong> (web_seed_entry const&amp; e) const;
│ │ │ │ +
│ │ │ │ +   enum type_t
│ │ │ │ +   {
│ │ │ │ +      url_seed,
│ │ │ │ +      http_seed,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   std::string url;
│ │ │ │ +   std::string auth;
│ │ │ │ +   headers_t extra_headers;
│ │ │ │ +   std::uint8_t type;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="operator==()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Boperator%3D%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Boperator%3D%3D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator">
│ │ │ │ +<h2>operator==()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>operator==</strong> (web_seed_entry const&amp; e) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>URL and type comparison</p>
│ │ │ │ +<a name="operator<()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Boperator%3C%28%29%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Boperator%3C%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="operator-1">
│ │ │ │ +<h2>operator&lt;()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>operator&lt;</strong> (web_seed_entry const&amp; e) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>URL and type less-than comparison</p>
│ │ │ │ +<a name="type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+type_t&labels=documentation&body=Documentation+under+heading+%22enum+type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-type-t">
│ │ │ │ +<h2>enum type_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_info.hpp">libtorrent/torrent_info.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ +<col width="35%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +<col width="42%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>request_queue_time</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3</td>
│ │ │ │ +<tr><td>url_seed</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>http_seed</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>the length of the request queue given in the number of seconds it
│ │ │ │ -should take for the other end to send all the pieces. i.e. the
│ │ │ │ -actual number of requests depends on the download rate and this
│ │ │ │ -number.</p>
│ │ │ │ -<a name="max_allowed_in_request_queue"></a><table border="1" class="docutils">
│ │ │ │ +<a name="url"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Burl%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Burl%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>url</dt>
│ │ │ │ +<dd>The URL of the web seed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="auth"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Bauth%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Bauth%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>auth</dt>
│ │ │ │ +<dd>Optional authentication. If this is set, it's passed
│ │ │ │ +in as HTTP basic auth to the web seed. The format is:
│ │ │ │ +username:password.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="extra_headers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Bextra_headers%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Bextra_headers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>extra_headers</dt>
│ │ │ │ +<dd>Any extra HTTP headers that need to be passed to the web seed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:web_seed_entry%3A%3A%5Btype%5D&labels=documentation&body=Documentation+under+heading+%22web_seed_entry%3A%3A%5Btype%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>type</dt>
│ │ │ │ +<dd>The type of web seed (see <a class="reference external" href="reference-Bdecoding.html#type_t">type_t</a>)</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="load_torrent_limits"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+load_torrent_limits&labels=documentation&body=Documentation+under+heading+%22class+load_torrent_limits%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="load-torrent-limits">
│ │ │ │ +<h1>load_torrent_limits</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_info.hpp">libtorrent/torrent_info.hpp</a>&quot;</p>
│ │ │ │ +<p>this object holds configuration options for limits to use when loading
│ │ │ │ +torrents. They are meant to prevent loading potentially malicious torrents
│ │ │ │ +that cause excessive memory allocations.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct load_torrent_limits
│ │ │ │ +{
│ │ │ │ +   int <strong>max_buffer_size</strong>  = 10000000;
│ │ │ │ +   int <strong>max_pieces</strong>  = 0x200000;
│ │ │ │ +   int <strong>max_decode_depth</strong>  = 100;
│ │ │ │ +   int <strong>max_decode_tokens</strong>  = 3000000;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="max_buffer_size"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_limits%3A%3A%5Bmax_buffer_size%5D&labels=documentation&body=Documentation+under+heading+%22load_torrent_limits%3A%3A%5Bmax_buffer_size%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>max_buffer_size</dt>
│ │ │ │ +<dd>the max size of a .torrent file to load into RAM</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="max_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_limits%3A%3A%5Bmax_pieces%5D&labels=documentation&body=Documentation+under+heading+%22load_torrent_limits%3A%3A%5Bmax_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>max_pieces</dt>
│ │ │ │ +<dd>the max number of pieces allowed in the torrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="max_decode_depth"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_limits%3A%3A%5Bmax_decode_depth%5D&labels=documentation&body=Documentation+under+heading+%22load_torrent_limits%3A%3A%5Bmax_decode_depth%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>max_decode_depth</dt>
│ │ │ │ +<dd>the max recursion depth in the bdecoded structure</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="max_decode_tokens"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_limits%3A%3A%5Bmax_decode_tokens%5D&labels=documentation&body=Documentation+under+heading+%22load_torrent_limits%3A%3A%5Bmax_decode_tokens%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>max_decode_tokens</dt>
│ │ │ │ +<dd>the max number of bdecode tokens</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_info&labels=documentation&body=Documentation+under+heading+%22class+torrent_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-info">
│ │ │ │ +<h1>torrent_info</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_info.hpp">libtorrent/torrent_info.hpp</a>&quot;</p>
│ │ │ │ +<p>the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> class holds the information found in a .torrent file.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +class torrent_info
│ │ │ │ +{
│ │ │ │ +   <strong>torrent_info</strong> (char const* buffer, int size, error_code&amp; ec);
│ │ │ │ +   explicit <strong>torrent_info</strong> (span&lt;char const&gt; buffer, from_span_t);
│ │ │ │ +   <strong>torrent_info</strong> (char const* buffer, int size);
│ │ │ │ +   <strong>torrent_info</strong> (std::string const&amp; filename, error_code&amp; ec);
│ │ │ │ +   <strong>torrent_info</strong> (torrent_info const&amp; t);
│ │ │ │ +   explicit <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file);
│ │ │ │ +   explicit <strong>torrent_info</strong> (info_hash_t const&amp; info_hash);
│ │ │ │ +   <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, error_code&amp; ec);
│ │ │ │ +   <strong>torrent_info</strong> (span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg, from_span_t);
│ │ │ │ +   explicit <strong>torrent_info</strong> (std::string const&amp; filename);
│ │ │ │ +   <strong>torrent_info</strong> (span&lt;char const&gt; buffer, error_code&amp; ec, from_span_t);
│ │ │ │ +   <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg);
│ │ │ │ +   <strong>torrent_info</strong> (std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ +   <strong>~torrent_info</strong> ();
│ │ │ │ +   file_storage const&amp; <strong>files</strong> () const;
│ │ │ │ +   file_storage const&amp; <strong>orig_files</strong> () const;
│ │ │ │ +   void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │ +   void <strong>remap_files</strong> (file_storage const&amp; f);
│ │ │ │ +   void <strong>add_tracker</strong> (std::string const&amp; url, int tier
│ │ │ │ +      , announce_entry::tracker_source source);
│ │ │ │ +   void <strong>clear_trackers</strong> ();
│ │ │ │ +   void <strong>add_tracker</strong> (std::string const&amp; url, int tier = 0);
│ │ │ │ +   std::vector&lt;announce_entry&gt; const&amp; <strong>trackers</strong> () const;
│ │ │ │ +   std::vector&lt;sha1_hash&gt; <strong>similar_torrents</strong> () const;
│ │ │ │ +   std::vector&lt;std::string&gt; <strong>collections</strong> () const;
│ │ │ │ +   void <strong>add_url_seed</strong> (std::string const&amp; url
│ │ │ │ +      , std::string const&amp; ext_auth = std::string()
│ │ │ │ +      , web_seed_entry::headers_t const&amp; ext_headers = web_seed_entry::headers_t());
│ │ │ │ +   std::vector&lt;web_seed_entry&gt; const&amp; <strong>web_seeds</strong> () const;
│ │ │ │ +   void <strong>add_http_seed</strong> (std::string const&amp; url
│ │ │ │ +      , std::string const&amp; extern_auth = std::string()
│ │ │ │ +      , web_seed_entry::headers_t const&amp; extra_headers = web_seed_entry::headers_t());
│ │ │ │ +   void <strong>set_web_seeds</strong> (std::vector&lt;web_seed_entry&gt; seeds);
│ │ │ │ +   std::int64_t <strong>total_size</strong> () const;
│ │ │ │ +   int <strong>num_pieces</strong> () const;
│ │ │ │ +   int <strong>piece_length</strong> () const;
│ │ │ │ +   int <strong>blocks_per_piece</strong> () const;
│ │ │ │ +   piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ +   index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const;
│ │ │ │ +   piece_index_t <strong>last_piece</strong> () const;
│ │ │ │ +   info_hash_t const&amp; <strong>info_hashes</strong> () const;
│ │ │ │ +   sha1_hash <strong>info_hash</strong> () const noexcept;
│ │ │ │ +   bool <strong>v1</strong> () const;
│ │ │ │ +   bool <strong>v2</strong> () const;
│ │ │ │ +   int <strong>num_files</strong> () const;
│ │ │ │ +   std::vector&lt;file_slice&gt; <strong>map_block</strong> (piece_index_t const piece
│ │ │ │ +      , std::int64_t offset, int size) const;
│ │ │ │ +   peer_request <strong>map_file</strong> (file_index_t const file, std::int64_t offset, int size) const;
│ │ │ │ +   string_view <strong>ssl_cert</strong> () const;
│ │ │ │ +   bool <strong>is_valid</strong> () const;
│ │ │ │ +   bool <strong>priv</strong> () const;
│ │ │ │ +   bool <strong>is_i2p</strong> () const;
│ │ │ │ +   int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │ +   char const* <strong>hash_for_piece_ptr</strong> (piece_index_t const index) const;
│ │ │ │ +   sha1_hash <strong>hash_for_piece</strong> (piece_index_t index) const;
│ │ │ │ +   bool <strong>is_loaded</strong> () const;
│ │ │ │ +   const std::string&amp; <strong>name</strong> () const;
│ │ │ │ +   std::time_t <strong>creation_date</strong> () const;
│ │ │ │ +   const std::string&amp; <strong>creator</strong> () const;
│ │ │ │ +   const std::string&amp; <strong>comment</strong> () const;
│ │ │ │ +   std::vector&lt;std::pair&lt;std::string, int&gt;&gt; const&amp; <strong>nodes</strong> () const;
│ │ │ │ +   void <strong>add_node</strong> (std::pair&lt;std::string, int&gt; const&amp; node);
│ │ │ │ +   bool <strong>parse_info_section</strong> (bdecode_node const&amp; info, error_code&amp; ec, int max_pieces);
│ │ │ │ +   bdecode_node <strong>info</strong> (char const* key) const;
│ │ │ │ +   span&lt;char const&gt; <strong>info_section</strong> () const;
│ │ │ │ +   span&lt;char const&gt; <strong>piece_layer</strong> (file_index_t) const;
│ │ │ │ +   void <strong>free_piece_layers</strong> ();
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="torrent_info()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Btorrent_info%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Btorrent_info%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="torrent-info-1">
│ │ │ │ +<h2>torrent_info()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>torrent_info</strong> (char const* buffer, int size, error_code&amp; ec);
│ │ │ │ +explicit <strong>torrent_info</strong> (span&lt;char const&gt; buffer, from_span_t);
│ │ │ │ +<strong>torrent_info</strong> (char const* buffer, int size);
│ │ │ │ +<strong>torrent_info</strong> (std::string const&amp; filename, error_code&amp; ec);
│ │ │ │ +<strong>torrent_info</strong> (torrent_info const&amp; t);
│ │ │ │ +explicit <strong>torrent_info</strong> (bdecode_node const&amp; torrent_file);
│ │ │ │ +explicit <strong>torrent_info</strong> (info_hash_t const&amp; info_hash);
│ │ │ │ +<strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, error_code&amp; ec);
│ │ │ │ +<strong>torrent_info</strong> (span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg, from_span_t);
│ │ │ │ +explicit <strong>torrent_info</strong> (std::string const&amp; filename);
│ │ │ │ +<strong>torrent_info</strong> (span&lt;char const&gt; buffer, error_code&amp; ec, from_span_t);
│ │ │ │ +<strong>torrent_info</strong> (bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg);
│ │ │ │ +<strong>torrent_info</strong> (std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ +</pre>
│ │ │ │ +<p>The constructor that takes an info-hash will initialize the info-hash
│ │ │ │ +to the given value, but leave all other fields empty. This is used
│ │ │ │ +internally when downloading torrents without the metadata. The
│ │ │ │ +metadata will be created by libtorrent as soon as it has been
│ │ │ │ +downloaded from the swarm.</p>
│ │ │ │ +<p>The constructor that takes a <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> will create a <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>
│ │ │ │ +object from the information found in the given torrent_file. The
│ │ │ │ +<a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> represents a tree node in an bencoded file. To load an
│ │ │ │ +ordinary .torrent file into a <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>, use <a class="reference external" href="reference-Bdecoding.html#bdecode()">bdecode()</a>.</p>
│ │ │ │ +<p>The version that takes a buffer pointer and a size will decode it as a
│ │ │ │ +.torrent file and initialize the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object for you.</p>
│ │ │ │ +<p>The version that takes a filename will simply load the torrent file
│ │ │ │ +and decode it inside the constructor, for convenience. This might not
│ │ │ │ +be the most suitable for applications that want to be able to report
│ │ │ │ +detailed errors on what might go wrong.</p>
│ │ │ │ +<p>There is an upper limit on the size of the torrent file that will be
│ │ │ │ +loaded by the overload taking a filename. If it's important that even
│ │ │ │ +very large torrent files are loaded, use one of the other overloads.</p>
│ │ │ │ +<p>The overloads that takes an <tt class="docutils literal">error_code const&amp;</tt> never throws if an
│ │ │ │ +error occur, they will simply set the error code to describe what went
│ │ │ │ +wrong and not fully initialize the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object. The overloads
│ │ │ │ +that do not take the extra error_code parameter will always throw if
│ │ │ │ +an error occurs. These overloads are not available when building
│ │ │ │ +without exception support.</p>
│ │ │ │ +<p>The overload that takes a <tt class="docutils literal">span</tt> also needs an extra parameter of
│ │ │ │ +type <tt class="docutils literal">from_span_t</tt> to disambiguate the <tt class="docutils literal"><span class="pre">std::string</span></tt> overload for
│ │ │ │ +string literals. There is an object in the libtorrent namespace of this
│ │ │ │ +type called <tt class="docutils literal">from_span</tt>.</p>
│ │ │ │ +<a name="~torrent_info()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5B~torrent_info%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5B~torrent_info%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-info-2">
│ │ │ │ +<h2>~torrent_info()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>~torrent_info</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>frees all storage associated with this <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object</p>
│ │ │ │ +<a name="files()"></a>
│ │ │ │ +<a name="orig_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bfiles%28%29+orig_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bfiles%28%29+orig_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="files-orig-files">
│ │ │ │ +<h2>files() orig_files()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +file_storage const&amp; <strong>files</strong> () const;
│ │ │ │ +file_storage const&amp; <strong>orig_files</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>The <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object contains the information on how to map the
│ │ │ │ +pieces to files. It is separated from the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object because
│ │ │ │ +when creating torrents a storage object needs to be created without
│ │ │ │ +having a torrent file. When renaming files in a storage, the storage
│ │ │ │ +needs to make its own copy of the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> in order to make its
│ │ │ │ +mapping differ from the one in the torrent file.</p>
│ │ │ │ +<p><tt class="docutils literal">orig_files()</tt> returns the original (unmodified) file storage for
│ │ │ │ +this torrent. This is used by the web server connection, which needs
│ │ │ │ +to request files with the original names. Filename may be changed using
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_info::rename_file()</span></tt>.</p>
│ │ │ │ +<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><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Brename_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Brename_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="rename-file">
│ │ │ │ +<h2>rename_file()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │ +</pre>
│ │ │ │ +<p>Renames the file with the specified index to the new name. The new
│ │ │ │ +filename is reflected by the <tt class="docutils literal">file_storage</tt> returned by <tt class="docutils literal">files()</tt>
│ │ │ │ +but not by the one returned by <tt class="docutils literal">orig_files()</tt>.</p>
│ │ │ │ +<p>If you want to rename the base name of the torrent (for a multi file
│ │ │ │ +torrent), you can copy the <tt class="docutils literal">file_storage</tt> (see <a class="reference external" href="reference-Torrent_Info.html#files()">files()</a> and
│ │ │ │ +<a class="reference external" href="reference-Torrent_Info.html#orig_files()">orig_files()</a> ), change the name, and then use <a class="reference internal" href="#remap-files">remap_files()</a>.</p>
│ │ │ │ +<p>The <tt class="docutils literal">new_filename</tt> can both be a relative path, in which case the
│ │ │ │ +file name is relative to the <tt class="docutils literal">save_path</tt> of the torrent. If the
│ │ │ │ +<tt class="docutils literal">new_filename</tt> is an absolute path (i.e. <tt class="docutils literal">is_complete(new_filename)
│ │ │ │ +== true</tt>), then the file is detached from the <tt class="docutils literal">save_path</tt> of the
│ │ │ │ +torrent. In this case the file is not moved when <a class="reference external" href="reference-Torrent_Handle.html#move_storage()">move_storage()</a> is
│ │ │ │ +invoked.</p>
│ │ │ │ +<a name="remap_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bremap_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bremap_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="remap-files">
│ │ │ │ +<h2>remap_files()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>remap_files</strong> (file_storage const&amp; f);
│ │ │ │ +</pre>
│ │ │ │ +<div class="admonition warning">
│ │ │ │ +<p class="first admonition-title">Warning</p>
│ │ │ │ +<p class="last">Using <cite>remap_files()</cite> is discouraged as it's incompatible with v2
│ │ │ │ +torrents. This is because the piece boundaries and piece hashes in
│ │ │ │ +v2 torrents are intimately tied to the file boundaries. Instead,
│ │ │ │ +just rename individual files, or implement a custom <a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a>
│ │ │ │ +to customize how to store files.</p>
│ │ │ │ +</div>
│ │ │ │ +<p>Remaps the file storage to a new file layout. This can be used to, for
│ │ │ │ +instance, download all data in a torrent to a single file, or to a
│ │ │ │ +number of fixed size sector aligned files, regardless of the number
│ │ │ │ +and sizes of the files in the torrent.</p>
│ │ │ │ +<p>The new specified <tt class="docutils literal">file_storage</tt> must have the exact same size as
│ │ │ │ +the current one.</p>
│ │ │ │ +<a name="clear_trackers()"></a>
│ │ │ │ +<a name="add_tracker()"></a>
│ │ │ │ +<a name="trackers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bclear_trackers%28%29+add_tracker%28%29+trackers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bclear_trackers%28%29+add_tracker%28%29+trackers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="clear-trackers-add-tracker-trackers">
│ │ │ │ +<h2>clear_trackers() add_tracker() trackers()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_tracker</strong> (std::string const&amp; url, int tier
│ │ │ │ +      , announce_entry::tracker_source source);
│ │ │ │ +void <strong>clear_trackers</strong> ();
│ │ │ │ +void <strong>add_tracker</strong> (std::string const&amp; url, int tier = 0);
│ │ │ │ +std::vector&lt;announce_entry&gt; const&amp; <strong>trackers</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">add_tracker()</tt> adds a tracker to the announce-list. The <tt class="docutils literal">tier</tt>
│ │ │ │ +determines the order in which the trackers are to be tried.
│ │ │ │ +The <tt class="docutils literal">trackers()</tt> function will return a sorted vector of
│ │ │ │ +<a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a>. Each announce <a class="reference external" href="reference-Bencoding.html#entry">entry</a> contains a string, which is
│ │ │ │ +the tracker url, and a tier index. The tier index is the high-level
│ │ │ │ +priority. No matter which trackers that works or not, the ones with
│ │ │ │ +lower tier will always be tried before the one with higher tier
│ │ │ │ +number. For more information, see <a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a>.</p>
│ │ │ │ +<p><tt class="docutils literal">trackers()</tt> returns all entries from announce-list.</p>
│ │ │ │ +<p><tt class="docutils literal">clear_trackers()</tt> removes all trackers from announce-list.</p>
│ │ │ │ +<a name="collections()"></a>
│ │ │ │ +<a name="similar_torrents()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bcollections%28%29+similar_torrents%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bcollections%28%29+similar_torrents%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="collections-similar-torrents">
│ │ │ │ +<h2>collections() similar_torrents()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;sha1_hash&gt; <strong>similar_torrents</strong> () const;
│ │ │ │ +std::vector&lt;std::string&gt; <strong>collections</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>These two functions are related to <a class="reference external" href="https://www.bittorrent.org/beps/bep_0038.html">BEP 38</a> (mutable torrents). The
│ │ │ │ +vectors returned from these correspond to the &quot;similar&quot; and
│ │ │ │ +&quot;collections&quot; keys in the .torrent file. Both info-hashes and
│ │ │ │ +collections from within the info-dict and from outside of it are
│ │ │ │ +included.</p>
│ │ │ │ +<a name="add_url_seed()"></a>
│ │ │ │ +<a name="web_seeds()"></a>
│ │ │ │ +<a name="set_web_seeds()"></a>
│ │ │ │ +<a name="add_http_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Badd_url_seed%28%29+web_seeds%28%29+set_web_seeds%28%29+add_http_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Badd_url_seed%28%29+web_seeds%28%29+set_web_seeds%28%29+add_http_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-url-seed-web-seeds-set-web-seeds-add-http-seed">
│ │ │ │ +<h2>add_url_seed() web_seeds() set_web_seeds() add_http_seed()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_url_seed</strong> (std::string const&amp; url
│ │ │ │ +      , std::string const&amp; ext_auth = std::string()
│ │ │ │ +      , web_seed_entry::headers_t const&amp; ext_headers = web_seed_entry::headers_t());
│ │ │ │ +std::vector&lt;web_seed_entry&gt; const&amp; <strong>web_seeds</strong> () const;
│ │ │ │ +void <strong>add_http_seed</strong> (std::string const&amp; url
│ │ │ │ +      , std::string const&amp; extern_auth = std::string()
│ │ │ │ +      , web_seed_entry::headers_t const&amp; extra_headers = web_seed_entry::headers_t());
│ │ │ │ +void <strong>set_web_seeds</strong> (std::vector&lt;web_seed_entry&gt; seeds);
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">web_seeds()</tt> returns all url seeds and http seeds in the torrent.
│ │ │ │ +Each <a class="reference external" href="reference-Bencoding.html#entry">entry</a> is a <tt class="docutils literal">web_seed_entry</tt> and may refer to either a url seed
│ │ │ │ +or http seed.</p>
│ │ │ │ +<p><tt class="docutils literal">add_url_seed()</tt> and <tt class="docutils literal">add_http_seed()</tt> adds one url to the list of
│ │ │ │ +url/http seeds.</p>
│ │ │ │ +<p><tt class="docutils literal">set_web_seeds()</tt> replaces all web seeds with the ones specified in
│ │ │ │ +the <tt class="docutils literal">seeds</tt> vector.</p>
│ │ │ │ +<p>The <tt class="docutils literal">extern_auth</tt> argument can be used for other authorization
│ │ │ │ +schemes than basic HTTP authorization. If set, it will override any
│ │ │ │ +username and password found in the URL itself. The string will be sent
│ │ │ │ +as the HTTP authorization header's value (without specifying &quot;Basic&quot;).</p>
│ │ │ │ +<p>The <tt class="docutils literal">extra_headers</tt> argument defaults to an empty list, but can be
│ │ │ │ +used to insert custom HTTP headers in the requests to a specific web
│ │ │ │ +seed.</p>
│ │ │ │ +<p>See <a class="reference external" href="manual-ref.html#http-seeding">http seeding</a> for more information.</p>
│ │ │ │ +<a name="total_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Btotal_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Btotal_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="total-size-1">
│ │ │ │ +<h2>total_size()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::int64_t <strong>total_size</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">total_size()</tt> returns the total number of bytes the torrent-file
│ │ │ │ +represents. Note that this is the number of pieces times the piece
│ │ │ │ +size (modulo the last piece possibly being smaller). With pad files,
│ │ │ │ +the total size will be larger than the sum of all (regular) file
│ │ │ │ +sizes.</p>
│ │ │ │ +<a name="piece_length()"></a>
│ │ │ │ +<a name="num_pieces()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpiece_length%28%29+num_pieces%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpiece_length%28%29+num_pieces%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-length-num-pieces">
│ │ │ │ +<h2>piece_length() num_pieces()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>num_pieces</strong> () const;
│ │ │ │ +int <strong>piece_length</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">piece_length()</tt> and <tt class="docutils literal">num_pieces()</tt> returns the number of byte
│ │ │ │ +for each piece and the total number of pieces, respectively. The
│ │ │ │ +difference between <tt class="docutils literal">piece_size()</tt> and <tt class="docutils literal">piece_length()</tt> is that
│ │ │ │ +<tt class="docutils literal">piece_size()</tt> takes the piece index as argument and gives you the
│ │ │ │ +exact size of that piece. It will always 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="blocks_per_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bblocks_per_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bblocks_per_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="blocks-per-piece">
│ │ │ │ +<h2>blocks_per_piece()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>blocks_per_piece</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the number of blocks there are in the typical piece. There
│ │ │ │ +may be fewer in the last piece)</p>
│ │ │ │ +<a name="piece_range()"></a>
│ │ │ │ +<a name="last_piece()"></a>
│ │ │ │ +<a name="end_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpiece_range%28%29+last_piece%28%29+end_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpiece_range%28%29+last_piece%28%29+end_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-range-last-piece-end-piece">
│ │ │ │ +<h2>piece_range() last_piece() end_piece()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ +index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const;
│ │ │ │ +piece_index_t <strong>last_piece</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">last_piece()</tt> returns the index to the last piece in the torrent and
│ │ │ │ +<tt class="docutils literal">end_piece()</tt> returns the index to the one-past-end piece in the
│ │ │ │ +torrent
│ │ │ │ +<tt class="docutils literal">piece_range()</tt> returns an implementation-defined type that can be
│ │ │ │ +used as the container in a range-for loop. Where the values are the
│ │ │ │ +indices of all pieces in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │ +<a name="info_hashes()"></a>
│ │ │ │ +<a name="info_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="info-hashes-info-hash">
│ │ │ │ +<h2>info_hashes() info_hash()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +info_hash_t const&amp; <strong>info_hashes</strong> () const;
│ │ │ │ +sha1_hash <strong>info_hash</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the info-hash of the torrent. For BitTorrent v2 support, use
│ │ │ │ +<tt class="docutils literal">info_hashes()</tt> to get an object that may hold both a v1 and v2
│ │ │ │ +info-hash</p>
│ │ │ │ +<a name="v1()"></a>
│ │ │ │ +<a name="v2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bv1%28%29+v2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bv1%28%29+v2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="v1-v2">
│ │ │ │ +<h2>v1() v2()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>v1</strong> () const;
│ │ │ │ +bool <strong>v2</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns whether this torrent has v1 and/or v2 metadata, respectively.
│ │ │ │ +Hybrid torrents have both. These are shortcuts for
│ │ │ │ +info_hashes().has_v1() and info_hashes().has_v2() calls.</p>
│ │ │ │ +<a name="num_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bnum_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bnum_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="num-files">
│ │ │ │ +<h2>num_files()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>num_files</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>If you need index-access to files you can use the <tt class="docutils literal">num_files()</tt> along
│ │ │ │ +with the <tt class="docutils literal">file_path()</tt>, <tt class="docutils literal">file_size()</tt>-family of functions to access
│ │ │ │ +files using indices.</p>
│ │ │ │ +<a name="map_block()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bmap_block%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bmap_block%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="map-block">
│ │ │ │ +<h2>map_block()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;file_slice&gt; <strong>map_block</strong> (piece_index_t const piece
│ │ │ │ +      , std::int64_t offset, int size) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function will map a piece index, a byte offset within that piece
│ │ │ │ +and a size (in bytes) into the corresponding files with offsets where
│ │ │ │ +that data for that piece is supposed to be stored. See <a class="reference external" href="reference-Storage.html#file_slice">file_slice</a>.</p>
│ │ │ │ +<a name="map_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bmap_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bmap_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="map-file">
│ │ │ │ +<h2>map_file()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +peer_request <strong>map_file</strong> (file_index_t const file, std::int64_t offset, int size) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function will map a range in a specific file into a range in the
│ │ │ │ +torrent. The <tt class="docutils literal">file_offset</tt> parameter is the offset in the file,
│ │ │ │ +given in bytes, where 0 is the start of the file. See <a class="reference external" href="reference-Core.html#peer_request">peer_request</a>.</p>
│ │ │ │ +<p>The input range is assumed to be valid within the torrent.
│ │ │ │ +<tt class="docutils literal">file_offset</tt> + <tt class="docutils literal">size</tt> is not allowed to be greater than the file
│ │ │ │ +size. <tt class="docutils literal">file_index</tt> must refer to a valid file, i.e. it cannot be &gt;=
│ │ │ │ +<tt class="docutils literal">num_files()</tt>.</p>
│ │ │ │ +<a name="ssl_cert()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bssl_cert%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bssl_cert%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="ssl-cert">
│ │ │ │ +<h2>ssl_cert()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +string_view <strong>ssl_cert</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Returns the SSL root certificate for the torrent, if it is an SSL
│ │ │ │ +torrent. Otherwise returns an empty string. The certificate is
│ │ │ │ +the public certificate in x509 format.</p>
│ │ │ │ +<a name="is_valid()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bis_valid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bis_valid%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="is-valid">
│ │ │ │ +<h2>is_valid()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>is_valid</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if this <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object has a torrent loaded.
│ │ │ │ +This is primarily used to determine if a magnet link has had its
│ │ │ │ +metadata resolved yet or not.</p>
│ │ │ │ +<a name="priv()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpriv%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpriv%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="priv">
│ │ │ │ +<h2>priv()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>priv</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if this torrent is private. i.e., the client should not
│ │ │ │ +advertise itself on the trackerless network (the Kademlia DHT) for this torrent.</p>
│ │ │ │ +<a name="is_i2p()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bis_i2p%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bis_i2p%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="is-i2p">
│ │ │ │ +<h2>is_i2p()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>is_i2p</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if this is an i2p torrent. This is determined by whether
│ │ │ │ +or not it has a tracker whose URL domain name ends with &quot;.i2p&quot;. i2p
│ │ │ │ +torrents disable the DHT and local peer discovery as well as talking
│ │ │ │ +to peers over anything other than the i2p network.</p>
│ │ │ │ +<a name="piece_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpiece_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpiece_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-size">
│ │ │ │ +<h2>piece_size()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the piece size of file with <tt class="docutils literal">index</tt>. This will be the same as <a class="reference external" href="reference-Storage.html#piece_length()">piece_length()</a>,
│ │ │ │ +except for the last piece, which may be shorter.</p>
│ │ │ │ +<a name="hash_for_piece_ptr()"></a>
│ │ │ │ +<a name="hash_for_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bhash_for_piece_ptr%28%29+hash_for_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bhash_for_piece_ptr%28%29+hash_for_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="hash-for-piece-ptr-hash-for-piece">
│ │ │ │ +<h2>hash_for_piece_ptr() hash_for_piece()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>hash_for_piece_ptr</strong> (piece_index_t const index) const;
│ │ │ │ +sha1_hash <strong>hash_for_piece</strong> (piece_index_t index) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">hash_for_piece()</tt> takes a piece-index and returns the 20-bytes
│ │ │ │ +sha1-hash for that piece and <tt class="docutils literal">info_hash()</tt> returns the 20-bytes
│ │ │ │ +sha1-hash for the info-section of the torrent file.
│ │ │ │ +<tt class="docutils literal">hash_for_piece_ptr()</tt> returns a pointer to the 20 byte sha1 digest
│ │ │ │ +for the piece. Note that the string is not 0-terminated.</p>
│ │ │ │ +<a name="name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bname%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bname%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="name">
│ │ │ │ +<h2>name()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +const std::string&amp; <strong>name</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">name()</tt> returns the name of the torrent.
│ │ │ │ +name contains UTF-8 encoded string.</p>
│ │ │ │ +<a name="creation_date()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bcreation_date%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bcreation_date%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="creation-date">
│ │ │ │ +<h2>creation_date()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::time_t <strong>creation_date</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">creation_date()</tt> returns the creation date of the torrent as time_t
│ │ │ │ +(<a class="reference internal" href="#posix-time">posix time</a>). If there's no time stamp in the torrent file, 0 is
│ │ │ │ +returned.
│ │ │ │ +.. <span class="target" id="posix-time">posix time</span>: <a class="reference external" href="http://www.opengroup.org/onlinepubs/009695399/functions/time.html">http://www.opengroup.org/onlinepubs/009695399/functions/time.html</a></p>
│ │ │ │ +<a name="creator()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bcreator%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bcreator%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="creator">
│ │ │ │ +<h2>creator()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +const std::string&amp; <strong>creator</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">creator()</tt> returns the creator string in the torrent. If there is
│ │ │ │ +no creator string it will return an empty string.</p>
│ │ │ │ +<a name="comment()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bcomment%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bcomment%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="comment">
│ │ │ │ +<h2>comment()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +const std::string&amp; <strong>comment</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">comment()</tt> returns the comment associated with the torrent. If
│ │ │ │ +there's no comment, it will return an empty string.
│ │ │ │ +comment contains UTF-8 encoded string.</p>
│ │ │ │ +<a name="nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bnodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bnodes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="nodes">
│ │ │ │ +<h2>nodes()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;std::pair&lt;std::string, int&gt;&gt; const&amp; <strong>nodes</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>If this torrent contains any DHT nodes, they are put in this vector in
│ │ │ │ +their original form (host name and port number).</p>
│ │ │ │ +<a name="add_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Badd_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Badd_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-node-1">
│ │ │ │ +<h2>add_node()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_node</strong> (std::pair&lt;std::string, int&gt; const&amp; node);
│ │ │ │ +</pre>
│ │ │ │ +<p>This is used when creating torrent. Use this to add a known DHT node.
│ │ │ │ +It may be used, by the client, to bootstrap into the DHT network.</p>
│ │ │ │ +<a name="parse_info_section()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bparse_info_section%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bparse_info_section%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="parse-info-section">
│ │ │ │ +<h2>parse_info_section()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>parse_info_section</strong> (bdecode_node const&amp; info, error_code&amp; ec, int max_pieces);
│ │ │ │ +</pre>
│ │ │ │ +<p>populates the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> by providing just the info-dict buffer.
│ │ │ │ +This is used when loading a torrent from a magnet link for instance,
│ │ │ │ +where we only have the info-dict. The <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> <tt class="docutils literal">e</tt> points to a
│ │ │ │ +parsed info-dictionary. <tt class="docutils literal">ec</tt> returns an error code if something
│ │ │ │ +fails (typically if the info dictionary is malformed).
│ │ │ │ +The <cite>max_pieces</cite> parameter allows limiting the amount of memory
│ │ │ │ +dedicated to loading the torrent, and fails for torrents that exceed
│ │ │ │ +the limit. To load large torrents, this limit may also need to be
│ │ │ │ +raised in <a class="reference external" href="reference-Settings.html#max_piece_count">settings_pack::max_piece_count</a> and in calls to
│ │ │ │ +<a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a>.</p>
│ │ │ │ +<a name="info()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Binfo%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Binfo%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="info">
│ │ │ │ +<h2>info()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bdecode_node <strong>info</strong> (char const* key) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function looks up keys from the info-dictionary of the loaded
│ │ │ │ +torrent file. It can be used to access extension values put in the
│ │ │ │ +.torrent file. If the specified key cannot be found, it returns nullptr.</p>
│ │ │ │ +<a name="info_section()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Binfo_section%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Binfo_section%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="info-section">
│ │ │ │ +<h2>info_section()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +span&lt;char const&gt; <strong>info_section</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a the raw info section of the torrent file.
│ │ │ │ +The underlying buffer is still owned by the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object</p>
│ │ │ │ +<a name="piece_layer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bpiece_layer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bpiece_layer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-layer">
│ │ │ │ +<h2>piece_layer()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +span&lt;char const&gt; <strong>piece_layer</strong> (file_index_t) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>return the bytes of the piece layer hashes for the specified file. If
│ │ │ │ +the file doesn't have a piece layer, an empty span is returned.
│ │ │ │ +The span size is divisible by 32, the size of a SHA-256 hash.
│ │ │ │ +If the size of the file is smaller than or equal to the piece size,
│ │ │ │ +the files &quot;root hash&quot; is the hash of the file and is not saved
│ │ │ │ +separately in the &quot;piece layers&quot; field, but this function still
│ │ │ │ +returns the root hash of the file in that case.</p>
│ │ │ │ +<a name="free_piece_layers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_info%3A%3A%5Bfree_piece_layers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_info%3A%3A%5Bfree_piece_layers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="free-piece-layers">
│ │ │ │ +<h2>free_piece_layers()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>free_piece_layers</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>clears the piece layers from the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>. This is done by the
│ │ │ │ +<a class="reference external" href="reference-Session.html#session">session</a> when a torrent is added, to avoid storing it twice. The piece
│ │ │ │ +layer (or other hashes part of the merkle tree) are stored in the
│ │ │ │ +internal torrent object.</p>
│ │ │ │ +<a name="ip_filter"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+ip_filter&labels=documentation&body=Documentation+under+heading+%22class+ip_filter%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="ip-filter">
│ │ │ │ +<h1>ip_filter</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/ip_filter.hpp">libtorrent/ip_filter.hpp</a>&quot;</p>
│ │ │ │ +<p>The <tt class="docutils literal">ip_filter</tt> class is a set of rules that uniquely categorizes all
│ │ │ │ +ip addresses as allowed or disallowed. The default constructor creates
│ │ │ │ +a single rule that allows all addresses (0.0.0.0 - 255.255.255.255 for
│ │ │ │ +the IPv4 range, and the equivalent range covering all addresses for the
│ │ │ │ +IPv6 range).</p>
│ │ │ │ +<p>A default constructed <a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a> does not filter any address.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct ip_filter
│ │ │ │ +{
│ │ │ │ +   <strong>ip_filter</strong> ();
│ │ │ │ +   ip_filter&amp; <strong>operator=</strong> (ip_filter const&amp;);
│ │ │ │ +   <strong>ip_filter</strong> (ip_filter const&amp;);
│ │ │ │ +   <strong>ip_filter</strong> (ip_filter&amp;&amp;);
│ │ │ │ +   ip_filter&amp; <strong>operator=</strong> (ip_filter&amp;&amp;);
│ │ │ │ +   <strong>~ip_filter</strong> ();
│ │ │ │ +   bool <strong>empty</strong> () const;
│ │ │ │ +   void <strong>add_rule</strong> (address const&amp; first, address const&amp; last, std::uint32_t flags);
│ │ │ │ +   std::uint32_t <strong>access</strong> (address const&amp; addr) const;
│ │ │ │ +   filter_tuple_t <strong>export_filter</strong> () const;
│ │ │ │ +
│ │ │ │ +   enum access_flags
│ │ │ │ +   {
│ │ │ │ +      blocked,
│ │ │ │ +   };
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="empty()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:ip_filter%3A%3A%5Bempty%28%29%5D&labels=documentation&body=Documentation+under+heading+%22ip_filter%3A%3A%5Bempty%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="empty">
│ │ │ │ +<h2>empty()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>empty</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if the filter does not contain any rules</p>
│ │ │ │ +<a name="add_rule()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:ip_filter%3A%3A%5Badd_rule%28%29%5D&labels=documentation&body=Documentation+under+heading+%22ip_filter%3A%3A%5Badd_rule%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-rule">
│ │ │ │ +<h2>add_rule()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_rule</strong> (address const&amp; first, address const&amp; last, std::uint32_t flags);
│ │ │ │ +</pre>
│ │ │ │ +<p>Adds a rule to the filter. <tt class="docutils literal">first</tt> and <tt class="docutils literal">last</tt> defines a range of
│ │ │ │ +ip addresses that will be marked with the given flags. The <tt class="docutils literal">flags</tt>
│ │ │ │ +can currently be 0, which means allowed, or <tt class="docutils literal"><span class="pre">ip_filter::blocked</span></tt>, which
│ │ │ │ +means disallowed.</p>
│ │ │ │ +<p>precondition:
│ │ │ │ +<tt class="docutils literal">first.is_v4() == last.is_v4() &amp;&amp; first.is_v6() == last.is_v6()</tt></p>
│ │ │ │ +<p>postcondition:
│ │ │ │ +<tt class="docutils literal">access(x) == flags</tt> for every <tt class="docutils literal">x</tt> in the range [<tt class="docutils literal">first</tt>, <tt class="docutils literal">last</tt>]</p>
│ │ │ │ +<p>This means that in a case of overlapping ranges, the last one applied takes
│ │ │ │ +precedence.</p>
│ │ │ │ +<a name="access()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:ip_filter%3A%3A%5Baccess%28%29%5D&labels=documentation&body=Documentation+under+heading+%22ip_filter%3A%3A%5Baccess%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="access">
│ │ │ │ +<h2>access()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::uint32_t <strong>access</strong> (address const&amp; addr) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Returns the access permissions for the given address (<tt class="docutils literal">addr</tt>). The permission
│ │ │ │ +can currently be 0 or <tt class="docutils literal"><span class="pre">ip_filter::blocked</span></tt>. The complexity of this operation
│ │ │ │ +is O(<tt class="docutils literal">log</tt> n), where n is the minimum number of non-overlapping ranges to describe
│ │ │ │ +the current filter.</p>
│ │ │ │ +<a name="export_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:ip_filter%3A%3A%5Bexport_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22ip_filter%3A%3A%5Bexport_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="export-filter">
│ │ │ │ +<h2>export_filter()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +filter_tuple_t <strong>export_filter</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function will return the current state of the filter in the minimum number of
│ │ │ │ +ranges possible. They are sorted from ranges in low addresses to high addresses. Each
│ │ │ │ +<a class="reference external" href="reference-Bencoding.html#entry">entry</a> in the returned vector is a range with the access control specified in its
│ │ │ │ +<tt class="docutils literal">flags</tt> field.</p>
│ │ │ │ +<p>The return value is a tuple containing two range-lists. One for IPv4 addresses
│ │ │ │ +and one for IPv6 addresses.</p>
│ │ │ │ +<a name="access_flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+access_flags&labels=documentation&body=Documentation+under+heading+%22enum+access_flags%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-access-flags">
│ │ │ │ +<h2>enum access_flags</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/ip_filter.hpp">libtorrent/ip_filter.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="67%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ +<col width="12%" />
│ │ │ │ +<col width="9%" />
│ │ │ │ +<col width="78%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>max_allowed_in_request_queue</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>2000</td>
│ │ │ │ +<tr><td>blocked</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>indicates that IPs in this range should not be connected
│ │ │ │ +to nor accepted as incoming connections</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>the number of outstanding block requests a peer is allowed to queue
│ │ │ │ -up in the client. If a peer sends more requests than this (before
│ │ │ │ -the first one has been sent) the last request will be dropped. the
│ │ │ │ -higher this is, the faster upload speeds the client can get to a
│ │ │ │ -single peer.</p>
│ │ │ │ -<a name="max_out_request_queue"></a><table border="1" class="docutils">
│ │ │ │ +<a name="port_filter"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+port_filter&labels=documentation&body=Documentation+under+heading+%22class+port_filter%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="port-filter">
│ │ │ │ +<h1>port_filter</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/ip_filter.hpp">libtorrent/ip_filter.hpp</a>&quot;</p>
│ │ │ │ +<p>the port filter maps non-overlapping port ranges to flags. This
│ │ │ │ +is primarily used to indicate whether a range of ports should
│ │ │ │ +be connected to or not. The default is to have the full port
│ │ │ │ +range (0-65535) set to flag 0.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +class port_filter
│ │ │ │ +{
│ │ │ │ +   <strong>port_filter</strong> (port_filter const&amp;);
│ │ │ │ +   <strong>~port_filter</strong> ();
│ │ │ │ +   port_filter&amp; <strong>operator=</strong> (port_filter const&amp;);
│ │ │ │ +   port_filter&amp; <strong>operator=</strong> (port_filter&amp;&amp;);
│ │ │ │ +   <strong>port_filter</strong> (port_filter&amp;&amp;);
│ │ │ │ +   <strong>port_filter</strong> ();
│ │ │ │ +   void <strong>add_rule</strong> (std::uint16_t first, std::uint16_t last, std::uint32_t flags);
│ │ │ │ +   std::uint32_t <strong>access</strong> (std::uint16_t port) const;
│ │ │ │ +
│ │ │ │ +   enum access_flags
│ │ │ │ +   {
│ │ │ │ +      blocked,
│ │ │ │ +   };
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="add_rule()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:port_filter%3A%3A%5Badd_rule%28%29%5D&labels=documentation&body=Documentation+under+heading+%22port_filter%3A%3A%5Badd_rule%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="add-rule-1">
│ │ │ │ +<h2>add_rule()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_rule</strong> (std::uint16_t first, std::uint16_t last, std::uint32_t flags);
│ │ │ │ +</pre>
│ │ │ │ +<p>set the flags for the specified port range (<tt class="docutils literal">first</tt>, <tt class="docutils literal">last</tt>) to
│ │ │ │ +<tt class="docutils literal">flags</tt> overwriting any existing rule for those ports. The range
│ │ │ │ +is inclusive, i.e. the port <tt class="docutils literal">last</tt> also has the flag set on it.</p>
│ │ │ │ +<a name="access()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:port_filter%3A%3A%5Baccess%28%29%5D&labels=documentation&body=Documentation+under+heading+%22port_filter%3A%3A%5Baccess%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="access-1">
│ │ │ │ +<h2>access()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::uint32_t <strong>access</strong> (std::uint16_t port) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>test the specified port (<tt class="docutils literal">port</tt>) for whether it is blocked
│ │ │ │ +or not. The returned value is the flags set for this port.
│ │ │ │ +see <a class="reference external" href="reference-Filter.html#access_flags">access_flags</a>.</p>
│ │ │ │ +<a name="access_flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+access_flags&labels=documentation&body=Documentation+under+heading+%22enum+access_flags%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-access-flags-1">
│ │ │ │ +<h2>enum access_flags</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/ip_filter.hpp">libtorrent/ip_filter.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="10%" />
│ │ │ │ +<col width="76%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>max_out_request_queue</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>500</td>
│ │ │ │ +<tr><td>blocked</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>this flag indicates that destination ports in the
│ │ │ │ +range should not be connected to</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">max_out_request_queue</tt> is the maximum number of outstanding
│ │ │ │ -requests to send to a peer. This limit takes precedence over
│ │ │ │ -<tt class="docutils literal">request_queue_time</tt>. i.e. no matter the download speed, the
│ │ │ │ -number of outstanding requests will never exceed this limit.</p>
│ │ │ │ -<a name="whole_pieces_threshold"></a><table border="1" class="docutils">
│ │ │ │ +<a name="block_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_info&labels=documentation&body=Documentation+under+heading+%22class+block_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="block-info">
│ │ │ │ +<h1>block_info</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │ +<p>holds the state of a block in a piece. Who we requested
│ │ │ │ +it from and how far along we are at downloading it.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct block_info
│ │ │ │ +{
│ │ │ │ +   void <strong>set_peer</strong> (tcp::endpoint const&amp; ep);
│ │ │ │ +   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>peer</strong> () const;
│ │ │ │ +
│ │ │ │ +   enum block_state_t
│ │ │ │ +   {
│ │ │ │ +      none,
│ │ │ │ +      requested,
│ │ │ │ +      writing,
│ │ │ │ +      finished,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   unsigned bytes_progress:15;
│ │ │ │ +   unsigned block_size:15;
│ │ │ │ +   unsigned state:2;
│ │ │ │ +   unsigned num_peers:14;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="peer()"></a>
│ │ │ │ +<a name="set_peer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bpeer%28%29+set_peer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bpeer%28%29+set_peer%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="peer-set-peer">
│ │ │ │ +<h2>peer() set_peer()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_peer</strong> (tcp::endpoint const&amp; ep);
│ │ │ │ +<a class="reference external" href="tcp::endpoint">tcp::endpoint</a> <strong>peer</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>The peer is the ip address of the peer this block was downloaded from.</p>
│ │ │ │ +<a name="block_state_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+block_state_t&labels=documentation&body=Documentation+under+heading+%22enum+block_state_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-block-state-t">
│ │ │ │ +<h2>enum block_state_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="62%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ +<col width="13%" />
│ │ │ │ +<col width="8%" />
│ │ │ │ +<col width="79%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>whole_pieces_threshold</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>20</td>
│ │ │ │ +<tr><td>none</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>This block has not been downloaded or requested form any peer.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>requested</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>The block has been requested, but not completely downloaded yet.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>writing</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>The block has been downloaded and is currently queued for being
│ │ │ │ +written to disk.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>finished</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>The block has been written to disk.</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>if a whole piece can be downloaded in this number of seconds, or
│ │ │ │ -less, the peer_connection will prefer to request whole pieces at a
│ │ │ │ -time from this peer. The benefit of this is to better utilize disk
│ │ │ │ -caches by doing localized accesses and also to make it easier to
│ │ │ │ -identify bad peers if a piece fails the hash check.</p>
│ │ │ │ -<a name="peer_timeout"></a><table border="1" class="docutils">
│ │ │ │ +<a name="bytes_progress"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bbytes_progress%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bbytes_progress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>bytes_progress</dt>
│ │ │ │ +<dd>the number of bytes that have been received for this block</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="block_size"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bblock_size%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bblock_size%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>block_size</dt>
│ │ │ │ +<dd>the total number of bytes in this block.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bstate%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bstate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>state</dt>
│ │ │ │ +<dd>the state this block is in (see <a class="reference external" href="reference-Torrent_Handle.html#block_state_t">block_state_t</a>)</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:block_info%3A%3A%5Bnum_peers%5D&labels=documentation&body=Documentation+under+heading+%22block_info%3A%3A%5Bnum_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_peers</dt>
│ │ │ │ +<dd>the number of peers that is currently requesting this block. Typically
│ │ │ │ +this is 0 or 1, but at the end of the torrent blocks may be requested
│ │ │ │ +by more peers in parallel to speed things up.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="partial_piece_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+partial_piece_info&labels=documentation&body=Documentation+under+heading+%22class+partial_piece_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="partial-piece-info">
│ │ │ │ +<h1>partial_piece_info</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │ +<p>This class holds information about pieces that have outstanding requests
│ │ │ │ +or outstanding writes</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct partial_piece_info
│ │ │ │ +{
│ │ │ │ +   piece_index_t piece_index;
│ │ │ │ +   int blocks_in_piece;
│ │ │ │ +   int finished;
│ │ │ │ +   int writing;
│ │ │ │ +   int requested;
│ │ │ │ +   block_info const* blocks;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="piece_index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Bpiece_index%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Bpiece_index%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>piece_index</dt>
│ │ │ │ +<dd>the index of the piece in question. <tt class="docutils literal">blocks_in_piece</tt> is the number
│ │ │ │ +of blocks in this particular piece. This number will be the same for
│ │ │ │ +most pieces, but
│ │ │ │ +the last piece may have fewer blocks than the standard pieces.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="blocks_in_piece"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Bblocks_in_piece%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Bblocks_in_piece%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>blocks_in_piece</dt>
│ │ │ │ +<dd>the number of blocks in this piece</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="finished"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Bfinished%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Bfinished%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>finished</dt>
│ │ │ │ +<dd>the number of blocks that are in the finished state</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="writing"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Bwriting%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Bwriting%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>writing</dt>
│ │ │ │ +<dd>the number of blocks that are in the writing state</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="requested"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Brequested%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Brequested%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>requested</dt>
│ │ │ │ +<dd>the number of blocks that are in the requested state</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="blocks"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:partial_piece_info%3A%3A%5Bblocks%5D&labels=documentation&body=Documentation+under+heading+%22partial_piece_info%3A%3A%5Bblocks%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>blocks</dt>
│ │ │ │ +<dd><p class="first">this is an array of <tt class="docutils literal">blocks_in_piece</tt> number of
│ │ │ │ +items. One for each block in the piece.</p>
│ │ │ │ +<div class="admonition warning last">
│ │ │ │ +<p class="first admonition-title">Warning</p>
│ │ │ │ +<p class="last">This is a pointer that points to an array
│ │ │ │ +that's owned by the <a class="reference external" href="reference-Session.html#session">session</a> object. The next time
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#get_download_queue()">get_download_queue()</a> is called, it will be invalidated.
│ │ │ │ +In the case of <a class="reference external" href="reference-Alerts.html#piece_info_alert">piece_info_alert</a>, these pointers point into the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +object itself, and will be invalidated when the <a class="reference external" href="reference-Alerts.html#alert">alert</a> destruct.</p>
│ │ │ │ +</div>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_handle&labels=documentation&body=Documentation+under+heading+%22class+torrent_handle%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-handle">
│ │ │ │ +<h1>torrent_handle</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │ +<p>You will usually have to store your torrent handles somewhere, since it's
│ │ │ │ +the object through which you retrieve information about the torrent and
│ │ │ │ +aborts the torrent.</p>
│ │ │ │ +<div class="admonition warning">
│ │ │ │ +<p class="first admonition-title">Warning</p>
│ │ │ │ +<p class="last">Any member function that returns a value or fills in a value has to be
│ │ │ │ +made synchronously. This means it has to wait for the main thread to
│ │ │ │ +complete the query before it can return. This might potentially be
│ │ │ │ +expensive if done from within a GUI thread that needs to stay
│ │ │ │ +responsive. Try to avoid querying for information you don't need, and
│ │ │ │ +try to do it in as few calls as possible. You can get most of the
│ │ │ │ +interesting information about a torrent from the
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a> call.</p>
│ │ │ │ +</div>
│ │ │ │ +<p>The default constructor will initialize the handle to an invalid state.
│ │ │ │ +Which means you cannot perform any operation on it, unless you first
│ │ │ │ +assign it a valid handle. If you try to perform any operation on an
│ │ │ │ +uninitialized handle, it will throw <tt class="docutils literal">invalid_handle</tt>.</p>
│ │ │ │ +<div class="admonition warning">
│ │ │ │ +<p class="first admonition-title">Warning</p>
│ │ │ │ +<p class="last">All operations on a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> may throw system_error
│ │ │ │ +exception, in case the handle is no longer referring to a torrent.
│ │ │ │ +There is one exception <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a> will never throw. Since the torrents
│ │ │ │ +are processed by a background thread, there is no guarantee that a
│ │ │ │ +handle will remain valid between two calls.</p>
│ │ │ │ +</div>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_handle
│ │ │ │ +{
│ │ │ │ +   friend std::size_t <strong>hash_value</strong> (torrent_handle const&amp; th);
│ │ │ │ +   <strong>torrent_handle</strong> () noexcept = default;
│ │ │ │ +   void <strong>add_piece</strong> (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
│ │ │ │ +   void <strong>add_piece</strong> (piece_index_t piece, std::vector&lt;char&gt; data, add_piece_flags_t flags = {}) const;
│ │ │ │ +   void <strong>read_piece</strong> (piece_index_t piece) const;
│ │ │ │ +   bool <strong>have_piece</strong> (piece_index_t piece) const;
│ │ │ │ +   void <strong>post_peer_info</strong> () const;
│ │ │ │ +   void <strong>get_peer_info</strong> (std::vector&lt;peer_info&gt;&amp; v) const;
│ │ │ │ +   torrent_status <strong>status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ +   void <strong>post_status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ +   std::vector&lt;partial_piece_info&gt; <strong>get_download_queue</strong> () const;
│ │ │ │ +   void <strong>post_download_queue</strong> () const;
│ │ │ │ +   void <strong>get_download_queue</strong> (std::vector&lt;partial_piece_info&gt;&amp; queue) const;
│ │ │ │ +   void <strong>reset_piece_deadline</strong> (piece_index_t index) const;
│ │ │ │ +   void <strong>clear_piece_deadlines</strong> () const;
│ │ │ │ +   void <strong>set_piece_deadline</strong> (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
│ │ │ │ +   void <strong>post_file_progress</strong> (file_progress_flags_t flags) const;
│ │ │ │ +   std::vector&lt;std::int64_t&gt; <strong>file_progress</strong> (file_progress_flags_t flags = {}) const;
│ │ │ │ +   void <strong>file_progress</strong> (std::vector&lt;std::int64_t&gt;&amp; progress, file_progress_flags_t flags = {}) const;
│ │ │ │ +   std::vector&lt;open_file_state&gt; <strong>file_status</strong> () const;
│ │ │ │ +   void <strong>clear_error</strong> () const;
│ │ │ │ +   void <strong>post_trackers</strong> () const;
│ │ │ │ +   void <strong>add_tracker</strong> (announce_entry const&amp;) const;
│ │ │ │ +   std::vector&lt;announce_entry&gt; <strong>trackers</strong> () const;
│ │ │ │ +   void <strong>replace_trackers</strong> (std::vector&lt;announce_entry&gt; const&amp;) const;
│ │ │ │ +   void <strong>remove_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +   std::set&lt;std::string&gt; <strong>url_seeds</strong> () const;
│ │ │ │ +   void <strong>add_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +   void <strong>remove_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +   std::set&lt;std::string&gt; <strong>http_seeds</strong> () const;
│ │ │ │ +   void <strong>add_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +   void <strong>add_extension</strong> (
│ │ │ │ +      std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(torrent_handle const&amp;, client_data_t)&gt; const&amp; ext
│ │ │ │ +      , client_data_t userdata = client_data_t{});
│ │ │ │ +   bool <strong>set_metadata</strong> (span&lt;char const&gt; metadata) const;
│ │ │ │ +   bool <strong>is_valid</strong> () const;
│ │ │ │ +   void <strong>resume</strong> () const;
│ │ │ │ +   void <strong>pause</strong> (pause_flags_t flags = {}) const;
│ │ │ │ +   void <strong>set_flags</strong> (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ +   void <strong>set_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ +   void <strong>unset_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ +   torrent_flags_t <strong>flags</strong> () const;
│ │ │ │ +   void <strong>flush_cache</strong> () const;
│ │ │ │ +   void <strong>force_recheck</strong> () const;
│ │ │ │ +   void <strong>save_resume_data</strong> (resume_data_flags_t flags = {}) const;
│ │ │ │ +   bool <strong>need_save_resume_data</strong> (resume_data_flags_t flags) const;
│ │ │ │ +   bool <strong>need_save_resume_data</strong> () const;
│ │ │ │ +   void <strong>queue_position_bottom</strong> () const;
│ │ │ │ +   void <strong>queue_position_top</strong> () const;
│ │ │ │ +   void <strong>queue_position_down</strong> () const;
│ │ │ │ +   queue_position_t <strong>queue_position</strong> () const;
│ │ │ │ +   void <strong>queue_position_up</strong> () const;
│ │ │ │ +   void <strong>queue_position_set</strong> (queue_position_t p) const;
│ │ │ │ +   void <strong>set_ssl_certificate_buffer</strong> (std::string const&amp; certificate
│ │ │ │ +      , std::string const&amp; private_key
│ │ │ │ +      , std::string const&amp; dh_params);
│ │ │ │ +   void <strong>set_ssl_certificate</strong> (std::string const&amp; certificate
│ │ │ │ +      , std::string const&amp; private_key
│ │ │ │ +      , std::string const&amp; dh_params
│ │ │ │ +      , std::string const&amp; passphrase = &quot;&quot;);
│ │ │ │ +   std::shared_ptr&lt;torrent_info&gt; <strong>torrent_file_with_hashes</strong> () const;
│ │ │ │ +   std::shared_ptr&lt;const torrent_info&gt; <strong>torrent_file</strong> () const;
│ │ │ │ +   std::vector&lt;std::vector&lt;sha256_hash&gt;&gt; <strong>piece_layers</strong> () const;
│ │ │ │ +   void <strong>post_piece_availability</strong> () const;
│ │ │ │ +   void <strong>piece_availability</strong> (std::vector&lt;int&gt;&amp; avail) const;
│ │ │ │ +   void <strong>piece_priority</strong> (piece_index_t index, download_priority_t priority) const;
│ │ │ │ +   download_priority_t <strong>piece_priority</strong> (piece_index_t index) const;
│ │ │ │ +   void <strong>prioritize_pieces</strong> (std::vector&lt;download_priority_t&gt; const&amp; pieces) const;
│ │ │ │ +   void <strong>prioritize_pieces</strong> (std::vector&lt;std::pair&lt;piece_index_t, download_priority_t&gt;&gt; const&amp; pieces) const;
│ │ │ │ +   std::vector&lt;download_priority_t&gt; <strong>get_piece_priorities</strong> () const;
│ │ │ │ +   download_priority_t <strong>file_priority</strong> (file_index_t index) const;
│ │ │ │ +   void <strong>prioritize_files</strong> (std::vector&lt;download_priority_t&gt; const&amp; files) const;
│ │ │ │ +   void <strong>file_priority</strong> (file_index_t index, download_priority_t priority) const;
│ │ │ │ +   std::vector&lt;download_priority_t&gt; <strong>get_file_priorities</strong> () const;
│ │ │ │ +   void <strong>force_lsd_announce</strong> () const;
│ │ │ │ +   void <strong>force_reannounce</strong> (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
│ │ │ │ +   void <strong>force_dht_announce</strong> () const;
│ │ │ │ +   void <strong>scrape_tracker</strong> (int idx = -1) const;
│ │ │ │ +   void <strong>set_upload_limit</strong> (int limit) const;
│ │ │ │ +   void <strong>set_download_limit</strong> (int limit) const;
│ │ │ │ +   int <strong>upload_limit</strong> () const;
│ │ │ │ +   int <strong>download_limit</strong> () const;
│ │ │ │ +   void <strong>connect_peer</strong> (tcp::endpoint const&amp; adr, peer_source_flags_t source = {}
│ │ │ │ +      , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
│ │ │ │ +   void <strong>clear_peers</strong> ();
│ │ │ │ +   void <strong>set_max_uploads</strong> (int max_uploads) const;
│ │ │ │ +   int <strong>max_uploads</strong> () const;
│ │ │ │ +   int <strong>max_connections</strong> () const;
│ │ │ │ +   void <strong>set_max_connections</strong> (int max_connections) const;
│ │ │ │ +   void <strong>move_storage</strong> (std::string const&amp; save_path
│ │ │ │ +      , move_flags_t flags = move_flags_t::always_replace_files
│ │ │ │ +      ) const;
│ │ │ │ +   void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_name) const;
│ │ │ │ +   info_hash_t <strong>info_hashes</strong> () const;
│ │ │ │ +   sha1_hash <strong>info_hash</strong> () const;
│ │ │ │ +   bool <strong>operator&lt;</strong> (const torrent_handle&amp; h) const;
│ │ │ │ +   bool <strong>operator==</strong> (const torrent_handle&amp; h) const;
│ │ │ │ +   bool <strong>operator!=</strong> (const torrent_handle&amp; h) const;
│ │ │ │ +   std::uint32_t <strong>id</strong> () const;
│ │ │ │ +   std::shared_ptr&lt;torrent&gt; <strong>native_handle</strong> () const;
│ │ │ │ +   client_data_t <strong>userdata</strong> () const;
│ │ │ │ +   bool <strong>in_session</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr add_piece_flags_t <strong>overwrite_existing</strong>  = 0_bit;
│ │ │ │ +   static constexpr status_flags_t <strong>query_distributed_copies</strong>  = 0_bit;
│ │ │ │ +   static constexpr status_flags_t <strong>query_accurate_download_counters</strong>  = 1_bit;
│ │ │ │ +   static constexpr status_flags_t <strong>query_last_seen_complete</strong>  = 2_bit;
│ │ │ │ +   static constexpr status_flags_t <strong>query_pieces</strong>  = 3_bit;
│ │ │ │ +   static constexpr status_flags_t <strong>query_verified_pieces</strong>  = 4_bit;
│ │ │ │ +   static constexpr status_flags_t <strong>query_torrent_file</strong>  = 5_bit;
│ │ │ │ +   static constexpr status_flags_t <strong>query_name</strong>  = 6_bit;
│ │ │ │ +   static constexpr status_flags_t <strong>query_save_path</strong>  = 7_bit;
│ │ │ │ +   static constexpr deadline_flags_t <strong>alert_when_available</strong>  = 0_bit;
│ │ │ │ +   static constexpr file_progress_flags_t <strong>piece_granularity</strong>  = 0_bit;
│ │ │ │ +   static constexpr pause_flags_t <strong>graceful_pause</strong>  = 0_bit;
│ │ │ │ +   static constexpr resume_data_flags_t <strong>flush_disk_cache</strong>  = 0_bit;
│ │ │ │ +   static constexpr resume_data_flags_t <strong>save_info_dict</strong>  = 1_bit;
│ │ │ │ +   static constexpr resume_data_flags_t <strong>only_if_modified</strong>  = 2_bit;
│ │ │ │ +   static constexpr resume_data_flags_t <strong>if_counters_changed</strong>  = 3_bit;
│ │ │ │ +   static constexpr resume_data_flags_t <strong>if_download_progress</strong>  = 4_bit;
│ │ │ │ +   static constexpr resume_data_flags_t <strong>if_config_changed</strong>  = 5_bit;
│ │ │ │ +   static constexpr resume_data_flags_t <strong>if_state_changed</strong>  = 6_bit;
│ │ │ │ +   static constexpr resume_data_flags_t <strong>if_metadata_changed</strong>  = 7_bit;
│ │ │ │ +   static constexpr reannounce_flags_t <strong>ignore_min_interval</strong>  = 0_bit;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="torrent_handle()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Btorrent_handle%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Btorrent_handle%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="torrent-handle-1">
│ │ │ │ +<h2>torrent_handle()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>torrent_handle</strong> () noexcept = default;
│ │ │ │ +</pre>
│ │ │ │ +<p>constructs a torrent handle that does not refer to a torrent.
│ │ │ │ +i.e. <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a> will return false.</p>
│ │ │ │ +<a name="add_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Badd_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Badd_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-piece">
│ │ │ │ +<h2>add_piece()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_piece</strong> (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
│ │ │ │ +void <strong>add_piece</strong> (piece_index_t piece, std::vector&lt;char&gt; data, add_piece_flags_t flags = {}) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function will write <tt class="docutils literal">data</tt> to the storage as piece <tt class="docutils literal">piece</tt>,
│ │ │ │ +as if it had been downloaded from a peer.</p>
│ │ │ │ +<p>By default, data that's already been downloaded is not overwritten by
│ │ │ │ +this buffer. If you trust this data to be correct (and pass the piece
│ │ │ │ +hash check) you may pass the overwrite_existing flag. This will
│ │ │ │ +instruct libtorrent to overwrite any data that may already have been
│ │ │ │ +downloaded with this data.</p>
│ │ │ │ +<p>Since the data is written asynchronously, you may know that is passed
│ │ │ │ +or failed the hash check by waiting for <a class="reference external" href="reference-Alerts.html#piece_finished_alert">piece_finished_alert</a> or
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#hash_failed_alert">hash_failed_alert</a>.</p>
│ │ │ │ +<p>Adding pieces while the torrent is being checked (i.e. in
│ │ │ │ +<a class="reference external" href="reference-Torrent_Status.html#checking_files">torrent_status::checking_files</a> state) is not supported.</p>
│ │ │ │ +<p>The overload taking a raw pointer to the data is a blocking call. It
│ │ │ │ +won't return until the libtorrent thread has copied the data into its
│ │ │ │ +disk write buffer. <tt class="docutils literal">data</tt> is expected to point to a buffer of as
│ │ │ │ +many bytes as the size of the specified piece. See
│ │ │ │ +<a class="reference external" href="reference-Storage.html#piece_size()">file_storage::piece_size()</a>.</p>
│ │ │ │ +<p>The data in the buffer is copied and passed on to the disk IO thread
│ │ │ │ +to be written at a later point.</p>
│ │ │ │ +<p>The overload taking a <tt class="docutils literal"><span class="pre">std::vector&lt;char&gt;</span></tt> is not blocking, it will
│ │ │ │ +send the buffer to the main thread and return immediately.</p>
│ │ │ │ +<a name="read_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bread_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bread_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="read-piece">
│ │ │ │ +<h2>read_piece()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>read_piece</strong> (piece_index_t piece) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function starts an asynchronous read operation of the specified
│ │ │ │ +piece from this torrent. You must have completed the download of the
│ │ │ │ +specified piece before calling this function.</p>
│ │ │ │ +<p>When the read operation is completed, it is passed back through an
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#alert">alert</a>, <a class="reference external" href="reference-Alerts.html#read_piece_alert">read_piece_alert</a>. Since this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is a response to an explicit
│ │ │ │ +call, it will always be posted, regardless of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
│ │ │ │ +<p>Note that if you read multiple pieces, the read operations are not
│ │ │ │ +guaranteed to finish in the same order as you initiated them.</p>
│ │ │ │ +<a name="have_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bhave_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bhave_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="have-piece">
│ │ │ │ +<h2>have_piece()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>have_piece</strong> (piece_index_t piece) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Returns true if this piece has been completely downloaded and written
│ │ │ │ +to disk, and false otherwise.</p>
│ │ │ │ +<a name="get_peer_info()"></a>
│ │ │ │ +<a name="post_peer_info()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bget_peer_info%28%29+post_peer_info%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bget_peer_info%28%29+post_peer_info%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-peer-info-post-peer-info">
│ │ │ │ +<h2>get_peer_info() post_peer_info()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>post_peer_info</strong> () const;
│ │ │ │ +void <strong>get_peer_info</strong> (std::vector&lt;peer_info&gt;&amp; v) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Query information about connected peers for this torrent. If the
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is invalid, it will throw a system_error exception.</p>
│ │ │ │ +<p><tt class="docutils literal">post_peer_info()</tt> is asynchronous and will trigger the posting of
│ │ │ │ +a <a class="reference external" href="reference-Alerts.html#peer_info_alert">peer_info_alert</a>. The <a class="reference external" href="reference-Alerts.html#alert">alert</a> contain a list of <a class="reference external" href="reference-Core.html#peer_info">peer_info</a> objects, one
│ │ │ │ +for each connected peer.</p>
│ │ │ │ +<p><tt class="docutils literal">get_peer_info()</tt> is synchronous and takes a reference to a vector
│ │ │ │ +that will be cleared and filled with one <a class="reference external" href="reference-Bencoding.html#entry">entry</a> for each peer
│ │ │ │ +connected to this torrent, given the handle is valid. Each <a class="reference external" href="reference-Bencoding.html#entry">entry</a> in
│ │ │ │ +the vector contains information about that particular peer. See
│ │ │ │ +<a class="reference external" href="reference-Core.html#peer_info">peer_info</a>.</p>
│ │ │ │ +<a name="post_status()"></a>
│ │ │ │ +<a name="status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpost_status%28%29+status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpost_status%28%29+status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="post-status-status">
│ │ │ │ +<h2>post_status() status()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +torrent_status <strong>status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ +void <strong>post_status</strong> (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">status()</tt> will return a structure with information about the status
│ │ │ │ +of this torrent. If the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is invalid, it will throw
│ │ │ │ +system_error exception. See <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a>. The <tt class="docutils literal">flags</tt>
│ │ │ │ +argument filters what information is returned in the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a>.
│ │ │ │ +Some information in there is relatively expensive to calculate, and if
│ │ │ │ +you're not interested in it (and see performance issues), you can
│ │ │ │ +filter them out.</p>
│ │ │ │ +<p>The <tt class="docutils literal">status()</tt> function will block until the internal libtorrent
│ │ │ │ +thread responds with the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> object. To avoid blocking,
│ │ │ │ +instead call <tt class="docutils literal">post_status()</tt>. It will trigger posting of a
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#state_update_alert">state_update_alert</a> with a single <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> object for this
│ │ │ │ +torrent.</p>
│ │ │ │ +<p>In order to get regular updates for torrents whose status changes,
│ │ │ │ +consider calling session::post_torrent_updates()`` instead.</p>
│ │ │ │ +<p>By default everything is included. The flags you can use to decide
│ │ │ │ +what to <em>include</em> are defined in this class.</p>
│ │ │ │ +<a name="post_download_queue()"></a>
│ │ │ │ +<a name="get_download_queue()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpost_download_queue%28%29+get_download_queue%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpost_download_queue%28%29+get_download_queue%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="post-download-queue-get-download-queue">
│ │ │ │ +<h2>post_download_queue() get_download_queue()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;partial_piece_info&gt; <strong>get_download_queue</strong> () const;
│ │ │ │ +void <strong>post_download_queue</strong> () const;
│ │ │ │ +void <strong>get_download_queue</strong> (std::vector&lt;partial_piece_info&gt;&amp; queue) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">post_download_queue()</tt> triggers a download_queue_alert to be
│ │ │ │ +posted.
│ │ │ │ +<tt class="docutils literal">get_download_queue()</tt> is a synchronous call and returns a vector
│ │ │ │ +with information about pieces that are partially downloaded or not
│ │ │ │ +downloaded but partially requested. See <a class="reference external" href="reference-Torrent_Handle.html#partial_piece_info">partial_piece_info</a> for the
│ │ │ │ +fields in the returned vector.</p>
│ │ │ │ +<a name="set_piece_deadline()"></a>
│ │ │ │ +<a name="reset_piece_deadline()"></a>
│ │ │ │ +<a name="clear_piece_deadlines()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_piece_deadline%28%29+reset_piece_deadline%28%29+clear_piece_deadlines%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_piece_deadline%28%29+reset_piece_deadline%28%29+clear_piece_deadlines%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-piece-deadline-reset-piece-deadline-clear-piece-deadlines">
│ │ │ │ +<h2>set_piece_deadline() reset_piece_deadline() clear_piece_deadlines()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>reset_piece_deadline</strong> (piece_index_t index) const;
│ │ │ │ +void <strong>clear_piece_deadlines</strong> () const;
│ │ │ │ +void <strong>set_piece_deadline</strong> (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function sets or resets the deadline associated with a specific
│ │ │ │ +piece index (<tt class="docutils literal">index</tt>). libtorrent will attempt to download this
│ │ │ │ +entire piece before the deadline expires. This is not necessarily
│ │ │ │ +possible, but pieces with a more recent deadline will always be
│ │ │ │ +prioritized over pieces with a deadline further ahead in time. The
│ │ │ │ +deadline (and flags) of a piece can be changed by calling this
│ │ │ │ +function again.</p>
│ │ │ │ +<p>If the piece is already downloaded when this call is made, nothing
│ │ │ │ +happens, unless the alert_when_available flag is set, in which case it
│ │ │ │ +will have the same effect as calling <a class="reference external" href="reference-Torrent_Handle.html#read_piece()">read_piece()</a> for <tt class="docutils literal">index</tt>.</p>
│ │ │ │ +<p><tt class="docutils literal">deadline</tt> is the number of milliseconds until this piece should be
│ │ │ │ +completed.</p>
│ │ │ │ +<p><tt class="docutils literal">reset_piece_deadline</tt> removes the deadline from the piece. If it
│ │ │ │ +hasn't already been downloaded, it will no longer be considered a
│ │ │ │ +priority.</p>
│ │ │ │ +<p><tt class="docutils literal">clear_piece_deadlines()</tt> removes deadlines on all pieces in
│ │ │ │ +the torrent. As if <a class="reference external" href="reference-Torrent_Handle.html#reset_piece_deadline()">reset_piece_deadline()</a> was called on all pieces.</p>
│ │ │ │ +<a name="file_progress()"></a>
│ │ │ │ +<a name="post_file_progress()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bfile_progress%28%29+post_file_progress%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bfile_progress%28%29+post_file_progress%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-progress-post-file-progress">
│ │ │ │ +<h2>file_progress() post_file_progress()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>post_file_progress</strong> (file_progress_flags_t flags) const;
│ │ │ │ +std::vector&lt;std::int64_t&gt; <strong>file_progress</strong> (file_progress_flags_t flags = {}) const;
│ │ │ │ +void <strong>file_progress</strong> (std::vector&lt;std::int64_t&gt;&amp; progress, file_progress_flags_t flags = {}) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function fills in the supplied vector, or returns a vector, with
│ │ │ │ +the number of bytes downloaded of each file in this torrent. The
│ │ │ │ +progress values are ordered the same as the files in the
│ │ │ │ +<a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>.</p>
│ │ │ │ +<p>This operation is not very cheap. Its complexity is <em>O(n + mj)</em>.
│ │ │ │ +Where <em>n</em> is the number of files, <em>m</em> is the number of currently
│ │ │ │ +downloading pieces and <em>j</em> is the number of blocks in a piece.</p>
│ │ │ │ +<p>The <tt class="docutils literal">flags</tt> parameter can be used to specify the granularity of the
│ │ │ │ +file progress. If left at the default value of 0, the progress will be
│ │ │ │ +as accurate as possible, but also more expensive to calculate. If
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_handle::piece_granularity</span></tt> is specified, the progress will
│ │ │ │ +be specified in piece granularity. i.e. only pieces that have been
│ │ │ │ +fully downloaded and passed the hash check count. When specifying
│ │ │ │ +piece granularity, the operation is a lot cheaper, since libtorrent
│ │ │ │ +already keeps track of this internally and no calculation is required.</p>
│ │ │ │ +<a name="file_status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bfile_status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bfile_status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-status">
│ │ │ │ +<h2>file_status()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;open_file_state&gt; <strong>file_status</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function returns a vector with status about files
│ │ │ │ +that are open for this torrent. Any file that is not open
│ │ │ │ +will not be reported in the vector, i.e. it's possible that
│ │ │ │ +the vector is empty when returning, if none of the files in the
│ │ │ │ +torrent are currently open.</p>
│ │ │ │ +<p>See <a class="reference external" href="reference-Custom_Storage.html#open_file_state">open_file_state</a></p>
│ │ │ │ +<a name="clear_error()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bclear_error%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bclear_error%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="clear-error">
│ │ │ │ +<h2>clear_error()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>clear_error</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>If the torrent is in an error state (i.e. <tt class="docutils literal"><span class="pre">torrent_status::error</span></tt> is
│ │ │ │ +non-empty), this will clear the error and start the torrent again.</p>
│ │ │ │ +<a name="add_tracker()"></a>
│ │ │ │ +<a name="replace_trackers()"></a>
│ │ │ │ +<a name="trackers()"></a>
│ │ │ │ +<a name="post_trackers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Badd_tracker%28%29+replace_trackers%28%29+trackers%28%29+post_trackers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Badd_tracker%28%29+replace_trackers%28%29+trackers%28%29+post_trackers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-tracker-replace-trackers-trackers-post-trackers">
│ │ │ │ +<h2>add_tracker() replace_trackers() trackers() post_trackers()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>post_trackers</strong> () const;
│ │ │ │ +void <strong>add_tracker</strong> (announce_entry const&amp;) const;
│ │ │ │ +std::vector&lt;announce_entry&gt; <strong>trackers</strong> () const;
│ │ │ │ +void <strong>replace_trackers</strong> (std::vector&lt;announce_entry&gt; const&amp;) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">trackers()</tt> returns the list of trackers for this torrent. The
│ │ │ │ +announce <a class="reference external" href="reference-Bencoding.html#entry">entry</a> contains both a string <tt class="docutils literal">url</tt> which specify the
│ │ │ │ +announce url for the tracker as well as an <a class="reference external" href="reference-Core.html#int">int</a> <tt class="docutils literal">tier</tt>, which is
│ │ │ │ +specifies the order in which this tracker is tried. If you want
│ │ │ │ +libtorrent to use another list of trackers for this torrent, you can
│ │ │ │ +use <tt class="docutils literal">replace_trackers()</tt> which takes a list of the same form as the
│ │ │ │ +one returned from <tt class="docutils literal">trackers()</tt> and will replace it. If you want an
│ │ │ │ +immediate effect, you have to call <a class="reference external" href="reference-Torrent_Handle.html#force_reannounce()">force_reannounce()</a>. See
│ │ │ │ +<a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a>.</p>
│ │ │ │ +<p><tt class="docutils literal">post_trackers()</tt> is the asynchronous version of <tt class="docutils literal">trackers()</tt>. It
│ │ │ │ +will trigger a <a class="reference external" href="reference-Alerts.html#tracker_list_alert">tracker_list_alert</a> to be posted.</p>
│ │ │ │ +<p><tt class="docutils literal">add_tracker()</tt> will look if the specified tracker is already in the
│ │ │ │ +set. If it is, it doesn't do anything. If it's not in the current set
│ │ │ │ +of trackers, it will insert it in the tier specified in the
│ │ │ │ +<a class="reference external" href="reference-Trackers.html#announce_entry">announce_entry</a>.</p>
│ │ │ │ +<p>The updated set of trackers will be saved in the resume data, and when
│ │ │ │ +a torrent is started with resume data, the trackers from the resume
│ │ │ │ +data will replace the original ones.</p>
│ │ │ │ +<a name="remove_url_seed()"></a>
│ │ │ │ +<a name="add_url_seed()"></a>
│ │ │ │ +<a name="url_seeds()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bremove_url_seed%28%29+add_url_seed%28%29+url_seeds%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bremove_url_seed%28%29+add_url_seed%28%29+url_seeds%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="remove-url-seed-add-url-seed-url-seeds">
│ │ │ │ +<h2>remove_url_seed() add_url_seed() url_seeds()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>remove_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +std::set&lt;std::string&gt; <strong>url_seeds</strong> () const;
│ │ │ │ +void <strong>add_url_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">add_url_seed()</tt> adds another url to the torrent's list of url
│ │ │ │ +seeds. If the given url already exists in that list, the call has no
│ │ │ │ +effect. The torrent will connect to the server and try to download
│ │ │ │ +pieces from it, unless it's paused, queued, checking or seeding.
│ │ │ │ +<tt class="docutils literal">remove_url_seed()</tt> removes the given url if it exists already.
│ │ │ │ +<tt class="docutils literal">url_seeds()</tt> return a set of the url seeds currently in this
│ │ │ │ +torrent. Note that URLs that fails may be removed automatically from
│ │ │ │ +the list.</p>
│ │ │ │ +<p>See <a class="reference external" href="manual-ref.html#http-seeding">http seeding</a> for more information.</p>
│ │ │ │ +<a name="http_seeds()"></a>
│ │ │ │ +<a name="remove_http_seed()"></a>
│ │ │ │ +<a name="add_http_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bhttp_seeds%28%29+remove_http_seed%28%29+add_http_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bhttp_seeds%28%29+remove_http_seed%28%29+add_http_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="http-seeds-remove-http-seed-add-http-seed">
│ │ │ │ +<h2>http_seeds() remove_http_seed() add_http_seed()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>remove_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +std::set&lt;std::string&gt; <strong>http_seeds</strong> () const;
│ │ │ │ +void <strong>add_http_seed</strong> (std::string const&amp; url) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>These functions are identical as the <tt class="docutils literal">*_url_seed()</tt> variants, but
│ │ │ │ +they operate on <a class="reference external" href="https://www.bittorrent.org/beps/bep_0017.html">BEP 17</a> web seeds instead of <a class="reference external" href="https://www.bittorrent.org/beps/bep_0019.html">BEP 19</a>.</p>
│ │ │ │ +<p>See <a class="reference external" href="manual-ref.html#http-seeding">http seeding</a> for more information.</p>
│ │ │ │ +<a name="add_extension()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Badd_extension%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Badd_extension%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-extension">
│ │ │ │ +<h2>add_extension()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_extension</strong> (
│ │ │ │ +      std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(torrent_handle const&amp;, client_data_t)&gt; const&amp; ext
│ │ │ │ +      , client_data_t userdata = client_data_t{});
│ │ │ │ +</pre>
│ │ │ │ +<p>add the specified extension to this torrent. The <tt class="docutils literal">ext</tt> argument is
│ │ │ │ +a function that will be called from within libtorrent's context
│ │ │ │ +passing in the internal torrent object and the specified userdata
│ │ │ │ +pointer. The function is expected to return a shared pointer to
│ │ │ │ +a <a class="reference external" href="reference-Plugins.html#torrent_plugin">torrent_plugin</a> instance.</p>
│ │ │ │ +<a name="set_metadata()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_metadata%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_metadata%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-metadata">
│ │ │ │ +<h2>set_metadata()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>set_metadata</strong> (span&lt;char const&gt; metadata) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">set_metadata</tt> expects the <em>info</em> section of metadata. i.e. The
│ │ │ │ +buffer passed in will be hashed and verified against the info-hash. If
│ │ │ │ +it fails, a <tt class="docutils literal">metadata_failed_alert</tt> will be generated. If it passes,
│ │ │ │ +a <tt class="docutils literal">metadata_received_alert</tt> is generated. The function returns true
│ │ │ │ +if the metadata is successfully set on the torrent, and false
│ │ │ │ +otherwise. If the torrent already has metadata, this function will not
│ │ │ │ +affect the torrent, and false will be returned.</p>
│ │ │ │ +<a name="is_valid()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bis_valid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bis_valid%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="is-valid-1">
│ │ │ │ +<h2>is_valid()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>is_valid</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Returns true if this handle refers to a valid torrent and false if it
│ │ │ │ +hasn't been initialized or if the torrent it refers to has been
│ │ │ │ +removed from the <a class="reference external" href="reference-Session.html#session">session</a> AND destructed.</p>
│ │ │ │ +<p>To tell if the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is in the <a class="reference external" href="reference-Session.html#session">session</a>, use
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#in_session()">torrent_handle::in_session()</a>. This will return true before
│ │ │ │ +<a class="reference external" href="reference-Session.html#remove_torrent()">session_handle::remove_torrent()</a> is called, and false
│ │ │ │ +afterward.</p>
│ │ │ │ +<p>Clients should only use <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a> to determine if the result of
│ │ │ │ +session::find_torrent() was successful.</p>
│ │ │ │ +<p>Unlike other member functions which return a value, <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a>
│ │ │ │ +completes immediately, without blocking on a result from the
│ │ │ │ +network thread. Also unlike other functions, it never throws
│ │ │ │ +the system_error exception.</p>
│ │ │ │ +<a name="pause()"></a>
│ │ │ │ +<a name="resume()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpause%28%29+resume%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpause%28%29+resume%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="pause-resume">
│ │ │ │ +<h2>pause() resume()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>resume</strong> () const;
│ │ │ │ +void <strong>pause</strong> (pause_flags_t flags = {}) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">pause()</tt>, and <tt class="docutils literal">resume()</tt> will disconnect all peers and reconnect
│ │ │ │ +all peers respectively. When a torrent is paused, it will however
│ │ │ │ +remember all share ratios to all peers and remember all potential (not
│ │ │ │ +connected) peers. Torrents may be paused automatically if there is a
│ │ │ │ +file error (e.g. disk full) or something similar. See
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#file_error_alert">file_error_alert</a>.</p>
│ │ │ │ +<p>For possible values of the <tt class="docutils literal">flags</tt> parameter, see pause_flags_t.</p>
│ │ │ │ +<p>To know if a torrent is paused or not, call
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_handle::flags()</span></tt> and check for the
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_status::paused</span></tt> flag.</p>
│ │ │ │ +<div class="admonition note">
│ │ │ │ +<p class="first admonition-title">Note</p>
│ │ │ │ +<p class="last">Torrents that are auto-managed may be automatically resumed again. It
│ │ │ │ +does not make sense to pause an auto-managed torrent without making it
│ │ │ │ +not auto-managed first. Torrents are auto-managed by default when added
│ │ │ │ +to the <a class="reference external" href="reference-Session.html#session">session</a>. For more information, see <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</p>
│ │ │ │ +</div>
│ │ │ │ +<a name="set_flags()"></a>
│ │ │ │ +<a name="unset_flags()"></a>
│ │ │ │ +<a name="flags()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_flags%28%29+unset_flags%28%29+flags%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_flags%28%29+unset_flags%28%29+flags%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-flags-unset-flags-flags">
│ │ │ │ +<h2>set_flags() unset_flags() flags()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_flags</strong> (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ +void <strong>set_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ +void <strong>unset_flags</strong> (torrent_flags_t flags) const;
│ │ │ │ +torrent_flags_t <strong>flags</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>sets and gets the torrent state flags. See <a class="reference external" href="reference-Core.html#torrent_flags_t">torrent_flags_t</a>.
│ │ │ │ +The <tt class="docutils literal">set_flags</tt> overload that take a mask will affect all
│ │ │ │ +flags part of the mask, and set their values to what the
│ │ │ │ +<tt class="docutils literal">flags</tt> argument is set to. This allows clearing and
│ │ │ │ +setting flags in a single function call.
│ │ │ │ +The <tt class="docutils literal">set_flags</tt> overload that just takes flags, sets all
│ │ │ │ +the specified flags and leave any other flags unchanged.
│ │ │ │ +<tt class="docutils literal">unset_flags</tt> clears the specified flags, while leaving
│ │ │ │ +any other flags unchanged.</p>
│ │ │ │ +<p>The <cite>seed_mode</cite> flag is special, it can only be cleared once the
│ │ │ │ +torrent has been added, and it can only be set as part of the
│ │ │ │ +<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> flags, when adding the torrent.</p>
│ │ │ │ +<a name="flush_cache()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bflush_cache%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bflush_cache%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="flush-cache">
│ │ │ │ +<h2>flush_cache()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>flush_cache</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Instructs libtorrent to flush all the disk caches for this torrent and
│ │ │ │ +close all file handles. This is done asynchronously and you will be
│ │ │ │ +notified that it's complete through <a class="reference external" href="reference-Alerts.html#cache_flushed_alert">cache_flushed_alert</a>.</p>
│ │ │ │ +<p>Note that by the time you get the <a class="reference external" href="reference-Alerts.html#alert">alert</a>, libtorrent may have cached
│ │ │ │ +more data for the torrent, but you are guaranteed that whatever cached
│ │ │ │ +data libtorrent had by the time you called
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_handle::flush_cache()</span></tt> has been written to disk.</p>
│ │ │ │ +<a name="force_recheck()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bforce_recheck%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bforce_recheck%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="force-recheck">
│ │ │ │ +<h2>force_recheck()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>force_recheck</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">force_recheck</tt> puts the torrent back in a state where it assumes to
│ │ │ │ +have no resume data. All peers will be disconnected and the torrent
│ │ │ │ +will stop announcing to the tracker. The torrent will be added to the
│ │ │ │ +checking queue, and will be checked (all the files will be read and
│ │ │ │ +compared to the piece hashes). Once the check is complete, the torrent
│ │ │ │ +will start connecting to peers again, as normal.
│ │ │ │ +The torrent will be placed last in queue, i.e. its queue position
│ │ │ │ +will be the highest of all torrents in the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │ +<a name="save_resume_data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bsave_resume_data%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bsave_resume_data%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="save-resume-data">
│ │ │ │ +<h2>save_resume_data()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>save_resume_data</strong> (resume_data_flags_t flags = {}) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">save_resume_data()</tt> asks libtorrent to generate fast-resume data for
│ │ │ │ +this torrent. The fast resume data (stored in an <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>
│ │ │ │ +object) can be used to resume a torrent in the next <a class="reference external" href="reference-Session.html#session">session</a> without
│ │ │ │ +having to check all files for which pieces have been downloaded. It
│ │ │ │ +can also be used to save a .torrent file for a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>.</p>
│ │ │ │ +<p>This operation is asynchronous, <tt class="docutils literal">save_resume_data</tt> will return
│ │ │ │ +immediately. The resume data is delivered when it's done through a
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a>.</p>
│ │ │ │ +<p>The operation will fail, and post a <a class="reference external" href="reference-Alerts.html#save_resume_data_failed_alert">save_resume_data_failed_alert</a>
│ │ │ │ +instead, in the following cases:</p>
│ │ │ │ +<blockquote>
│ │ │ │ +<ol class="arabic simple">
│ │ │ │ +<li>The torrent is in the process of being removed.</li>
│ │ │ │ +<li>No torrent state has changed since the last saving of resume
│ │ │ │ +data, and the only_if_modified flag is set.
│ │ │ │ +metadata (see libtorrent's <a class="reference external" href="manual-ref.html#metadata-from-peers">metadata from peers</a> extension)</li>
│ │ │ │ +</ol>
│ │ │ │ +</blockquote>
│ │ │ │ +<p>Note that some <a class="reference external" href="reference-Stats.html#counters">counters</a> may be outdated by the time you receive the fast resume data</p>
│ │ │ │ +<p>When saving resume data because of shutting down, make sure not to
│ │ │ │ +<a class="reference external" href="reference-Session.html#remove_torrent()">remove_torrent()</a> before you receive the <a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a>.
│ │ │ │ +There's no need to pause the <a class="reference external" href="reference-Session.html#session">session</a> or torrent when saving resume
│ │ │ │ +data.</p>
│ │ │ │ +<p>The paused state of a torrent is saved in the resume data, so pausing
│ │ │ │ +all torrents before saving resume data will all torrents be restored
│ │ │ │ +in a paused state.</p>
│ │ │ │ +<div class="admonition note">
│ │ │ │ +<p class="first admonition-title">Note</p>
│ │ │ │ +<p class="last">It is typically a good idea to save resume data whenever a torrent
│ │ │ │ +is completed or paused. If you save resume data for torrents when they are
│ │ │ │ +paused, you can accelerate the shutdown process by not saving resume
│ │ │ │ +data again for those torrents. Completed torrents should have their
│ │ │ │ +resume data saved when they complete and on exit, since their
│ │ │ │ +statistics might be updated.</p>
│ │ │ │ +</div>
│ │ │ │ +<p>Example code to pause and save resume data for all torrents and wait
│ │ │ │ +for the alerts:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="keyword">extern</span><span class="whitespace"> </span><span class="keyword type">int</span><span class="whitespace"> </span><span class="name">outstanding_resume_data</span><span class="punctuation">;</span><span class="whitespace"> </span><span class="comment single">// global counter of outstanding resume data
│ │ │ │ +</span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">torrent_handle</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">handles</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">get_torrents</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +</span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">torrent_handle</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">h</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">handles</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">try</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">h</span><span class="punctuation">.</span><span class="name">save_resume_data</span><span class="punctuation">(</span><span class="name">torrent_handle</span><span class="operator">::</span><span class="name">only_if_modified</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +        </span><span class="operator">++</span><span class="name">outstanding_resume_data</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +</span><span class="keyword">catch</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">lt</span><span class="operator">::</span><span class="name">system_error</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">e</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +        </span><span class="comment single">// the handle was invalid, ignore this one and move to the next
│ │ │ │ +</span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +</span><span class="keyword">while</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">outstanding_resume_data</span><span class="whitespace"> </span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="literal number integer">0</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">alert</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">a</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">wait_for_alert</span><span class="punctuation">(</span><span class="name">seconds</span><span class="punctuation">(</span><span class="literal number integer">30</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +        </span><span class="comment single">// if we don't get an alert within 30 seconds, abort
│ │ │ │ +</span><span class="whitespace">        </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">a</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="keyword">nullptr</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +        </span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">alert</span><span class="operator">*&gt;</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">pop_alerts</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">alerts</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +        </span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">alert</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">i</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +        </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +                </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">alert_cast</span><span class="operator">&lt;</span><span class="name">save_resume_data_failed_alert</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">i</span><span class="punctuation">))</span><span class="whitespace">
│ │ │ │ +                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +                        </span><span class="name">process_alert</span><span class="punctuation">(</span><span class="name">i</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +                        </span><span class="operator">--</span><span class="name">outstanding_resume_data</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +                        </span><span class="keyword">continue</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +                </span><span class="name">save_resume_data_alert</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">rd</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">alert_cast</span><span class="operator">&lt;</span><span class="name">save_resume_data_alert</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">i</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +                </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">rd</span><span class="whitespace"> </span><span class="operator">==</span><span class="whitespace"> </span><span class="keyword">nullptr</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +                        </span><span class="name">process_alert</span><span class="punctuation">(</span><span class="name">i</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +                        </span><span class="keyword">continue</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +                </span><span class="name">std</span><span class="operator">::</span><span class="name">ofstream</span><span class="whitespace"> </span><span class="name">out</span><span class="punctuation">((</span><span class="name">rd</span><span class="operator">-&gt;</span><span class="name">params</span><span class="punctuation">.</span><span class="name">save_path</span><span class="whitespace">
│ │ │ │ +                        </span><span class="operator">+</span><span class="whitespace"> </span><span class="literal string">&quot;/&quot;</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="name">rd</span><span class="operator">-&gt;</span><span class="name">params</span><span class="punctuation">.</span><span class="name">name</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="literal string">&quot;.fastresume&quot;</span><span class="punctuation">).</span><span class="name">c_str</span><span class="punctuation">()</span><span class="whitespace">
│ │ │ │ +                        </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">ios_base</span><span class="operator">::</span><span class="name">binary</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +                </span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">buf</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">write_resume_data_buf</span><span class="punctuation">(</span><span class="name">rd</span><span class="operator">-&gt;</span><span class="name">params</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +                </span><span class="name">out</span><span class="punctuation">.</span><span class="name">write</span><span class="punctuation">(</span><span class="name">buf</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="name">buf</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">());</span><span class="whitespace">
│ │ │ │ +                </span><span class="operator">--</span><span class="name">outstanding_resume_data</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +        </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">}</span>
│ │ │ │ +</pre>
│ │ │ │ +<div class="admonition note">
│ │ │ │ +<p class="first admonition-title">Note</p>
│ │ │ │ +<p class="last">Note how <tt class="docutils literal">outstanding_resume_data</tt> is a global counter in this
│ │ │ │ +example. This is deliberate, otherwise there is a race condition for
│ │ │ │ +torrents that was just asked to save their resume data, they posted
│ │ │ │ +the <a class="reference external" href="reference-Alerts.html#alert">alert</a>, but it has not been received yet. Those torrents would
│ │ │ │ +report that they don't need to save resume data again, and skipped by
│ │ │ │ +the initial loop, and thwart the counter otherwise.</p>
│ │ │ │ +</div>
│ │ │ │ +<a name="need_save_resume_data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bneed_save_resume_data%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bneed_save_resume_data%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="need-save-resume-data">
│ │ │ │ +<h2>need_save_resume_data()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>need_save_resume_data</strong> (resume_data_flags_t flags) const;
│ │ │ │ +bool <strong>need_save_resume_data</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function returns true if anything that is stored in the resume
│ │ │ │ +data has changed since the last time resume data was saved.
│ │ │ │ +The overload that takes <tt class="docutils literal">flags</tt> let you ask if specific categories
│ │ │ │ +of properties have changed. These flags have the same behavior as in
│ │ │ │ +the <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> call.</p>
│ │ │ │ +<p>This is a <em>blocking</em> call. It will wait for a response from
│ │ │ │ +libtorrent's main thread. A way to avoid blocking is to instead
│ │ │ │ +call <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> directly, specifying the conditions under
│ │ │ │ +which resume data should be saved.</p>
│ │ │ │ +<div class="admonition note">
│ │ │ │ +<p class="first admonition-title">Note</p>
│ │ │ │ +<p class="last">A torrent's resume data is considered saved as soon as the
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a> is posted. It is important to make sure this
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#alert">alert</a> is received and handled in order for this function to be
│ │ │ │ +meaningful.</p>
│ │ │ │ +</div>
│ │ │ │ +<a name="queue_position_top()"></a>
│ │ │ │ +<a name="queue_position_down()"></a>
│ │ │ │ +<a name="queue_position_bottom()"></a>
│ │ │ │ +<a name="queue_position_up()"></a>
│ │ │ │ +<a name="queue_position()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bqueue_position_top%28%29+queue_position_down%28%29+queue_position_bottom%28%29+queue_position_up%28%29+queue_position%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bqueue_position_top%28%29+queue_position_down%28%29+queue_position_bottom%28%29+queue_position_up%28%29+queue_position%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="queue-position-top-queue-position-down-queue-position-bottom-queue-position-up-queue-position">
│ │ │ │ +<h2>queue_position_top() queue_position_down() queue_position_bottom() queue_position_up() queue_position()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>queue_position_bottom</strong> () const;
│ │ │ │ +void <strong>queue_position_top</strong> () const;
│ │ │ │ +void <strong>queue_position_down</strong> () const;
│ │ │ │ +queue_position_t <strong>queue_position</strong> () const;
│ │ │ │ +void <strong>queue_position_up</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Every torrent that is added is assigned a queue position exactly one
│ │ │ │ +greater than the greatest queue position of all existing torrents.
│ │ │ │ +Torrents that are being seeded have -1 as their queue position, since
│ │ │ │ +they're no longer in line to be downloaded.</p>
│ │ │ │ +<p>When a torrent is removed or turns into a seed, all torrents with
│ │ │ │ +greater queue positions have their positions decreased to fill in the
│ │ │ │ +space in the sequence.</p>
│ │ │ │ +<p><tt class="docutils literal">queue_position()</tt> returns the torrent's position in the download
│ │ │ │ +queue. The torrents with the smallest numbers are the ones that are
│ │ │ │ +being downloaded. The smaller number, the closer the torrent is to the
│ │ │ │ +front of the line to be started.</p>
│ │ │ │ +<p>The queue position is also available in the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a>.</p>
│ │ │ │ +<p>The <tt class="docutils literal"><span class="pre">queue_position_*()</span></tt> functions adjust the torrents position in
│ │ │ │ +the queue. Up means closer to the front and down means closer to the
│ │ │ │ +back of the queue. Top and bottom refers to the front and the back of
│ │ │ │ +the queue respectively.</p>
│ │ │ │ +<a name="queue_position_set()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bqueue_position_set%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bqueue_position_set%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="queue-position-set">
│ │ │ │ +<h2>queue_position_set()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>queue_position_set</strong> (queue_position_t p) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>updates the position in the queue for this torrent. The relative order
│ │ │ │ +of all other torrents remain intact but their numerical queue position
│ │ │ │ +shifts to make space for this torrent's new position</p>
│ │ │ │ +<a name="set_ssl_certificate()"></a>
│ │ │ │ +<a name="set_ssl_certificate_buffer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_ssl_certificate%28%29+set_ssl_certificate_buffer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_ssl_certificate%28%29+set_ssl_certificate_buffer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-ssl-certificate-set-ssl-certificate-buffer">
│ │ │ │ +<h2>set_ssl_certificate() set_ssl_certificate_buffer()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_ssl_certificate_buffer</strong> (std::string const&amp; certificate
│ │ │ │ +      , std::string const&amp; private_key
│ │ │ │ +      , std::string const&amp; dh_params);
│ │ │ │ +void <strong>set_ssl_certificate</strong> (std::string const&amp; certificate
│ │ │ │ +      , std::string const&amp; private_key
│ │ │ │ +      , std::string const&amp; dh_params
│ │ │ │ +      , std::string const&amp; passphrase = &quot;&quot;);
│ │ │ │ +</pre>
│ │ │ │ +<p>For SSL torrents, use this to specify a path to a .pem file to use as
│ │ │ │ +this client's certificate. The certificate must be signed by the
│ │ │ │ +certificate in the .torrent file to be valid.</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Torrent_Handle.html#set_ssl_certificate_buffer()">set_ssl_certificate_buffer()</a> overload takes the actual certificate,
│ │ │ │ +private key and DH params as strings, rather than paths to files.</p>
│ │ │ │ +<p><tt class="docutils literal">cert</tt> is a path to the (signed) certificate in .pem format
│ │ │ │ +corresponding to this torrent.</p>
│ │ │ │ +<p><tt class="docutils literal">private_key</tt> is a path to the private key for the specified
│ │ │ │ +certificate. This must be in .pem format.</p>
│ │ │ │ +<p><tt class="docutils literal">dh_params</tt> is a path to the Diffie-Hellman parameter file, which
│ │ │ │ +needs to be in .pem format. You can generate this file using the
│ │ │ │ +openssl command like this: <tt class="docutils literal">openssl dhparam <span class="pre">-outform</span> PEM <span class="pre">-out</span>
│ │ │ │ +dhparams.pem 512</tt>.</p>
│ │ │ │ +<p><tt class="docutils literal">passphrase</tt> may be specified if the private key is encrypted and
│ │ │ │ +requires a passphrase to be decrypted.</p>
│ │ │ │ +<p>Note that when a torrent first starts up, and it needs a certificate,
│ │ │ │ +it will suspend connecting to any peers until it has one. It's
│ │ │ │ +typically desirable to resume the torrent after setting the SSL
│ │ │ │ +certificate.</p>
│ │ │ │ +<p>If you receive a <a class="reference external" href="reference-Alerts.html#torrent_need_cert_alert">torrent_need_cert_alert</a>, you need to call this to
│ │ │ │ +provide a valid cert. If you don't have a cert you won't be allowed to
│ │ │ │ +connect to any peers.</p>
│ │ │ │ +<a name="torrent_file_with_hashes()"></a>
│ │ │ │ +<a name="torrent_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Btorrent_file_with_hashes%28%29+torrent_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Btorrent_file_with_hashes%28%29+torrent_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-file-with-hashes-torrent-file">
│ │ │ │ +<h2>torrent_file_with_hashes() torrent_file()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::shared_ptr&lt;torrent_info&gt; <strong>torrent_file_with_hashes</strong> () const;
│ │ │ │ +std::shared_ptr&lt;const torrent_info&gt; <strong>torrent_file</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><a class="reference external" href="reference-Torrent_Handle.html#torrent_file()">torrent_file()</a> returns a pointer to the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object
│ │ │ │ +associated with this torrent. The <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object may be a copy
│ │ │ │ +of the internal object. If the torrent doesn't have metadata, the
│ │ │ │ +pointer will not be initialized (i.e. a nullptr). The torrent may be
│ │ │ │ +in a state without metadata only if it was started without a .torrent
│ │ │ │ +file, e.g. by being added by magnet link.</p>
│ │ │ │ +<p>Note that the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object returned here may be a different
│ │ │ │ +instance than the one added to the <a class="reference external" href="reference-Session.html#session">session</a>, with different attributes
│ │ │ │ +like piece layers, dht nodes and trackers. A <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object does
│ │ │ │ +not round-trip cleanly when added to a <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │ +<p>If you want to save a .torrent file from the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>, instead
│ │ │ │ +call <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> and <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a> the
│ │ │ │ +<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object passed back in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ +<p><a class="reference external" href="reference-Torrent_Handle.html#torrent_file_with_hashes()">torrent_file_with_hashes()</a> returns a <em>copy</em> of the internal
│ │ │ │ +<a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> and piece layer hashes (if it's a v2 torrent). The piece
│ │ │ │ +layers will only be included if they are available. If this torrent
│ │ │ │ +was added from a .torrent file with piece layers or if it's seeding,
│ │ │ │ +the piece layers are available. This function is more expensive than
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#torrent_file()">torrent_file()</a> since it needs to make copies of this information.</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Torrent_Handle.html#torrent_file_with_hashes()">torrent_file_with_hashes()</a> is here for backwards compatibility
│ │ │ │ +when constructing a <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> object from a <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> that's
│ │ │ │ +in a <a class="reference external" href="reference-Session.html#session">session</a>. Prefer <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> + <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a>.</p>
│ │ │ │ +<p>Note that a torrent added from a magnet link may not have the full
│ │ │ │ +merkle trees for all files, and hence not have the complete piece
│ │ │ │ +layers. In that state, you cannot create a .torrent file even from
│ │ │ │ +the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> returned from <a class="reference external" href="reference-Torrent_Handle.html#torrent_file_with_hashes()">torrent_file_with_hashes()</a>. Once the
│ │ │ │ +torrent completes downloading all files, becoming a seed, you can
│ │ │ │ +make a .torrent file from it.</p>
│ │ │ │ +<a name="piece_layers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpiece_layers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpiece_layers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-layers">
│ │ │ │ +<h2>piece_layers()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;std::vector&lt;sha256_hash&gt;&gt; <strong>piece_layers</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the piece layers for all files in the torrent. If this is a
│ │ │ │ +v1 torrent (and doesn't have any piece layers) it returns an empty
│ │ │ │ +vector. This is a blocking call that will synchronize with the
│ │ │ │ +libtorrent network thread.</p>
│ │ │ │ +<a name="post_piece_availability()"></a>
│ │ │ │ +<a name="piece_availability()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpost_piece_availability%28%29+piece_availability%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpost_piece_availability%28%29+piece_availability%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="post-piece-availability-piece-availability">
│ │ │ │ +<h2>post_piece_availability() piece_availability()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>post_piece_availability</strong> () const;
│ │ │ │ +void <strong>piece_availability</strong> (std::vector&lt;int&gt;&amp; avail) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>The piece availability is the number of peers that we are connected
│ │ │ │ +that has advertised having a particular piece. This is the information
│ │ │ │ +that libtorrent uses in order to prefer picking rare pieces.</p>
│ │ │ │ +<p><tt class="docutils literal">post_piece_availability()</tt> will trigger a <a class="reference external" href="reference-Alerts.html#piece_availability_alert">piece_availability_alert</a>
│ │ │ │ +to be posted.</p>
│ │ │ │ +<p><tt class="docutils literal">piece_availability()</tt> fills the specified <tt class="docutils literal"><span class="pre">std::vector&lt;int&gt;</span></tt>
│ │ │ │ +with the availability for each piece in this torrent. libtorrent does
│ │ │ │ +not keep track of availability for seeds, so if the torrent is
│ │ │ │ +seeding the availability for all pieces is reported as 0.</p>
│ │ │ │ +<a name="piece_priority()"></a>
│ │ │ │ +<a name="prioritize_pieces()"></a>
│ │ │ │ +<a name="get_piece_priorities()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpiece_priority%28%29+prioritize_pieces%28%29+get_piece_priorities%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpiece_priority%28%29+prioritize_pieces%28%29+get_piece_priorities%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-priority-prioritize-pieces-get-piece-priorities">
│ │ │ │ +<h2>piece_priority() prioritize_pieces() get_piece_priorities()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>piece_priority</strong> (piece_index_t index, download_priority_t priority) const;
│ │ │ │ +download_priority_t <strong>piece_priority</strong> (piece_index_t index) const;
│ │ │ │ +void <strong>prioritize_pieces</strong> (std::vector&lt;download_priority_t&gt; const&amp; pieces) const;
│ │ │ │ +void <strong>prioritize_pieces</strong> (std::vector&lt;std::pair&lt;piece_index_t, download_priority_t&gt;&gt; const&amp; pieces) const;
│ │ │ │ +std::vector&lt;download_priority_t&gt; <strong>get_piece_priorities</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>These functions are used to set and get the priority of individual
│ │ │ │ +pieces. By default all pieces have priority 4. That means that the
│ │ │ │ +random rarest first algorithm is effectively active for all pieces.
│ │ │ │ +You may however change the priority of individual pieces. There are 8
│ │ │ │ +priority levels. 0 means not to download the piece at all. Otherwise,
│ │ │ │ +lower priority values means less likely to be picked. Piece priority
│ │ │ │ +takes precedence over piece availability. Every piece with priority 7
│ │ │ │ +will be attempted to be picked before a priority 6 piece and so on.</p>
│ │ │ │ +<p>The default priority of pieces is 4.</p>
│ │ │ │ +<p>Piece priorities can not be changed for torrents that have not
│ │ │ │ +downloaded the metadata yet. Magnet links won't have metadata
│ │ │ │ +immediately. see the <a class="reference external" href="reference-Alerts.html#metadata_received_alert">metadata_received_alert</a>.</p>
│ │ │ │ +<p><tt class="docutils literal">piece_priority</tt> sets or gets the priority for an individual piece,
│ │ │ │ +specified by <tt class="docutils literal">index</tt>.</p>
│ │ │ │ +<p><tt class="docutils literal">prioritize_pieces</tt> takes a vector of integers, one integer per
│ │ │ │ +piece in the torrent. All the piece priorities will be updated with
│ │ │ │ +the priorities in the vector.
│ │ │ │ +The second overload of <tt class="docutils literal">prioritize_pieces</tt> that takes a vector of pairs
│ │ │ │ +will update the priorities of only select pieces, and leave all other
│ │ │ │ +unaffected. Each pair is (piece, priority). That is, the first item is
│ │ │ │ +the piece index and the second item is the priority of that piece.
│ │ │ │ +Invalid entries, where the piece index or priority is out of range, are
│ │ │ │ +not allowed.</p>
│ │ │ │ +<p><tt class="docutils literal">get_piece_priorities</tt> returns a vector with one element for each piece
│ │ │ │ +in the torrent. Each element is the current priority of that piece.</p>
│ │ │ │ +<p>It's possible to cancel the effect of <em>file</em> priorities by setting the
│ │ │ │ +priorities for the affected pieces. Care has to be taken when mixing
│ │ │ │ +usage of file- and piece priorities.</p>
│ │ │ │ +<a name="get_file_priorities()"></a>
│ │ │ │ +<a name="prioritize_files()"></a>
│ │ │ │ +<a name="file_priority()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bget_file_priorities%28%29+prioritize_files%28%29+file_priority%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bget_file_priorities%28%29+prioritize_files%28%29+file_priority%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-file-priorities-prioritize-files-file-priority">
│ │ │ │ +<h2>get_file_priorities() prioritize_files() file_priority()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +download_priority_t <strong>file_priority</strong> (file_index_t index) const;
│ │ │ │ +void <strong>prioritize_files</strong> (std::vector&lt;download_priority_t&gt; const&amp; files) const;
│ │ │ │ +void <strong>file_priority</strong> (file_index_t index, download_priority_t priority) const;
│ │ │ │ +std::vector&lt;download_priority_t&gt; <strong>get_file_priorities</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">index</tt> must be in the range [0, number_of_files).</p>
│ │ │ │ +<p><tt class="docutils literal">file_priority()</tt> queries or sets the priority of file <tt class="docutils literal">index</tt>.</p>
│ │ │ │ +<p><tt class="docutils literal">prioritize_files()</tt> takes a vector that has at as many elements as
│ │ │ │ +there are files in the torrent. Each <a class="reference external" href="reference-Bencoding.html#entry">entry</a> is the priority of that
│ │ │ │ +file. The function sets the priorities of all the pieces in the
│ │ │ │ +torrent based on the vector.</p>
│ │ │ │ +<p><tt class="docutils literal">get_file_priorities()</tt> returns a vector with the priorities of all
│ │ │ │ +files.</p>
│ │ │ │ +<p>The priority values are the same as for <a class="reference external" href="reference-Torrent_Handle.html#piece_priority()">piece_priority()</a>. See
│ │ │ │ +<a class="reference external" href="reference-Core.html#download_priority_t">download_priority_t</a>.</p>
│ │ │ │ +<p>Whenever a file priority is changed, all other piece priorities are
│ │ │ │ +reset to match the file priorities. In order to maintain special
│ │ │ │ +priorities for particular pieces, <a class="reference external" href="reference-Torrent_Handle.html#piece_priority()">piece_priority()</a> has to be called
│ │ │ │ +again for those pieces.</p>
│ │ │ │ +<p>You cannot set the file priorities on a torrent that does not yet have
│ │ │ │ +metadata or a torrent that is a seed. <tt class="docutils literal">file_priority(int, int)</tt> and
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#prioritize_files()">prioritize_files()</a> are both no-ops for such torrents.</p>
│ │ │ │ +<p>Since changing file priorities may involve disk operations (of moving
│ │ │ │ +files in- and out of the part file), the internal accounting of file
│ │ │ │ +priorities happen asynchronously. i.e. setting file priorities and then
│ │ │ │ +immediately querying them may not yield the same priorities just set.
│ │ │ │ +To synchronize with the priorities taking effect, wait for the
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#file_prio_alert">file_prio_alert</a>.</p>
│ │ │ │ +<p>When combining file- and piece priorities, the resume file will record
│ │ │ │ +both. When loading the resume data, the file priorities will be applied
│ │ │ │ +first, then the piece priorities.</p>
│ │ │ │ +<p>Moving data from a file into the part file is currently not
│ │ │ │ +supported. If a file has its priority set to 0 <em>after</em> it has already
│ │ │ │ +been created, it will not be moved into the partfile.</p>
│ │ │ │ +<a name="force_lsd_announce()"></a>
│ │ │ │ +<a name="force_reannounce()"></a>
│ │ │ │ +<a name="force_dht_announce()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bforce_lsd_announce%28%29+force_reannounce%28%29+force_dht_announce%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bforce_lsd_announce%28%29+force_reannounce%28%29+force_dht_announce%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="force-lsd-announce-force-reannounce-force-dht-announce">
│ │ │ │ +<h2>force_lsd_announce() force_reannounce() force_dht_announce()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>force_lsd_announce</strong> () const;
│ │ │ │ +void <strong>force_reannounce</strong> (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
│ │ │ │ +void <strong>force_dht_announce</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">force_reannounce()</tt> will force this torrent to do another tracker
│ │ │ │ +request, to receive new peers. The <tt class="docutils literal">seconds</tt> argument specifies how
│ │ │ │ +many seconds from now to issue the tracker announces.</p>
│ │ │ │ +<p>If the tracker's <tt class="docutils literal">min_interval</tt> has not passed since the last
│ │ │ │ +announce, the forced announce will be scheduled to happen immediately
│ │ │ │ +as the <tt class="docutils literal">min_interval</tt> expires. This is to honor trackers minimum
│ │ │ │ +re-announce interval settings.</p>
│ │ │ │ +<p>The <tt class="docutils literal">tracker_index</tt> argument specifies which tracker to re-announce.
│ │ │ │ +If set to -1 (which is the default), all trackers are re-announce.</p>
│ │ │ │ +<p>The <tt class="docutils literal">flags</tt> argument can be used to affect the re-announce. See
│ │ │ │ +ignore_min_interval.</p>
│ │ │ │ +<p><tt class="docutils literal">force_dht_announce</tt> will announce the torrent to the DHT
│ │ │ │ +immediately.</p>
│ │ │ │ +<p><tt class="docutils literal">force_lsd_announce</tt> will announce the torrent on LSD
│ │ │ │ +immediately.</p>
│ │ │ │ +<a name="scrape_tracker()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bscrape_tracker%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bscrape_tracker%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="scrape-tracker">
│ │ │ │ +<h2>scrape_tracker()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>scrape_tracker</strong> (int idx = -1) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">scrape_tracker()</tt> will send a scrape request to a tracker. By
│ │ │ │ +default (<tt class="docutils literal">idx</tt> = -1) it will scrape the last working tracker. If
│ │ │ │ +<tt class="docutils literal">idx</tt> is &gt;= 0, the tracker with the specified index will scraped.</p>
│ │ │ │ +<p>A scrape request queries the tracker for statistics such as total
│ │ │ │ +number of incomplete peers, complete peers, number of downloads etc.</p>
│ │ │ │ +<p>This request will specifically update the <tt class="docutils literal">num_complete</tt> and
│ │ │ │ +<tt class="docutils literal">num_incomplete</tt> fields in the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> struct once it
│ │ │ │ +completes. When it completes, it will generate a <a class="reference external" href="reference-Alerts.html#scrape_reply_alert">scrape_reply_alert</a>.
│ │ │ │ +If it fails, it will generate a <a class="reference external" href="reference-Alerts.html#scrape_failed_alert">scrape_failed_alert</a>.</p>
│ │ │ │ +<a name="set_download_limit()"></a>
│ │ │ │ +<a name="set_upload_limit()"></a>
│ │ │ │ +<a name="upload_limit()"></a>
│ │ │ │ +<a name="download_limit()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_download_limit%28%29+set_upload_limit%28%29+upload_limit%28%29+download_limit%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_download_limit%28%29+set_upload_limit%28%29+upload_limit%28%29+download_limit%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-download-limit-set-upload-limit-upload-limit-download-limit">
│ │ │ │ +<h2>set_download_limit() set_upload_limit() upload_limit() download_limit()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_upload_limit</strong> (int limit) const;
│ │ │ │ +void <strong>set_download_limit</strong> (int limit) const;
│ │ │ │ +int <strong>upload_limit</strong> () const;
│ │ │ │ +int <strong>download_limit</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">set_upload_limit</tt> 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.
│ │ │ │ +<tt class="docutils literal">set_download_limit</tt> works the same way but for download bandwidth
│ │ │ │ +instead of upload bandwidth. Note that setting a higher limit on a
│ │ │ │ +torrent then the global limit
│ │ │ │ +(<tt class="docutils literal"><span class="pre">settings_pack::upload_rate_limit</span></tt>) will not override the global
│ │ │ │ +rate limit. The torrent can never upload more than the global rate
│ │ │ │ +limit.</p>
│ │ │ │ +<p><tt class="docutils literal">upload_limit</tt> and <tt class="docutils literal">download_limit</tt> will return the current limit
│ │ │ │ +setting, for upload and download, respectively.</p>
│ │ │ │ +<p>Local peers are not rate limited by default. see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ +<a name="connect_peer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bconnect_peer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bconnect_peer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="connect-peer">
│ │ │ │ +<h2>connect_peer()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>connect_peer</strong> (tcp::endpoint const&amp; adr, peer_source_flags_t source = {}
│ │ │ │ +      , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">connect_peer()</tt> is a way to manually connect to peers that one
│ │ │ │ +believe is a part of the torrent. If the peer does not respond, or is
│ │ │ │ +not a member of this torrent, it will simply be disconnected. No harm
│ │ │ │ +can be done by using this other than an unnecessary connection attempt
│ │ │ │ +is made. If the torrent is uninitialized or in queued or checking
│ │ │ │ +mode, this will throw system_error. The second (optional)
│ │ │ │ +argument will be bitwise ORed into the source mask of this peer.
│ │ │ │ +Typically this is one of the source flags in <a class="reference external" href="reference-Core.html#peer_info">peer_info</a>. i.e.
│ │ │ │ +<tt class="docutils literal">tracker</tt>, <tt class="docutils literal">pex</tt>, <tt class="docutils literal">dht</tt> etc.</p>
│ │ │ │ +<p>For possible values of <tt class="docutils literal">flags</tt>, see <a class="reference external" href="reference-Core.html#pex_flags_t">pex_flags_t</a>.</p>
│ │ │ │ +<a name="clear_peers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bclear_peers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bclear_peers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="clear-peers">
│ │ │ │ +<h2>clear_peers()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>clear_peers</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>This will disconnect all peers and clear the peer list for this
│ │ │ │ +torrent. New peers will have to be acquired before resuming, from
│ │ │ │ +trackers, DHT or local service discovery, for example.</p>
│ │ │ │ +<a name="set_max_uploads()"></a>
│ │ │ │ +<a name="max_uploads()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bset_max_uploads%28%29+max_uploads%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bset_max_uploads%28%29+max_uploads%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-max-uploads-max-uploads">
│ │ │ │ +<h2>set_max_uploads() max_uploads()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_max_uploads</strong> (int max_uploads) const;
│ │ │ │ +int <strong>max_uploads</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">set_max_uploads()</tt> sets the maximum number of peers that's unchoked
│ │ │ │ +at the same time on this torrent. If you set this to -1, there will be
│ │ │ │ +no limit. This defaults to infinite. The primary setting controlling
│ │ │ │ +this is the global unchoke slots limit, set by unchoke_slots_limit in
│ │ │ │ +<a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>.</p>
│ │ │ │ +<p><tt class="docutils literal">max_uploads()</tt> returns the current settings.</p>
│ │ │ │ +<a name="max_connections()"></a>
│ │ │ │ +<a name="set_max_connections()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bmax_connections%28%29+set_max_connections%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bmax_connections%28%29+set_max_connections%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="max-connections-set-max-connections">
│ │ │ │ +<h2>max_connections() set_max_connections()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>max_connections</strong> () const;
│ │ │ │ +void <strong>set_max_connections</strong> (int max_connections) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">set_max_connections()</tt> sets the maximum number of connection this
│ │ │ │ +torrent will open. If all connections are used up, incoming
│ │ │ │ +connections may be refused or poor connections may be closed. This
│ │ │ │ +must be at least 2. The default is unlimited number of connections. If
│ │ │ │ +-1 is given to the function, it means unlimited. There is also a
│ │ │ │ +global limit of the number of connections, set by
│ │ │ │ +<tt class="docutils literal">connections_limit</tt> in <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>.</p>
│ │ │ │ +<p><tt class="docutils literal">max_connections()</tt> returns the current settings.</p>
│ │ │ │ +<a name="move_storage()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bmove_storage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bmove_storage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="move-storage">
│ │ │ │ +<h2>move_storage()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>move_storage</strong> (std::string const&amp; save_path
│ │ │ │ +      , move_flags_t flags = move_flags_t::always_replace_files
│ │ │ │ +      ) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Moves the file(s) that this torrent are currently seeding from or
│ │ │ │ +downloading to. If the given <tt class="docutils literal">save_path</tt> is not located on the same
│ │ │ │ +drive as the original save path, the files will be copied to the new
│ │ │ │ +drive and removed from their original location. This will block all
│ │ │ │ +other disk IO, and other torrents download and upload rates may drop
│ │ │ │ +while copying the file.</p>
│ │ │ │ +<p>Since disk IO is performed in a separate thread, this operation is
│ │ │ │ +also asynchronous. Once the operation completes, the
│ │ │ │ +<tt class="docutils literal">storage_moved_alert</tt> is generated, with the new path as the
│ │ │ │ +message. If the move fails for some reason,
│ │ │ │ +<tt class="docutils literal">storage_moved_failed_alert</tt> is generated instead, containing the
│ │ │ │ +error message.</p>
│ │ │ │ +<p>The <tt class="docutils literal">flags</tt> argument determines the behavior of the copying/moving
│ │ │ │ +of the files in the torrent. see <a class="reference external" href="reference-Storage.html#move_flags_t">move_flags_t</a>.</p>
│ │ │ │ +<p><tt class="docutils literal">always_replace_files</tt> is the default and replaces any file that
│ │ │ │ +exist in both the source directory and the target directory.</p>
│ │ │ │ +<p><tt class="docutils literal">fail_if_exist</tt> first check to see that none of the copy operations
│ │ │ │ +would cause an overwrite. If it would, it will fail. Otherwise it will
│ │ │ │ +proceed as if it was in <tt class="docutils literal">always_replace_files</tt> mode. Note that there
│ │ │ │ +is an inherent race condition here. If the files in the target
│ │ │ │ +directory appear after the check but before the copy or move
│ │ │ │ +completes, they will be overwritten. When failing because of files
│ │ │ │ +already existing in the target path, the <tt class="docutils literal">error</tt> of
│ │ │ │ +<tt class="docutils literal">move_storage_failed_alert</tt> is set to
│ │ │ │ +<tt class="docutils literal"><span class="pre">boost::system::errc::file_exists</span></tt>.</p>
│ │ │ │ +<p>The intention is that a client may use this as a probe, and if it
│ │ │ │ +fails, ask the user which mode to use. The client may then re-issue
│ │ │ │ +the <tt class="docutils literal">move_storage</tt> call with one of the other modes.</p>
│ │ │ │ +<p><tt class="docutils literal">dont_replace</tt> always keeps the existing file in the target
│ │ │ │ +directory, if there is one. The source files will still be removed in
│ │ │ │ +that case. Note that it won't automatically re-check files. If an
│ │ │ │ +incomplete torrent is moved into a directory with the complete files,
│ │ │ │ +pause, move, force-recheck and resume. Without the re-checking, the
│ │ │ │ +torrent will keep downloading and files in the new download directory
│ │ │ │ +will be overwritten.</p>
│ │ │ │ +<p>Files that have been renamed to have absolute paths are not moved by
│ │ │ │ +this function. Keep in mind that files that don't belong to the
│ │ │ │ +torrent but are stored in the torrent's directory may be moved as
│ │ │ │ +well. This goes for files that have been renamed to absolute paths
│ │ │ │ +that still end up inside the save path.</p>
│ │ │ │ +<p>When copying files, sparse regions are not likely to be preserved.
│ │ │ │ +This makes it proportionally more expensive to move a large torrent
│ │ │ │ +when only few pieces have been downloaded, since the files are then
│ │ │ │ +allocated with zeros in the destination directory.</p>
│ │ │ │ +<a name="rename_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Brename_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Brename_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="rename-file-1">
│ │ │ │ +<h2>rename_file()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_name) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Renames the file with the given index asynchronously. The rename
│ │ │ │ +operation is complete when either a <a class="reference external" href="reference-Alerts.html#file_renamed_alert">file_renamed_alert</a> or
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#file_rename_failed_alert">file_rename_failed_alert</a> is posted.</p>
│ │ │ │ +<a name="info_hashes()"></a>
│ │ │ │ +<a name="info_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Binfo_hashes%28%29+info_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="info-hashes-info-hash-1">
│ │ │ │ +<h2>info_hashes() info_hash()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +info_hash_t <strong>info_hashes</strong> () const;
│ │ │ │ +sha1_hash <strong>info_hash</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the info-hash(es) of the torrent. If this handle is to a
│ │ │ │ +torrent that hasn't loaded yet (for instance by being added) by a
│ │ │ │ +URL, the returned value is undefined.
│ │ │ │ +The <tt class="docutils literal">info_hash()</tt> returns the SHA-1 info-hash for v1 torrents and a
│ │ │ │ +truncated hash for v2 torrents. For the full v2 info-hash, use
│ │ │ │ +<tt class="docutils literal">info_hashes()</tt> instead.</p>
│ │ │ │ +<a name="operator!=()"></a>
│ │ │ │ +<a name="operator==()"></a>
│ │ │ │ +<a name="operator<()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Boperator%21%3D%28%29+operator%3D%3D%28%29+operator%3C%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Boperator%21%3D%28%29+operator%3D%3D%28%29+operator%3C%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="operator-operator-operator">
│ │ │ │ +<h2>operator!=() operator==() operator&lt;()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>operator&lt;</strong> (const torrent_handle&amp; h) const;
│ │ │ │ +bool <strong>operator==</strong> (const torrent_handle&amp; h) const;
│ │ │ │ +bool <strong>operator!=</strong> (const torrent_handle&amp; h) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>comparison operators. The order of the torrents is unspecified
│ │ │ │ +but stable.</p>
│ │ │ │ +<a name="id()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bid%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="id">
│ │ │ │ +<h2>id()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::uint32_t <strong>id</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a unique identifier for this torrent. It's not a dense index.
│ │ │ │ +It's not preserved across sessions.</p>
│ │ │ │ +<a name="native_handle()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bnative_handle%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bnative_handle%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="native-handle">
│ │ │ │ +<h2>native_handle()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::shared_ptr&lt;torrent&gt; <strong>native_handle</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function is intended only for use by plugins and the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +dispatch function. This type does not have a stable ABI and should
│ │ │ │ +be relied on as little as possible. Accessing the handle returned by
│ │ │ │ +this function is not thread safe outside of libtorrent's internal
│ │ │ │ +thread (which is used to invoke <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> callbacks).
│ │ │ │ +The <tt class="docutils literal">torrent</tt> class is not only eligible for changing ABI across
│ │ │ │ +minor versions of libtorrent, its layout is also dependent on build
│ │ │ │ +configuration. This adds additional requirements on a client to be
│ │ │ │ +built with the exact same build configuration as libtorrent itself.
│ │ │ │ +i.e. the <tt class="docutils literal">TORRENT_</tt> macros must match between libtorrent and the
│ │ │ │ +client builds.</p>
│ │ │ │ +<a name="userdata()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Buserdata%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Buserdata%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="userdata">
│ │ │ │ +<h2>userdata()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +client_data_t <strong>userdata</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the userdata pointer as set in <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a></p>
│ │ │ │ +<a name="in_session()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bin_session%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bin_session%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="in-session">
│ │ │ │ +<h2>in_session()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>in_session</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Returns true if the torrent is in the <a class="reference external" href="reference-Session.html#session">session</a>. It returns true before
│ │ │ │ +session::remove_torrent() is called, and false afterward.</p>
│ │ │ │ +<p>Note that this is a blocking function, unlike <a class="reference external" href="reference-Torrent_Handle.html#is_valid()">torrent_handle::is_valid()</a>
│ │ │ │ +which returns immediately.</p>
│ │ │ │ +<a name="overwrite_existing"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Boverwrite_existing%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Boverwrite_existing%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>overwrite_existing</dt>
│ │ │ │ +<dd>instruct libtorrent to overwrite any data that may already have been
│ │ │ │ +downloaded with the data of the new piece being added. Using this
│ │ │ │ +flag when adding a piece that is actively being downloaded from other
│ │ │ │ +peers may have some unexpected consequences, as blocks currently
│ │ │ │ +being downloaded from peers may not be replaced.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="query_distributed_copies"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_distributed_copies%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_distributed_copies%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>query_distributed_copies</dt>
│ │ │ │ +<dd>calculates <tt class="docutils literal">distributed_copies</tt>, <tt class="docutils literal">distributed_full_copies</tt> and
│ │ │ │ +<tt class="docutils literal">distributed_fraction</tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="query_accurate_download_counters"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_accurate_download_counters%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_accurate_download_counters%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>query_accurate_download_counters</dt>
│ │ │ │ +<dd>includes partial downloaded blocks in <tt class="docutils literal">total_done</tt> and
│ │ │ │ +<tt class="docutils literal">total_wanted_done</tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="query_last_seen_complete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_last_seen_complete%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_last_seen_complete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>query_last_seen_complete</dt>
│ │ │ │ +<dd>includes <tt class="docutils literal">last_seen_complete</tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="query_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_pieces%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>query_pieces</dt>
│ │ │ │ +<dd>populate the <tt class="docutils literal">pieces</tt> field in <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="query_verified_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_verified_pieces%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_verified_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>query_verified_pieces</dt>
│ │ │ │ +<dd>includes <tt class="docutils literal">verified_pieces</tt> (only applies to torrents in <em>seed
│ │ │ │ +mode</em>).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="query_torrent_file"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_torrent_file%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_torrent_file%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>query_torrent_file</dt>
│ │ │ │ +<dd>includes <tt class="docutils literal">torrent_file</tt>, which is all the static information from
│ │ │ │ +the .torrent file.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="query_name"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_name%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_name%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>query_name</dt>
│ │ │ │ +<dd>includes <tt class="docutils literal">name</tt>, the name of the torrent. This is either derived
│ │ │ │ +from the .torrent file, or from the <tt class="docutils literal">&amp;dn=</tt> magnet link argument
│ │ │ │ +or possibly some other source. If the name of the torrent is not
│ │ │ │ +known, this is an empty string.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="query_save_path"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bquery_save_path%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bquery_save_path%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>query_save_path</dt>
│ │ │ │ +<dd>includes <tt class="docutils literal">save_path</tt>, the path to the directory the files of the
│ │ │ │ +torrent are saved to.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_when_available"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Balert_when_available%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Balert_when_available%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>alert_when_available</dt>
│ │ │ │ +<dd>used to ask libtorrent to send an <a class="reference external" href="reference-Alerts.html#alert">alert</a> once the piece has been
│ │ │ │ +downloaded, by passing alert_when_available. When set, the
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#read_piece_alert">read_piece_alert</a> <a class="reference external" href="reference-Alerts.html#alert">alert</a> will be delivered, with the piece data, when
│ │ │ │ +it's downloaded.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="piece_granularity"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bpiece_granularity%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bpiece_granularity%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>piece_granularity</dt>
│ │ │ │ +<dd>only calculate file progress at piece granularity. This makes
│ │ │ │ +the <a class="reference external" href="reference-Torrent_Handle.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.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="graceful_pause"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bgraceful_pause%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bgraceful_pause%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>graceful_pause</dt>
│ │ │ │ +<dd>will delay the disconnect of peers that we're still downloading
│ │ │ │ +outstanding requests from. The torrent will not accept any more
│ │ │ │ +requests and will disconnect all idle peers. As soon as a peer is done
│ │ │ │ +transferring the blocks that were requested from it, it is
│ │ │ │ +disconnected. This is a graceful shut down of the torrent in the sense
│ │ │ │ +that no downloaded bytes are wasted.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="flush_disk_cache"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bflush_disk_cache%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bflush_disk_cache%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>flush_disk_cache</dt>
│ │ │ │ +<dd>the disk cache will be flushed before creating the resume data.
│ │ │ │ +This avoids a problem with file timestamps in the resume data in
│ │ │ │ +case the cache hasn't been flushed yet.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="save_info_dict"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bsave_info_dict%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bsave_info_dict%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>save_info_dict</dt>
│ │ │ │ +<dd>the resume data will contain the metadata from the torrent file as
│ │ │ │ +well. This is useful for clients that don't keep .torrent files
│ │ │ │ +around separately, or for torrents that were added via a magnet link.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="only_if_modified"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bonly_if_modified%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bonly_if_modified%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>only_if_modified</dt>
│ │ │ │ +<dd>this flag has the same behavior as the combination of:
│ │ │ │ +if_counters_changed | if_download_progress | if_config_changed |
│ │ │ │ +if_state_changed | if_metadata_changed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="if_counters_changed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bif_counters_changed%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bif_counters_changed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>if_counters_changed</dt>
│ │ │ │ +<dd>save resume data if any <a class="reference external" href="reference-Stats.html#counters">counters</a> has changed since the last time
│ │ │ │ +resume data was saved. This includes upload/download <a class="reference external" href="reference-Stats.html#counters">counters</a>, active
│ │ │ │ +time <a class="reference external" href="reference-Stats.html#counters">counters</a> and scrape data. A torrent that is not paused will have
│ │ │ │ +its active time <a class="reference external" href="reference-Stats.html#counters">counters</a> incremented continuously.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="if_download_progress"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bif_download_progress%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bif_download_progress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>if_download_progress</dt>
│ │ │ │ +<dd>save the resume data if any blocks have been downloaded since the
│ │ │ │ +last time resume data was saved. This includes:
│ │ │ │ +* checking existing files on disk
│ │ │ │ +* downloading a block from a peer</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="if_config_changed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bif_config_changed%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bif_config_changed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>if_config_changed</dt>
│ │ │ │ +<dd>save the resume data if configuration options changed since last time
│ │ │ │ +the resume data was saved. This includes:
│ │ │ │ +* file- or piece priorities
│ │ │ │ +* upload- and download rate limits
│ │ │ │ +* change max-uploads (unchoke slots)
│ │ │ │ +* change max connection limit
│ │ │ │ +* enable/disable peer-exchange, local service discovery or DHT
│ │ │ │ +* enable/disable apply IP-filter
│ │ │ │ +* enable/disable auto-managed
│ │ │ │ +* enable/disable share-mode
│ │ │ │ +* enable/disable sequential-mode
│ │ │ │ +* files renamed
│ │ │ │ +* storage moved (save_path changed)</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="if_state_changed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bif_state_changed%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bif_state_changed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>if_state_changed</dt>
│ │ │ │ +<dd>save the resume data if torrent state has changed since last time the
│ │ │ │ +resume data was saved. This includes:
│ │ │ │ +* upload mode
│ │ │ │ +* paused state
│ │ │ │ +* super-seeding
│ │ │ │ +* seed-mode</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="if_metadata_changed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bif_metadata_changed%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bif_metadata_changed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>if_metadata_changed</dt>
│ │ │ │ +<dd>save the resume data if any <em>metadata</em> changed since the last time
│ │ │ │ +resume data was saved. This includes:
│ │ │ │ +* add/remove web seeds
│ │ │ │ +* add/remove trackers
│ │ │ │ +* receiving metadata for a magnet link</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="ignore_min_interval"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_handle%3A%3A%5Bignore_min_interval%5D&labels=documentation&body=Documentation+under+heading+%22torrent_handle%3A%3A%5Bignore_min_interval%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>ignore_min_interval</dt>
│ │ │ │ +<dd>by default, force-reannounce will still honor the min-interval
│ │ │ │ +published by the tracker. If this flag is set, it will be ignored
│ │ │ │ +and the tracker is announced immediately.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="hash_value()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hash_value%28%29&labels=documentation&body=Documentation+under+heading+%22hash_value%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="hash-value">
│ │ │ │ +<h1>hash_value()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_handle.hpp">libtorrent/torrent_handle.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::size_t <strong>hash_value</strong> (torrent_handle const&amp; h);
│ │ │ │ +</pre>
│ │ │ │ +<p>for std::hash (and to support using this type in unordered_map etc.)</p>
│ │ │ │ +<a name="session_proxy"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_proxy&labels=documentation&body=Documentation+under+heading+%22class+session_proxy%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="session-proxy">
│ │ │ │ +<h1>session_proxy</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session.hpp">libtorrent/session.hpp</a>&quot;</p>
│ │ │ │ +<p>this is a holder for the internal <a class="reference external" href="reference-Session.html#session">session</a> implementation object. Once the
│ │ │ │ +<a class="reference external" href="reference-Session.html#session">session</a> destruction is explicitly initiated, this holder is used to
│ │ │ │ +synchronize the completion of the shutdown. The lifetime of this object
│ │ │ │ +may outlive <a class="reference external" href="reference-Session.html#session">session</a>, causing the <a class="reference external" href="reference-Session.html#session">session</a> destructor to not block. The
│ │ │ │ +<a class="reference external" href="reference-Session.html#session_proxy">session_proxy</a> destructor will block however, until the underlying <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │ +is done shutting down.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct session_proxy
│ │ │ │ +{
│ │ │ │ +   <strong>session_proxy</strong> ();
│ │ │ │ +   session_proxy&amp; <strong>operator=</strong> (session_proxy const&amp;) &amp;;
│ │ │ │ +   <strong>~session_proxy</strong> ();
│ │ │ │ +   session_proxy&amp; <strong>operator=</strong> (session_proxy&amp;&amp;) &amp; noexcept;
│ │ │ │ +   <strong>session_proxy</strong> (session_proxy const&amp;);
│ │ │ │ +   <strong>session_proxy</strong> (session_proxy&amp;&amp;) noexcept;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="operator=()"></a>
│ │ │ │ +<a name="session_proxy()"></a>
│ │ │ │ +<a name="~session_proxy()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_proxy%3A%3A%5Boperator%3D%28%29+session_proxy%28%29+~session_proxy%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_proxy%3A%3A%5Boperator%3D%28%29+session_proxy%28%29+~session_proxy%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-session-proxy-session-proxy">
│ │ │ │ +<h2>operator=() session_proxy() ~session_proxy()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>session_proxy</strong> ();
│ │ │ │ +session_proxy&amp; <strong>operator=</strong> (session_proxy const&amp;) &amp;;
│ │ │ │ +<strong>~session_proxy</strong> ();
│ │ │ │ +session_proxy&amp; <strong>operator=</strong> (session_proxy&amp;&amp;) &amp; noexcept;
│ │ │ │ +<strong>session_proxy</strong> (session_proxy const&amp;);
│ │ │ │ +<strong>session_proxy</strong> (session_proxy&amp;&amp;) noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>default constructor, does not refer to any <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │ +implementation object.</p>
│ │ │ │ +<a name="session"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session&labels=documentation&body=Documentation+under+heading+%22class+session%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="session">
│ │ │ │ +<h1>session</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session.hpp">libtorrent/session.hpp</a>&quot;</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Session.html#session">session</a> holds all state that spans multiple torrents. Among other
│ │ │ │ +things it runs the network loop and manages all torrents. Once it's
│ │ │ │ +created, the <a class="reference external" href="reference-Session.html#session">session</a> object will spawn the main thread that will do all
│ │ │ │ +the work. The main thread will be idle as long it doesn't have any
│ │ │ │ +torrents to participate in.</p>
│ │ │ │ +<p>You have some control over <a class="reference external" href="reference-Session.html#session">session</a> configuration through the
│ │ │ │ +<tt class="docutils literal"><span class="pre">session_handle::apply_settings()</span></tt> member function. To change one or more
│ │ │ │ +configuration options, create a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>. object and fill it with
│ │ │ │ +the settings to be set and pass it in to <tt class="docutils literal"><span class="pre">session::apply_settings()</span></tt>.</p>
│ │ │ │ +<p>see <a class="reference external" href="reference-Session.html#apply_settings()">apply_settings()</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct session : session_handle
│ │ │ │ +{
│ │ │ │ +   <strong>session</strong> (session_params const&amp; params, session_flags_t flags);
│ │ │ │ +   <strong>session</strong> (session_params&amp;&amp; params, session_flags_t flags);
│ │ │ │ +   explicit <strong>session</strong> (session_params const&amp; params);
│ │ │ │ +   explicit <strong>session</strong> (session_params&amp;&amp; params);
│ │ │ │ +   <strong>session</strong> ();
│ │ │ │ +   <strong>session</strong> (session_params const&amp; params, io_context&amp; ios);
│ │ │ │ +   <strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │ +   <strong>session</strong> (session_params const&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │ +   <strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios);
│ │ │ │ +   <strong>~session</strong> ();
│ │ │ │ +   session_proxy <strong>abort</strong> ();
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="session()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session%3A%3A%5Bsession%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session%3A%3A%5Bsession%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="session-1">
│ │ │ │ +<h2>session()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>session</strong> (session_params const&amp; params, session_flags_t flags);
│ │ │ │ +<strong>session</strong> (session_params&amp;&amp; params, session_flags_t flags);
│ │ │ │ +explicit <strong>session</strong> (session_params const&amp; params);
│ │ │ │ +explicit <strong>session</strong> (session_params&amp;&amp; params);
│ │ │ │ +<strong>session</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>Constructs the <a class="reference external" href="reference-Session.html#session">session</a> objects which acts as the container of torrents.
│ │ │ │ +In order to avoid a race condition between starting the <a class="reference external" href="reference-Session.html#session">session</a> and
│ │ │ │ +configuring it, you can pass in a <a class="reference external" href="reference-Session.html#session_params">session_params</a> object. Its settings
│ │ │ │ +will take effect before the <a class="reference external" href="reference-Session.html#session">session</a> starts up.</p>
│ │ │ │ +<p>The overloads taking <tt class="docutils literal">flags</tt> can be used to start a <a class="reference external" href="reference-Session.html#session">session</a> in
│ │ │ │ +paused mode (by passing in <tt class="docutils literal"><span class="pre">session::paused</span></tt>). Note that
│ │ │ │ +<tt class="docutils literal">add_default_plugins</tt> do not have an affect on constructors that
│ │ │ │ +take a <a class="reference external" href="reference-Session.html#session_params">session_params</a> object. It already contains the plugins to use.</p>
│ │ │ │ +<a name="session()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session%3A%3A%5Bsession%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session%3A%3A%5Bsession%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="session-2">
│ │ │ │ +<h2>session()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>session</strong> (session_params const&amp; params, io_context&amp; ios);
│ │ │ │ +<strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │ +<strong>session</strong> (session_params const&amp; params, io_context&amp; ios, session_flags_t);
│ │ │ │ +<strong>session</strong> (session_params&amp;&amp; params, io_context&amp; ios);
│ │ │ │ +</pre>
│ │ │ │ +<p>Overload of the constructor that takes an external io_context to run
│ │ │ │ +the <a class="reference external" href="reference-Session.html#session">session</a> object on. This is primarily useful for tests that may want
│ │ │ │ +to run multiple sessions on a single io_context, or low resource
│ │ │ │ +systems where additional threads are expensive and sharing an
│ │ │ │ +io_context with other events is fine.</p>
│ │ │ │ +<div class="admonition warning">
│ │ │ │ +<p class="first admonition-title">Warning</p>
│ │ │ │ +<p class="last">The <a class="reference external" href="reference-Session.html#session">session</a> object does not cleanly terminate with an external
│ │ │ │ +<tt class="docutils literal">io_context</tt>. The <tt class="docutils literal"><span class="pre">io_context::run()</span></tt> call <em>must</em> have returned
│ │ │ │ +before it's safe to destruct the <a class="reference external" href="reference-Session.html#session">session</a>. Which means you <em>MUST</em>
│ │ │ │ +call <a class="reference external" href="reference-Session.html#abort()">session::abort()</a> and save the <a class="reference external" href="reference-Session.html#session_proxy">session_proxy</a> first, then
│ │ │ │ +destruct the <a class="reference external" href="reference-Session.html#session">session</a> object, then sync with the io_context, then
│ │ │ │ +destruct the <a class="reference external" href="reference-Session.html#session_proxy">session_proxy</a> object.</p>
│ │ │ │ +</div>
│ │ │ │ +<a name="~session()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session%3A%3A%5B~session%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session%3A%3A%5B~session%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="session-3">
│ │ │ │ +<h2>~session()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>~session</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>The destructor of <a class="reference external" href="reference-Session.html#session">session</a> will notify all trackers that our torrents
│ │ │ │ +have been shut down. If some trackers are down, they will time out.
│ │ │ │ +All this before the destructor of <a class="reference external" href="reference-Session.html#session">session</a> returns. So, it's advised
│ │ │ │ +that any kind of interface (such as windows) are closed before
│ │ │ │ +destructing the <a class="reference external" href="reference-Session.html#session">session</a> object. Because it can take a few second for
│ │ │ │ +it to finish. The timeout can be set with <a class="reference external" href="reference-Session.html#apply_settings()">apply_settings()</a>.</p>
│ │ │ │ +<a name="abort()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session%3A%3A%5Babort%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session%3A%3A%5Babort%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="abort-2">
│ │ │ │ +<h2>abort()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +session_proxy <strong>abort</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>In case you want to destruct the <a class="reference external" href="reference-Session.html#session">session</a> asynchronously, you can
│ │ │ │ +request a <a class="reference external" href="reference-Session.html#session">session</a> destruction proxy. If you don't do this, the
│ │ │ │ +destructor of the <a class="reference external" href="reference-Session.html#session">session</a> object will block while the trackers are
│ │ │ │ +contacted. If you keep one <tt class="docutils literal">session_proxy</tt> to the <a class="reference external" href="reference-Session.html#session">session</a> when
│ │ │ │ +destructing it, the destructor will not block, but start to close down
│ │ │ │ +the <a class="reference external" href="reference-Session.html#session">session</a>, the destructor of the proxy will then synchronize the
│ │ │ │ +threads. So, the destruction of the <a class="reference external" href="reference-Session.html#session">session</a> is performed from the
│ │ │ │ +<tt class="docutils literal">session</tt> destructor call until the <tt class="docutils literal">session_proxy</tt> destructor
│ │ │ │ +call. The <tt class="docutils literal">session_proxy</tt> does not have any operations on it (since
│ │ │ │ +the <a class="reference external" href="reference-Session.html#session">session</a> is being closed down, no operations are allowed on it).
│ │ │ │ +The only valid operation is calling the destructor:</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct session_proxy {};
│ │ │ │ +</pre>
│ │ │ │ +<a name="session_params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_params&labels=documentation&body=Documentation+under+heading+%22class+session_params%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="session-params">
│ │ │ │ +<h1>session_params</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_params.hpp">libtorrent/session_params.hpp</a>&quot;</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Session.html#session_params">session_params</a> is a parameters pack for configuring the <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │ +before it's started.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct session_params
│ │ │ │ +{
│ │ │ │ +   <strong>session_params</strong> ();
│ │ │ │ +   <strong>session_params</strong> (settings_pack&amp;&amp; sp);
│ │ │ │ +   <strong>session_params</strong> (settings_pack const&amp; sp);
│ │ │ │ +   <strong>session_params</strong> (settings_pack&amp;&amp; sp
│ │ │ │ +      , std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; exts);
│ │ │ │ +   <strong>session_params</strong> (settings_pack const&amp; sp
│ │ │ │ +      , std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; exts);
│ │ │ │ +
│ │ │ │ +   settings_pack settings;
│ │ │ │ +   std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; extensions;
│ │ │ │ +   dht::dht_state dht_state;
│ │ │ │ +   dht::dht_storage_constructor_type dht_storage_constructor;
│ │ │ │ +   disk_io_constructor_type disk_io_constructor;
│ │ │ │ +   std::map&lt;std::string, std::string&gt; ext_state;
│ │ │ │ +   libtorrent::ip_filter ip_filter;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="session_params()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bsession_params%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bsession_params%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="session-params-1">
│ │ │ │ +<h2>session_params()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>session_params</strong> ();
│ │ │ │ +<strong>session_params</strong> (settings_pack&amp;&amp; sp);
│ │ │ │ +<strong>session_params</strong> (settings_pack const&amp; sp);
│ │ │ │ +</pre>
│ │ │ │ +<p>This constructor can be used to start with the default plugins
│ │ │ │ +(ut_metadata, ut_pex and smart_ban). Pass a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> to set the
│ │ │ │ +initial settings when the <a class="reference external" href="reference-Session.html#session">session</a> starts.</p>
│ │ │ │ +<a name="session_params()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bsession_params%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bsession_params%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="session-params-2">
│ │ │ │ +<h2>session_params()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>session_params</strong> (settings_pack&amp;&amp; sp
│ │ │ │ +      , std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; exts);
│ │ │ │ +<strong>session_params</strong> (settings_pack const&amp; sp
│ │ │ │ +      , std::vector&lt;std::shared_ptr&lt;plugin&gt;&gt; exts);
│ │ │ │ +</pre>
│ │ │ │ +<p>This constructor helps to configure the set of initial plugins
│ │ │ │ +to be added to the <a class="reference external" href="reference-Session.html#session">session</a> before it's started.</p>
│ │ │ │ +<a name="settings"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bsettings%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bsettings%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>settings</dt>
│ │ │ │ +<dd>The settings to configure the <a class="reference external" href="reference-Session.html#session">session</a> with</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="extensions"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bextensions%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bextensions%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>extensions</dt>
│ │ │ │ +<dd>the plugins to add to the <a class="reference external" href="reference-Session.html#session">session</a> as it is constructed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bdht_state%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bdht_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>dht_state</dt>
│ │ │ │ +<dd>DHT node ID and node addresses to bootstrap the DHT with.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_storage_constructor"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bdht_storage_constructor%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bdht_storage_constructor%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>dht_storage_constructor</dt>
│ │ │ │ +<dd>function object to construct the storage object for DHT items.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="disk_io_constructor"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bdisk_io_constructor%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bdisk_io_constructor%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>disk_io_constructor</dt>
│ │ │ │ +<dd>function object to create the disk I/O subsystem. Defaults to
│ │ │ │ +default_disk_io_constructor.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="ext_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bext_state%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bext_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>ext_state</dt>
│ │ │ │ +<dd>this container can be used by extensions/plugins to store settings. It's
│ │ │ │ +primarily here to make it convenient to save and restore state across
│ │ │ │ +sessions, using <a class="reference external" href="reference-Session.html#read_session_params()">read_session_params()</a> and <a class="reference external" href="reference-Session.html#write_session_params()">write_session_params()</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="ip_filter"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_params%3A%3A%5Bip_filter%5D&labels=documentation&body=Documentation+under+heading+%22session_params%3A%3A%5Bip_filter%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>ip_filter</dt>
│ │ │ │ +<dd>the IP filter to use for the <a class="reference external" href="reference-Session.html#session">session</a>. This restricts which peers are allowed
│ │ │ │ +to connect. As if passed to <a class="reference external" href="reference-Session.html#set_ip_filter()">set_ip_filter()</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="session_handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_handle&labels=documentation&body=Documentation+under+heading+%22class+session_handle%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="session-handle">
│ │ │ │ +<h1>session_handle</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_handle.hpp">libtorrent/session_handle.hpp</a>&quot;</p>
│ │ │ │ +<p>this class provides a non-owning handle to a <a class="reference external" href="reference-Session.html#session">session</a> and a subset of the
│ │ │ │ +interface of the <a class="reference external" href="reference-Session.html#session">session</a> class. If the underlying <a class="reference external" href="reference-Session.html#session">session</a> is destructed
│ │ │ │ +any handle to it will no longer be valid. <a class="reference external" href="reference-Session.html#is_valid()">is_valid()</a> will return false and
│ │ │ │ +any operation on it will throw a system_error exception, with error code
│ │ │ │ +invalid_session_handle.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct session_handle
│ │ │ │ +{
│ │ │ │ +   bool <strong>is_valid</strong> () const;
│ │ │ │ +   session_params <strong>session_state</strong> (save_state_flags_t flags = save_state_flags_t::all()) const;
│ │ │ │ +   void <strong>refresh_torrent_status</strong> (std::vector&lt;torrent_status&gt;* ret
│ │ │ │ +      , status_flags_t flags = {}) const;
│ │ │ │ +   std::vector&lt;torrent_status&gt; <strong>get_torrent_status</strong> (
│ │ │ │ +      std::function&lt;bool(torrent_status const&amp;)&gt; const&amp; pred
│ │ │ │ +      , status_flags_t flags = {}) const;
│ │ │ │ +   void <strong>post_torrent_updates</strong> (status_flags_t flags = status_flags_t::all());
│ │ │ │ +   void <strong>post_session_stats</strong> ();
│ │ │ │ +   void <strong>post_dht_stats</strong> ();
│ │ │ │ +   void <strong>set_dht_state</strong> (dht::dht_state const&amp; st);
│ │ │ │ +   void <strong>set_dht_state</strong> (dht::dht_state&amp;&amp; st);
│ │ │ │ +   std::vector&lt;torrent_handle&gt; <strong>get_torrents</strong> () const;
│ │ │ │ +   torrent_handle <strong>find_torrent</strong> (sha1_hash const&amp; info_hash) const;
│ │ │ │ +   torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params, error_code&amp; ec);
│ │ │ │ +   torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params, error_code&amp; ec);
│ │ │ │ +   void <strong>async_add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ +   torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ +   void <strong>async_add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │ +   torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │ +   void <strong>resume</strong> ();
│ │ │ │ +   void <strong>pause</strong> ();
│ │ │ │ +   bool <strong>is_paused</strong> () const;
│ │ │ │ +   bool <strong>is_dht_running</strong> () const;
│ │ │ │ +   void <strong>set_dht_storage</strong> (dht::dht_storage_constructor_type sc);
│ │ │ │ +   void <strong>add_dht_node</strong> (std::pair&lt;std::string, int&gt; const&amp; node);
│ │ │ │ +   void <strong>dht_get_item</strong> (sha1_hash const&amp; target);
│ │ │ │ +   void <strong>dht_get_item</strong> (std::array&lt;char, 32&gt; key
│ │ │ │ +      , std::string salt = std::string());
│ │ │ │ +   sha1_hash <strong>dht_put_item</strong> (entry data);
│ │ │ │ +   void <strong>dht_put_item</strong> (std::array&lt;char, 32&gt; key
│ │ │ │ +      , std::function&lt;void(entry&amp;, std::array&lt;char, 64&gt;&amp;
│ │ │ │ +      , std::int64_t&amp;, std::string const&amp;)&gt; cb
│ │ │ │ +      , std::string salt = std::string());
│ │ │ │ +   void <strong>dht_get_peers</strong> (sha1_hash const&amp; info_hash);
│ │ │ │ +   void <strong>dht_announce</strong> (sha1_hash const&amp; info_hash, int port = 0, dht::announce_flags_t flags = {});
│ │ │ │ +   void <strong>dht_live_nodes</strong> (sha1_hash const&amp; nid);
│ │ │ │ +   void <strong>dht_sample_infohashes</strong> (udp::endpoint const&amp; ep, sha1_hash const&amp; target);
│ │ │ │ +   void <strong>dht_direct_request</strong> (udp::endpoint const&amp; ep, entry const&amp; e, client_data_t userdata = {});
│ │ │ │ +   void <strong>add_extension</strong> (std::shared_ptr&lt;plugin&gt; ext);
│ │ │ │ +   void <strong>add_extension</strong> (std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(
│ │ │ │ +      torrent_handle const&amp;, client_data_t)&gt; ext);
│ │ │ │ +   void <strong>set_ip_filter</strong> (ip_filter f);
│ │ │ │ +   ip_filter <strong>get_ip_filter</strong> () const;
│ │ │ │ +   void <strong>set_port_filter</strong> (port_filter const&amp; f);
│ │ │ │ +   unsigned short <strong>ssl_listen_port</strong> () const;
│ │ │ │ +   bool <strong>is_listening</strong> () const;
│ │ │ │ +   unsigned short <strong>listen_port</strong> () const;
│ │ │ │ +   ip_filter <strong>get_peer_class_filter</strong> () const;
│ │ │ │ +   void <strong>set_peer_class_filter</strong> (ip_filter const&amp; f);
│ │ │ │ +   peer_class_type_filter <strong>get_peer_class_type_filter</strong> () const;
│ │ │ │ +   void <strong>set_peer_class_type_filter</strong> (peer_class_type_filter const&amp; f);
│ │ │ │ +   peer_class_t <strong>create_peer_class</strong> (char const* name);
│ │ │ │ +   void <strong>delete_peer_class</strong> (peer_class_t cid);
│ │ │ │ +   void <strong>set_peer_class</strong> (peer_class_t cid, peer_class_info const&amp; pci);
│ │ │ │ +   peer_class_info <strong>get_peer_class</strong> (peer_class_t cid) const;
│ │ │ │ +   void <strong>remove_torrent</strong> (const torrent_handle&amp;, remove_flags_t = {});
│ │ │ │ +   void <strong>apply_settings</strong> (settings_pack&amp;&amp;);
│ │ │ │ +   void <strong>apply_settings</strong> (settings_pack const&amp;);
│ │ │ │ +   settings_pack <strong>get_settings</strong> () const;
│ │ │ │ +   void <strong>set_alert_notify</strong> (std::function&lt;void()&gt; const&amp; fun);
│ │ │ │ +   alert* <strong>wait_for_alert</strong> (time_duration max_wait);
│ │ │ │ +   void <strong>pop_alerts</strong> (std::vector&lt;alert*&gt;* alerts);
│ │ │ │ +   std::vector&lt;port_mapping_t&gt; <strong>add_port_mapping</strong> (portmap_protocol t, int external_port, int local_port);
│ │ │ │ +   void <strong>delete_port_mapping</strong> (port_mapping_t handle);
│ │ │ │ +   void <strong>reopen_network_sockets</strong> (reopen_network_flags_t options = reopen_map_ports);
│ │ │ │ +   std::shared_ptr&lt;aux::session_impl&gt; <strong>native_handle</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr save_state_flags_t <strong>save_settings</strong>  = 0_bit;
│ │ │ │ +   static constexpr save_state_flags_t <strong>save_dht_state</strong>  = 2_bit;
│ │ │ │ +   static constexpr save_state_flags_t <strong>save_extension_state</strong>  = 11_bit;
│ │ │ │ +   static constexpr save_state_flags_t <strong>save_ip_filter</strong>  = 12_bit;
│ │ │ │ +   static constexpr peer_class_t <strong>global_peer_class_id</strong> {0};
│ │ │ │ +   static constexpr peer_class_t <strong>tcp_peer_class_id</strong> {1};
│ │ │ │ +   static constexpr peer_class_t <strong>local_peer_class_id</strong> {2};
│ │ │ │ +   static constexpr remove_flags_t <strong>delete_files</strong>  = 0_bit;
│ │ │ │ +   static constexpr remove_flags_t <strong>delete_partfile</strong>  = 1_bit;
│ │ │ │ +   static constexpr session_flags_t <strong>paused</strong>  = 2_bit;
│ │ │ │ +   static constexpr portmap_protocol <strong>udp</strong>  = portmap_protocol::udp;
│ │ │ │ +   static constexpr portmap_protocol <strong>tcp</strong>  = portmap_protocol::tcp;
│ │ │ │ +   static constexpr reopen_network_flags_t <strong>reopen_map_ports</strong>  = 0_bit;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="is_valid()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bis_valid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bis_valid%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="is-valid-2">
│ │ │ │ +<h2>is_valid()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>is_valid</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if this handle refers to a valid <a class="reference external" href="reference-Session.html#session">session</a> object. If the
│ │ │ │ +<a class="reference external" href="reference-Session.html#session">session</a> has been destroyed, all <a class="reference external" href="reference-Session.html#session_handle">session_handle</a> objects will expire and
│ │ │ │ +not be valid.</p>
│ │ │ │ +<a name="session_state()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bsession_state%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bsession_state%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="session-state">
│ │ │ │ +<h2>session_state()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +session_params <strong>session_state</strong> (save_state_flags_t flags = save_state_flags_t::all()) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the current <a class="reference external" href="reference-Session.html#session">session</a> state. This can be passed to
│ │ │ │ +<a class="reference external" href="reference-Session.html#write_session_params()">write_session_params()</a> to save the state to disk and restored using
│ │ │ │ +<a class="reference external" href="reference-Session.html#read_session_params()">read_session_params()</a> when constructing a new <a class="reference external" href="reference-Session.html#session">session</a>. The kind of
│ │ │ │ +state that's included is all settings, the DHT routing table, possibly
│ │ │ │ +plugin-specific state.
│ │ │ │ +the flags parameter can be used to only save certain parts of the
│ │ │ │ +<a class="reference external" href="reference-Session.html#session">session</a> state</p>
│ │ │ │ +<a name="get_torrent_status()"></a>
│ │ │ │ +<a name="refresh_torrent_status()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bget_torrent_status%28%29+refresh_torrent_status%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bget_torrent_status%28%29+refresh_torrent_status%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-torrent-status-refresh-torrent-status">
│ │ │ │ +<h2>get_torrent_status() refresh_torrent_status()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>refresh_torrent_status</strong> (std::vector&lt;torrent_status&gt;* ret
│ │ │ │ +      , status_flags_t flags = {}) const;
│ │ │ │ +std::vector&lt;torrent_status&gt; <strong>get_torrent_status</strong> (
│ │ │ │ +      std::function&lt;bool(torrent_status const&amp;)&gt; const&amp; pred
│ │ │ │ +      , status_flags_t flags = {}) const;
│ │ │ │ +</pre>
│ │ │ │ +<div class="admonition note">
│ │ │ │ +<p class="first admonition-title">Note</p>
│ │ │ │ +<p class="last">these calls are potentially expensive and won't scale well with
│ │ │ │ +lots of torrents. If you're concerned about performance, consider
│ │ │ │ +using <tt class="docutils literal">post_torrent_updates()</tt> instead.</p>
│ │ │ │ +</div>
│ │ │ │ +<p><tt class="docutils literal">get_torrent_status</tt> returns a vector of the <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> for
│ │ │ │ +every torrent which satisfies <tt class="docutils literal">pred</tt>, which is a predicate function
│ │ │ │ +which determines if a torrent should be included in the returned set
│ │ │ │ +or not. Returning true means it should be included and false means
│ │ │ │ +excluded. The <tt class="docutils literal">flags</tt> argument is the same as to
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a>. Since <tt class="docutils literal">pred</tt> is guaranteed to be
│ │ │ │ +called for every torrent, it may be used to count the number of
│ │ │ │ +torrents of different categories as well.</p>
│ │ │ │ +<p><tt class="docutils literal">refresh_torrent_status</tt> takes a vector of <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> structs
│ │ │ │ +(for instance the same vector that was returned by
│ │ │ │ +<a class="reference external" href="reference-Session.html#get_torrent_status()">get_torrent_status()</a> ) and refreshes the status based on the
│ │ │ │ +<tt class="docutils literal">handle</tt> member. It is possible to use this function by first
│ │ │ │ +setting up a vector of default constructed <tt class="docutils literal">torrent_status</tt> objects,
│ │ │ │ +only initializing the <tt class="docutils literal">handle</tt> member, in order to request the
│ │ │ │ +torrent status for multiple torrents in a single call. This can save a
│ │ │ │ +significant amount of time if you have a lot of torrents.</p>
│ │ │ │ +<p>Any <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a> object whose <tt class="docutils literal">handle</tt> member is not referring to
│ │ │ │ +a valid torrent are ignored.</p>
│ │ │ │ +<p>The intended use of these functions is to start off by calling
│ │ │ │ +<tt class="docutils literal">get_torrent_status()</tt> to get a list of all torrents that match your
│ │ │ │ +criteria. Then call <tt class="docutils literal">refresh_torrent_status()</tt> on that list. This
│ │ │ │ +will only refresh the status for the torrents in your list, and thus
│ │ │ │ +ignore all other torrents you might be running. This may save a
│ │ │ │ +significant amount of time, especially if the number of torrents you're
│ │ │ │ +interested in is small. In order to keep your list of interested
│ │ │ │ +torrents up to date, you can either call <tt class="docutils literal">get_torrent_status()</tt> from
│ │ │ │ +time to time, to include torrents you might have become interested in
│ │ │ │ +since the last time. In order to stop refreshing a certain torrent,
│ │ │ │ +simply remove it from the list.</p>
│ │ │ │ +<a name="post_torrent_updates()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bpost_torrent_updates%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bpost_torrent_updates%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="post-torrent-updates">
│ │ │ │ +<h2>post_torrent_updates()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>post_torrent_updates</strong> (status_flags_t flags = status_flags_t::all());
│ │ │ │ +</pre>
│ │ │ │ +<p>This functions instructs the <a class="reference external" href="reference-Session.html#session">session</a> to post the <a class="reference external" href="reference-Alerts.html#state_update_alert">state_update_alert</a>,
│ │ │ │ +containing the status of all torrents whose state changed since the
│ │ │ │ +last time this function was called.</p>
│ │ │ │ +<p>Only torrents who has the state subscription flag set will be
│ │ │ │ +included. This flag is on by default. See <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>.
│ │ │ │ +the <tt class="docutils literal">flags</tt> argument is the same as for <a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a>.
│ │ │ │ +see status_flags_t in <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>.</p>
│ │ │ │ +<a name="post_session_stats()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bpost_session_stats%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bpost_session_stats%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="post-session-stats">
│ │ │ │ +<h2>post_session_stats()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>post_session_stats</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>This function will post a <a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a> object, containing a
│ │ │ │ +snapshot of the performance <a class="reference external" href="reference-Stats.html#counters">counters</a> from the internals of libtorrent.
│ │ │ │ +To interpret these <a class="reference external" href="reference-Stats.html#counters">counters</a>, query the <a class="reference external" href="reference-Session.html#session">session</a> via
│ │ │ │ +<a class="reference external" href="reference-Stats.html#session_stats_metrics()">session_stats_metrics()</a>.</p>
│ │ │ │ +<p>For more information, see the <a class="reference external" href="manual-ref.html#session-statistics">session statistics</a> section.</p>
│ │ │ │ +<a name="post_dht_stats()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bpost_dht_stats%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bpost_dht_stats%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="post-dht-stats">
│ │ │ │ +<h2>post_dht_stats()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>post_dht_stats</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>This will cause a <a class="reference external" href="reference-Alerts.html#dht_stats_alert">dht_stats_alert</a> to be posted.</p>
│ │ │ │ +<a name="set_dht_state()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_dht_state%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_dht_state%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-dht-state">
│ │ │ │ +<h2>set_dht_state()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_dht_state</strong> (dht::dht_state const&amp; st);
│ │ │ │ +void <strong>set_dht_state</strong> (dht::dht_state&amp;&amp; st);
│ │ │ │ +</pre>
│ │ │ │ +<p>set the DHT state for the <a class="reference external" href="reference-Session.html#session">session</a>. This will be taken into account the
│ │ │ │ +next time the DHT is started, as if it had been passed in via the
│ │ │ │ +<a class="reference external" href="reference-Session.html#session_params">session_params</a> on startup.</p>
│ │ │ │ +<a name="find_torrent()"></a>
│ │ │ │ +<a name="get_torrents()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bfind_torrent%28%29+get_torrents%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bfind_torrent%28%29+get_torrents%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="find-torrent-get-torrents">
│ │ │ │ +<h2>find_torrent() get_torrents()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;torrent_handle&gt; <strong>get_torrents</strong> () const;
│ │ │ │ +torrent_handle <strong>find_torrent</strong> (sha1_hash const&amp; info_hash) const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">find_torrent()</tt> looks for a torrent with the given info-hash. In
│ │ │ │ +case there is such a torrent in the <a class="reference external" href="reference-Session.html#session">session</a>, a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> to that
│ │ │ │ +torrent is returned. In case the torrent cannot be found, an invalid
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is returned.</p>
│ │ │ │ +<p>See <tt class="docutils literal"><span class="pre">torrent_handle::is_valid()</span></tt> to know if the torrent was found or
│ │ │ │ +not.</p>
│ │ │ │ +<p><tt class="docutils literal">get_torrents()</tt> returns a vector of torrent_handles to all the
│ │ │ │ +torrents currently in the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │ +<a name="async_add_torrent()"></a>
│ │ │ │ +<a name="add_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Basync_add_torrent%28%29+add_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Basync_add_torrent%28%29+add_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="async-add-torrent-add-torrent">
│ │ │ │ +<h2>async_add_torrent() add_torrent()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params, error_code&amp; ec);
│ │ │ │ +torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params, error_code&amp; ec);
│ │ │ │ +void <strong>async_add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ +torrent_handle <strong>add_torrent</strong> (add_torrent_params&amp;&amp; params);
│ │ │ │ +void <strong>async_add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │ +torrent_handle <strong>add_torrent</strong> (add_torrent_params const&amp; params);
│ │ │ │ +</pre>
│ │ │ │ +<p>You add torrents through the <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> function where you give an
│ │ │ │ +object with all the parameters. The <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> overloads will block
│ │ │ │ +until the torrent has been added (or failed to be added) and returns
│ │ │ │ +an error code and a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a>. In order to add torrents more
│ │ │ │ +efficiently, consider using <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a> which returns
│ │ │ │ +immediately, without waiting for the torrent to add. Notification of
│ │ │ │ +the torrent being added is sent as <a class="reference external" href="reference-Alerts.html#add_torrent_alert">add_torrent_alert</a>.</p>
│ │ │ │ +<p>The <tt class="docutils literal">save_path</tt> field in <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> must be set to a valid
│ │ │ │ +path where the files for the torrent will be saved. Even when using a
│ │ │ │ +custom storage, this needs to be set to something. If the save_path
│ │ │ │ +is empty, the call to <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> will throw a system_error
│ │ │ │ +exception.</p>
│ │ │ │ +<p>The overload that does not take an error_code throws an exception on
│ │ │ │ +error and is not available when building without exception support.
│ │ │ │ +The <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> returned by <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> can be used to retrieve
│ │ │ │ +information about the torrent's progress, its peers etc. It is also
│ │ │ │ +used to abort a torrent.</p>
│ │ │ │ +<p>If the torrent you are trying to add already exists in the <a class="reference external" href="reference-Session.html#session">session</a> (is
│ │ │ │ +either queued for checking, being checked or downloading)
│ │ │ │ +<tt class="docutils literal">add_torrent()</tt> will throw system_error which derives from
│ │ │ │ +<tt class="docutils literal"><span class="pre">std::exception</span></tt> unless duplicate_is_error is set to false. In that
│ │ │ │ +case, <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> will return the handle to the existing torrent.</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> class has a flags field. It can be used to
│ │ │ │ +control what state the new torrent will be added in. Common flags to
│ │ │ │ +want to control are torrent_flags::paused and
│ │ │ │ +torrent_flags::auto_managed. In order to add a magnet link that will
│ │ │ │ +just download the metadata, but no payload, set the
│ │ │ │ +torrent_flags::upload_mode flag.</p>
│ │ │ │ +<p>Special consideration has to be taken when adding hybrid torrents
│ │ │ │ +(i.e. torrents that are BitTorrent v2 torrents that are backwards
│ │ │ │ +compatible with v1). For more details, see <a class="reference external" href="manual-ref.html#bittorrent-v2-torrents">BitTorrent v2 torrents</a>.</p>
│ │ │ │ +<a name="is_paused()"></a>
│ │ │ │ +<a name="pause()"></a>
│ │ │ │ +<a name="resume()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bis_paused%28%29+pause%28%29+resume%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bis_paused%28%29+pause%28%29+resume%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="is-paused-pause-resume">
│ │ │ │ +<h2>is_paused() pause() resume()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>resume</strong> ();
│ │ │ │ +void <strong>pause</strong> ();
│ │ │ │ +bool <strong>is_paused</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Pausing the <a class="reference external" href="reference-Session.html#session">session</a> has the same effect as pausing every torrent in
│ │ │ │ +it, except that torrents will not be resumed by the auto-manage
│ │ │ │ +mechanism. Resuming will restore the torrents to their previous paused
│ │ │ │ +state. i.e. the <a class="reference external" href="reference-Session.html#session">session</a> pause state is separate from the torrent pause
│ │ │ │ +state. A torrent is inactive if it is paused or if the <a class="reference external" href="reference-Session.html#session">session</a> is
│ │ │ │ +paused.</p>
│ │ │ │ +<a name="is_dht_running()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bis_dht_running%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bis_dht_running%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="is-dht-running">
│ │ │ │ +<h2>is_dht_running()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>is_dht_running</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">is_dht_running()</tt> returns true if the DHT support has been started
│ │ │ │ +and false otherwise.</p>
│ │ │ │ +<a name="set_dht_storage()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_dht_storage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_dht_storage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-dht-storage">
│ │ │ │ +<h2>set_dht_storage()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_dht_storage</strong> (dht::dht_storage_constructor_type sc);
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">set_dht_storage</tt> set a dht custom storage constructor function
│ │ │ │ +to be used internally when the dht is created.</p>
│ │ │ │ +<p>Since the dht storage is a critical component for the dht behavior,
│ │ │ │ +this function will only be effective the next time the dht is started.
│ │ │ │ +If you never touch this feature, a default map-memory based storage
│ │ │ │ +is used.</p>
│ │ │ │ +<p>If you want to make sure the dht is initially created with your
│ │ │ │ +custom storage, create a <a class="reference external" href="reference-Session.html#session">session</a> with the setting
│ │ │ │ +<tt class="docutils literal"><span class="pre">settings_pack::enable_dht</span></tt> to false, set your constructor function
│ │ │ │ +and call <tt class="docutils literal">apply_settings</tt> with <tt class="docutils literal"><span class="pre">settings_pack::enable_dht</span></tt> to true.</p>
│ │ │ │ +<a name="add_dht_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Badd_dht_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Badd_dht_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-dht-node">
│ │ │ │ +<h2>add_dht_node()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_dht_node</strong> (std::pair&lt;std::string, int&gt; const&amp; node);
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">add_dht_node</tt> takes a host name and port pair. That endpoint will be
│ │ │ │ +pinged, and if a valid DHT reply is received, the node will be added to
│ │ │ │ +the routing table.</p>
│ │ │ │ +<a name="dht_get_item()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_get_item%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_get_item%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-get-item">
│ │ │ │ +<h2>dht_get_item()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>dht_get_item</strong> (sha1_hash const&amp; target);
│ │ │ │ +</pre>
│ │ │ │ +<p>query the DHT for an immutable item at the <tt class="docutils literal">target</tt> hash.
│ │ │ │ +the result is posted as a <a class="reference external" href="reference-Alerts.html#dht_immutable_item_alert">dht_immutable_item_alert</a>.</p>
│ │ │ │ +<a name="dht_get_item()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_get_item%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_get_item%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-get-item-1">
│ │ │ │ +<h2>dht_get_item()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>dht_get_item</strong> (std::array&lt;char, 32&gt; key
│ │ │ │ +      , std::string salt = std::string());
│ │ │ │ +</pre>
│ │ │ │ +<p>query the DHT for a mutable item under the public key <tt class="docutils literal">key</tt>.
│ │ │ │ +this is an ed25519 key. <tt class="docutils literal">salt</tt> is optional and may be left
│ │ │ │ +as an empty string if no salt is to be used.
│ │ │ │ +if the item is found in the DHT, a <a class="reference external" href="reference-Alerts.html#dht_mutable_item_alert">dht_mutable_item_alert</a> is
│ │ │ │ +posted.</p>
│ │ │ │ +<a name="dht_put_item()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_put_item%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_put_item%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-put-item">
│ │ │ │ +<h2>dht_put_item()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +sha1_hash <strong>dht_put_item</strong> (entry data);
│ │ │ │ +</pre>
│ │ │ │ +<p>store the given bencoded data as an immutable item in the DHT.
│ │ │ │ +the returned hash is the key that is to be used to look the item
│ │ │ │ +up again. It's just the SHA-1 hash of the bencoded form of the
│ │ │ │ +structure.</p>
│ │ │ │ +<a name="dht_put_item()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_put_item%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_put_item%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-put-item-1">
│ │ │ │ +<h2>dht_put_item()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>dht_put_item</strong> (std::array&lt;char, 32&gt; key
│ │ │ │ +      , std::function&lt;void(entry&amp;, std::array&lt;char, 64&gt;&amp;
│ │ │ │ +      , std::int64_t&amp;, std::string const&amp;)&gt; cb
│ │ │ │ +      , std::string salt = std::string());
│ │ │ │ +</pre>
│ │ │ │ +<p>store a mutable item. The <tt class="docutils literal">key</tt> is the public key the blob is
│ │ │ │ +to be stored under. The optional <tt class="docutils literal">salt</tt> argument is a string that
│ │ │ │ +is to be mixed in with the key when determining where in the DHT
│ │ │ │ +the value is to be stored. The callback function is called from within
│ │ │ │ +the libtorrent network thread once we've found where to store the blob,
│ │ │ │ +possibly with the current value stored under the key.
│ │ │ │ +The values passed to the callback functions are:</p>
│ │ │ │ +<dl class="docutils">
│ │ │ │ +<dt>entry&amp; value</dt>
│ │ │ │ +<dd>the current value stored under the key (may be empty). Also expected
│ │ │ │ +to be set to the value to be stored by the function.</dd>
│ │ │ │ +<dt>std::array&lt;char,64&gt;&amp; signature</dt>
│ │ │ │ +<dd>the signature authenticating the current value. This may be zeros
│ │ │ │ +if there is currently no value stored. The function is expected to
│ │ │ │ +fill in this buffer with the signature of the new value to store.
│ │ │ │ +To generate the signature, you may want to use the
│ │ │ │ +<tt class="docutils literal">sign_mutable_item</tt> function.</dd>
│ │ │ │ +<dt>std::int64_t&amp; seq</dt>
│ │ │ │ +<dd>current sequence number. May be zero if there is no current value.
│ │ │ │ +The function is expected to set this to the new sequence number of
│ │ │ │ +the value that is to be stored. Sequence numbers must be monotonically
│ │ │ │ +increasing. Attempting to overwrite a value with a lower or equal
│ │ │ │ +sequence number will fail, even if the signature is correct.</dd>
│ │ │ │ +<dt>std::string const&amp; salt</dt>
│ │ │ │ +<dd>this is the salt that was used for this put call.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<p>Since the callback function <tt class="docutils literal">cb</tt> is called from within libtorrent,
│ │ │ │ +it is critical to not perform any blocking operations. Ideally not
│ │ │ │ +even locking a mutex. Pass any data required for this function along
│ │ │ │ +with the function object's context and make the function entirely
│ │ │ │ +self-contained. The only reason data blob's value is computed
│ │ │ │ +via a function instead of just passing in the new value is to avoid
│ │ │ │ +race conditions. If you want to <em>update</em> the value in the DHT, you
│ │ │ │ +must first retrieve it, then modify it, then write it back. The way
│ │ │ │ +the DHT works, it is natural to always do a lookup before storing and
│ │ │ │ +calling the callback in between is convenient.</p>
│ │ │ │ +<a name="dht_announce()"></a>
│ │ │ │ +<a name="dht_get_peers()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_announce%28%29+dht_get_peers%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_announce%28%29+dht_get_peers%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-announce-dht-get-peers">
│ │ │ │ +<h2>dht_announce() dht_get_peers()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>dht_get_peers</strong> (sha1_hash const&amp; info_hash);
│ │ │ │ +void <strong>dht_announce</strong> (sha1_hash const&amp; info_hash, int port = 0, dht::announce_flags_t flags = {});
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">dht_get_peers()</tt> will issue a DHT get_peer request to the DHT for the
│ │ │ │ +specified info-hash. The response (the peers) will be posted back in a
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#dht_get_peers_reply_alert">dht_get_peers_reply_alert</a>.</p>
│ │ │ │ +<p><tt class="docutils literal">dht_announce()</tt> will issue a DHT announce request to the DHT to the
│ │ │ │ +specified info-hash, advertising the specified port. If the port is
│ │ │ │ +left at its default, 0, the port will be implied by the DHT message's
│ │ │ │ +source port (which may improve connectivity through a NAT).
│ │ │ │ +<tt class="docutils literal">dht_announce()</tt> is not affected by the <tt class="docutils literal">announce_port</tt> override setting.</p>
│ │ │ │ +<p>Both these functions are exposed for advanced custom use of the DHT.
│ │ │ │ +All torrents eligible to be announce to the DHT will be automatically,
│ │ │ │ +by libtorrent.</p>
│ │ │ │ +<p>For possible flags, see <a class="reference external" href="reference-DHT.html#announce_flags_t">announce_flags_t</a>.</p>
│ │ │ │ +<a name="dht_live_nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_live_nodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_live_nodes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-live-nodes">
│ │ │ │ +<h2>dht_live_nodes()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>dht_live_nodes</strong> (sha1_hash const&amp; nid);
│ │ │ │ +</pre>
│ │ │ │ +<p>Retrieve all the live DHT (identified by <tt class="docutils literal">nid</tt>) nodes. All the
│ │ │ │ +nodes id and endpoint will be returned in the list of nodes in the
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#alert">alert</a> <tt class="docutils literal">dht_live_nodes_alert</tt>.
│ │ │ │ +Since this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is a response to an explicit call, it will always be
│ │ │ │ +posted, regardless of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
│ │ │ │ +<a name="dht_sample_infohashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_sample_infohashes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_sample_infohashes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-sample-infohashes">
│ │ │ │ +<h2>dht_sample_infohashes()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>dht_sample_infohashes</strong> (udp::endpoint const&amp; ep, sha1_hash const&amp; target);
│ │ │ │ +</pre>
│ │ │ │ +<p>Query the DHT node specified by <tt class="docutils literal">ep</tt> to retrieve a sample of the
│ │ │ │ +info-hashes that the node currently have in their storage.
│ │ │ │ +The <tt class="docutils literal">target</tt> is included for iterative lookups so that indexing nodes
│ │ │ │ +can perform a key space traversal with a single RPC per node by adjusting
│ │ │ │ +the target value for each RPC. It has no effect on the returned sample value.
│ │ │ │ +The result is posted as a <tt class="docutils literal">dht_sample_infohashes_alert</tt>.</p>
│ │ │ │ +<a name="dht_direct_request()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdht_direct_request%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdht_direct_request%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-direct-request">
│ │ │ │ +<h2>dht_direct_request()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>dht_direct_request</strong> (udp::endpoint const&amp; ep, entry const&amp; e, client_data_t userdata = {});
│ │ │ │ +</pre>
│ │ │ │ +<p>Send an arbitrary DHT request directly to the specified endpoint. This
│ │ │ │ +function is intended for use by plugins. When a response is received
│ │ │ │ +or the request times out, a <a class="reference external" href="reference-Alerts.html#dht_direct_response_alert">dht_direct_response_alert</a> will be posted
│ │ │ │ +with the response (if any) and the userdata pointer passed in here.
│ │ │ │ +Since this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is a response to an explicit call, it will always be
│ │ │ │ +posted, regardless of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
│ │ │ │ +<a name="add_extension()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Badd_extension%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Badd_extension%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-extension-1">
│ │ │ │ +<h2>add_extension()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_extension</strong> (std::shared_ptr&lt;plugin&gt; ext);
│ │ │ │ +void <strong>add_extension</strong> (std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(
│ │ │ │ +      torrent_handle const&amp;, client_data_t)&gt; ext);
│ │ │ │ +</pre>
│ │ │ │ +<p>This function adds an extension to this <a class="reference external" href="reference-Session.html#session">session</a>. The argument is a
│ │ │ │ +function object that is called with a <tt class="docutils literal">torrent_handle</tt> and which should
│ │ │ │ +return a <tt class="docutils literal"><span class="pre">std::shared_ptr&lt;torrent_plugin&gt;</span></tt>. To write custom
│ │ │ │ +plugins, see <a class="reference external" href="reference-Plugins.html">libtorrent plugins</a>. For the typical bittorrent client
│ │ │ │ +all of these extensions should be added. The main plugins implemented
│ │ │ │ +in libtorrent are:</p>
│ │ │ │ +<dl class="docutils">
│ │ │ │ +<dt>uTorrent metadata</dt>
│ │ │ │ +<dd>Allows peers to download the metadata (.torrent files) from the swarm
│ │ │ │ +directly. Makes it possible to join a swarm with just a tracker and
│ │ │ │ +info-hash.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="comment preproc">#include</span><span class="whitespace"> </span><span class="comment preprocfile">&lt;libtorrent/extensions/ut_metadata.hpp&gt;</span><span class="comment preproc">
│ │ │ │ +</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">add_extension</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">lt</span><span class="operator">::</span><span class="name">create_ut_metadata_plugin</span><span class="punctuation">);</span>
│ │ │ │ +</pre>
│ │ │ │ +<dl class="docutils">
│ │ │ │ +<dt>uTorrent peer exchange</dt>
│ │ │ │ +<dd>Exchanges peers between clients.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="comment preproc">#include</span><span class="whitespace"> </span><span class="comment preprocfile">&lt;libtorrent/extensions/ut_pex.hpp&gt;</span><span class="comment preproc">
│ │ │ │ +</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">add_extension</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">lt</span><span class="operator">::</span><span class="name">create_ut_pex_plugin</span><span class="punctuation">);</span>
│ │ │ │ +</pre>
│ │ │ │ +<dl class="docutils">
│ │ │ │ +<dt>smart ban <a class="reference external" href="reference-Plugins.html#plugin">plugin</a></dt>
│ │ │ │ +<dd>A <a class="reference external" href="reference-Plugins.html#plugin">plugin</a> that, with a small overhead, can ban peers
│ │ │ │ +that sends bad data with very high accuracy. Should
│ │ │ │ +eliminate most problems on poisoned torrents.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="comment preproc">#include</span><span class="whitespace"> </span><span class="comment preprocfile">&lt;libtorrent/extensions/smart_ban.hpp&gt;</span><span class="comment preproc">
│ │ │ │ +</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">add_extension</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">lt</span><span class="operator">::</span><span class="name">create_smart_ban_plugin</span><span class="punctuation">);</span>
│ │ │ │ +</pre>
│ │ │ │ +<a name="set_ip_filter()"></a>
│ │ │ │ +<a name="get_ip_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_ip_filter%28%29+get_ip_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_ip_filter%28%29+get_ip_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-ip-filter-get-ip-filter">
│ │ │ │ +<h2>set_ip_filter() get_ip_filter()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_ip_filter</strong> (ip_filter f);
│ │ │ │ +ip_filter <strong>get_ip_filter</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Sets a filter that will be used to reject and accept incoming as well
│ │ │ │ +as outgoing connections based on their originating ip address. The
│ │ │ │ +default filter will allow connections to any ip address. To build a
│ │ │ │ +set of rules for which addresses are accepted and not, see <a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a>.</p>
│ │ │ │ +<p>Each time a peer is blocked because of the IP filter, a
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#peer_blocked_alert">peer_blocked_alert</a> is generated. <tt class="docutils literal">get_ip_filter()</tt> Returns the
│ │ │ │ +<a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a> currently in the <a class="reference external" href="reference-Session.html#session">session</a>. See <a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a>.</p>
│ │ │ │ +<a name="set_port_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_port_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_port_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-port-filter">
│ │ │ │ +<h2>set_port_filter()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_port_filter</strong> (port_filter const&amp; f);
│ │ │ │ +</pre>
│ │ │ │ +<p>apply <a class="reference external" href="reference-Filter.html#port_filter">port_filter</a> <tt class="docutils literal">f</tt> to incoming and outgoing peers. a port filter
│ │ │ │ +will reject making outgoing peer connections to certain remote ports.
│ │ │ │ +The main intention is to be able to avoid triggering certain
│ │ │ │ +anti-virus software by connecting to SMTP, FTP ports.</p>
│ │ │ │ +<a name="ssl_listen_port()"></a>
│ │ │ │ +<a name="is_listening()"></a>
│ │ │ │ +<a name="listen_port()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bssl_listen_port%28%29+is_listening%28%29+listen_port%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bssl_listen_port%28%29+is_listening%28%29+listen_port%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="ssl-listen-port-is-listening-listen-port">
│ │ │ │ +<h2>ssl_listen_port() is_listening() listen_port()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +unsigned short <strong>ssl_listen_port</strong> () const;
│ │ │ │ +bool <strong>is_listening</strong> () const;
│ │ │ │ +unsigned short <strong>listen_port</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">is_listening()</tt> will tell you whether or not the <a class="reference external" href="reference-Session.html#session">session</a> has
│ │ │ │ +successfully opened a listening port. If it hasn't, this function will
│ │ │ │ +return false, and then you can set a new
│ │ │ │ +<a class="reference external" href="reference-Settings.html#listen_interfaces">settings_pack::listen_interfaces</a> to try another interface and port to
│ │ │ │ +bind to.</p>
│ │ │ │ +<p><tt class="docutils literal">listen_port()</tt> returns the port we ended up listening on.</p>
│ │ │ │ +<a name="get_peer_class_filter()"></a>
│ │ │ │ +<a name="set_peer_class_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bget_peer_class_filter%28%29+set_peer_class_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bget_peer_class_filter%28%29+set_peer_class_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-peer-class-filter-set-peer-class-filter">
│ │ │ │ +<h2>get_peer_class_filter() set_peer_class_filter()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +ip_filter <strong>get_peer_class_filter</strong> () const;
│ │ │ │ +void <strong>set_peer_class_filter</strong> (ip_filter const&amp; f);
│ │ │ │ +</pre>
│ │ │ │ +<p>Sets the peer class filter for this <a class="reference external" href="reference-Session.html#session">session</a>. All new peer connections
│ │ │ │ +will take this into account and be added to the peer classes specified
│ │ │ │ +by this filter, based on the peer's IP address.</p>
│ │ │ │ +<p>The ip-filter essentially maps an IP -&gt; uint32. Each bit in that 32
│ │ │ │ +bit integer represents a peer class. The least significant bit
│ │ │ │ +represents class 0, the next bit class 1 and so on.</p>
│ │ │ │ +<p>For more info, see <a class="reference external" href="reference-Filter.html#ip_filter">ip_filter</a>.</p>
│ │ │ │ +<p>For example, to make all peers in the range 200.1.1.0 - 200.1.255.255
│ │ │ │ +belong to their own peer class, apply the following filter:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="name">ip_filter</span><span class="whitespace"> </span><span class="name">f</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">get_peer_class_filter</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +</span><span class="name">peer_class_t</span><span class="whitespace"> </span><span class="name">my_class</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ses</span><span class="punctuation">.</span><span class="name">create_peer_class</span><span class="punctuation">(</span><span class="literal string">&quot;200.1.x.x IP range&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="name">f</span><span class="punctuation">.</span><span class="name">add_rule</span><span class="punctuation">(</span><span class="name">make_address</span><span class="punctuation">(</span><span class="literal string">&quot;200.1.1.0&quot;</span><span class="punctuation">),</span><span class="whitespace"> </span><span class="name">make_address</span><span class="punctuation">(</span><span class="literal string">&quot;200.1.255.255&quot;</span><span class="punctuation">)</span><span class="whitespace">
│ │ │ │ +        </span><span class="punctuation">,</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="whitespace"> </span><span class="operator">&lt;&lt;</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="name">std</span><span class="operator">::</span><span class="keyword type">uint32_t</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">my_class</span><span class="punctuation">));</span><span class="whitespace">
│ │ │ │ +</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">set_peer_class_filter</span><span class="punctuation">(</span><span class="name">f</span><span class="punctuation">);</span>
│ │ │ │ +</pre>
│ │ │ │ +<p>This setting only applies to new connections, it won't affect existing
│ │ │ │ +peer connections.</p>
│ │ │ │ +<p>This function is limited to only peer class 0-31, since there are only
│ │ │ │ +32 bits in the IP range mapping. Only the set bits matter; no peer
│ │ │ │ +class will be removed from a peer as a result of this call, peer
│ │ │ │ +classes are only added.</p>
│ │ │ │ +<p>The <tt class="docutils literal">peer_class</tt> argument cannot be greater than 31. The bitmasks
│ │ │ │ +representing peer classes in the <tt class="docutils literal">peer_class_filter</tt> are 32 bits.</p>
│ │ │ │ +<p>The <tt class="docutils literal">get_peer_class_filter()</tt> function returns the current filter.</p>
│ │ │ │ +<p>For more information, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ +<a name="set_peer_class_type_filter()"></a>
│ │ │ │ +<a name="get_peer_class_type_filter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bset_peer_class_type_filter%28%29+get_peer_class_type_filter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bset_peer_class_type_filter%28%29+get_peer_class_type_filter%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-peer-class-type-filter-get-peer-class-type-filter">
│ │ │ │ +<h2>set_peer_class_type_filter() get_peer_class_type_filter()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +peer_class_type_filter <strong>get_peer_class_type_filter</strong> () const;
│ │ │ │ +void <strong>set_peer_class_type_filter</strong> (peer_class_type_filter const&amp; f);
│ │ │ │ +</pre>
│ │ │ │ +<p>Sets and gets the <em>peer class type filter</em>. This is controls automatic
│ │ │ │ +peer class assignments to peers based on what kind of socket it is.</p>
│ │ │ │ +<p>It does not only support assigning peer classes, it also supports
│ │ │ │ +removing peer classes based on socket type.</p>
│ │ │ │ +<p>The order of these rules being applied are:</p>
│ │ │ │ +<ol class="arabic simple">
│ │ │ │ +<li>peer-class IP filter</li>
│ │ │ │ +<li>peer-class type filter, removing classes</li>
│ │ │ │ +<li>peer-class type filter, adding classes</li>
│ │ │ │ +</ol>
│ │ │ │ +<p>For more information, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ +<a name="create_peer_class()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bcreate_peer_class%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bcreate_peer_class%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="create-peer-class">
│ │ │ │ +<h2>create_peer_class()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +peer_class_t <strong>create_peer_class</strong> (char const* name);
│ │ │ │ +</pre>
│ │ │ │ +<p>Creates a new peer class (see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>) with the given name. The
│ │ │ │ +returned integer is the new peer class identifier. Peer classes may
│ │ │ │ +have the same name, so each invocation of this function creates a new
│ │ │ │ +class and returns a unique identifier.</p>
│ │ │ │ +<p>Identifiers are assigned from low numbers to higher. So if you plan on
│ │ │ │ +using certain peer classes in a call to <a class="reference external" href="reference-Session.html#set_peer_class_filter()">set_peer_class_filter()</a>,
│ │ │ │ +make sure to create those early on, to get low identifiers.</p>
│ │ │ │ +<p>For more information on peer classes, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ +<a name="delete_peer_class()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdelete_peer_class%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdelete_peer_class%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="delete-peer-class">
│ │ │ │ +<h2>delete_peer_class()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>delete_peer_class</strong> (peer_class_t cid);
│ │ │ │ +</pre>
│ │ │ │ +<p>This call dereferences the reference count of the specified peer
│ │ │ │ +class. When creating a peer class it's automatically referenced by 1.
│ │ │ │ +If you want to recycle a peer class, you may call this function. You
│ │ │ │ +may only call this function <strong>once</strong> per peer class you create.
│ │ │ │ +Calling it more than once for the same class will lead to memory
│ │ │ │ +corruption.</p>
│ │ │ │ +<p>Since peer classes are reference counted, this function will not
│ │ │ │ +remove the peer class if it's still assigned to torrents or peers. It
│ │ │ │ +will however remove it once the last peer and torrent drops their
│ │ │ │ +references to it.</p>
│ │ │ │ +<p>There is no need to call this function for custom peer classes. All
│ │ │ │ +peer classes will be properly destructed when the <a class="reference external" href="reference-Session.html#session">session</a> object
│ │ │ │ +destructs.</p>
│ │ │ │ +<p>For more information on peer classes, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ +<a name="get_peer_class()"></a>
│ │ │ │ +<a name="set_peer_class()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bget_peer_class%28%29+set_peer_class%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bget_peer_class%28%29+set_peer_class%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-peer-class-set-peer-class">
│ │ │ │ +<h2>get_peer_class() set_peer_class()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_peer_class</strong> (peer_class_t cid, peer_class_info const&amp; pci);
│ │ │ │ +peer_class_info <strong>get_peer_class</strong> (peer_class_t cid) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>These functions queries information from a peer class and updates the
│ │ │ │ +configuration of a peer class, respectively.</p>
│ │ │ │ +<p><tt class="docutils literal">cid</tt> must refer to an existing peer class. If it does not, the
│ │ │ │ +return value of <tt class="docutils literal">get_peer_class()</tt> is undefined.</p>
│ │ │ │ +<p><tt class="docutils literal">set_peer_class()</tt> sets all the information in the
│ │ │ │ +<a class="reference external" href="reference-PeerClass.html#peer_class_info">peer_class_info</a> object in the specified peer class. There is no
│ │ │ │ +option to only update a single property.</p>
│ │ │ │ +<p>A peer or torrent belonging to more than one class, the highest
│ │ │ │ +priority among any of its classes is the one that is taken into
│ │ │ │ +account.</p>
│ │ │ │ +<p>For more information, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ +<a name="remove_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bremove_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bremove_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="remove-torrent-1">
│ │ │ │ +<h2>remove_torrent()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>remove_torrent</strong> (const torrent_handle&amp;, remove_flags_t = {});
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">remove_torrent()</tt> will close all peer connections associated with
│ │ │ │ +the torrent and tell the tracker that we've stopped participating in
│ │ │ │ +the swarm. This operation cannot fail. When it completes, you will
│ │ │ │ +receive a <a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a>.</p>
│ │ │ │ +<p><a class="reference external" href="reference-Session.html#remove_torrent()">remove_torrent()</a> is non-blocking, but will remove the torrent from the
│ │ │ │ +<a class="reference external" href="reference-Session.html#session">session</a> synchronously. Calling <a class="reference external" href="reference-Session.html#add_torrent()">session_handle::add_torrent()</a> immediately
│ │ │ │ +afterward with the same torrent will succeed. Note that this creates a
│ │ │ │ +new handle which is not equal to the removed one.</p>
│ │ │ │ +<p>The optional second argument <tt class="docutils literal">options</tt> can be used to delete all the
│ │ │ │ +files downloaded by this torrent. To do so, pass in the value
│ │ │ │ +<tt class="docutils literal"><span class="pre">session_handle::delete_files</span></tt>. Once the torrent is deleted, a
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#torrent_deleted_alert">torrent_deleted_alert</a> is posted.</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> remains valid for some time after <a class="reference external" href="reference-Session.html#remove_torrent()">remove_torrent()</a> is
│ │ │ │ +called. It will become invalid only after all libtorrent tasks (such as
│ │ │ │ +I/O tasks) release their references to the torrent. Until this happens,
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#is_valid()">torrent_handle::is_valid()</a> will return true, and other calls such
│ │ │ │ +as <a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a> will succeed. Because of this, and because
│ │ │ │ +<a class="reference external" href="reference-Session.html#remove_torrent()">remove_torrent()</a> is non-blocking, the following sequence usually
│ │ │ │ +succeeds (does not throw system_error):
│ │ │ │ +.. code:: c++</p>
│ │ │ │ +<blockquote>
│ │ │ │ +session.remove_handle(handle);
│ │ │ │ +handle.save_resume_data();</blockquote>
│ │ │ │ +<p>Note that when a queued or downloading torrent is removed, its position
│ │ │ │ +in the download queue is vacated and every subsequent torrent in the
│ │ │ │ +queue has their queue positions updated. This can potentially cause a
│ │ │ │ +large state_update to be posted. When removing all torrents, it is
│ │ │ │ +advised to remove them from the back of the queue, to minimize the
│ │ │ │ +shifting.</p>
│ │ │ │ +<a name="apply_settings()"></a>
│ │ │ │ +<a name="get_settings()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bapply_settings%28%29+get_settings%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bapply_settings%28%29+get_settings%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="apply-settings-get-settings">
│ │ │ │ +<h2>apply_settings() get_settings()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>apply_settings</strong> (settings_pack&amp;&amp;);
│ │ │ │ +void <strong>apply_settings</strong> (settings_pack const&amp;);
│ │ │ │ +settings_pack <strong>get_settings</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Applies the settings specified by the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> <tt class="docutils literal">s</tt>. This is an
│ │ │ │ +asynchronous operation that will return immediately and actually apply
│ │ │ │ +the settings to the main thread of libtorrent some time later.</p>
│ │ │ │ +<a name="pop_alerts()"></a>
│ │ │ │ +<a name="set_alert_notify()"></a>
│ │ │ │ +<a name="wait_for_alert()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bpop_alerts%28%29+set_alert_notify%28%29+wait_for_alert%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bpop_alerts%28%29+set_alert_notify%28%29+wait_for_alert%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="pop-alerts-set-alert-notify-wait-for-alert">
│ │ │ │ +<h2>pop_alerts() set_alert_notify() wait_for_alert()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_alert_notify</strong> (std::function&lt;void()&gt; const&amp; fun);
│ │ │ │ +alert* <strong>wait_for_alert</strong> (time_duration max_wait);
│ │ │ │ +void <strong>pop_alerts</strong> (std::vector&lt;alert*&gt;* alerts);
│ │ │ │ +</pre>
│ │ │ │ +<p>Alerts is the main mechanism for libtorrent to report errors and
│ │ │ │ +events. <tt class="docutils literal">pop_alerts</tt> fills in the vector passed to it with pointers
│ │ │ │ +to new alerts. The <a class="reference external" href="reference-Session.html#session">session</a> still owns these alerts and they will stay
│ │ │ │ +valid until the next time <tt class="docutils literal">pop_alerts</tt> is called. You may not delete
│ │ │ │ +the <a class="reference external" href="reference-Alerts.html#alert">alert</a> objects.</p>
│ │ │ │ +<p>It is safe to call <tt class="docutils literal">pop_alerts</tt> from multiple different threads, as
│ │ │ │ +long as the alerts themselves are not accessed once another thread
│ │ │ │ +calls <tt class="docutils literal">pop_alerts</tt>. Doing this requires manual synchronization
│ │ │ │ +between the popping threads.</p>
│ │ │ │ +<p><tt class="docutils literal">wait_for_alert</tt> will block the current thread for <tt class="docutils literal">max_wait</tt> time
│ │ │ │ +duration, or until another <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted. If an <a class="reference external" href="reference-Alerts.html#alert">alert</a> is available
│ │ │ │ +at the time of the call, it returns immediately. The returned <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +pointer is the head of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue. <tt class="docutils literal">wait_for_alert</tt> does not
│ │ │ │ +pop alerts from the queue, it merely peeks at it. The returned <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +will stay valid until <tt class="docutils literal">pop_alerts</tt> is called twice. The first time
│ │ │ │ +will pop it and the second will free it.</p>
│ │ │ │ +<p>If there is no <a class="reference external" href="reference-Alerts.html#alert">alert</a> in the queue and no <a class="reference external" href="reference-Alerts.html#alert">alert</a> arrives within the
│ │ │ │ +specified timeout, <tt class="docutils literal">wait_for_alert</tt> returns nullptr.</p>
│ │ │ │ +<p>In the python binding, <tt class="docutils literal">wait_for_alert</tt> takes the number of
│ │ │ │ +milliseconds to wait as an integer.</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue in the <a class="reference external" href="reference-Session.html#session">session</a> will not grow indefinitely. Make sure
│ │ │ │ +to pop periodically to not miss notifications. To control the max
│ │ │ │ +number of alerts that's queued by the <a class="reference external" href="reference-Session.html#session">session</a>, see
│ │ │ │ +<tt class="docutils literal"><span class="pre">settings_pack::alert_queue_size</span></tt>.</p>
│ │ │ │ +<p>Some alerts are considered so important that they are posted even when
│ │ │ │ +the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue is full. Some alerts are considered mandatory and cannot
│ │ │ │ +be disabled by the <tt class="docutils literal">alert_mask</tt>. For instance,
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a> and <a class="reference external" href="reference-Alerts.html#save_resume_data_failed_alert">save_resume_data_failed_alert</a> are always
│ │ │ │ +posted, regardless of the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
│ │ │ │ +<p>To control which alerts are posted, set the alert_mask
│ │ │ │ +(<a class="reference external" href="reference-Settings.html#alert_mask">settings_pack::alert_mask</a>).</p>
│ │ │ │ +<p>If the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue fills up to the point where alerts are dropped, this
│ │ │ │ +will be indicated by a <a class="reference external" href="reference-Alerts.html#alerts_dropped_alert">alerts_dropped_alert</a>, which contains a bitmask
│ │ │ │ +of which types of alerts were dropped. Generally it is a good idea to
│ │ │ │ +make sure the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue is large enough, the alert_mask doesn't have
│ │ │ │ +unnecessary categories enabled and to call pop_alert() frequently, to
│ │ │ │ +avoid alerts being dropped.</p>
│ │ │ │ +<p>the <tt class="docutils literal">set_alert_notify</tt> function lets the client set a function object
│ │ │ │ +to be invoked every time the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue goes from having 0 alerts to
│ │ │ │ +1 <a class="reference external" href="reference-Alerts.html#alert">alert</a>. This function is called from within libtorrent, it may be the
│ │ │ │ +main thread, or it may be from within a user call. The intention of
│ │ │ │ +of the function is that the client wakes up its main thread, to poll
│ │ │ │ +for more alerts using <tt class="docutils literal">pop_alerts()</tt>. If the notify function fails
│ │ │ │ +to do so, it won't be called again, until <tt class="docutils literal">pop_alerts</tt> is called for
│ │ │ │ +some other reason. For instance, it could signal an eventfd, post a
│ │ │ │ +message to an HWND or some other main message pump. The actual
│ │ │ │ +retrieval of alerts should not be done in the callback. In fact, the
│ │ │ │ +callback should not block. It should not perform any expensive work.
│ │ │ │ +It really should just notify the main application thread.</p>
│ │ │ │ +<p>The type of an <a class="reference external" href="reference-Alerts.html#alert">alert</a> is returned by the polymorphic function
│ │ │ │ +<tt class="docutils literal"><span class="pre">alert::type()</span></tt> but can also be queries from a concrete type via
│ │ │ │ +<tt class="docutils literal"><span class="pre">T::alert_type</span></tt>, as a static constant.</p>
│ │ │ │ +<a name="add_port_mapping()"></a>
│ │ │ │ +<a name="delete_port_mapping()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Badd_port_mapping%28%29+delete_port_mapping%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Badd_port_mapping%28%29+delete_port_mapping%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-port-mapping-delete-port-mapping">
│ │ │ │ +<h2>add_port_mapping() delete_port_mapping()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;port_mapping_t&gt; <strong>add_port_mapping</strong> (portmap_protocol t, int external_port, int local_port);
│ │ │ │ +void <strong>delete_port_mapping</strong> (port_mapping_t handle);
│ │ │ │ +</pre>
│ │ │ │ +<p>add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP,
│ │ │ │ +whichever is enabled. A mapping is created for each listen socket
│ │ │ │ +in the <a class="reference external" href="reference-Session.html#session">session</a>. The return values are all handles referring to the
│ │ │ │ +port mappings that were just created. Pass them to <a class="reference external" href="reference-Session.html#delete_port_mapping()">delete_port_mapping()</a>
│ │ │ │ +to remove them.</p>
│ │ │ │ +<a name="reopen_network_sockets()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Breopen_network_sockets%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Breopen_network_sockets%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="reopen-network-sockets">
│ │ │ │ +<h2>reopen_network_sockets()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>reopen_network_sockets</strong> (reopen_network_flags_t options = reopen_map_ports);
│ │ │ │ +</pre>
│ │ │ │ +<p>Instructs the <a class="reference external" href="reference-Session.html#session">session</a> to reopen all listen and outgoing sockets.</p>
│ │ │ │ +<p>It's useful in the case your platform doesn't support the built in
│ │ │ │ +IP notifier mechanism, or if you have a better more reliable way to
│ │ │ │ +detect changes in the IP routing table.</p>
│ │ │ │ +<a name="native_handle()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bnative_handle%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bnative_handle%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="native-handle-1">
│ │ │ │ +<h2>native_handle()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::shared_ptr&lt;aux::session_impl&gt; <strong>native_handle</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This function is intended only for use by plugins. This type does
│ │ │ │ +not have a stable API and should be relied on as little as possible.</p>
│ │ │ │ +<a name="save_settings"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bsave_settings%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bsave_settings%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>save_settings</dt>
│ │ │ │ +<dd>saves settings (i.e. the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>)</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="save_dht_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bsave_dht_state%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bsave_dht_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>save_dht_state</dt>
│ │ │ │ +<dd>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.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="save_extension_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bsave_extension_state%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bsave_extension_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>save_extension_state</dt>
│ │ │ │ +<dd>load or save state from plugins</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="save_ip_filter"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bsave_ip_filter%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bsave_ip_filter%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>save_ip_filter</dt>
│ │ │ │ +<dd>load or save the IP filter set on the <a class="reference external" href="reference-Session.html#session">session</a></dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="global_peer_class_id"></a>
│ │ │ │ +<a name="tcp_peer_class_id"></a>
│ │ │ │ +<a name="local_peer_class_id"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bglobal_peer_class_id+tcp_peer_class_id+local_peer_class_id%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bglobal_peer_class_id+tcp_peer_class_id+local_peer_class_id%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>global_peer_class_id tcp_peer_class_id local_peer_class_id</dt>
│ │ │ │ +<dd>built-in peer classes</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="delete_files"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdelete_files%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdelete_files%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>delete_files</dt>
│ │ │ │ +<dd>delete the files belonging to the torrent from disk.
│ │ │ │ +including the part-file, if there is one</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="delete_partfile"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bdelete_partfile%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bdelete_partfile%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>delete_partfile</dt>
│ │ │ │ +<dd>delete just the part-file associated with this torrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="paused"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Bpaused%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Bpaused%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>paused</dt>
│ │ │ │ +<dd>when set, the <a class="reference external" href="reference-Session.html#session">session</a> will start paused. Call
│ │ │ │ +<a class="reference external" href="reference-Session.html#resume()">session_handle::resume()</a> to start</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="udp"></a>
│ │ │ │ +<a name="tcp"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Budp+tcp%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Budp+tcp%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>udp tcp</dt>
│ │ │ │ +<dd>protocols used by <a class="reference external" href="reference-Session.html#add_port_mapping()">add_port_mapping()</a></dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="reopen_map_ports"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_handle%3A%3A%5Breopen_map_ports%5D&labels=documentation&body=Documentation+under+heading+%22session_handle%3A%3A%5Breopen_map_ports%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>reopen_map_ports</dt>
│ │ │ │ +<dd>This option indicates if the ports are mapped using natpmp
│ │ │ │ +and upnp. If mapping was already made, they are deleted and added
│ │ │ │ +again. This only works if natpmp and/or upnp are configured to be
│ │ │ │ +enable.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="read_session_params()"></a>
│ │ │ │ +<a name="write_session_params_buf()"></a>
│ │ │ │ +<a name="write_session_params()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:read_session_params%28%29+write_session_params_buf%28%29+write_session_params%28%29&labels=documentation&body=Documentation+under+heading+%22read_session_params%28%29+write_session_params_buf%28%29+write_session_params%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="read-session-params-write-session-params-buf-write-session-params">
│ │ │ │ +<h1>read_session_params() write_session_params_buf() write_session_params()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_params.hpp">libtorrent/session_params.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +session_params <strong>read_session_params</strong> (span&lt;char const&gt; buf
│ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ +session_params <strong>read_session_params</strong> (bdecode_node const&amp; e
│ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ +std::vector&lt;char&gt; <strong>write_session_params_buf</strong> (session_params const&amp; sp
│ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ +entry <strong>write_session_params</strong> (session_params const&amp; sp
│ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ +</pre>
│ │ │ │ +<p>These functions serialize and de-serialize a <tt class="docutils literal">session_params</tt> object to and
│ │ │ │ +from bencoded form. The <a class="reference external" href="reference-Session.html#session_params">session_params</a> object is used to initialize a new
│ │ │ │ +<a class="reference external" href="reference-Session.html#session">session</a> using the state from a previous one (or by programmatically configure
│ │ │ │ +the <a class="reference external" href="reference-Session.html#session">session</a> up-front).
│ │ │ │ +The flags parameter can be used to only save and load certain aspects of the
│ │ │ │ +session's state.
│ │ │ │ +The <tt class="docutils literal">_buf</tt> suffix indicates the function operates on buffer rather than the
│ │ │ │ +bencoded structure.
│ │ │ │ +The torrents in a <a class="reference external" href="reference-Session.html#session">session</a> are not part of the <a class="reference external" href="reference-Session.html#session_params">session_params</a> state, they have
│ │ │ │ +to be restored separately.</p>
│ │ │ │ +<a name="counters"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+counters&labels=documentation&body=Documentation+under+heading+%22class+counters%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="counters">
│ │ │ │ +<h1>counters</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/performance_counters.hpp">libtorrent/performance_counters.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct counters
│ │ │ │ +{
│ │ │ │ +   <strong>counters</strong> () ;
│ │ │ │ +   counters&amp; <strong>operator=</strong> (counters const&amp;) &amp; ;
│ │ │ │ +   <strong>counters</strong> (counters const&amp;) ;
│ │ │ │ +   std::int64_t <strong>inc_stats_counter</strong> (int c, std::int64_t value = 1) ;
│ │ │ │ +   std::int64_t <strong>operator[]</strong> (int i) const ;
│ │ │ │ +   void <strong>blend_stats_counter</strong> (int c, std::int64_t value, int ratio) ;
│ │ │ │ +   void <strong>set_value</strong> (int c, std::int64_t value) ;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="operator[]()"></a>
│ │ │ │ +<a name="inc_stats_counter()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:counters%3A%3A%5Boperator%5B%5D%28%29+inc_stats_counter%28%29%5D&labels=documentation&body=Documentation+under+heading+%22counters%3A%3A%5Boperator%5B%5D%28%29+inc_stats_counter%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-inc-stats-counter">
│ │ │ │ +<h2>operator[]() inc_stats_counter()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::int64_t <strong>inc_stats_counter</strong> (int c, std::int64_t value = 1) ;
│ │ │ │ +std::int64_t <strong>operator[]</strong> (int i) const ;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the new value</p>
│ │ │ │ +<a name="stats_metric"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+stats_metric&labels=documentation&body=Documentation+under+heading+%22class+stats_metric%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="stats-metric">
│ │ │ │ +<h1>stats_metric</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_stats.hpp">libtorrent/session_stats.hpp</a>&quot;</p>
│ │ │ │ +<p>describes one statistics metric from the <a class="reference external" href="reference-Session.html#session">session</a>. For more information,
│ │ │ │ +see the <a class="reference external" href="manual-ref.html#session-statistics">session statistics</a> section.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct stats_metric
│ │ │ │ +{
│ │ │ │ +   char const* name;
│ │ │ │ +   int value_index;
│ │ │ │ +   metric_type_t type;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="name"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:stats_metric%3A%3A%5Bname%5D&labels=documentation&body=Documentation+under+heading+%22stats_metric%3A%3A%5Bname%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>name</dt>
│ │ │ │ +<dd>the name of the counter or gauge</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="value_index"></a>
│ │ │ │ +<a name="type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:stats_metric%3A%3A%5Bvalue_index+type%5D&labels=documentation&body=Documentation+under+heading+%22stats_metric%3A%3A%5Bvalue_index+type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>value_index type</dt>
│ │ │ │ +<dd>the index into the <a class="reference external" href="reference-Session.html#session">session</a> stats array, where the underlying value of
│ │ │ │ +this counter or gauge is found. The <a class="reference external" href="reference-Session.html#session">session</a> stats array is part of the
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a> object.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="session_stats_metrics()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_stats_metrics%28%29&labels=documentation&body=Documentation+under+heading+%22session_stats_metrics%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="session-stats-metrics">
│ │ │ │ +<h1>session_stats_metrics()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_stats.hpp">libtorrent/session_stats.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;stats_metric&gt; <strong>session_stats_metrics</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>This free function returns the list of available metrics exposed by
│ │ │ │ +libtorrent's statistics API. Each metric has a name and a <em>value index</em>.
│ │ │ │ +The value index is the index into the array in <a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a> where
│ │ │ │ +this metric's value can be found when the <a class="reference external" href="reference-Session.html#session">session</a> stats is sampled (by
│ │ │ │ +calling <a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a>).</p>
│ │ │ │ +<a name="find_metric_idx()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:find_metric_idx%28%29&labels=documentation&body=Documentation+under+heading+%22find_metric_idx%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="find-metric-idx">
│ │ │ │ +<h1>find_metric_idx()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_stats.hpp">libtorrent/session_stats.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>find_metric_idx</strong> (string_view name);
│ │ │ │ +</pre>
│ │ │ │ +<p>given a name of a metric, this function returns the counter index of it,
│ │ │ │ +or -1 if it could not be found. The counter index is the index into the
│ │ │ │ +values array returned by <a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a>.</p>
│ │ │ │ +<a name="metric_type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+metric_type_t&labels=documentation&body=Documentation+under+heading+%22enum+metric_type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-metric-type-t">
│ │ │ │ +<h1>enum metric_type_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session_stats.hpp">libtorrent/session_stats.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="48%" />
│ │ │ │ -<col width="21%" />
│ │ │ │  <col width="31%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>peer_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>120</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">peer_timeout</tt> is the number of seconds the peer connection
│ │ │ │ -should wait (for any activity on the peer connection) before
│ │ │ │ -closing it due to time out. 120 seconds is
│ │ │ │ -specified in the protocol specification. After half
│ │ │ │ -the time out, a keep alive message is sent.</p>
│ │ │ │ -<a name="urlseed_timeout"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="53%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="28%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>urlseed_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>20</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>same as peer_timeout, but only applies to url-seeds. this is
│ │ │ │ -usually set lower, because web servers are expected to be more
│ │ │ │ -reliable.</p>
│ │ │ │ -<a name="urlseed_pipeline_size"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>urlseed_pipeline_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>controls the pipelining size of url and http seeds. i.e. the number of HTTP
│ │ │ │ -request to keep outstanding before waiting for the first one to
│ │ │ │ -complete. It's common for web servers to limit this to a relatively
│ │ │ │ -low number, like 5</p>
│ │ │ │ -<a name="urlseed_wait_retry"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>urlseed_wait_retry</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>30</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>number of seconds until a new retry of a url-seed takes place.
│ │ │ │ -Default retry value for http-seeds that don't provide
│ │ │ │ -a valid <tt class="docutils literal"><span class="pre">retry-after</span></tt> header.</p>
│ │ │ │ -<a name="file_pool_size"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="52%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="29%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>file_pool_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>40</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>sets the upper limit on the total number of files this <a class="reference external" href="reference-Session.html#session">session</a> will
│ │ │ │ -keep open. The reason why files are left open at all is that some
│ │ │ │ -anti virus software hooks on every file close, and scans the file
│ │ │ │ -for viruses. deferring the closing of the files will be the
│ │ │ │ -difference between a usable system and a completely hogged down
│ │ │ │ -system. Most operating systems also has a limit on the total number
│ │ │ │ -of file descriptors a process may have open.</p>
│ │ │ │ -<a name="max_failcount"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="50%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -<col width="30%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_failcount</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">max_failcount</tt> is the maximum times we try to
│ │ │ │ -connect to a peer before stop connecting again. If a
│ │ │ │ -peer succeeds, the failure counter is reset. If a
│ │ │ │ -peer is retrieved from a peer source (other than DHT)
│ │ │ │ -the failcount is decremented by one, allowing another
│ │ │ │ -try.</p>
│ │ │ │ -<a name="min_reconnect_time"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>min_reconnect_time</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>60</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the number of seconds to wait to reconnect to a peer. this time is
│ │ │ │ -multiplied with the failcount.</p>
│ │ │ │ -<a name="peer_connect_timeout"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="59%" />
│ │ │ │ -<col width="16%" />
│ │ │ │  <col width="24%" />
│ │ │ │ +<col width="45%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>peer_connect_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>15</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">peer_connect_timeout</tt> the number of seconds to wait after a
│ │ │ │ -connection attempt is initiated to a peer until it is considered as
│ │ │ │ -having timed out. This setting is especially important in case the
│ │ │ │ -number of half-open connections are limited, since stale half-open
│ │ │ │ -connection may delay the connection of other peers considerably.</p>
│ │ │ │ -<a name="connection_speed"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="55%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="27%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>connection_speed</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>30</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">connection_speed</tt> is the number of connection attempts that are
│ │ │ │ -made per second. If a number &lt; 0 is specified, it will default to
│ │ │ │ -200 connections per second. If 0 is specified, it means don't make
│ │ │ │ -outgoing connections at all.</p>
│ │ │ │ -<a name="inactivity_timeout"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>inactivity_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>600</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>if a peer is uninteresting and uninterested for longer than this
│ │ │ │ -number of seconds, it will be disconnected.</p>
│ │ │ │ -<a name="unchoke_interval"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="55%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="27%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>counter</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>unchoke_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>15</td>
│ │ │ │ +<tr><td>gauge</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">unchoke_interval</tt> is the number of seconds between
│ │ │ │ -chokes/unchokes. On this interval, peers are re-evaluated for being
│ │ │ │ -choked/unchoked. This is defined as 30 seconds in the protocol, and
│ │ │ │ -it should be significantly longer than what it takes for TCP to
│ │ │ │ -ramp up to it's max rate.</p>
│ │ │ │ -<a name="optimistic_unchoke_interval"></a><table border="1" class="docutils">
│ │ │ │ +<a name="announce_infohash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+announce_infohash&labels=documentation&body=Documentation+under+heading+%22class+announce_infohash%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="announce-infohash">
│ │ │ │ +<h1>announce_infohash</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/announce_entry.hpp">libtorrent/announce_entry.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct announce_infohash
│ │ │ │ +{
│ │ │ │ +   std::string message;
│ │ │ │ +   error_code last_error;
│ │ │ │ +   int <strong>scrape_incomplete</strong>  = -1;
│ │ │ │ +   int <strong>scrape_complete</strong>  = -1;
│ │ │ │ +   int <strong>scrape_downloaded</strong>  = -1;
│ │ │ │ +   std::uint8_t fails : 7;
│ │ │ │ +   bool updating : 1;
│ │ │ │ +   bool start_sent : 1;
│ │ │ │ +   bool complete_sent : 1;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="message"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bmessage%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bmessage%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>message</dt>
│ │ │ │ +<dd>if this tracker has returned an error or warning message
│ │ │ │ +that message is stored here</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="last_error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Blast_error%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Blast_error%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>last_error</dt>
│ │ │ │ +<dd>if this tracker failed the last time it was contacted
│ │ │ │ +this error code specifies what error occurred</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="scrape_incomplete"></a>
│ │ │ │ +<a name="scrape_complete"></a>
│ │ │ │ +<a name="scrape_downloaded"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bscrape_incomplete+scrape_complete+scrape_downloaded%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bscrape_incomplete+scrape_complete+scrape_downloaded%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>scrape_incomplete scrape_complete scrape_downloaded</dt>
│ │ │ │ +<dd>if this tracker has returned scrape data, these fields are filled in
│ │ │ │ +with valid numbers. Otherwise they are set to -1. <tt class="docutils literal">incomplete</tt> counts
│ │ │ │ +the number of current downloaders. <tt class="docutils literal">complete</tt> counts the number of
│ │ │ │ +current peers completed the download, or &quot;seeds&quot;. <tt class="docutils literal">downloaded</tt> is the
│ │ │ │ +cumulative number of completed downloads.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="fails"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bfails%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bfails%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>fails</dt>
│ │ │ │ +<dd>the number of times in a row we have failed to announce to this
│ │ │ │ +tracker.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="updating"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bupdating%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bupdating%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>updating</dt>
│ │ │ │ +<dd>true while we're waiting for a response from the tracker.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="start_sent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bstart_sent%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bstart_sent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>start_sent</dt>
│ │ │ │ +<dd>set to true when we get a valid response from an announce
│ │ │ │ +with event=started. If it is set, we won't send start in the subsequent
│ │ │ │ +announces.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="complete_sent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bcomplete_sent%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bcomplete_sent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>complete_sent</dt>
│ │ │ │ +<dd>set to true when we send a event=completed.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="announce_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+announce_endpoint&labels=documentation&body=Documentation+under+heading+%22class+announce_endpoint%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="announce-endpoint">
│ │ │ │ +<h1>announce_endpoint</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/announce_entry.hpp">libtorrent/announce_entry.hpp</a>&quot;</p>
│ │ │ │ +<p>announces are sent to each tracker using every listen socket
│ │ │ │ +this class holds information about one listen socket for one tracker</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct announce_endpoint
│ │ │ │ +{
│ │ │ │ +   <strong>announce_endpoint</strong> ();
│ │ │ │ +
│ │ │ │ +   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> local_endpoint;
│ │ │ │ +   aux::array&lt;announce_infohash, num_protocols, protocol_version&gt; info_hashes;
│ │ │ │ +   bool <strong>enabled</strong>  = true;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="local_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_endpoint%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22announce_endpoint%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>local_endpoint</dt>
│ │ │ │ +<dd>the local endpoint of the listen interface associated with this endpoint</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_endpoint%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22announce_endpoint%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>info_hashes</dt>
│ │ │ │ +<dd>info_hashes[0] is the v1 info hash (SHA1)
│ │ │ │ +info_hashes[1] is the v2 info hash (truncated SHA-256)</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="enabled"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_endpoint%3A%3A%5Benabled%5D&labels=documentation&body=Documentation+under+heading+%22announce_endpoint%3A%3A%5Benabled%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>enabled</dt>
│ │ │ │ +<dd>set to false to not announce from this endpoint</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="announce_entry"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+announce_entry&labels=documentation&body=Documentation+under+heading+%22class+announce_entry%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="announce-entry">
│ │ │ │ +<h1>announce_entry</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/announce_entry.hpp">libtorrent/announce_entry.hpp</a>&quot;</p>
│ │ │ │ +<p>this class holds information about one bittorrent tracker, as it
│ │ │ │ +relates to a specific torrent.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct announce_entry
│ │ │ │ +{
│ │ │ │ +   <strong>announce_entry</strong> (announce_entry const&amp;);
│ │ │ │ +   <strong>~announce_entry</strong> ();
│ │ │ │ +   announce_entry&amp; <strong>operator=</strong> (announce_entry const&amp;) &amp;;
│ │ │ │ +   <strong>announce_entry</strong> ();
│ │ │ │ +   explicit <strong>announce_entry</strong> (string_view u);
│ │ │ │ +
│ │ │ │ +   enum tracker_source
│ │ │ │ +   {
│ │ │ │ +      source_torrent,
│ │ │ │ +      source_client,
│ │ │ │ +      source_magnet_link,
│ │ │ │ +      source_tex,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   std::string url;
│ │ │ │ +   std::string trackerid;
│ │ │ │ +   std::vector&lt;announce_endpoint&gt; endpoints;
│ │ │ │ +   std::uint8_t <strong>tier</strong>  = 0;
│ │ │ │ +   std::uint8_t <strong>fail_limit</strong>  = 0;
│ │ │ │ +   std::uint8_t source:4;
│ │ │ │ +   bool verified:1;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="operator=()"></a>
│ │ │ │ +<a name="~announce_entry()"></a>
│ │ │ │ +<a name="announce_entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Boperator%3D%28%29+~announce_entry%28%29+announce_entry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Boperator%3D%28%29+~announce_entry%28%29+announce_entry%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-announce-entry-announce-entry">
│ │ │ │ +<h2>operator=() ~announce_entry() announce_entry()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>announce_entry</strong> (announce_entry const&amp;);
│ │ │ │ +<strong>~announce_entry</strong> ();
│ │ │ │ +announce_entry&amp; <strong>operator=</strong> (announce_entry const&amp;) &amp;;
│ │ │ │ +<strong>announce_entry</strong> ();
│ │ │ │ +explicit <strong>announce_entry</strong> (string_view u);
│ │ │ │ +</pre>
│ │ │ │ +<p>constructs a tracker announce <a class="reference external" href="reference-Bencoding.html#entry">entry</a> with <tt class="docutils literal">u</tt> as the URL.</p>
│ │ │ │ +<a name="tracker_source"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+tracker_source&labels=documentation&body=Documentation+under+heading+%22enum+tracker_source%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-tracker-source">
│ │ │ │ +<h2>enum tracker_source</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/announce_entry.hpp">libtorrent/announce_entry.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="66%" />
│ │ │ │ -<col width="14%" />
│ │ │ │  <col width="20%" />
│ │ │ │ +<col width="7%" />
│ │ │ │ +<col width="74%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>optimistic_unchoke_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>30</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">optimistic_unchoke_interval</tt> is the number of seconds between
│ │ │ │ -each <em>optimistic</em> unchoke. On this timer, the currently
│ │ │ │ -optimistically unchoked peer will change.</p>
│ │ │ │ -<a name="num_want"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="40%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -<col width="36%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>num_want</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>200</td>
│ │ │ │ +<tr><td>source_torrent</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>the tracker was part of the .torrent file</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">num_want</tt> is the number of peers we want from each tracker
│ │ │ │ -request. It defines what is sent as the <tt class="docutils literal">&amp;num_want=</tt> parameter to
│ │ │ │ -the tracker.</p>
│ │ │ │ -<a name="initial_picker_threshold"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>source_client</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>the tracker was added programmatically via the <a class="reference external" href="reference-Torrent_Handle.html#add_tracker()">add_tracker()</a> function</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>initial_picker_threshold</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>source_magnet_link</td>
│ │ │ │  <td>4</td>
│ │ │ │ +<td>the tracker was part of a magnet link</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">initial_picker_threshold</tt> specifies the number of pieces we need
│ │ │ │ -before we switch to rarest first picking. The first
│ │ │ │ -<tt class="docutils literal">initial_picker_threshold</tt> pieces in any torrent are picked at random
│ │ │ │ -, the following pieces are picked in rarest first order.</p>
│ │ │ │ -<a name="allowed_fast_set_size"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>allowed_fast_set_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the number of allowed pieces to send to peers that supports the
│ │ │ │ -fast extensions</p>
│ │ │ │ -<a name="suggest_mode"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="25%" />
│ │ │ │ -<col width="11%" />
│ │ │ │ -<col width="65%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>suggest_mode</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>settings_pack::no_piece_suggestions</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">suggest_mode</tt> controls whether or not libtorrent will send out
│ │ │ │ -suggest messages to create a bias of its peers to request certain
│ │ │ │ -pieces. The modes are:</p>
│ │ │ │ -<ul class="simple">
│ │ │ │ -<li><tt class="docutils literal">no_piece_suggestions</tt> which will not send out suggest messages.</li>
│ │ │ │ -<li><tt class="docutils literal">suggest_read_cache</tt> which will send out suggest messages for
│ │ │ │ -the most recent pieces that are in the read cache.</li>
│ │ │ │ -</ul>
│ │ │ │ -<a name="max_queued_disk_bytes"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="55%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="31%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_queued_disk_bytes</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>1024 * 1024</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">max_queued_disk_bytes</tt> is the maximum number of bytes, to
│ │ │ │ -be written to disk, that can wait in the disk I/O thread queue.
│ │ │ │ -This queue is only for waiting for the disk I/O thread to receive
│ │ │ │ -the job and either write it to disk or insert it in the write
│ │ │ │ -cache. When this limit is reached, the peer connections will stop
│ │ │ │ -reading data from their sockets, until the disk thread catches up.
│ │ │ │ -Setting this too low will severely limit your download rate.</p>
│ │ │ │ -<a name="handshake_timeout"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="56%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>handshake_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>10</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the number of seconds to wait for a handshake response from a peer.
│ │ │ │ -If no response is received within this time, the peer is
│ │ │ │ -disconnected.</p>
│ │ │ │ -<a name="send_buffer_low_watermark"></a>
│ │ │ │ -<a name="send_buffer_watermark"></a>
│ │ │ │ -<a name="send_buffer_watermark_factor"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>send_buffer_low_watermark</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>10 * 1024</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>send_buffer_watermark</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>500 * 1024</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>send_buffer_watermark_factor</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>50</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">send_buffer_low_watermark</tt> the minimum send buffer target size
│ │ │ │ -(send buffer includes bytes pending being read from disk). For good
│ │ │ │ -and snappy seeding performance, set this fairly high, to at least
│ │ │ │ -fit a few blocks. This is essentially the initial window size which
│ │ │ │ -will determine how fast we can ramp up the send rate</p>
│ │ │ │ -<p>if the send buffer has fewer bytes than <tt class="docutils literal">send_buffer_watermark</tt>,
│ │ │ │ -we'll read another 16 kiB block onto it. If set too small, upload
│ │ │ │ -rate capacity will suffer. If set too high, memory will be wasted.
│ │ │ │ -The actual watermark may be lower than this in case the upload rate
│ │ │ │ -is low, this is the upper limit.</p>
│ │ │ │ -<p>the current upload rate to a peer is multiplied by this factor to
│ │ │ │ -get the send buffer watermark. The factor is specified as a
│ │ │ │ -percentage. i.e. 50 -&gt; 0.5 This product is clamped to the
│ │ │ │ -<tt class="docutils literal">send_buffer_watermark</tt> setting to not exceed the max. For high
│ │ │ │ -speed upload, this should be set to a greater value than 100. For
│ │ │ │ -high capacity connections, setting this higher can improve upload
│ │ │ │ -performance and disk throughput. Setting it too high may waste RAM
│ │ │ │ -and create a bias towards read jobs over write jobs.</p>
│ │ │ │ -<a name="choking_algorithm"></a>
│ │ │ │ -<a name="seed_choking_algorithm"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="37%" />
│ │ │ │ -<col width="9%" />
│ │ │ │ -<col width="54%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>choking_algorithm</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>settings_pack::fixed_slots_choker</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>seed_choking_algorithm</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>settings_pack::round_robin</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">choking_algorithm</tt> specifies which algorithm to use to determine
│ │ │ │ -how many peers to unchoke. The unchoking algorithm for
│ │ │ │ -downloading torrents is always &quot;tit-for-tat&quot;, i.e. the peers we
│ │ │ │ -download the fastest from are unchoked.</p>
│ │ │ │ -<p>The options for choking algorithms are defined in the
│ │ │ │ -<a class="reference external" href="reference-Settings.html#choking_algorithm_t">choking_algorithm_t</a> enum.</p>
│ │ │ │ -<p><tt class="docutils literal">seed_choking_algorithm</tt> controls the seeding unchoke behavior.
│ │ │ │ -i.e. How we select which peers to unchoke for seeding torrents.
│ │ │ │ -Since a seeding torrent isn't downloading anything, the
│ │ │ │ -tit-for-tat mechanism cannot be used. The available options are
│ │ │ │ -defined in the <a class="reference external" href="reference-Settings.html#seed_choking_algorithm_t">seed_choking_algorithm_t</a> enum.</p>
│ │ │ │ -<a name="disk_io_write_mode"></a>
│ │ │ │ -<a name="disk_io_read_mode"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="34%" />
│ │ │ │ -<col width="10%" />
│ │ │ │ -<col width="55%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>disk_io_write_mode</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>DISK_WRITE_MODE</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>disk_io_read_mode</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>settings_pack::enable_os_cache</td>
│ │ │ │ +<tr><td>source_tex</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>the tracker was received from the swarm via tracker exchange</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>determines how files are opened when they're in read only mode
│ │ │ │ -versus read and write mode. The options are:</p>
│ │ │ │ -<dl class="docutils">
│ │ │ │ -<dt>enable_os_cache</dt>
│ │ │ │ -<dd>Files are opened normally, with the OS caching reads and writes.</dd>
│ │ │ │ -<dt>disable_os_cache</dt>
│ │ │ │ -<dd>This opens all files in no-cache mode. This corresponds to the
│ │ │ │ -OS not letting blocks for the files linger in the cache. This
│ │ │ │ -makes sense in order to avoid the bittorrent client to
│ │ │ │ -potentially evict all other processes' cache by simply handling
│ │ │ │ -high throughput and large files. If libtorrent's read cache is
│ │ │ │ -disabled, enabling this may reduce performance.</dd>
│ │ │ │ -<dt>write_through</dt>
│ │ │ │ -<dd>flush pieces to disk as they complete validation.</dd>
│ │ │ │ +<a name="url"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Burl%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Burl%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>url</dt>
│ │ │ │ +<dd>tracker URL as it appeared in the torrent file</dd>
│ │ │ │  </dl>
│ │ │ │ -<p>One reason to disable caching is that it may help the operating
│ │ │ │ -system from growing its file cache indefinitely.</p>
│ │ │ │ -<a name="outgoing_port"></a>
│ │ │ │ -<a name="num_outgoing_ports"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>outgoing_port</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>num_outgoing_ports</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>this is the first port to use for binding outgoing connections to.
│ │ │ │ -This is useful for users that have routers that allow QoS settings
│ │ │ │ -based on local port. when binding outgoing connections to specific
│ │ │ │ -ports, <tt class="docutils literal">num_outgoing_ports</tt> is the size of the range. It should
│ │ │ │ -be more than a few</p>
│ │ │ │ -<div class="admonition warning">
│ │ │ │ -<p class="first admonition-title">Warning</p>
│ │ │ │ -<p class="last">setting outgoing ports will limit the ability to keep
│ │ │ │ -multiple connections to the same client, even for different
│ │ │ │ -torrents. It is not recommended to change this setting. Its main
│ │ │ │ -purpose is to use as an escape hatch for cheap routers with QoS
│ │ │ │ -capability but can only classify flows based on port numbers.</p>
│ │ │ │ +<a name="trackerid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Btrackerid%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Btrackerid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>trackerid</dt>
│ │ │ │ +<dd>the current <tt class="docutils literal">&amp;trackerid=</tt> argument passed to the tracker.
│ │ │ │ +this is optional and is normally empty (in which case no
│ │ │ │ +trackerid is sent).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="endpoints"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bendpoints%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bendpoints%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>endpoints</dt>
│ │ │ │ +<dd>each local listen socket (endpoint) will announce to the tracker. This
│ │ │ │ +list contains state per endpoint.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="tier"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Btier%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Btier%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>tier</dt>
│ │ │ │ +<dd>the tier this tracker belongs to</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="fail_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bfail_limit%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bfail_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>fail_limit</dt>
│ │ │ │ +<dd>the max number of failures to announce to this tracker in
│ │ │ │ +a row, before this tracker is not used anymore. 0 means unlimited</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="source"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bsource%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bsource%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>source</dt>
│ │ │ │ +<dd>a bitmask specifying which sources we got this tracker from.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="verified"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bverified%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bverified%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>verified</dt>
│ │ │ │ +<dd>set to true the first time we receive a valid response
│ │ │ │ +from this tracker.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="peer_class_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_class_info&labels=documentation&body=Documentation+under+heading+%22class+peer_class_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │ -<p>It is a range instead of a single port because of the problems with
│ │ │ │ -failing to reconnect to peers if a previous socket to that peer and
│ │ │ │ -port is in <tt class="docutils literal">TIME_WAIT</tt> state.</p>
│ │ │ │ -<a name="peer_dscp"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="42%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ -<col width="35%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>peer_dscp</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0x04</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">peer_dscp</tt> determines the DSCP field in the IP header of every
│ │ │ │ -packet sent to peers (including web seeds). <tt class="docutils literal">0x0</tt> means no marking,
│ │ │ │ -<tt class="docutils literal">0x04</tt> represents Lower Effort. For more details see <a class="reference external" href="http://www.faqs.org/rfcs/rfc8622.html">RFC 8622</a>.</p>
│ │ │ │ -<p><tt class="docutils literal">peer_tos</tt> is the backwards compatible name for this setting.</p>
│ │ │ │ -<a name="active_downloads"></a>
│ │ │ │ -<a name="active_seeds"></a>
│ │ │ │ -<a name="active_checking"></a>
│ │ │ │ -<a name="active_dht_limit"></a>
│ │ │ │ -<a name="active_tracker_limit"></a>
│ │ │ │ -<a name="active_lsd_limit"></a>
│ │ │ │ -<a name="active_limit"></a><table border="1" class="docutils">
│ │ │ │ +<div class="section" id="peer-class-info">
│ │ │ │ +<h1>peer_class_info</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_class.hpp">libtorrent/peer_class.hpp</a>&quot;</p>
│ │ │ │ +<p>holds settings for a peer class. Used in <a class="reference external" href="reference-Session.html#set_peer_class()">set_peer_class()</a> and
│ │ │ │ +<a class="reference external" href="reference-Session.html#get_peer_class()">get_peer_class()</a> calls.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_class_info
│ │ │ │ +{
│ │ │ │ +   bool ignore_unchoke_slots;
│ │ │ │ +   int connection_limit_factor;
│ │ │ │ +   std::string label;
│ │ │ │ +   int upload_limit;
│ │ │ │ +   int download_limit;
│ │ │ │ +   int upload_priority;
│ │ │ │ +   int download_priority;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="ignore_unchoke_slots"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_info%3A%3A%5Bignore_unchoke_slots%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_info%3A%3A%5Bignore_unchoke_slots%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>ignore_unchoke_slots</dt>
│ │ │ │ +<dd><tt class="docutils literal">ignore_unchoke_slots</tt> determines whether peers should always
│ │ │ │ +unchoke a peer, regardless of the choking algorithm, or if it should
│ │ │ │ +honor the unchoke slot limits. It's used for local peers by default.
│ │ │ │ +If <em>any</em> of the peer classes a peer belongs to has this set to true,
│ │ │ │ +that peer will be unchoked at all times.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="connection_limit_factor"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_info%3A%3A%5Bconnection_limit_factor%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_info%3A%3A%5Bconnection_limit_factor%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>connection_limit_factor</dt>
│ │ │ │ +<dd>adjusts the connection limit (global and per torrent) that applies to
│ │ │ │ +this peer class. By default, local peers are allowed to exceed the
│ │ │ │ +normal connection limit for instance. This is specified as a percent
│ │ │ │ +factor. 100 makes the peer class apply normally to the limit. 200
│ │ │ │ +means as long as there are fewer connections than twice the limit, we
│ │ │ │ +accept this peer. This factor applies both to the global connection
│ │ │ │ +limit and the per-torrent limit. Note that if not used carefully one
│ │ │ │ +peer class can potentially completely starve out all other over time.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="label"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_info%3A%3A%5Blabel%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_info%3A%3A%5Blabel%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>label</dt>
│ │ │ │ +<dd>not used by libtorrent. It's intended as a potentially user-facing
│ │ │ │ +identifier of this peer class.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="upload_limit"></a>
│ │ │ │ +<a name="download_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_info%3A%3A%5Bupload_limit+download_limit%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_info%3A%3A%5Bupload_limit+download_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>upload_limit download_limit</dt>
│ │ │ │ +<dd>transfer rates limits for the whole peer class. They are specified in
│ │ │ │ +bytes per second and apply to the sum of all peers that are members of
│ │ │ │ +this class.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="upload_priority"></a>
│ │ │ │ +<a name="download_priority"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_info%3A%3A%5Bupload_priority+download_priority%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_info%3A%3A%5Bupload_priority+download_priority%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>upload_priority download_priority</dt>
│ │ │ │ +<dd>relative priorities used by the bandwidth allocator in the rate
│ │ │ │ +limiter. If no rate limits are in use, the priority is not used
│ │ │ │ +either. Priorities start at 1 (0 is not a valid priority) and may not
│ │ │ │ +exceed 255.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="peer_class_type_filter"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_class_type_filter&labels=documentation&body=Documentation+under+heading+%22class+peer_class_type_filter%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="peer-class-type-filter">
│ │ │ │ +<h1>peer_class_type_filter</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_class_type_filter.hpp">libtorrent/peer_class_type_filter.hpp</a>&quot;</p>
│ │ │ │ +<p><tt class="docutils literal">peer_class_type_filter</tt> is a simple container for rules for adding and subtracting
│ │ │ │ +peer-classes from peers. It is applied <em>after</em> the peer class filter is applied (which
│ │ │ │ +is based on the peer's IP address).</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_class_type_filter
│ │ │ │ +{
│ │ │ │ +   void <strong>remove</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ +   void <strong>add</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ +   void <strong>disallow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ +   void <strong>allow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ +   std::uint32_t <strong>apply</strong> (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ │ +   friend bool <strong>operator==</strong> (peer_class_type_filter const&amp; lhs
│ │ │ │ +      , peer_class_type_filter const&amp; rhs);
│ │ │ │ +
│ │ │ │ +   enum socket_type_t
│ │ │ │ +   {
│ │ │ │ +      tcp_socket,
│ │ │ │ +      utp_socket,
│ │ │ │ +      ssl_tcp_socket,
│ │ │ │ +      ssl_utp_socket,
│ │ │ │ +      i2p_socket,
│ │ │ │ +      num_socket_types,
│ │ │ │ +   };
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="remove()"></a>
│ │ │ │ +<a name="add()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_type_filter%3A%3A%5Bremove%28%29+add%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_type_filter%3A%3A%5Bremove%28%29+add%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="remove-add">
│ │ │ │ +<h2>remove() add()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>remove</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ +void <strong>add</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">add()</tt> and <tt class="docutils literal">remove()</tt> adds and removes a peer class to be added
│ │ │ │ +to new peers based on socket type.</p>
│ │ │ │ +<a name="allow()"></a>
│ │ │ │ +<a name="disallow()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_type_filter%3A%3A%5Ballow%28%29+disallow%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_type_filter%3A%3A%5Ballow%28%29+disallow%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="allow-disallow">
│ │ │ │ +<h2>allow() disallow()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>disallow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ +void <strong>allow</strong> (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ +</pre>
│ │ │ │ +<p><tt class="docutils literal">disallow()</tt> and <tt class="docutils literal">allow()</tt> adds and removes a peer class to be
│ │ │ │ +removed from new peers based on socket type.</p>
│ │ │ │ +<p>The <tt class="docutils literal">peer_class</tt> argument cannot be greater than 31. The bitmasks representing
│ │ │ │ +peer classes in the <tt class="docutils literal">peer_class_type_filter</tt> are 32 bits.</p>
│ │ │ │ +<a name="apply()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_class_type_filter%3A%3A%5Bapply%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_class_type_filter%3A%3A%5Bapply%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="apply">
│ │ │ │ +<h2>apply()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::uint32_t <strong>apply</strong> (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ │ +</pre>
│ │ │ │ +<p>takes a bitmask of peer classes and returns a new bitmask of
│ │ │ │ +peer classes after the rules have been applied, based on the socket type argument
│ │ │ │ +(<tt class="docutils literal">st</tt>).</p>
│ │ │ │ +<a name="socket_type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+socket_type_t&labels=documentation&body=Documentation+under+heading+%22enum+socket_type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-socket-type-t">
│ │ │ │ +<h2>enum socket_type_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_class_type_filter.hpp">libtorrent/peer_class_type_filter.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="59%" />
│ │ │ │ -<col width="16%" />
│ │ │ │  <col width="24%" />
│ │ │ │ +<col width="9%" />
│ │ │ │ +<col width="67%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>active_downloads</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>active_seeds</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>5</td>
│ │ │ │ +<tr><td>tcp_socket</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>these match the socket types from socket_type.hpp
│ │ │ │ +shifted one down</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>active_checking</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>utp_socket</td>
│ │ │ │  <td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>active_dht_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>88</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>active_tracker_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>1600</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>active_lsd_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>60</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>active_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>500</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>for auto managed torrents, these are the limits they are subject
│ │ │ │ -to. If there are too many torrents some of the auto managed ones
│ │ │ │ -will be paused until some slots free up. <tt class="docutils literal">active_downloads</tt> and
│ │ │ │ -<tt class="docutils literal">active_seeds</tt> controls how many active seeding and downloading
│ │ │ │ -torrents the queuing mechanism allows. The target number of active
│ │ │ │ -torrents is <tt class="docutils literal">min(active_downloads + active_seeds, active_limit)</tt>.
│ │ │ │ -<tt class="docutils literal">active_downloads</tt> and <tt class="docutils literal">active_seeds</tt> are upper limits on the
│ │ │ │ -number of downloading torrents and seeding torrents respectively.
│ │ │ │ -Setting the value to -1 means unlimited.</p>
│ │ │ │ -<p>For example if there are 10 seeding torrents and 10 downloading
│ │ │ │ -torrents, and <tt class="docutils literal">active_downloads</tt> is 4 and <tt class="docutils literal">active_seeds</tt> is 4,
│ │ │ │ -there will be 4 seeds active and 4 downloading torrents. If the
│ │ │ │ -settings are <tt class="docutils literal">active_downloads</tt> = 2 and <tt class="docutils literal">active_seeds</tt> = 4,
│ │ │ │ -then there will be 2 downloading torrents and 4 seeding torrents
│ │ │ │ -active. Torrents that are not auto managed are not counted against
│ │ │ │ -these limits.</p>
│ │ │ │ -<p><tt class="docutils literal">active_checking</tt> is the limit of number of simultaneous checking
│ │ │ │ -torrents.</p>
│ │ │ │ -<p><tt class="docutils literal">active_limit</tt> is a hard limit on the number of active (auto
│ │ │ │ -managed) torrents. This limit also applies to slow torrents.</p>
│ │ │ │ -<p><tt class="docutils literal">active_dht_limit</tt> is the max number of torrents to announce to
│ │ │ │ -the DHT.</p>
│ │ │ │ -<p><tt class="docutils literal">active_tracker_limit</tt> is the max number of torrents to announce
│ │ │ │ -to their trackers.</p>
│ │ │ │ -<p><tt class="docutils literal">active_lsd_limit</tt> is the max number of torrents to announce to
│ │ │ │ -the local network over the local service discovery protocol.</p>
│ │ │ │ -<p>You can have more torrents <em>active</em>, even though they are not
│ │ │ │ -announced to the DHT, lsd or their tracker. If some peer knows
│ │ │ │ -about you for any reason and tries to connect, it will still be
│ │ │ │ -accepted, unless the torrent is paused, which means it won't accept
│ │ │ │ -any connections.</p>
│ │ │ │ -<a name="auto_manage_interval"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="59%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>auto_manage_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>30</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">auto_manage_interval</tt> is the number of seconds between the
│ │ │ │ -torrent queue is updated, and rotated.</p>
│ │ │ │ -<a name="seed_time_limit"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="46%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="38%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>seed_time_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>24 * 60 * 60</td>
│ │ │ │ +<tr><td>ssl_tcp_socket</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>this is the limit on the time a torrent has been an active seed
│ │ │ │ -(specified in seconds) before it is considered having met the seed
│ │ │ │ -limit criteria. See <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</p>
│ │ │ │ -<a name="auto_scrape_interval"></a>
│ │ │ │ -<a name="auto_scrape_min_interval"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>ssl_utp_socket</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>auto_scrape_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>1800</td>
│ │ │ │ +<tr><td>i2p_socket</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>auto_scrape_min_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>300</td>
│ │ │ │ +<tr><td>num_socket_types</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">auto_scrape_interval</tt> is the number of seconds between scrapes
│ │ │ │ -of queued torrents (auto managed and paused torrents). Auto managed
│ │ │ │ -torrents that are paused, are scraped regularly in order to keep
│ │ │ │ -track of their downloader/seed ratio. This ratio is used to
│ │ │ │ -determine which torrents to seed and which to pause.</p>
│ │ │ │ -<p><tt class="docutils literal">auto_scrape_min_interval</tt> is the minimum number of seconds
│ │ │ │ -between any automatic scrape (regardless of torrent). In case there
│ │ │ │ -are a large number of paused auto managed torrents, this puts a
│ │ │ │ -limit on how often a scrape request is sent.</p>
│ │ │ │ -<a name="max_peerlist_size"></a>
│ │ │ │ -<a name="max_paused_peerlist_size"></a><table border="1" class="docutils">
│ │ │ │ +<a name="storage_params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_params&labels=documentation&body=Documentation+under+heading+%22class+storage_params%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="storage-params">
│ │ │ │ +<h1>storage_params</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/storage_defs.hpp">libtorrent/storage_defs.hpp</a>&quot;</p>
│ │ │ │ +<p>a parameter pack used to construct the storage for a torrent, used in
│ │ │ │ +<a class="reference external" href="reference-Custom_Storage.html#disk_interface">disk_interface</a></p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct storage_params
│ │ │ │ +{
│ │ │ │ +   <strong>storage_params</strong> (file_storage const&amp; f, file_storage const* mf
│ │ │ │ +      , std::string const&amp; sp, storage_mode_t const sm
│ │ │ │ +      , aux::vector&lt;download_priority_t, file_index_t&gt; const&amp; prio
│ │ │ │ +      , sha1_hash const&amp; ih);
│ │ │ │ +
│ │ │ │ +   file_storage const&amp; files;
│ │ │ │ +   file_storage const* <strong>mapped_files</strong>  = nullptr;
│ │ │ │ +   std::string const&amp; path;
│ │ │ │ +   storage_mode_t <strong>mode</strong> {storage_mode_sparse};
│ │ │ │ +   aux::vector&lt;download_priority_t, file_index_t&gt; const&amp; priorities;
│ │ │ │ +   sha1_hash info_hash;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="file_slice"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_slice&labels=documentation&body=Documentation+under+heading+%22class+file_slice%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-slice">
│ │ │ │ +<h1>file_slice</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/file_storage.hpp">libtorrent/file_storage.hpp</a>&quot;</p>
│ │ │ │ +<p>represents a window of a file in a torrent.</p>
│ │ │ │ +<p>The <tt class="docutils literal">file_index</tt> refers to the index of the file (in the <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>).
│ │ │ │ +To get the path and filename, use <tt class="docutils literal">file_path()</tt> and give the <tt class="docutils literal">file_index</tt>
│ │ │ │ +as argument. The <tt class="docutils literal">offset</tt> is the byte offset in the file where the range
│ │ │ │ +starts, and <tt class="docutils literal">size</tt> is the number of bytes this range is. The size + offset
│ │ │ │ +will never be greater than the file size.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct file_slice
│ │ │ │ +{
│ │ │ │ +   file_index_t file_index;
│ │ │ │ +   std::int64_t offset;
│ │ │ │ +   std::int64_t size;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="file_index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_slice%3A%3A%5Bfile_index%5D&labels=documentation&body=Documentation+under+heading+%22file_slice%3A%3A%5Bfile_index%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>file_index</dt>
│ │ │ │ +<dd>the index of the file</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="offset"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_slice%3A%3A%5Boffset%5D&labels=documentation&body=Documentation+under+heading+%22file_slice%3A%3A%5Boffset%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>offset</dt>
│ │ │ │ +<dd>the offset from the start of the file, in bytes</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="size"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_slice%3A%3A%5Bsize%5D&labels=documentation&body=Documentation+under+heading+%22file_slice%3A%3A%5Bsize%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>size</dt>
│ │ │ │ +<dd>the size of the window, in bytes</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_storage"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_storage&labels=documentation&body=Documentation+under+heading+%22class+file_storage%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-storage">
│ │ │ │ +<h1>file_storage</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/file_storage.hpp">libtorrent/file_storage.hpp</a>&quot;</p>
│ │ │ │ +<p>The <tt class="docutils literal">file_storage</tt> class represents a file list and the piece
│ │ │ │ +size. Everything necessary to interpret a regular bittorrent storage
│ │ │ │ +file structure.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +class file_storage
│ │ │ │ +{
│ │ │ │ +   bool <strong>is_valid</strong> () const;
│ │ │ │ +   void <strong>reserve</strong> (int num_files);
│ │ │ │ +   void <strong>add_file_borrow</strong> (error_code&amp; ec, string_view filename
│ │ │ │ +      , std::string const&amp; path, std::int64_t file_size
│ │ │ │ +      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ +      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ +   void <strong>add_file</strong> (error_code&amp; ec, std::string const&amp; path, std::int64_t file_size
│ │ │ │ +      , file_flags_t file_flags = {}
│ │ │ │ +      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ +   void <strong>add_file</strong> (std::string const&amp; path, std::int64_t file_size
│ │ │ │ +      , file_flags_t file_flags = {}
│ │ │ │ +      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ +   void <strong>add_file_borrow</strong> (string_view filename
│ │ │ │ +      , std::string const&amp; path, std::int64_t file_size
│ │ │ │ +      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ +      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ +   void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │ +   std::vector&lt;file_slice&gt; <strong>map_block</strong> (piece_index_t piece, std::int64_t offset
│ │ │ │ +      , std::int64_t size) const;
│ │ │ │ +   peer_request <strong>map_file</strong> (file_index_t file, std::int64_t offset, int size) const;
│ │ │ │ +   int <strong>num_files</strong> () const noexcept;
│ │ │ │ +   file_index_t <strong>end_file</strong> () const noexcept;
│ │ │ │ +   index_range&lt;file_index_t&gt; <strong>file_range</strong> () const noexcept;
│ │ │ │ +   std::int64_t <strong>total_size</strong> () const;
│ │ │ │ +   int <strong>num_pieces</strong> () const;
│ │ │ │ +   void <strong>set_num_pieces</strong> (int n);
│ │ │ │ +   piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ +   piece_index_t <strong>last_piece</strong> () const;
│ │ │ │ +   index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │ +   void <strong>set_piece_length</strong> (int l);
│ │ │ │ +   int <strong>piece_length</strong> () const;
│ │ │ │ +   int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │ +   int <strong>piece_size2</strong> (piece_index_t index) const;
│ │ │ │ +   int <strong>blocks_in_piece2</strong> (piece_index_t index) const;
│ │ │ │ +   int <strong>blocks_per_piece</strong> () const;
│ │ │ │ +   std::string const&amp; <strong>name</strong> () const;
│ │ │ │ +   void <strong>set_name</strong> (std::string const&amp; n);
│ │ │ │ +   void <strong>swap</strong> (file_storage&amp; ti) noexcept;
│ │ │ │ +   void <strong>canonicalize</strong> ();
│ │ │ │ +   sha256_hash <strong>root</strong> (file_index_t index) const;
│ │ │ │ +   bool <strong>pad_file_at</strong> (file_index_t index) const;
│ │ │ │ +   char const* <strong>root_ptr</strong> (file_index_t const index) const;
│ │ │ │ +   std::string <strong>symlink</strong> (file_index_t index) const;
│ │ │ │ +   std::int64_t <strong>file_size</strong> (file_index_t index) const;
│ │ │ │ +   std::int64_t <strong>file_offset</strong> (file_index_t index) const;
│ │ │ │ +   string_view <strong>file_name</strong> (file_index_t index) const;
│ │ │ │ +   std::string <strong>file_path</strong> (file_index_t index, std::string const&amp; save_path = &quot;&quot;) const;
│ │ │ │ +   sha1_hash <strong>hash</strong> (file_index_t index) const;
│ │ │ │ +   std::time_t <strong>mtime</strong> (file_index_t index) const;
│ │ │ │ +   index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t) const;
│ │ │ │ +   int <strong>file_num_blocks</strong> (file_index_t index) const;
│ │ │ │ +   int <strong>file_num_pieces</strong> (file_index_t index) const;
│ │ │ │ +   int <strong>file_first_block_node</strong> (file_index_t index) const;
│ │ │ │ +   int <strong>file_first_piece_node</strong> (file_index_t index) const;
│ │ │ │ +   std::uint32_t <strong>file_path_hash</strong> (file_index_t index, std::string const&amp; save_path) const;
│ │ │ │ +   void <strong>all_path_hashes</strong> (std::unordered_set&lt;std::uint32_t&gt;&amp; table) const;
│ │ │ │ +   file_flags_t <strong>file_flags</strong> (file_index_t index) const;
│ │ │ │ +   bool <strong>file_absolute_path</strong> (file_index_t index) const;
│ │ │ │ +   file_index_t <strong>file_index_at_offset</strong> (std::int64_t offset) const;
│ │ │ │ +   file_index_t <strong>file_index_at_piece</strong> (piece_index_t piece) const;
│ │ │ │ +   file_index_t <strong>file_index_for_root</strong> (sha256_hash const&amp; root_hash) const;
│ │ │ │ +   piece_index_t <strong>piece_index_at_file</strong> (file_index_t f) const;
│ │ │ │ +   void <strong>sanitize_symlinks</strong> ();
│ │ │ │ +   bool <strong>v2</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr file_flags_t <strong>flag_pad_file</strong>  = 0_bit;
│ │ │ │ +   static constexpr file_flags_t <strong>flag_hidden</strong>  = 1_bit;
│ │ │ │ +   static constexpr file_flags_t <strong>flag_executable</strong>  = 2_bit;
│ │ │ │ +   static constexpr file_flags_t <strong>flag_symlink</strong>  = 3_bit;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="is_valid()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bis_valid%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bis_valid%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="is-valid-3">
│ │ │ │ +<h2>is_valid()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>is_valid</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if the piece length has been initialized
│ │ │ │ +on the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>. This is typically taken as a proxy
│ │ │ │ +of whether the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> as a whole is initialized or
│ │ │ │ +not.</p>
│ │ │ │ +<a name="reserve()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Breserve%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Breserve%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="reserve">
│ │ │ │ +<h2>reserve()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>reserve</strong> (int num_files);
│ │ │ │ +</pre>
│ │ │ │ +<p>allocates space for <tt class="docutils literal">num_files</tt> in the internal file list. This can
│ │ │ │ +be used to avoid reallocating the internal file list when the number
│ │ │ │ +of files to be added is known up-front.</p>
│ │ │ │ +<a name="add_file_borrow()"></a>
│ │ │ │ +<a name="add_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Badd_file_borrow%28%29+add_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Badd_file_borrow%28%29+add_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-file-borrow-add-file">
│ │ │ │ +<h2>add_file_borrow() add_file()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>add_file_borrow</strong> (error_code&amp; ec, string_view filename
│ │ │ │ +      , std::string const&amp; path, std::int64_t file_size
│ │ │ │ +      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ +      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ +void <strong>add_file</strong> (error_code&amp; ec, std::string const&amp; path, std::int64_t file_size
│ │ │ │ +      , file_flags_t file_flags = {}
│ │ │ │ +      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ +void <strong>add_file</strong> (std::string const&amp; path, std::int64_t file_size
│ │ │ │ +      , file_flags_t file_flags = {}
│ │ │ │ +      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ +void <strong>add_file_borrow</strong> (string_view filename
│ │ │ │ +      , std::string const&amp; path, std::int64_t file_size
│ │ │ │ +      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ +      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ +</pre>
│ │ │ │ +<p>Adds a file to the file storage. The <tt class="docutils literal">add_file_borrow</tt> version
│ │ │ │ +expects that <tt class="docutils literal">filename</tt> is the file name (without a path) of
│ │ │ │ +the file that's being added.
│ │ │ │ +This memory is <em>borrowed</em>, i.e. it is the caller's
│ │ │ │ +responsibility to make sure it stays valid throughout the lifetime
│ │ │ │ +of this <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object or any copy of it. The same thing applies
│ │ │ │ +to <tt class="docutils literal">filehash</tt>, which is an optional pointer to a 20 byte binary
│ │ │ │ +SHA-1 hash of the file.</p>
│ │ │ │ +<p>if <tt class="docutils literal">filename</tt> is empty, the filename from <tt class="docutils literal">path</tt> is used and not
│ │ │ │ +borrowed.</p>
│ │ │ │ +<p>The <tt class="docutils literal">path</tt> argument is the full path (in the torrent file) to
│ │ │ │ +the file to add. Note that this is not supposed to be an absolute
│ │ │ │ +path, but it is expected to include the name of the torrent as the
│ │ │ │ +first path element.</p>
│ │ │ │ +<p><tt class="docutils literal">file_size</tt> is the size of the file in bytes.</p>
│ │ │ │ +<p>The <tt class="docutils literal">file_flags</tt> argument sets attributes on the file. The file
│ │ │ │ +attributes is an extension and may not work in all bittorrent clients.</p>
│ │ │ │ +<p>For possible file attributes, see file_storage::flags_t.</p>
│ │ │ │ +<p>The <tt class="docutils literal">mtime</tt> argument is optional and can be set to 0. If non-zero,
│ │ │ │ +it is the posix time of the last modification time of this file.</p>
│ │ │ │ +<p><tt class="docutils literal">symlink_path</tt> is the path the file is a symlink to. To make this a
│ │ │ │ +symlink you also need to set the <a class="reference external" href="reference-Storage.html#flag_symlink">file_storage::flag_symlink</a> file flag.</p>
│ │ │ │ +<p><tt class="docutils literal">root_hash</tt> is an optional pointer to a 32 byte SHA-256 hash, being
│ │ │ │ +the merkle tree root hash for this file. This is only used for v2
│ │ │ │ +torrents. If the <tt class="docutils literal">root hash</tt> is specified for one file, it has to
│ │ │ │ +be specified for all, otherwise this function will fail.
│ │ │ │ +Note that the buffer <tt class="docutils literal">root_hash</tt> points to must out-live the
│ │ │ │ +<a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object, it will not be copied. This parameter is only
│ │ │ │ +used when <em>loading</em> torrents, that already have their file hashes
│ │ │ │ +computed. When creating torrents, the file hashes will be computed by
│ │ │ │ +the piece hashes.</p>
│ │ │ │ +<p>If more files than one are added, certain restrictions to their paths
│ │ │ │ +apply. In a multi-file file storage (torrent), all files must share
│ │ │ │ +the same root directory.</p>
│ │ │ │ +<p>That is, the first path element of all files must be the same.
│ │ │ │ +This shared path element is also set to the name of the torrent. It
│ │ │ │ +can be changed by calling <tt class="docutils literal">set_name</tt>.</p>
│ │ │ │ +<p>The overloads that take an <cite>error_code</cite> reference will report failures
│ │ │ │ +via that variable, otherwise <cite>system_error</cite> is thrown.</p>
│ │ │ │ +<a name="rename_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Brename_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Brename_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="rename-file-2">
│ │ │ │ +<h2>rename_file()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>rename_file</strong> (file_index_t index, std::string const&amp; new_filename);
│ │ │ │ +</pre>
│ │ │ │ +<p>renames the file at <tt class="docutils literal">index</tt> to <tt class="docutils literal">new_filename</tt>. Keep in mind
│ │ │ │ +that filenames are expected to be UTF-8 encoded.</p>
│ │ │ │ +<a name="map_block()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bmap_block%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bmap_block%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="map-block-1">
│ │ │ │ +<h2>map_block()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;file_slice&gt; <strong>map_block</strong> (piece_index_t piece, std::int64_t offset
│ │ │ │ +      , std::int64_t size) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a list of <a class="reference external" href="reference-Storage.html#file_slice">file_slice</a> objects representing the portions of
│ │ │ │ +files the specified piece index, byte offset and size range overlaps.
│ │ │ │ +this is the inverse mapping of <a class="reference external" href="reference-Storage.html#map_file()">map_file()</a>.</p>
│ │ │ │ +<p>Preconditions of this function is that the input range is within the
│ │ │ │ +torrents address space. <tt class="docutils literal">piece</tt> may not be negative and</p>
│ │ │ │ +<blockquote>
│ │ │ │ +<tt class="docutils literal">piece</tt> * piece_size + <tt class="docutils literal">offset</tt> + <tt class="docutils literal">size</tt></blockquote>
│ │ │ │ +<p>may not exceed the total size of the torrent.</p>
│ │ │ │ +<a name="map_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bmap_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bmap_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="map-file-1">
│ │ │ │ +<h2>map_file()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +peer_request <strong>map_file</strong> (file_index_t file, std::int64_t offset, int size) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> representing the piece index, byte offset
│ │ │ │ +and size the specified file range overlaps. This is the inverse
│ │ │ │ +mapping over <a class="reference external" href="reference-Storage.html#map_block()">map_block()</a>. Note that the <tt class="docutils literal">peer_request</tt> return type
│ │ │ │ +is meant to hold bittorrent block requests, which may not be larger
│ │ │ │ +than 16 kiB. Mapping a range larger than that may return an overflown
│ │ │ │ +integer.</p>
│ │ │ │ +<a name="num_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bnum_files%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bnum_files%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="num-files-1">
│ │ │ │ +<h2>num_files()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>num_files</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the number of files in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a></p>
│ │ │ │ +<a name="end_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bend_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bend_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="end-file">
│ │ │ │ +<h2>end_file()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +file_index_t <strong>end_file</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the index of the one-past-end file in the file storage</p>
│ │ │ │ +<a name="file_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-range-1">
│ │ │ │ +<h2>file_range()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +index_range&lt;file_index_t&gt; <strong>file_range</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns an implementation-defined type that can be used as the
│ │ │ │ +container in a range-for loop. Where the values are the indices of all
│ │ │ │ +files in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │ +<a name="total_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Btotal_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Btotal_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="total-size-2">
│ │ │ │ +<h2>total_size()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::int64_t <strong>total_size</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the total number of bytes all the files in this torrent spans</p>
│ │ │ │ +<a name="set_num_pieces()"></a>
│ │ │ │ +<a name="num_pieces()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bset_num_pieces%28%29+num_pieces%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bset_num_pieces%28%29+num_pieces%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-num-pieces-num-pieces">
│ │ │ │ +<h2>set_num_pieces() num_pieces()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>num_pieces</strong> () const;
│ │ │ │ +void <strong>set_num_pieces</strong> (int n);
│ │ │ │ +</pre>
│ │ │ │ +<p>set and get the number of pieces in the torrent</p>
│ │ │ │ +<a name="end_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bend_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bend_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="end-piece">
│ │ │ │ +<h2>end_piece()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the index of the one-past-end piece in the file storage</p>
│ │ │ │ +<a name="last_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Blast_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Blast_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="last-piece">
│ │ │ │ +<h2>last_piece()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +piece_index_t <strong>last_piece</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the index of the last piece in the torrent. The last piece is
│ │ │ │ +special in that it may be smaller than the other pieces (and the other
│ │ │ │ +pieces are all the same size).</p>
│ │ │ │ +<a name="piece_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-range-1">
│ │ │ │ +<h2>piece_range()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns an implementation-defined type that can be used as the
│ │ │ │ +container in a range-for loop. Where the values are the indices of all
│ │ │ │ +pieces in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │ +<a name="piece_length()"></a>
│ │ │ │ +<a name="set_piece_length()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_length%28%29+set_piece_length%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_length%28%29+set_piece_length%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-length-set-piece-length">
│ │ │ │ +<h2>piece_length() set_piece_length()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_piece_length</strong> (int l);
│ │ │ │ +int <strong>piece_length</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>set and get the size of each piece in this torrent. It must be a power of two
│ │ │ │ +and at least 16 kiB.</p>
│ │ │ │ +<a name="piece_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-size-1">
│ │ │ │ +<h2>piece_size()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>piece_size</strong> (piece_index_t index) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the piece size of <tt class="docutils literal">index</tt>. This will be the same as <a class="reference external" href="reference-Storage.html#piece_length()">piece_length()</a>, except
│ │ │ │ +for the last piece, which may be shorter.</p>
│ │ │ │ +<a name="piece_size2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_size2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_size2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-size2">
│ │ │ │ +<h2>piece_size2()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>piece_size2</strong> (piece_index_t index) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Returns the size of the given piece. If the piece spans multiple files,
│ │ │ │ +only the first file is considered part of the piece. This is used for
│ │ │ │ +v2 torrents, where all files are piece aligned and padded. i.e. The pad
│ │ │ │ +files are not considered part of the piece for this purpose.</p>
│ │ │ │ +<a name="blocks_in_piece2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bblocks_in_piece2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bblocks_in_piece2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="blocks-in-piece2">
│ │ │ │ +<h2>blocks_in_piece2()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>blocks_in_piece2</strong> (piece_index_t index) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the number of blocks in the specified piece, for v2 torrents.</p>
│ │ │ │ +<a name="blocks_per_piece()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bblocks_per_piece%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bblocks_per_piece%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="blocks-per-piece-1">
│ │ │ │ +<h2>blocks_per_piece()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>blocks_per_piece</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the number of blocks there are in the typical piece. There
│ │ │ │ +may be fewer in the last piece)</p>
│ │ │ │ +<a name="name()"></a>
│ │ │ │ +<a name="set_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bname%28%29+set_name%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bname%28%29+set_name%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="name-set-name">
│ │ │ │ +<h2>name() set_name()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::string const&amp; <strong>name</strong> () const;
│ │ │ │ +void <strong>set_name</strong> (std::string const&amp; n);
│ │ │ │ +</pre>
│ │ │ │ +<p>set and get the name of this torrent. For multi-file torrents, this is also
│ │ │ │ +the name of the root directory all the files are stored in.</p>
│ │ │ │ +<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="swap-1">
│ │ │ │ +<h2>swap()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>swap</strong> (file_storage&amp; ti) noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>swap all content of <em>this</em> with <em>ti</em>.</p>
│ │ │ │ +<a name="canonicalize()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bcanonicalize%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bcanonicalize%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="canonicalize">
│ │ │ │ +<h2>canonicalize()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>canonicalize</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>arrange files and padding to match the canonical form required
│ │ │ │ +by BEP 52</p>
│ │ │ │ +<a name="file_offset()"></a>
│ │ │ │ +<a name="symlink()"></a>
│ │ │ │ +<a name="hash()"></a>
│ │ │ │ +<a name="file_name()"></a>
│ │ │ │ +<a name="file_size()"></a>
│ │ │ │ +<a name="root_ptr()"></a>
│ │ │ │ +<a name="root()"></a>
│ │ │ │ +<a name="file_path()"></a>
│ │ │ │ +<a name="pad_file_at()"></a>
│ │ │ │ +<a name="mtime()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_offset%28%29+symlink%28%29+hash%28%29+file_name%28%29+file_size%28%29+root_ptr%28%29+root%28%29+file_path%28%29+pad_file_at%28%29+mtime%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_offset%28%29+symlink%28%29+hash%28%29+file_name%28%29+file_size%28%29+root_ptr%28%29+root%28%29+file_path%28%29+pad_file_at%28%29+mtime%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-offset-symlink-hash-file-name-file-size-root-ptr-root-file-path-pad-file-at-mtime">
│ │ │ │ +<h2>file_offset() symlink() hash() file_name() file_size() root_ptr() root() file_path() pad_file_at() mtime()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +sha256_hash <strong>root</strong> (file_index_t index) const;
│ │ │ │ +bool <strong>pad_file_at</strong> (file_index_t index) const;
│ │ │ │ +char const* <strong>root_ptr</strong> (file_index_t const index) const;
│ │ │ │ +std::string <strong>symlink</strong> (file_index_t index) const;
│ │ │ │ +std::int64_t <strong>file_size</strong> (file_index_t index) const;
│ │ │ │ +std::int64_t <strong>file_offset</strong> (file_index_t index) const;
│ │ │ │ +string_view <strong>file_name</strong> (file_index_t index) const;
│ │ │ │ +std::string <strong>file_path</strong> (file_index_t index, std::string const&amp; save_path = &quot;&quot;) const;
│ │ │ │ +sha1_hash <strong>hash</strong> (file_index_t index) const;
│ │ │ │ +std::time_t <strong>mtime</strong> (file_index_t index) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>These functions are used to query attributes of files at
│ │ │ │ +a given index.</p>
│ │ │ │ +<p>The <tt class="docutils literal">hash()</tt> is a SHA-1 hash of the file, or 0 if none was
│ │ │ │ +provided in the torrent file. This can potentially be used to
│ │ │ │ +join a bittorrent network with other file sharing networks.</p>
│ │ │ │ +<p><tt class="docutils literal">root()</tt> returns the SHA-256 merkle tree root of the specified file,
│ │ │ │ +in case this is a v2 torrent. Otherwise returns zeros.
│ │ │ │ +<tt class="docutils literal">root_ptr()</tt> returns a pointer to the SHA-256 merkle tree root hash
│ │ │ │ +for the specified file. The pointer points into storage referred to
│ │ │ │ +when the file was added, it is not owned by this object. Torrents
│ │ │ │ +that are not v2 torrents return nullptr.</p>
│ │ │ │ +<p>The <tt class="docutils literal">mtime()</tt> is the modification time is the posix
│ │ │ │ +time when a file was last modified when the torrent
│ │ │ │ +was created, or 0 if it was not included in the torrent file.</p>
│ │ │ │ +<p><tt class="docutils literal">file_path()</tt> returns the full path to a file.</p>
│ │ │ │ +<p><tt class="docutils literal">file_size()</tt> returns the size of a file.</p>
│ │ │ │ +<p><tt class="docutils literal">pad_file_at()</tt> returns true if the file at the given
│ │ │ │ +index is a pad-file.</p>
│ │ │ │ +<p><tt class="docutils literal">file_name()</tt> returns <em>just</em> the name of the file, whereas
│ │ │ │ +<tt class="docutils literal">file_path()</tt> returns the path (inside the torrent file) with
│ │ │ │ +the filename appended.</p>
│ │ │ │ +<p><tt class="docutils literal">file_offset()</tt> returns the byte offset within the torrent file
│ │ │ │ +where this file starts. It can be used to map the file to a piece
│ │ │ │ +index (given the piece size).</p>
│ │ │ │ +<a name="file_num_pieces()"></a>
│ │ │ │ +<a name="file_piece_range()"></a>
│ │ │ │ +<a name="file_num_blocks()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_num_pieces%28%29+file_piece_range%28%29+file_num_blocks%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_num_pieces%28%29+file_piece_range%28%29+file_num_blocks%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-num-pieces-file-piece-range-file-num-blocks">
│ │ │ │ +<h2>file_num_pieces() file_piece_range() file_num_blocks()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t) const;
│ │ │ │ +int <strong>file_num_blocks</strong> (file_index_t index) const;
│ │ │ │ +int <strong>file_num_pieces</strong> (file_index_t index) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Returns the number of pieces or blocks the file at <cite>index</cite> spans,
│ │ │ │ +under the assumption that the file is aligned to the start of a piece.
│ │ │ │ +This is only meaningful for v2 torrents, where files are guaranteed
│ │ │ │ +such alignment.
│ │ │ │ +These numbers are used to size and navigate the merkle hash tree for
│ │ │ │ +each file.</p>
│ │ │ │ +<a name="file_first_block_node()"></a>
│ │ │ │ +<a name="file_first_piece_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_first_block_node%28%29+file_first_piece_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_first_block_node%28%29+file_first_piece_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-first-block-node-file-first-piece-node">
│ │ │ │ +<h2>file_first_block_node() file_first_piece_node()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>file_first_block_node</strong> (file_index_t index) const;
│ │ │ │ +int <strong>file_first_piece_node</strong> (file_index_t index) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>index of first piece node in the merkle tree</p>
│ │ │ │ +<a name="file_path_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_path_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_path_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-path-hash">
│ │ │ │ +<h2>file_path_hash()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::uint32_t <strong>file_path_hash</strong> (file_index_t index, std::string const&amp; save_path) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the crc32 hash of file_path(index)</p>
│ │ │ │ +<a name="all_path_hashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Ball_path_hashes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Ball_path_hashes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="all-path-hashes">
│ │ │ │ +<h2>all_path_hashes()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>all_path_hashes</strong> (std::unordered_set&lt;std::uint32_t&gt;&amp; table) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>this will add the CRC32 hash of all directory entries to the table. No
│ │ │ │ +filename will be included, just directories. Every depth of directories
│ │ │ │ +are added separately to allow test for collisions with files at all
│ │ │ │ +levels. i.e. if one path in the torrent is <tt class="docutils literal">foo/bar/baz</tt>, the CRC32
│ │ │ │ +hashes for <tt class="docutils literal">foo</tt>, <tt class="docutils literal">foo/bar</tt> and <tt class="docutils literal">foo/bar/baz</tt> will be added to
│ │ │ │ +the set.</p>
│ │ │ │ +<a name="file_flags()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_flags%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_flags%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-flags">
│ │ │ │ +<h2>file_flags()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +file_flags_t <strong>file_flags</strong> (file_index_t index) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a bitmask of flags from file_flags_t that apply
│ │ │ │ +to file at <tt class="docutils literal">index</tt>.</p>
│ │ │ │ +<a name="file_absolute_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_absolute_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_absolute_path%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-absolute-path">
│ │ │ │ +<h2>file_absolute_path()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>file_absolute_path</strong> (file_index_t index) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if the file at the specified index has been renamed to
│ │ │ │ +have an absolute path, i.e. is not anchored in the save path of the
│ │ │ │ +torrent.</p>
│ │ │ │ +<a name="file_index_at_piece()"></a>
│ │ │ │ +<a name="file_index_at_offset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_index_at_piece%28%29+file_index_at_offset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_index_at_piece%28%29+file_index_at_offset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-index-at-piece-file-index-at-offset">
│ │ │ │ +<h2>file_index_at_piece() file_index_at_offset()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +file_index_t <strong>file_index_at_offset</strong> (std::int64_t offset) const;
│ │ │ │ +file_index_t <strong>file_index_at_piece</strong> (piece_index_t piece) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the index of the file at the given offset in the torrent</p>
│ │ │ │ +<a name="file_index_for_root()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bfile_index_for_root%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bfile_index_for_root%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-index-for-root">
│ │ │ │ +<h2>file_index_for_root()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +file_index_t <strong>file_index_for_root</strong> (sha256_hash const&amp; root_hash) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>finds the file with the given root hash and returns its index
│ │ │ │ +if there is no file with the root hash, file_index_t{-1} is returned</p>
│ │ │ │ +<a name="piece_index_at_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bpiece_index_at_file%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bpiece_index_at_file%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-index-at-file">
│ │ │ │ +<h2>piece_index_at_file()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +piece_index_t <strong>piece_index_at_file</strong> (file_index_t f) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the piece index the given file starts at</p>
│ │ │ │ +<a name="sanitize_symlinks()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bsanitize_symlinks%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bsanitize_symlinks%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="sanitize-symlinks">
│ │ │ │ +<h2>sanitize_symlinks()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>sanitize_symlinks</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>validate any symlinks, to ensure they all point to
│ │ │ │ +other files or directories inside this storage. Any invalid symlinks
│ │ │ │ +are updated to point to themselves.</p>
│ │ │ │ +<a name="v2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bv2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bv2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="v2">
│ │ │ │ +<h2>v2()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>v2</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if this torrent contains v2 metadata.</p>
│ │ │ │ +<a name="flag_pad_file"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bflag_pad_file%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bflag_pad_file%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>flag_pad_file</dt>
│ │ │ │ +<dd>the file is a pad file. It's required to contain zeros
│ │ │ │ +at it will not be saved to disk. Its purpose is to make
│ │ │ │ +the following file start on a piece boundary.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="flag_hidden"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bflag_hidden%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bflag_hidden%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>flag_hidden</dt>
│ │ │ │ +<dd>this file has the hidden attribute set. This is primarily
│ │ │ │ +a windows attribute</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="flag_executable"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bflag_executable%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bflag_executable%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>flag_executable</dt>
│ │ │ │ +<dd>this file has the executable attribute set.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="flag_symlink"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_storage%3A%3A%5Bflag_symlink%5D&labels=documentation&body=Documentation+under+heading+%22file_storage%3A%3A%5Bflag_symlink%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>flag_symlink</dt>
│ │ │ │ +<dd>this file is a symbolic link. It should have a link
│ │ │ │ +target string associated with it.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="mmap_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:mmap_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22mmap_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="mmap-disk-io-constructor">
│ │ │ │ +<h1>mmap_disk_io_constructor()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/mmap_disk_io.hpp">libtorrent/mmap_disk_io.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::unique_ptr&lt;disk_interface&gt; <strong>mmap_disk_io_constructor</strong> (
│ │ │ │ +   io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │ +</pre>
│ │ │ │ +<p>constructs a memory mapped file disk I/O object.</p>
│ │ │ │ +<a name="default_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:default_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22default_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="default-disk-io-constructor">
│ │ │ │ +<h1>default_disk_io_constructor()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session.hpp">libtorrent/session.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::unique_ptr&lt;disk_interface&gt; <strong>default_disk_io_constructor</strong> (
│ │ │ │ +   io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │ +</pre>
│ │ │ │ +<p>the constructor function for the default storage. On systems that support
│ │ │ │ +memory mapped files (and a 64 bit address space) the memory mapped storage
│ │ │ │ +will be constructed, otherwise the portable posix storage.</p>
│ │ │ │ +<a name="disabled_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:disabled_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22disabled_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="disabled-disk-io-constructor">
│ │ │ │ +<h1>disabled_disk_io_constructor()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/disabled_disk_io.hpp">libtorrent/disabled_disk_io.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::unique_ptr&lt;disk_interface&gt; <strong>disabled_disk_io_constructor</strong> (
│ │ │ │ +   io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │ +</pre>
│ │ │ │ +<p>creates a disk io object that discards all data written to it, and only
│ │ │ │ +returns zero-buffers when read from. May be useful for testing and
│ │ │ │ +benchmarking.</p>
│ │ │ │ +<a name="posix_disk_io_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:posix_disk_io_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22posix_disk_io_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="posix-disk-io-constructor">
│ │ │ │ +<h1>posix_disk_io_constructor()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/posix_disk_io.hpp">libtorrent/posix_disk_io.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::unique_ptr&lt;disk_interface&gt; <strong>posix_disk_io_constructor</strong> (
│ │ │ │ +   io_context&amp; ios, settings_interface const&amp;, counters&amp; cnt);
│ │ │ │ +</pre>
│ │ │ │ +<p>this is a simple posix disk I/O back-end, used for systems that don't
│ │ │ │ +have a 64 bit virtual address space or don't support memory mapped files.
│ │ │ │ +It's implemented using portable C file functions and is single-threaded.</p>
│ │ │ │ +<a name="storage_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+storage_mode_t&labels=documentation&body=Documentation+under+heading+%22enum+storage_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-storage-mode-t">
│ │ │ │ +<h1>enum storage_mode_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/storage_defs.hpp">libtorrent/storage_defs.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │  <col width="22%" />
│ │ │ │ +<col width="7%" />
│ │ │ │ +<col width="72%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_peerlist_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3000</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>max_paused_peerlist_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>1000</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">max_peerlist_size</tt> is the maximum number of peers in the list of
│ │ │ │ -known peers. These peers are not necessarily connected, so this
│ │ │ │ -number should be much greater than the maximum number of connected
│ │ │ │ -peers. Peers are evicted from the cache when the list grows passed
│ │ │ │ -90% of this limit, and once the size hits the limit, peers are no
│ │ │ │ -longer added to the list. If this limit is set to 0, there is no
│ │ │ │ -limit on how many peers we'll keep in the peer list.</p>
│ │ │ │ -<p><tt class="docutils literal">max_paused_peerlist_size</tt> is the max peer list size used for
│ │ │ │ -torrents that are paused. This can be used to save memory for paused
│ │ │ │ -torrents, since it's not as important for them to keep a large peer
│ │ │ │ -list.</p>
│ │ │ │ -<a name="min_announce_interval"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>min_announce_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>5 * 60</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>this is the minimum allowed announce interval for a tracker. This
│ │ │ │ -is specified in seconds and is used as a sanity check on what is
│ │ │ │ -returned from a tracker. It mitigates hammering mis-configured
│ │ │ │ -trackers.</p>
│ │ │ │ -<a name="auto_manage_startup"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>auto_manage_startup</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>60</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>this is the number of seconds a torrent is considered active after
│ │ │ │ -it was started, regardless of upload and download speed. This is so
│ │ │ │ -that newly started torrents are not considered inactive until they
│ │ │ │ -have a fair chance to start downloading.</p>
│ │ │ │ -<a name="seeding_piece_quota"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>seeding_piece_quota</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>20</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">seeding_piece_quota</tt> is the number of pieces to send to a peer,
│ │ │ │ -when seeding, before rotating in another peer to the unchoke set.</p>
│ │ │ │ -<a name="max_rejects"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="46%" />
│ │ │ │ -<col width="21%" />
│ │ │ │ -<col width="32%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_rejects</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>50</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">max_rejects</tt> is the number of piece requests we will reject in a
│ │ │ │ -row while a peer is choked before the peer is considered abusive
│ │ │ │ -and is disconnected.</p>
│ │ │ │ -<a name="recv_socket_buffer_size"></a>
│ │ │ │ -<a name="send_socket_buffer_size"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>recv_socket_buffer_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>send_socket_buffer_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>storage_mode_allocate</td>
│ │ │ │  <td>0</td>
│ │ │ │ +<td>All pieces will be written to their final position, all files will be
│ │ │ │ +allocated in full when the torrent is first started. This mode minimizes
│ │ │ │ +fragmentation but could be a costly operation.</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>specifies the buffer sizes set on peer sockets. 0 means the OS
│ │ │ │ -default (i.e. don't change the buffer sizes).
│ │ │ │ -The socket buffer sizes are changed using setsockopt() with
│ │ │ │ -SOL_SOCKET/SO_RCVBUF and SO_SNDBUFFER.</p>
│ │ │ │ -<p>Note that uTP peers share a single UDP socket buffer for each of the
│ │ │ │ -<tt class="docutils literal">listen_interfaces</tt>, along with DHT and UDP tracker traffic.
│ │ │ │ -If the buffer size is too small for the combined traffic through the
│ │ │ │ -socket, packets may be dropped.</p>
│ │ │ │ -<a name="max_peer_recv_buffer_size"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="54%" />
│ │ │ │ -<col width="12%" />
│ │ │ │ -<col width="34%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_peer_recv_buffer_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>2 * 1024 * 1024</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the max number of bytes a single peer connection's receive buffer is
│ │ │ │ -allowed to grow to.</p>
│ │ │ │ -<a name="optimistic_disk_retry"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>optimistic_disk_retry</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>10 * 60</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">optimistic_disk_retry</tt> is the number of seconds from a disk
│ │ │ │ -write errors occur on a torrent until libtorrent will take it out
│ │ │ │ -of the upload mode, to test if the error condition has been fixed.</p>
│ │ │ │ -<p>libtorrent will only do this automatically for auto managed
│ │ │ │ -torrents.</p>
│ │ │ │ -<p>You can explicitly take a torrent out of upload only mode using
│ │ │ │ -set_upload_mode().</p>
│ │ │ │ -<a name="max_suggest_pieces"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_suggest_pieces</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>16</td>
│ │ │ │ +<tr><td>storage_mode_sparse</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>All pieces will be written to the place where they belong and sparse files
│ │ │ │ +will be used. This is the recommended, and default mode.</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">max_suggest_pieces</tt> is the max number of suggested piece indices
│ │ │ │ -received from a peer that's remembered. If a peer floods suggest
│ │ │ │ -messages, this limit prevents libtorrent from using too much RAM.</p>
│ │ │ │ -<a name="local_service_announce_interval"></a><table border="1" class="docutils">
│ │ │ │ +<a name="status_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+status_t&labels=documentation&body=Documentation+under+heading+%22enum+status_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-status-t">
│ │ │ │ +<h1>enum status_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/storage_defs.hpp">libtorrent/storage_defs.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="69%" />
│ │ │ │ -<col width="13%" />
│ │ │ │  <col width="19%" />
│ │ │ │ +<col width="7%" />
│ │ │ │ +<col width="74%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>local_service_announce_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>5 * 60</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">local_service_announce_interval</tt> is the time between local
│ │ │ │ -network announces for a torrent.
│ │ │ │ -This interval is specified in seconds.</p>
│ │ │ │ -<a name="dht_announce_interval"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_announce_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>15 * 60</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">dht_announce_interval</tt> is the number of seconds between
│ │ │ │ -announcing torrents to the distributed hash table (DHT).</p>
│ │ │ │ -<a name="udp_tracker_token_expiry"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>udp_tracker_token_expiry</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>60</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">udp_tracker_token_expiry</tt> is the number of seconds libtorrent
│ │ │ │ -will keep UDP tracker connection tokens around for. This is
│ │ │ │ -specified to be 60 seconds. The higher this
│ │ │ │ -value is, the fewer packets have to be sent to the UDP tracker. In
│ │ │ │ -order for higher values to work, the tracker needs to be configured
│ │ │ │ -to match the expiration time for tokens.</p>
│ │ │ │ -<a name="num_optimistic_unchoke_slots"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="67%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>num_optimistic_unchoke_slots</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>no_error</td>
│ │ │ │  <td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">num_optimistic_unchoke_slots</tt> is the number of optimistic
│ │ │ │ -unchoke slots to use.
│ │ │ │ -Having a higher number of optimistic unchoke slots mean you will
│ │ │ │ -find the good peers faster but with the trade-off to use up more
│ │ │ │ -bandwidth. 0 means automatic, where libtorrent opens up 20% of your
│ │ │ │ -allowed upload slots as optimistic unchoke slots.</p>
│ │ │ │ -<a name="max_pex_peers"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="50%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -<col width="30%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_pex_peers</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>50</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the max number of peers we accept from pex messages from a single
│ │ │ │ -peer. this limits the number of concurrent peers any of our peers
│ │ │ │ -claims to be connected to. If they claim to be connected to more
│ │ │ │ -than this, we'll ignore any peer that exceeds this limit</p>
│ │ │ │ -<a name="tick_interval"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="50%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -<col width="30%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>tick_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>500</td>
│ │ │ │ +<tr><td>fatal_disk_error</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">tick_interval</tt> specifies the number of milliseconds between
│ │ │ │ -internal ticks. This is the frequency with which bandwidth quota is
│ │ │ │ -distributed to peers. It should not be more than one second (i.e.
│ │ │ │ -1000 ms). Setting this to a low value (around 100) means higher
│ │ │ │ -resolution bandwidth quota distribution, setting it to a higher
│ │ │ │ -value saves CPU cycles.</p>
│ │ │ │ -<a name="share_mode_target"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="56%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>need_full_check</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>share_mode_target</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>file_exist</td>
│ │ │ │  <td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">share_mode_target</tt> specifies the target share ratio for share
│ │ │ │ -mode torrents. If set to 3, we'll try to upload 3
│ │ │ │ -times as much as we download. Setting this very high, will make it
│ │ │ │ -very conservative and you might end up not downloading anything
│ │ │ │ -ever (and not affecting your share ratio). It does not make any
│ │ │ │ -sense to set this any lower than 2. For instance, if only 3 peers
│ │ │ │ -need to download the rarest piece, it's impossible to download a
│ │ │ │ -single piece and upload it more than 3 times. If the
│ │ │ │ -share_mode_target is set to more than 3, nothing is downloaded.</p>
│ │ │ │ -<a name="upload_rate_limit"></a>
│ │ │ │ -<a name="download_rate_limit"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>upload_rate_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>download_rate_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">upload_rate_limit</tt> and <tt class="docutils literal">download_rate_limit</tt> sets
│ │ │ │ -the session-global limits of upload and download rate limits, in
│ │ │ │ -bytes per second. By default peers on the local network are not rate
│ │ │ │ -limited.</p>
│ │ │ │ -<p>A value of 0 means unlimited.</p>
│ │ │ │ -<p>For fine grained control over rate limits, including making them apply
│ │ │ │ -to local peers, see <a class="reference external" href="manual-ref.html#peer-classes">peer classes</a>.</p>
│ │ │ │ -<a name="dht_upload_rate_limit"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_upload_rate_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>8000</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the number of bytes per second (on average) the DHT is allowed to send.
│ │ │ │ -If the incoming requests causes to many bytes to be sent in responses,
│ │ │ │ -incoming requests will be dropped until the quota has been replenished.</p>
│ │ │ │ -<a name="unchoke_slots_limit"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>unchoke_slots_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">unchoke_slots_limit</tt> is the max number of unchoked peers in the
│ │ │ │ -<a class="reference external" href="reference-Session.html#session">session</a>. The number of unchoke slots may be ignored depending on
│ │ │ │ -what <tt class="docutils literal">choking_algorithm</tt> is set to. Setting this limit to -1
│ │ │ │ -means unlimited, i.e. all peers will always be unchoked.</p>
│ │ │ │ -<a name="connections_limit"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="56%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>connections_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>200</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">connections_limit</tt> sets a global limit on the number of
│ │ │ │ -connections opened. The number of connections is set to a hard
│ │ │ │ -minimum of at least two per torrent, so if you set a too low
│ │ │ │ -connections limit, and open too many torrents, the limit will not
│ │ │ │ -be met.</p>
│ │ │ │ -<a name="connections_slack"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="56%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>connections_slack</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>10</td>
│ │ │ │ +<tr><td>oversized_file</td>
│ │ │ │ +<td>16</td>
│ │ │ │ +<td>this is not an enum value, but a flag that can be set in the return
│ │ │ │ +from async_check_files, in case an existing file was found larger than
│ │ │ │ +specified in the torrent. i.e. it has garbage at the end
│ │ │ │ +the <a class="reference external" href="reference-Storage.html#status_t">status_t</a> field is used for this to preserve ABI.</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">connections_slack</tt> is the number of incoming connections
│ │ │ │ -exceeding the connection limit to accept in order to potentially
│ │ │ │ -replace existing ones.</p>
│ │ │ │ -<a name="utp_target_delay"></a>
│ │ │ │ -<a name="utp_gain_factor"></a>
│ │ │ │ -<a name="utp_min_timeout"></a>
│ │ │ │ -<a name="utp_syn_resends"></a>
│ │ │ │ -<a name="utp_fin_resends"></a>
│ │ │ │ -<a name="utp_num_resends"></a>
│ │ │ │ -<a name="utp_connect_timeout"></a>
│ │ │ │ -<a name="utp_loss_multiplier"></a><table border="1" class="docutils">
│ │ │ │ +<a name="move_flags_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+move_flags_t&labels=documentation&body=Documentation+under+heading+%22enum+move_flags_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-move-flags-t">
│ │ │ │ +<h1>enum move_flags_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/storage_defs.hpp">libtorrent/storage_defs.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ +<col width="29%" />
│ │ │ │ +<col width="7%" />
│ │ │ │ +<col width="64%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>utp_target_delay</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>100</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>utp_gain_factor</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3000</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>utp_min_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>500</td>
│ │ │ │ +<tr><td>always_replace_files</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>replace any files in the destination when copying
│ │ │ │ +or moving the storage</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>utp_syn_resends</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>2</td>
│ │ │ │ +<tr><td>fail_if_exist</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>if any files that we want to copy exist in the destination
│ │ │ │ +exist, fail the whole operation and don't perform
│ │ │ │ +any copy or move. There is an inherent race condition
│ │ │ │ +in this mode. The files are checked for existence before
│ │ │ │ +the operation starts. In between the check and performing
│ │ │ │ +the copy, the destination files may be created, in which
│ │ │ │ +case they are replaced.</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>utp_fin_resends</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>dont_replace</td>
│ │ │ │  <td>2</td>
│ │ │ │ +<td>if any file exist in the target, take those files instead
│ │ │ │ +of the ones we may have in the source.</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>utp_num_resends</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>reset_save_path</td>
│ │ │ │  <td>3</td>
│ │ │ │ +<td>don't move any source files, just forget about them
│ │ │ │ +and begin checking files at new save path</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>utp_connect_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3000</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>utp_loss_multiplier</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>50</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">utp_target_delay</tt> is the target delay for uTP sockets in
│ │ │ │ -milliseconds. A high value will make uTP connections more
│ │ │ │ -aggressive and cause longer queues in the upload bottleneck. It
│ │ │ │ -cannot be too low, since the noise in the measurements would cause
│ │ │ │ -it to send too slow.
│ │ │ │ -<tt class="docutils literal">utp_gain_factor</tt> is the number of bytes the uTP congestion
│ │ │ │ -window can increase at the most in one RTT.
│ │ │ │ -If this is set too high, the congestion controller reacts
│ │ │ │ -too hard to noise and will not be stable, if it's set too low, it
│ │ │ │ -will react slow to congestion and not back off as fast.</p>
│ │ │ │ -<p><tt class="docutils literal">utp_min_timeout</tt> is the shortest allowed uTP socket timeout,
│ │ │ │ -specified in milliseconds. The
│ │ │ │ -timeout depends on the RTT of the connection, but is never smaller
│ │ │ │ -than this value. A connection times out when every packet in a
│ │ │ │ -window is lost, or when a packet is lost twice in a row (i.e. the
│ │ │ │ -resent packet is lost as well).</p>
│ │ │ │ -<p>The shorter the timeout is, the faster the connection will recover
│ │ │ │ -from this situation, assuming the RTT is low enough.
│ │ │ │ -<tt class="docutils literal">utp_syn_resends</tt> is the number of SYN packets that are sent (and
│ │ │ │ -timed out) before giving up and closing the socket.
│ │ │ │ -<tt class="docutils literal">utp_num_resends</tt> is the number of times a packet is sent (and
│ │ │ │ -lost or timed out) before giving up and closing the connection.
│ │ │ │ -<tt class="docutils literal">utp_connect_timeout</tt> is the number of milliseconds of timeout
│ │ │ │ -for the initial SYN packet for uTP connections. For each timed out
│ │ │ │ -packet (in a row), the timeout is doubled. <tt class="docutils literal">utp_loss_multiplier</tt>
│ │ │ │ -controls how the congestion window is changed when a packet loss is
│ │ │ │ -experienced. It's specified as a percentage multiplier for
│ │ │ │ -<tt class="docutils literal">cwnd</tt>. Do not change this value unless you know what you're doing.
│ │ │ │ -Never set it higher than 100.</p>
│ │ │ │ -<a name="mixed_mode_algorithm"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="35%" />
│ │ │ │ -<col width="10%" />
│ │ │ │ -<col width="55%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>mixed_mode_algorithm</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>settings_pack::peer_proportional</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>The <tt class="docutils literal">mixed_mode_algorithm</tt> determines how to treat TCP
│ │ │ │ -connections when there are uTP connections. Since uTP is designed
│ │ │ │ -to yield to TCP, there's an inherent problem when using swarms that
│ │ │ │ -have both TCP and uTP connections. If nothing is done, uTP
│ │ │ │ -connections would often be starved out for bandwidth by the TCP
│ │ │ │ -connections. This mode is <tt class="docutils literal">prefer_tcp</tt>. The <tt class="docutils literal">peer_proportional</tt>
│ │ │ │ -mode simply looks at the current throughput and rate limits all TCP
│ │ │ │ -connections to their proportional share based on how many of the
│ │ │ │ -connections are TCP. This works best if uTP connections are not
│ │ │ │ -rate limited by the global rate limiter (which they aren't by
│ │ │ │ -default).</p>
│ │ │ │ -<a name="listen_queue_size"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="56%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>listen_queue_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">listen_queue_size</tt> is the value passed in to listen() for the
│ │ │ │ -listen socket. It is the number of outstanding incoming connections
│ │ │ │ -to queue up while we're not actively waiting for a connection to be
│ │ │ │ -accepted. 5 should be sufficient for any
│ │ │ │ -normal client. If this is a high performance server which expects
│ │ │ │ -to receive a lot of connections, or used in a simulator or test, it
│ │ │ │ -might make sense to raise this number. It will not take affect
│ │ │ │ -until the <tt class="docutils literal">listen_interfaces</tt> settings is updated.</p>
│ │ │ │ -<a name="torrent_connect_boost"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>torrent_connect_boost</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>30</td>
│ │ │ │ +<tr><td>reset_save_path_unchecked</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>don't move any source files, just change save path
│ │ │ │ +and continue working without any checks</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">torrent_connect_boost</tt> is the number of peers to try to connect
│ │ │ │ -to immediately when the first tracker response is received for a
│ │ │ │ -torrent. This is a boost to given to new torrents to accelerate
│ │ │ │ -them starting up. The normal connect scheduler is run once every
│ │ │ │ -second, this allows peers to be connected immediately instead of
│ │ │ │ -waiting for the <a class="reference external" href="reference-Session.html#session">session</a> tick to trigger connections.
│ │ │ │ -This may not be set higher than 255.</p>
│ │ │ │ -<a name="alert_queue_size"></a><table border="1" class="docutils">
│ │ │ │ +<p>The <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> function on <a class="reference external" href="reference-Session.html#session">session</a> is the main interface for retrieving
│ │ │ │ +alerts (warnings, messages and errors from libtorrent). If no alerts have
│ │ │ │ +been posted by libtorrent <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> will return an empty list.</p>
│ │ │ │ +<p>By default, only errors are reported. <a class="reference external" href="reference-Settings.html#alert_mask">settings_pack::alert_mask</a> can be
│ │ │ │ +used to specify which kinds of events should be reported. The <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask is
│ │ │ │ +a combination of the <a class="reference external" href="reference-Alerts.html#alert_category_t">alert_category_t</a> flags in the <a class="reference external" href="reference-Alerts.html#alert">alert</a> class.</p>
│ │ │ │ +<p>Every <a class="reference external" href="reference-Alerts.html#alert">alert</a> belongs to one or more category. There is a cost associated with
│ │ │ │ +posting alerts. Only alerts that belong to an enabled category are
│ │ │ │ +posted. Setting the <a class="reference external" href="reference-Alerts.html#alert">alert</a> bitmask to 0 will disable all alerts (except those
│ │ │ │ +that are non-discardable). Alerts that are responses to API calls such as
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> and <a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a> are non-discardable and will be
│ │ │ │ +posted even if their category is disabled.</p>
│ │ │ │ +<p>There are other <a class="reference external" href="reference-Alerts.html#alert">alert</a> base classes that some alerts derive from, all the
│ │ │ │ +alerts that are generated for a specific torrent are derived from
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a>, and tracker events derive from <a class="reference external" href="reference-Alerts.html#tracker_alert">tracker_alert</a>.</p>
│ │ │ │ +<p>Alerts returned by <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> are only valid until the next call to
│ │ │ │ +<a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a>. You may not copy an <a class="reference external" href="reference-Alerts.html#alert">alert</a> object to access it after the next
│ │ │ │ +call to <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a>. Internal members of alerts also become invalid once
│ │ │ │ +<a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> is called again.</p>
│ │ │ │ +<a name="dht_routing_bucket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_routing_bucket&labels=documentation&body=Documentation+under+heading+%22class+dht_routing_bucket%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-routing-bucket">
│ │ │ │ +<h1>dht_routing_bucket</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>struct to hold information about a single DHT routing table bucket</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_routing_bucket
│ │ │ │ +{
│ │ │ │ +   int num_nodes;
│ │ │ │ +   int num_replacements;
│ │ │ │ +   int last_active;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="num_nodes"></a>
│ │ │ │ +<a name="num_replacements"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_routing_bucket%3A%3A%5Bnum_nodes+num_replacements%5D&labels=documentation&body=Documentation+under+heading+%22dht_routing_bucket%3A%3A%5Bnum_nodes+num_replacements%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_nodes num_replacements</dt>
│ │ │ │ +<dd>the total number of nodes and replacement nodes
│ │ │ │ +in the routing table</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="last_active"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_routing_bucket%3A%3A%5Blast_active%5D&labels=documentation&body=Documentation+under+heading+%22dht_routing_bucket%3A%3A%5Blast_active%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>last_active</dt>
│ │ │ │ +<dd>number of seconds since last activity</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-alert">
│ │ │ │ +<h1>torrent_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This is a base class for alerts that are associated with a
│ │ │ │ +specific torrent. It contains a handle to the torrent.</p>
│ │ │ │ +<p>Note that by the time the client receives a <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a>, its
│ │ │ │ +<tt class="docutils literal">handle</tt> member may be invalid.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_alert : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>torrent_name</strong> () const;
│ │ │ │ +
│ │ │ │ +   torrent_handle handle;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_alert%3A%3A%5Bmessage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_alert%3A%3A%5Bmessage%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="message">
│ │ │ │ +<h2>message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::string <strong>message</strong> () const override;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the message associated with this <a class="reference external" href="reference-Alerts.html#alert">alert</a></p>
│ │ │ │ +<a name="handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_alert%3A%3A%5Bhandle%5D&labels=documentation&body=Documentation+under+heading+%22torrent_alert%3A%3A%5Bhandle%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>handle</dt>
│ │ │ │ +<dd>The <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> pointing to the torrent this
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#alert">alert</a> is associated with.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="peer_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="peer-alert">
│ │ │ │ +<h1>peer_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>The peer <a class="reference external" href="reference-Alerts.html#alert">alert</a> is a base class for alerts that refer to a specific peer. It includes all
│ │ │ │ +the information to identify the peer. i.e. <tt class="docutils literal">ip</tt> and <tt class="docutils literal"><span class="pre">peer-id</span></tt>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_alert : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; endpoint;
│ │ │ │ +   peer_id pid;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22peer_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>endpoint</dt>
│ │ │ │ +<dd>The peer's IP address and port.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_alert%3A%3A%5Bpid%5D&labels=documentation&body=Documentation+under+heading+%22peer_alert%3A%3A%5Bpid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>pid</dt>
│ │ │ │ +<dd>the peer ID, if known.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="tracker_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="tracker-alert">
│ │ │ │ +<h1>tracker_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This is a base class used for alerts that are associated with a
│ │ │ │ +specific tracker. It derives from <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a> since a tracker
│ │ │ │ +is also associated with a specific torrent.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct tracker_alert : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>tracker_url</strong> () const;
│ │ │ │ +
│ │ │ │ +   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; local_endpoint;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="tracker_url()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_alert%3A%3A%5Btracker_url%28%29%5D&labels=documentation&body=Documentation+under+heading+%22tracker_alert%3A%3A%5Btracker_url%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="tracker-url">
│ │ │ │ +<h2>tracker_url()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>tracker_url</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a 0-terminated string of the tracker's URL</p>
│ │ │ │ +<a name="local_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_alert%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22tracker_alert%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>local_endpoint</dt>
│ │ │ │ +<dd>endpoint of the listen interface being announced</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_removed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_removed_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_removed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="torrent-removed-alert">
│ │ │ │ +<h1>torrent_removed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>The <tt class="docutils literal">torrent_removed_alert</tt> is posted whenever a torrent is removed. Since
│ │ │ │ +the torrent handle in its base class will usually be invalid (since the torrent
│ │ │ │ +is already removed) it has the info hash as a member, to identify it.
│ │ │ │ +It's posted when the <tt class="docutils literal"><span class="pre">alert_category::status</span></tt> bit is set in the alert_mask.</p>
│ │ │ │ +<p>Note that the <tt class="docutils literal">handle</tt> remains valid for some time after
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a> is posted, as long as some internal libtorrent
│ │ │ │ +task (such as an I/O task) refers to it. Additionally, other alerts like
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a> may be posted after <a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a>.
│ │ │ │ +To synchronize on whether the torrent has been removed or not, call
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#in_session()">torrent_handle::in_session()</a>. This will return true before
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a> is posted, and false afterward.</p>
│ │ │ │ +<p>Even though the <tt class="docutils literal">handle</tt> member doesn't point to an existing torrent anymore,
│ │ │ │ +it is still useful for comparing to other handles, which may also no
│ │ │ │ +longer point to existing torrents, but to the same non-existing torrents.</p>
│ │ │ │ +<p>The <tt class="docutils literal">torrent_handle</tt> acts as a <tt class="docutils literal">weak_ptr</tt>, even though its object no
│ │ │ │ +longer exists, it can still compare equal to another weak pointer which
│ │ │ │ +points to the same non-existent object.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_removed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +   info_hash_t info_hashes;
│ │ │ │ +   client_data_t userdata;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="userdata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_removed_alert%3A%3A%5Buserdata%5D&labels=documentation&body=Documentation+under+heading+%22torrent_removed_alert%3A%3A%5Buserdata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>userdata</dt>
│ │ │ │ +<dd>'<cite>userdata`</cite> as set in <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> at torrent creation.
│ │ │ │ +This can be used to associate this torrent with related data
│ │ │ │ +in the client application more efficiently than info_hashes.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="read_piece_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+read_piece_alert&labels=documentation&body=Documentation+under+heading+%22class+read_piece_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="read-piece-alert">
│ │ │ │ +<h1>read_piece_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the asynchronous read operation initiated by
│ │ │ │ +a call to <a class="reference external" href="reference-Torrent_Handle.html#read_piece()">torrent_handle::read_piece()</a> is completed. If the read failed, the torrent
│ │ │ │ +is paused and an error state is set and the buffer member of the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +is 0. If successful, <tt class="docutils literal">buffer</tt> points to a buffer containing all the data
│ │ │ │ +of the piece. <tt class="docutils literal">piece</tt> is the piece index that was read. <tt class="docutils literal">size</tt> is the
│ │ │ │ +number of bytes that was read.</p>
│ │ │ │ +<p>If the operation fails, <tt class="docutils literal">error</tt> will indicate what went wrong.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct read_piece_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ +   error_code const error;
│ │ │ │ +   boost::shared_array&lt;char&gt; const buffer;
│ │ │ │ +   piece_index_t const piece;
│ │ │ │ +   int const size;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="file_completed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_completed_alert&labels=documentation&body=Documentation+under+heading+%22class+file_completed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-completed-alert">
│ │ │ │ +<h1>file_completed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This is posted whenever an individual file completes its download. i.e.
│ │ │ │ +All pieces overlapping this file have passed their hash check.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct file_completed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   file_index_t const index;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_completed_alert%3A%3A%5Bindex%5D&labels=documentation&body=Documentation+under+heading+%22file_completed_alert%3A%3A%5Bindex%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>index</dt>
│ │ │ │ +<dd>refers to the index of the file that completed.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_renamed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_renamed_alert&labels=documentation&body=Documentation+under+heading+%22class+file_renamed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-renamed-alert">
│ │ │ │ +<h1>file_renamed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This is posted as a response to a <a class="reference external" href="reference-Torrent_Handle.html#rename_file()">torrent_handle::rename_file()</a> call, if the rename
│ │ │ │ +operation succeeds.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct file_renamed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>old_name</strong> () const;
│ │ │ │ +   char const* <strong>new_name</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ +   file_index_t const index;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="new_name()"></a>
│ │ │ │ +<a name="old_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_renamed_alert%3A%3A%5Bnew_name%28%29+old_name%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_renamed_alert%3A%3A%5Bnew_name%28%29+old_name%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="new-name-old-name">
│ │ │ │ +<h2>new_name() old_name()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>old_name</strong> () const;
│ │ │ │ +char const* <strong>new_name</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the new and previous file name, respectively.</p>
│ │ │ │ +<a name="index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_renamed_alert%3A%3A%5Bindex%5D&labels=documentation&body=Documentation+under+heading+%22file_renamed_alert%3A%3A%5Bindex%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>index</dt>
│ │ │ │ +<dd>refers to the index of the file that was renamed,</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_rename_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_rename_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+file_rename_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="file-rename-failed-alert">
│ │ │ │ +<h1>file_rename_failed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This is posted as a response to a <a class="reference external" href="reference-Torrent_Handle.html#rename_file()">torrent_handle::rename_file()</a> call, if the rename
│ │ │ │ +operation failed.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct file_rename_failed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ +   file_index_t const index;
│ │ │ │ +   error_code const error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="index"></a>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_rename_failed_alert%3A%3A%5Bindex+error%5D&labels=documentation&body=Documentation+under+heading+%22file_rename_failed_alert%3A%3A%5Bindex+error%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>index error</dt>
│ │ │ │ +<dd>refers to the index of the file that was supposed to be renamed,
│ │ │ │ +<tt class="docutils literal">error</tt> is the error code returned from the filesystem.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="performance_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+performance_alert&labels=documentation&body=Documentation+under+heading+%22class+performance_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="performance-alert">
│ │ │ │ +<h1>performance_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a limit is reached that might have a negative impact on
│ │ │ │ +upload or download rate performance.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct performance_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   enum performance_warning_t
│ │ │ │ +   {
│ │ │ │ +      outstanding_disk_buffer_limit_reached,
│ │ │ │ +      outstanding_request_limit_reached,
│ │ │ │ +      upload_limit_too_low,
│ │ │ │ +      download_limit_too_low,
│ │ │ │ +      send_buffer_watermark_too_low,
│ │ │ │ +      too_many_optimistic_unchoke_slots,
│ │ │ │ +      too_high_disk_queue_limit,
│ │ │ │ +      aio_limit_reached,
│ │ │ │ +      deprecated_bittyrant_with_no_uplimit,
│ │ │ │ +      too_few_outgoing_ports,
│ │ │ │ +      too_few_file_descriptors,
│ │ │ │ +      num_warnings,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::performance_warning;
│ │ │ │ +   performance_warning_t const warning_code;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="performance_warning_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+performance_warning_t&labels=documentation&body=Documentation+under+heading+%22enum+performance_warning_t%22+could+be+improved">report issue</a>]</span><div class="section" id="enum-performance-warning-t">
│ │ │ │ +<h2>enum performance_warning_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="55%" />
│ │ │ │ -<col width="18%" />
│ │ │ │  <col width="27%" />
│ │ │ │ +<col width="5%" />
│ │ │ │ +<col width="68%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>alert_queue_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>2000</td>
│ │ │ │ +<tr><td>outstanding_disk_buffer_limit_reached</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>This warning means that the number of bytes queued to be written to disk
│ │ │ │ +exceeds the max disk byte queue setting (<tt class="docutils literal"><span class="pre">settings_pack::max_queued_disk_bytes</span></tt>).
│ │ │ │ +This might restrict the download rate, by not queuing up enough write jobs
│ │ │ │ +to the disk I/O thread. When this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted, peer connections are
│ │ │ │ +temporarily stopped from downloading, until the queued disk bytes have fallen
│ │ │ │ +below the limit again. Unless your <tt class="docutils literal">max_queued_disk_bytes</tt> setting is already
│ │ │ │ +high, you might want to increase it to get better performance.</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">alert_queue_size</tt> is the maximum number of alerts queued up
│ │ │ │ -internally. If alerts are not popped, the queue will eventually
│ │ │ │ -fill up to this level. Once the <a class="reference external" href="reference-Alerts.html#alert">alert</a> queue is full, additional
│ │ │ │ -alerts will be dropped, and not delivered to the client. Once the
│ │ │ │ -client drains the queue, new alerts may be delivered again. In order
│ │ │ │ -to know that alerts have been dropped, see
│ │ │ │ -session_handle::dropped_alerts().</p>
│ │ │ │ -<a name="max_metadata_size"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="44%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="42%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>outstanding_request_limit_reached</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>This is posted when libtorrent would like to send more requests to a peer,
│ │ │ │ +but it's limited by <tt class="docutils literal"><span class="pre">settings_pack::max_out_request_queue</span></tt>. The queue length
│ │ │ │ +libtorrent is trying to achieve is determined by the download rate and the
│ │ │ │ +assumed round-trip-time (<tt class="docutils literal"><span class="pre">settings_pack::request_queue_time</span></tt>). The assumed
│ │ │ │ +round-trip-time is not limited to just the network RTT, but also the remote disk
│ │ │ │ +access time and message handling time. It defaults to 3 seconds. The target number
│ │ │ │ +of outstanding requests is set to fill the bandwidth-delay product (assumed RTT
│ │ │ │ +times download rate divided by number of bytes per request). When this <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +is posted, there is a risk that the number of outstanding requests is too low
│ │ │ │ +and limits the download rate. You might want to increase the <tt class="docutils literal">max_out_request_queue</tt>
│ │ │ │ +setting.</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_metadata_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3 * 1024 * 10240</td>
│ │ │ │ +<tr><td>upload_limit_too_low</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>This warning is posted when the amount of TCP/IP overhead is greater than the
│ │ │ │ +upload rate limit. When this happens, the TCP/IP overhead is caused by a much
│ │ │ │ +faster download rate, triggering TCP ACK packets. These packets eat into the
│ │ │ │ +rate limit specified to libtorrent. When the overhead traffic is greater than
│ │ │ │ +the rate limit, libtorrent will not be able to send any actual payload, such
│ │ │ │ +as piece requests. This means the download rate will suffer, and new requests
│ │ │ │ +can be sent again. There will be an equilibrium where the download rate, on
│ │ │ │ +average, is about 20 times the upload rate limit. If you want to maximize the
│ │ │ │ +download rate, increase the upload rate limit above 5% of your download capacity.</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">max_metadata_size</tt> is the maximum allowed size (in bytes) to be
│ │ │ │ -received by the metadata extension, i.e. magnet links.</p>
│ │ │ │ -<a name="hashing_threads"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="53%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="28%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>download_limit_too_low</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>This is the same warning as <tt class="docutils literal">upload_limit_too_low</tt> but referring to the download
│ │ │ │ +limit instead of upload. This suggests that your download rate limit is much lower
│ │ │ │ +than your upload capacity. Your upload rate will suffer. To maximize upload rate,
│ │ │ │ +make sure your download rate limit is above 5% of your upload capacity.</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>hashing_threads</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>1</td>
│ │ │ │ +<tr><td>send_buffer_watermark_too_low</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td><p class="first">We're stalled on the disk. We want to write to the socket, and we can write
│ │ │ │ +but our send buffer is empty, waiting to be refilled from the disk.
│ │ │ │ +This either means the disk is slower than the network connection
│ │ │ │ +or that our send buffer watermark is too small, because we can
│ │ │ │ +send it all before the disk gets back to us.
│ │ │ │ +The number of bytes that we keep outstanding, requested from the disk, is calculated
│ │ │ │ +as follows:</p>
│ │ │ │ +<pre class="code C++ literal-block">
│ │ │ │ +<span class="name">min</span><span class="punctuation">(</span><span class="literal number integer">512</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">max</span><span class="punctuation">(</span><span class="name">upload_rate</span><span class="whitespace"> </span><span class="operator">*</span><span class="whitespace"> </span><span class="name">send_buffer_watermark_factor</span><span class="whitespace"> </span><span class="operator">/</span><span class="whitespace"> </span><span class="literal number integer">100</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">send_buffer_watermark</span><span class="punctuation">))</span>
│ │ │ │ +</pre>
│ │ │ │ +<p class="last">If you receive this <a class="reference external" href="reference-Alerts.html#alert">alert</a>, you might want to either increase your <tt class="docutils literal">send_buffer_watermark</tt>
│ │ │ │ +or <tt class="docutils literal">send_buffer_watermark_factor</tt>.</p>
│ │ │ │ +</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">hashing_threads</tt> is the number of disk I/O threads to use for
│ │ │ │ -piece hash verification. These threads are <em>in addition</em> to the
│ │ │ │ -regular disk I/O threads specified by <a class="reference external" href="reference-Settings.html#aio_threads">settings_pack::aio_threads</a>.
│ │ │ │ -These threads are only used for full checking of torrents. The
│ │ │ │ -hash checking done while downloading are done by the regular disk
│ │ │ │ -I/O threads.
│ │ │ │ -The <a class="reference external" href="reference-Utility.html#hasher">hasher</a> threads do not only compute hashes, but also perform
│ │ │ │ -the read from disk. On storage optimal for sequential access,
│ │ │ │ -such as hard drives, this setting should be set to 1, which is
│ │ │ │ -also the default.</p>
│ │ │ │ -<a name="checking_mem_usage"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>too_many_optimistic_unchoke_slots</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>If the half (or more) of all upload slots are set as optimistic unchoke slots, this
│ │ │ │ +warning is issued. You probably want more regular (rate based) unchoke slots.</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>checking_mem_usage</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>256</td>
│ │ │ │ +<tr><td>too_high_disk_queue_limit</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>If the disk write queue ever grows larger than half of the cache size, this warning
│ │ │ │ +is posted. The disk write queue eats into the total disk cache and leaves very little
│ │ │ │ +left for the actual cache. This causes the disk cache to oscillate in evicting large
│ │ │ │ +portions of the cache before allowing peers to download any more, onto the disk write
│ │ │ │ +queue. Either lower <tt class="docutils literal">max_queued_disk_bytes</tt> or increase <tt class="docutils literal">cache_size</tt>.</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the number of blocks to keep outstanding at any given time when
│ │ │ │ -checking torrents. Higher numbers give faster re-checks but uses
│ │ │ │ -more memory. Specified in number of 16 kiB blocks</p>
│ │ │ │ -<a name="predictive_piece_announce"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="64%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="21%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>aio_limit_reached</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>predictive_piece_announce</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0</td>
│ │ │ │ +<tr><td>deprecated_bittyrant_with_no_uplimit</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>if set to &gt; 0, pieces will be announced to other peers before they
│ │ │ │ -are fully downloaded (and before they are hash checked). The
│ │ │ │ -intention is to gain 1.5 potential round trip times per downloaded
│ │ │ │ -piece. When non-zero, this indicates how many milliseconds in
│ │ │ │ -advance pieces should be announced, before they are expected to be
│ │ │ │ -completed.</p>
│ │ │ │ -<a name="aio_threads"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="46%" />
│ │ │ │ -<col width="21%" />
│ │ │ │ -<col width="32%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>too_few_outgoing_ports</td>
│ │ │ │ +<td>9</td>
│ │ │ │ +<td>This is generated if outgoing peer connections are failing because of <em>address in use</em>
│ │ │ │ +errors, indicating that <tt class="docutils literal"><span class="pre">settings_pack::outgoing_ports</span></tt> is set and is too small of
│ │ │ │ +a range. Consider not using the <tt class="docutils literal">outgoing_ports</tt> setting at all, or widen the range to
│ │ │ │ +include more ports.</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>aio_threads</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>too_few_file_descriptors</td>
│ │ │ │  <td>10</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>for some aio back-ends, <tt class="docutils literal">aio_threads</tt> specifies the number of
│ │ │ │ -io-threads to use.</p>
│ │ │ │ -<a name="tracker_backoff"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="53%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="28%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>tracker_backoff</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>250</td>
│ │ │ │ +<tr><td>num_warnings</td>
│ │ │ │ +<td>11</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">tracker_backoff</tt> determines how aggressively to back off from
│ │ │ │ -retrying failing trackers. This value determines <em>x</em> in the
│ │ │ │ -following formula, determining the number of seconds to wait until
│ │ │ │ -the next retry:</p>
│ │ │ │ -<blockquote>
│ │ │ │ -delay = 5 + 5 * x / 100 * fails^2</blockquote>
│ │ │ │ -<p>This setting may be useful to make libtorrent more or less
│ │ │ │ -aggressive in hitting trackers.</p>
│ │ │ │ -<a name="share_ratio_limit"></a>
│ │ │ │ -<a name="seed_time_ratio_limit"></a><table border="1" class="docutils">
│ │ │ │ +<a name="state_changed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+state_changed_alert&labels=documentation&body=Documentation+under+heading+%22class+state_changed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="state-changed-alert">
│ │ │ │ +<h1>state_changed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>Generated whenever a torrent changes its state.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct state_changed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +   torrent_status::state_t const state;
│ │ │ │ +   torrent_status::state_t const prev_state;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:state_changed_alert%3A%3A%5Bstate%5D&labels=documentation&body=Documentation+under+heading+%22state_changed_alert%3A%3A%5Bstate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>state</dt>
│ │ │ │ +<dd>the new state of the torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="prev_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:state_changed_alert%3A%3A%5Bprev_state%5D&labels=documentation&body=Documentation+under+heading+%22state_changed_alert%3A%3A%5Bprev_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>prev_state</dt>
│ │ │ │ +<dd>the previous state.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="tracker_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_error_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="tracker-error-alert">
│ │ │ │ +<h1>tracker_error_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated on tracker time outs, premature disconnects,
│ │ │ │ +invalid response or a HTTP response other than &quot;200 OK&quot;. From the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +you can get the handle to the torrent the tracker belongs to.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct tracker_error_alert final : tracker_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>failure_reason</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker | alert_category::error;
│ │ │ │ +   int const times_in_row;
│ │ │ │ +   error_code const error;
│ │ │ │ +   operation_t op;
│ │ │ │ +   protocol_version version;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="failure_reason()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Bfailure_reason%28%29%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Bfailure_reason%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="failure-reason">
│ │ │ │ +<h2>failure_reason()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>failure_reason</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>if the tracker sent a &quot;failure reason&quot; string, it will be returned
│ │ │ │ +here.</p>
│ │ │ │ +<a name="times_in_row"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Btimes_in_row%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Btimes_in_row%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>times_in_row</dt>
│ │ │ │ +<dd>This member says how many times in a row this tracker has failed.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error code indicating why the tracker announce failed. If it is
│ │ │ │ +is <tt class="docutils literal"><span class="pre">lt::errors::tracker_failure</span></tt> the <a class="reference external" href="reference-Alerts.html#failure_reason()">failure_reason()</a> might contain
│ │ │ │ +a more detailed description of why the tracker rejected the request.
│ │ │ │ +HTTP status codes indicating errors are also set in this field.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>version</dt>
│ │ │ │ +<dd>the bittorrent protocol version that was announced</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="tracker_warning_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_warning_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_warning_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="tracker-warning-alert">
│ │ │ │ +<h1>tracker_warning_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is triggered if the tracker reply contains a warning field.
│ │ │ │ +Usually this means that the tracker announce was successful, but the
│ │ │ │ +tracker has a message to the client.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct tracker_warning_alert final : tracker_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>warning_message</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker | alert_category::error;
│ │ │ │ +   protocol_version version;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="warning_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_warning_alert%3A%3A%5Bwarning_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22tracker_warning_alert%3A%3A%5Bwarning_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="warning-message">
│ │ │ │ +<h2>warning_message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>warning_message</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>the message associated with this warning</p>
│ │ │ │ +<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_warning_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_warning_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>version</dt>
│ │ │ │ +<dd>the bittorrent protocol version that was announced</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="scrape_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+scrape_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+scrape_reply_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="scrape-reply-alert">
│ │ │ │ +<h1>scrape_reply_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a scrape request succeeds.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct scrape_reply_alert final : tracker_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker;
│ │ │ │ +   int const incomplete;
│ │ │ │ +   int const complete;
│ │ │ │ +   protocol_version version;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="incomplete"></a>
│ │ │ │ +<a name="complete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_reply_alert%3A%3A%5Bincomplete+complete%5D&labels=documentation&body=Documentation+under+heading+%22scrape_reply_alert%3A%3A%5Bincomplete+complete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>incomplete complete</dt>
│ │ │ │ +<dd>the data returned in the scrape response. These numbers
│ │ │ │ +may be -1 if the response was malformed.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_reply_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22scrape_reply_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>version</dt>
│ │ │ │ +<dd>the bittorrent protocol version that was scraped</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="scrape_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+scrape_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+scrape_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="scrape-failed-alert">
│ │ │ │ +<h1>scrape_failed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>If a scrape request fails, this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated. This might be due
│ │ │ │ +to the tracker timing out, refusing connection or returning an http response
│ │ │ │ +code indicating an error.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct scrape_failed_alert final : tracker_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>error_message</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker | alert_category::error;
│ │ │ │ +   error_code const error;
│ │ │ │ +   protocol_version version;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="error_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_failed_alert%3A%3A%5Berror_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22scrape_failed_alert%3A%3A%5Berror_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="error-message">
│ │ │ │ +<h2>error_message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>error_message</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>if the error indicates there is an associated message, this returns
│ │ │ │ +that message. Otherwise and empty string.</p>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22scrape_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error itself. This may indicate that the tracker sent an error
│ │ │ │ +message (<tt class="docutils literal"><span class="pre">error::tracker_failure</span></tt>), in which case it can be
│ │ │ │ +retrieved by calling <tt class="docutils literal">error_message()</tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_failed_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22scrape_failed_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>version</dt>
│ │ │ │ +<dd>the bittorrent protocol version that was scraped</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="tracker_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_reply_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="tracker-reply-alert">
│ │ │ │ +<h1>tracker_reply_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only for informational purpose. It is generated when a tracker announce
│ │ │ │ +succeeds. It is generated regardless what kind of tracker was used, be it UDP, HTTP or
│ │ │ │ +the DHT.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct tracker_reply_alert final : tracker_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker;
│ │ │ │ +   int const num_peers;
│ │ │ │ +   protocol_version version;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="num_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_reply_alert%3A%3A%5Bnum_peers%5D&labels=documentation&body=Documentation+under+heading+%22tracker_reply_alert%3A%3A%5Bnum_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_peers</dt>
│ │ │ │ +<dd>tells how many peers the tracker returned in this response. This is
│ │ │ │ +not expected to be greater than the <tt class="docutils literal">num_want</tt> settings. These are not necessarily
│ │ │ │ +all new peers, some of them may already be connected.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_reply_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_reply_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>version</dt>
│ │ │ │ +<dd>the bittorrent protocol version that was announced</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_reply_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-reply-alert">
│ │ │ │ +<h1>dht_reply_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated each time the DHT receives peers from a node. <tt class="docutils literal">num_peers</tt>
│ │ │ │ +is the number of peers we received in this packet. Typically these packets are
│ │ │ │ +received from multiple DHT nodes, and so the alerts are typically generated
│ │ │ │ +a few at a time.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_reply_alert final : tracker_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht | alert_category::tracker;
│ │ │ │ +   int const num_peers;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="tracker_announce_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_announce_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_announce_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="tracker-announce-alert">
│ │ │ │ +<h1>tracker_announce_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated each time a tracker announce is sent (or attempted to be sent).
│ │ │ │ +There are no extra data members in this <a class="reference external" href="reference-Alerts.html#alert">alert</a>. The url can be found in the base class
│ │ │ │ +however.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct tracker_announce_alert final : tracker_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker;
│ │ │ │ +   event_t const event;
│ │ │ │ +   protocol_version version;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="event"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_announce_alert%3A%3A%5Bevent%5D&labels=documentation&body=Documentation+under+heading+%22tracker_announce_alert%3A%3A%5Bevent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>event</dt>
│ │ │ │ +<dd>specifies what event was sent to the tracker. See <a class="reference external" href="reference-Core.html#event_t">event_t</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_announce_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_announce_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>version</dt>
│ │ │ │ +<dd>the bittorrent protocol version that is announced</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="hash_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+hash_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+hash_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="hash-failed-alert">
│ │ │ │ +<h1>hash_failed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a finished piece fails its hash check. You can get the handle
│ │ │ │ +to the torrent which got the failed piece and the index of the piece itself from the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct hash_failed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +   piece_index_t const piece_index;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="peer_ban_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_ban_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_ban_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="peer-ban-alert">
│ │ │ │ +<h1>peer_ban_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is banned because it has sent too many corrupt pieces
│ │ │ │ +to us. <tt class="docutils literal">ip</tt> is the endpoint to the peer that was banned.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_ban_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="peer_unsnubbed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_unsnubbed_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_unsnubbed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="peer-unsnubbed-alert">
│ │ │ │ +<h1>peer_unsnubbed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is un-snubbed. Essentially when it was snubbed for stalling
│ │ │ │ +sending data, and now it started sending data again.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_unsnubbed_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="peer_snubbed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_snubbed_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_snubbed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="peer-snubbed-alert">
│ │ │ │ +<h1>peer_snubbed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is snubbed, when it stops sending data when we request
│ │ │ │ +it.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_snubbed_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="peer_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_error_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="peer-error-alert">
│ │ │ │ +<h1>peer_error_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer sends invalid data over the peer-peer protocol. The peer
│ │ │ │ +will be disconnected, but you get its ip address from the <a class="reference external" href="reference-Alerts.html#alert">alert</a>, to identify it.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_error_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ +   operation_t op;
│ │ │ │ +   error_code const error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_error_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22peer_error_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>op</dt>
│ │ │ │ +<dd>a 0-terminated string of the low-level operation that failed, or nullptr if
│ │ │ │ +there was no low level disk operation.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22peer_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>tells you what error caused this <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="peer_connect_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_connect_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_connect_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="peer-connect-alert">
│ │ │ │ +<h1>peer_connect_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time an incoming peer connection both
│ │ │ │ +successfully passes the protocol handshake and is associated with a
│ │ │ │ +torrent, or an outgoing peer connection attempt succeeds. For arbitrary
│ │ │ │ +incoming connections, see <a class="reference external" href="reference-Alerts.html#incoming_connection_alert">incoming_connection_alert</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_connect_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   enum direction_t
│ │ │ │ +   {
│ │ │ │ +      in,
│ │ │ │ +      out,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::connect;
│ │ │ │ +   direction_t direction;
│ │ │ │ +   socket_type_t socket_type;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="direction_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+direction_t&labels=documentation&body=Documentation+under+heading+%22enum+direction_t%22+could+be+improved">report issue</a>]</span><div class="section" id="enum-direction-t">
│ │ │ │ +<h2>enum direction_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +<col width="27%" />
│ │ │ │ +<col width="50%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>share_ratio_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>200</td>
│ │ │ │ +<tr><td>in</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>seed_time_ratio_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>700</td>
│ │ │ │ +<tr><td>out</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>when a seeding torrent reaches either the share ratio (bytes up /
│ │ │ │ -bytes down) or the seed time ratio (seconds as seed / seconds as
│ │ │ │ -downloader) or the seed time limit (seconds as seed) it is
│ │ │ │ -considered done, and it will leave room for other torrents. These
│ │ │ │ -are specified as percentages. Torrents that are considered done will
│ │ │ │ -still be allowed to be seeded, they just won't have priority anymore.
│ │ │ │ -For more, see <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</p>
│ │ │ │ -<a name="peer_turnover"></a>
│ │ │ │ -<a name="peer_turnover_cutoff"></a>
│ │ │ │ -<a name="peer_turnover_interval"></a><table border="1" class="docutils">
│ │ │ │ +<a name="direction"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_connect_alert%3A%3A%5Bdirection%5D&labels=documentation&body=Documentation+under+heading+%22peer_connect_alert%3A%3A%5Bdirection%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>direction</dt>
│ │ │ │ +<dd>Tells you if the peer was incoming or outgoing</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="peer_disconnected_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_disconnected_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_disconnected_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="peer-disconnected-alert">
│ │ │ │ +<h1>peer_disconnected_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is disconnected for any reason (other than the ones
│ │ │ │ +covered by <a class="reference external" href="reference-Alerts.html#peer_error_alert">peer_error_alert</a> ).</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_disconnected_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::connect;
│ │ │ │ +   socket_type_t const socket_type;
│ │ │ │ +   operation_t const op;
│ │ │ │ +   error_code const error;
│ │ │ │ +   close_reason_t const reason;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>socket_type</dt>
│ │ │ │ +<dd>the kind of socket this peer was connected over</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>op</dt>
│ │ │ │ +<dd>the operation or level where the error occurred. Specified as an
│ │ │ │ +value from the <a class="reference external" href="reference-Alerts.html#operation_t">operation_t</a> enum. Defined in operations.hpp.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>tells you what error caused peer to disconnect.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="reason"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Breason%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Breason%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>reason</dt>
│ │ │ │ +<dd>the reason the peer disconnected (if specified)</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="invalid_request_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+invalid_request_alert&labels=documentation&body=Documentation+under+heading+%22class+invalid_request_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="invalid-request-alert">
│ │ │ │ +<h1>invalid_request_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This is a debug <a class="reference external" href="reference-Alerts.html#alert">alert</a> that is generated by an incoming invalid piece request.
│ │ │ │ +<tt class="docutils literal">ip</tt> is the address of the peer and the <tt class="docutils literal">request</tt> is the actual incoming
│ │ │ │ +request from the peer. See <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> for more info.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct invalid_request_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ +   peer_request const request;
│ │ │ │ +   bool const we_have;
│ │ │ │ +   bool const peer_interested;
│ │ │ │ +   bool const withheld;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="request"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Brequest%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Brequest%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>request</dt>
│ │ │ │ +<dd>the request we received from the peer</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="we_have"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Bwe_have%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Bwe_have%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>we_have</dt>
│ │ │ │ +<dd>true if we have this piece</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="peer_interested"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Bpeer_interested%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Bpeer_interested%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>peer_interested</dt>
│ │ │ │ +<dd>true if the peer indicated that it was interested to download before
│ │ │ │ +sending the request</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="withheld"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Bwithheld%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Bwithheld%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>withheld</dt>
│ │ │ │ +<dd>if this is true, the peer is not allowed to download this piece because
│ │ │ │ +of super-seeding rules.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_finished_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_finished_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_finished_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-finished-alert">
│ │ │ │ +<h1>torrent_finished_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a torrent switches from being a downloader to a seed.
│ │ │ │ +It will only be generated once per torrent. It contains a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> to the
│ │ │ │ +torrent in question.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_finished_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="piece_finished_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_finished_alert&labels=documentation&body=Documentation+under+heading+%22class+piece_finished_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-finished-alert">
│ │ │ │ +<h1>piece_finished_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time a piece completes downloading
│ │ │ │ +and passes the hash check. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> derives from <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a>
│ │ │ │ +which contains the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> to the torrent the piece belongs to.
│ │ │ │ +Note that being downloaded and passing the hash check may happen before
│ │ │ │ +the piece is also fully flushed to disk. So <a class="reference external" href="reference-Torrent_Handle.html#have_piece()">torrent_handle::have_piece()</a>
│ │ │ │ +may still return false</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct piece_finished_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   piece_index_t const piece_index;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="piece_index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_finished_alert%3A%3A%5Bpiece_index%5D&labels=documentation&body=Documentation+under+heading+%22piece_finished_alert%3A%3A%5Bpiece_index%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>piece_index</dt>
│ │ │ │ +<dd>the index of the piece that finished</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="request_dropped_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+request_dropped_alert&labels=documentation&body=Documentation+under+heading+%22class+request_dropped_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="request-dropped-alert">
│ │ │ │ +<h1>request_dropped_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer rejects or ignores a piece request.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct request_dropped_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   int const block_index;
│ │ │ │ +   piece_index_t const piece_index;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="block_timeout_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_timeout_alert&labels=documentation&body=Documentation+under+heading+%22class+block_timeout_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="block-timeout-alert">
│ │ │ │ +<h1>block_timeout_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block request times out.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct block_timeout_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   int const block_index;
│ │ │ │ +   piece_index_t const piece_index;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="block_finished_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_finished_alert&labels=documentation&body=Documentation+under+heading+%22class+block_finished_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="block-finished-alert">
│ │ │ │ +<h1>block_finished_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block request receives a response.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct block_finished_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   int const block_index;
│ │ │ │ +   piece_index_t const piece_index;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="block_downloading_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_downloading_alert&labels=documentation&body=Documentation+under+heading+%22class+block_downloading_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="block-downloading-alert">
│ │ │ │ +<h1>block_downloading_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block request is sent to a peer.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct block_downloading_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   int const block_index;
│ │ │ │ +   piece_index_t const piece_index;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="unwanted_block_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+unwanted_block_alert&labels=documentation&body=Documentation+under+heading+%22class+unwanted_block_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="unwanted-block-alert">
│ │ │ │ +<h1>unwanted_block_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block is received that was not requested or
│ │ │ │ +whose request timed out.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct unwanted_block_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ +   int const block_index;
│ │ │ │ +   piece_index_t const piece_index;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="storage_moved_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_moved_alert&labels=documentation&body=Documentation+under+heading+%22class+storage_moved_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="storage-moved-alert">
│ │ │ │ +<h1>storage_moved_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>The <tt class="docutils literal">storage_moved_alert</tt> is generated when all the disk IO has
│ │ │ │ +completed and the files have been moved, as an effect of a call to
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_handle::move_storage</span></tt>. This is useful to synchronize with the
│ │ │ │ +actual disk. The <tt class="docutils literal">storage_path()</tt> member return the new path of the
│ │ │ │ +storage.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct storage_moved_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>storage_path</strong> () const;
│ │ │ │ +   char const* <strong>old_path</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="storage_path()"></a>
│ │ │ │ +<a name="old_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_moved_alert%3A%3A%5Bstorage_path%28%29+old_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22storage_moved_alert%3A%3A%5Bstorage_path%28%29+old_path%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="storage-path-old-path">
│ │ │ │ +<h2>storage_path() old_path()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>storage_path</strong> () const;
│ │ │ │ +char const* <strong>old_path</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>the path the torrent was moved to and from, respectively.</p>
│ │ │ │ +<a name="storage_moved_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_moved_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+storage_moved_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="storage-moved-failed-alert">
│ │ │ │ +<h1>storage_moved_failed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>The <tt class="docutils literal">storage_moved_failed_alert</tt> is generated when an attempt to move the storage,
│ │ │ │ +via <a class="reference external" href="reference-Torrent_Handle.html#move_storage()">torrent_handle::move_storage()</a>, fails.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct storage_moved_failed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>file_path</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ +   error_code const error;
│ │ │ │ +   operation_t op;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="file_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_moved_failed_alert%3A%3A%5Bfile_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22storage_moved_failed_alert%3A%3A%5Bfile_path%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="file-path">
│ │ │ │ +<h2>file_path()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>file_path</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>If the error happened for a specific file, this returns its path.</p>
│ │ │ │ +<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_moved_failed_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22storage_moved_failed_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>op</dt>
│ │ │ │ +<dd>this indicates what underlying operation caused the error</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_deleted_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_deleted_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_deleted_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="torrent-deleted-alert">
│ │ │ │ +<h1>torrent_deleted_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a request to delete the files of a torrent complete.</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted in the <tt class="docutils literal"><span class="pre">alert_category::storage</span></tt> category, and that bit
│ │ │ │ +needs to be set in the alert_mask.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_deleted_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ +   info_hash_t info_hashes;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_deleted_alert%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_deleted_alert%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>info_hashes</dt>
│ │ │ │ +<dd>The info-hash of the torrent that was just deleted. Most of
│ │ │ │ +the time the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> in the <tt class="docutils literal">torrent_alert</tt> will be invalid by the time
│ │ │ │ +this <a class="reference external" href="reference-Alerts.html#alert">alert</a> arrives, since the torrent is being deleted. The <tt class="docutils literal">info_hashes</tt> member
│ │ │ │ +is hence the main way of identifying which torrent just completed the delete.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_delete_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_delete_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_delete_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-delete-failed-alert">
│ │ │ │ +<h1>torrent_delete_failed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a request to delete the files of a torrent fails.
│ │ │ │ +Just removing a torrent from the <a class="reference external" href="reference-Session.html#session">session</a> cannot fail</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_delete_failed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage
│ │ │ │ +   | alert_category::error;
│ │ │ │ +   error_code const error;
│ │ │ │ +   info_hash_t info_hashes;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_delete_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22torrent_delete_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>tells you why it failed.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_delete_failed_alert%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_delete_failed_alert%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>info_hashes</dt>
│ │ │ │ +<dd>the info hash of the torrent whose files failed to be deleted</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="save_resume_data_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+save_resume_data_alert&labels=documentation&body=Documentation+under+heading+%22class+save_resume_data_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="save-resume-data-alert">
│ │ │ │ +<h1>save_resume_data_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated as a response to a <tt class="docutils literal"><span class="pre">torrent_handle::save_resume_data</span></tt> request.
│ │ │ │ +It is generated once the disk IO thread is done writing the state for this torrent.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct save_resume_data_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ +   add_torrent_params params;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:save_resume_data_alert%3A%3A%5Bparams%5D&labels=documentation&body=Documentation+under+heading+%22save_resume_data_alert%3A%3A%5Bparams%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>params</dt>
│ │ │ │ +<dd><p class="first">the <tt class="docutils literal">params</tt> object is populated with the torrent file whose resume
│ │ │ │ +data was saved. It is suitable to be:</p>
│ │ │ │ +<ul class="last simple">
│ │ │ │ +<li>added to a <a class="reference external" href="reference-Session.html#session">session</a> with <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> or <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a></li>
│ │ │ │ +<li>saved to disk with <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a></li>
│ │ │ │ +<li>turned into a magnet link with <a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a></li>
│ │ │ │ +<li>saved as a .torrent file with <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a></li>
│ │ │ │ +</ul>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="save_resume_data_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+save_resume_data_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+save_resume_data_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="save-resume-data-failed-alert">
│ │ │ │ +<h1>save_resume_data_failed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated instead of <tt class="docutils literal">save_resume_data_alert</tt> if there was an error
│ │ │ │ +generating the resume data. <tt class="docutils literal">error</tt> describes what went wrong.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct save_resume_data_failed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage
│ │ │ │ +   | alert_category::error;
│ │ │ │ +   error_code const error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:save_resume_data_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22save_resume_data_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error code from the resume_data failure</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_paused_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_paused_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_paused_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-paused-alert">
│ │ │ │ +<h1>torrent_paused_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated as a response to a <tt class="docutils literal"><span class="pre">torrent_handle::pause</span></tt> 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.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_paused_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="torrent_resumed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_resumed_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_resumed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-resumed-alert">
│ │ │ │ +<h1>torrent_resumed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated as a response to a <a class="reference external" href="reference-Torrent_Handle.html#resume()">torrent_handle::resume()</a> request. It is
│ │ │ │ +generated when a torrent goes from a paused state to an active state.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_resumed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="torrent_checked_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_checked_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_checked_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-checked-alert">
│ │ │ │ +<h1>torrent_checked_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when a torrent completes checking. i.e. when it transitions
│ │ │ │ +out of the <tt class="docutils literal">checking files</tt> state into a state where it is ready to start downloading</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_checked_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="url_seed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+url_seed_alert&labels=documentation&body=Documentation+under+heading+%22class+url_seed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="url-seed-alert">
│ │ │ │ +<h1>url_seed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a HTTP seed name lookup fails.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct url_seed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>server_url</strong> () const;
│ │ │ │ +   char const* <strong>error_message</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer | alert_category::error;
│ │ │ │ +   error_code const error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="server_url()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:url_seed_alert%3A%3A%5Bserver_url%28%29%5D&labels=documentation&body=Documentation+under+heading+%22url_seed_alert%3A%3A%5Bserver_url%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="server-url">
│ │ │ │ +<h2>server_url()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>server_url</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>the URL the error is associated with</p>
│ │ │ │ +<a name="error_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:url_seed_alert%3A%3A%5Berror_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22url_seed_alert%3A%3A%5Berror_message%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="error-message-1">
│ │ │ │ +<h2>error_message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>error_message</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>in case the web server sent an error message, this function returns
│ │ │ │ +it.</p>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:url_seed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22url_seed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error the web seed encountered. If this is not set, the server
│ │ │ │ +sent an error message, call <tt class="docutils literal">error_message()</tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_error_alert&labels=documentation&body=Documentation+under+heading+%22class+file_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="file-error-alert">
│ │ │ │ +<h1>file_error_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>If the storage fails to read or write files that it needs access to, this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is
│ │ │ │ +generated and the torrent is paused.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct file_error_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>filename</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status
│ │ │ │ +   | alert_category::storage;
│ │ │ │ +   error_code const error;
│ │ │ │ +   operation_t op;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="filename()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_error_alert%3A%3A%5Bfilename%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_error_alert%3A%3A%5Bfilename%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="filename">
│ │ │ │ +<h2>filename()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>filename</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>the file that experienced the error</p>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22file_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error code describing the error.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_error_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22file_error_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>op</dt>
│ │ │ │ +<dd>indicates which underlying operation caused the error</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="metadata_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+metadata_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+metadata_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="metadata-failed-alert">
│ │ │ │ +<h1>metadata_failed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when the metadata has been completely received and the info-hash
│ │ │ │ +failed to match it. i.e. the metadata that was received was corrupt. libtorrent will
│ │ │ │ +automatically retry to fetch it in this case. This is only relevant when running a
│ │ │ │ +torrent-less download, with the metadata extension provided by libtorrent.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct metadata_failed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ +   error_code const error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:metadata_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22metadata_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>indicates what failed when parsing the metadata. This error is
│ │ │ │ +what's returned from lazy_bdecode().</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="metadata_received_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+metadata_received_alert&labels=documentation&body=Documentation+under+heading+%22class+metadata_received_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="metadata-received-alert">
│ │ │ │ +<h1>metadata_received_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when the metadata has been completely received and the torrent
│ │ │ │ +can start downloading. It is not generated on torrents that are started with metadata, but
│ │ │ │ +only those that needs to download it from peers (when utilizing the libtorrent extension).</p>
│ │ │ │ +<p>There are no additional data members in this <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ +<p>Typically, when receiving this <a class="reference external" href="reference-Alerts.html#alert">alert</a>, you would want to save the torrent file in order
│ │ │ │ +to load it back up again when the <a class="reference external" href="reference-Session.html#session">session</a> is restarted. Here's an example snippet of
│ │ │ │ +code to do that:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="name">torrent_handle</span><span class="whitespace"> </span><span class="name">h</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">alert</span><span class="operator">-&gt;</span><span class="name">handle</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="name">torrent_info</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">ti</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">h</span><span class="punctuation">.</span><span class="name">torrent_file</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +</span><span class="name">create_torrent</span><span class="whitespace"> </span><span class="name function">ct</span><span class="punctuation">(</span><span class="operator">*</span><span class="name">ti</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="name">entry</span><span class="whitespace"> </span><span class="name">te</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ct</span><span class="punctuation">.</span><span class="name">generate</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +</span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">buffer</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="name">bencode</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">back_inserter</span><span class="punctuation">(</span><span class="name">buffer</span><span class="punctuation">),</span><span class="whitespace"> </span><span class="name">te</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="keyword type">FILE</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">f</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">fopen</span><span class="punctuation">((</span><span class="name">to_hex</span><span class="punctuation">(</span><span class="name">ti</span><span class="operator">-&gt;</span><span class="name">info_hashes</span><span class="punctuation">().</span><span class="name">get_best</span><span class="punctuation">().</span><span class="name">to_string</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="literal string">&quot;.torrent&quot;</span><span class="punctuation">).</span><span class="name">c_str</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="literal string">&quot;wb+&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">f</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">fwrite</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">buffer</span><span class="punctuation">[</span><span class="literal number integer">0</span><span class="punctuation">],</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">buffer</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="name">f</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">fclose</span><span class="punctuation">(</span><span class="name">f</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">}</span>
│ │ │ │ +</pre>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct metadata_received_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="udp_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+udp_error_alert&labels=documentation&body=Documentation+under+heading+%22class+udp_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="udp-error-alert">
│ │ │ │ +<h1>udp_error_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when there is an error on a UDP socket. The
│ │ │ │ +UDP sockets are used for all uTP, DHT and UDP tracker traffic. They are
│ │ │ │ +global to the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct udp_error_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ +   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
│ │ │ │ +   operation_t operation;
│ │ │ │ +   error_code const error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:udp_error_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22udp_error_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>endpoint</dt>
│ │ │ │ +<dd>the source address associated with the error (if any)</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="operation"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:udp_error_alert%3A%3A%5Boperation%5D&labels=documentation&body=Documentation+under+heading+%22udp_error_alert%3A%3A%5Boperation%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>operation</dt>
│ │ │ │ +<dd>the operation that failed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:udp_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22udp_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error code describing the error</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="external_ip_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+external_ip_alert&labels=documentation&body=Documentation+under+heading+%22class+external_ip_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="external-ip-alert">
│ │ │ │ +<h1>external_ip_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>Whenever libtorrent learns about the machines external IP, this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is
│ │ │ │ +generated. The external IP address can be acquired from the tracker (if it
│ │ │ │ +supports that) or from peers that supports the extension protocol.
│ │ │ │ +The address can be accessed through the <tt class="docutils literal">external_address</tt> member.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct external_ip_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +   aux::noexcept_movable&lt;address&gt; external_address;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="external_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:external_ip_alert%3A%3A%5Bexternal_address%5D&labels=documentation&body=Documentation+under+heading+%22external_ip_alert%3A%3A%5Bexternal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>external_address</dt>
│ │ │ │ +<dd>the IP address that is believed to be our external IP</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="listen_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+listen_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+listen_failed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="listen-failed-alert">
│ │ │ │ +<h1>listen_failed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when none of the ports, given in the port range, to
│ │ │ │ +<a class="reference external" href="reference-Session.html#session">session</a> can be opened for listening. The <tt class="docutils literal">listen_interface</tt> member is the
│ │ │ │ +interface that failed, <tt class="docutils literal">error</tt> is the error code describing the failure.</p>
│ │ │ │ +<p>In the case an endpoint was created before generating the <a class="reference external" href="reference-Alerts.html#alert">alert</a>, it is
│ │ │ │ +represented by <tt class="docutils literal">address</tt> and <tt class="docutils literal">port</tt>. The combinations of socket type
│ │ │ │ +and operation in which such address and port are not valid are:
│ │ │ │ +accept  - i2p
│ │ │ │ +accept  - socks5
│ │ │ │ +enum_if - tcp</p>
│ │ │ │ +<p>libtorrent may sometimes try to listen on port 0, if all other ports failed.
│ │ │ │ +Port 0 asks the operating system to pick a port that's free). If that fails
│ │ │ │ +you may see a <a class="reference external" href="reference-Alerts.html#listen_failed_alert">listen_failed_alert</a> with port 0 even if you didn't ask to
│ │ │ │ +listen on it.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct listen_failed_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>listen_interface</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status | alert_category::error;
│ │ │ │ +   error_code const error;
│ │ │ │ +   operation_t op;
│ │ │ │ +   lt::socket_type_t const socket_type;
│ │ │ │ +   aux::noexcept_movable&lt;lt::address&gt; address;
│ │ │ │ +   int const port;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="listen_interface()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Blisten_interface%28%29%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Blisten_interface%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="listen-interface">
│ │ │ │ +<h2>listen_interface()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>listen_interface</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>the network device libtorrent attempted to listen on, or the IP address</p>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error the system returned</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>op</dt>
│ │ │ │ +<dd>the underlying operation that failed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>socket_type</dt>
│ │ │ │ +<dd>the type of listen socket this <a class="reference external" href="reference-Alerts.html#alert">alert</a> refers to.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Baddress%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Baddress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>address</dt>
│ │ │ │ +<dd>the address libtorrent attempted to listen on
│ │ │ │ +see <a class="reference external" href="reference-Alerts.html#alert">alert</a> documentation for validity of this value</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="port"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Bport%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Bport%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>port</dt>
│ │ │ │ +<dd>the port libtorrent attempted to listen on
│ │ │ │ +see <a class="reference external" href="reference-Alerts.html#alert">alert</a> documentation for validity of this value</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="listen_succeeded_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+listen_succeeded_alert&labels=documentation&body=Documentation+under+heading+%22class+listen_succeeded_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="listen-succeeded-alert">
│ │ │ │ +<h1>listen_succeeded_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the listen port succeeds to be opened on a
│ │ │ │ +particular interface. <tt class="docutils literal">address</tt> and <tt class="docutils literal">port</tt> is the endpoint that
│ │ │ │ +successfully was opened for listening.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct listen_succeeded_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +   aux::noexcept_movable&lt;lt::address&gt; address;
│ │ │ │ +   int const port;
│ │ │ │ +   lt::socket_type_t const socket_type;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_succeeded_alert%3A%3A%5Baddress%5D&labels=documentation&body=Documentation+under+heading+%22listen_succeeded_alert%3A%3A%5Baddress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>address</dt>
│ │ │ │ +<dd>the address libtorrent ended up listening on. This address
│ │ │ │ +refers to the local interface.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="port"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_succeeded_alert%3A%3A%5Bport%5D&labels=documentation&body=Documentation+under+heading+%22listen_succeeded_alert%3A%3A%5Bport%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>port</dt>
│ │ │ │ +<dd>the port libtorrent ended up listening on.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_succeeded_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22listen_succeeded_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>socket_type</dt>
│ │ │ │ +<dd>the type of listen socket this <a class="reference external" href="reference-Alerts.html#alert">alert</a> refers to.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="portmap_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+portmap_error_alert&labels=documentation&body=Documentation+under+heading+%22class+portmap_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="portmap-error-alert">
│ │ │ │ +<h1>portmap_error_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a NAT router was successfully found but some
│ │ │ │ +part of the port mapping request failed. It contains a text message that
│ │ │ │ +may help the user figure out what is wrong. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is not generated in
│ │ │ │ +case it appears the client is not running on a NAT:ed network or if it
│ │ │ │ +appears there is no NAT router that can be remote controlled to add port
│ │ │ │ +mappings.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct portmap_error_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::port_mapping
│ │ │ │ +   | alert_category::error;
│ │ │ │ +   port_mapping_t const mapping;
│ │ │ │ +   portmap_transport map_transport;
│ │ │ │ +   aux::noexcept_movable&lt;address&gt; local_address;
│ │ │ │ +   error_code const error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="mapping"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Bmapping%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Bmapping%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>mapping</dt>
│ │ │ │ +<dd>refers to the mapping index of the port map that failed, i.e.
│ │ │ │ +the index returned from add_mapping().</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="map_transport"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Bmap_transport%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Bmap_transport%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>map_transport</dt>
│ │ │ │ +<dd>UPnP or NAT-PMP</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>local_address</dt>
│ │ │ │ +<dd>the local network the port mapper is running on</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>tells you what failed.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="portmap_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+portmap_alert&labels=documentation&body=Documentation+under+heading+%22class+portmap_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="portmap-alert">
│ │ │ │ +<h1>portmap_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a NAT router was successfully found and
│ │ │ │ +a port was successfully mapped on it. On a NAT:ed network with a NAT-PMP
│ │ │ │ +capable router, this is typically generated once when mapping the TCP
│ │ │ │ +port and, if DHT is enabled, when the UDP port is mapped.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct portmap_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::port_mapping;
│ │ │ │ +   port_mapping_t const mapping;
│ │ │ │ +   int const external_port;
│ │ │ │ +   portmap_protocol const map_protocol;
│ │ │ │ +   portmap_transport const map_transport;
│ │ │ │ +   aux::noexcept_movable&lt;address&gt; local_address;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="mapping"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_alert%3A%3A%5Bmapping%5D&labels=documentation&body=Documentation+under+heading+%22portmap_alert%3A%3A%5Bmapping%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>mapping</dt>
│ │ │ │ +<dd>refers to the mapping index of the port map that failed, i.e.
│ │ │ │ +the index returned from add_mapping().</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="external_port"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_alert%3A%3A%5Bexternal_port%5D&labels=documentation&body=Documentation+under+heading+%22portmap_alert%3A%3A%5Bexternal_port%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>external_port</dt>
│ │ │ │ +<dd>the external port allocated for the mapping.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22portmap_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>local_address</dt>
│ │ │ │ +<dd>the local network the port mapper is running on</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="portmap_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+portmap_log_alert&labels=documentation&body=Documentation+under+heading+%22class+portmap_log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="portmap-log-alert">
│ │ │ │ +<h1>portmap_log_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated to log informational events related to either
│ │ │ │ +UPnP or NAT-PMP. They contain a log line and the type (0 = NAT-PMP
│ │ │ │ +and 1 = UPnP). Displaying these messages to an end user is only useful
│ │ │ │ +for debugging the UPnP or NAT-PMP implementation. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only
│ │ │ │ +posted if the alert_category::port_mapping_log flag is enabled in
│ │ │ │ +the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct portmap_log_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>log_message</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::port_mapping_log;
│ │ │ │ +   portmap_transport const map_transport;
│ │ │ │ +   aux::noexcept_movable&lt;address&gt; local_address;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22portmap_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message">
│ │ │ │ +<h2>log_message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>log_message</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>the message associated with this log line</p>
│ │ │ │ +<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_log_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22portmap_log_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>local_address</dt>
│ │ │ │ +<dd>the local network the port mapper is running on</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="fastresume_rejected_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+fastresume_rejected_alert&labels=documentation&body=Documentation+under+heading+%22class+fastresume_rejected_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="fastresume-rejected-alert">
│ │ │ │ +<h1>fastresume_rejected_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a fast resume file has been passed to
│ │ │ │ +<a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> but the files on disk did not match the fast resume file.
│ │ │ │ +The error_code explains the reason why the resume file was rejected.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct fastresume_rejected_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>file_path</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status
│ │ │ │ +   | alert_category::error;
│ │ │ │ +   error_code error;
│ │ │ │ +   operation_t op;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="file_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:fastresume_rejected_alert%3A%3A%5Bfile_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22fastresume_rejected_alert%3A%3A%5Bfile_path%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="file-path-1">
│ │ │ │ +<h2>file_path()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>file_path</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>If the error happened to a specific file, this returns the path to it.</p>
│ │ │ │ +<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:fastresume_rejected_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22fastresume_rejected_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>op</dt>
│ │ │ │ +<dd>the underlying operation that failed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="peer_blocked_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_blocked_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_blocked_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="peer-blocked-alert">
│ │ │ │ +<h1>peer_blocked_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when an incoming peer connection, or a peer that's about to be added
│ │ │ │ +to our peer list, is blocked for some reason. This could be any of:</p>
│ │ │ │ +<ul class="simple">
│ │ │ │ +<li>the IP filter</li>
│ │ │ │ +<li>i2p mixed mode restrictions (a normal peer is not allowed on an i2p swarm)</li>
│ │ │ │ +<li>the port filter</li>
│ │ │ │ +<li>the peer has a low port and <tt class="docutils literal">no_connect_privileged_ports</tt> is enabled</li>
│ │ │ │ +<li>the protocol of the peer is blocked (uTP/TCP blocking)</li>
│ │ │ │ +</ul>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_blocked_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   enum reason_t
│ │ │ │ +   {
│ │ │ │ +      ip_filter,
│ │ │ │ +      port_filter,
│ │ │ │ +      i2p_mixed,
│ │ │ │ +      privileged_ports,
│ │ │ │ +      utp_disabled,
│ │ │ │ +      tcp_disabled,
│ │ │ │ +      invalid_local_interface,
│ │ │ │ +      ssrf_mitigation,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::ip_block;
│ │ │ │ +   int const reason;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="reason_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+reason_t&labels=documentation&body=Documentation+under+heading+%22enum+reason_t%22+could+be+improved">report issue</a>]</span><div class="section" id="enum-reason-t">
│ │ │ │ +<h2>enum reason_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="62%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ +<col width="56%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="29%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>peer_turnover</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>peer_turnover_cutoff</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>90</td>
│ │ │ │ +<tr><td>ip_filter</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>peer_turnover_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>300</td>
│ │ │ │ +<tr><td>port_filter</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>peer_turnover is the percentage of peers to disconnect every
│ │ │ │ -turnover peer_turnover_interval (if we're at the peer limit), this
│ │ │ │ -is specified in percent when we are connected to more than limit *
│ │ │ │ -peer_turnover_cutoff peers disconnect peer_turnover fraction of the
│ │ │ │ -peers. It is specified in percent peer_turnover_interval is the
│ │ │ │ -interval (in seconds) between optimistic disconnects if the
│ │ │ │ -disconnects happen and how many peers are disconnected is
│ │ │ │ -controlled by peer_turnover and peer_turnover_cutoff</p>
│ │ │ │ -<a name="connect_seed_every_n_download"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="67%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>i2p_mixed</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>connect_seed_every_n_download</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>10</td>
│ │ │ │ +<tr><td>privileged_ports</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>this setting controls the priority of downloading torrents over
│ │ │ │ -seeding or finished torrents when it comes to making peer
│ │ │ │ -connections. Peer connections are throttled by the connection_speed
│ │ │ │ -and the half-open connection limit. This makes peer connections a
│ │ │ │ -limited resource. Torrents that still have pieces to download are
│ │ │ │ -prioritized by default, to avoid having many seeding torrents use
│ │ │ │ -most of the connection attempts and only give one peer every now
│ │ │ │ -and then to the downloading torrent. libtorrent will loop over the
│ │ │ │ -downloading torrents to connect a peer each, and every n:th
│ │ │ │ -connection attempt, a finished torrent is picked to be allowed to
│ │ │ │ -connect to a peer. This setting controls n.</p>
│ │ │ │ -<a name="max_http_recv_buffer_size"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="60%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="27%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>utp_disabled</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_http_recv_buffer_size</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>4*1024*204</td>
│ │ │ │ +<tr><td>tcp_disabled</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the max number of bytes to allow an HTTP response to be when
│ │ │ │ -announcing to trackers or downloading .torrent files via the
│ │ │ │ -<tt class="docutils literal">url</tt> provided in <tt class="docutils literal">add_torrent_params</tt>.</p>
│ │ │ │ -<a name="max_retry_port_bind"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>invalid_local_interface</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_retry_port_bind</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>10</td>
│ │ │ │ +<tr><td>ssrf_mitigation</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>if binding to a specific port fails, should the port be incremented
│ │ │ │ -by one and tried again? This setting specifies how many times to
│ │ │ │ -retry a failed port bind</p>
│ │ │ │ -<a name="alert_mask"></a><table border="1" class="docutils">
│ │ │ │ +<a name="reason"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_blocked_alert%3A%3A%5Breason%5D&labels=documentation&body=Documentation+under+heading+%22peer_blocked_alert%3A%3A%5Breason%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>reason</dt>
│ │ │ │ +<dd>the reason for the peer being blocked. Is one of the values from the
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#reason_t">reason_t</a> enum.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_announce_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_announce_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_announce_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="dht-announce-alert">
│ │ │ │ +<h1>dht_announce_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a DHT node announces to an info-hash on our
│ │ │ │ +DHT node. It belongs to the <tt class="docutils literal"><span class="pre">alert_category::dht</span></tt> category.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_announce_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ +   aux::noexcept_movable&lt;address&gt; ip;
│ │ │ │ +   int port;
│ │ │ │ +   sha1_hash info_hash;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="dht_get_peers_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_get_peers_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_get_peers_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-get-peers-alert">
│ │ │ │ +<h1>dht_get_peers_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a DHT node sends a <tt class="docutils literal">get_peers</tt> message to
│ │ │ │ +our DHT node. It belongs to the <tt class="docutils literal"><span class="pre">alert_category::dht</span></tt> category.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_get_peers_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ +   sha1_hash info_hash;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="cache_flushed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+cache_flushed_alert&labels=documentation&body=Documentation+under+heading+%22class+cache_flushed_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="cache-flushed-alert">
│ │ │ │ +<h1>cache_flushed_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the disk cache has been flushed for a specific
│ │ │ │ +torrent as a result of a call to <a class="reference external" href="reference-Torrent_Handle.html#flush_cache()">torrent_handle::flush_cache()</a>. This
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#alert">alert</a> belongs to the <tt class="docutils literal"><span class="pre">alert_category::storage</span></tt> category, which must be
│ │ │ │ +enabled to let this <a class="reference external" href="reference-Alerts.html#alert">alert</a> through. The <a class="reference external" href="reference-Alerts.html#alert">alert</a> is also posted when removing
│ │ │ │ +a torrent from the <a class="reference external" href="reference-Session.html#session">session</a>, once the outstanding cache flush is complete
│ │ │ │ +and the torrent does no longer have any files open.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct cache_flushed_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="lsd_peer_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+lsd_peer_alert&labels=documentation&body=Documentation+under+heading+%22class+lsd_peer_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="lsd-peer-alert">
│ │ │ │ +<h1>lsd_peer_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when we receive a local service discovery message
│ │ │ │ +from a peer for a torrent we're currently participating in.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct lsd_peer_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="trackerid_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+trackerid_alert&labels=documentation&body=Documentation+under+heading+%22class+trackerid_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="trackerid-alert">
│ │ │ │ +<h1>trackerid_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted whenever a tracker responds with a <tt class="docutils literal">trackerid</tt>.
│ │ │ │ +The tracker ID is like a cookie. libtorrent will store the tracker ID
│ │ │ │ +for this tracker and repeat it in subsequent announces.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct trackerid_alert final : tracker_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>tracker_id</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="tracker_id()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:trackerid_alert%3A%3A%5Btracker_id%28%29%5D&labels=documentation&body=Documentation+under+heading+%22trackerid_alert%3A%3A%5Btracker_id%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="tracker-id">
│ │ │ │ +<h2>tracker_id()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>tracker_id</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>The tracker ID returned by the tracker</p>
│ │ │ │ +<a name="dht_bootstrap_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_bootstrap_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_bootstrap_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="dht-bootstrap-alert">
│ │ │ │ +<h1>dht_bootstrap_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the initial DHT bootstrap is done.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_bootstrap_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="torrent_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_error_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-error-alert">
│ │ │ │ +<h1>torrent_error_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This is posted whenever a torrent is transitioned into the error state.
│ │ │ │ +If the error code is duplicate_torrent (<a class="reference external" href="reference-Error_Codes.html#error_code_enum">error_code_enum</a>) error, it suggests two magnet
│ │ │ │ +links ended up resolving to the same hybrid torrent. For more details,
│ │ │ │ +see <a class="reference external" href="manual-ref.html#bittorrent-v2-torrents">BitTorrent v2 torrents</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_error_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>filename</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error | alert_category::status;
│ │ │ │ +   error_code const error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="filename()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_error_alert%3A%3A%5Bfilename%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_error_alert%3A%3A%5Bfilename%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="filename-1">
│ │ │ │ +<h2>filename()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>filename</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>the filename (or object) the error occurred on.</p>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22torrent_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>specifies which error the torrent encountered.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_need_cert_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_need_cert_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_need_cert_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="torrent-need-cert-alert">
│ │ │ │ +<h1>torrent_need_cert_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This is always posted for SSL torrents. This is a reminder to the client that
│ │ │ │ +the torrent won't work unless <a class="reference external" href="reference-Torrent_Handle.html#set_ssl_certificate()">torrent_handle::set_ssl_certificate()</a> is called with
│ │ │ │ +a valid certificate. Valid certificates MUST be signed by the SSL certificate
│ │ │ │ +in the .torrent file.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_need_cert_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="incoming_connection_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+incoming_connection_alert&labels=documentation&body=Documentation+under+heading+%22class+incoming_connection_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="incoming-connection-alert">
│ │ │ │ +<h1>incoming_connection_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>The incoming connection <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time we successfully accept
│ │ │ │ +an incoming connection, through any mean. The most straight-forward ways
│ │ │ │ +of accepting incoming connections are through the TCP listen socket and
│ │ │ │ +the UDP listen socket for uTP sockets. However, connections may also be
│ │ │ │ +accepted through a Socks5 or i2p listen socket, or via an SSL listen
│ │ │ │ +socket.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct incoming_connection_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
│ │ │ │ +   socket_type_t socket_type;
│ │ │ │ +   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; endpoint;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:incoming_connection_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22incoming_connection_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>socket_type</dt>
│ │ │ │ +<dd>tells you what kind of socket the connection was accepted</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:incoming_connection_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22incoming_connection_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>endpoint</dt>
│ │ │ │ +<dd>is the IP address and port the connection came from.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="add_torrent_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+add_torrent_alert&labels=documentation&body=Documentation+under+heading+%22class+add_torrent_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="add-torrent-alert">
│ │ │ │ +<h1>add_torrent_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is always posted when a torrent was attempted to be added
│ │ │ │ +and contains the return status of the add operation. The torrent handle of the new
│ │ │ │ +torrent can be found as the <tt class="docutils literal">handle</tt> member in the base class. If adding
│ │ │ │ +the torrent failed, <tt class="docutils literal">error</tt> contains the error code.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct add_torrent_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +   add_torrent_params params;
│ │ │ │ +   error_code error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_alert%3A%3A%5Bparams%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_alert%3A%3A%5Bparams%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>params</dt>
│ │ │ │ +<dd><p class="first">This contains copies of the most important fields from the original
│ │ │ │ +<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object, passed to <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> or
│ │ │ │ +<a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a>. Specifically, these fields are copied:</p>
│ │ │ │ +<ul class="simple">
│ │ │ │ +<li>version</li>
│ │ │ │ +<li>ti</li>
│ │ │ │ +<li>name</li>
│ │ │ │ +<li>save_path</li>
│ │ │ │ +<li>userdata</li>
│ │ │ │ +<li>tracker_id</li>
│ │ │ │ +<li>flags</li>
│ │ │ │ +<li>info_hash</li>
│ │ │ │ +</ul>
│ │ │ │ +<p class="last">the info_hash field will be updated with the info-hash of the torrent
│ │ │ │ +specified by <tt class="docutils literal">ti</tt>.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>set to the error, if one occurred while adding the torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="state_update_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+state_update_alert&labels=documentation&body=Documentation+under+heading+%22class+state_update_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="state-update-alert">
│ │ │ │ +<h1>state_update_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only posted when requested by the user, by calling
│ │ │ │ +session::post_torrent_updates() on the <a class="reference external" href="reference-Session.html#session">session</a>. It contains the torrent
│ │ │ │ +status of all torrents that changed since last time this message was
│ │ │ │ +posted. Its category is <tt class="docutils literal"><span class="pre">alert_category::status</span></tt>, but it's not subject to
│ │ │ │ +filtering, since it's only manually posted anyway.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct state_update_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +   std::vector&lt;torrent_status&gt; status;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="status"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:state_update_alert%3A%3A%5Bstatus%5D&labels=documentation&body=Documentation+under+heading+%22state_update_alert%3A%3A%5Bstatus%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>status</dt>
│ │ │ │ +<dd>contains the torrent status of all torrents that changed since last
│ │ │ │ +time this message was posted. Note that you can map a torrent status
│ │ │ │ +to a specific torrent via its <tt class="docutils literal">handle</tt> member. The receiving end is
│ │ │ │ +suggested to have all torrents sorted by the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> or hashed
│ │ │ │ +by it, for efficient updates.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="session_stats_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_stats_alert&labels=documentation&body=Documentation+under+heading+%22class+session_stats_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="session-stats-alert">
│ │ │ │ +<h1>session_stats_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a> is posted when the user requests <a class="reference external" href="reference-Session.html#session">session</a> statistics by
│ │ │ │ +calling <a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a> on the <a class="reference external" href="reference-Session.html#session">session</a> object. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> does not
│ │ │ │ +have a category, since it's only posted in response to an API call. It
│ │ │ │ +is not subject to the alert_mask filter.</p>
│ │ │ │ +<p>the <tt class="docutils literal">message()</tt> member function returns a string representation of the values that
│ │ │ │ +properly match the line returned in <tt class="docutils literal"><span class="pre">session_stats_header_alert::message()</span></tt>.</p>
│ │ │ │ +<p>this specific output is parsed by tools/parse_session_stats.py
│ │ │ │ +if this is changed, that parser should also be changed</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct session_stats_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   span&lt;std::int64_t const&gt; <strong>counters</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = {};
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="counters()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_stats_alert%3A%3A%5Bcounters%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_stats_alert%3A%3A%5Bcounters%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="counters-1">
│ │ │ │ +<h2>counters()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +span&lt;std::int64_t const&gt; <strong>counters</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>An array are a mix of <em>counters</em> and <em>gauges</em>, which meanings can be
│ │ │ │ +queries via the <a class="reference external" href="reference-Stats.html#session_stats_metrics()">session_stats_metrics()</a> function on the <a class="reference external" href="reference-Session.html#session">session</a>. The
│ │ │ │ +mapping from a specific metric to an index into this array is constant
│ │ │ │ +for a specific version of libtorrent, but may differ for other
│ │ │ │ +versions. The intended usage is to request the mapping, i.e. call
│ │ │ │ +<a class="reference external" href="reference-Stats.html#session_stats_metrics()">session_stats_metrics()</a>, once on startup, and then use that mapping to
│ │ │ │ +interpret these values throughout the process' runtime.</p>
│ │ │ │ +<p>For more information, see the <a class="reference external" href="manual-ref.html#session-statistics">session statistics</a> section.</p>
│ │ │ │ +<a name="dht_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_error_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="dht-error-alert">
│ │ │ │ +<h1>dht_error_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted when something fails in the DHT. This is not necessarily a fatal
│ │ │ │ +error, but it could prevent proper operation</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_error_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error | alert_category::dht;
│ │ │ │ +   error_code error;
│ │ │ │ +   operation_t op;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22dht_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error code</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_error_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22dht_error_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>op</dt>
│ │ │ │ +<dd>the operation that failed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_immutable_item_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_immutable_item_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_immutable_item_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-immutable-item-alert">
│ │ │ │ +<h1>dht_immutable_item_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted as a response to a call to session::get_item(),
│ │ │ │ +specifically the overload for looking up immutable items in the DHT.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_immutable_item_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ +   sha1_hash target;
│ │ │ │ +   entry item;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="target"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_immutable_item_alert%3A%3A%5Btarget%5D&labels=documentation&body=Documentation+under+heading+%22dht_immutable_item_alert%3A%3A%5Btarget%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>target</dt>
│ │ │ │ +<dd>the target hash of the immutable item. This must
│ │ │ │ +match the SHA-1 hash of the bencoded form of <tt class="docutils literal">item</tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="item"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_immutable_item_alert%3A%3A%5Bitem%5D&labels=documentation&body=Documentation+under+heading+%22dht_immutable_item_alert%3A%3A%5Bitem%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>item</dt>
│ │ │ │ +<dd>the data for this item</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_mutable_item_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_mutable_item_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_mutable_item_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-mutable-item-alert">
│ │ │ │ +<h1>dht_mutable_item_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted as a response to a call to session::get_item(),
│ │ │ │ +specifically the overload for looking up mutable items in the DHT.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_mutable_item_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ +   std::array&lt;char, 32&gt; key;
│ │ │ │ +   std::array&lt;char, 64&gt; signature;
│ │ │ │ +   std::int64_t seq;
│ │ │ │ +   std::string salt;
│ │ │ │ +   entry item;
│ │ │ │ +   bool authoritative;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="key"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bkey%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bkey%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>key</dt>
│ │ │ │ +<dd>the public key that was looked up</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="signature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bsignature%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bsignature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>signature</dt>
│ │ │ │ +<dd>the signature of the data. This is not the signature of the
│ │ │ │ +plain encoded form of the item, but it includes the sequence number
│ │ │ │ +and possibly the hash as well. See the dht_store document for more
│ │ │ │ +information. This is primarily useful for echoing back in a store
│ │ │ │ +request.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="seq"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bseq%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bseq%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>seq</dt>
│ │ │ │ +<dd>the sequence number of this item</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="salt"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bsalt%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bsalt%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>salt</dt>
│ │ │ │ +<dd>the salt, if any, used to lookup and store this item. If no
│ │ │ │ +salt was used, this is an empty string</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="item"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bitem%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bitem%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>item</dt>
│ │ │ │ +<dd>the data for this item</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="authoritative"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bauthoritative%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bauthoritative%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>authoritative</dt>
│ │ │ │ +<dd>the last response for mutable data is authoritative.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_put_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_put_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_put_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-put-alert">
│ │ │ │ +<h1>dht_put_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this is posted when a DHT put operation completes. This is useful if the
│ │ │ │ +client is waiting for a put to complete before shutting down for instance.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_put_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ +   sha1_hash target;
│ │ │ │ +   std::array&lt;char, 32&gt; public_key;
│ │ │ │ +   std::array&lt;char, 64&gt; signature;
│ │ │ │ +   std::string salt;
│ │ │ │ +   std::int64_t seq;
│ │ │ │ +   int num_success;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="target"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_put_alert%3A%3A%5Btarget%5D&labels=documentation&body=Documentation+under+heading+%22dht_put_alert%3A%3A%5Btarget%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>target</dt>
│ │ │ │ +<dd>the target hash the item was stored under if this was an <em>immutable</em>
│ │ │ │ +item.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="public_key"></a>
│ │ │ │ +<a name="signature"></a>
│ │ │ │ +<a name="salt"></a>
│ │ │ │ +<a name="seq"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_put_alert%3A%3A%5Bpublic_key+signature+salt+seq%5D&labels=documentation&body=Documentation+under+heading+%22dht_put_alert%3A%3A%5Bpublic_key+signature+salt+seq%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>public_key signature salt seq</dt>
│ │ │ │ +<dd>if a mutable item was stored, these are the public key, signature,
│ │ │ │ +salt and sequence number the item was stored under.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_success"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_put_alert%3A%3A%5Bnum_success%5D&labels=documentation&body=Documentation+under+heading+%22dht_put_alert%3A%3A%5Bnum_success%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_success</dt>
│ │ │ │ +<dd>DHT put operation usually writes item to k nodes, maybe the node
│ │ │ │ +is stale so no response, or the node doesn't support 'put', or the
│ │ │ │ +token for write is out of date, etc. num_success is the number of
│ │ │ │ +successful responses we got from the puts.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="i2p_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+i2p_alert&labels=documentation&body=Documentation+under+heading+%22class+i2p_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="i2p-alert">
│ │ │ │ +<h1>i2p_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is used to report errors in the i2p SAM connection</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct i2p_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ +   error_code error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:i2p_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22i2p_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error that occurred in the i2p SAM connection</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_outgoing_get_peers_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_outgoing_get_peers_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_outgoing_get_peers_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-outgoing-get-peers-alert">
│ │ │ │ +<h1>dht_outgoing_get_peers_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when we send a get_peers request
│ │ │ │ +It belongs to the <tt class="docutils literal"><span class="pre">alert_category::dht</span></tt> category.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_outgoing_get_peers_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ +   sha1_hash info_hash;
│ │ │ │ +   sha1_hash obfuscated_info_hash;
│ │ │ │ +   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="info_hash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_outgoing_get_peers_alert%3A%3A%5Binfo_hash%5D&labels=documentation&body=Documentation+under+heading+%22dht_outgoing_get_peers_alert%3A%3A%5Binfo_hash%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>info_hash</dt>
│ │ │ │ +<dd>the info_hash of the torrent we're looking for peers for.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="obfuscated_info_hash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_outgoing_get_peers_alert%3A%3A%5Bobfuscated_info_hash%5D&labels=documentation&body=Documentation+under+heading+%22dht_outgoing_get_peers_alert%3A%3A%5Bobfuscated_info_hash%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>obfuscated_info_hash</dt>
│ │ │ │ +<dd>if this was an obfuscated lookup, this is the info-hash target
│ │ │ │ +actually sent to the node.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_outgoing_get_peers_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22dht_outgoing_get_peers_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>endpoint</dt>
│ │ │ │ +<dd>the endpoint we're sending this query to</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+log_alert&labels=documentation&body=Documentation+under+heading+%22class+log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="log-alert">
│ │ │ │ +<h1>log_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted by some <a class="reference external" href="reference-Session.html#session">session</a> wide event. Its main purpose is
│ │ │ │ +trouble shooting and debugging. It's not enabled by the default <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +mask and is enabled by the <tt class="docutils literal"><span class="pre">alert_category::session_log</span></tt> bit.
│ │ │ │ +Furthermore, it's by default disabled as a build configuration.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct log_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>log_message</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::session_log;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-1">
│ │ │ │ +<h2>log_message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>log_message</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the log message</p>
│ │ │ │ +<a name="torrent_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_log_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="torrent-log-alert">
│ │ │ │ +<h1>torrent_log_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted by torrent wide events. It's meant to be used for
│ │ │ │ +trouble shooting and debugging. It's not enabled by the default <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +mask and is enabled by the <tt class="docutils literal"><span class="pre">alert_category::torrent_log</span></tt> bit. By
│ │ │ │ +default it is disabled as a build configuration.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_log_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>log_message</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::torrent_log;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-2">
│ │ │ │ +<h2>log_message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>log_message</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the log message</p>
│ │ │ │ +<a name="peer_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_log_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="peer-log-alert">
│ │ │ │ +<h1>peer_log_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted by events specific to a peer. It's meant to be used
│ │ │ │ +for trouble shooting and debugging. It's not enabled by the default <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +mask and is enabled by the <tt class="docutils literal"><span class="pre">alert_category::peer_log</span></tt> bit. By
│ │ │ │ +default it is disabled as a build configuration.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_log_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>log_message</strong> () const;
│ │ │ │ +
│ │ │ │ +   enum direction_t
│ │ │ │ +   {
│ │ │ │ +      incoming_message,
│ │ │ │ +      outgoing_message,
│ │ │ │ +      incoming,
│ │ │ │ +      outgoing,
│ │ │ │ +      info,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer_log;
│ │ │ │ +   char const* event_type;
│ │ │ │ +   direction_t direction;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-3">
│ │ │ │ +<h2>log_message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>log_message</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the log message</p>
│ │ │ │ +<a name="direction_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+direction_t&labels=documentation&body=Documentation+under+heading+%22enum+direction_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-direction-t-1">
│ │ │ │ +<h2>enum direction_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="44%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="33%" />
│ │ │ │ +<col width="47%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="34%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>alert_mask</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>a bitmask combining flags from <a class="reference external" href="reference-Alerts.html#alert_category_t">alert_category_t</a> defining which
│ │ │ │ -kinds of alerts to receive</p>
│ │ │ │ -<a name="out_enc_policy"></a>
│ │ │ │ -<a name="in_enc_policy"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="33%" />
│ │ │ │ -<col width="12%" />
│ │ │ │ -<col width="55%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>incoming_message</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>out_enc_policy</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>settings_pack::pe_enabled</td>
│ │ │ │ +<tr><td>outgoing_message</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>in_enc_policy</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>settings_pack::pe_enabled</td>
│ │ │ │ +<tr><td>incoming</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>control the settings for incoming and outgoing connections
│ │ │ │ -respectively. see <a class="reference external" href="reference-Settings.html#enc_policy">enc_policy</a> enum for the available options.
│ │ │ │ -Keep in mind that protocol encryption degrades performance in
│ │ │ │ -several respects:</p>
│ │ │ │ -<ol class="arabic simple">
│ │ │ │ -<li>It prevents &quot;zero copy&quot; disk buffers being sent to peers, since
│ │ │ │ -each peer needs to mutate the data (i.e. encrypt it) the data
│ │ │ │ -must be copied per peer connection rather than sending the same
│ │ │ │ -buffer to multiple peers.</li>
│ │ │ │ -<li>The encryption itself requires more CPU than plain bittorrent
│ │ │ │ -protocol. The highest cost is the Diffie Hellman exchange on
│ │ │ │ -connection setup.</li>
│ │ │ │ -<li>The encryption handshake adds several round-trips to the
│ │ │ │ -connection setup, and delays transferring data.</li>
│ │ │ │ -</ol>
│ │ │ │ -<a name="allowed_enc_level"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="39%" />
│ │ │ │ -<col width="12%" />
│ │ │ │ -<col width="49%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>outgoing</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>allowed_enc_level</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>settings_pack::pe_both</td>
│ │ │ │ +<tr><td>info</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>determines the encryption level of the connections. This setting
│ │ │ │ -will adjust which encryption scheme is offered to the other peer,
│ │ │ │ -as well as which encryption scheme is selected by the client. See
│ │ │ │ -<a class="reference external" href="reference-Settings.html#enc_level">enc_level</a> enum for options.</p>
│ │ │ │ -<a name="inactive_down_rate"></a>
│ │ │ │ -<a name="inactive_up_rate"></a><table border="1" class="docutils">
│ │ │ │ +<a name="event_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_log_alert%3A%3A%5Bevent_type%5D&labels=documentation&body=Documentation+under+heading+%22peer_log_alert%3A%3A%5Bevent_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>event_type</dt>
│ │ │ │ +<dd>string literal indicating the kind of event. For messages, this is the
│ │ │ │ +message name.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="lsd_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+lsd_error_alert&labels=documentation&body=Documentation+under+heading+%22class+lsd_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="lsd-error-alert">
│ │ │ │ +<h1>lsd_error_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted if the local service discovery socket fails to start properly.
│ │ │ │ +it's categorized as <tt class="docutils literal"><span class="pre">alert_category::error</span></tt>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct lsd_error_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ +   aux::noexcept_movable&lt;address&gt; local_address;
│ │ │ │ +   error_code error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:lsd_error_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22lsd_error_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>local_address</dt>
│ │ │ │ +<dd>the local network the corresponding local service discovery is running
│ │ │ │ +on</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:lsd_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22lsd_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>The error code</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_lookup"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_lookup&labels=documentation&body=Documentation+under+heading+%22class+dht_lookup%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-lookup">
│ │ │ │ +<h1>dht_lookup</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>holds statistics about a current <a class="reference external" href="reference-Alerts.html#dht_lookup">dht_lookup</a> operation.
│ │ │ │ +a DHT lookup is the traversal of nodes, looking up a
│ │ │ │ +set of target nodes in the DHT for retrieving and possibly
│ │ │ │ +storing information in the DHT</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_lookup
│ │ │ │ +{
│ │ │ │ +   char const* type;
│ │ │ │ +   int outstanding_requests;
│ │ │ │ +   int timeouts;
│ │ │ │ +   int responses;
│ │ │ │ +   int branch_factor;
│ │ │ │ +   int nodes_left;
│ │ │ │ +   int last_sent;
│ │ │ │ +   int first_timeout;
│ │ │ │ +   sha1_hash target;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Btype%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Btype%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>type</dt>
│ │ │ │ +<dd>string literal indicating which kind of lookup this is</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="outstanding_requests"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Boutstanding_requests%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Boutstanding_requests%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>outstanding_requests</dt>
│ │ │ │ +<dd>the number of outstanding request to individual nodes
│ │ │ │ +this lookup has right now</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="timeouts"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Btimeouts%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Btimeouts%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>timeouts</dt>
│ │ │ │ +<dd>the total number of requests that have timed out so far
│ │ │ │ +for this lookup</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="responses"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bresponses%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bresponses%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>responses</dt>
│ │ │ │ +<dd>the total number of responses we have received for this
│ │ │ │ +lookup so far for this lookup</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="branch_factor"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bbranch_factor%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bbranch_factor%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>branch_factor</dt>
│ │ │ │ +<dd>the branch factor for this lookup. This is the number of
│ │ │ │ +nodes we keep outstanding requests to in parallel by default.
│ │ │ │ +when nodes time out we may increase this.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="nodes_left"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bnodes_left%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bnodes_left%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>nodes_left</dt>
│ │ │ │ +<dd>the number of nodes left that could be queries for this
│ │ │ │ +lookup. Many of these are likely to be part of the trail
│ │ │ │ +while performing the lookup and would never end up actually
│ │ │ │ +being queried.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="last_sent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Blast_sent%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Blast_sent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>last_sent</dt>
│ │ │ │ +<dd>the number of seconds ago the
│ │ │ │ +last message was sent that's still
│ │ │ │ +outstanding</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="first_timeout"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bfirst_timeout%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bfirst_timeout%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>first_timeout</dt>
│ │ │ │ +<dd>the number of outstanding requests
│ │ │ │ +that have exceeded the short timeout
│ │ │ │ +and are considered timed out in the
│ │ │ │ +sense that they increased the branch
│ │ │ │ +factor</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="target"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Btarget%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Btarget%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>target</dt>
│ │ │ │ +<dd>the node-id or info-hash target for this lookup</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_stats_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_stats_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_stats_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-stats-alert">
│ │ │ │ +<h1>dht_stats_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>contains current DHT state. Posted in response to session::post_dht_stats().</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_stats_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = {};
│ │ │ │ +   std::vector&lt;dht_lookup&gt; active_requests;
│ │ │ │ +   std::vector&lt;dht_routing_bucket&gt; routing_table;
│ │ │ │ +   sha1_hash nid;
│ │ │ │ +   aux::noexcept_movable&lt;udp::endpoint&gt; local_endpoint;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="active_requests"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Bactive_requests%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Bactive_requests%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>active_requests</dt>
│ │ │ │ +<dd>a vector of the currently running DHT lookups.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="routing_table"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Brouting_table%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Brouting_table%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>routing_table</dt>
│ │ │ │ +<dd>contains information about every bucket in the DHT routing
│ │ │ │ +table.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="nid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Bnid%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Bnid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>nid</dt>
│ │ │ │ +<dd>the node ID of the DHT node instance</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="local_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>local_endpoint</dt>
│ │ │ │ +<dd>the local socket this DHT node is running on</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="incoming_request_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+incoming_request_alert&labels=documentation&body=Documentation+under+heading+%22class+incoming_request_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="incoming-request-alert">
│ │ │ │ +<h1>incoming_request_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted every time an incoming request from a peer is accepted and queued
│ │ │ │ +up for being serviced. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only posted if
│ │ │ │ +the alert_category::incoming_request flag is enabled in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +mask.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct incoming_request_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::incoming_request;
│ │ │ │ +   peer_request req;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="req"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:incoming_request_alert%3A%3A%5Breq%5D&labels=documentation&body=Documentation+under+heading+%22incoming_request_alert%3A%3A%5Breq%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>req</dt>
│ │ │ │ +<dd>the request this peer sent to us</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_log_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-log-alert">
│ │ │ │ +<h1>dht_log_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>debug logging of the DHT when alert_category::dht_log is set in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +mask.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_log_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   char const* <strong>log_message</strong> () const;
│ │ │ │ +
│ │ │ │ +   enum dht_module_t
│ │ │ │ +   {
│ │ │ │ +      tracker,
│ │ │ │ +      node,
│ │ │ │ +      routing_table,
│ │ │ │ +      rpc_manager,
│ │ │ │ +      traversal,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_log;
│ │ │ │ +   dht_module_t module;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-4">
│ │ │ │ +<h2>log_message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>log_message</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>the log message</p>
│ │ │ │ +<a name="dht_module_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+dht_module_t&labels=documentation&body=Documentation+under+heading+%22enum+dht_module_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-dht-module-t">
│ │ │ │ +<h2>enum dht_module_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ +<col width="43%" />
│ │ │ │ +<col width="20%" />
│ │ │ │ +<col width="37%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>inactive_down_rate</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>2048</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>inactive_up_rate</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>2048</td>
│ │ │ │ +<tr><td>tracker</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the download and upload rate limits for a torrent to be considered
│ │ │ │ -active by the queuing mechanism. A torrent whose download rate is
│ │ │ │ -less than <tt class="docutils literal">inactive_down_rate</tt> and whose upload rate is less than
│ │ │ │ -<tt class="docutils literal">inactive_up_rate</tt> for <tt class="docutils literal">auto_manage_startup</tt> seconds, is
│ │ │ │ -considered inactive, and another queued torrent may be started.
│ │ │ │ -This logic is disabled if <tt class="docutils literal">dont_count_slow_torrents</tt> is false.</p>
│ │ │ │ -<a name="proxy_type"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="31%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="54%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>node</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>proxy_type</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>settings_pack::none</td>
│ │ │ │ +<tr><td>routing_table</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>proxy to use. see <a class="reference external" href="reference-Settings.html#proxy_type_t">proxy_type_t</a>.</p>
│ │ │ │ -<a name="proxy_port"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="44%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="33%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>rpc_manager</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>proxy_port</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0</td>
│ │ │ │ +<tr><td>traversal</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>the port of the proxy server</p>
│ │ │ │ -<a name="i2p_port"></a><table border="1" class="docutils">
│ │ │ │ +<a name="module"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_log_alert%3A%3A%5Bmodule%5D&labels=documentation&body=Documentation+under+heading+%22dht_log_alert%3A%3A%5Bmodule%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>module</dt>
│ │ │ │ +<dd>the module, or part, of the DHT that produced this log message.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_pkt_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_pkt_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_pkt_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="dht-pkt-alert">
│ │ │ │ +<h1>dht_pkt_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time a DHT message is sent or received. It is
│ │ │ │ +only posted if the <tt class="docutils literal"><span class="pre">alert_category::dht_log</span></tt> <a class="reference external" href="reference-Alerts.html#alert">alert</a> category is
│ │ │ │ +enabled. It contains a verbatim copy of the message.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_pkt_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   span&lt;char const&gt; <strong>pkt_buf</strong> () const;
│ │ │ │ +
│ │ │ │ +   enum direction_t
│ │ │ │ +   {
│ │ │ │ +      incoming,
│ │ │ │ +      outgoing,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_log;
│ │ │ │ +   direction_t direction;
│ │ │ │ +   aux::noexcept_movable&lt;udp::endpoint&gt; node;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="pkt_buf()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_pkt_alert%3A%3A%5Bpkt_buf%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_pkt_alert%3A%3A%5Bpkt_buf%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="pkt-buf">
│ │ │ │ +<h2>pkt_buf()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +span&lt;char const&gt; <strong>pkt_buf</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a pointer to the packet buffer and size of the packet,
│ │ │ │ +respectively. This buffer is only valid for as long as the <a class="reference external" href="reference-Alerts.html#alert">alert</a> itself
│ │ │ │ +is valid, which is owned by libtorrent and reclaimed whenever
│ │ │ │ +<a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> is called on the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
│ │ │ │ +<a name="direction_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+direction_t&labels=documentation&body=Documentation+under+heading+%22enum+direction_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-direction-t-2">
│ │ │ │ +<h2>enum direction_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="40%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -<col width="36%" />
│ │ │ │ +<col width="33%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +<col width="43%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>i2p_port</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>incoming</td>
│ │ │ │  <td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>sets the <a class="reference external" href="http://www.i2p2.de">i2p</a> SAM bridge port to connect to. set the hostname with
│ │ │ │ -the <tt class="docutils literal">i2p_hostname</tt> setting.</p>
│ │ │ │ -<a name="urlseed_max_request_bytes"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="53%" />
│ │ │ │ -<col width="12%" />
│ │ │ │ -<col width="35%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>urlseed_max_request_bytes</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>16 * 1024 * 1024</td>
│ │ │ │ +<tr><td>outgoing</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>The maximum request range of an url seed in bytes. This value
│ │ │ │ -defines the largest possible sequential web seed request. Lower values
│ │ │ │ -are possible but will be ignored if they are lower then piece size.
│ │ │ │ -This value should be related to your download speed to prevent
│ │ │ │ -libtorrent from creating too many expensive http requests per
│ │ │ │ -second. You can select a value as high as you want but keep in mind
│ │ │ │ -that libtorrent can't create parallel requests if the first request
│ │ │ │ -did already select the whole file.
│ │ │ │ -If you combine bittorrent seeds with web seeds and pick strategies
│ │ │ │ -like rarest first you may find your web seed requests split into
│ │ │ │ -smaller parts because we don't download already picked pieces
│ │ │ │ -twice.</p>
│ │ │ │ -<a name="web_seed_name_lookup_retry"></a><table border="1" class="docutils">
│ │ │ │ +<a name="direction"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_pkt_alert%3A%3A%5Bdirection%5D&labels=documentation&body=Documentation+under+heading+%22dht_pkt_alert%3A%3A%5Bdirection%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>direction</dt>
│ │ │ │ +<dd>whether this is an incoming or outgoing packet.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="node"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_pkt_alert%3A%3A%5Bnode%5D&labels=documentation&body=Documentation+under+heading+%22dht_pkt_alert%3A%3A%5Bnode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>node</dt>
│ │ │ │ +<dd>the DHT node we received this packet from, or sent this packet to
│ │ │ │ +(depending on <tt class="docutils literal">direction</tt>).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_get_peers_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_get_peers_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_get_peers_reply_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="dht-get-peers-reply-alert">
│ │ │ │ +<h1>dht_get_peers_reply_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>Posted when we receive a response to a DHT get_peers request.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_get_peers_reply_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   int <strong>num_peers</strong> () const;
│ │ │ │ +   std::vector&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; <strong>peers</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_operation;
│ │ │ │ +   sha1_hash info_hash;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="dht_direct_response_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_direct_response_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_direct_response_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-direct-response-alert">
│ │ │ │ +<h1>dht_direct_response_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This is posted exactly once for every call to session_handle::dht_direct_request.
│ │ │ │ +If the request failed, <a class="reference external" href="reference-Alerts.html#response()">response()</a> will return a default constructed <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_direct_response_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   bdecode_node <strong>response</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ +   client_data_t userdata;
│ │ │ │ +   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="picker_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+picker_log_alert&labels=documentation&body=Documentation+under+heading+%22class+picker_log_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="picker-log-alert">
│ │ │ │ +<h1>picker_log_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this is posted when one or more blocks are picked by the piece picker,
│ │ │ │ +assuming the verbose piece picker logging is enabled (see
│ │ │ │ +alert_category::picker_log).</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct picker_log_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   std::vector&lt;piece_block&gt; <strong>blocks</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::picker_log;
│ │ │ │ +   static constexpr picker_flags_t <strong>partial_ratio</strong>  = 0_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>prioritize_partials</strong>  = 1_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>rarest_first_partials</strong>  = 2_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>rarest_first</strong>  = 3_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>reverse_rarest_first</strong>  = 4_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>suggested_pieces</strong>  = 5_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>prio_sequential_pieces</strong>  = 6_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>sequential_pieces</strong>  = 7_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>reverse_pieces</strong>  = 8_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>time_critical</strong>  = 9_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>random_pieces</strong>  = 10_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>prefer_contiguous</strong>  = 11_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>reverse_sequential</strong>  = 12_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>backup1</strong>  = 13_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>backup2</strong>  = 14_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>end_game</strong>  = 15_bit;
│ │ │ │ +   static constexpr picker_flags_t <strong>extent_affinity</strong>  = 16_bit;
│ │ │ │ +   picker_flags_t const picker_flags;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="picker_flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:picker_log_alert%3A%3A%5Bpicker_flags%5D&labels=documentation&body=Documentation+under+heading+%22picker_log_alert%3A%3A%5Bpicker_flags%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>picker_flags</dt>
│ │ │ │ +<dd>this is a bitmask of which features were enabled for this particular
│ │ │ │ +pick. The bits are defined in the picker_flags_t enum.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="session_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_error_alert&labels=documentation&body=Documentation+under+heading+%22class+session_error_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="session-error-alert">
│ │ │ │ +<h1>session_error_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the <a class="reference external" href="reference-Session.html#session">session</a> encounters a serious error,
│ │ │ │ +potentially fatal</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct session_error_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ +   error_code const error;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22session_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>The error code, if one is associated with this error</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht_live_nodes_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_live_nodes_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_live_nodes_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-live-nodes-alert">
│ │ │ │ +<h1>dht_live_nodes_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted in response to a call to session::dht_live_nodes(). It contains the
│ │ │ │ +live nodes from the DHT routing table of one of the DHT nodes running
│ │ │ │ +locally.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_live_nodes_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
│ │ │ │ +   int <strong>num_nodes</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
│ │ │ │ +   sha1_hash node_id;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="num_nodes()"></a>
│ │ │ │ +<a name="nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_live_nodes_alert%3A%3A%5Bnum_nodes%28%29+nodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_live_nodes_alert%3A%3A%5Bnum_nodes%28%29+nodes%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="num-nodes-nodes">
│ │ │ │ +<h2>num_nodes() nodes()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
│ │ │ │ +int <strong>num_nodes</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>the number of nodes in the routing table and the actual nodes.</p>
│ │ │ │ +<a name="node_id"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_live_nodes_alert%3A%3A%5Bnode_id%5D&labels=documentation&body=Documentation+under+heading+%22dht_live_nodes_alert%3A%3A%5Bnode_id%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>node_id</dt>
│ │ │ │ +<dd>the local DHT node's node-ID this routing table belongs to</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="session_stats_header_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_stats_header_alert&labels=documentation&body=Documentation+under+heading+%22class+session_stats_header_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="session-stats-header-alert">
│ │ │ │ +<h1>session_stats_header_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>The session_stats_header <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted the first time
│ │ │ │ +<a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a> is called</p>
│ │ │ │ +<p>the <tt class="docutils literal">message()</tt> member function returns a string representation of the
│ │ │ │ +header that properly match the stats values string returned in
│ │ │ │ +<tt class="docutils literal"><span class="pre">session_stats_alert::message()</span></tt>.</p>
│ │ │ │ +<p>this specific output is parsed by tools/parse_session_stats.py
│ │ │ │ +if this is changed, that parser should also be changed</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct session_stats_header_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = {};
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="dht_sample_infohashes_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_sample_infohashes_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_sample_infohashes_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-sample-infohashes-alert">
│ │ │ │ +<h1>dht_sample_infohashes_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted as a response to a call to session::dht_sample_infohashes() with
│ │ │ │ +the information from the DHT response message.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct dht_sample_infohashes_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   int <strong>num_samples</strong> () const;
│ │ │ │ +   std::vector&lt;sha1_hash&gt; <strong>samples</strong> () const;
│ │ │ │ +   int <strong>num_nodes</strong> () const;
│ │ │ │ +   std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_operation;
│ │ │ │ +   sha1_hash node_id;
│ │ │ │ +   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
│ │ │ │ +   time_duration const interval;
│ │ │ │ +   int const num_infohashes;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="samples()"></a>
│ │ │ │ +<a name="num_samples()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bsamples%28%29+num_samples%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bsamples%28%29+num_samples%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="samples-num-samples">
│ │ │ │ +<h2>samples() num_samples()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>num_samples</strong> () const;
│ │ │ │ +std::vector&lt;sha1_hash&gt; <strong>samples</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the number of info-hashes returned by the node, as well as the
│ │ │ │ +actual info-hashes. <tt class="docutils literal">num_samples()</tt> is more efficient than
│ │ │ │ +<tt class="docutils literal"><span class="pre">samples().size()</span></tt>.</p>
│ │ │ │ +<a name="num_nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnum_nodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnum_nodes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="num-nodes">
│ │ │ │ +<h2>num_nodes()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>num_nodes</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>The total number of nodes returned by <tt class="docutils literal">nodes()</tt>.</p>
│ │ │ │ +<a name="nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnodes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="nodes-1">
│ │ │ │ +<h2>nodes()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>This is the set of more DHT nodes returned by the request.</p>
│ │ │ │ +<p>The information is included so that indexing nodes can perform a key
│ │ │ │ +space traversal with a single RPC per node by adjusting the target
│ │ │ │ +value for each RPC.</p>
│ │ │ │ +<a name="node_id"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnode_id%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnode_id%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>node_id</dt>
│ │ │ │ +<dd>id of the node the request was sent to (and this response was received from)</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>endpoint</dt>
│ │ │ │ +<dd>the node the request was sent to (and this response was received from)</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="interval"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Binterval%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Binterval%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>interval</dt>
│ │ │ │ +<dd>the interval to wait before making another request to this node</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_infohashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnum_infohashes%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnum_infohashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_infohashes</dt>
│ │ │ │ +<dd>This field indicates how many info-hash keys are currently in the node's storage.
│ │ │ │ +If the value is larger than the number of returned samples it indicates that the
│ │ │ │ +indexer may obtain additional samples after waiting out the interval.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="block_uploaded_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_uploaded_alert&labels=documentation&body=Documentation+under+heading+%22class+block_uploaded_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="block-uploaded-alert">
│ │ │ │ +<h1>block_uploaded_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when a block intended to be sent to a peer is placed in the
│ │ │ │ +send buffer. Note that if the connection is closed before the send buffer is sent,
│ │ │ │ +the <a class="reference external" href="reference-Alerts.html#alert">alert</a> may be posted without the bytes having been sent to the peer.
│ │ │ │ +It belongs to the <tt class="docutils literal"><span class="pre">alert_category::upload</span></tt> category.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct block_uploaded_alert final : peer_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   int const block_index;
│ │ │ │ +   piece_index_t const piece_index;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="alerts_dropped_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+alerts_dropped_alert&labels=documentation&body=Documentation+under+heading+%22class+alerts_dropped_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="alerts-dropped-alert">
│ │ │ │ +<h1>alerts_dropped_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted to indicate to the client that some alerts were
│ │ │ │ +dropped. Dropped meaning that the <a class="reference external" href="reference-Alerts.html#alert">alert</a> failed to be delivered to the
│ │ │ │ +client. The most common cause of such failure is that the internal <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +queue grew too big (controlled by alert_queue_size).</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct alerts_dropped_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +   <strong>static_assert</strong> (num_alert_types &lt;= abi_alert_count, &quot;need to increase bitset. This is an ABI break&quot;);
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ +   std::bitset&lt;abi_alert_count&gt; dropped_alerts;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="dropped_alerts"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alerts_dropped_alert%3A%3A%5Bdropped_alerts%5D&labels=documentation&body=Documentation+under+heading+%22alerts_dropped_alert%3A%3A%5Bdropped_alerts%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>dropped_alerts</dt>
│ │ │ │ +<dd>a bitmask indicating which alerts were dropped. Each bit represents the
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#alert">alert</a> type ID, where bit 0 represents whether any <a class="reference external" href="reference-Alerts.html#alert">alert</a> of type 0 has
│ │ │ │ +been dropped, and so on.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="socks5_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+socks5_alert&labels=documentation&body=Documentation+under+heading+%22class+socks5_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="socks5-alert">
│ │ │ │ +<h1>socks5_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted with SOCKS5 related errors, when a SOCKS5 proxy is
│ │ │ │ +configured. It's enabled with the alert_category::error <a class="reference external" href="reference-Alerts.html#alert">alert</a> category.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct socks5_alert final : alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ +   error_code error;
│ │ │ │ +   operation_t op;
│ │ │ │ +   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; ip;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks5_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22socks5_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks5_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22socks5_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>op</dt>
│ │ │ │ +<dd>the operation that failed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="ip"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks5_alert%3A%3A%5Bip%5D&labels=documentation&body=Documentation+under+heading+%22socks5_alert%3A%3A%5Bip%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>ip</dt>
│ │ │ │ +<dd>the endpoint configured as the proxy</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_prio_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_prio_alert&labels=documentation&body=Documentation+under+heading+%22class+file_prio_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-prio-alert">
│ │ │ │ +<h1>file_prio_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted when a <a class="reference external" href="reference-Torrent_Handle.html#prioritize_files()">prioritize_files()</a> or <a class="reference external" href="reference-Torrent_Handle.html#file_priority()">file_priority()</a> update of the file
│ │ │ │ +priorities complete, which requires a round-trip to the disk thread.</p>
│ │ │ │ +<p>If the disk operation fails this <a class="reference external" href="reference-Alerts.html#alert">alert</a> won't be posted, but a
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#file_error_alert">file_error_alert</a> is posted instead, and the torrent is stopped.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct file_prio_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ +   error_code error;
│ │ │ │ +   operation_t op;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_prio_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22file_prio_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd>the error</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_prio_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22file_prio_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>op</dt>
│ │ │ │ +<dd>the operation that failed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="oversized_file_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+oversized_file_alert&labels=documentation&body=Documentation+under+heading+%22class+oversized_file_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="oversized-file-alert">
│ │ │ │ +<h1>oversized_file_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> may be posted when the initial checking of resume data and files
│ │ │ │ +on disk (just existence, not piece hashes) completes. If a file belonging
│ │ │ │ +to the torrent is found on disk, but is larger than the file in the
│ │ │ │ +torrent, that's when this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted.
│ │ │ │ +the client may want to call <a class="reference external" href="reference-Core.html#truncate_files()">truncate_files()</a> in that case, or perhaps
│ │ │ │ +interpret it as a sign that some other file is in the way, that shouldn't
│ │ │ │ +be overwritten.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct oversized_file_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="torrent_conflict_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_conflict_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_conflict_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-conflict-alert">
│ │ │ │ +<h1>torrent_conflict_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when two separate torrents (magnet links) resolve to
│ │ │ │ +the same torrent, thus causing the same torrent being added twice. In
│ │ │ │ +that case, both torrents enter an error state with <tt class="docutils literal">duplicate_torrent</tt>
│ │ │ │ +as the error code. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted containing the metadata. For more
│ │ │ │ +information, see <a class="reference external" href="manual-ref.html#bittorrent-v2-torrents">BitTorrent v2 torrents</a>.
│ │ │ │ +The torrent this <a class="reference external" href="reference-Alerts.html#alert">alert</a> originated from was the one that downloaded the</p>
│ │ │ │ +<p>metadata (i.e. the <cite>handle</cite> member from the <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a> base class).</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_conflict_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
│ │ │ │ +   torrent_handle conflicting_torrent;
│ │ │ │ +   std::shared_ptr&lt;torrent_info&gt; metadata;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="conflicting_torrent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_conflict_alert%3A%3A%5Bconflicting_torrent%5D&labels=documentation&body=Documentation+under+heading+%22torrent_conflict_alert%3A%3A%5Bconflicting_torrent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>conflicting_torrent</dt>
│ │ │ │ +<dd>the handle to the torrent in conflict. The swarm associated with this
│ │ │ │ +torrent handle did not download the metadata, but the downloaded
│ │ │ │ +metadata collided with this swarm's info-hash.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="metadata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_conflict_alert%3A%3A%5Bmetadata%5D&labels=documentation&body=Documentation+under+heading+%22torrent_conflict_alert%3A%3A%5Bmetadata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>metadata</dt>
│ │ │ │ +<dd>the metadata that was received by one of the torrents in conflict.
│ │ │ │ +One way to resolve the conflict is to remove both failing torrents
│ │ │ │ +and re-add it using this metadata</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="peer_info_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_info_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_info_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="peer-info-alert">
│ │ │ │ +<h1>peer_info_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_peer_info()">torrent_handle::post_peer_info()</a> is called</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_info_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +   std::vector&lt;lt::peer_info&gt; peer_info;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="peer_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info_alert%3A%3A%5Bpeer_info%5D&labels=documentation&body=Documentation+under+heading+%22peer_info_alert%3A%3A%5Bpeer_info%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>peer_info</dt>
│ │ │ │ +<dd>the list of the currently connected peers</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="file_progress_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_progress_alert&labels=documentation&body=Documentation+under+heading+%22class+file_progress_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="file-progress-alert">
│ │ │ │ +<h1>file_progress_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_file_progress()">torrent_handle::post_file_progress()</a> is called</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct file_progress_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::file_progress;
│ │ │ │ +   aux::vector&lt;std::int64_t, file_index_t&gt; files;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="files"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_progress_alert%3A%3A%5Bfiles%5D&labels=documentation&body=Documentation+under+heading+%22file_progress_alert%3A%3A%5Bfiles%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>files</dt>
│ │ │ │ +<dd>the list of the files in the torrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="piece_info_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_info_alert&labels=documentation&body=Documentation+under+heading+%22class+piece_info_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-info-alert">
│ │ │ │ +<h1>piece_info_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_download_queue()">torrent_handle::post_download_queue()</a> is called</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct piece_info_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::piece_progress;
│ │ │ │ +   std::vector&lt;partial_piece_info&gt; piece_info;
│ │ │ │ +   std::vector&lt;block_info&gt; block_data;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="piece_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_info_alert%3A%3A%5Bpiece_info%5D&labels=documentation&body=Documentation+under+heading+%22piece_info_alert%3A%3A%5Bpiece_info%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>piece_info</dt>
│ │ │ │ +<dd>info about pieces being downloaded for the torrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="block_data"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_info_alert%3A%3A%5Bblock_data%5D&labels=documentation&body=Documentation+under+heading+%22piece_info_alert%3A%3A%5Bblock_data%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>block_data</dt>
│ │ │ │ +<dd>storage for <a class="reference external" href="reference-Torrent_Handle.html#block_info">block_info</a> pointers in <a class="reference external" href="reference-Torrent_Handle.html#partial_piece_info">partial_piece_info</a> objects</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="piece_availability_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_availability_alert&labels=documentation&body=Documentation+under+heading+%22class+piece_availability_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="piece-availability-alert">
│ │ │ │ +<h1>piece_availability_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_piece_availability()">torrent_handle::post_piece_availability()</a> is called</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct piece_availability_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +   std::vector&lt;int&gt; piece_availability;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="piece_availability"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_availability_alert%3A%3A%5Bpiece_availability%5D&labels=documentation&body=Documentation+under+heading+%22piece_availability_alert%3A%3A%5Bpiece_availability%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>piece_availability</dt>
│ │ │ │ +<dd>info about pieces being downloaded for the torrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="tracker_list_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_list_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_list_alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="tracker-list-alert">
│ │ │ │ +<h1>tracker_list_alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_trackers()">torrent_handle::post_trackers()</a> is called</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct tracker_list_alert final : torrent_alert
│ │ │ │ +{
│ │ │ │ +   std::string <strong>message</strong> () const override;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
│ │ │ │ +   std::vector&lt;announce_entry&gt; trackers;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="trackers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_list_alert%3A%3A%5Btrackers%5D&labels=documentation&body=Documentation+under+heading+%22tracker_list_alert%3A%3A%5Btrackers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>trackers</dt>
│ │ │ │ +<dd>list of trackers and their status for the torrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+alert&labels=documentation&body=Documentation+under+heading+%22class+alert%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="alert">
│ │ │ │ +<h1>alert</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
│ │ │ │ +<p>The <tt class="docutils literal">alert</tt> class is the base class that specific messages are derived from.
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#alert">alert</a> types are not copyable, and cannot be constructed by the client. The
│ │ │ │ +pointers returned by libtorrent are short lived (the details are described
│ │ │ │ +under <a class="reference external" href="reference-Session.html#pop_alerts()">session_handle::pop_alerts()</a>)</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct alert
│ │ │ │ +{
│ │ │ │ +   time_point <strong>timestamp</strong> () const;
│ │ │ │ +   virtual int <strong>type</strong> () const noexcept = 0;
│ │ │ │ +   virtual char const* <strong>what</strong> () const noexcept = 0;
│ │ │ │ +   virtual std::string <strong>message</strong> () const = 0;
│ │ │ │ +   virtual alert_category_t <strong>category</strong> () const noexcept = 0;
│ │ │ │ +
│ │ │ │ +   static constexpr alert_category_t <strong>error_notification</strong>  = 0_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>peer_notification</strong>  = 1_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>port_mapping_notification</strong>  = 2_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>storage_notification</strong>  = 3_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>tracker_notification</strong>  = 4_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>connect_notification</strong>  = 5_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>status_notification</strong>  = 6_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>ip_block_notification</strong>  = 8_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>performance_warning</strong>  = 9_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>dht_notification</strong>  = 10_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>session_log_notification</strong>  = 13_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>torrent_log_notification</strong>  = 14_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>peer_log_notification</strong>  = 15_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>incoming_request_notification</strong>  = 16_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>dht_log_notification</strong>  = 17_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>dht_operation_notification</strong>  = 18_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>port_mapping_log_notification</strong>  = 19_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>picker_log_notification</strong>  = 20_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>file_progress_notification</strong>  = 21_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>piece_progress_notification</strong>  = 22_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>upload_notification</strong>  = 23_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>block_progress_notification</strong>  = 24_bit;
│ │ │ │ +   static constexpr alert_category_t <strong>all_categories</strong>  = alert_category_t::all();
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="timestamp()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Btimestamp%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Btimestamp%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="timestamp">
│ │ │ │ +<h2>timestamp()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +time_point <strong>timestamp</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>a timestamp is automatically created in the constructor</p>
│ │ │ │ +<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="type-1">
│ │ │ │ +<h2>type()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual int <strong>type</strong> () const noexcept = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns an integer that is unique to this <a class="reference external" href="reference-Alerts.html#alert">alert</a> type. It can be
│ │ │ │ +compared against a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> by querying a static constant called <tt class="docutils literal">alert_type</tt>
│ │ │ │ +in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>. It can be used to determine the run-time type of an alert* in
│ │ │ │ +order to cast to that <a class="reference external" href="reference-Alerts.html#alert">alert</a> type and access specific members.</p>
│ │ │ │ +<p>e.g:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">alert</span><span class="operator">*&gt;</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">pop_alerts</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">alerts</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">alert</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">a</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +        </span><span class="keyword">switch</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">a</span><span class="operator">-&gt;</span><span class="name">type</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +
│ │ │ │ +                </span><span class="keyword">case</span><span class="whitespace"> </span><span class="name constant">read_piece_alert</span><span class="operator">::</span><span class="name constant">alert_type</span><span class="punctuation">:</span><span class="whitespace">
│ │ │ │ +                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +                        </span><span class="keyword">auto</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">p</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="name">read_piece_alert</span><span class="operator">*&gt;</span><span class="punctuation">(</span><span class="name">a</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +                        </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">p</span><span class="operator">-&gt;</span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +                                </span><span class="comment single">// read_piece failed
│ │ │ │ +</span><span class="whitespace">                                </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +                        </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +                        </span><span class="comment single">// use p
│ │ │ │ +</span><span class="whitespace">                        </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +                </span><span class="keyword">case</span><span class="whitespace"> </span><span class="name constant">file_renamed_alert</span><span class="operator">::</span><span class="name constant">alert_type</span><span class="punctuation">:</span><span class="whitespace">
│ │ │ │ +                </span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +                        </span><span class="comment single">// etc...
│ │ │ │ +</span><span class="whitespace">                </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +        </span><span class="punctuation">}</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">}</span>
│ │ │ │ +</pre>
│ │ │ │ +<a name="what()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bwhat%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bwhat%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="what">
│ │ │ │ +<h2>what()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual char const* <strong>what</strong> () const noexcept = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a string literal describing the type of the <a class="reference external" href="reference-Alerts.html#alert">alert</a>. It does
│ │ │ │ +not include any information that might be bundled with the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
│ │ │ │ +<a name="message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bmessage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bmessage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="message-1">
│ │ │ │ +<h2>message()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual std::string <strong>message</strong> () const = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>generate a string describing the <a class="reference external" href="reference-Alerts.html#alert">alert</a> and the information bundled
│ │ │ │ +with it. This is mainly intended for debug and development use. It is not suitable
│ │ │ │ +to use this for applications that may be localized. Instead, handle each <a class="reference external" href="reference-Alerts.html#alert">alert</a>
│ │ │ │ +type individually and extract and render the information from the <a class="reference external" href="reference-Alerts.html#alert">alert</a> depending
│ │ │ │ +on the locale.</p>
│ │ │ │ +<a name="category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bcategory%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bcategory%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="category">
│ │ │ │ +<h2>category()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +virtual alert_category_t <strong>category</strong> () const noexcept = 0;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a bitmask specifying which categories this <a class="reference external" href="reference-Alerts.html#alert">alert</a> belong to.</p>
│ │ │ │ +<a name="alert_cast()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert_cast%28%29&labels=documentation&body=Documentation+under+heading+%22alert_cast%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="alert-cast">
│ │ │ │ +<h1>alert_cast()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +template &lt;typename T&gt; T* <strong>alert_cast</strong> (alert* a);
│ │ │ │ +template &lt;typename T&gt; T const* <strong>alert_cast</strong> (alert const* a);
│ │ │ │ +</pre>
│ │ │ │ +<p>When you get an <a class="reference external" href="reference-Alerts.html#alert">alert</a>, you can use <tt class="docutils literal">alert_cast&lt;&gt;</tt> to attempt to cast the
│ │ │ │ +pointer to a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> type, in order to query it for more
│ │ │ │ +information.</p>
│ │ │ │ +<div class="admonition note">
│ │ │ │ +<p class="first admonition-title">Note</p>
│ │ │ │ +<p class="last"><tt class="docutils literal">alert_cast&lt;&gt;</tt> can only cast to an exact <a class="reference external" href="reference-Alerts.html#alert">alert</a> type, not a base class</p>
│ │ │ │ +</div>
│ │ │ │ +<a name="operation_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:operation_name%28%29&labels=documentation&body=Documentation+under+heading+%22operation_name%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="operation-name">
│ │ │ │ +<h1>operation_name()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/operations.hpp">libtorrent/operations.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>operation_name</strong> (operation_t op);
│ │ │ │ +</pre>
│ │ │ │ +<p>maps an operation id (from <a class="reference external" href="reference-Alerts.html#peer_error_alert">peer_error_alert</a> and <a class="reference external" href="reference-Alerts.html#peer_disconnected_alert">peer_disconnected_alert</a>)
│ │ │ │ +to its name. See <a class="reference external" href="reference-Alerts.html#operation_t">operation_t</a> for the constants</p>
│ │ │ │ +<a name="operation_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+operation_t&labels=documentation&body=Documentation+under+heading+%22enum+operation_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-operation-t">
│ │ │ │ +<h1>enum operation_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/operations.hpp">libtorrent/operations.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="65%" />
│ │ │ │ -<col width="14%" />
│ │ │ │  <col width="21%" />
│ │ │ │ +<col width="7%" />
│ │ │ │ +<col width="72%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │  <tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>web_seed_name_lookup_retry</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>1800</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>time to wait until a new retry of a web seed name lookup</p>
│ │ │ │ -<a name="close_file_interval"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="44%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="44%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>close_file_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>CLOSE_FILE_INTERVAL</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the number of seconds between closing the file opened the longest
│ │ │ │ -ago. 0 means to disable the feature. The purpose of this is to
│ │ │ │ -periodically close files to trigger the operating system flushing
│ │ │ │ -disk cache. Specifically it has been observed to be required on
│ │ │ │ -windows to not have the disk cache grow indefinitely.
│ │ │ │ -This defaults to 240 seconds on windows, and disabled on other
│ │ │ │ -systems.</p>
│ │ │ │ -<a name="utp_cwnd_reduce_timer"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>unknown</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>the error was unexpected and it is unknown which operation caused it</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>utp_cwnd_reduce_timer</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>100</td>
│ │ │ │ +<tr><td>bittorrent</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>this is used when the bittorrent logic
│ │ │ │ +determines to disconnect</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>When uTP experiences packet loss, it will reduce the congestion
│ │ │ │ -window, and not reduce it again for this many milliseconds, even if
│ │ │ │ -experiencing another lost packet.</p>
│ │ │ │ -<a name="max_web_seed_connections"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="63%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="22%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>iocontrol</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>a call to iocontrol failed</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_web_seed_connections</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>getpeername</td>
│ │ │ │  <td>3</td>
│ │ │ │ +<td>a call to <tt class="docutils literal">getpeername()</tt> failed (querying the remote IP of a
│ │ │ │ +connection)</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the max number of web seeds to have connected per torrent at any
│ │ │ │ -given time.</p>
│ │ │ │ -<a name="resolver_cache_timeout"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="62%" />
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="23%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>resolver_cache_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>1200</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the number of seconds before the internal host name resolver
│ │ │ │ -considers a cache value timed out, negative values are interpreted
│ │ │ │ -as zero.</p>
│ │ │ │ -<a name="send_not_sent_low_watermark"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="66%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>send_not_sent_low_watermark</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>16384</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>specify the not-sent low watermark for socket send buffers. This
│ │ │ │ -corresponds to the, Linux-specific, <tt class="docutils literal">TCP_NOTSENT_LOWAT</tt> TCP socket
│ │ │ │ -option.</p>
│ │ │ │ -<a name="rate_choker_initial_threshold"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="67%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>rate_choker_initial_threshold</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>1024</td>
│ │ │ │ +<tr><td>getname</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>a call to getname failed (querying the local IP of a
│ │ │ │ +connection)</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the rate based choker compares the upload rate to peers against a
│ │ │ │ -threshold that increases proportionally by its size for every
│ │ │ │ -peer it visits, visiting peers in decreasing upload rate. The
│ │ │ │ -number of upload slots is determined by the number of peers whose
│ │ │ │ -upload rate exceeds the threshold. This option sets the start
│ │ │ │ -value for this threshold. A higher value leads to fewer unchoke
│ │ │ │ -slots, a lower value leads to more.</p>
│ │ │ │ -<a name="upnp_lease_duration"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>alloc_recvbuf</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>an attempt to allocate a receive buffer failed</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>upnp_lease_duration</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3600</td>
│ │ │ │ +<tr><td>alloc_sndbuf</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>an attempt to allocate a send buffer failed</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>The expiration time of UPnP port-mappings, specified in seconds. 0
│ │ │ │ -means permanent lease. Some routers do not support expiration times
│ │ │ │ -on port-maps (nor correctly returning an error indicating lack of
│ │ │ │ -support). In those cases, set this to 0. Otherwise, don't set it any
│ │ │ │ -lower than 5 minutes.</p>
│ │ │ │ -<a name="max_concurrent_http_announces"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="67%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>file_write</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>writing to a file failed</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_concurrent_http_announces</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>50</td>
│ │ │ │ +<tr><td>file_read</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>reading from a file failed</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>limits the number of concurrent HTTP tracker announces. Once the
│ │ │ │ -limit is hit, tracker requests are queued and issued when an
│ │ │ │ -outstanding announce completes.</p>
│ │ │ │ -<a name="dht_max_peers_reply"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>file</td>
│ │ │ │ +<td>9</td>
│ │ │ │ +<td>a non-read and non-write file operation failed</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_max_peers_reply</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>100</td>
│ │ │ │ +<tr><td>sock_write</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +<td>a socket write operation failed</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the maximum number of peers to send in a reply to <tt class="docutils literal">get_peers</tt></p>
│ │ │ │ -<a name="dht_search_branching"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="59%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>sock_read</td>
│ │ │ │ +<td>11</td>
│ │ │ │ +<td>a socket read operation failed</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_search_branching</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>5</td>
│ │ │ │ +<tr><td>sock_open</td>
│ │ │ │ +<td>12</td>
│ │ │ │ +<td>a call to open(), to create a socket socket failed</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the number of concurrent search request the node will send when
│ │ │ │ -announcing and refreshing the routing table. This parameter is called
│ │ │ │ -alpha in the kademlia paper</p>
│ │ │ │ -<a name="dht_max_fail_count"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="57%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>sock_bind</td>
│ │ │ │ +<td>13</td>
│ │ │ │ +<td>a call to bind() on a socket failed</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_max_fail_count</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>20</td>
│ │ │ │ +<tr><td>available</td>
│ │ │ │ +<td>14</td>
│ │ │ │ +<td>an attempt to query the number of bytes available to read from a socket
│ │ │ │ +failed</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the maximum number of failed tries to contact a node before it is
│ │ │ │ -removed from the routing table. If there are known working nodes that
│ │ │ │ -are ready to replace a failing node, it will be replaced immediately,
│ │ │ │ -this limit is only used to clear out nodes that don't have any node
│ │ │ │ -that can replace them.</p>
│ │ │ │ -<a name="dht_max_torrents"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="55%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="27%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>encryption</td>
│ │ │ │ +<td>15</td>
│ │ │ │ +<td>a call related to bittorrent protocol encryption failed</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_max_torrents</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>2000</td>
│ │ │ │ +<tr><td>connect</td>
│ │ │ │ +<td>16</td>
│ │ │ │ +<td>an attempt to connect a socket failed</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the total number of torrents to track from the DHT. This is simply an
│ │ │ │ -upper limit to make sure malicious DHT nodes cannot make us allocate
│ │ │ │ -an unbounded amount of memory.</p>
│ │ │ │ -<a name="dht_max_dht_items"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="56%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>ssl_handshake</td>
│ │ │ │ +<td>17</td>
│ │ │ │ +<td>establishing an SSL connection failed</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_max_dht_items</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>700</td>
│ │ │ │ +<tr><td>get_interface</td>
│ │ │ │ +<td>18</td>
│ │ │ │ +<td>a connection failed to satisfy the bind interface setting</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>max number of items the DHT will store</p>
│ │ │ │ -<a name="dht_max_peers"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="50%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -<col width="30%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>sock_listen</td>
│ │ │ │ +<td>19</td>
│ │ │ │ +<td>a call to listen() on a socket</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_max_peers</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>500</td>
│ │ │ │ +<tr><td>sock_bind_to_device</td>
│ │ │ │ +<td>20</td>
│ │ │ │ +<td>a call to the ioctl to bind a socket to a specific network device or
│ │ │ │ +adapter</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the max number of peers to store per torrent (for the DHT)</p>
│ │ │ │ -<a name="dht_max_torrent_search_reply"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="67%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>sock_accept</td>
│ │ │ │ +<td>21</td>
│ │ │ │ +<td>a call to accept() on a socket</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_max_torrent_search_reply</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>20</td>
│ │ │ │ +<tr><td>parse_address</td>
│ │ │ │ +<td>22</td>
│ │ │ │ +<td>convert a string into a valid network address</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the max number of torrents to return in a torrent search query to the
│ │ │ │ -DHT</p>
│ │ │ │ -<a name="dht_block_timeout"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="56%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>enum_if</td>
│ │ │ │ +<td>23</td>
│ │ │ │ +<td>enumeration network devices or adapters</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_block_timeout</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>5 * 60</td>
│ │ │ │ +<tr><td>file_stat</td>
│ │ │ │ +<td>24</td>
│ │ │ │ +<td>invoking stat() on a file</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the number of seconds a DHT node is banned if it exceeds the rate
│ │ │ │ -limit. The rate limit is averaged over 10 seconds to allow for bursts
│ │ │ │ -above the limit.</p>
│ │ │ │ -<a name="dht_block_ratelimit"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="58%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="25%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>file_copy</td>
│ │ │ │ +<td>25</td>
│ │ │ │ +<td>copying a file</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_block_ratelimit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>5</td>
│ │ │ │ +<tr><td>file_fallocate</td>
│ │ │ │ +<td>26</td>
│ │ │ │ +<td>allocating storage for a file</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the max number of packets per second a DHT node is allowed to send
│ │ │ │ -without getting banned.</p>
│ │ │ │ -<a name="dht_item_lifetime"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="56%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="26%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>file_hard_link</td>
│ │ │ │ +<td>27</td>
│ │ │ │ +<td>creating a hard link</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_item_lifetime</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0</td>
│ │ │ │ +<tr><td>file_remove</td>
│ │ │ │ +<td>28</td>
│ │ │ │ +<td>removing a file</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the number of seconds a immutable/mutable item will be expired.
│ │ │ │ -default is 0, means never expires.</p>
│ │ │ │ -<a name="dht_sample_infohashes_interval"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="68%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>file_rename</td>
│ │ │ │ +<td>29</td>
│ │ │ │ +<td>renaming a file</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_sample_infohashes_interval</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>21600</td>
│ │ │ │ +<tr><td>file_open</td>
│ │ │ │ +<td>30</td>
│ │ │ │ +<td>opening a file</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the info-hashes sample recomputation interval (in seconds).
│ │ │ │ -The node will precompute a subset of the tracked info-hashes and return
│ │ │ │ -that instead of calculating it upon each request. The permissible range
│ │ │ │ -is between 0 and 21600 seconds (inclusive).</p>
│ │ │ │ -<a name="dht_max_infohashes_sample_count"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="69%" />
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>mkdir</td>
│ │ │ │ +<td>31</td>
│ │ │ │ +<td>creating a directory</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>dht_max_infohashes_sample_count</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>20</td>
│ │ │ │ +<tr><td>check_resume</td>
│ │ │ │ +<td>32</td>
│ │ │ │ +<td>check fast resume data against files on disk</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>the maximum number of elements in the sampled subset of info-hashes.
│ │ │ │ -If this number is too big, expect the DHT storage implementations
│ │ │ │ -to clamp it in order to allow UDP packets go through</p>
│ │ │ │ -<a name="max_piece_count"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="52%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="30%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>exception</td>
│ │ │ │ +<td>33</td>
│ │ │ │ +<td>an unknown exception</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>max_piece_count</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0x200000</td>
│ │ │ │ +<tr><td>alloc_cache_piece</td>
│ │ │ │ +<td>34</td>
│ │ │ │ +<td>allocate space for a piece in the cache</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p><tt class="docutils literal">max_piece_count</tt> is the maximum allowed number of pieces in
│ │ │ │ -metadata received via magnet links. Loading large torrents (with
│ │ │ │ -more pieces than the default limit) may also require passing in
│ │ │ │ -a higher limit to <a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a> and
│ │ │ │ -<a class="reference external" href="reference-Torrent_Info.html#parse_info_section()">torrent_info::parse_info_section()</a>, if those are used.</p>
│ │ │ │ -<a name="metadata_token_limit"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="59%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>partfile_move</td>
│ │ │ │ +<td>35</td>
│ │ │ │ +<td>move a part-file</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>metadata_token_limit</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>2500000</td>
│ │ │ │ +<tr><td>partfile_read</td>
│ │ │ │ +<td>36</td>
│ │ │ │ +<td>read from a part file</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>when receiving metadata (torrent file) from peers, this is the
│ │ │ │ -max number of bencoded tokens we're willing to parse. This limit
│ │ │ │ -is meant to prevent DoS attacks on peers. For very large
│ │ │ │ -torrents, this limit may have to be raised.</p>
│ │ │ │ -<a name="disk_write_mode"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="23%" />
│ │ │ │ -<col width="8%" />
│ │ │ │ -<col width="69%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>partfile_write</td>
│ │ │ │ +<td>37</td>
│ │ │ │ +<td>write to a part-file</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>disk_write_mode</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>settings_pack::mmap_write_mode_t::auto_mmap_write</td>
│ │ │ │ +<tr><td>hostname_lookup</td>
│ │ │ │ +<td>38</td>
│ │ │ │ +<td>a hostname lookup</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>controls whether disk writes will be made through a memory mapped
│ │ │ │ -file or via normal write calls. This only affects the
│ │ │ │ -mmap_disk_io. When saving to a non-local drive (network share,
│ │ │ │ -NFS or NAS) using memory mapped files is most likely inferior.
│ │ │ │ -When writing to a local SSD (especially in DAX mode) using memory
│ │ │ │ -mapped files likely gives the best performance.
│ │ │ │ -The values for this setting are specified as <a class="reference external" href="reference-Settings.html#mmap_write_mode_t">mmap_write_mode_t</a>.</p>
│ │ │ │ -<a name="mmap_file_size_cutoff"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>symlink</td>
│ │ │ │ +<td>39</td>
│ │ │ │ +<td>create or read a symlink</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>mmap_file_size_cutoff</td>
│ │ │ │ -<td>int</td>
│ │ │ │ +<tr><td>handshake</td>
│ │ │ │  <td>40</td>
│ │ │ │ +<td>handshake with a peer or server</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>when using mmap_disk_io, files smaller than this number of blocks
│ │ │ │ -will not be memory mapped, but will use normal pread/pwrite
│ │ │ │ -operations. This file size limit is specified in 16 kiB blocks.</p>
│ │ │ │ -<a name="i2p_inbound_quantity"></a>
│ │ │ │ -<a name="i2p_outbound_quantity"></a>
│ │ │ │ -<a name="i2p_inbound_length"></a>
│ │ │ │ -<a name="i2p_outbound_length"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="61%" />
│ │ │ │ -<col width="16%" />
│ │ │ │ -<col width="24%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ -</tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>i2p_inbound_quantity</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3</td>
│ │ │ │ +<tr><td>sock_option</td>
│ │ │ │ +<td>41</td>
│ │ │ │ +<td>set socket option</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>i2p_outbound_quantity</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3</td>
│ │ │ │ +<tr><td>enum_route</td>
│ │ │ │ +<td>42</td>
│ │ │ │ +<td>enumeration of network routes</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>i2p_inbound_length</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3</td>
│ │ │ │ +<tr><td>file_seek</td>
│ │ │ │ +<td>43</td>
│ │ │ │ +<td>moving read/write position in a file, <a class="reference external" href="reference-Alerts.html#hostname_lookup">operation_t::hostname_lookup</a></td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>i2p_outbound_length</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>3</td>
│ │ │ │ +<tr><td>timer</td>
│ │ │ │ +<td>44</td>
│ │ │ │ +<td>an async wait operation on a timer</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<p>Configures the SAM <a class="reference external" href="reference-Session.html#session">session</a>
│ │ │ │ -quantity of I2P inbound and outbound tunnels [1..16].
│ │ │ │ -number of hops for I2P inbound and outbound tunnels [0..7]
│ │ │ │ -Changing these will not trigger a reconnect to the SAM bridge,
│ │ │ │ -they will take effect the next time the SAM connection is
│ │ │ │ -re-established (by restarting or changing i2p_hostname or
│ │ │ │ -i2p_port).</p>
│ │ │ │ -<a name="announce_port"></a><table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="50%" />
│ │ │ │ -<col width="20%" />
│ │ │ │ -<col width="30%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">type</th>
│ │ │ │ -<th class="head">default</th>
│ │ │ │ +<tr><td>file_mmap</td>
│ │ │ │ +<td>45</td>
│ │ │ │ +<td>call to mmap() (or windows counterpart)</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>announce_port</td>
│ │ │ │ -<td>int</td>
│ │ │ │ -<td>0</td>
│ │ │ │ +<tr><td>file_truncate</td>
│ │ │ │ +<td>46</td>
│ │ │ │ +<td>call to ftruncate() (or SetEndOfFile() on windows)</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p><tt class="docutils literal">announce_port</tt> is the port passed along as the <tt class="docutils literal">port</tt> parameter
│ │ │ │ -to remote trackers such as HTTP or DHT. This setting does not affect
│ │ │ │ -the effective listening port nor local service discovery announcements.
│ │ │ │ -If left as zero (default), the listening port value is used.</p>
│ │ │ │ +<a name="int"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:int&labels=documentation&body=Documentation+under+heading+%22int%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="int">
│ │ │ │ +<h1>int</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
│ │ │ │ +<a name="int::user_alert_id"></a><dl class="docutils">
│ │ │ │ +<dt>user_alert_id</dt>
│ │ │ │ +<dd>user defined alerts should use IDs greater than this</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="int::num_alert_types"></a><dl class="docutils">
│ │ │ │ +<dt>num_alert_types</dt>
│ │ │ │ +<dd>this constant represents &quot;max_alert_index&quot; + 1</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert_category_t&labels=documentation&body=Documentation+under+heading+%22alert_category_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="alert-category-t">
│ │ │ │ +<h1>alert_category_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
│ │ │ │ +<a name="alert_category_t::error"></a><dl class="docutils">
│ │ │ │ +<dt>error</dt>
│ │ │ │ +<dd><p class="first">Enables alerts that report an error. This includes:</p>
│ │ │ │ +<ul class="last simple">
│ │ │ │ +<li>tracker errors</li>
│ │ │ │ +<li>tracker warnings</li>
│ │ │ │ +<li>file errors</li>
│ │ │ │ +<li>resume data failures</li>
│ │ │ │ +<li>web seed errors</li>
│ │ │ │ +<li>.torrent files errors</li>
│ │ │ │ +<li>listen socket errors</li>
│ │ │ │ +<li>port mapping errors</li>
│ │ │ │ +</ul>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::peer"></a><dl class="docutils">
│ │ │ │ +<dt>peer</dt>
│ │ │ │ +<dd>Enables alerts when peers send invalid requests, get banned or
│ │ │ │ +snubbed.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::port_mapping"></a><dl class="docutils">
│ │ │ │ +<dt>port_mapping</dt>
│ │ │ │ +<dd>Enables alerts for port mapping events. For NAT-PMP and UPnP.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::storage"></a><dl class="docutils">
│ │ │ │ +<dt>storage</dt>
│ │ │ │ +<dd>Enables alerts for events related to the storage. File errors and
│ │ │ │ +synchronization events for moving the storage, renaming files etc.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::tracker"></a><dl class="docutils">
│ │ │ │ +<dt>tracker</dt>
│ │ │ │ +<dd>Enables all tracker events. Includes announcing to trackers,
│ │ │ │ +receiving responses, warnings and errors.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::connect"></a><dl class="docutils">
│ │ │ │ +<dt>connect</dt>
│ │ │ │ +<dd>Low level alerts for when peers are connected and disconnected.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::status"></a><dl class="docutils">
│ │ │ │ +<dt>status</dt>
│ │ │ │ +<dd>Enables alerts for when a torrent or the <a class="reference external" href="reference-Session.html#session">session</a> changes state.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::ip_block"></a><dl class="docutils">
│ │ │ │ +<dt>ip_block</dt>
│ │ │ │ +<dd>Alerts when a peer is blocked by the ip blocker or port blocker.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::performance_warning"></a><dl class="docutils">
│ │ │ │ +<dt>performance_warning</dt>
│ │ │ │ +<dd>Alerts when some limit is reached that might limit the download
│ │ │ │ +or upload rate.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::dht"></a><dl class="docutils">
│ │ │ │ +<dt>dht</dt>
│ │ │ │ +<dd>Alerts on events in the DHT node. For incoming searches or
│ │ │ │ +bootstrapping being done etc.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::stats"></a><dl class="docutils">
│ │ │ │ +<dt>stats</dt>
│ │ │ │ +<dd>If you enable these alerts, you will receive a stats_alert
│ │ │ │ +approximately once every second, for every active torrent.
│ │ │ │ +These alerts contain all statistics <a class="reference external" href="reference-Stats.html#counters">counters</a> for the interval since
│ │ │ │ +the lasts stats <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::session_log"></a><dl class="docutils">
│ │ │ │ +<dt>session_log</dt>
│ │ │ │ +<dd>Enables debug logging alerts. These are available unless libtorrent
│ │ │ │ +was built with logging disabled (<tt class="docutils literal">TORRENT_DISABLE_LOGGING</tt>). The
│ │ │ │ +alerts being posted are <a class="reference external" href="reference-Alerts.html#log_alert">log_alert</a> and are <a class="reference external" href="reference-Session.html#session">session</a> wide.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::torrent_log"></a><dl class="docutils">
│ │ │ │ +<dt>torrent_log</dt>
│ │ │ │ +<dd>Enables debug logging alerts for torrents. These are available
│ │ │ │ +unless libtorrent was built with logging disabled
│ │ │ │ +(<tt class="docutils literal">TORRENT_DISABLE_LOGGING</tt>). The alerts being posted are
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#torrent_log_alert">torrent_log_alert</a> and are torrent wide debug events.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::peer_log"></a><dl class="docutils">
│ │ │ │ +<dt>peer_log</dt>
│ │ │ │ +<dd>Enables debug logging alerts for peers. These are available unless
│ │ │ │ +libtorrent was built with logging disabled
│ │ │ │ +(<tt class="docutils literal">TORRENT_DISABLE_LOGGING</tt>). The alerts being posted are
│ │ │ │ +<a class="reference external" href="reference-Alerts.html#peer_log_alert">peer_log_alert</a> and low-level peer events and messages.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::incoming_request"></a><dl class="docutils">
│ │ │ │ +<dt>incoming_request</dt>
│ │ │ │ +<dd>enables the <a class="reference external" href="reference-Alerts.html#incoming_request_alert">incoming_request_alert</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::dht_log"></a><dl class="docutils">
│ │ │ │ +<dt>dht_log</dt>
│ │ │ │ +<dd>enables <a class="reference external" href="reference-Alerts.html#dht_log_alert">dht_log_alert</a>, debug logging for the DHT</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::dht_operation"></a><dl class="docutils">
│ │ │ │ +<dt>dht_operation</dt>
│ │ │ │ +<dd>enable events from pure dht operations not related to torrents</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::port_mapping_log"></a><dl class="docutils">
│ │ │ │ +<dt>port_mapping_log</dt>
│ │ │ │ +<dd>enables port mapping log events. This log is useful
│ │ │ │ +for debugging the UPnP or NAT-PMP implementation</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::picker_log"></a><dl class="docutils">
│ │ │ │ +<dt>picker_log</dt>
│ │ │ │ +<dd>enables verbose logging from the piece picker.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::file_progress"></a><dl class="docutils">
│ │ │ │ +<dt>file_progress</dt>
│ │ │ │ +<dd>alerts when files complete downloading</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::piece_progress"></a><dl class="docutils">
│ │ │ │ +<dt>piece_progress</dt>
│ │ │ │ +<dd>alerts when pieces complete downloading or fail hash check</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::upload"></a><dl class="docutils">
│ │ │ │ +<dt>upload</dt>
│ │ │ │ +<dd>alerts when we upload blocks to other peers</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::block_progress"></a><dl class="docutils">
│ │ │ │ +<dt>block_progress</dt>
│ │ │ │ +<dd>alerts on individual blocks being requested, downloading, finished,
│ │ │ │ +rejected, time-out and cancelled. This is likely to post alerts at a
│ │ │ │ +high rate.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="alert_category_t::all"></a><dl class="docutils">
│ │ │ │ +<dt>all</dt>
│ │ │ │ +<dd><p class="first">The full bitmask, representing all available categories.</p>
│ │ │ │ +<p class="last">since the enum is signed, make sure this isn't
│ │ │ │ +interpreted as -1. For instance, boost.python
│ │ │ │ +does that and fails when assigning it to an
│ │ │ │ +unsigned parameter.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="hasher"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+hasher&labels=documentation&body=Documentation+under+heading+%22class+hasher%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="hasher">
│ │ │ │ +<h1>hasher</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/hasher.hpp">libtorrent/hasher.hpp</a>&quot;</p>
│ │ │ │ +<p>this is a SHA-1 hash class.</p>
│ │ │ │ +<p>You use it by first instantiating it, then call <tt class="docutils literal">update()</tt> to feed it
│ │ │ │ +with data. i.e. you don't have to keep the entire buffer of which you want to
│ │ │ │ +create the hash in memory. You can feed the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> parts of it at a time. When
│ │ │ │ +You have fed the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> with all the data, you call <tt class="docutils literal">final()</tt> and it
│ │ │ │ +will return the sha1-hash of the data.</p>
│ │ │ │ +<p>The constructor that takes a <tt class="docutils literal">char const*</tt> and an integer will construct the
│ │ │ │ +sha1 context and feed it the data passed in.</p>
│ │ │ │ +<p>If you want to reuse the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> object once you have created a hash, you have to
│ │ │ │ +call <tt class="docutils literal">reset()</tt> to reinitialize it.</p>
│ │ │ │ +<p>The built-in software version of sha1-algorithm was implemented
│ │ │ │ +by Steve Reid and released as public domain.
│ │ │ │ +For more info, see <tt class="docutils literal">src/sha1.cpp</tt>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +class hasher
│ │ │ │ +{
│ │ │ │ +   <strong>hasher</strong> ();
│ │ │ │ +   <strong>hasher</strong> (char const* data, int len);
│ │ │ │ +   explicit <strong>hasher</strong> (span&lt;char const&gt; data);
│ │ │ │ +   <strong>hasher</strong> (hasher const&amp;);
│ │ │ │ +   hasher&amp; <strong>operator=</strong> (hasher const&amp;) &amp;;
│ │ │ │ +   hasher&amp; <strong>update</strong> (span&lt;char const&gt; data);
│ │ │ │ +   hasher&amp; <strong>update</strong> (char const* data, int len);
│ │ │ │ +   sha1_hash <strong>final</strong> ();
│ │ │ │ +   void <strong>reset</strong> ();
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="operator=()"></a>
│ │ │ │ +<a name="hasher()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Boperator%3D%28%29+hasher%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Boperator%3D%28%29+hasher%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-hasher">
│ │ │ │ +<h2>operator=() hasher()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>hasher</strong> (char const* data, int len);
│ │ │ │ +explicit <strong>hasher</strong> (span&lt;char const&gt; data);
│ │ │ │ +<strong>hasher</strong> (hasher const&amp;);
│ │ │ │ +hasher&amp; <strong>operator=</strong> (hasher const&amp;) &amp;;
│ │ │ │ +</pre>
│ │ │ │ +<p>this is the same as default constructing followed by a call to
│ │ │ │ +<tt class="docutils literal">update(data, len)</tt>.</p>
│ │ │ │ +<a name="update()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Bupdate%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Bupdate%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="update">
│ │ │ │ +<h2>update()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +hasher&amp; <strong>update</strong> (span&lt;char const&gt; data);
│ │ │ │ +hasher&amp; <strong>update</strong> (char const* data, int len);
│ │ │ │ +</pre>
│ │ │ │ +<p>append the following bytes to what is being hashed</p>
│ │ │ │ +<a name="final()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Bfinal%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Bfinal%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="final">
│ │ │ │ +<h2>final()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +sha1_hash <strong>final</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the SHA-1 digest of the buffers previously passed to
│ │ │ │ +<a class="reference external" href="reference-Utility.html#update()">update()</a> and the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> constructor.</p>
│ │ │ │ +<a name="reset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher%3A%3A%5Breset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher%3A%3A%5Breset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="reset-1">
│ │ │ │ +<h2>reset()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>reset</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>restore the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> state to be as if the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> has just been
│ │ │ │ +default constructed.</p>
│ │ │ │ +<a name="hasher256"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+hasher256&labels=documentation&body=Documentation+under+heading+%22class+hasher256%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="hasher256">
│ │ │ │ +<h1>hasher256</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/hasher.hpp">libtorrent/hasher.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +class hasher256
│ │ │ │ +{
│ │ │ │ +   <strong>hasher256</strong> ();
│ │ │ │ +   hasher256&amp; <strong>operator=</strong> (hasher256 const&amp;) &amp;;
│ │ │ │ +   <strong>hasher256</strong> (char const* data, int len);
│ │ │ │ +   explicit <strong>hasher256</strong> (span&lt;char const&gt; data);
│ │ │ │ +   <strong>hasher256</strong> (hasher256 const&amp;);
│ │ │ │ +   hasher256&amp; <strong>update</strong> (span&lt;char const&gt; data);
│ │ │ │ +   hasher256&amp; <strong>update</strong> (char const* data, int len);
│ │ │ │ +   sha256_hash <strong>final</strong> ();
│ │ │ │ +   void <strong>reset</strong> ();
│ │ │ │ +   <strong>~hasher256</strong> ();
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="operator=()"></a>
│ │ │ │ +<a name="hasher256()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Boperator%3D%28%29+hasher256%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Boperator%3D%28%29+hasher256%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-hasher256">
│ │ │ │ +<h2>operator=() hasher256()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +hasher256&amp; <strong>operator=</strong> (hasher256 const&amp;) &amp;;
│ │ │ │ +<strong>hasher256</strong> (char const* data, int len);
│ │ │ │ +explicit <strong>hasher256</strong> (span&lt;char const&gt; data);
│ │ │ │ +<strong>hasher256</strong> (hasher256 const&amp;);
│ │ │ │ +</pre>
│ │ │ │ +<p>this is the same as default constructing followed by a call to
│ │ │ │ +<tt class="docutils literal">update(data, len)</tt>.</p>
│ │ │ │ +<a name="update()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Bupdate%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Bupdate%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="update-1">
│ │ │ │ +<h2>update()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +hasher256&amp; <strong>update</strong> (span&lt;char const&gt; data);
│ │ │ │ +hasher256&amp; <strong>update</strong> (char const* data, int len);
│ │ │ │ +</pre>
│ │ │ │ +<p>append the following bytes to what is being hashed</p>
│ │ │ │ +<a name="final()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Bfinal%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Bfinal%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="final-1">
│ │ │ │ +<h2>final()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +sha256_hash <strong>final</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the SHA-1 digest of the buffers previously passed to
│ │ │ │ +<a class="reference external" href="reference-Utility.html#update()">update()</a> and the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> constructor.</p>
│ │ │ │ +<a name="reset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:hasher256%3A%3A%5Breset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22hasher256%3A%3A%5Breset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="reset-2">
│ │ │ │ +<h2>reset()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>reset</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>restore the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> state to be as if the <a class="reference external" href="reference-Utility.html#hasher">hasher</a> has just been
│ │ │ │ +default constructed.</p>
│ │ │ │ +<a name="bitfield"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+bitfield&labels=documentation&body=Documentation+under+heading+%22class+bitfield%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="bitfield">
│ │ │ │ +<h1>bitfield</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bitfield.hpp">libtorrent/bitfield.hpp</a>&quot;</p>
│ │ │ │ +<p>The <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> type stores any number of bits as a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>
│ │ │ │ +in a heap allocated array.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct bitfield
│ │ │ │ +{
│ │ │ │ +   explicit <strong>bitfield</strong> (int bits);
│ │ │ │ +   <strong>bitfield</strong> (char const* b, int bits);
│ │ │ │ +   <strong>bitfield</strong> () noexcept = default;
│ │ │ │ +   <strong>bitfield</strong> (int bits, bool val);
│ │ │ │ +   <strong>bitfield</strong> (bitfield&amp;&amp; rhs) noexcept = default;
│ │ │ │ +   <strong>bitfield</strong> (bitfield const&amp; rhs);
│ │ │ │ +   void <strong>assign</strong> (char const* b, int const bits);
│ │ │ │ +   bool <strong>operator[]</strong> (int index) const noexcept;
│ │ │ │ +   bool <strong>get_bit</strong> (int index) const noexcept;
│ │ │ │ +   void <strong>set_bit</strong> (int index) noexcept;
│ │ │ │ +   void <strong>clear_bit</strong> (int index) noexcept;
│ │ │ │ +   bool <strong>all_set</strong> () const noexcept;
│ │ │ │ +   bool <strong>none_set</strong> () const noexcept;
│ │ │ │ +   int <strong>size</strong> () const noexcept;
│ │ │ │ +   int <strong>num_words</strong> () const noexcept;
│ │ │ │ +   int <strong>num_bytes</strong> () const noexcept;
│ │ │ │ +   bool <strong>empty</strong> () const noexcept;
│ │ │ │ +   char* <strong>data</strong> () noexcept;
│ │ │ │ +   char const* <strong>data</strong> () const noexcept;
│ │ │ │ +   void <strong>swap</strong> (bitfield&amp; rhs) noexcept;
│ │ │ │ +   int <strong>count</strong> () const noexcept;
│ │ │ │ +   int <strong>find_first_set</strong> () const noexcept;
│ │ │ │ +   int <strong>find_last_clear</strong> () const noexcept;
│ │ │ │ +   bool <strong>operator==</strong> (lt::bitfield const&amp; rhs) const;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="bitfield()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bbitfield%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bbitfield%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="bitfield-1">
│ │ │ │ +<h2>bitfield()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +explicit <strong>bitfield</strong> (int bits);
│ │ │ │ +<strong>bitfield</strong> (char const* b, int bits);
│ │ │ │ +<strong>bitfield</strong> () noexcept = default;
│ │ │ │ +<strong>bitfield</strong> (int bits, bool val);
│ │ │ │ +<strong>bitfield</strong> (bitfield&amp;&amp; rhs) noexcept = default;
│ │ │ │ +<strong>bitfield</strong> (bitfield const&amp; rhs);
│ │ │ │ +</pre>
│ │ │ │ +<p>constructs a new <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>. The default constructor creates an empty
│ │ │ │ +<a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>. <tt class="docutils literal">bits</tt> is the size of the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> (specified in bits).
│ │ │ │ +<tt class="docutils literal">val</tt> is the value to initialize the bits to. If not specified
│ │ │ │ +all bits are initialized to 0.</p>
│ │ │ │ +<p>The constructor taking a pointer <tt class="docutils literal">b</tt> and <tt class="docutils literal">bits</tt> copies a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>
│ │ │ │ +from the specified buffer, and <tt class="docutils literal">bits</tt> number of bits (rounded up to
│ │ │ │ +the nearest byte boundary).</p>
│ │ │ │ +<a name="assign()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bassign%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bassign%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="assign">
│ │ │ │ +<h2>assign()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>assign</strong> (char const* b, int const bits);
│ │ │ │ +</pre>
│ │ │ │ +<p>copy <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> from buffer <tt class="docutils literal">b</tt> of <tt class="docutils literal">bits</tt> number of bits, rounded up to
│ │ │ │ +the nearest byte boundary.</p>
│ │ │ │ +<a name="operator[]()"></a>
│ │ │ │ +<a name="get_bit()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Boperator%5B%5D%28%29+get_bit%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Boperator%5B%5D%28%29+get_bit%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="operator-get-bit">
│ │ │ │ +<h2>operator[]() get_bit()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>operator[]</strong> (int index) const noexcept;
│ │ │ │ +bool <strong>get_bit</strong> (int index) const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>query bit at <tt class="docutils literal">index</tt>. Returns true if bit is 1, otherwise false.</p>
│ │ │ │ +<a name="set_bit()"></a>
│ │ │ │ +<a name="clear_bit()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bset_bit%28%29+clear_bit%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bset_bit%28%29+clear_bit%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="set-bit-clear-bit">
│ │ │ │ +<h2>set_bit() clear_bit()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>set_bit</strong> (int index) noexcept;
│ │ │ │ +void <strong>clear_bit</strong> (int index) noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>set bit at <tt class="docutils literal">index</tt> to 0 (clear_bit) or 1 (set_bit).</p>
│ │ │ │ +<a name="all_set()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Ball_set%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Ball_set%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="all-set">
│ │ │ │ +<h2>all_set()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>all_set</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if all bits in the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> are set</p>
│ │ │ │ +<a name="none_set()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bnone_set%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bnone_set%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="none-set">
│ │ │ │ +<h2>none_set()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>none_set</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if no bit in the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> is set</p>
│ │ │ │ +<a name="size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bsize%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bsize%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="size">
│ │ │ │ +<h2>size()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>size</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the size of the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> in bits.</p>
│ │ │ │ +<a name="num_words()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bnum_words%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bnum_words%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="num-words">
│ │ │ │ +<h2>num_words()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>num_words</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the number of 32 bit words are needed to represent all bits in
│ │ │ │ +this <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>.</p>
│ │ │ │ +<a name="num_bytes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bnum_bytes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bnum_bytes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="num-bytes">
│ │ │ │ +<h2>num_bytes()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>num_bytes</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the number of bytes needed to represent all bits in this
│ │ │ │ +<a class="reference external" href="reference-Utility.html#bitfield">bitfield</a></p>
│ │ │ │ +<a name="empty()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bempty%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bempty%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="empty-1">
│ │ │ │ +<h2>empty()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>empty</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> has zero size.</p>
│ │ │ │ +<a name="data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bdata%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bdata%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="data-1">
│ │ │ │ +<h2>data()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char* <strong>data</strong> () noexcept;
│ │ │ │ +char const* <strong>data</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a pointer to the internal buffer of the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>, or
│ │ │ │ +<tt class="docutils literal">nullptr</tt> if it's empty.</p>
│ │ │ │ +<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="swap-2">
│ │ │ │ +<h2>swap()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>swap</strong> (bitfield&amp; rhs) noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>swaps the bit-fields two variables refer to</p>
│ │ │ │ +<a name="count()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bcount%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bcount%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="count">
│ │ │ │ +<h2>count()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>count</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>count the number of bits in the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a> that are set to 1.</p>
│ │ │ │ +<a name="find_first_set()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bfind_first_set%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bfind_first_set%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="find-first-set">
│ │ │ │ +<h2>find_first_set()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>find_first_set</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the index of the first set bit in the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>, i.e. 1 bit.</p>
│ │ │ │ +<a name="find_last_clear()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bitfield%3A%3A%5Bfind_last_clear%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bitfield%3A%3A%5Bfind_last_clear%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="find-last-clear">
│ │ │ │ +<h2>find_last_clear()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>find_last_clear</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the index to the last cleared bit in the <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>, i.e. 0 bit.</p>
│ │ │ │ +<a name="peer_request"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_request&labels=documentation&body=Documentation+under+heading+%22class+peer_request%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="peer-request">
│ │ │ │ +<h1>peer_request</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_request.hpp">libtorrent/peer_request.hpp</a>&quot;</p>
│ │ │ │ +<p>represents a byte range within a piece. Internally this is is used for
│ │ │ │ +incoming piece requests.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_request
│ │ │ │ +{
│ │ │ │ +   bool <strong>operator==</strong> (peer_request const&amp; r) const;
│ │ │ │ +
│ │ │ │ +   piece_index_t piece;
│ │ │ │ +   int start;
│ │ │ │ +   int length;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="operator==()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Boperator%3D%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Boperator%3D%3D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-2">
│ │ │ │ +<h2>operator==()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>operator==</strong> (peer_request const&amp; r) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if the right hand side <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> refers to the same
│ │ │ │ +range as this does.</p>
│ │ │ │ +<a name="piece"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Bpiece%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Bpiece%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>piece</dt>
│ │ │ │ +<dd>The index of the piece in which the range starts.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="start"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Bstart%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Bstart%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>start</dt>
│ │ │ │ +<dd>The byte offset within that piece where the range starts.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="length"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_request%3A%3A%5Blength%5D&labels=documentation&body=Documentation+under+heading+%22peer_request%3A%3A%5Blength%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>length</dt>
│ │ │ │ +<dd>The size of the range, in bytes.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="piece_block"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_block&labels=documentation&body=Documentation+under+heading+%22class+piece_block%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="piece-block">
│ │ │ │ +<h1>piece_block</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/piece_block.hpp">libtorrent/piece_block.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct piece_block
│ │ │ │ +{
│ │ │ │ +   <strong>piece_block</strong> (piece_index_t p_index, int b_index);
│ │ │ │ +   <strong>piece_block</strong> () = default;
│ │ │ │ +   bool <strong>operator&lt;</strong> (piece_block const&amp; b) const;
│ │ │ │ +   bool <strong>operator==</strong> (piece_block const&amp; b) const;
│ │ │ │ +   bool <strong>operator!=</strong> (piece_block const&amp; b) const;
│ │ │ │ +
│ │ │ │ +   static const piece_block invalid;
│ │ │ │ +   piece_index_t piece_index {0};
│ │ │ │ +   int <strong>block_index</strong>  = 0;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="peer_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_info&labels=documentation&body=Documentation+under+heading+%22class+peer_info%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="peer-info">
│ │ │ │ +<h1>peer_info</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_info.hpp">libtorrent/peer_info.hpp</a>&quot;</p>
│ │ │ │ +<p>holds information and statistics about one peer
│ │ │ │ +that libtorrent is connected to</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct peer_info
│ │ │ │ +{
│ │ │ │ +   sha256_hash <strong>i2p_destination</strong> () const;
│ │ │ │ +
│ │ │ │ +   std::string client;
│ │ │ │ +   typed_bitfield&lt;piece_index_t&gt; pieces;
│ │ │ │ +   std::int64_t total_download;
│ │ │ │ +   std::int64_t total_upload;
│ │ │ │ +   time_duration last_request;
│ │ │ │ +   time_duration last_active;
│ │ │ │ +   time_duration download_queue_time;
│ │ │ │ +   static constexpr peer_flags_t <strong>interesting</strong>  = 0_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>choked</strong>  = 1_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>remote_interested</strong>  = 2_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>remote_choked</strong>  = 3_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>supports_extensions</strong>  = 4_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>outgoing_connection</strong>  = 5_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>local_connection</strong>  = 5_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>handshake</strong>  = 6_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>connecting</strong>  = 7_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>on_parole</strong>  = 9_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>seed</strong>  = 10_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>optimistic_unchoke</strong>  = 11_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>snubbed</strong>  = 12_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>upload_only</strong>  = 13_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>endgame_mode</strong>  = 14_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>holepunched</strong>  = 15_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>i2p_socket</strong>  = 16_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>utp_socket</strong>  = 17_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>ssl_socket</strong>  = 18_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>rc4_encrypted</strong>  = 19_bit;
│ │ │ │ +   static constexpr peer_flags_t <strong>plaintext_encrypted</strong>  = 20_bit;
│ │ │ │ +   peer_flags_t flags;
│ │ │ │ +   static constexpr peer_source_flags_t <strong>tracker</strong>  = 0_bit;
│ │ │ │ +   static constexpr peer_source_flags_t <strong>dht</strong>  = 1_bit;
│ │ │ │ +   static constexpr peer_source_flags_t <strong>pex</strong>  = 2_bit;
│ │ │ │ +   static constexpr peer_source_flags_t <strong>lsd</strong>  = 3_bit;
│ │ │ │ +   static constexpr peer_source_flags_t <strong>resume_data</strong>  = 4_bit;
│ │ │ │ +   static constexpr peer_source_flags_t <strong>incoming</strong>  = 5_bit;
│ │ │ │ +   peer_source_flags_t source;
│ │ │ │ +   int up_speed;
│ │ │ │ +   int down_speed;
│ │ │ │ +   int payload_up_speed;
│ │ │ │ +   int payload_down_speed;
│ │ │ │ +   peer_id pid;
│ │ │ │ +   int queue_bytes;
│ │ │ │ +   int request_timeout;
│ │ │ │ +   int send_buffer_size;
│ │ │ │ +   int used_send_buffer;
│ │ │ │ +   int receive_buffer_size;
│ │ │ │ +   int used_receive_buffer;
│ │ │ │ +   int receive_buffer_watermark;
│ │ │ │ +   int num_hashfails;
│ │ │ │ +   int download_queue_length;
│ │ │ │ +   int timed_out_requests;
│ │ │ │ +   int busy_requests;
│ │ │ │ +   int requests_in_buffer;
│ │ │ │ +   int target_dl_queue_length;
│ │ │ │ +   int upload_queue_length;
│ │ │ │ +   int failcount;
│ │ │ │ +   piece_index_t downloading_piece_index;
│ │ │ │ +   int downloading_block_index;
│ │ │ │ +   int downloading_progress;
│ │ │ │ +   int downloading_total;
│ │ │ │ +   static constexpr connection_type_t <strong>standard_bittorrent</strong>  = 0_bit;
│ │ │ │ +   static constexpr connection_type_t <strong>web_seed</strong>  = 1_bit;
│ │ │ │ +   static constexpr connection_type_t <strong>http_seed</strong>  = 2_bit;
│ │ │ │ +   connection_type_t connection_type;
│ │ │ │ +   int pending_disk_bytes;
│ │ │ │ +   int pending_disk_read_bytes;
│ │ │ │ +   int send_quota;
│ │ │ │ +   int receive_quota;
│ │ │ │ +   int rtt;
│ │ │ │ +   int num_pieces;
│ │ │ │ +   int download_rate_peak;
│ │ │ │ +   int upload_rate_peak;
│ │ │ │ +   float progress;
│ │ │ │ +   int progress_ppm;
│ │ │ │ +   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> ip;
│ │ │ │ +   <a class="reference external" href="tcp::endpoint">tcp::endpoint</a> local_endpoint;
│ │ │ │ +   static constexpr bandwidth_state_flags_t <strong>bw_idle</strong>  = 0_bit;
│ │ │ │ +   static constexpr bandwidth_state_flags_t <strong>bw_limit</strong>  = 1_bit;
│ │ │ │ +   static constexpr bandwidth_state_flags_t <strong>bw_network</strong>  = 2_bit;
│ │ │ │ +   static constexpr bandwidth_state_flags_t <strong>bw_disk</strong>  = 4_bit;
│ │ │ │ +   bandwidth_state_flags_t read_state;
│ │ │ │ +   bandwidth_state_flags_t write_state;
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="i2p_destination()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bi2p_destination%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bi2p_destination%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="i2p-destination">
│ │ │ │ +<h2>i2p_destination()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +sha256_hash <strong>i2p_destination</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>If this peer is an i2p peer, this function returns the destination
│ │ │ │ +address of the peer</p>
│ │ │ │ +<a name="client"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bclient%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bclient%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>client</dt>
│ │ │ │ +<dd>A human readable string describing the software at the other end of
│ │ │ │ +the connection. In some cases this information is not available, then
│ │ │ │ +it will contain a string that may give away something about which
│ │ │ │ +software is running in the other end. In the case of a web seed, the
│ │ │ │ +server type and version will be a part of this string. This is UTF-8
│ │ │ │ +encoded.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpieces%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>pieces</dt>
│ │ │ │ +<dd>a <a class="reference external" href="reference-Utility.html#bitfield">bitfield</a>, with one bit per piece in the torrent. Each bit tells you
│ │ │ │ +if the peer has that piece (if it's set to 1) or if the peer miss that
│ │ │ │ +piece (set to 0).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="total_download"></a>
│ │ │ │ +<a name="total_upload"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Btotal_download+total_upload%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Btotal_download+total_upload%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>total_download total_upload</dt>
│ │ │ │ +<dd>the total number of bytes downloaded from and uploaded to this peer.
│ │ │ │ +These numbers do not include the protocol chatter, but only the
│ │ │ │ +payload data.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="last_request"></a>
│ │ │ │ +<a name="last_active"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Blast_request+last_active%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Blast_request+last_active%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>last_request last_active</dt>
│ │ │ │ +<dd>the time since we last sent a request to this peer and since any
│ │ │ │ +transfer occurred with this peer</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="download_queue_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bdownload_queue_time%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bdownload_queue_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>download_queue_time</dt>
│ │ │ │ +<dd>the time until all blocks in the request queue will be downloaded</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="interesting"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Binteresting%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Binteresting%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>interesting</dt>
│ │ │ │ +<dd><strong>we</strong> are interested in pieces from this peer.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="choked"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bchoked%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bchoked%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>choked</dt>
│ │ │ │ +<dd><strong>we</strong> have choked this peer.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="remote_interested"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bremote_interested%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bremote_interested%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>remote_interested</dt>
│ │ │ │ +<dd>the peer is interested in <strong>us</strong></dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="remote_choked"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bremote_choked%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bremote_choked%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>remote_choked</dt>
│ │ │ │ +<dd>the peer has choked <strong>us</strong>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="supports_extensions"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bsupports_extensions%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bsupports_extensions%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>supports_extensions</dt>
│ │ │ │ +<dd>means that this peer supports the
│ │ │ │ +<a class="reference external" href="extension_protocol.html">extension protocol</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="outgoing_connection"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Boutgoing_connection%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Boutgoing_connection%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>outgoing_connection</dt>
│ │ │ │ +<dd>The connection was initiated by us, the peer has a
│ │ │ │ +listen port open, and that port is the same as in the
│ │ │ │ +address of this peer. If this flag is not set, this
│ │ │ │ +peer connection was opened by this peer connecting to
│ │ │ │ +us.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="local_connection"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Blocal_connection%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Blocal_connection%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>local_connection</dt>
│ │ │ │ +<dd>deprecated synonym for outgoing_connection</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="handshake"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bhandshake%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bhandshake%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>handshake</dt>
│ │ │ │ +<dd>The connection is opened, and waiting for the
│ │ │ │ +handshake. Until the handshake is done, the peer
│ │ │ │ +cannot be identified.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="connecting"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bconnecting%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bconnecting%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>connecting</dt>
│ │ │ │ +<dd>The connection is in a half-open state (i.e. it is
│ │ │ │ +being connected).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="on_parole"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bon_parole%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bon_parole%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>on_parole</dt>
│ │ │ │ +<dd>The peer has participated in a piece that failed the
│ │ │ │ +hash check, and is now &quot;on parole&quot;, 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.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="seed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bseed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bseed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>seed</dt>
│ │ │ │ +<dd>This peer is a seed (it has all the pieces).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="optimistic_unchoke"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Boptimistic_unchoke%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Boptimistic_unchoke%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>optimistic_unchoke</dt>
│ │ │ │ +<dd>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.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="snubbed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bsnubbed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bsnubbed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>snubbed</dt>
│ │ │ │ +<dd>This peer has recently failed to send a block within
│ │ │ │ +the request timeout from when the request was sent.
│ │ │ │ +We're currently picking one block at a time from this
│ │ │ │ +peer.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="upload_only"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bupload_only%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bupload_only%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>upload_only</dt>
│ │ │ │ +<dd>This peer has either explicitly (with an extension)
│ │ │ │ +or implicitly (by becoming a seed) told us that it
│ │ │ │ +will not downloading anything more, regardless of
│ │ │ │ +which pieces we have.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="endgame_mode"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bendgame_mode%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bendgame_mode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>endgame_mode</dt>
│ │ │ │ +<dd>This means the last time this peer picket a piece,
│ │ │ │ +it could not pick as many as it wanted because there
│ │ │ │ +were not enough free ones. i.e. all pieces this peer
│ │ │ │ +has were already requested from other peers.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="holepunched"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bholepunched%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bholepunched%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>holepunched</dt>
│ │ │ │ +<dd>This flag is set if the peer was in holepunch mode
│ │ │ │ +when the connection succeeded. This typically only
│ │ │ │ +happens if both peers are behind a NAT and the peers
│ │ │ │ +connect via the NAT holepunch mechanism.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="i2p_socket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bi2p_socket%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bi2p_socket%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>i2p_socket</dt>
│ │ │ │ +<dd>indicates that this socket is running on top of the
│ │ │ │ +I2P transport.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="utp_socket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Butp_socket%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Butp_socket%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>utp_socket</dt>
│ │ │ │ +<dd>indicates that this socket is a uTP socket</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="ssl_socket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bssl_socket%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bssl_socket%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>ssl_socket</dt>
│ │ │ │ +<dd>indicates that this socket is running on top of an SSL
│ │ │ │ +(TLS) channel</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="rc4_encrypted"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Brc4_encrypted%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Brc4_encrypted%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>rc4_encrypted</dt>
│ │ │ │ +<dd>this connection is obfuscated with RC4</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="plaintext_encrypted"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bplaintext_encrypted%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bplaintext_encrypted%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>plaintext_encrypted</dt>
│ │ │ │ +<dd>the handshake of this connection was obfuscated
│ │ │ │ +with a Diffie-Hellman exchange</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bflags%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bflags%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>flags</dt>
│ │ │ │ +<dd>tells you in which state the peer is in. It is set to
│ │ │ │ +any combination of the peer_flags_t flags above.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="tracker"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Btracker%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Btracker%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>tracker</dt>
│ │ │ │ +<dd>The peer was received from the tracker.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="dht"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bdht%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bdht%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>dht</dt>
│ │ │ │ +<dd>The peer was received from the kademlia DHT.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pex"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpex%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpex%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>pex</dt>
│ │ │ │ +<dd>The peer was received from the peer exchange
│ │ │ │ +extension.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="lsd"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Blsd%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Blsd%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>lsd</dt>
│ │ │ │ +<dd>The peer was received from the local service
│ │ │ │ +discovery (The peer is on the local network).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="resume_data"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bresume_data%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bresume_data%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>resume_data</dt>
│ │ │ │ +<dd>The peer was added from the fast resume data.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="incoming"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bincoming%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bincoming%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>incoming</dt>
│ │ │ │ +<dd>we received an incoming connection from this peer</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="source"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bsource%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bsource%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>source</dt>
│ │ │ │ +<dd>a combination of flags describing from which sources this peer
│ │ │ │ +was received. A combination of the peer_source_flags_t above.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="up_speed"></a>
│ │ │ │ +<a name="down_speed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bup_speed+down_speed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bup_speed+down_speed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>up_speed down_speed</dt>
│ │ │ │ +<dd>the current upload and download speed we have to and from this peer
│ │ │ │ +(including any protocol messages). updated about once per second</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="payload_up_speed"></a>
│ │ │ │ +<a name="payload_down_speed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpayload_up_speed+payload_down_speed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpayload_up_speed+payload_down_speed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>payload_up_speed payload_down_speed</dt>
│ │ │ │ +<dd>The transfer rates of payload data only updated about once per second</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpid%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>pid</dt>
│ │ │ │ +<dd>the peer's id as used in the bittorrent protocol. This id can be used
│ │ │ │ +to extract 'fingerprints' from the peer. Sometimes it can tell you
│ │ │ │ +which client the peer is using. See identify_client()_</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="queue_bytes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bqueue_bytes%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bqueue_bytes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>queue_bytes</dt>
│ │ │ │ +<dd>the number of bytes we have requested from this peer, but not yet
│ │ │ │ +received.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="request_timeout"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Brequest_timeout%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Brequest_timeout%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>request_timeout</dt>
│ │ │ │ +<dd>the number of seconds until the current front piece request will time
│ │ │ │ +out. This timeout can be adjusted through
│ │ │ │ +<tt class="docutils literal"><span class="pre">settings_pack::request_timeout</span></tt>.
│ │ │ │ +-1 means that there is not outstanding request.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="send_buffer_size"></a>
│ │ │ │ +<a name="used_send_buffer"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bsend_buffer_size+used_send_buffer%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bsend_buffer_size+used_send_buffer%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>send_buffer_size used_send_buffer</dt>
│ │ │ │ +<dd>the number of bytes allocated
│ │ │ │ +and used for the peer's send buffer, respectively.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="receive_buffer_size"></a>
│ │ │ │ +<a name="used_receive_buffer"></a>
│ │ │ │ +<a name="receive_buffer_watermark"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Breceive_buffer_size+used_receive_buffer+receive_buffer_watermark%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Breceive_buffer_size+used_receive_buffer+receive_buffer_watermark%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>receive_buffer_size used_receive_buffer receive_buffer_watermark</dt>
│ │ │ │ +<dd>the number of bytes
│ │ │ │ +allocated and used as receive buffer, respectively.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_hashfails"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bnum_hashfails%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bnum_hashfails%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_hashfails</dt>
│ │ │ │ +<dd>the number of pieces this peer has participated in sending us that
│ │ │ │ +turned out to fail the hash check.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="download_queue_length"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bdownload_queue_length%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bdownload_queue_length%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>download_queue_length</dt>
│ │ │ │ +<dd>this is the number of requests we have sent to this peer that we
│ │ │ │ +haven't got a response for yet</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="timed_out_requests"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Btimed_out_requests%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Btimed_out_requests%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>timed_out_requests</dt>
│ │ │ │ +<dd>the number of block requests that have timed out, and are still in the
│ │ │ │ +download queue</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="busy_requests"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bbusy_requests%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bbusy_requests%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>busy_requests</dt>
│ │ │ │ +<dd>the number of busy requests in the download queue. A busy request is a
│ │ │ │ +request for a block we've also requested from a different peer</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="requests_in_buffer"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Brequests_in_buffer%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Brequests_in_buffer%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>requests_in_buffer</dt>
│ │ │ │ +<dd>the number of requests messages that are currently in the send buffer
│ │ │ │ +waiting to be sent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="target_dl_queue_length"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Btarget_dl_queue_length%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Btarget_dl_queue_length%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>target_dl_queue_length</dt>
│ │ │ │ +<dd>the number of requests that is tried to be maintained (this is
│ │ │ │ +typically a function of download speed)</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="upload_queue_length"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bupload_queue_length%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bupload_queue_length%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>upload_queue_length</dt>
│ │ │ │ +<dd>the number of piece-requests we have received from this peer
│ │ │ │ +that we haven't answered with a piece yet.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="failcount"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bfailcount%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bfailcount%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>failcount</dt>
│ │ │ │ +<dd>the number of times this peer has &quot;failed&quot;. i.e. failed to connect or
│ │ │ │ +disconnected us. The failcount is decremented when we see this peer in
│ │ │ │ +a tracker response or peer exchange message.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="downloading_piece_index"></a>
│ │ │ │ +<a name="downloading_block_index"></a>
│ │ │ │ +<a name="downloading_progress"></a>
│ │ │ │ +<a name="downloading_total"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bdownloading_piece_index+downloading_block_index+downloading_progress+downloading_total%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bdownloading_piece_index+downloading_block_index+downloading_progress+downloading_total%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>downloading_piece_index downloading_block_index downloading_progress downloading_total</dt>
│ │ │ │ +<dd>You can know which piece, and which part of that piece, that is
│ │ │ │ +currently being downloaded from a specific peer by looking at these
│ │ │ │ +four members. <tt class="docutils literal">downloading_piece_index</tt> is the index of the piece
│ │ │ │ +that is currently being downloaded. This may be set to -1 if there's
│ │ │ │ +currently no piece downloading from this peer. If it is &gt;= 0, the
│ │ │ │ +other three members are valid. <tt class="docutils literal">downloading_block_index</tt> is the
│ │ │ │ +index of the block (or sub-piece) that is being downloaded.
│ │ │ │ +<tt class="docutils literal">downloading_progress</tt> is the number of bytes of this block we have
│ │ │ │ +received from the peer, and <tt class="docutils literal">downloading_total</tt> is the total number
│ │ │ │ +of bytes in this block.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="standard_bittorrent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bstandard_bittorrent%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bstandard_bittorrent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>standard_bittorrent</dt>
│ │ │ │ +<dd>Regular bittorrent connection</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="web_seed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bweb_seed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bweb_seed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>web_seed</dt>
│ │ │ │ +<dd>HTTP connection using the <a class="reference external" href="https://www.bittorrent.org/beps/bep_0019.html">BEP 19</a> protocol</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="http_seed"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bhttp_seed%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bhttp_seed%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>http_seed</dt>
│ │ │ │ +<dd>HTTP connection using the <a class="reference external" href="https://www.bittorrent.org/beps/bep_0017.html">BEP 17</a> protocol</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="connection_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bconnection_type%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bconnection_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>connection_type</dt>
│ │ │ │ +<dd>the kind of connection this peer uses. See connection_type_t.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pending_disk_bytes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpending_disk_bytes%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpending_disk_bytes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>pending_disk_bytes</dt>
│ │ │ │ +<dd>the number of bytes this peer has pending in the disk-io thread.
│ │ │ │ +Downloaded and waiting to be written to disk. This is what is capped
│ │ │ │ +by <tt class="docutils literal"><span class="pre">settings_pack::max_queued_disk_bytes</span></tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pending_disk_read_bytes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bpending_disk_read_bytes%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bpending_disk_read_bytes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>pending_disk_read_bytes</dt>
│ │ │ │ +<dd>number of outstanding bytes to read
│ │ │ │ +from disk</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="send_quota"></a>
│ │ │ │ +<a name="receive_quota"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bsend_quota+receive_quota%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bsend_quota+receive_quota%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>send_quota receive_quota</dt>
│ │ │ │ +<dd>the number of bytes this peer has been assigned to be allowed to send
│ │ │ │ +and receive until it has to request more quota from the bandwidth
│ │ │ │ +manager.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="rtt"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Brtt%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Brtt%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>rtt</dt>
│ │ │ │ +<dd>an estimated round trip time to this peer, in milliseconds. It is
│ │ │ │ +estimated by timing the TCP <tt class="docutils literal">connect()</tt>. It may be 0 for
│ │ │ │ +incoming connections.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bnum_pieces%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bnum_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_pieces</dt>
│ │ │ │ +<dd>the number of pieces this peer has.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="download_rate_peak"></a>
│ │ │ │ +<a name="upload_rate_peak"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bdownload_rate_peak+upload_rate_peak%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bdownload_rate_peak+upload_rate_peak%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>download_rate_peak upload_rate_peak</dt>
│ │ │ │ +<dd>the highest download and upload rates seen on this connection. They
│ │ │ │ +are given in bytes per second. This number is reset to 0 on reconnect.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="progress"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bprogress%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bprogress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>progress</dt>
│ │ │ │ +<dd>the progress of the peer in the range [0, 1]. This is always 0 when
│ │ │ │ +floating point operations are disabled, instead use <tt class="docutils literal">progress_ppm</tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="progress_ppm"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bprogress_ppm%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bprogress_ppm%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>progress_ppm</dt>
│ │ │ │ +<dd>indicates the download progress of the peer in the range [0, 1000000]
│ │ │ │ +(parts per million).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="ip"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bip%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bip%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>ip</dt>
│ │ │ │ +<dd>the IP-address to this peer. The type is an asio endpoint. For
│ │ │ │ +more info, see the <a class="reference external" href="http://asio.sourceforge.net/asio-0.3.8/doc/asio/reference.html">asio</a> documentation. This field is not valid for
│ │ │ │ +i2p peers. Instead use the <a class="reference external" href="reference-Core.html#i2p_destination()">i2p_destination()</a> function.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="local_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>local_endpoint</dt>
│ │ │ │ +<dd>the IP and port pair the socket is bound to locally. i.e. the IP
│ │ │ │ +address of the interface it's going out over. This may be useful for
│ │ │ │ +multi-homed clients with multiple interfaces to the internet.
│ │ │ │ +This field is not valid for i2p peers.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="bw_idle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bbw_idle%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bbw_idle%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>bw_idle</dt>
│ │ │ │ +<dd>The peer is not waiting for any external events to
│ │ │ │ +send or receive data.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="bw_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bbw_limit%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bbw_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>bw_limit</dt>
│ │ │ │ +<dd>The peer is waiting for the rate limiter.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="bw_network"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bbw_network%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bbw_network%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>bw_network</dt>
│ │ │ │ +<dd>The peer has quota and is currently waiting for a
│ │ │ │ +network read or write operation to complete. This is
│ │ │ │ +the state all peers are in if there are no bandwidth
│ │ │ │ +limits.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="bw_disk"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bbw_disk%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bbw_disk%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>bw_disk</dt>
│ │ │ │ +<dd>The peer is waiting for the disk I/O thread to catch
│ │ │ │ +up writing buffers to disk before downloading more.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="read_state"></a>
│ │ │ │ +<a name="write_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info%3A%3A%5Bread_state+write_state%5D&labels=documentation&body=Documentation+under+heading+%22peer_info%3A%3A%5Bread_state+write_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>read_state write_state</dt>
│ │ │ │ +<dd>bitmasks indicating what state this peer
│ │ │ │ +is in with regards to sending and receiving data. The states are
│ │ │ │ +defined as independent flags of type bandwidth_state_flags_t, in this
│ │ │ │ +class.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="info_hash_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+info_hash_t&labels=documentation&body=Documentation+under+heading+%22class+info_hash_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="info-hash-t">
│ │ │ │ +<h1>info_hash_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/info_hash.hpp">libtorrent/info_hash.hpp</a>&quot;</p>
│ │ │ │ +<p>class holding the info-hash of a torrent. It can hold a v1 info-hash
│ │ │ │ +(SHA-1) or a v2 info-hash (SHA-256) or both.</p>
│ │ │ │  <div class="admonition note">
│ │ │ │  <p class="first admonition-title">Note</p>
│ │ │ │ -<p class="last">This setting is only meant for very special cases where a
│ │ │ │ -seed's listening port differs from the external port. As an
│ │ │ │ -example, if a local proxy is used and that the proxy supports
│ │ │ │ -reverse tunnels through NAT-PMP, the tracker must connect to
│ │ │ │ -the external NAT-PMP port (configured using <tt class="docutils literal">announce_port</tt>)
│ │ │ │ -instead of the actual local listening port.</p>
│ │ │ │ +<p class="last">If <tt class="docutils literal">has_v2()</tt> is false then the v1 hash might actually be a truncated
│ │ │ │ +v2 hash</p>
│ │ │ │  </div>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct settings_pack final : settings_interface
│ │ │ │ +struct info_hash_t
│ │ │ │  {
│ │ │ │ -   friend  void <strong>apply_pack_impl</strong> (settings_pack const*
│ │ │ │ -      , aux::session_settings_single_thread&amp;
│ │ │ │ -      , std::vector&lt;void(aux::session_impl::*)()&gt;*);
│ │ │ │ -   void <strong>set_int</strong> (int name, flags::bitfield_flag&lt;Type, Tag&gt; const val);
│ │ │ │ -   void <strong>set_int</strong> (int name, int val) override;
│ │ │ │ -   void <strong>set_bool</strong> (int name, bool val) override;
│ │ │ │ -   void <strong>set_str</strong> (int name, std::string val) override;
│ │ │ │ -   bool <strong>has_val</strong> (int name) const override;
│ │ │ │ -   void <strong>clear</strong> ();
│ │ │ │ -   void <strong>clear</strong> (int name);
│ │ │ │ -   int <strong>get_int</strong> (int name) const override;
│ │ │ │ -   bool <strong>get_bool</strong> (int name) const override;
│ │ │ │ -   std::string const&amp; <strong>get_str</strong> (int name) const override;
│ │ │ │ -   void <strong>for_each</strong> (Fun&amp;&amp; f) const;
│ │ │ │ -
│ │ │ │ -   enum type_bases
│ │ │ │ -   {
│ │ │ │ -      string_type_base,
│ │ │ │ -      int_type_base,
│ │ │ │ -      bool_type_base,
│ │ │ │ -      type_mask,
│ │ │ │ -      index_mask,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   enum mmap_write_mode_t
│ │ │ │ -   {
│ │ │ │ -      always_pwrite,
│ │ │ │ -      always_mmap_write,
│ │ │ │ -      auto_mmap_write,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   enum suggest_mode_t
│ │ │ │ -   {
│ │ │ │ -      no_piece_suggestions,
│ │ │ │ -      suggest_read_cache,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   enum choking_algorithm_t
│ │ │ │ -   {
│ │ │ │ -      fixed_slots_choker,
│ │ │ │ -      rate_based_choker,
│ │ │ │ -      deprecated_bittyrant_choker,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   enum seed_choking_algorithm_t
│ │ │ │ -   {
│ │ │ │ -      round_robin,
│ │ │ │ -      fastest_upload,
│ │ │ │ -      anti_leech,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   enum io_buffer_mode_t
│ │ │ │ -   {
│ │ │ │ -      enable_os_cache,
│ │ │ │ -      deprecated_disable_os_cache_for_aligned_files,
│ │ │ │ -      disable_os_cache,
│ │ │ │ -      write_through,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   enum bandwidth_mixed_algo_t
│ │ │ │ -   {
│ │ │ │ -      prefer_tcp,
│ │ │ │ -      peer_proportional,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   enum enc_policy
│ │ │ │ -   {
│ │ │ │ -      pe_forced,
│ │ │ │ -      pe_enabled,
│ │ │ │ -      pe_disabled,
│ │ │ │ -   };
│ │ │ │ -
│ │ │ │ -   enum enc_level
│ │ │ │ -   {
│ │ │ │ -      pe_plaintext,
│ │ │ │ -      pe_rc4,
│ │ │ │ -      pe_both,
│ │ │ │ -   };
│ │ │ │ +   <strong>info_hash_t</strong> () noexcept = default;
│ │ │ │ +   explicit <strong>info_hash_t</strong> (sha256_hash h2) noexcept;
│ │ │ │ +   explicit <strong>info_hash_t</strong> (sha1_hash h1) noexcept;
│ │ │ │ +   <strong>info_hash_t</strong> (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ +   bool <strong>has_v1</strong> () const;
│ │ │ │ +   bool <strong>has_v2</strong> () const;
│ │ │ │ +   bool <strong>has</strong> (protocol_version v) const;
│ │ │ │ +   sha1_hash <strong>get</strong> (protocol_version v) const;
│ │ │ │ +   sha1_hash <strong>get_best</strong> () const;
│ │ │ │ +   friend bool <strong>operator!=</strong> (info_hash_t const&amp; lhs, info_hash_t const&amp; rhs);
│ │ │ │ +   friend bool <strong>operator==</strong> (info_hash_t const&amp; lhs, info_hash_t const&amp; rhs) noexcept;
│ │ │ │ +   template &lt;typename F&gt; void <strong>for_each</strong> (F f) const;
│ │ │ │ +   bool <strong>operator&lt;</strong> (info_hash_t const&amp; o) const;
│ │ │ │ +   friend std::ostream&amp; <strong>operator&lt;&lt;</strong> (std::ostream&amp; os, info_hash_t const&amp; ih);
│ │ │ │  
│ │ │ │ -   enum proxy_type_t
│ │ │ │ -   {
│ │ │ │ -      none,
│ │ │ │ -      socks4,
│ │ │ │ -      socks5,
│ │ │ │ -      socks5_pw,
│ │ │ │ -      http,
│ │ │ │ -      http_pw,
│ │ │ │ -   };
│ │ │ │ +   sha1_hash v1;
│ │ │ │ +   sha256_hash v2;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="set_bool()"></a>
│ │ │ │ -<a name="set_int()"></a>
│ │ │ │ -<a name="set_str()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bset_bool%28%29+set_int%28%29+set_str%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bset_bool%28%29+set_int%28%29+set_str%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="set-bool-set-int-set-str">
│ │ │ │ -<h2>set_bool() set_int() set_str()</h2>
│ │ │ │ +<a name="info_hash_t()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Binfo_hash_t%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Binfo_hash_t%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="info-hash-t-1">
│ │ │ │ +<h2>info_hash_t()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>set_int</strong> (int name, flags::bitfield_flag&lt;Type, Tag&gt; const val);
│ │ │ │ -void <strong>set_int</strong> (int name, int val) override;
│ │ │ │ -void <strong>set_bool</strong> (int name, bool val) override;
│ │ │ │ -void <strong>set_str</strong> (int name, std::string val) override;
│ │ │ │ +<strong>info_hash_t</strong> () noexcept = default;
│ │ │ │ +explicit <strong>info_hash_t</strong> (sha256_hash h2) noexcept;
│ │ │ │ +explicit <strong>info_hash_t</strong> (sha1_hash h1) noexcept;
│ │ │ │ +<strong>info_hash_t</strong> (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │  </pre>
│ │ │ │ -<p>set a configuration option in the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>. <tt class="docutils literal">name</tt> is one of
│ │ │ │ -the enum values from string_types, int_types or bool_types. They must
│ │ │ │ -match the respective type of the set_* function.</p>
│ │ │ │ -<a name="has_val()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bhas_val%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bhas_val%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="has-val">
│ │ │ │ -<h2>has_val()</h2>
│ │ │ │ +<p>The default constructor creates an object that has neither a v1 or v2
│ │ │ │ +hash.</p>
│ │ │ │ +<p>For backwards compatibility, make it possible to construct directly
│ │ │ │ +from a v1 hash. This constructor allows <em>implicit</em> conversion from a
│ │ │ │ +v1 hash, but the implicitness is deprecated.</p>
│ │ │ │ +<a name="has_v2()"></a>
│ │ │ │ +<a name="has_v1()"></a>
│ │ │ │ +<a name="has()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bhas_v2%28%29+has_v1%28%29+has%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bhas_v2%28%29+has_v1%28%29+has%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="has-v2-has-v1-has">
│ │ │ │ +<h2>has_v2() has_v1() has()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -bool <strong>has_val</strong> (int name) const override;
│ │ │ │ +bool <strong>has_v1</strong> () const;
│ │ │ │ +bool <strong>has_v2</strong> () const;
│ │ │ │ +bool <strong>has</strong> (protocol_version v) const;
│ │ │ │  </pre>
│ │ │ │ -<p>queries whether the specified configuration option has a value set in
│ │ │ │ -this pack. <tt class="docutils literal">name</tt> can be any enumeration value from string_types,
│ │ │ │ -int_types or bool_types.</p>
│ │ │ │ -<a name="clear()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bclear%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bclear%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="clear">
│ │ │ │ -<h2>clear()</h2>
│ │ │ │ +<p>returns true if the corresponding info hash is present in this
│ │ │ │ +object.</p>
│ │ │ │ +<a name="get()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bget%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bget%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get">
│ │ │ │ +<h2>get()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>clear</strong> ();
│ │ │ │ +sha1_hash <strong>get</strong> (protocol_version v) const;
│ │ │ │  </pre>
│ │ │ │ -<p>clear the settings pack from all settings</p>
│ │ │ │ -<a name="clear()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bclear%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bclear%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="clear-1">
│ │ │ │ -<h2>clear()</h2>
│ │ │ │ +<p>returns the has for the specified protocol version</p>
│ │ │ │ +<a name="get_best()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bget_best%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bget_best%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="get-best">
│ │ │ │ +<h2>get_best()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -void <strong>clear</strong> (int name);
│ │ │ │ +sha1_hash <strong>get_best</strong> () const;
│ │ │ │  </pre>
│ │ │ │ -<p>clear a specific setting from the pack</p>
│ │ │ │ -<a name="get_str()"></a>
│ │ │ │ -<a name="get_bool()"></a>
│ │ │ │ -<a name="get_int()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:settings_pack%3A%3A%5Bget_str%28%29+get_bool%28%29+get_int%28%29%5D&labels=documentation&body=Documentation+under+heading+%22settings_pack%3A%3A%5Bget_str%28%29+get_bool%28%29+get_int%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="get-str-get-bool-get-int">
│ │ │ │ -<h2>get_str() get_bool() get_int()</h2>
│ │ │ │ +<p>returns the v2 (truncated) info-hash, if there is one, otherwise
│ │ │ │ +returns the v1 info-hash</p>
│ │ │ │ +<a name="for_each()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:info_hash_t%3A%3A%5Bfor_each%28%29%5D&labels=documentation&body=Documentation+under+heading+%22info_hash_t%3A%3A%5Bfor_each%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="for-each">
│ │ │ │ +<h2>for_each()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -int <strong>get_int</strong> (int name) const override;
│ │ │ │ -bool <strong>get_bool</strong> (int name) const override;
│ │ │ │ -std::string const&amp; <strong>get_str</strong> (int name) const override;
│ │ │ │ +template &lt;typename F&gt; void <strong>for_each</strong> (F f) const;
│ │ │ │  </pre>
│ │ │ │ -<p>queries the current configuration option from the <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>.
│ │ │ │ -<tt class="docutils literal">name</tt> is one of the enumeration values from string_types, int_types
│ │ │ │ -or bool_types. The enum value must match the type of the get_*
│ │ │ │ -function. If the specified setting field has not been set, the default
│ │ │ │ -value is returned.</p>
│ │ │ │ -<a name="type_bases"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+type_bases&labels=documentation&body=Documentation+under+heading+%22enum+type_bases%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-type-bases">
│ │ │ │ -<h2>enum type_bases</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<p>calls the function object <tt class="docutils literal">f</tt> for each hash that is available.
│ │ │ │ +starting with v1. The signature of <tt class="docutils literal">F</tt> is:</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void(sha1_hash const&amp;, protocol_version);
│ │ │ │ +</pre>
│ │ │ │ +<a name="load_torrent_parsed()"></a>
│ │ │ │ +<a name="load_torrent_file()"></a>
│ │ │ │ +<a name="load_torrent_buffer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:load_torrent_parsed%28%29+load_torrent_file%28%29+load_torrent_buffer%28%29&labels=documentation&body=Documentation+under+heading+%22load_torrent_parsed%28%29+load_torrent_file%28%29+load_torrent_buffer%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="load-torrent-parsed-load-torrent-file-load-torrent-buffer">
│ │ │ │ +<h1>load_torrent_parsed() load_torrent_file() load_torrent_buffer()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/load_torrent.hpp">libtorrent/load_torrent.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +add_torrent_params <strong>load_torrent_file</strong> (
│ │ │ │ +   std::string const&amp; filename);
│ │ │ │ +add_torrent_params <strong>load_torrent_buffer</strong> (
│ │ │ │ +   span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg);
│ │ │ │ +add_torrent_params <strong>load_torrent_file</strong> (
│ │ │ │ +   std::string const&amp; filename, load_torrent_limits const&amp; cfg);
│ │ │ │ +add_torrent_params <strong>load_torrent_parsed</strong> (
│ │ │ │ +   bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg);
│ │ │ │ +add_torrent_params <strong>load_torrent_parsed</strong> (
│ │ │ │ +   bdecode_node const&amp; torrent_file);
│ │ │ │ +add_torrent_params <strong>load_torrent_buffer</strong> (
│ │ │ │ +   span&lt;char const&gt; buffer);
│ │ │ │ +</pre>
│ │ │ │ +<p>These functions load the content of a .torrent file into an
│ │ │ │ +<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object.
│ │ │ │ +The immutable part of a torrent file (the info-dictionary) is stored in
│ │ │ │ +the <tt class="docutils literal">ti</tt> field in the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object (as a <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a>
│ │ │ │ +object).
│ │ │ │ +The returned object is suitable to be:</p>
│ │ │ │ +<blockquote>
│ │ │ │ +<ul class="simple">
│ │ │ │ +<li>added to a <a class="reference external" href="reference-Session.html#session">session</a> via <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> or <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a></li>
│ │ │ │ +<li>saved as a .torrent_file via <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a></li>
│ │ │ │ +<li>turned into a magnet link via <a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a></li>
│ │ │ │ +</ul>
│ │ │ │ +</blockquote>
│ │ │ │ +<a name="truncate_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:truncate_files%28%29&labels=documentation&body=Documentation+under+heading+%22truncate_files%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="truncate-files">
│ │ │ │ +<h1>truncate_files()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/truncate.hpp">libtorrent/truncate.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>truncate_files</strong> (file_storage const&amp; fs, std::string const&amp; save_path, storage_error&amp; ec);
│ │ │ │ +</pre>
│ │ │ │ +<p>Truncates files larger than specified in the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>, saved under
│ │ │ │ +the specified save_path.</p>
│ │ │ │ +<a name="make_magnet_uri()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:make_magnet_uri%28%29&labels=documentation&body=Documentation+under+heading+%22make_magnet_uri%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="make-magnet-uri">
│ │ │ │ +<h1>make_magnet_uri()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/magnet_uri.hpp">libtorrent/magnet_uri.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::string <strong>make_magnet_uri</strong> (add_torrent_params const&amp; atp);
│ │ │ │ +std::string <strong>make_magnet_uri</strong> (torrent_info const&amp; info);
│ │ │ │ +std::string <strong>make_magnet_uri</strong> (torrent_handle const&amp; handle);
│ │ │ │ +</pre>
│ │ │ │ +<p>Generates a magnet URI from the specified torrent.</p>
│ │ │ │ +<p>Several fields from the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> objects are recorded in the
│ │ │ │ +magnet link. In order to not include them, they have to be cleared before
│ │ │ │ +calling <a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a>. These fields are used:</p>
│ │ │ │ +<blockquote>
│ │ │ │ +<tt class="docutils literal">ti</tt>, <tt class="docutils literal">info_hashes</tt>, <tt class="docutils literal">url_seeds</tt>, <tt class="docutils literal">dht_nodes</tt>,
│ │ │ │ +<tt class="docutils literal">file_priorities</tt>, <tt class="docutils literal">trackers</tt>, <tt class="docutils literal">name</tt>, <tt class="docutils literal">peers</tt>.</blockquote>
│ │ │ │ +<p>Depending on what the use case for the resulting magnet link is, clearing
│ │ │ │ +<tt class="docutils literal">peers</tt> and <tt class="docutils literal">dht_nodes</tt> is probably a good idea if the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>
│ │ │ │ +came from a running torrent. Those lists may be long and be ephemeral.</p>
│ │ │ │ +<p>If none of the <tt class="docutils literal">info_hashes</tt> or <tt class="docutils literal">ti</tt> fields are set, there is not
│ │ │ │ +info-hash available, and a magnet link cannot be created. In this case
│ │ │ │ +<a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a> returns an empty string.</p>
│ │ │ │ +<p>The recommended way to generate a magnet link from a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> is to
│ │ │ │ +call <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a>, which will post a <a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a>
│ │ │ │ +containing an <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object. This can then be passed to
│ │ │ │ +<a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a>.</p>
│ │ │ │ +<p>The overload that takes a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> will make blocking calls to
│ │ │ │ +query information about the torrent. If the torrent handle is invalid,
│ │ │ │ +an empty string is returned.</p>
│ │ │ │ +<p>For more information about magnet links, see <a class="reference external" href="manual-ref.html#magnet-links">magnet links</a>.</p>
│ │ │ │ +<a name="parse_magnet_uri()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:parse_magnet_uri%28%29&labels=documentation&body=Documentation+under+heading+%22parse_magnet_uri%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="parse-magnet-uri">
│ │ │ │ +<h1>parse_magnet_uri()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/magnet_uri.hpp">libtorrent/magnet_uri.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>parse_magnet_uri</strong> (string_view uri, add_torrent_params&amp; p, error_code&amp; ec);
│ │ │ │ +add_torrent_params <strong>parse_magnet_uri</strong> (string_view uri);
│ │ │ │ +add_torrent_params <strong>parse_magnet_uri</strong> (string_view uri, error_code&amp; ec);
│ │ │ │ +</pre>
│ │ │ │ +<p>This function parses out information from the magnet link and populates the
│ │ │ │ +<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object. The overload that does not take an
│ │ │ │ +<tt class="docutils literal">error_code</tt> reference will throw a system_error on error
│ │ │ │ +The overload taking an <tt class="docutils literal">add_torrent_params</tt> reference will fill in the
│ │ │ │ +fields specified in the magnet URI.</p>
│ │ │ │ +<a name="torrent_peer_equal()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_peer_equal%28%29&labels=documentation&body=Documentation+under+heading+%22torrent_peer_equal%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-peer-equal">
│ │ │ │ +<h1>torrent_peer_equal()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_peer.hpp">libtorrent/torrent_peer.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +inline bool <strong>torrent_peer_equal</strong> (torrent_peer const* lhs, torrent_peer const* rhs);
│ │ │ │ +</pre>
│ │ │ │ +<a name="version()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:version%28%29&labels=documentation&body=Documentation+under+heading+%22version%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="version">
│ │ │ │ +<h1>version()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>version</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the libtorrent version as string form in this format:
│ │ │ │ +&quot;&lt;major&gt;.&lt;minor&gt;.&lt;tiny&gt;.&lt;tag&gt;&quot;</p>
│ │ │ │ +<a name="event_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+event_t&labels=documentation&body=Documentation+under+heading+%22enum+event_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-event-t">
│ │ │ │ +<h1>enum event_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/tracker_manager.hpp">libtorrent/tracker_manager.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="47%" />
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="34%" />
│ │ │ │ +<col width="35%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +<col width="42%" />
│ │ │ │  </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>string_type_base</td>
│ │ │ │ +<tr><td>none</td>
│ │ │ │  <td>0</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>int_type_base</td>
│ │ │ │ -<td>16384</td>
│ │ │ │ +<tr><td>completed</td>
│ │ │ │ +<td>1</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>bool_type_base</td>
│ │ │ │ -<td>32768</td>
│ │ │ │ +<tr><td>started</td>
│ │ │ │ +<td>2</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>type_mask</td>
│ │ │ │ -<td>49152</td>
│ │ │ │ +<tr><td>stopped</td>
│ │ │ │ +<td>3</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>index_mask</td>
│ │ │ │ -<td>16383</td>
│ │ │ │ +<tr><td>paused</td>
│ │ │ │ +<td>4</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="mmap_write_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+mmap_write_mode_t&labels=documentation&body=Documentation+under+heading+%22enum+mmap_write_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-mmap-write-mode-t">
│ │ │ │ -<h2>enum mmap_write_mode_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<a name="portmap_transport"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+portmap_transport&labels=documentation&body=Documentation+under+heading+%22enum+portmap_transport%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-portmap-transport">
│ │ │ │ +<h1>enum portmap_transport</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/portmap.hpp">libtorrent/portmap.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="21%" />
│ │ │ │ -<col width="8%" />
│ │ │ │ -<col width="71%" />
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="16%" />
│ │ │ │ +<col width="67%" />
│ │ │ │  </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>always_pwrite</td>
│ │ │ │ +<tr><td>natpmp</td>
│ │ │ │  <td>0</td>
│ │ │ │ -<td>disable writing to disk via mmap, always use normal write calls</td>
│ │ │ │ +<td>natpmp can be NAT-PMP or PCP</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>always_mmap_write</td>
│ │ │ │ +<tr><td>upnp</td>
│ │ │ │  <td>1</td>
│ │ │ │ -<td>prefer using memory mapped files for disk writes (at least for
│ │ │ │ -large files where it might make sense)</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>auto_mmap_write</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>determine whether to use pwrite or memory mapped files for disk
│ │ │ │ -writes depending on the kind of storage behind the save path</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="suggest_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+suggest_mode_t&labels=documentation&body=Documentation+under+heading+%22enum+suggest_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-suggest-mode-t">
│ │ │ │ -<h2>enum suggest_mode_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<a name="portmap_protocol"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+portmap_protocol&labels=documentation&body=Documentation+under+heading+%22enum+portmap_protocol%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-portmap-protocol">
│ │ │ │ +<h1>enum portmap_protocol</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/portmap.hpp">libtorrent/portmap.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="52%" />
│ │ │ │ -<col width="17%" />
│ │ │ │ -<col width="31%" />
│ │ │ │ +<col width="23%" />
│ │ │ │ +<col width="27%" />
│ │ │ │ +<col width="50%" />
│ │ │ │  </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_piece_suggestions</td>
│ │ │ │ +<tr><td>none</td>
│ │ │ │  <td>0</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>suggest_read_cache</td>
│ │ │ │ +<tr><td>tcp</td>
│ │ │ │  <td>1</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="choking_algorithm_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+choking_algorithm_t&labels=documentation&body=Documentation+under+heading+%22enum+choking_algorithm_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-choking-algorithm-t">
│ │ │ │ -<h2>enum choking_algorithm_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="28%" />
│ │ │ │ -<col width="7%" />
│ │ │ │ -<col width="65%" />
│ │ │ │ -</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>fixed_slots_choker</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>This is the traditional choker with a fixed number of unchoke
│ │ │ │ -slots (as specified by <a class="reference external" href="reference-Settings.html#unchoke_slots_limit">settings_pack::unchoke_slots_limit</a>).</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>rate_based_choker</td>
│ │ │ │ +<tr><td>udp</td>
│ │ │ │  <td>2</td>
│ │ │ │ -<td><p class="first">This opens up unchoke slots based on the upload rate achieved to
│ │ │ │ -peers. The more slots that are opened, the marginal upload rate
│ │ │ │ -required to open up another slot increases. Configure the initial
│ │ │ │ -threshold with <a class="reference external" href="reference-Settings.html#rate_choker_initial_threshold">settings_pack::rate_choker_initial_threshold</a>.</p>
│ │ │ │ -<p class="last">For more information, see <a class="reference external" href="manual-ref.html#rate-based-choking">rate based choking</a>.</p>
│ │ │ │ -</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>deprecated_bittyrant_choker</td>
│ │ │ │ -<td>3</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="seed_choking_algorithm_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+seed_choking_algorithm_t&labels=documentation&body=Documentation+under+heading+%22enum+seed_choking_algorithm_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-seed-choking-algorithm-t">
│ │ │ │ -<h2>enum seed_choking_algorithm_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<a name="protocol_version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+protocol_version&labels=documentation&body=Documentation+under+heading+%22enum+protocol_version%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-protocol-version">
│ │ │ │ +<h1>enum protocol_version</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/info_hash.hpp">libtorrent/info_hash.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="18%" />
│ │ │ │  <col width="8%" />
│ │ │ │ -<col width="75%" />
│ │ │ │ +<col width="10%" />
│ │ │ │ +<col width="82%" />
│ │ │ │  </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>round_robin</td>
│ │ │ │ +<tr><td>V1</td>
│ │ │ │  <td>0</td>
│ │ │ │ -<td>which round-robins the peers that are unchoked
│ │ │ │ -when seeding. This distributes the upload bandwidth uniformly and
│ │ │ │ -fairly. It minimizes the ability for a peer to download everything
│ │ │ │ -without redistributing it.</td>
│ │ │ │ +<td>The original BitTorrent version, using SHA-1 hashes</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>fastest_upload</td>
│ │ │ │ +<tr><td>V2</td>
│ │ │ │  <td>1</td>
│ │ │ │ -<td>unchokes the peers we can send to the fastest. This might be a
│ │ │ │ -bit more reliable in utilizing all available capacity.</td>
│ │ │ │ +<td>Version 2 of the BitTorrent protocol, using SHA-256 hashes</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>anti_leech</td>
│ │ │ │ +<tr><td>NUM</td>
│ │ │ │  <td>2</td>
│ │ │ │ -<td>prioritizes peers who have just started or are
│ │ │ │ -just about to finish the download. The intention is to force
│ │ │ │ -peers in the middle of the download to trade with each other.
│ │ │ │ -This does not just take into account the pieces a peer is
│ │ │ │ -reporting having downloaded, but also the pieces we have sent
│ │ │ │ -to it.</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="io_buffer_mode_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+io_buffer_mode_t&labels=documentation&body=Documentation+under+heading+%22enum+io_buffer_mode_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-io-buffer-mode-t">
│ │ │ │ -<h2>enum io_buffer_mode_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<a name="socket_type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+socket_type_t&labels=documentation&body=Documentation+under+heading+%22enum+socket_type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-socket-type-t-1">
│ │ │ │ +<h1>enum socket_type_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/socket_type.hpp">libtorrent/socket_type.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="70%" />
│ │ │ │ -<col width="10%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ +<col width="38%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +<col width="41%" />
│ │ │ │  </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>enable_os_cache</td>
│ │ │ │ +<tr><td>tcp</td>
│ │ │ │  <td>0</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>deprecated_disable_os_cache_for_aligned_files</td>
│ │ │ │ +<tr><td>socks5</td>
│ │ │ │  <td>1</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>disable_os_cache</td>
│ │ │ │ +<tr><td>http</td>
│ │ │ │  <td>2</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>write_through</td>
│ │ │ │ +<tr><td>utp</td>
│ │ │ │  <td>3</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="bandwidth_mixed_algo_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+bandwidth_mixed_algo_t&labels=documentation&body=Documentation+under+heading+%22enum+bandwidth_mixed_algo_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-bandwidth-mixed-algo-t">
│ │ │ │ -<h2>enum bandwidth_mixed_algo_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="22%" />
│ │ │ │ -<col width="8%" />
│ │ │ │ -<col width="70%" />
│ │ │ │ -</colgroup>
│ │ │ │ -<thead valign="bottom">
│ │ │ │ -<tr><th class="head">name</th>
│ │ │ │ -<th class="head">value</th>
│ │ │ │ -<th class="head">description</th>
│ │ │ │ +<tr><td>i2p</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -</thead>
│ │ │ │ -<tbody valign="top">
│ │ │ │ -<tr><td>prefer_tcp</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>disables the mixed mode bandwidth balancing</td>
│ │ │ │ +<tr><td>tcp_ssl</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>peer_proportional</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>does not throttle uTP, throttles TCP to the same proportion
│ │ │ │ -of throughput as there are TCP connections</td>
│ │ │ │ +<tr><td>socks5_ssl</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>http_ssl</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>utp_ssl</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="enc_policy"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+enc_policy&labels=documentation&body=Documentation+under+heading+%22enum+enc_policy%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-enc-policy">
│ │ │ │ -<h2>enum enc_policy</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<a name="connection_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+connection_type&labels=documentation&body=Documentation+under+heading+%22enum+connection_type%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-connection-type">
│ │ │ │ +<h1>enum connection_type</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/peer_connection.hpp">libtorrent/peer_connection.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="15%" />
│ │ │ │ -<col width="8%" />
│ │ │ │ -<col width="78%" />
│ │ │ │ +<col width="38%" />
│ │ │ │ +<col width="22%" />
│ │ │ │ +<col width="41%" />
│ │ │ │  </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>pe_forced</td>
│ │ │ │ +<tr><td>bittorrent</td>
│ │ │ │  <td>0</td>
│ │ │ │ -<td>Only encrypted connections are allowed. Incoming connections that
│ │ │ │ -are not encrypted are closed and if the encrypted outgoing
│ │ │ │ -connection fails, a non-encrypted retry will not be made.</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>pe_enabled</td>
│ │ │ │ +<tr><td>url_seed</td>
│ │ │ │  <td>1</td>
│ │ │ │ -<td>encrypted connections are enabled, but non-encrypted connections
│ │ │ │ -are allowed. An incoming non-encrypted connection will be accepted,
│ │ │ │ -and if an outgoing encrypted connection fails, a non- encrypted
│ │ │ │ -connection will be tried.</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>pe_disabled</td>
│ │ │ │ +<tr><td>http_seed</td>
│ │ │ │  <td>2</td>
│ │ │ │ -<td>only non-encrypted connections are allowed.</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="enc_level"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+enc_level&labels=documentation&body=Documentation+under+heading+%22enum+enc_level%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-enc-level">
│ │ │ │ -<h2>enum enc_level</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<a name="torrent_flags_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_flags_t&labels=documentation&body=Documentation+under+heading+%22torrent_flags_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-flags-t">
│ │ │ │ +<h1>torrent_flags_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_flags.hpp">libtorrent/torrent_flags.hpp</a>&quot;</p>
│ │ │ │ +<a name="torrent_flags_t::seed_mode"></a><dl class="docutils">
│ │ │ │ +<dt>seed_mode</dt>
│ │ │ │ +<dd><p class="first">If <tt class="docutils literal">seed_mode</tt> is set, libtorrent will assume that all files
│ │ │ │ +are present for this torrent and that they all match the hashes in
│ │ │ │ +the torrent file. Each time a peer requests to download a block,
│ │ │ │ +the piece is verified against the hash, unless it has been verified
│ │ │ │ +already. If a hash fails, the torrent will automatically leave the
│ │ │ │ +seed mode and recheck all the files. The use case for this mode is
│ │ │ │ +if a torrent is created and seeded, or if the user already know
│ │ │ │ +that the files are complete, this is a way to avoid the initial
│ │ │ │ +file checks, and significantly reduce the startup time.</p>
│ │ │ │ +<p>Setting <tt class="docutils literal">seed_mode</tt> on a torrent without metadata (a
│ │ │ │ +.torrent file) is a no-op and will be ignored.</p>
│ │ │ │ +<p class="last">It is not possible to <em>set</em> the <tt class="docutils literal">seed_mode</tt> flag on a torrent after it has
│ │ │ │ +been added to a <a class="reference external" href="reference-Session.html#session">session</a>. It is possible to <em>clear</em> it though.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::upload_mode"></a><dl class="docutils">
│ │ │ │ +<dt>upload_mode</dt>
│ │ │ │ +<dd><p class="first">If <tt class="docutils literal">upload_mode</tt> is set, the torrent will be initialized in
│ │ │ │ +upload-mode, which means it will not make any piece requests. This
│ │ │ │ +state is typically entered on disk I/O errors, and if the torrent
│ │ │ │ +is also auto managed, it will be taken out of this state
│ │ │ │ +periodically (see <tt class="docutils literal"><span class="pre">settings_pack::optimistic_disk_retry</span></tt>).</p>
│ │ │ │ +<p>This mode can be used to avoid race conditions when
│ │ │ │ +adjusting priorities of pieces before allowing the torrent to start
│ │ │ │ +downloading.</p>
│ │ │ │ +<p class="last">If the torrent is auto-managed (<tt class="docutils literal">auto_managed</tt>), the torrent
│ │ │ │ +will eventually be taken out of upload-mode, regardless of how it
│ │ │ │ +got there. If it's important to manually control when the torrent
│ │ │ │ +leaves upload mode, don't make it auto managed.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::share_mode"></a><dl class="docutils">
│ │ │ │ +<dt>share_mode</dt>
│ │ │ │ +<dd><p class="first">determines if the torrent should be added in <em>share mode</em> or not.
│ │ │ │ +Share mode indicates that we are not interested in downloading the
│ │ │ │ +torrent, but merely want to improve our share ratio (i.e. increase
│ │ │ │ +it). A torrent started in share mode will do its best to never
│ │ │ │ +download more than it uploads to the swarm. If the swarm does not
│ │ │ │ +have enough demand for upload capacity, the torrent will not
│ │ │ │ +download anything. This mode is intended to be safe to add any
│ │ │ │ +number of torrents to, without manual screening, without the risk
│ │ │ │ +of downloading more than is uploaded.</p>
│ │ │ │ +<p>A torrent in share mode sets the priority to all pieces to 0,
│ │ │ │ +except for the pieces that are downloaded, when pieces are decided
│ │ │ │ +to be downloaded. This affects the progress bar, which might be set
│ │ │ │ +to &quot;100% finished&quot; most of the time. Do not change file or piece
│ │ │ │ +priorities for torrents in share mode, it will make it not work.</p>
│ │ │ │ +<p class="last">The share mode has one setting, the share ratio target, see
│ │ │ │ +<tt class="docutils literal"><span class="pre">settings_pack::share_mode_target</span></tt> for more info.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::apply_ip_filter"></a><dl class="docutils">
│ │ │ │ +<dt>apply_ip_filter</dt>
│ │ │ │ +<dd>determines if the IP filter should apply to this torrent or not. By
│ │ │ │ +default all torrents are subject to filtering by the IP filter
│ │ │ │ +(i.e. this flag is set by default). This is useful if certain
│ │ │ │ +torrents needs to be exempt for some reason, being an auto-update
│ │ │ │ +torrent for instance.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::paused"></a><dl class="docutils">
│ │ │ │ +<dt>paused</dt>
│ │ │ │ +<dd>specifies whether or not the torrent is paused. i.e. it won't connect to the tracker or any of the peers
│ │ │ │ +until it's resumed. Note that a paused torrent that also has the
│ │ │ │ +auto_managed flag set can be started at any time by libtorrent's queuing
│ │ │ │ +logic. See <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::auto_managed"></a><dl class="docutils">
│ │ │ │ +<dt>auto_managed</dt>
│ │ │ │ +<dd><p class="first">If the torrent is auto-managed (<tt class="docutils literal">auto_managed</tt>), the torrent
│ │ │ │ +may be resumed at any point, regardless of how it paused. If it's
│ │ │ │ +important to manually control when the torrent is paused and
│ │ │ │ +resumed, don't make it auto managed.</p>
│ │ │ │ +<p class="last">If <tt class="docutils literal">auto_managed</tt> is set, the torrent will be queued,
│ │ │ │ +started and seeded automatically by libtorrent. When this is set,
│ │ │ │ +the torrent should also be started as paused. The default queue
│ │ │ │ +order is the order the torrents were added. They are all downloaded
│ │ │ │ +in that order. For more details, see <a class="reference external" href="manual-ref.html#queuing">queuing</a>.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::duplicate_is_error"></a><dl class="docutils">
│ │ │ │ +<dt>duplicate_is_error</dt>
│ │ │ │ +<dd>used in <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> to indicate that it's an error to attempt
│ │ │ │ +to add a torrent that's already in the <a class="reference external" href="reference-Session.html#session">session</a>. If it's not considered an
│ │ │ │ +error, a handle to the existing torrent is returned.
│ │ │ │ +This flag is not saved by <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a>, since it is only meant for
│ │ │ │ +adding torrents.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::update_subscribe"></a><dl class="docutils">
│ │ │ │ +<dt>update_subscribe</dt>
│ │ │ │ +<dd>on by default and means that this torrent will be part of state
│ │ │ │ +updates when calling <a class="reference external" href="reference-Session.html#post_torrent_updates()">post_torrent_updates()</a>.
│ │ │ │ +This flag is not saved by <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::super_seeding"></a><dl class="docutils">
│ │ │ │ +<dt>super_seeding</dt>
│ │ │ │ +<dd>sets the torrent into super seeding/initial seeding mode. If the torrent
│ │ │ │ +is not a seed, this flag has no effect.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::sequential_download"></a><dl class="docutils">
│ │ │ │ +<dt>sequential_download</dt>
│ │ │ │ +<dd>sets the sequential download state for the torrent. In this mode the
│ │ │ │ +piece picker will pick pieces with low index numbers before pieces with
│ │ │ │ +high indices. The actual pieces that are picked depend on other factors
│ │ │ │ +still, such as which pieces a peer has and whether it is in parole mode
│ │ │ │ +or &quot;prefer whole pieces&quot;-mode. Sequential mode is not ideal for streaming
│ │ │ │ +media. For that, see <a class="reference external" href="reference-Torrent_Handle.html#set_piece_deadline()">set_piece_deadline()</a> instead.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::stop_when_ready"></a><dl class="docutils">
│ │ │ │ +<dt>stop_when_ready</dt>
│ │ │ │ +<dd><p class="first">When this flag is set, the torrent will <em>force stop</em> whenever it
│ │ │ │ +transitions from a non-data-transferring state into a data-transferring
│ │ │ │ +state (referred to as being ready to download or seed). This is useful
│ │ │ │ +for torrents that should not start downloading or seeding yet, but want
│ │ │ │ +to be made ready to do so. A torrent may need to have its files checked
│ │ │ │ +for instance, so it needs to be started and possibly queued for checking
│ │ │ │ +(auto-managed and started) but as soon as it's done, it should be
│ │ │ │ +stopped.</p>
│ │ │ │ +<p><em>Force stopped</em> means auto-managed is set to false and it's paused. As
│ │ │ │ +if the auto_manages flag is cleared and the paused flag is set on the torrent.</p>
│ │ │ │ +<p>Note that the torrent may transition into a downloading state while
│ │ │ │ +setting this flag, and since the logic is edge triggered you may
│ │ │ │ +miss the edge. To avoid this race, if the torrent already is in a
│ │ │ │ +downloading state when this call is made, it will trigger the
│ │ │ │ +stop-when-ready immediately.</p>
│ │ │ │ +<p>When the stop-when-ready logic fires, the flag is cleared. Any
│ │ │ │ +subsequent transitions between downloading and non-downloading states
│ │ │ │ +will not be affected, until this flag is set again.</p>
│ │ │ │ +<p>The behavior is more robust when setting this flag as part of adding
│ │ │ │ +the torrent. See <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>.</p>
│ │ │ │ +<p>The stop-when-ready flag fixes the inherent race condition of waiting
│ │ │ │ +for the <a class="reference external" href="reference-Alerts.html#state_changed_alert">state_changed_alert</a> and then call <a class="reference external" href="reference-Session.html#pause()">pause()</a>. The download/seeding
│ │ │ │ +will most likely start in between posting the <a class="reference external" href="reference-Alerts.html#alert">alert</a> and receiving the
│ │ │ │ +call to pause.</p>
│ │ │ │ +<p class="last">A downloading state is one where peers are being connected. Which means
│ │ │ │ +just downloading the metadata via the <tt class="docutils literal">ut_metadata</tt> extension counts
│ │ │ │ +as a downloading state. In order to stop a torrent once the metadata
│ │ │ │ +has been downloaded, instead set all file priorities to dont_download</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::override_trackers"></a><dl class="docutils">
│ │ │ │ +<dt>override_trackers</dt>
│ │ │ │ +<dd>when this flag is set, the tracker list in the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>
│ │ │ │ +object override any trackers from the torrent file. If the flag is
│ │ │ │ +not set, the trackers from the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object will be
│ │ │ │ +added to the list of trackers used by the torrent.
│ │ │ │ +This flag is set by <a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a> if there are trackers present in
│ │ │ │ +the resume data file. This effectively makes the trackers saved in the
│ │ │ │ +resume data take precedence over the original trackers. This includes if
│ │ │ │ +there's an empty list of trackers, to support the case where they were
│ │ │ │ +explicitly removed in the previous <a class="reference external" href="reference-Session.html#session">session</a>.
│ │ │ │ +This flag is not saved by <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a></dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::override_web_seeds"></a><dl class="docutils">
│ │ │ │ +<dt>override_web_seeds</dt>
│ │ │ │ +<dd>If this flag is set, the web seeds from the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a>
│ │ │ │ +object will override any web seeds in the torrent file. If it's not
│ │ │ │ +set, web seeds in the <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object will be added to the
│ │ │ │ +list of web seeds used by the torrent.
│ │ │ │ +This flag is set by <a class="reference external" href="reference-Resume_Data.html#read_resume_data()">read_resume_data()</a> if there are web seeds present in
│ │ │ │ +the resume data file. This effectively makes the web seeds saved in the
│ │ │ │ +resume data take precedence over the original ones. This includes if
│ │ │ │ +there's an empty list of web seeds, to support the case where they were
│ │ │ │ +explicitly removed in the previous <a class="reference external" href="reference-Session.html#session">session</a>.
│ │ │ │ +This flag is not saved by <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a></dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::need_save_resume"></a><dl class="docutils">
│ │ │ │ +<dt>need_save_resume</dt>
│ │ │ │ +<dd><p class="first">if this flag is set (which it is by default) the torrent will be
│ │ │ │ +considered needing to save its resume data immediately, in the
│ │ │ │ +category if_metadata_changed. See resume_data_flags_t and
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> for details.</p>
│ │ │ │ +<p class="last">This flag is cleared by a successful call to <a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a>
│ │ │ │ +This flag is not saved by <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a>, since it represents an
│ │ │ │ +ephemeral state of a running torrent.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::disable_dht"></a><dl class="docutils">
│ │ │ │ +<dt>disable_dht</dt>
│ │ │ │ +<dd>set this flag to disable DHT for this torrent. This lets you have the DHT
│ │ │ │ +enabled for the whole client, and still have specific torrents not
│ │ │ │ +participating in it. i.e. not announcing to the DHT nor picking up peers
│ │ │ │ +from it.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::disable_lsd"></a><dl class="docutils">
│ │ │ │ +<dt>disable_lsd</dt>
│ │ │ │ +<dd>set this flag to disable local service discovery for this torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::disable_pex"></a><dl class="docutils">
│ │ │ │ +<dt>disable_pex</dt>
│ │ │ │ +<dd>set this flag to disable peer exchange for this torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::no_verify_files"></a><dl class="docutils">
│ │ │ │ +<dt>no_verify_files</dt>
│ │ │ │ +<dd>if this flag is set, the resume data will be assumed to be correct
│ │ │ │ +without validating it against any files on disk. This may be used when
│ │ │ │ +restoring a <a class="reference external" href="reference-Session.html#session">session</a> by loading resume data from disk. It will save time
│ │ │ │ +and also delay any hard disk errors until files are actually needed. If
│ │ │ │ +the resume data cannot be trusted, or if a torrent is added for the first
│ │ │ │ +time to some save path that may already have some of the files, this flag
│ │ │ │ +should not be set.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::default_dont_download"></a><dl class="docutils">
│ │ │ │ +<dt>default_dont_download</dt>
│ │ │ │ +<dd>default all file priorities to dont_download. This is useful for adding
│ │ │ │ +magnet links where the number of files is unknown, but the
│ │ │ │ +file_priorities is still set for some files. Any file not covered by
│ │ │ │ +the file_priorities list will be set to normal download priority,
│ │ │ │ +unless this flag is set, in which case they will be set to 0
│ │ │ │ +(dont_download).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::i2p_torrent"></a><dl class="docutils">
│ │ │ │ +<dt>i2p_torrent</dt>
│ │ │ │ +<dd>this flag makes the torrent be considered an &quot;i2p torrent&quot; for purposes
│ │ │ │ +of the allow_i2p_mixed setting. When mixing regular peers and i2p peers
│ │ │ │ +is disabled, i2p torrents won't add normal peers to its peer list.
│ │ │ │ +Note that non i2p torrents may still allow i2p peers (on the off-chance
│ │ │ │ +that a tracker return them and the <a class="reference external" href="reference-Session.html#session">session</a> is configured with a SAM
│ │ │ │ +connection).
│ │ │ │ +This flag is set automatically when adding a torrent that has at least
│ │ │ │ +one tracker whose hostname ends with .i2p.
│ │ │ │ +It's also set by <a class="reference external" href="reference-Core.html#parse_magnet_uri()">parse_magnet_uri()</a> if the tracker list contains such
│ │ │ │ +URL.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_flags_t::all"></a><dl class="docutils">
│ │ │ │ +<dt>all</dt>
│ │ │ │ +<dd>all torrent flags combined. Can conveniently be used when creating masks
│ │ │ │ +for flags</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="int"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:int&labels=documentation&body=Documentation+under+heading+%22int%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="int-1">
│ │ │ │ +<h1>int</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ +<a name="int::version_major"></a><dl class="docutils">
│ │ │ │ +<dt>version_major</dt>
│ │ │ │ +<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="int::version_minor"></a><dl class="docutils">
│ │ │ │ +<dt>version_minor</dt>
│ │ │ │ +<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="int::version_tiny"></a><dl class="docutils">
│ │ │ │ +<dt>version_tiny</dt>
│ │ │ │ +<dd>the major, minor and tiny versions of libtorrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pex_flags_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:pex_flags_t&labels=documentation&body=Documentation+under+heading+%22pex_flags_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="pex-flags-t">
│ │ │ │ +<h1>pex_flags_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/pex_flags.hpp">libtorrent/pex_flags.hpp</a>&quot;</p>
│ │ │ │ +<a name="pex_flags_t::pex_encryption"></a><dl class="docutils">
│ │ │ │ +<dt>pex_encryption</dt>
│ │ │ │ +<dd>the peer supports protocol encryption</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pex_flags_t::pex_seed"></a><dl class="docutils">
│ │ │ │ +<dt>pex_seed</dt>
│ │ │ │ +<dd>the peer is a seed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pex_flags_t::pex_utp"></a><dl class="docutils">
│ │ │ │ +<dt>pex_utp</dt>
│ │ │ │ +<dd>the peer supports the uTP, transport protocol over UDP.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pex_flags_t::pex_holepunch"></a><dl class="docutils">
│ │ │ │ +<dt>pex_holepunch</dt>
│ │ │ │ +<dd>the peer supports the holepunch extension If this flag is received from a
│ │ │ │ +peer, it can be used as a rendezvous point in case direct connections to
│ │ │ │ +the peer fail</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pex_flags_t::pex_lt_v2"></a><dl class="docutils">
│ │ │ │ +<dt>pex_lt_v2</dt>
│ │ │ │ +<dd>protocol v2
│ │ │ │ +this is not a standard flag, it is only used internally</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="char const*"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:char+const%2A&labels=documentation&body=Documentation+under+heading+%22char+const%2A%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="char-const">
│ │ │ │ +<h1>char const*</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ +<a name="char const*::version_str"></a><dl class="docutils">
│ │ │ │ +<dt>version_str</dt>
│ │ │ │ +<dd>the libtorrent version in string form</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="std::uint64_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:std%3A%3Auint64_t&labels=documentation&body=Documentation+under+heading+%22std%3A%3Auint64_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="std-uint64-t">
│ │ │ │ +<h1>std::uint64_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/version.hpp">libtorrent/version.hpp</a>&quot;</p>
│ │ │ │ +<a name="std::uint64_t::version_revision"></a><dl class="docutils">
│ │ │ │ +<dt>version_revision</dt>
│ │ │ │ +<dd>the git commit of this libtorrent version</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="download_priority_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:download_priority_t&labels=documentation&body=Documentation+under+heading+%22download_priority_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="download-priority-t">
│ │ │ │ +<h1>download_priority_t</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/download_priority.hpp">libtorrent/download_priority.hpp</a>&quot;</p>
│ │ │ │ +<a name="download_priority_t::dont_download"></a><dl class="docutils">
│ │ │ │ +<dt>dont_download</dt>
│ │ │ │ +<dd>Don't download the file or piece. Partial pieces may still be downloaded when
│ │ │ │ +setting file priorities.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="download_priority_t::default_priority"></a><dl class="docutils">
│ │ │ │ +<dt>default_priority</dt>
│ │ │ │ +<dd>The default priority for files and pieces.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="download_priority_t::low_priority"></a><dl class="docutils">
│ │ │ │ +<dt>low_priority</dt>
│ │ │ │ +<dd>The lowest priority for files and pieces.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="download_priority_t::top_priority"></a><dl class="docutils">
│ │ │ │ +<dt>top_priority</dt>
│ │ │ │ +<dd>The highest priority for files and pieces.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="bdecode_node"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+bdecode_node&labels=documentation&body=Documentation+under+heading+%22class+bdecode_node%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="bdecode-node">
│ │ │ │ +<h1>bdecode_node</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ +<p>Sometimes it's important to get a non-owning reference to the root node (
│ │ │ │ +to be able to copy it as a reference for instance). For that, use the
│ │ │ │ +<a class="reference external" href="reference-Bdecoding.html#non_owning()">non_owning()</a> member function.</p>
│ │ │ │ +<p>There are 5 different types of nodes, see <a class="reference external" href="reference-Bdecoding.html#type_t">type_t</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct bdecode_node
│ │ │ │ +{
│ │ │ │ +   <strong>bdecode_node</strong> () = default;
│ │ │ │ +   <strong>bdecode_node</strong> (bdecode_node&amp;&amp;) noexcept;
│ │ │ │ +   bdecode_node&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │ +   bdecode_node&amp; <strong>operator=</strong> (bdecode_node&amp;&amp;) &amp; = default;
│ │ │ │ +   <strong>bdecode_node</strong> (bdecode_node const&amp;);
│ │ │ │ +   type_t <strong>type</strong> () const noexcept;
│ │ │ │ +   explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ +   bdecode_node <strong>non_owning</strong> () const;
│ │ │ │ +   std::ptrdiff_t <strong>data_offset</strong> () const noexcept;
│ │ │ │ +   span&lt;char const&gt; <strong>data_section</strong> () const noexcept;
│ │ │ │ +   bdecode_node <strong>list_at</strong> (int i) const;
│ │ │ │ +   string_view <strong>list_string_value_at</strong> (int i
│ │ │ │ +      , string_view default_val = string_view()) const;
│ │ │ │ +   int <strong>list_size</strong> () const;
│ │ │ │ +   std::int64_t <strong>list_int_value_at</strong> (int i
│ │ │ │ +      , std::int64_t default_val = 0) const;
│ │ │ │ +   bdecode_node <strong>dict_find_int</strong> (string_view key) const;
│ │ │ │ +   string_view <strong>dict_find_string_value</strong> (string_view key
│ │ │ │ +      , string_view default_value = string_view()) const;
│ │ │ │ +   int <strong>dict_size</strong> () const;
│ │ │ │ +   bdecode_node <strong>dict_find_dict</strong> (string_view key) const;
│ │ │ │ +   std::int64_t <strong>dict_find_int_value</strong> (string_view key
│ │ │ │ +      , std::int64_t default_val = 0) const;
│ │ │ │ +   bdecode_node <strong>dict_find_list</strong> (string_view key) const;
│ │ │ │ +   bdecode_node <strong>dict_find</strong> (string_view key) const;
│ │ │ │ +   std::pair&lt;bdecode_node, bdecode_node&gt; <strong>dict_at_node</strong> (int i) const;
│ │ │ │ +   std::pair&lt;string_view, bdecode_node&gt; <strong>dict_at</strong> (int i) const;
│ │ │ │ +   bdecode_node <strong>dict_find_string</strong> (string_view key) const;
│ │ │ │ +   std::int64_t <strong>int_value</strong> () const;
│ │ │ │ +   char const* <strong>string_ptr</strong> () const;
│ │ │ │ +   std::ptrdiff_t <strong>string_offset</strong> () const;
│ │ │ │ +   string_view <strong>string_value</strong> () const;
│ │ │ │ +   int <strong>string_length</strong> () const;
│ │ │ │ +   void <strong>clear</strong> ();
│ │ │ │ +   void <strong>swap</strong> (bdecode_node&amp; n);
│ │ │ │ +   void <strong>reserve</strong> (int tokens);
│ │ │ │ +   void <strong>switch_underlying_buffer</strong> (char const* buf) noexcept;
│ │ │ │ +   bool <strong>has_soft_error</strong> (span&lt;char&gt; error) const;
│ │ │ │ +
│ │ │ │ +   enum type_t
│ │ │ │ +   {
│ │ │ │ +      none_t,
│ │ │ │ +      dict_t,
│ │ │ │ +      list_t,
│ │ │ │ +      string_t,
│ │ │ │ +      int_t,
│ │ │ │ +   };
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="bdecode_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bbdecode_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bbdecode_node%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="bdecode-node-1">
│ │ │ │ +<h2>bdecode_node()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>bdecode_node</strong> () = default;
│ │ │ │ +</pre>
│ │ │ │ +<p>creates a default constructed node, it will have the type <tt class="docutils literal">none_t</tt>.</p>
│ │ │ │ +<a name="bdecode_node()"></a>
│ │ │ │ +<a name="operator=()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bbdecode_node%28%29+operator%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bbdecode_node%28%29+operator%3D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="bdecode-node-operator">
│ │ │ │ +<h2>bdecode_node() operator=()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>bdecode_node</strong> (bdecode_node&amp;&amp;) noexcept;
│ │ │ │ +bdecode_node&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │ +bdecode_node&amp; <strong>operator=</strong> (bdecode_node&amp;&amp;) &amp; = default;
│ │ │ │ +<strong>bdecode_node</strong> (bdecode_node const&amp;);
│ │ │ │ +</pre>
│ │ │ │ +<p>For owning nodes, the copy will create a copy of the tree, but the
│ │ │ │ +underlying buffer remains the same.</p>
│ │ │ │ +<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="type-2">
│ │ │ │ +<h2>type()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +type_t <strong>type</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>the type of this node. See <a class="reference external" href="reference-Bdecoding.html#type_t">type_t</a>.</p>
│ │ │ │ +<a name="bool()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bbool%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bbool%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="bool-1">
│ │ │ │ +<h2>bool()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if <a class="reference external" href="reference-Bencoding.html#type()">type()</a> != none_t.</p>
│ │ │ │ +<a name="non_owning()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bnon_owning%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bnon_owning%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="non-owning">
│ │ │ │ +<h2>non_owning()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bdecode_node <strong>non_owning</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>return a non-owning reference to this node. This is useful to refer to
│ │ │ │ +the root node without copying it in assignments.</p>
│ │ │ │ +<a name="data_section()"></a>
│ │ │ │ +<a name="data_offset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bdata_section%28%29+data_offset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bdata_section%28%29+data_offset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="data-section-data-offset">
│ │ │ │ +<h2>data_section() data_offset()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::ptrdiff_t <strong>data_offset</strong> () const noexcept;
│ │ │ │ +span&lt;char const&gt; <strong>data_section</strong> () const noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the buffer and length of the section in the original bencoded
│ │ │ │ +buffer where this node is defined. For a dictionary for instance, this
│ │ │ │ +starts with <tt class="docutils literal">d</tt> and ends with <tt class="docutils literal">e</tt>, and has all the content of the
│ │ │ │ +dictionary in between.
│ │ │ │ +the <tt class="docutils literal">data_offset()</tt> function returns the byte-offset to this node in,
│ │ │ │ +starting from the beginning of the buffer that was parsed.</p>
│ │ │ │ +<a name="list_size()"></a>
│ │ │ │ +<a name="list_at()"></a>
│ │ │ │ +<a name="list_string_value_at()"></a>
│ │ │ │ +<a name="list_int_value_at()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Blist_size%28%29+list_at%28%29+list_string_value_at%28%29+list_int_value_at%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Blist_size%28%29+list_at%28%29+list_string_value_at%28%29+list_int_value_at%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="list-size-list-at-list-string-value-at-list-int-value-at">
│ │ │ │ +<h2>list_size() list_at() list_string_value_at() list_int_value_at()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bdecode_node <strong>list_at</strong> (int i) const;
│ │ │ │ +string_view <strong>list_string_value_at</strong> (int i
│ │ │ │ +      , string_view default_val = string_view()) const;
│ │ │ │ +int <strong>list_size</strong> () const;
│ │ │ │ +std::int64_t <strong>list_int_value_at</strong> (int i
│ │ │ │ +      , std::int64_t default_val = 0) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>functions with the <tt class="docutils literal">list_</tt> prefix operate on lists. These functions are
│ │ │ │ +only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">list_t</tt>. <tt class="docutils literal">list_at()</tt> returns the item
│ │ │ │ +in the list at index <tt class="docutils literal">i</tt>. <tt class="docutils literal">i</tt> may not be greater than or equal to the
│ │ │ │ +size of the list. <tt class="docutils literal">size()</tt> returns the size of the list.</p>
│ │ │ │ +<a name="dict_at_node()"></a>
│ │ │ │ +<a name="dict_find_int()"></a>
│ │ │ │ +<a name="dict_find_int_value()"></a>
│ │ │ │ +<a name="dict_find_list()"></a>
│ │ │ │ +<a name="dict_find()"></a>
│ │ │ │ +<a name="dict_at()"></a>
│ │ │ │ +<a name="dict_size()"></a>
│ │ │ │ +<a name="dict_find_string()"></a>
│ │ │ │ +<a name="dict_find_string_value()"></a>
│ │ │ │ +<a name="dict_find_dict()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bdict_at_node%28%29+dict_find_int%28%29+dict_find_int_value%28%29+dict_find_list%28%29+dict_find%28%29+dict_at%28%29+dict_size%28%29+dict_find_string%28%29+dict_find_string_value%28%29+dict_find_dict%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bdict_at_node%28%29+dict_find_int%28%29+dict_find_int_value%28%29+dict_find_list%28%29+dict_find%28%29+dict_at%28%29+dict_size%28%29+dict_find_string%28%29+dict_find_string_value%28%29+dict_find_dict%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dict-at-node-dict-find-int-dict-find-int-value-dict-find-list-dict-find-dict-at-dict-size-dict-find-string-dict-find-string-value-dict-find-dict">
│ │ │ │ +<h2>dict_at_node() dict_find_int() dict_find_int_value() dict_find_list() dict_find() dict_at() dict_size() dict_find_string() dict_find_string_value() dict_find_dict()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bdecode_node <strong>dict_find_int</strong> (string_view key) const;
│ │ │ │ +string_view <strong>dict_find_string_value</strong> (string_view key
│ │ │ │ +      , string_view default_value = string_view()) const;
│ │ │ │ +int <strong>dict_size</strong> () const;
│ │ │ │ +bdecode_node <strong>dict_find_dict</strong> (string_view key) const;
│ │ │ │ +std::int64_t <strong>dict_find_int_value</strong> (string_view key
│ │ │ │ +      , std::int64_t default_val = 0) const;
│ │ │ │ +bdecode_node <strong>dict_find_list</strong> (string_view key) const;
│ │ │ │ +bdecode_node <strong>dict_find</strong> (string_view key) const;
│ │ │ │ +std::pair&lt;bdecode_node, bdecode_node&gt; <strong>dict_at_node</strong> (int i) const;
│ │ │ │ +std::pair&lt;string_view, bdecode_node&gt; <strong>dict_at</strong> (int i) const;
│ │ │ │ +bdecode_node <strong>dict_find_string</strong> (string_view key) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>Functions with the <tt class="docutils literal">dict_</tt> prefix operates on dictionaries. They are
│ │ │ │ +only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">dict_t</tt>. In case a key you're looking up
│ │ │ │ +contains a 0 byte, you cannot use the 0-terminated string overloads,
│ │ │ │ +but have to use <tt class="docutils literal">string_view</tt> instead. <tt class="docutils literal">dict_find_list</tt> will return a
│ │ │ │ +valid <tt class="docutils literal">bdecode_node</tt> if the key is found _and_ it is a list. Otherwise
│ │ │ │ +it will return a default-constructed <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>.</p>
│ │ │ │ +<p>Functions with the <tt class="docutils literal">_value</tt> suffix return the value of the node
│ │ │ │ +directly, rather than the nodes. In case the node is not found, or it has
│ │ │ │ +a different type, a default value is returned (which can be specified).</p>
│ │ │ │ +<p><tt class="docutils literal">dict_at()</tt> returns the (key, value)-pair at the specified index in a
│ │ │ │ +dictionary. Keys are only allowed to be strings. <tt class="docutils literal">dict_at_node()</tt> also
│ │ │ │ +returns the (key, value)-pair, but the key is returned as a
│ │ │ │ +<tt class="docutils literal">bdecode_node</tt> (and it will always be a string).</p>
│ │ │ │ +<a name="int_value()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bint_value%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bint_value%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="int-value">
│ │ │ │ +<h2>int_value()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::int64_t <strong>int_value</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>this function is only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">int_t</tt>. It returns the
│ │ │ │ +value of the integer.</p>
│ │ │ │ +<a name="string_offset()"></a>
│ │ │ │ +<a name="string_ptr()"></a>
│ │ │ │ +<a name="string_value()"></a>
│ │ │ │ +<a name="string_length()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bstring_offset%28%29+string_ptr%28%29+string_value%28%29+string_length%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bstring_offset%28%29+string_ptr%28%29+string_value%28%29+string_length%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="string-offset-string-ptr-string-value-string-length">
│ │ │ │ +<h2>string_offset() string_ptr() string_value() string_length()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +char const* <strong>string_ptr</strong> () const;
│ │ │ │ +std::ptrdiff_t <strong>string_offset</strong> () const;
│ │ │ │ +string_view <strong>string_value</strong> () const;
│ │ │ │ +int <strong>string_length</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>these functions are only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">string_t</tt>. They return
│ │ │ │ +the string values. Note that <tt class="docutils literal">string_ptr()</tt> is <em>not</em> 0-terminated.
│ │ │ │ +<tt class="docutils literal">string_length()</tt> returns the number of bytes in the string.
│ │ │ │ +<tt class="docutils literal">string_offset()</tt> returns the byte offset from the start of the parsed
│ │ │ │ +bencoded buffer this string can be found.</p>
│ │ │ │ +<a name="clear()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bclear%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bclear%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="clear-2">
│ │ │ │ +<h2>clear()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>clear</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>resets the <tt class="docutils literal">bdecoded_node</tt> to a default constructed state. If this is
│ │ │ │ +an owning node, the tree is freed and all child nodes are invalidated.</p>
│ │ │ │ +<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="swap-3">
│ │ │ │ +<h2>swap()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>swap</strong> (bdecode_node&amp; n);
│ │ │ │ +</pre>
│ │ │ │ +<p>Swap contents.</p>
│ │ │ │ +<a name="reserve()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Breserve%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Breserve%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="reserve-1">
│ │ │ │ +<h2>reserve()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>reserve</strong> (int tokens);
│ │ │ │ +</pre>
│ │ │ │ +<p>preallocate memory for the specified numbers of tokens. This is
│ │ │ │ +useful if you know approximately how many tokens are in the file
│ │ │ │ +you are about to parse. Doing so will save realloc operations
│ │ │ │ +while parsing. You should only call this on the root node, before
│ │ │ │ +passing it in to <a class="reference external" href="reference-Bdecoding.html#bdecode()">bdecode()</a>.</p>
│ │ │ │ +<a name="switch_underlying_buffer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bswitch_underlying_buffer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bswitch_underlying_buffer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="switch-underlying-buffer">
│ │ │ │ +<h2>switch_underlying_buffer()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>switch_underlying_buffer</strong> (char const* buf) noexcept;
│ │ │ │ +</pre>
│ │ │ │ +<p>this buffer <em>MUST</em> be identical to the one originally parsed. This
│ │ │ │ +operation is only defined on owning root nodes, i.e. the one passed in to
│ │ │ │ +decode().</p>
│ │ │ │ +<a name="has_soft_error()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bhas_soft_error%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bhas_soft_error%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="has-soft-error">
│ │ │ │ +<h2>has_soft_error()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>has_soft_error</strong> (span&lt;char&gt; error) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns true if there is a non-fatal error in the bencoding of this node
│ │ │ │ +or its children</p>
│ │ │ │ +<a name="type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+type_t&labels=documentation&body=Documentation+under+heading+%22enum+type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-type-t-1">
│ │ │ │ +<h2>enum type_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="26%" />
│ │ │ │  <col width="13%" />
│ │ │ │ -<col width="60%" />
│ │ │ │ +<col width="9%" />
│ │ │ │ +<col width="78%" />
│ │ │ │  </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>pe_plaintext</td>
│ │ │ │ +<tr><td>none_t</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>uninitialized or default constructed. This is also used
│ │ │ │ +to indicate that a node was not found in some cases.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>dict_t</td>
│ │ │ │  <td>1</td>
│ │ │ │ -<td>use only plain text encryption</td>
│ │ │ │ +<td>a dictionary node. The <tt class="docutils literal">dict_find_</tt> functions are valid.</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>pe_rc4</td>
│ │ │ │ +<tr><td>list_t</td>
│ │ │ │  <td>2</td>
│ │ │ │ -<td>use only RC4 encryption</td>
│ │ │ │ +<td>a list node. The <tt class="docutils literal">list_</tt> functions are valid.</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>pe_both</td>
│ │ │ │ +<tr><td>string_t</td>
│ │ │ │  <td>3</td>
│ │ │ │ -<td>allow both</td>
│ │ │ │ +<td>a string node, the <tt class="docutils literal">string_</tt> functions are valid.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>int_t</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>an integer node. The <tt class="docutils literal">int_</tt> functions are valid.</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="proxy_type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+proxy_type_t&labels=documentation&body=Documentation+under+heading+%22enum+proxy_type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-proxy-type-t">
│ │ │ │ -<h2>enum proxy_type_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<a name="print_entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:print_entry%28%29&labels=documentation&body=Documentation+under+heading+%22print_entry%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="print-entry">
│ │ │ │ +<h1>print_entry()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::string <strong>print_entry</strong> (bdecode_node const&amp; e
│ │ │ │ +   , bool single_line = false, int indent = 0);
│ │ │ │ +</pre>
│ │ │ │ +<p>print the bencoded structure in a human-readable format to a string
│ │ │ │ +that's returned.</p>
│ │ │ │ +<a name="bdecode()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode%28%29&labels=documentation&body=Documentation+under+heading+%22bdecode%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="bdecode">
│ │ │ │ +<h1>bdecode()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +int <strong>bdecode</strong> (char const* start, char const* end, bdecode_node&amp; ret
│ │ │ │ +   , error_code&amp; ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ +   , int token_limit = 2000000);
│ │ │ │ +bdecode_node <strong>bdecode</strong> (span&lt;char const&gt; buffer
│ │ │ │ +   , int depth_limit = 100, int token_limit = 2000000);
│ │ │ │ +bdecode_node <strong>bdecode</strong> (span&lt;char const&gt; buffer
│ │ │ │ +   , error_code&amp; ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ +   , int token_limit = 2000000);
│ │ │ │ +</pre>
│ │ │ │ +<p>This function decodes/parses bdecoded data (for example a .torrent file).
│ │ │ │ +The data structure is returned in the <tt class="docutils literal">ret</tt> argument. the buffer to parse
│ │ │ │ +is specified by the <tt class="docutils literal">start</tt> of the buffer as well as the <tt class="docutils literal">end</tt>, i.e. one
│ │ │ │ +byte past the end. If the buffer fails to parse, the function returns a
│ │ │ │ +non-zero value and fills in <tt class="docutils literal">ec</tt> with the error code. The optional
│ │ │ │ +argument <tt class="docutils literal">error_pos</tt>, if set to non-nullptr, will be set to the byte offset
│ │ │ │ +into the buffer where the parse failure occurred.</p>
│ │ │ │ +<p><tt class="docutils literal">depth_limit</tt> specifies the max number of nested lists or dictionaries are
│ │ │ │ +allowed in the data structure. (This affects the stack usage of the
│ │ │ │ +function, be careful not to set it too high).</p>
│ │ │ │ +<p><tt class="docutils literal">token_limit</tt> is the max number of tokens allowed to be parsed from the
│ │ │ │ +buffer. This is simply a sanity check to not have unbounded memory usage.</p>
│ │ │ │ +<p>The resulting <tt class="docutils literal">bdecode_node</tt> is an <em>owning</em> node. That means it will
│ │ │ │ +be holding the whole parsed tree. When iterating lists and dictionaries,
│ │ │ │ +those <tt class="docutils literal">bdecode_node</tt> objects will simply have references to the root or
│ │ │ │ +owning <tt class="docutils literal">bdecode_node</tt>. If the root node is destructed, all other nodes
│ │ │ │ +that refer to anything in that tree become invalid.</p>
│ │ │ │ +<p>However, the underlying buffer passed in to this function (<tt class="docutils literal">start</tt>, <tt class="docutils literal">end</tt>)
│ │ │ │ +must also remain valid while the bdecoded tree is used. The parsed tree
│ │ │ │ +produced by this function does not copy any data out of the buffer, but
│ │ │ │ +simply produces references back into it.</p>
│ │ │ │ +<a name="torrent_status"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_status&labels=documentation&body=Documentation+under+heading+%22class+torrent_status%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="torrent-status">
│ │ │ │ +<h1>torrent_status</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_status.hpp">libtorrent/torrent_status.hpp</a>&quot;</p>
│ │ │ │ +<p>holds a snapshot of the status of a torrent, as queried by
│ │ │ │ +<a class="reference external" href="reference-Torrent_Handle.html#status()">torrent_handle::status()</a>.</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +struct torrent_status
│ │ │ │ +{
│ │ │ │ +   bool <strong>operator==</strong> (torrent_status const&amp; st) const;
│ │ │ │ +
│ │ │ │ +   enum state_t
│ │ │ │ +   {
│ │ │ │ +      checking_files,
│ │ │ │ +      downloading_metadata,
│ │ │ │ +      downloading,
│ │ │ │ +      finished,
│ │ │ │ +      seeding,
│ │ │ │ +      unused_enum_for_backwards_compatibility_allocating,
│ │ │ │ +      checking_resume_data,
│ │ │ │ +   };
│ │ │ │ +
│ │ │ │ +   torrent_handle handle;
│ │ │ │ +   error_code errc;
│ │ │ │ +   file_index_t <strong>error_file</strong>  = torrent_status::error_file_none;
│ │ │ │ +   static constexpr file_index_t <strong>error_file_none</strong> {-1};
│ │ │ │ +   static constexpr file_index_t <strong>error_file_ssl_ctx</strong> {-3};
│ │ │ │ +   static constexpr file_index_t <strong>error_file_metadata</strong> {-4};
│ │ │ │ +   static constexpr file_index_t <strong>error_file_exception</strong> {-5};
│ │ │ │ +   static constexpr file_index_t <strong>error_file_partfile</strong> {-6};
│ │ │ │ +   std::string save_path;
│ │ │ │ +   std::string name;
│ │ │ │ +   std::weak_ptr&lt;const torrent_info&gt; torrent_file;
│ │ │ │ +   time_duration <strong>next_announce</strong>  = seconds{0};
│ │ │ │ +   std::string current_tracker;
│ │ │ │ +   std::int64_t <strong>total_download</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>total_upload</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>total_payload_download</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>total_payload_upload</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>total_failed_bytes</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>total_redundant_bytes</strong>  = 0;
│ │ │ │ +   typed_bitfield&lt;piece_index_t&gt; pieces;
│ │ │ │ +   typed_bitfield&lt;piece_index_t&gt; verified_pieces;
│ │ │ │ +   std::int64_t <strong>total_done</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>total</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>total_wanted_done</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>total_wanted</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>all_time_upload</strong>  = 0;
│ │ │ │ +   std::int64_t <strong>all_time_download</strong>  = 0;
│ │ │ │ +   std::time_t <strong>added_time</strong>  = 0;
│ │ │ │ +   std::time_t <strong>completed_time</strong>  = 0;
│ │ │ │ +   std::time_t <strong>last_seen_complete</strong>  = 0;
│ │ │ │ +   storage_mode_t <strong>storage_mode</strong>  = storage_mode_sparse;
│ │ │ │ +   float <strong>progress</strong>  = 0.f;
│ │ │ │ +   int <strong>progress_ppm</strong>  = 0;
│ │ │ │ +   queue_position_t <strong>queue_position</strong> {};
│ │ │ │ +   int <strong>download_rate</strong>  = 0;
│ │ │ │ +   int <strong>upload_rate</strong>  = 0;
│ │ │ │ +   int <strong>download_payload_rate</strong>  = 0;
│ │ │ │ +   int <strong>upload_payload_rate</strong>  = 0;
│ │ │ │ +   int <strong>num_seeds</strong>  = 0;
│ │ │ │ +   int <strong>num_peers</strong>  = 0;
│ │ │ │ +   int <strong>num_complete</strong>  = -1;
│ │ │ │ +   int <strong>num_incomplete</strong>  = -1;
│ │ │ │ +   int <strong>list_seeds</strong>  = 0;
│ │ │ │ +   int <strong>list_peers</strong>  = 0;
│ │ │ │ +   int <strong>connect_candidates</strong>  = 0;
│ │ │ │ +   int <strong>num_pieces</strong>  = 0;
│ │ │ │ +   int <strong>distributed_full_copies</strong>  = 0;
│ │ │ │ +   int <strong>distributed_fraction</strong>  = 0;
│ │ │ │ +   float <strong>distributed_copies</strong>  = 0.f;
│ │ │ │ +   int <strong>block_size</strong>  = 0;
│ │ │ │ +   int <strong>num_uploads</strong>  = 0;
│ │ │ │ +   int <strong>num_connections</strong>  = 0;
│ │ │ │ +   int <strong>uploads_limit</strong>  = 0;
│ │ │ │ +   int <strong>connections_limit</strong>  = 0;
│ │ │ │ +   int <strong>up_bandwidth_queue</strong>  = 0;
│ │ │ │ +   int <strong>down_bandwidth_queue</strong>  = 0;
│ │ │ │ +   int <strong>seed_rank</strong>  = 0;
│ │ │ │ +   state_t <strong>state</strong>  = checking_resume_data;
│ │ │ │ +   bool <strong>need_save_resume</strong>  = false;
│ │ │ │ +   bool <strong>is_seeding</strong>  = false;
│ │ │ │ +   bool <strong>is_finished</strong>  = false;
│ │ │ │ +   bool <strong>has_metadata</strong>  = false;
│ │ │ │ +   bool <strong>has_incoming</strong>  = false;
│ │ │ │ +   bool <strong>moving_storage</strong>  = false;
│ │ │ │ +   bool <strong>announcing_to_trackers</strong>  = false;
│ │ │ │ +   bool <strong>announcing_to_lsd</strong>  = false;
│ │ │ │ +   bool <strong>announcing_to_dht</strong>  = false;
│ │ │ │ +   info_hash_t info_hashes;
│ │ │ │ +   time_point last_upload;
│ │ │ │ +   time_point last_download;
│ │ │ │ +   seconds active_duration;
│ │ │ │ +   seconds finished_duration;
│ │ │ │ +   seconds seeding_duration;
│ │ │ │ +   torrent_flags_t <strong>flags</strong> {};
│ │ │ │ +};
│ │ │ │ +</pre>
│ │ │ │ +<a name="operator==()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Boperator%3D%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Boperator%3D%3D%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="operator-3">
│ │ │ │ +<h2>operator==()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +bool <strong>operator==</strong> (torrent_status const&amp; st) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>compares if the torrent status objects come from the same torrent. i.e.
│ │ │ │ +only the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> field is compared.</p>
│ │ │ │ +<a name="state_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+state_t&labels=documentation&body=Documentation+under+heading+%22enum+state_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-state-t">
│ │ │ │ +<h2>enum state_t</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/torrent_status.hpp">libtorrent/torrent_status.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="11%" />
│ │ │ │ -<col width="7%" />
│ │ │ │ -<col width="81%" />
│ │ │ │ +<col width="44%" />
│ │ │ │ +<col width="6%" />
│ │ │ │ +<col width="50%" />
│ │ │ │  </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>none</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>No proxy server is used and all other fields are ignored.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>socks4</td>
│ │ │ │ +<tr><td>checking_files</td>
│ │ │ │  <td>1</td>
│ │ │ │ -<td>The server is assumed to be a <a class="reference external" href="http://www.ufasoft.com/doc/socks4_protocol.htm">SOCKS4 server</a> that requires a
│ │ │ │ -username.</td>
│ │ │ │ +<td>The torrent has not started its download yet, and is
│ │ │ │ +currently checking existing files.</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>socks5</td>
│ │ │ │ +<tr><td>downloading_metadata</td>
│ │ │ │  <td>2</td>
│ │ │ │ -<td>The server is assumed to be a SOCKS5 server (<a class="reference external" href="http://www.faqs.org/rfcs/rfc1928.html">RFC 1928</a>) that does
│ │ │ │ -not require any authentication. The username and password are
│ │ │ │ -ignored.</td>
│ │ │ │ +<td>The torrent is trying to download metadata from peers.
│ │ │ │ +This implies the ut_metadata extension is in use.</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>socks5_pw</td>
│ │ │ │ +<tr><td>downloading</td>
│ │ │ │  <td>3</td>
│ │ │ │ -<td>The server is assumed to be a SOCKS5 server that supports plain
│ │ │ │ -text username and password authentication (<a class="reference external" href="http://www.faqs.org/rfcs/rfc1929.html">RFC 1929</a>). The
│ │ │ │ -username and password specified may be sent to the proxy if it
│ │ │ │ -requires.</td>
│ │ │ │ +<td>The torrent is being downloaded. This is the state
│ │ │ │ +most torrents will be in most of the time. The progress
│ │ │ │ +meter will tell how much of the files that has been
│ │ │ │ +downloaded.</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>http</td>
│ │ │ │ +<tr><td>finished</td>
│ │ │ │  <td>4</td>
│ │ │ │ -<td>The server is assumed to be an HTTP proxy. If the transport used
│ │ │ │ -for the connection is non-HTTP, the server is assumed to support
│ │ │ │ -the <a class="reference external" href="http://tools.ietf.org/html/draft-luotonen-web-proxy-tunneling-01">CONNECT</a> method. i.e. for web seeds and HTTP trackers, a plain
│ │ │ │ -proxy will suffice. The proxy is assumed to not require
│ │ │ │ -authorization. The username and password will not be used.</td>
│ │ │ │ +<td>In this state the torrent has finished downloading but
│ │ │ │ +still doesn't have the entire torrent. i.e. some pieces
│ │ │ │ +are filtered and won't get downloaded.</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>http_pw</td>
│ │ │ │ +<tr><td>seeding</td>
│ │ │ │  <td>5</td>
│ │ │ │ -<td>The server is assumed to be an HTTP proxy that requires user
│ │ │ │ -authorization. The username and password will be sent to the proxy.</td>
│ │ │ │ +<td>In this state the torrent has finished downloading and
│ │ │ │ +is a pure seeder.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>unused_enum_for_backwards_compatibility_allocating</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>If the torrent was started in full allocation mode, this
│ │ │ │ +indicates that the (disk) storage for the torrent is
│ │ │ │ +allocated.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>checking_resume_data</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>The torrent is currently checking the fast resume data and
│ │ │ │ +comparing it to the files on disk. This is typically
│ │ │ │ +completed in a fraction of a second, but if you add a
│ │ │ │ +large number of torrents at once, they will queue up.</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="min_memory_usage()"></a>
│ │ │ │ -<a name="high_performance_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:min_memory_usage%28%29+high_performance_seed%28%29&labels=documentation&body=Documentation+under+heading+%22min_memory_usage%28%29+high_performance_seed%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<a name="handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bhandle%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bhandle%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>handle</dt>
│ │ │ │ +<dd>a handle to the torrent whose status the object represents.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="errc"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berrc%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berrc%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>errc</dt>
│ │ │ │ +<dd>may be set to an error code describing why the torrent was paused, in
│ │ │ │ +case it was paused by an error. If the torrent is not paused or if it's
│ │ │ │ +paused but not because of an error, this error_code is not set.
│ │ │ │ +if the error is attributed specifically to a file, error_file is set to
│ │ │ │ +the index of that file in the .torrent file.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error_file"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error_file</dt>
│ │ │ │ +<dd>if the torrent is stopped because of an disk I/O error, this field
│ │ │ │ +contains the index of the file in the torrent that encountered the
│ │ │ │ +error. If the error did not originate in a file in the torrent, there
│ │ │ │ +are a few special values this can be set to: error_file_none,
│ │ │ │ +error_file_ssl_ctx, error_file_exception, error_file_partfile or
│ │ │ │ +error_file_metadata;</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error_file_none"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file_none%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file_none%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error_file_none</dt>
│ │ │ │ +<dd>special values for error_file to describe which file or component
│ │ │ │ +encountered the error (<tt class="docutils literal">errc</tt>).
│ │ │ │ +the error did not occur on a file</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error_file_ssl_ctx"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file_ssl_ctx%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file_ssl_ctx%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error_file_ssl_ctx</dt>
│ │ │ │ +<dd>the error occurred setting up the SSL context</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error_file_metadata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file_metadata%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file_metadata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error_file_metadata</dt>
│ │ │ │ +<dd>the error occurred while loading the metadata for the torrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error_file_exception"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file_exception%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file_exception%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error_file_exception</dt>
│ │ │ │ +<dd>there was a serious error reported in this torrent. The error code
│ │ │ │ +or a torrent log <a class="reference external" href="reference-Alerts.html#alert">alert</a> may provide more information.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="error_file_partfile"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Berror_file_partfile%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Berror_file_partfile%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>error_file_partfile</dt>
│ │ │ │ +<dd>the error occurred with the partfile</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="save_path"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bsave_path%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bsave_path%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>save_path</dt>
│ │ │ │ +<dd>the path to the directory where this torrent's files are stored.
│ │ │ │ +It's typically the path as was given to <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a> or
│ │ │ │ +<a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> when this torrent was started. This field is only
│ │ │ │ +included if the torrent status is queried with
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_handle::query_save_path</span></tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="name"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bname%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bname%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>name</dt>
│ │ │ │ +<dd>the name of the torrent. Typically this is derived from the
│ │ │ │ +.torrent file. In case the torrent was started without metadata,
│ │ │ │ +and hasn't completely received it yet, it returns the name given
│ │ │ │ +to it when added to the <a class="reference external" href="reference-Session.html#session">session</a>. See <tt class="docutils literal"><span class="pre">session::add_torrent</span></tt>.
│ │ │ │ +This field is only included if the torrent status is queried
│ │ │ │ +with <tt class="docutils literal"><span class="pre">torrent_handle::query_name</span></tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="torrent_file"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btorrent_file%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btorrent_file%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>torrent_file</dt>
│ │ │ │ +<dd>set to point to the <tt class="docutils literal">torrent_info</tt> object for this torrent. It's
│ │ │ │ +only included if the torrent status is queried with
│ │ │ │ +<tt class="docutils literal"><span class="pre">torrent_handle::query_torrent_file</span></tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="next_announce"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnext_announce%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnext_announce%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>next_announce</dt>
│ │ │ │ +<dd>the time until the torrent will announce itself to the tracker.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="current_tracker"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bcurrent_tracker%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bcurrent_tracker%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>current_tracker</dt>
│ │ │ │ +<dd>the URL of the last working tracker. If no tracker request has
│ │ │ │ +been successful yet, it's set to an empty string.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="total_download"></a>
│ │ │ │ +<a name="total_upload"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_download+total_upload%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_download+total_upload%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>total_download total_upload</dt>
│ │ │ │ +<dd>the number of bytes downloaded and uploaded to all peers, accumulated,
│ │ │ │ +<em>this session</em> only. The <a class="reference external" href="reference-Session.html#session">session</a> is considered to restart when a
│ │ │ │ +torrent is paused and restarted again. When a torrent is paused, these
│ │ │ │ +<a class="reference external" href="reference-Stats.html#counters">counters</a> are reset to 0. If you want complete, persistent, stats, see
│ │ │ │ +<tt class="docutils literal">all_time_upload</tt> and <tt class="docutils literal">all_time_download</tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="total_payload_download"></a>
│ │ │ │ +<a name="total_payload_upload"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_payload_download+total_payload_upload%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_payload_download+total_payload_upload%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>total_payload_download total_payload_upload</dt>
│ │ │ │ +<dd>counts the amount of bytes send and received this <a class="reference external" href="reference-Session.html#session">session</a>, but only
│ │ │ │ +the actual payload data (i.e the interesting data), these <a class="reference external" href="reference-Stats.html#counters">counters</a>
│ │ │ │ +ignore any protocol overhead. The <a class="reference external" href="reference-Session.html#session">session</a> is considered to restart
│ │ │ │ +when a torrent is paused and restarted again. When a torrent is
│ │ │ │ +paused, these <a class="reference external" href="reference-Stats.html#counters">counters</a> are reset to 0.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="total_failed_bytes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_failed_bytes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_failed_bytes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>total_failed_bytes</dt>
│ │ │ │ +<dd>the number of bytes that has been downloaded and that has failed the
│ │ │ │ +piece hash test. In other words, this is just how much crap that has
│ │ │ │ +been downloaded since the torrent was last started. If a torrent is
│ │ │ │ +paused and then restarted again, this counter will be reset.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="total_redundant_bytes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_redundant_bytes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_redundant_bytes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>total_redundant_bytes</dt>
│ │ │ │ +<dd>the number of bytes that has been downloaded even though that data
│ │ │ │ +already was downloaded. The reason for this is that in some situations
│ │ │ │ +the same data can be downloaded by mistake. When libtorrent sends
│ │ │ │ +requests to a peer, and the peer doesn't send a response within a
│ │ │ │ +certain timeout, libtorrent will re-request that block. Another
│ │ │ │ +situation when libtorrent may re-request blocks is when the requests
│ │ │ │ +it sends out are not replied in FIFO-order (it will re-request blocks
│ │ │ │ +that are skipped by an out of order block). This is supposed to be as
│ │ │ │ +low as possible. This only counts bytes since the torrent was last
│ │ │ │ +started. If a torrent is paused and then restarted again, this counter
│ │ │ │ +will be reset.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bpieces%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bpieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>pieces</dt>
│ │ │ │ +<dd>a bitmask that represents which pieces we have (set to true) and the
│ │ │ │ +pieces we don't have. It's a pointer and may be set to 0 if the
│ │ │ │ +torrent isn't downloading or seeding.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="verified_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bverified_pieces%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bverified_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>verified_pieces</dt>
│ │ │ │ +<dd>a bitmask representing which pieces has had their hash checked. This
│ │ │ │ +only applies to torrents in <em>seed mode</em>. If the torrent is not in seed
│ │ │ │ +mode, this bitmask may be empty.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="total_done"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_done%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_done%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>total_done</dt>
│ │ │ │ +<dd>the total number of bytes of the file(s) that we have. All this does
│ │ │ │ +not necessarily has to be downloaded during this <a class="reference external" href="reference-Session.html#session">session</a> (that's
│ │ │ │ +<tt class="docutils literal">total_payload_download</tt>).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="total"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>total</dt>
│ │ │ │ +<dd>the total number of bytes to download for this torrent. This
│ │ │ │ +may be less than the size of the torrent in case there are
│ │ │ │ +pad files. This number only counts bytes that will actually
│ │ │ │ +be requested from peers.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="total_wanted_done"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_wanted_done%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_wanted_done%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>total_wanted_done</dt>
│ │ │ │ +<dd>the number of bytes we have downloaded, only counting the pieces that
│ │ │ │ +we actually want to download. i.e. excluding any pieces that we have
│ │ │ │ +but have priority 0 (i.e. not wanted).
│ │ │ │ +Once a torrent becomes seed, any piece- and file priorities are
│ │ │ │ +forgotten and all bytes are considered &quot;wanted&quot;.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="total_wanted"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Btotal_wanted%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Btotal_wanted%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>total_wanted</dt>
│ │ │ │ +<dd>The total number of bytes we want to download. This may be smaller
│ │ │ │ +than the total torrent size in case any pieces are prioritized to 0,
│ │ │ │ +i.e.  not wanted.
│ │ │ │ +Once a torrent becomes seed, any piece- and file priorities are
│ │ │ │ +forgotten and all bytes are considered &quot;wanted&quot;.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="all_time_upload"></a>
│ │ │ │ +<a name="all_time_download"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Ball_time_upload+all_time_download%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Ball_time_upload+all_time_download%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>all_time_upload all_time_download</dt>
│ │ │ │ +<dd>are accumulated upload and download payload byte <a class="reference external" href="reference-Stats.html#counters">counters</a>. They are
│ │ │ │ +saved in and restored from resume data to keep totals across sessions.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="added_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Badded_time%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Badded_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>added_time</dt>
│ │ │ │ +<dd>the posix-time when this torrent was added. i.e. what <tt class="docutils literal">time(nullptr)</tt>
│ │ │ │ +returned at the time.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="completed_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bcompleted_time%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bcompleted_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>completed_time</dt>
│ │ │ │ +<dd>the posix-time when this torrent was finished. If the torrent is not
│ │ │ │ +yet finished, this is 0.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="last_seen_complete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Blast_seen_complete%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Blast_seen_complete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>last_seen_complete</dt>
│ │ │ │ +<dd>the time when we, or one of our peers, last saw a complete copy of
│ │ │ │ +this torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="storage_mode"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bstorage_mode%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bstorage_mode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>storage_mode</dt>
│ │ │ │ +<dd>The allocation mode for the torrent. See <a class="reference external" href="reference-Storage.html#storage_mode_t">storage_mode_t</a> for the
│ │ │ │ +options. For more information, see <a class="reference external" href="manual-ref.html#storage-allocation">storage allocation</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="progress"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bprogress%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bprogress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>progress</dt>
│ │ │ │ +<dd>a value in the range [0, 1], that represents the progress of the
│ │ │ │ +torrent's current task. It may be checking files or downloading.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="progress_ppm"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bprogress_ppm%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bprogress_ppm%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>progress_ppm</dt>
│ │ │ │ +<dd><p class="first">progress parts per million (progress * 1000000) when disabling
│ │ │ │ +floating point operations, this is the only option to query progress</p>
│ │ │ │ +<p class="last">reflects the same value as <tt class="docutils literal">progress</tt>, but instead in a range [0,
│ │ │ │ +1000000] (ppm = parts per million). When floating point operations are
│ │ │ │ +disabled, this is the only alternative to the floating point value in
│ │ │ │ +progress.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="queue_position"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bqueue_position%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bqueue_position%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>queue_position</dt>
│ │ │ │ +<dd>the position this torrent has in the download
│ │ │ │ +queue. If the torrent is a seed or finished, this is -1.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="download_rate"></a>
│ │ │ │ +<a name="upload_rate"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bdownload_rate+upload_rate%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bdownload_rate+upload_rate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>download_rate upload_rate</dt>
│ │ │ │ +<dd>the total rates for all peers for this torrent. These will usually
│ │ │ │ +have better precision than summing the rates from all peers. The rates
│ │ │ │ +are given as the number of bytes per second.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="download_payload_rate"></a>
│ │ │ │ +<a name="upload_payload_rate"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bdownload_payload_rate+upload_payload_rate%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bdownload_payload_rate+upload_payload_rate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>download_payload_rate upload_payload_rate</dt>
│ │ │ │ +<dd>the total transfer rate of payload only, not counting protocol
│ │ │ │ +chatter. This might be slightly smaller than the other rates, but if
│ │ │ │ +projected over a long time (e.g. when calculating ETA:s) the
│ │ │ │ +difference may be noticeable.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_seeds"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_seeds%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_seeds%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_seeds</dt>
│ │ │ │ +<dd>the number of peers that are seeding that this client is
│ │ │ │ +currently connected to.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_peers%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_peers</dt>
│ │ │ │ +<dd>the number of peers this torrent currently is connected to. Peer
│ │ │ │ +connections that are in the half-open state (is attempting to connect)
│ │ │ │ +or are queued for later connection attempt do not count. Although they
│ │ │ │ +are visible in the peer list when you call <a class="reference external" href="reference-Torrent_Handle.html#get_peer_info()">get_peer_info()</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_complete"></a>
│ │ │ │ +<a name="num_incomplete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_complete+num_incomplete%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_complete+num_incomplete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_complete num_incomplete</dt>
│ │ │ │ +<dd>if the tracker sends scrape info in its announce reply, these fields
│ │ │ │ +will be set to the total number of peers that have the whole file and
│ │ │ │ +the total number of peers that are still downloading. set to -1 if the
│ │ │ │ +tracker did not send any scrape data in its announce reply.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="list_seeds"></a>
│ │ │ │ +<a name="list_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Blist_seeds+list_peers%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Blist_seeds+list_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>list_seeds list_peers</dt>
│ │ │ │ +<dd>the number of seeds in our peer list and the total number of peers
│ │ │ │ +(including seeds). We are not necessarily connected to all the peers
│ │ │ │ +in our peer list. This is the number of peers we know of in total,
│ │ │ │ +including banned peers and peers that we have failed to connect to.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="connect_candidates"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bconnect_candidates%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bconnect_candidates%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>connect_candidates</dt>
│ │ │ │ +<dd>the number of peers in this torrent's peer list that is a candidate to
│ │ │ │ +be connected to. i.e. It has fewer connect attempts than the max fail
│ │ │ │ +count, it is not a seed if we are a seed, it is not banned etc. If
│ │ │ │ +this is 0, it means we don't know of any more peers that we can try.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_pieces"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_pieces%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_pieces%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_pieces</dt>
│ │ │ │ +<dd>the number of pieces that has been downloaded. It is equivalent to:
│ │ │ │ +<tt class="docutils literal"><span class="pre">std::accumulate(pieces-&gt;begin(),</span> <span class="pre">pieces-&gt;end())</span></tt>. So you don't have
│ │ │ │ +to count yourself. This can be used to see if anything has updated
│ │ │ │ +since last time if you want to keep a graph of the pieces up to date.
│ │ │ │ +Note that these pieces have not necessarily been written to disk yet,
│ │ │ │ +and there is a risk the write to disk will fail.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="distributed_full_copies"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bdistributed_full_copies%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bdistributed_full_copies%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>distributed_full_copies</dt>
│ │ │ │ +<dd>the number of distributed copies of the torrent. Note that one copy
│ │ │ │ +may be spread out among many peers. It tells how many copies there are
│ │ │ │ +currently of the rarest piece(s) among the peers this client is
│ │ │ │ +connected to.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="distributed_fraction"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bdistributed_fraction%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bdistributed_fraction%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>distributed_fraction</dt>
│ │ │ │ +<dd><p class="first">tells the share of pieces that have more copies than the rarest
│ │ │ │ +piece(s). Divide this number by 1000 to get the fraction.</p>
│ │ │ │ +<p>For example, if <tt class="docutils literal">distributed_full_copies</tt> is 2 and
│ │ │ │ +<tt class="docutils literal">distributed_fraction</tt> is 500, it means that the rarest pieces have
│ │ │ │ +only 2 copies among the peers this torrent is connected to, and that
│ │ │ │ +50% of all the pieces have more than two copies.</p>
│ │ │ │ +<p class="last">If we are a seed, the piece picker is deallocated as an optimization,
│ │ │ │ +and piece availability is no longer tracked. In this case the
│ │ │ │ +distributed copies members are set to -1.</p>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="distributed_copies"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bdistributed_copies%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bdistributed_copies%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>distributed_copies</dt>
│ │ │ │ +<dd><p class="first">the number of distributed copies of the file. note that one copy may
│ │ │ │ +be spread out among many peers. This is a floating point
│ │ │ │ +representation of the distributed copies.</p>
│ │ │ │ +<dl class="last docutils">
│ │ │ │ +<dt>the integer part tells how many copies</dt>
│ │ │ │ +<dd>there are of the rarest piece(s)</dd>
│ │ │ │ +<dt>the fractional part tells the fraction of pieces that</dt>
│ │ │ │ +<dd>have more copies than the rarest piece(s).</dd>
│ │ │ │ +</dl>
│ │ │ │ +</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="block_size"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bblock_size%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bblock_size%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>block_size</dt>
│ │ │ │ +<dd>the size of a block, in bytes. A block is a sub piece, it is the
│ │ │ │ +number of bytes that each piece request asks for and the number of
│ │ │ │ +bytes that each bit in the <tt class="docutils literal">partial_piece_info</tt>'s bitset represents,
│ │ │ │ +see <a class="reference external" href="reference-Torrent_Handle.html#get_download_queue()">get_download_queue()</a>. This is typically 16 kB, but it may be
│ │ │ │ +smaller, if the pieces are smaller.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_uploads"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_uploads%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_uploads%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_uploads</dt>
│ │ │ │ +<dd>the number of unchoked peers in this torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="num_connections"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bnum_connections%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bnum_connections%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>num_connections</dt>
│ │ │ │ +<dd>the number of peer connections this torrent has, including half-open
│ │ │ │ +connections that hasn't completed the bittorrent handshake yet. This
│ │ │ │ +is always &gt;= <tt class="docutils literal">num_peers</tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="uploads_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Buploads_limit%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Buploads_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>uploads_limit</dt>
│ │ │ │ +<dd>the set limit of upload slots (unchoked peers) for this torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="connections_limit"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bconnections_limit%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bconnections_limit%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>connections_limit</dt>
│ │ │ │ +<dd>the set limit of number of connections for this torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="up_bandwidth_queue"></a>
│ │ │ │ +<a name="down_bandwidth_queue"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bup_bandwidth_queue+down_bandwidth_queue%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bup_bandwidth_queue+down_bandwidth_queue%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>up_bandwidth_queue down_bandwidth_queue</dt>
│ │ │ │ +<dd>the number of peers in this torrent that are waiting for more
│ │ │ │ +bandwidth quota from the torrent rate limiter. This can determine if
│ │ │ │ +the rate you get from this torrent is bound by the torrents limit or
│ │ │ │ +not. If there is no limit set on this torrent, the peers might still
│ │ │ │ +be waiting for bandwidth quota from the global limiter, but then they
│ │ │ │ +are counted in the <tt class="docutils literal">session_status</tt> object.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="seed_rank"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bseed_rank%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bseed_rank%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>seed_rank</dt>
│ │ │ │ +<dd>A rank of how important it is to seed the torrent, it is used to
│ │ │ │ +determine which torrents to seed and which to queue. It is based on
│ │ │ │ +the peer to seed ratio from the tracker scrape. For more information,
│ │ │ │ +see <a class="reference external" href="manual-ref.html#queuing">queuing</a>. Higher value means more important to seed</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bstate%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bstate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>state</dt>
│ │ │ │ +<dd>the main state the torrent is in. See <a class="reference external" href="reference-Torrent_Status.html#state_t">torrent_status::state_t</a>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="need_save_resume"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bneed_save_resume%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bneed_save_resume%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>need_save_resume</dt>
│ │ │ │ +<dd>true if this torrent has unsaved changes
│ │ │ │ +to its download state and statistics since the last resume data
│ │ │ │ +was saved.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="is_seeding"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bis_seeding%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bis_seeding%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>is_seeding</dt>
│ │ │ │ +<dd>true if all pieces have been downloaded.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="is_finished"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bis_finished%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bis_finished%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>is_finished</dt>
│ │ │ │ +<dd>true if all pieces that have a priority &gt; 0 are downloaded. There is
│ │ │ │ +only a distinction between finished and seeding if some pieces or
│ │ │ │ +files have been set to priority 0, i.e. are not downloaded.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="has_metadata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bhas_metadata%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bhas_metadata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>has_metadata</dt>
│ │ │ │ +<dd>true if this torrent has metadata (either it was started from a
│ │ │ │ +.torrent file or the metadata has been downloaded). The only scenario
│ │ │ │ +where this can be false is when the torrent was started torrent-less
│ │ │ │ +(i.e. with just an info-hash and tracker ip, a magnet link for
│ │ │ │ +instance).</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="has_incoming"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bhas_incoming%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bhas_incoming%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>has_incoming</dt>
│ │ │ │ +<dd>true if there has ever been an incoming connection attempt to this
│ │ │ │ +torrent.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="moving_storage"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bmoving_storage%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bmoving_storage%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>moving_storage</dt>
│ │ │ │ +<dd>this is true if this torrent's storage is currently being moved from
│ │ │ │ +one location to another. This may potentially be a long operation
│ │ │ │ +if a large file ends up being copied from one drive to another.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="announcing_to_trackers"></a>
│ │ │ │ +<a name="announcing_to_lsd"></a>
│ │ │ │ +<a name="announcing_to_dht"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bannouncing_to_trackers+announcing_to_lsd+announcing_to_dht%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bannouncing_to_trackers+announcing_to_lsd+announcing_to_dht%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>announcing_to_trackers announcing_to_lsd announcing_to_dht</dt>
│ │ │ │ +<dd>these are set to true if this torrent is allowed to announce to the
│ │ │ │ +respective peer source. Whether they are true or false is determined by
│ │ │ │ +the queue logic/auto manager. Torrents that are not auto managed will
│ │ │ │ +always be allowed to announce to all peer sources.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>info_hashes</dt>
│ │ │ │ +<dd>the info-hash for this torrent</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="last_upload"></a>
│ │ │ │ +<a name="last_download"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Blast_upload+last_download%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Blast_upload+last_download%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>last_upload last_download</dt>
│ │ │ │ +<dd>the timestamps of the last time this torrent uploaded or downloaded
│ │ │ │ +payload to any peer.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="active_duration"></a>
│ │ │ │ +<a name="finished_duration"></a>
│ │ │ │ +<a name="seeding_duration"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bactive_duration+finished_duration+seeding_duration%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bactive_duration+finished_duration+seeding_duration%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>active_duration finished_duration seeding_duration</dt>
│ │ │ │ +<dd>these are cumulative <a class="reference external" href="reference-Stats.html#counters">counters</a> of for how long the torrent has been in
│ │ │ │ +different states. active means not paused and added to <a class="reference external" href="reference-Session.html#session">session</a>. Whether
│ │ │ │ +it has found any peers or not is not relevant.
│ │ │ │ +finished means all selected files/pieces were downloaded and available
│ │ │ │ +to other peers (this is always a subset of active time).
│ │ │ │ +seeding means all files/pieces were downloaded and available to
│ │ │ │ +peers. Being available to peers does not imply there are other peers
│ │ │ │ +asking for the payload.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<a name="flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_status%3A%3A%5Bflags%5D&labels=documentation&body=Documentation+under+heading+%22torrent_status%3A%3A%5Bflags%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>flags</dt>
│ │ │ │ +<dd>reflects several of the torrent's flags. For more
│ │ │ │ +information, see <tt class="docutils literal"><span class="pre">torrent_handle::flags()</span></tt>.</dd>
│ │ │ │ +</dl>
│ │ │ │ +<p>Bencoding is a common representation in bittorrent used for dictionary,
│ │ │ │ +list, <a class="reference external" href="reference-Core.html#int">int</a> and string hierarchies. It's used to encode .torrent files and
│ │ │ │ +some messages in the network protocol. libtorrent also uses it to store
│ │ │ │ +settings, resume data and other <a class="reference external" href="reference-Session.html#session">session</a> state.</p>
│ │ │ │ +<p>Strings in bencoded structures do not necessarily represent text.
│ │ │ │ +Strings are raw byte buffers of a certain length. If a string is meant to be
│ │ │ │ +interpreted as text, it is required to be UTF-8 encoded. See <a class="reference external" href="https://www.bittorrent.org/beps/bep_0003.html">BEP 3</a>.</p>
│ │ │ │ +<p>The function for decoding bencoded data <a class="reference external" href="reference-Bdecoding.html#bdecode()">bdecode()</a>, returning a <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>.
│ │ │ │ +This function builds a tree that points back into the original buffer. The
│ │ │ │ +returned <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> will not be valid once the buffer it was parsed out of
│ │ │ │ +is discarded.</p>
│ │ │ │ +<p>It's possible to construct an <a class="reference external" href="reference-Bencoding.html#entry">entry</a> from a <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>, if a structure needs
│ │ │ │ +to be altered and re-encoded.</p>
│ │ │ │ +<a name="entry"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+entry&labels=documentation&body=Documentation+under+heading+%22class+entry%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │ -<div class="section" id="min-memory-usage-high-performance-seed">
│ │ │ │ -<h1>min_memory_usage() high_performance_seed()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/session.hpp">libtorrent/session.hpp</a>&quot;</p>
│ │ │ │ +<div class="section" id="entry">
│ │ │ │ +<h1>entry</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/entry.hpp">libtorrent/entry.hpp</a>&quot;</p>
│ │ │ │ +<p>The <tt class="docutils literal">entry</tt> class represents one node in a bencoded hierarchy. It works as a
│ │ │ │ +variant type, it can be either a list, a dictionary (<tt class="docutils literal"><span class="pre">std::map</span></tt>), an integer
│ │ │ │ +or a string.</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -settings_pack <strong>min_memory_usage</strong> ();
│ │ │ │ -settings_pack <strong>high_performance_seed</strong> ();
│ │ │ │ +class entry
│ │ │ │ +{
│ │ │ │ +   data_type <strong>type</strong> () const;
│ │ │ │ +   <strong>entry</strong> (dictionary_type);
│ │ │ │ +   <strong>entry</strong> (span&lt;char const&gt;);
│ │ │ │ +   <strong>entry</strong> (list_type);
│ │ │ │ +   <strong>entry</strong> (integer_type);
│ │ │ │ +   <strong>entry</strong> (preformatted_type);
│ │ │ │ +   <strong>entry</strong> (U v);
│ │ │ │ +   <strong>entry</strong> (data_type t);
│ │ │ │ +   <strong>entry</strong> (bdecode_node const&amp; n);
│ │ │ │ +   entry&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (preformatted_type) &amp;;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (entry&amp;&amp;) &amp; noexcept;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (dictionary_type) &amp;;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (entry const&amp;) &amp;;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (span&lt;char const&gt;) &amp;;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (list_type) &amp;;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (integer_type) &amp;;
│ │ │ │ +   entry&amp; <strong>operator=</strong> (U v) &amp;;
│ │ │ │ +   dictionary_type const&amp; <strong>dict</strong> () const;
│ │ │ │ +   string_type&amp; <strong>string</strong> ();
│ │ │ │ +   integer_type&amp; <strong>integer</strong> ();
│ │ │ │ +   list_type const&amp; <strong>list</strong> () const;
│ │ │ │ +   dictionary_type&amp; <strong>dict</strong> ();
│ │ │ │ +   list_type&amp; <strong>list</strong> ();
│ │ │ │ +   integer_type const&amp; <strong>integer</strong> () const;
│ │ │ │ +   preformatted_type&amp; <strong>preformatted</strong> ();
│ │ │ │ +   string_type const&amp; <strong>string</strong> () const;
│ │ │ │ +   preformatted_type const&amp; <strong>preformatted</strong> () const;
│ │ │ │ +   void <strong>swap</strong> (entry&amp; e);
│ │ │ │ +   entry&amp; <strong>operator[]</strong> (string_view key);
│ │ │ │ +   entry const&amp; <strong>operator[]</strong> (string_view key) const;
│ │ │ │ +   entry* <strong>find_key</strong> (string_view key);
│ │ │ │ +   entry const* <strong>find_key</strong> (string_view key) const;
│ │ │ │ +   std::string <strong>to_string</strong> (bool single_line = false) const;
│ │ │ │ +
│ │ │ │ +   enum data_type
│ │ │ │ +   {
│ │ │ │ +      int_t,
│ │ │ │ +      string_t,
│ │ │ │ +      list_t,
│ │ │ │ +      dictionary_t,
│ │ │ │ +      undefined_t,
│ │ │ │ +      preformatted_t,
│ │ │ │ +   };
│ │ │ │ +};
│ │ │ │  </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 intended 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>
│ │ │ │ -<a name="generate_fingerprint()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:generate_fingerprint%28%29&labels=documentation&body=Documentation+under+heading+%22generate_fingerprint%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="generate-fingerprint">
│ │ │ │ -<h1>generate_fingerprint()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/fingerprint.hpp">libtorrent/fingerprint.hpp</a>&quot;</p>
│ │ │ │ +<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="type-3">
│ │ │ │ +<h2>type()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -std::string <strong>generate_fingerprint</strong> (std::string name
│ │ │ │ -   , int major, int minor = 0, int revision = 0, int tag = 0);
│ │ │ │ +data_type <strong>type</strong> () const;
│ │ │ │  </pre>
│ │ │ │ -<p>This is a utility function to produce a client ID fingerprint formatted to
│ │ │ │ -the most common convention. The fingerprint can be set via the
│ │ │ │ -<tt class="docutils literal">peer_fingerprint</tt> setting, in <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a>.</p>
│ │ │ │ -<p>The name string should contain exactly two characters. These are the
│ │ │ │ -characters unique to your client, used to identify it. Make sure not to
│ │ │ │ -clash with anybody else. Here are some taken id's:</p>
│ │ │ │ +<p>returns the concrete type of the <a class="reference external" href="reference-Bencoding.html#entry">entry</a></p>
│ │ │ │ +<a name="entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bentry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bentry%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="entry-1">
│ │ │ │ +<h2>entry()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>entry</strong> (dictionary_type);
│ │ │ │ +<strong>entry</strong> (span&lt;char const&gt;);
│ │ │ │ +<strong>entry</strong> (list_type);
│ │ │ │ +<strong>entry</strong> (integer_type);
│ │ │ │ +<strong>entry</strong> (preformatted_type);
│ │ │ │ +</pre>
│ │ │ │ +<p>constructors directly from a specific type.
│ │ │ │ +The content of the argument is copied into the
│ │ │ │ +newly constructed <a class="reference external" href="reference-Bencoding.html#entry">entry</a></p>
│ │ │ │ +<a name="entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bentry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bentry%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="entry-2">
│ │ │ │ +<h2>entry()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>entry</strong> (data_type t);
│ │ │ │ +</pre>
│ │ │ │ +<p>construct an empty <a class="reference external" href="reference-Bencoding.html#entry">entry</a> of the specified type.
│ │ │ │ +see <a class="reference external" href="reference-Bencoding.html#data_type">data_type</a> enum.</p>
│ │ │ │ +<a name="entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bentry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bentry%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="entry-3">
│ │ │ │ +<h2>entry()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +<strong>entry</strong> (bdecode_node const&amp; n);
│ │ │ │ +</pre>
│ │ │ │ +<p>construct from <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> parsed form (see <a class="reference external" href="reference-Bdecoding.html#bdecode()">bdecode()</a>)</p>
│ │ │ │ +<a name="operator=()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Boperator%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Boperator%3D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="operator-4">
│ │ │ │ +<h2>operator=()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +entry&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │ +entry&amp; <strong>operator=</strong> (preformatted_type) &amp;;
│ │ │ │ +entry&amp; <strong>operator=</strong> (entry&amp;&amp;) &amp; noexcept;
│ │ │ │ +entry&amp; <strong>operator=</strong> (dictionary_type) &amp;;
│ │ │ │ +entry&amp; <strong>operator=</strong> (entry const&amp;) &amp;;
│ │ │ │ +entry&amp; <strong>operator=</strong> (span&lt;char const&gt;) &amp;;
│ │ │ │ +entry&amp; <strong>operator=</strong> (list_type) &amp;;
│ │ │ │ +entry&amp; <strong>operator=</strong> (integer_type) &amp;;
│ │ │ │ +</pre>
│ │ │ │ +<p>copies the structure of the right hand side into this
│ │ │ │ +<a class="reference external" href="reference-Bencoding.html#entry">entry</a>.</p>
│ │ │ │ +<a name="string()"></a>
│ │ │ │ +<a name="preformatted()"></a>
│ │ │ │ +<a name="list()"></a>
│ │ │ │ +<a name="integer()"></a>
│ │ │ │ +<a name="dict()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bstring%28%29+preformatted%28%29+list%28%29+integer%28%29+dict%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bstring%28%29+preformatted%28%29+list%28%29+integer%28%29+dict%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="string-preformatted-list-integer-dict">
│ │ │ │ +<h2>string() preformatted() list() integer() dict()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +dictionary_type const&amp; <strong>dict</strong> () const;
│ │ │ │ +string_type&amp; <strong>string</strong> ();
│ │ │ │ +integer_type&amp; <strong>integer</strong> ();
│ │ │ │ +list_type const&amp; <strong>list</strong> () const;
│ │ │ │ +dictionary_type&amp; <strong>dict</strong> ();
│ │ │ │ +list_type&amp; <strong>list</strong> ();
│ │ │ │ +integer_type const&amp; <strong>integer</strong> () const;
│ │ │ │ +preformatted_type&amp; <strong>preformatted</strong> ();
│ │ │ │ +string_type const&amp; <strong>string</strong> () const;
│ │ │ │ +preformatted_type const&amp; <strong>preformatted</strong> () const;
│ │ │ │ +</pre>
│ │ │ │ +<p>The <tt class="docutils literal">integer()</tt>, <tt class="docutils literal">string()</tt>, <tt class="docutils literal">list()</tt> and <tt class="docutils literal">dict()</tt> functions
│ │ │ │ +are accessors that return the respective type. If the <tt class="docutils literal">entry</tt> object
│ │ │ │ +isn't of the type you request, the accessor will throw
│ │ │ │ +system_error. You can ask an <tt class="docutils literal">entry</tt> for its type through the
│ │ │ │ +<tt class="docutils literal">type()</tt> function.</p>
│ │ │ │ +<p>If you want to create an <tt class="docutils literal">entry</tt> you give it the type you want it to
│ │ │ │ +have in its constructor, and then use one of the non-const accessors
│ │ │ │ +to get a reference which you then can assign the value you want it to
│ │ │ │ +have.</p>
│ │ │ │ +<p>The typical code to get info from a torrent file will then look like
│ │ │ │ +this:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="name">entry</span><span class="whitespace"> </span><span class="name">torrent_file</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="comment single">// ...
│ │ │ │ +</span><span class="whitespace">
│ │ │ │ +</span><span class="comment single">// throws if this is not a dictionary
│ │ │ │ +</span><span class="name">entry</span><span class="operator">::</span><span class="name">dictionary_type</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">dict</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">torrent_file</span><span class="punctuation">.</span><span class="name">dict</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +</span><span class="name">entry</span><span class="operator">::</span><span class="name">dictionary_type</span><span class="operator">::</span><span class="name">const_iterator</span><span class="whitespace"> </span><span class="name">i</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="name">i</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">dict</span><span class="punctuation">.</span><span class="name">find</span><span class="punctuation">(</span><span class="literal string">&quot;announce&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ +</span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">i</span><span class="whitespace"> </span><span class="operator">!=</span><span class="whitespace"> </span><span class="name">dict</span><span class="punctuation">.</span><span class="name">end</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="name">tracker_url</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">string</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">std</span><span class="operator">::</span><span class="name">cout</span><span class="whitespace"> </span><span class="operator">&lt;&lt;</span><span class="whitespace"> </span><span class="name">tracker_url</span><span class="whitespace"> </span><span class="operator">&lt;&lt;</span><span class="whitespace"> </span><span class="literal string">&quot;</span><span class="literal string escape">\n</span><span class="literal string">&quot;</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">}</span>
│ │ │ │ +</pre>
│ │ │ │ +<p>The following code is equivalent, but a little bit shorter:</p>
│ │ │ │ +<pre class="code c++ literal-block">
│ │ │ │ +<span class="name">entry</span><span class="whitespace"> </span><span class="name">torrent_file</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="comment single">// ...
│ │ │ │ +</span><span class="whitespace">
│ │ │ │ +</span><span class="comment single">// throws if this is not a dictionary
│ │ │ │ +</span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">entry</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">i</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">torrent_file</span><span class="punctuation">.</span><span class="name">find_key</span><span class="punctuation">(</span><span class="literal string">&quot;announce&quot;</span><span class="punctuation">))</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="name">tracker_url</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">string</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ +        </span><span class="name">std</span><span class="operator">::</span><span class="name">cout</span><span class="whitespace"> </span><span class="operator">&lt;&lt;</span><span class="whitespace"> </span><span class="name">tracker_url</span><span class="whitespace"> </span><span class="operator">&lt;&lt;</span><span class="whitespace"> </span><span class="literal string">&quot;</span><span class="literal string escape">\n</span><span class="literal string">&quot;</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ +</span><span class="punctuation">}</span>
│ │ │ │ +</pre>
│ │ │ │ +<p>To make it easier to extract information from a torrent file, the
│ │ │ │ +class <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> exists.</p>
│ │ │ │ +<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="swap-4">
│ │ │ │ +<h2>swap()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +void <strong>swap</strong> (entry&amp; e);
│ │ │ │ +</pre>
│ │ │ │ +<p>swaps the content of <em>this</em> with <tt class="docutils literal">e</tt>.</p>
│ │ │ │ +<a name="operator[]()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Boperator%5B%5D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Boperator%5B%5D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="operator-5">
│ │ │ │ +<h2>operator[]()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +entry&amp; <strong>operator[]</strong> (string_view key);
│ │ │ │ +entry const&amp; <strong>operator[]</strong> (string_view key) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>All of these functions requires the <a class="reference external" href="reference-Bencoding.html#entry">entry</a> to be a dictionary, if it
│ │ │ │ +isn't they will throw <tt class="docutils literal">system_error</tt>.</p>
│ │ │ │ +<p>The non-const versions of the <tt class="docutils literal">operator[]</tt> will return a reference
│ │ │ │ +to either the existing element at the given key or, if there is no
│ │ │ │ +element with the given key, a reference to a newly inserted element at
│ │ │ │ +that key.</p>
│ │ │ │ +<p>The const version of <tt class="docutils literal">operator[]</tt> will only return a reference to an
│ │ │ │ +existing element at the given key. If the key is not found, it will
│ │ │ │ +throw <tt class="docutils literal">system_error</tt>.</p>
│ │ │ │ +<a name="find_key()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bfind_key%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bfind_key%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="find-key">
│ │ │ │ +<h2>find_key()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +entry* <strong>find_key</strong> (string_view key);
│ │ │ │ +entry const* <strong>find_key</strong> (string_view key) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>These functions requires the <a class="reference external" href="reference-Bencoding.html#entry">entry</a> to be a dictionary, if it isn't
│ │ │ │ +they will throw <tt class="docutils literal">system_error</tt>.</p>
│ │ │ │ +<p>They will look for an element at the given key in the dictionary, if
│ │ │ │ +the element cannot be found, they will return nullptr. If an element
│ │ │ │ +with the given key is found, the return a pointer to it.</p>
│ │ │ │ +<a name="to_string()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bto_string%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bto_string%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="to-string">
│ │ │ │ +<h2>to_string()</h2>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +std::string <strong>to_string</strong> (bool single_line = false) const;
│ │ │ │ +</pre>
│ │ │ │ +<p>returns a pretty-printed string representation
│ │ │ │ +of the bencoded structure, with JSON-style syntax</p>
│ │ │ │ +<a name="data_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+data_type&labels=documentation&body=Documentation+under+heading+%22enum+data_type%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-data-type">
│ │ │ │ +<h2>enum data_type</h2>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/entry.hpp">libtorrent/entry.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │ -<col width="30%" />
│ │ │ │ -<col width="70%" />
│ │ │ │ +<col width="44%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="36%" />
│ │ │ │  </colgroup>
│ │ │ │  <thead valign="bottom">
│ │ │ │ -<tr><th class="head">id chars</th>
│ │ │ │ -<th class="head">client</th>
│ │ │ │ +<tr><th class="head">name</th>
│ │ │ │ +<th class="head">value</th>
│ │ │ │ +<th class="head">description</th>
│ │ │ │  </tr>
│ │ │ │  </thead>
│ │ │ │  <tbody valign="top">
│ │ │ │ -<tr><td>LT</td>
│ │ │ │ -<td>libtorrent (default)</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>UT</td>
│ │ │ │ -<td>uTorrent</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>UM</td>
│ │ │ │ -<td>uTorrent Mac</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>qB</td>
│ │ │ │ -<td>qBittorrent</td>
│ │ │ │ +<tr><td>int_t</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>BP</td>
│ │ │ │ -<td>BitTorrent Pro</td>
│ │ │ │ +<tr><td>string_t</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>BT</td>
│ │ │ │ -<td>BitTorrent</td>
│ │ │ │ +<tr><td>list_t</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>DE</td>
│ │ │ │ -<td>Deluge</td>
│ │ │ │ +<tr><td>dictionary_t</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>AZ</td>
│ │ │ │ -<td>Azureus</td>
│ │ │ │ +<tr><td>undefined_t</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │ -<tr><td>TL</td>
│ │ │ │ -<td>Tribler</td>
│ │ │ │ +<tr><td>preformatted_t</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<p>There's an informal directory of client id's <a class="reference external" href="http://wiki.theory.org/BitTorrentSpecification#peer_id">here</a>.</p>
│ │ │ │ -<p>The <tt class="docutils literal">major</tt>, <tt class="docutils literal">minor</tt>, <tt class="docutils literal">revision</tt> and <tt class="docutils literal">tag</tt> parameters are used to
│ │ │ │ -identify the version of your client.</p>
│ │ │ │ -<a name="name_for_setting()"></a>
│ │ │ │ -<a name="setting_by_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:name_for_setting%28%29+setting_by_name%28%29&labels=documentation&body=Documentation+under+heading+%22name_for_setting%28%29+setting_by_name%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="name-for-setting-setting-by-name">
│ │ │ │ -<h1>name_for_setting() setting_by_name()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<a name="bencode()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bencode%28%29&labels=documentation&body=Documentation+under+heading+%22bencode%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │ +<div class="section" id="bencode">
│ │ │ │ +<h1>bencode()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bencode.hpp">libtorrent/bencode.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -char const* <strong>name_for_setting</strong> (int s);
│ │ │ │ -int <strong>setting_by_name</strong> (string_view name);
│ │ │ │ +template&lt;class OutIt&gt; int <strong>bencode</strong> (OutIt out, const entry&amp; e);
│ │ │ │  </pre>
│ │ │ │ -<p>converts a setting integer (from the enums string_types, int_types or
│ │ │ │ -bool_types) to a string, and vice versa.</p>
│ │ │ │ -<a name="default_settings()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:default_settings%28%29&labels=documentation&body=Documentation+under+heading+%22default_settings%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="default-settings">
│ │ │ │ -<h1>default_settings()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/settings_pack.hpp">libtorrent/settings_pack.hpp</a>&quot;</p>
│ │ │ │ +<p>This function will encode data to bencoded form.</p>
│ │ │ │ +<p>The <a class="reference internal" href="#entry">entry</a> class is the internal representation of the bencoded data
│ │ │ │ +and it can be used to retrieve information, an <a class="reference internal" href="#entry">entry</a> can also be build by
│ │ │ │ +the program and given to <tt class="docutils literal">bencode()</tt> to encode it into the <tt class="docutils literal">OutIt</tt>
│ │ │ │ +iterator.</p>
│ │ │ │ +<p><tt class="docutils literal">OutIt</tt> is an <a class="reference external" href="https://en.cppreference.com/w/cpp/named_req/OutputIterator">OutputIterator</a>. It's a template and usually
│ │ │ │ +instantiated as <a class="reference external" href="https://en.cppreference.com/w/cpp/iterator/ostream_iterator">ostream_iterator</a> or <a class="reference external" href="https://en.cppreference.com/w/cpp/iterator/back_insert_iterator">back_insert_iterator</a>. This
│ │ │ │ +function assumes the value_type of the iterator is a <tt class="docutils literal">char</tt>.
│ │ │ │ +In order to encode <a class="reference external" href="reference-Bencoding.html#entry">entry</a> <tt class="docutils literal">e</tt> into a buffer, do:</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -settings_pack <strong>default_settings</strong> ();
│ │ │ │ +std::vector&lt;char&gt; buf;
│ │ │ │ +bencode(std::back_inserter(buf), e);
│ │ │ │  </pre>
│ │ │ │ -<p>returns a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> with every setting set to its default value</p>
│ │ │ │ +<a name="operator<<()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:operator%3C%3C%28%29&labels=documentation&body=Documentation+under+heading+%22operator%3C%3C%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="operator-6">
│ │ │ │ +<h1>operator&lt;&lt;()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/entry.hpp">libtorrent/entry.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +inline std::ostream&amp; <strong>operator&lt;&lt;</strong> (std::ostream&amp; os, const entry&amp; e);
│ │ │ │ +</pre>
│ │ │ │ +<p>prints the bencoded structure to the ostream as a JSON-style structure.</p>
│ │ │ │  <a name="storage_error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_error&labels=documentation&body=Documentation+under+heading+%22class+storage_error%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="storage-error">
│ │ │ │  <h1>storage_error</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │  <p>used by storage to return errors
│ │ │ │  also includes which underlying file the
│ │ │ │  error happened on</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct storage_error
│ │ │ │  {
│ │ │ │     explicit operator <strong>bool</strong> () const;
│ │ │ │ -   file_index_t <strong>file</strong> () const;
│ │ │ │     void <strong>file</strong> (file_index_t f);
│ │ │ │ +   file_index_t <strong>file</strong> () const;
│ │ │ │  
│ │ │ │     error_code ec;
│ │ │ │     operation_t operation;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="bool()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_error%3A%3A%5Bbool%28%29%5D&labels=documentation&body=Documentation+under+heading+%22storage_error%3A%3A%5Bbool%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="bool-1">
│ │ │ │ +<a name="bool()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_error%3A%3A%5Bbool%28%29%5D&labels=documentation&body=Documentation+under+heading+%22storage_error%3A%3A%5Bbool%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="bool-2">
│ │ │ │  <h2>bool()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  explicit operator <strong>bool</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>explicitly converts to true if this object represents an error, and
│ │ │ │  false if it does not.</p>
│ │ │ │  <a name="file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_error%3A%3A%5Bfile%28%29%5D&labels=documentation&body=Documentation+under+heading+%22storage_error%3A%3A%5Bfile%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="file">
│ │ │ │  <h2>file()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -file_index_t <strong>file</strong> () const;
│ │ │ │  void <strong>file</strong> (file_index_t f);
│ │ │ │ +file_index_t <strong>file</strong> () const;
│ │ │ │  </pre>
│ │ │ │  <p>set and query the index (in the torrent) of the file this error
│ │ │ │  occurred on. This may also have special values defined in
│ │ │ │  <a class="reference external" href="reference-Torrent_Status.html#torrent_status">torrent_status</a>.</p>
│ │ │ │  <a name="ec"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_error%3A%3A%5Bec%5D&labels=documentation&body=Documentation+under+heading+%22storage_error%3A%3A%5Bec%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>ec</dt>
│ │ │ │  <dd>the error that occurred</dd>
│ │ │ │  </dl>
│ │ │ │  <a name="operation"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_error%3A%3A%5Boperation%5D&labels=documentation&body=Documentation+under+heading+%22storage_error%3A%3A%5Boperation%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │  <dt>operation</dt>
│ │ │ │  <dd>A code from <a class="reference external" href="reference-Alerts.html#operation_t">operation_t</a> enum, indicating what
│ │ │ │  kind of operation failed.</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="libtorrent_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:libtorrent_category%28%29&labels=documentation&body=Documentation+under+heading+%22libtorrent_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<a name="gzip_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:gzip_category%28%29&labels=documentation&body=Documentation+under+heading+%22gzip_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  </div>
│ │ │ │ -<div class="section" id="libtorrent-category">
│ │ │ │ -<h1>libtorrent_category()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -boost::system::error_category&amp; <strong>libtorrent_category</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>return the instance of the libtorrent_error_category which
│ │ │ │ -maps libtorrent error codes to human readable error messages.</p>
│ │ │ │ -<a name="http_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:http_category%28%29&labels=documentation&body=Documentation+under+heading+%22http_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="http-category">
│ │ │ │ -<h1>http_category()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │ +<div class="section" id="gzip-category">
│ │ │ │ +<h1>gzip_category()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/gzip.hpp">libtorrent/gzip.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -boost::system::error_category&amp; <strong>http_category</strong> ();
│ │ │ │ +boost::system::error_category&amp; <strong>gzip_category</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>returns the error_category for HTTP errors</p>
│ │ │ │ -<a name="i2p_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:i2p_category%28%29&labels=documentation&body=Documentation+under+heading+%22i2p_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="i2p-category">
│ │ │ │ -<h1>i2p_category()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/i2p_stream.hpp">libtorrent/i2p_stream.hpp</a>&quot;</p>
│ │ │ │ +<p>get the <tt class="docutils literal">error_category</tt> for zip errors</p>
│ │ │ │ +<a name="upnp_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:upnp_category%28%29&labels=documentation&body=Documentation+under+heading+%22upnp_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="upnp-category">
│ │ │ │ +<h1>upnp_category()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/upnp.hpp">libtorrent/upnp.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -boost::system::error_category&amp; <strong>i2p_category</strong> ();
│ │ │ │ +boost::system::error_category&amp; <strong>upnp_category</strong> ();
│ │ │ │  </pre>
│ │ │ │ -<p>returns the error category for I2P errors</p>
│ │ │ │ +<p>the boost.system error category for UPnP errors</p>
│ │ │ │  <a name="bdecode_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_category%28%29&labels=documentation&body=Documentation+under+heading+%22bdecode_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="bdecode-category">
│ │ │ │  <h1>bdecode_category()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  boost::system::error_category&amp; <strong>bdecode_category</strong> ();
│ │ │ │  </pre>
│ │ │ │  <a name="pcp_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:pcp_category%28%29&labels=documentation&body=Documentation+under+heading+%22pcp_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="pcp-category">
│ │ │ │  <h1>pcp_category()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/natpmp.hpp">libtorrent/natpmp.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  boost::system::error_category&amp; <strong>pcp_category</strong> ();
│ │ │ │  </pre>
│ │ │ │ +<a name="i2p_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:i2p_category%28%29&labels=documentation&body=Documentation+under+heading+%22i2p_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="i2p-category">
│ │ │ │ +<h1>i2p_category()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/i2p_stream.hpp">libtorrent/i2p_stream.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +boost::system::error_category&amp; <strong>i2p_category</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the error category for I2P errors</p>
│ │ │ │ +<a name="libtorrent_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:libtorrent_category%28%29&labels=documentation&body=Documentation+under+heading+%22libtorrent_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="libtorrent-category">
│ │ │ │ +<h1>libtorrent_category()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +boost::system::error_category&amp; <strong>libtorrent_category</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>return the instance of the libtorrent_error_category which
│ │ │ │ +maps libtorrent error codes to human readable error messages.</p>
│ │ │ │ +<a name="http_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:http_category%28%29&labels=documentation&body=Documentation+under+heading+%22http_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="http-category">
│ │ │ │ +<h1>http_category()</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │ +<pre class="literal-block">
│ │ │ │ +boost::system::error_category&amp; <strong>http_category</strong> ();
│ │ │ │ +</pre>
│ │ │ │ +<p>returns the error_category for HTTP errors</p>
│ │ │ │  <a name="socks_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks_category%28%29&labels=documentation&body=Documentation+under+heading+%22socks_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="socks-category">
│ │ │ │  <h1>socks_category()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/socks5_stream.hpp">libtorrent/socks5_stream.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  boost::system::error_category&amp; <strong>socks_category</strong> ();
│ │ │ │  </pre>
│ │ │ │  <p>returns the error_category for SOCKS5 errors</p>
│ │ │ │ -<a name="gzip_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:gzip_category%28%29&labels=documentation&body=Documentation+under+heading+%22gzip_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="gzip-category">
│ │ │ │ -<h1>gzip_category()</h1>
│ │ │ │ +<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-error-code-enum">
│ │ │ │ +<h1>enum error_code_enum</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/gzip.hpp">libtorrent/gzip.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -boost::system::error_category&amp; <strong>gzip_category</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>get the <tt class="docutils literal">error_category</tt> for zip errors</p>
│ │ │ │ -<a name="upnp_category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:upnp_category%28%29&labels=documentation&body=Documentation+under+heading+%22upnp_category%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="upnp-category">
│ │ │ │ -<h1>upnp_category()</h1>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="33%" />
│ │ │ │ +<col width="6%" />
│ │ │ │ +<col width="61%" />
│ │ │ │ +</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>invalid_gzip_header</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>the supplied gzip buffer has invalid header</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>inflated_data_too_large</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>the gzip buffer would inflate to more bytes than the specified
│ │ │ │ +maximum size, and was rejected.</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>data_did_not_terminate</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>available inflate data did not terminate</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>space_exhausted</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>output space exhausted before completing inflate</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_block_type</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>invalid block type (type == 3)</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_stored_block_length</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>stored block length did not match one's complement</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>too_many_length_or_distance_codes</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>dynamic block code description: too many length or distance codes</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>code_lengths_codes_incomplete</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>dynamic block code description: code lengths codes incomplete</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>repeat_lengths_with_no_first_length</td>
│ │ │ │ +<td>9</td>
│ │ │ │ +<td>dynamic block code description: repeat lengths with no first length</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>repeat_more_than_specified_lengths</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +<td>dynamic block code description: repeat more than specified lengths</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_literal_length_code_lengths</td>
│ │ │ │ +<td>11</td>
│ │ │ │ +<td>dynamic block code description: invalid literal/length code lengths</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_distance_code_lengths</td>
│ │ │ │ +<td>12</td>
│ │ │ │ +<td>dynamic block code description: invalid distance code lengths</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_literal_code_in_block</td>
│ │ │ │ +<td>13</td>
│ │ │ │ +<td>invalid literal/length or distance code in fixed or dynamic block</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>distance_too_far_back_in_block</td>
│ │ │ │ +<td>14</td>
│ │ │ │ +<td>distance is too far back in fixed or dynamic block</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>unknown_gzip_error</td>
│ │ │ │ +<td>15</td>
│ │ │ │ +<td>an unknown error occurred during gzip inflation</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>error_code_max</td>
│ │ │ │ +<td>16</td>
│ │ │ │ +<td>the number of error codes</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-error-code-enum-1">
│ │ │ │ +<h1>enum error_code_enum</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/upnp.hpp">libtorrent/upnp.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -boost::system::error_category&amp; <strong>upnp_category</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>the boost.system error category for UPnP errors</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="37%" />
│ │ │ │ +<col width="7%" />
│ │ │ │ +<col width="56%" />
│ │ │ │ +</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>No error</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_argument</td>
│ │ │ │ +<td>402</td>
│ │ │ │ +<td>One of the arguments in the request is invalid</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>action_failed</td>
│ │ │ │ +<td>501</td>
│ │ │ │ +<td>The request failed</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>value_not_in_array</td>
│ │ │ │ +<td>714</td>
│ │ │ │ +<td>The specified value does not exist in the array</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>source_ip_cannot_be_wildcarded</td>
│ │ │ │ +<td>715</td>
│ │ │ │ +<td>The source IP address cannot be wild-carded, but
│ │ │ │ +must be fully specified</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>external_port_cannot_be_wildcarded</td>
│ │ │ │ +<td>716</td>
│ │ │ │ +<td>The external port cannot be a wildcard, but must
│ │ │ │ +be specified</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>port_mapping_conflict</td>
│ │ │ │ +<td>718</td>
│ │ │ │ +<td>The port mapping <a class="reference external" href="reference-Bencoding.html#entry">entry</a> specified conflicts with a
│ │ │ │ +mapping assigned previously to another client</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>internal_port_must_match_external</td>
│ │ │ │ +<td>724</td>
│ │ │ │ +<td>Internal and external port value must be the same</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>only_permanent_leases_supported</td>
│ │ │ │ +<td>725</td>
│ │ │ │ +<td>The NAT implementation only supports permanent
│ │ │ │ +lease times on port mappings</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>remote_host_must_be_wildcard</td>
│ │ │ │ +<td>726</td>
│ │ │ │ +<td>RemoteHost must be a wildcard and cannot be a
│ │ │ │ +specific IP address or DNS name</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>external_port_must_be_wildcard</td>
│ │ │ │ +<td>727</td>
│ │ │ │ +<td>ExternalPort must be a wildcard and cannot be a
│ │ │ │ +specific port</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │  <a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-error-code-enum">
│ │ │ │ +<div class="section" id="enum-error-code-enum-2">
│ │ │ │ +<h1>enum error_code_enum</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="18%" />
│ │ │ │ +<col width="8%" />
│ │ │ │ +<col width="74%" />
│ │ │ │ +</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_digit</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>expected digit 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, <a class="reference external" href="reference-Core.html#int">int</a> 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>overflow</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>integer overflow</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>error_code_max</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>the number of error codes</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<a name="pcp_errors"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+pcp_errors&labels=documentation&body=Documentation+under+heading+%22enum+pcp_errors%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-pcp-errors">
│ │ │ │ +<h1>enum pcp_errors</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/natpmp.hpp">libtorrent/natpmp.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="59%" />
│ │ │ │ +<col width="14%" />
│ │ │ │ +<col width="27%" />
│ │ │ │ +</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>pcp_success</td>
│ │ │ │ +<td>0</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_unsupp_version</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_not_authorized</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_malformed_request</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_unsupp_opcode</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_unsupp_option</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_malformed_option</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_network_failure</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_no_resources</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_unsupp_protocol</td>
│ │ │ │ +<td>9</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_user_ex_quota</td>
│ │ │ │ +<td>10</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_cannot_provide_external</td>
│ │ │ │ +<td>11</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_address_mismatch</td>
│ │ │ │ +<td>12</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>pcp_excessive_remote_peers</td>
│ │ │ │ +<td>13</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<a name="i2p_error_code"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+i2p_error_code&labels=documentation&body=Documentation+under+heading+%22enum+i2p_error_code%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-i2p-error-code">
│ │ │ │ +<h1>enum i2p_error_code</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/i2p_stream.hpp">libtorrent/i2p_stream.hpp</a>&quot;</p>
│ │ │ │ +<table border="1" class="docutils">
│ │ │ │ +<colgroup>
│ │ │ │ +<col width="46%" />
│ │ │ │ +<col width="19%" />
│ │ │ │ +<col width="35%" />
│ │ │ │ +</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>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>parse_failed</td>
│ │ │ │ +<td>1</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>cant_reach_peer</td>
│ │ │ │ +<td>2</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>i2p_error</td>
│ │ │ │ +<td>3</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_key</td>
│ │ │ │ +<td>4</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>invalid_id</td>
│ │ │ │ +<td>5</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>timeout</td>
│ │ │ │ +<td>6</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>key_not_found</td>
│ │ │ │ +<td>7</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>duplicated_id</td>
│ │ │ │ +<td>8</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +<tr><td>num_errors</td>
│ │ │ │ +<td>9</td>
│ │ │ │ +<td>&nbsp;</td>
│ │ │ │ +</tr>
│ │ │ │ +</tbody>
│ │ │ │ +</table>
│ │ │ │ +<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="enum-error-code-enum-3">
│ │ │ │  <h1>enum error_code_enum</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/error_code.hpp">libtorrent/error_code.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │  <col width="32%" />
│ │ │ │  <col width="6%" />
│ │ │ │  <col width="63%" />
│ │ │ │ @@ -18597,203 +20272,14 @@
│ │ │ │  </tr>
│ │ │ │  <tr><td>service_unavailable</td>
│ │ │ │  <td>503</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="i2p_error_code"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+i2p_error_code&labels=documentation&body=Documentation+under+heading+%22enum+i2p_error_code%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-i2p-error-code">
│ │ │ │ -<h1>enum i2p_error_code</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/i2p_stream.hpp">libtorrent/i2p_stream.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="46%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="35%" />
│ │ │ │ -</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>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>parse_failed</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>cant_reach_peer</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>i2p_error</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_key</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_id</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>timeout</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>key_not_found</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>duplicated_id</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>num_errors</td>
│ │ │ │ -<td>9</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-error-code-enum-1">
│ │ │ │ -<h1>enum error_code_enum</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="18%" />
│ │ │ │ -<col width="8%" />
│ │ │ │ -<col width="74%" />
│ │ │ │ -</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_digit</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>expected digit 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, <a class="reference external" href="reference-Core.html#int">int</a> 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>overflow</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>integer overflow</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>error_code_max</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>the number of error codes</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="pcp_errors"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+pcp_errors&labels=documentation&body=Documentation+under+heading+%22enum+pcp_errors%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-pcp-errors">
│ │ │ │ -<h1>enum pcp_errors</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/natpmp.hpp">libtorrent/natpmp.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="59%" />
│ │ │ │ -<col width="14%" />
│ │ │ │ -<col width="27%" />
│ │ │ │ -</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>pcp_success</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_unsupp_version</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_not_authorized</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_malformed_request</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_unsupp_opcode</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_unsupp_option</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_malformed_option</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_network_failure</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_no_resources</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_unsupp_protocol</td>
│ │ │ │ -<td>9</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_user_ex_quota</td>
│ │ │ │ -<td>10</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_cannot_provide_external</td>
│ │ │ │ -<td>11</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_address_mismatch</td>
│ │ │ │ -<td>12</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>pcp_excessive_remote_peers</td>
│ │ │ │ -<td>13</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │  <a name="socks_error_code"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+socks_error_code&labels=documentation&body=Documentation+under+heading+%22enum+socks_error_code%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="enum-socks-error-code">
│ │ │ │  <h1>enum socks_error_code</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/socks5_stream.hpp">libtorrent/socks5_stream.hpp</a>&quot;</p>
│ │ │ │  <table border="1" class="docutils">
│ │ │ │  <colgroup>
│ │ │ │  <col width="64%" />
│ │ │ │ @@ -18849,1242 +20335,40 @@
│ │ │ │  </tr>
│ │ │ │  <tr><td>num_errors</td>
│ │ │ │  <td>10</td>
│ │ │ │  <td>&nbsp;</td>
│ │ │ │  </tr>
│ │ │ │  </tbody>
│ │ │ │  </table>
│ │ │ │ -<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-error-code-enum-2">
│ │ │ │ -<h1>enum error_code_enum</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/gzip.hpp">libtorrent/gzip.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="33%" />
│ │ │ │ -<col width="6%" />
│ │ │ │ -<col width="61%" />
│ │ │ │ -</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>invalid_gzip_header</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>the supplied gzip buffer has invalid header</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>inflated_data_too_large</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>the gzip buffer would inflate to more bytes than the specified
│ │ │ │ -maximum size, and was rejected.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>data_did_not_terminate</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>available inflate data did not terminate</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>space_exhausted</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>output space exhausted before completing inflate</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_block_type</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>invalid block type (type == 3)</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_stored_block_length</td>
│ │ │ │ -<td>6</td>
│ │ │ │ -<td>stored block length did not match one's complement</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>too_many_length_or_distance_codes</td>
│ │ │ │ -<td>7</td>
│ │ │ │ -<td>dynamic block code description: too many length or distance codes</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>code_lengths_codes_incomplete</td>
│ │ │ │ -<td>8</td>
│ │ │ │ -<td>dynamic block code description: code lengths codes incomplete</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>repeat_lengths_with_no_first_length</td>
│ │ │ │ -<td>9</td>
│ │ │ │ -<td>dynamic block code description: repeat lengths with no first length</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>repeat_more_than_specified_lengths</td>
│ │ │ │ -<td>10</td>
│ │ │ │ -<td>dynamic block code description: repeat more than specified lengths</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_literal_length_code_lengths</td>
│ │ │ │ -<td>11</td>
│ │ │ │ -<td>dynamic block code description: invalid literal/length code lengths</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_distance_code_lengths</td>
│ │ │ │ -<td>12</td>
│ │ │ │ -<td>dynamic block code description: invalid distance code lengths</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_literal_code_in_block</td>
│ │ │ │ -<td>13</td>
│ │ │ │ -<td>invalid literal/length or distance code in fixed or dynamic block</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>distance_too_far_back_in_block</td>
│ │ │ │ -<td>14</td>
│ │ │ │ -<td>distance is too far back in fixed or dynamic block</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>unknown_gzip_error</td>
│ │ │ │ -<td>15</td>
│ │ │ │ -<td>an unknown error occurred during gzip inflation</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>error_code_max</td>
│ │ │ │ -<td>16</td>
│ │ │ │ -<td>the number of error codes</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="error_code_enum"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+error_code_enum&labels=documentation&body=Documentation+under+heading+%22enum+error_code_enum%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-error-code-enum-3">
│ │ │ │ -<h1>enum error_code_enum</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/upnp.hpp">libtorrent/upnp.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="37%" />
│ │ │ │ -<col width="7%" />
│ │ │ │ -<col width="56%" />
│ │ │ │ -</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>No error</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>invalid_argument</td>
│ │ │ │ -<td>402</td>
│ │ │ │ -<td>One of the arguments in the request is invalid</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>action_failed</td>
│ │ │ │ -<td>501</td>
│ │ │ │ -<td>The request failed</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>value_not_in_array</td>
│ │ │ │ -<td>714</td>
│ │ │ │ -<td>The specified value does not exist in the array</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>source_ip_cannot_be_wildcarded</td>
│ │ │ │ -<td>715</td>
│ │ │ │ -<td>The source IP address cannot be wild-carded, but
│ │ │ │ -must be fully specified</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>external_port_cannot_be_wildcarded</td>
│ │ │ │ -<td>716</td>
│ │ │ │ -<td>The external port cannot be a wildcard, but must
│ │ │ │ -be specified</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>port_mapping_conflict</td>
│ │ │ │ -<td>718</td>
│ │ │ │ -<td>The port mapping <a class="reference external" href="reference-Bencoding.html#entry">entry</a> specified conflicts with a
│ │ │ │ -mapping assigned previously to another client</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>internal_port_must_match_external</td>
│ │ │ │ -<td>724</td>
│ │ │ │ -<td>Internal and external port value must be the same</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>only_permanent_leases_supported</td>
│ │ │ │ -<td>725</td>
│ │ │ │ -<td>The NAT implementation only supports permanent
│ │ │ │ -lease times on port mappings</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>remote_host_must_be_wildcard</td>
│ │ │ │ -<td>726</td>
│ │ │ │ -<td>RemoteHost must be a wildcard and cannot be a
│ │ │ │ -specific IP address or DNS name</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>external_port_must_be_wildcard</td>
│ │ │ │ -<td>727</td>
│ │ │ │ -<td>ExternalPort must be a wildcard and cannot be a
│ │ │ │ -specific port</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="bdecode_node"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+bdecode_node&labels=documentation&body=Documentation+under+heading+%22class+bdecode_node%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="bdecode-node">
│ │ │ │ -<h1>bdecode_node</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ -<p>Sometimes it's important to get a non-owning reference to the root node (
│ │ │ │ -to be able to copy it as a reference for instance). For that, use the
│ │ │ │ -<a class="reference external" href="reference-Bdecoding.html#non_owning()">non_owning()</a> member function.</p>
│ │ │ │ -<p>There are 5 different types of nodes, see <a class="reference external" href="reference-Bdecoding.html#type_t">type_t</a>.</p>
│ │ │ │ +<a name="dht_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_state&labels=documentation&body=Documentation+under+heading+%22class+dht_state%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="dht-state">
│ │ │ │ +<h1>dht_state</h1>
│ │ │ │ +<p>Declared in &quot;<a class="reference external" href="include/libtorrent/kademlia/dht_state.hpp">libtorrent/kademlia/dht_state.hpp</a>&quot;</p>
│ │ │ │ +<p>This structure helps to store and load the state
│ │ │ │ +of the <tt class="docutils literal">dht_tracker</tt>.
│ │ │ │ +At this moment the library is only a dual stack
│ │ │ │ +implementation of the DHT. See <a class="reference external" href="https://www.bittorrent.org/beps/bep_0032.html">BEP 32</a></p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -struct bdecode_node
│ │ │ │ +struct dht_state
│ │ │ │  {
│ │ │ │ -   <strong>bdecode_node</strong> () = default;
│ │ │ │ -   bdecode_node&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │ -   bdecode_node&amp; <strong>operator=</strong> (bdecode_node&amp;&amp;) &amp; = default;
│ │ │ │ -   <strong>bdecode_node</strong> (bdecode_node const&amp;);
│ │ │ │ -   <strong>bdecode_node</strong> (bdecode_node&amp;&amp;) noexcept;
│ │ │ │ -   type_t <strong>type</strong> () const noexcept;
│ │ │ │ -   explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ -   bdecode_node <strong>non_owning</strong> () const;
│ │ │ │ -   std::ptrdiff_t <strong>data_offset</strong> () const noexcept;
│ │ │ │ -   span&lt;char const&gt; <strong>data_section</strong> () const noexcept;
│ │ │ │ -   std::int64_t <strong>list_int_value_at</strong> (int i
│ │ │ │ -      , std::int64_t default_val = 0) const;
│ │ │ │ -   int <strong>list_size</strong> () const;
│ │ │ │ -   bdecode_node <strong>list_at</strong> (int i) const;
│ │ │ │ -   string_view <strong>list_string_value_at</strong> (int i
│ │ │ │ -      , string_view default_val = string_view()) const;
│ │ │ │ -   std::pair&lt;bdecode_node, bdecode_node&gt; <strong>dict_at_node</strong> (int i) const;
│ │ │ │ -   bdecode_node <strong>dict_find</strong> (string_view key) const;
│ │ │ │ -   std::int64_t <strong>dict_find_int_value</strong> (string_view key
│ │ │ │ -      , std::int64_t default_val = 0) const;
│ │ │ │ -   std::pair&lt;string_view, bdecode_node&gt; <strong>dict_at</strong> (int i) const;
│ │ │ │ -   bdecode_node <strong>dict_find_dict</strong> (string_view key) const;
│ │ │ │ -   bdecode_node <strong>dict_find_string</strong> (string_view key) const;
│ │ │ │ -   string_view <strong>dict_find_string_value</strong> (string_view key
│ │ │ │ -      , string_view default_value = string_view()) const;
│ │ │ │ -   bdecode_node <strong>dict_find_int</strong> (string_view key) const;
│ │ │ │ -   int <strong>dict_size</strong> () const;
│ │ │ │ -   bdecode_node <strong>dict_find_list</strong> (string_view key) const;
│ │ │ │ -   std::int64_t <strong>int_value</strong> () const;
│ │ │ │ -   int <strong>string_length</strong> () const;
│ │ │ │ -   string_view <strong>string_value</strong> () const;
│ │ │ │ -   char const* <strong>string_ptr</strong> () const;
│ │ │ │ -   std::ptrdiff_t <strong>string_offset</strong> () const;
│ │ │ │     void <strong>clear</strong> ();
│ │ │ │ -   void <strong>swap</strong> (bdecode_node&amp; n);
│ │ │ │ -   void <strong>reserve</strong> (int tokens);
│ │ │ │ -   void <strong>switch_underlying_buffer</strong> (char const* buf) noexcept;
│ │ │ │ -   bool <strong>has_soft_error</strong> (span&lt;char&gt; error) const;
│ │ │ │ -
│ │ │ │ -   enum type_t
│ │ │ │ -   {
│ │ │ │ -      none_t,
│ │ │ │ -      dict_t,
│ │ │ │ -      list_t,
│ │ │ │ -      string_t,
│ │ │ │ -      int_t,
│ │ │ │ -   };
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="bdecode_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bbdecode_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bbdecode_node%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="bdecode-node-1">
│ │ │ │ -<h2>bdecode_node()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>bdecode_node</strong> () = default;
│ │ │ │ -</pre>
│ │ │ │ -<p>creates a default constructed node, it will have the type <tt class="docutils literal">none_t</tt>.</p>
│ │ │ │ -<a name="operator=()"></a>
│ │ │ │ -<a name="bdecode_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Boperator%3D%28%29+bdecode_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Boperator%3D%28%29+bdecode_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="operator-bdecode-node">
│ │ │ │ -<h2>operator=() bdecode_node()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bdecode_node&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │ -bdecode_node&amp; <strong>operator=</strong> (bdecode_node&amp;&amp;) &amp; = default;
│ │ │ │ -<strong>bdecode_node</strong> (bdecode_node const&amp;);
│ │ │ │ -<strong>bdecode_node</strong> (bdecode_node&amp;&amp;) noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>For owning nodes, the copy will create a copy of the tree, but the
│ │ │ │ -underlying buffer remains the same.</p>
│ │ │ │ -<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="type-2">
│ │ │ │ -<h2>type()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -type_t <strong>type</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>the type of this node. See <a class="reference external" href="reference-Bdecoding.html#type_t">type_t</a>.</p>
│ │ │ │ -<a name="bool()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bbool%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bbool%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="bool-2">
│ │ │ │ -<h2>bool()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -explicit operator <strong>bool</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if <a class="reference external" href="reference-Bencoding.html#type()">type()</a> != none_t.</p>
│ │ │ │ -<a name="non_owning()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bnon_owning%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bnon_owning%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="non-owning">
│ │ │ │ -<h2>non_owning()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bdecode_node <strong>non_owning</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>return a non-owning reference to this node. This is useful to refer to
│ │ │ │ -the root node without copying it in assignments.</p>
│ │ │ │ -<a name="data_section()"></a>
│ │ │ │ -<a name="data_offset()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bdata_section%28%29+data_offset%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bdata_section%28%29+data_offset%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="data-section-data-offset">
│ │ │ │ -<h2>data_section() data_offset()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::ptrdiff_t <strong>data_offset</strong> () const noexcept;
│ │ │ │ -span&lt;char const&gt; <strong>data_section</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the buffer and length of the section in the original bencoded
│ │ │ │ -buffer where this node is defined. For a dictionary for instance, this
│ │ │ │ -starts with <tt class="docutils literal">d</tt> and ends with <tt class="docutils literal">e</tt>, and has all the content of the
│ │ │ │ -dictionary in between.
│ │ │ │ -the <tt class="docutils literal">data_offset()</tt> function returns the byte-offset to this node in,
│ │ │ │ -starting from the beginning of the buffer that was parsed.</p>
│ │ │ │ -<a name="list_string_value_at()"></a>
│ │ │ │ -<a name="list_int_value_at()"></a>
│ │ │ │ -<a name="list_size()"></a>
│ │ │ │ -<a name="list_at()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Blist_string_value_at%28%29+list_int_value_at%28%29+list_size%28%29+list_at%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Blist_string_value_at%28%29+list_int_value_at%28%29+list_size%28%29+list_at%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="list-string-value-at-list-int-value-at-list-size-list-at">
│ │ │ │ -<h2>list_string_value_at() list_int_value_at() list_size() list_at()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::int64_t <strong>list_int_value_at</strong> (int i
│ │ │ │ -      , std::int64_t default_val = 0) const;
│ │ │ │ -int <strong>list_size</strong> () const;
│ │ │ │ -bdecode_node <strong>list_at</strong> (int i) const;
│ │ │ │ -string_view <strong>list_string_value_at</strong> (int i
│ │ │ │ -      , string_view default_val = string_view()) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>functions with the <tt class="docutils literal">list_</tt> prefix operate on lists. These functions are
│ │ │ │ -only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">list_t</tt>. <tt class="docutils literal">list_at()</tt> returns the item
│ │ │ │ -in the list at index <tt class="docutils literal">i</tt>. <tt class="docutils literal">i</tt> may not be greater than or equal to the
│ │ │ │ -size of the list. <tt class="docutils literal">size()</tt> returns the size of the list.</p>
│ │ │ │ -<a name="dict_find_int()"></a>
│ │ │ │ -<a name="dict_size()"></a>
│ │ │ │ -<a name="dict_at_node()"></a>
│ │ │ │ -<a name="dict_at()"></a>
│ │ │ │ -<a name="dict_find_string()"></a>
│ │ │ │ -<a name="dict_find_string_value()"></a>
│ │ │ │ -<a name="dict_find()"></a>
│ │ │ │ -<a name="dict_find_int_value()"></a>
│ │ │ │ -<a name="dict_find_list()"></a>
│ │ │ │ -<a name="dict_find_dict()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bdict_find_int%28%29+dict_size%28%29+dict_at_node%28%29+dict_at%28%29+dict_find_string%28%29+dict_find_string_value%28%29+dict_find%28%29+dict_find_int_value%28%29+dict_find_list%28%29+dict_find_dict%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bdict_find_int%28%29+dict_size%28%29+dict_at_node%28%29+dict_at%28%29+dict_find_string%28%29+dict_find_string_value%28%29+dict_find%28%29+dict_find_int_value%28%29+dict_find_list%28%29+dict_find_dict%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="dict-find-int-dict-size-dict-at-node-dict-at-dict-find-string-dict-find-string-value-dict-find-dict-find-int-value-dict-find-list-dict-find-dict">
│ │ │ │ -<h2>dict_find_int() dict_size() dict_at_node() dict_at() dict_find_string() dict_find_string_value() dict_find() dict_find_int_value() dict_find_list() dict_find_dict()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::pair&lt;bdecode_node, bdecode_node&gt; <strong>dict_at_node</strong> (int i) const;
│ │ │ │ -bdecode_node <strong>dict_find</strong> (string_view key) const;
│ │ │ │ -std::int64_t <strong>dict_find_int_value</strong> (string_view key
│ │ │ │ -      , std::int64_t default_val = 0) const;
│ │ │ │ -std::pair&lt;string_view, bdecode_node&gt; <strong>dict_at</strong> (int i) const;
│ │ │ │ -bdecode_node <strong>dict_find_dict</strong> (string_view key) const;
│ │ │ │ -bdecode_node <strong>dict_find_string</strong> (string_view key) const;
│ │ │ │ -string_view <strong>dict_find_string_value</strong> (string_view key
│ │ │ │ -      , string_view default_value = string_view()) const;
│ │ │ │ -bdecode_node <strong>dict_find_int</strong> (string_view key) const;
│ │ │ │ -int <strong>dict_size</strong> () const;
│ │ │ │ -bdecode_node <strong>dict_find_list</strong> (string_view key) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>Functions with the <tt class="docutils literal">dict_</tt> prefix operates on dictionaries. They are
│ │ │ │ -only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">dict_t</tt>. In case a key you're looking up
│ │ │ │ -contains a 0 byte, you cannot use the 0-terminated string overloads,
│ │ │ │ -but have to use <tt class="docutils literal">string_view</tt> instead. <tt class="docutils literal">dict_find_list</tt> will return a
│ │ │ │ -valid <tt class="docutils literal">bdecode_node</tt> if the key is found _and_ it is a list. Otherwise
│ │ │ │ -it will return a default-constructed <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>.</p>
│ │ │ │ -<p>Functions with the <tt class="docutils literal">_value</tt> suffix return the value of the node
│ │ │ │ -directly, rather than the nodes. In case the node is not found, or it has
│ │ │ │ -a different type, a default value is returned (which can be specified).</p>
│ │ │ │ -<p><tt class="docutils literal">dict_at()</tt> returns the (key, value)-pair at the specified index in a
│ │ │ │ -dictionary. Keys are only allowed to be strings. <tt class="docutils literal">dict_at_node()</tt> also
│ │ │ │ -returns the (key, value)-pair, but the key is returned as a
│ │ │ │ -<tt class="docutils literal">bdecode_node</tt> (and it will always be a string).</p>
│ │ │ │ -<a name="int_value()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bint_value%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bint_value%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="int-value">
│ │ │ │ -<h2>int_value()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::int64_t <strong>int_value</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>this function is only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">int_t</tt>. It returns the
│ │ │ │ -value of the integer.</p>
│ │ │ │ -<a name="string_value()"></a>
│ │ │ │ -<a name="string_offset()"></a>
│ │ │ │ -<a name="string_length()"></a>
│ │ │ │ -<a name="string_ptr()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bstring_value%28%29+string_offset%28%29+string_length%28%29+string_ptr%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bstring_value%28%29+string_offset%28%29+string_length%28%29+string_ptr%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="string-value-string-offset-string-length-string-ptr">
│ │ │ │ -<h2>string_value() string_offset() string_length() string_ptr()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>string_length</strong> () const;
│ │ │ │ -string_view <strong>string_value</strong> () const;
│ │ │ │ -char const* <strong>string_ptr</strong> () const;
│ │ │ │ -std::ptrdiff_t <strong>string_offset</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>these functions are only valid if <tt class="docutils literal">type()</tt> == <tt class="docutils literal">string_t</tt>. They return
│ │ │ │ -the string values. Note that <tt class="docutils literal">string_ptr()</tt> is <em>not</em> 0-terminated.
│ │ │ │ -<tt class="docutils literal">string_length()</tt> returns the number of bytes in the string.
│ │ │ │ -<tt class="docutils literal">string_offset()</tt> returns the byte offset from the start of the parsed
│ │ │ │ -bencoded buffer this string can be found.</p>
│ │ │ │ -<a name="clear()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bclear%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bclear%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="clear-2">
│ │ │ │ -<h2>clear()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>clear</strong> ();
│ │ │ │ -</pre>
│ │ │ │ -<p>resets the <tt class="docutils literal">bdecoded_node</tt> to a default constructed state. If this is
│ │ │ │ -an owning node, the tree is freed and all child nodes are invalidated.</p>
│ │ │ │ -<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="swap-3">
│ │ │ │ -<h2>swap()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>swap</strong> (bdecode_node&amp; n);
│ │ │ │ -</pre>
│ │ │ │ -<p>Swap contents.</p>
│ │ │ │ -<a name="reserve()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Breserve%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Breserve%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="reserve-1">
│ │ │ │ -<h2>reserve()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>reserve</strong> (int tokens);
│ │ │ │ -</pre>
│ │ │ │ -<p>preallocate memory for the specified numbers of tokens. This is
│ │ │ │ -useful if you know approximately how many tokens are in the file
│ │ │ │ -you are about to parse. Doing so will save realloc operations
│ │ │ │ -while parsing. You should only call this on the root node, before
│ │ │ │ -passing it in to <a class="reference external" href="reference-Bdecoding.html#bdecode()">bdecode()</a>.</p>
│ │ │ │ -<a name="switch_underlying_buffer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bswitch_underlying_buffer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bswitch_underlying_buffer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="switch-underlying-buffer">
│ │ │ │ -<h2>switch_underlying_buffer()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>switch_underlying_buffer</strong> (char const* buf) noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>this buffer <em>MUST</em> be identical to the one originally parsed. This
│ │ │ │ -operation is only defined on owning root nodes, i.e. the one passed in to
│ │ │ │ -decode().</p>
│ │ │ │ -<a name="has_soft_error()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode_node%3A%3A%5Bhas_soft_error%28%29%5D&labels=documentation&body=Documentation+under+heading+%22bdecode_node%3A%3A%5Bhas_soft_error%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="has-soft-error">
│ │ │ │ -<h2>has_soft_error()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bool <strong>has_soft_error</strong> (span&lt;char&gt; error) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns true if there is a non-fatal error in the bencoding of this node
│ │ │ │ -or its children</p>
│ │ │ │ -<a name="type_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+type_t&labels=documentation&body=Documentation+under+heading+%22enum+type_t%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-type-t-1">
│ │ │ │ -<h2>enum type_t</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="13%" />
│ │ │ │ -<col width="9%" />
│ │ │ │ -<col width="78%" />
│ │ │ │ -</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>none_t</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>uninitialized or default constructed. This is also used
│ │ │ │ -to indicate that a node was not found in some cases.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>dict_t</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>a dictionary node. The <tt class="docutils literal">dict_find_</tt> functions are valid.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>list_t</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>a list node. The <tt class="docutils literal">list_</tt> functions are valid.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>string_t</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>a string node, the <tt class="docutils literal">string_</tt> functions are valid.</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>int_t</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>an integer node. The <tt class="docutils literal">int_</tt> functions are valid.</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="print_entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:print_entry%28%29&labels=documentation&body=Documentation+under+heading+%22print_entry%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="print-entry">
│ │ │ │ -<h1>print_entry()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::string <strong>print_entry</strong> (bdecode_node const&amp; e
│ │ │ │ -   , bool single_line = false, int indent = 0);
│ │ │ │ -</pre>
│ │ │ │ -<p>print the bencoded structure in a human-readable format to a string
│ │ │ │ -that's returned.</p>
│ │ │ │ -<a name="bdecode()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bdecode%28%29&labels=documentation&body=Documentation+under+heading+%22bdecode%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="bdecode">
│ │ │ │ -<h1>bdecode()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bdecode.hpp">libtorrent/bdecode.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -bdecode_node <strong>bdecode</strong> (span&lt;char const&gt; buffer
│ │ │ │ -   , int depth_limit = 100, int token_limit = 2000000);
│ │ │ │ -int <strong>bdecode</strong> (char const* start, char const* end, bdecode_node&amp; ret
│ │ │ │ -   , error_code&amp; ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ -   , int token_limit = 2000000);
│ │ │ │ -bdecode_node <strong>bdecode</strong> (span&lt;char const&gt; buffer
│ │ │ │ -   , error_code&amp; ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ -   , int token_limit = 2000000);
│ │ │ │ -</pre>
│ │ │ │ -<p>This function decodes/parses bdecoded data (for example a .torrent file).
│ │ │ │ -The data structure is returned in the <tt class="docutils literal">ret</tt> argument. the buffer to parse
│ │ │ │ -is specified by the <tt class="docutils literal">start</tt> of the buffer as well as the <tt class="docutils literal">end</tt>, i.e. one
│ │ │ │ -byte past the end. If the buffer fails to parse, the function returns a
│ │ │ │ -non-zero value and fills in <tt class="docutils literal">ec</tt> with the error code. The optional
│ │ │ │ -argument <tt class="docutils literal">error_pos</tt>, if set to non-nullptr, will be set to the byte offset
│ │ │ │ -into the buffer where the parse failure occurred.</p>
│ │ │ │ -<p><tt class="docutils literal">depth_limit</tt> specifies the max number of nested lists or dictionaries are
│ │ │ │ -allowed in the data structure. (This affects the stack usage of the
│ │ │ │ -function, be careful not to set it too high).</p>
│ │ │ │ -<p><tt class="docutils literal">token_limit</tt> is the max number of tokens allowed to be parsed from the
│ │ │ │ -buffer. This is simply a sanity check to not have unbounded memory usage.</p>
│ │ │ │ -<p>The resulting <tt class="docutils literal">bdecode_node</tt> is an <em>owning</em> node. That means it will
│ │ │ │ -be holding the whole parsed tree. When iterating lists and dictionaries,
│ │ │ │ -those <tt class="docutils literal">bdecode_node</tt> objects will simply have references to the root or
│ │ │ │ -owning <tt class="docutils literal">bdecode_node</tt>. If the root node is destructed, all other nodes
│ │ │ │ -that refer to anything in that tree become invalid.</p>
│ │ │ │ -<p>However, the underlying buffer passed in to this function (<tt class="docutils literal">start</tt>, <tt class="docutils literal">end</tt>)
│ │ │ │ -must also remain valid while the bdecoded tree is used. The parsed tree
│ │ │ │ -produced by this function does not copy any data out of the buffer, but
│ │ │ │ -simply produces references back into it.</p>
│ │ │ │ -<p>Bencoding is a common representation in bittorrent used for dictionary,
│ │ │ │ -list, <a class="reference external" href="reference-Core.html#int">int</a> and string hierarchies. It's used to encode .torrent files and
│ │ │ │ -some messages in the network protocol. libtorrent also uses it to store
│ │ │ │ -settings, resume data and other <a class="reference external" href="reference-Session.html#session">session</a> state.</p>
│ │ │ │ -<p>Strings in bencoded structures do not necessarily represent text.
│ │ │ │ -Strings are raw byte buffers of a certain length. If a string is meant to be
│ │ │ │ -interpreted as text, it is required to be UTF-8 encoded. See <a class="reference external" href="https://www.bittorrent.org/beps/bep_0003.html">BEP 3</a>.</p>
│ │ │ │ -<p>The function for decoding bencoded data <a class="reference external" href="reference-Bdecoding.html#bdecode()">bdecode()</a>, returning a <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>.
│ │ │ │ -This function builds a tree that points back into the original buffer. The
│ │ │ │ -returned <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> will not be valid once the buffer it was parsed out of
│ │ │ │ -is discarded.</p>
│ │ │ │ -<p>It's possible to construct an <a class="reference external" href="reference-Bencoding.html#entry">entry</a> from a <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>, if a structure needs
│ │ │ │ -to be altered and re-encoded.</p>
│ │ │ │ -<a name="entry"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+entry&labels=documentation&body=Documentation+under+heading+%22class+entry%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="entry">
│ │ │ │ -<h1>entry</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/entry.hpp">libtorrent/entry.hpp</a>&quot;</p>
│ │ │ │ -<p>The <tt class="docutils literal">entry</tt> class represents one node in a bencoded hierarchy. It works as a
│ │ │ │ -variant type, it can be either a list, a dictionary (<tt class="docutils literal"><span class="pre">std::map</span></tt>), an integer
│ │ │ │ -or a string.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -class entry
│ │ │ │ -{
│ │ │ │ -   data_type <strong>type</strong> () const;
│ │ │ │ -   <strong>entry</strong> (dictionary_type);
│ │ │ │ -   <strong>entry</strong> (span&lt;char const&gt;);
│ │ │ │ -   <strong>entry</strong> (integer_type);
│ │ │ │ -   <strong>entry</strong> (preformatted_type);
│ │ │ │ -   <strong>entry</strong> (list_type);
│ │ │ │ -   <strong>entry</strong> (U v);
│ │ │ │ -   <strong>entry</strong> (data_type t);
│ │ │ │ -   <strong>entry</strong> (bdecode_node const&amp; n);
│ │ │ │ -   entry&amp; <strong>operator=</strong> (dictionary_type) &amp;;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (list_type) &amp;;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (entry&amp;&amp;) &amp; noexcept;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (entry const&amp;) &amp;;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (preformatted_type) &amp;;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (integer_type) &amp;;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (span&lt;char const&gt;) &amp;;
│ │ │ │ -   entry&amp; <strong>operator=</strong> (U v) &amp;;
│ │ │ │ -   dictionary_type&amp; <strong>dict</strong> ();
│ │ │ │ -   preformatted_type&amp; <strong>preformatted</strong> ();
│ │ │ │ -   preformatted_type const&amp; <strong>preformatted</strong> () const;
│ │ │ │ -   dictionary_type const&amp; <strong>dict</strong> () const;
│ │ │ │ -   integer_type&amp; <strong>integer</strong> ();
│ │ │ │ -   string_type const&amp; <strong>string</strong> () const;
│ │ │ │ -   string_type&amp; <strong>string</strong> ();
│ │ │ │ -   list_type&amp; <strong>list</strong> ();
│ │ │ │ -   list_type const&amp; <strong>list</strong> () const;
│ │ │ │ -   integer_type const&amp; <strong>integer</strong> () const;
│ │ │ │ -   void <strong>swap</strong> (entry&amp; e);
│ │ │ │ -   entry const&amp; <strong>operator[]</strong> (string_view key) const;
│ │ │ │ -   entry&amp; <strong>operator[]</strong> (string_view key);
│ │ │ │ -   entry* <strong>find_key</strong> (string_view key);
│ │ │ │ -   entry const* <strong>find_key</strong> (string_view key) const;
│ │ │ │ -   std::string <strong>to_string</strong> (bool single_line = false) const;
│ │ │ │ -
│ │ │ │ -   enum data_type
│ │ │ │ -   {
│ │ │ │ -      int_t,
│ │ │ │ -      string_t,
│ │ │ │ -      list_t,
│ │ │ │ -      dictionary_t,
│ │ │ │ -      undefined_t,
│ │ │ │ -      preformatted_t,
│ │ │ │ -   };
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="type-3">
│ │ │ │ -<h2>type()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -data_type <strong>type</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the concrete type of the <a class="reference external" href="reference-Bencoding.html#entry">entry</a></p>
│ │ │ │ -<a name="entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bentry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bentry%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="entry-1">
│ │ │ │ -<h2>entry()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>entry</strong> (dictionary_type);
│ │ │ │ -<strong>entry</strong> (span&lt;char const&gt;);
│ │ │ │ -<strong>entry</strong> (integer_type);
│ │ │ │ -<strong>entry</strong> (preformatted_type);
│ │ │ │ -<strong>entry</strong> (list_type);
│ │ │ │ -</pre>
│ │ │ │ -<p>constructors directly from a specific type.
│ │ │ │ -The content of the argument is copied into the
│ │ │ │ -newly constructed <a class="reference external" href="reference-Bencoding.html#entry">entry</a></p>
│ │ │ │ -<a name="entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bentry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bentry%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="entry-2">
│ │ │ │ -<h2>entry()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>entry</strong> (data_type t);
│ │ │ │ -</pre>
│ │ │ │ -<p>construct an empty <a class="reference external" href="reference-Bencoding.html#entry">entry</a> of the specified type.
│ │ │ │ -see <a class="reference external" href="reference-Bencoding.html#data_type">data_type</a> enum.</p>
│ │ │ │ -<a name="entry()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bentry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bentry%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="entry-3">
│ │ │ │ -<h2>entry()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -<strong>entry</strong> (bdecode_node const&amp; n);
│ │ │ │ -</pre>
│ │ │ │ -<p>construct from <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a> parsed form (see <a class="reference external" href="reference-Bdecoding.html#bdecode()">bdecode()</a>)</p>
│ │ │ │ -<a name="operator=()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Boperator%3D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Boperator%3D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="operator-4">
│ │ │ │ -<h2>operator=()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -entry&amp; <strong>operator=</strong> (dictionary_type) &amp;;
│ │ │ │ -entry&amp; <strong>operator=</strong> (list_type) &amp;;
│ │ │ │ -entry&amp; <strong>operator=</strong> (entry&amp;&amp;) &amp; noexcept;
│ │ │ │ -entry&amp; <strong>operator=</strong> (bdecode_node const&amp;) &amp;;
│ │ │ │ -entry&amp; <strong>operator=</strong> (entry const&amp;) &amp;;
│ │ │ │ -entry&amp; <strong>operator=</strong> (preformatted_type) &amp;;
│ │ │ │ -entry&amp; <strong>operator=</strong> (integer_type) &amp;;
│ │ │ │ -entry&amp; <strong>operator=</strong> (span&lt;char const&gt;) &amp;;
│ │ │ │ -</pre>
│ │ │ │ -<p>copies the structure of the right hand side into this
│ │ │ │ -<a class="reference external" href="reference-Bencoding.html#entry">entry</a>.</p>
│ │ │ │ -<a name="preformatted()"></a>
│ │ │ │ -<a name="dict()"></a>
│ │ │ │ -<a name="list()"></a>
│ │ │ │ -<a name="string()"></a>
│ │ │ │ -<a name="integer()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bpreformatted%28%29+dict%28%29+list%28%29+string%28%29+integer%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bpreformatted%28%29+dict%28%29+list%28%29+string%28%29+integer%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="preformatted-dict-list-string-integer">
│ │ │ │ -<h2>preformatted() dict() list() string() integer()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -dictionary_type&amp; <strong>dict</strong> ();
│ │ │ │ -preformatted_type&amp; <strong>preformatted</strong> ();
│ │ │ │ -preformatted_type const&amp; <strong>preformatted</strong> () const;
│ │ │ │ -dictionary_type const&amp; <strong>dict</strong> () const;
│ │ │ │ -integer_type&amp; <strong>integer</strong> ();
│ │ │ │ -string_type const&amp; <strong>string</strong> () const;
│ │ │ │ -string_type&amp; <strong>string</strong> ();
│ │ │ │ -list_type&amp; <strong>list</strong> ();
│ │ │ │ -list_type const&amp; <strong>list</strong> () const;
│ │ │ │ -integer_type const&amp; <strong>integer</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>The <tt class="docutils literal">integer()</tt>, <tt class="docutils literal">string()</tt>, <tt class="docutils literal">list()</tt> and <tt class="docutils literal">dict()</tt> functions
│ │ │ │ -are accessors that return the respective type. If the <tt class="docutils literal">entry</tt> object
│ │ │ │ -isn't of the type you request, the accessor will throw
│ │ │ │ -system_error. You can ask an <tt class="docutils literal">entry</tt> for its type through the
│ │ │ │ -<tt class="docutils literal">type()</tt> function.</p>
│ │ │ │ -<p>If you want to create an <tt class="docutils literal">entry</tt> you give it the type you want it to
│ │ │ │ -have in its constructor, and then use one of the non-const accessors
│ │ │ │ -to get a reference which you then can assign the value you want it to
│ │ │ │ -have.</p>
│ │ │ │ -<p>The typical code to get info from a torrent file will then look like
│ │ │ │ -this:</p>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="name">entry</span><span class="whitespace"> </span><span class="name">torrent_file</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -</span><span class="comment single">// ...
│ │ │ │ -</span><span class="whitespace">
│ │ │ │ -</span><span class="comment single">// throws if this is not a dictionary
│ │ │ │ -</span><span class="name">entry</span><span class="operator">::</span><span class="name">dictionary_type</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">dict</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">torrent_file</span><span class="punctuation">.</span><span class="name">dict</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ -</span><span class="name">entry</span><span class="operator">::</span><span class="name">dictionary_type</span><span class="operator">::</span><span class="name">const_iterator</span><span class="whitespace"> </span><span class="name">i</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -</span><span class="name">i</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">dict</span><span class="punctuation">.</span><span class="name">find</span><span class="punctuation">(</span><span class="literal string">&quot;announce&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">i</span><span class="whitespace"> </span><span class="operator">!=</span><span class="whitespace"> </span><span class="name">dict</span><span class="punctuation">.</span><span class="name">end</span><span class="punctuation">())</span><span class="whitespace">
│ │ │ │ -</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -        </span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="name">tracker_url</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">second</span><span class="punctuation">.</span><span class="name">string</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ -        </span><span class="name">std</span><span class="operator">::</span><span class="name">cout</span><span class="whitespace"> </span><span class="operator">&lt;&lt;</span><span class="whitespace"> </span><span class="name">tracker_url</span><span class="whitespace"> </span><span class="operator">&lt;&lt;</span><span class="whitespace"> </span><span class="literal string">&quot;</span><span class="literal string escape">\n</span><span class="literal string">&quot;</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -</span><span class="punctuation">}</span>
│ │ │ │ -</pre>
│ │ │ │ -<p>The following code is equivalent, but a little bit shorter:</p>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="name">entry</span><span class="whitespace"> </span><span class="name">torrent_file</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -</span><span class="comment single">// ...
│ │ │ │ -</span><span class="whitespace">
│ │ │ │ -</span><span class="comment single">// throws if this is not a dictionary
│ │ │ │ -</span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">entry</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">i</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">torrent_file</span><span class="punctuation">.</span><span class="name">find_key</span><span class="punctuation">(</span><span class="literal string">&quot;announce&quot;</span><span class="punctuation">))</span><span class="whitespace">
│ │ │ │ -</span><span class="punctuation">{</span><span class="whitespace">
│ │ │ │ -        </span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="name">tracker_url</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">i</span><span class="operator">-&gt;</span><span class="name">string</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ -        </span><span class="name">std</span><span class="operator">::</span><span class="name">cout</span><span class="whitespace"> </span><span class="operator">&lt;&lt;</span><span class="whitespace"> </span><span class="name">tracker_url</span><span class="whitespace"> </span><span class="operator">&lt;&lt;</span><span class="whitespace"> </span><span class="literal string">&quot;</span><span class="literal string escape">\n</span><span class="literal string">&quot;</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -</span><span class="punctuation">}</span>
│ │ │ │ -</pre>
│ │ │ │ -<p>To make it easier to extract information from a torrent file, the
│ │ │ │ -class <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> exists.</p>
│ │ │ │ -<a name="swap()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bswap%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bswap%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="swap-4">
│ │ │ │ -<h2>swap()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>swap</strong> (entry&amp; e);
│ │ │ │ -</pre>
│ │ │ │ -<p>swaps the content of <em>this</em> with <tt class="docutils literal">e</tt>.</p>
│ │ │ │ -<a name="operator[]()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Boperator%5B%5D%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Boperator%5B%5D%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="operator-5">
│ │ │ │ -<h2>operator[]()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -entry const&amp; <strong>operator[]</strong> (string_view key) const;
│ │ │ │ -entry&amp; <strong>operator[]</strong> (string_view key);
│ │ │ │ -</pre>
│ │ │ │ -<p>All of these functions requires the <a class="reference external" href="reference-Bencoding.html#entry">entry</a> to be a dictionary, if it
│ │ │ │ -isn't they will throw <tt class="docutils literal">system_error</tt>.</p>
│ │ │ │ -<p>The non-const versions of the <tt class="docutils literal">operator[]</tt> will return a reference
│ │ │ │ -to either the existing element at the given key or, if there is no
│ │ │ │ -element with the given key, a reference to a newly inserted element at
│ │ │ │ -that key.</p>
│ │ │ │ -<p>The const version of <tt class="docutils literal">operator[]</tt> will only return a reference to an
│ │ │ │ -existing element at the given key. If the key is not found, it will
│ │ │ │ -throw <tt class="docutils literal">system_error</tt>.</p>
│ │ │ │ -<a name="find_key()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bfind_key%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bfind_key%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="find-key">
│ │ │ │ -<h2>find_key()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -entry* <strong>find_key</strong> (string_view key);
│ │ │ │ -entry const* <strong>find_key</strong> (string_view key) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>These functions requires the <a class="reference external" href="reference-Bencoding.html#entry">entry</a> to be a dictionary, if it isn't
│ │ │ │ -they will throw <tt class="docutils literal">system_error</tt>.</p>
│ │ │ │ -<p>They will look for an element at the given key in the dictionary, if
│ │ │ │ -the element cannot be found, they will return nullptr. If an element
│ │ │ │ -with the given key is found, the return a pointer to it.</p>
│ │ │ │ -<a name="to_string()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:entry%3A%3A%5Bto_string%28%29%5D&labels=documentation&body=Documentation+under+heading+%22entry%3A%3A%5Bto_string%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="to-string">
│ │ │ │ -<h2>to_string()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::string <strong>to_string</strong> (bool single_line = false) const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns a pretty-printed string representation
│ │ │ │ -of the bencoded structure, with JSON-style syntax</p>
│ │ │ │ -<a name="data_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+data_type&labels=documentation&body=Documentation+under+heading+%22enum+data_type%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="enum-data-type">
│ │ │ │ -<h2>enum data_type</h2>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/entry.hpp">libtorrent/entry.hpp</a>&quot;</p>
│ │ │ │ -<table border="1" class="docutils">
│ │ │ │ -<colgroup>
│ │ │ │ -<col width="44%" />
│ │ │ │ -<col width="19%" />
│ │ │ │ -<col width="36%" />
│ │ │ │ -</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>int_t</td>
│ │ │ │ -<td>0</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>string_t</td>
│ │ │ │ -<td>1</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>list_t</td>
│ │ │ │ -<td>2</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>dictionary_t</td>
│ │ │ │ -<td>3</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>undefined_t</td>
│ │ │ │ -<td>4</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -<tr><td>preformatted_t</td>
│ │ │ │ -<td>5</td>
│ │ │ │ -<td>&nbsp;</td>
│ │ │ │ -</tr>
│ │ │ │ -</tbody>
│ │ │ │ -</table>
│ │ │ │ -<a name="bencode()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:bencode%28%29&labels=documentation&body=Documentation+under+heading+%22bencode%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="bencode">
│ │ │ │ -<h1>bencode()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/bencode.hpp">libtorrent/bencode.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -template&lt;class OutIt&gt; int <strong>bencode</strong> (OutIt out, const entry&amp; e);
│ │ │ │ -</pre>
│ │ │ │ -<p>This function will encode data to bencoded form.</p>
│ │ │ │ -<p>The <a class="reference internal" href="#entry">entry</a> class is the internal representation of the bencoded data
│ │ │ │ -and it can be used to retrieve information, an <a class="reference internal" href="#entry">entry</a> can also be build by
│ │ │ │ -the program and given to <tt class="docutils literal">bencode()</tt> to encode it into the <tt class="docutils literal">OutIt</tt>
│ │ │ │ -iterator.</p>
│ │ │ │ -<p><tt class="docutils literal">OutIt</tt> is an <a class="reference external" href="https://en.cppreference.com/w/cpp/named_req/OutputIterator">OutputIterator</a>. It's a template and usually
│ │ │ │ -instantiated as <a class="reference external" href="https://en.cppreference.com/w/cpp/iterator/ostream_iterator">ostream_iterator</a> or <a class="reference external" href="https://en.cppreference.com/w/cpp/iterator/back_insert_iterator">back_insert_iterator</a>. This
│ │ │ │ -function assumes the value_type of the iterator is a <tt class="docutils literal">char</tt>.
│ │ │ │ -In order to encode <a class="reference external" href="reference-Bencoding.html#entry">entry</a> <tt class="docutils literal">e</tt> into a buffer, do:</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::vector&lt;char&gt; buf;
│ │ │ │ -bencode(std::back_inserter(buf), e);
│ │ │ │ -</pre>
│ │ │ │ -<a name="operator<<()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:operator%3C%3C%28%29&labels=documentation&body=Documentation+under+heading+%22operator%3C%3C%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="operator-6">
│ │ │ │ -<h1>operator&lt;&lt;()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/entry.hpp">libtorrent/entry.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -inline std::ostream&amp; <strong>operator&lt;&lt;</strong> (std::ostream&amp; os, const entry&amp; e);
│ │ │ │ -</pre>
│ │ │ │ -<p>prints the bencoded structure to the ostream as a JSON-style structure.</p>
│ │ │ │ -<p>This section describes the functions and classes that are used
│ │ │ │ -to create torrent files. It is a layered API with low level classes
│ │ │ │ -and higher level convenience functions. A torrent is created in 4
│ │ │ │ -steps:</p>
│ │ │ │ -<ol class="arabic simple">
│ │ │ │ -<li>first the files that will be part of the torrent are determined.</li>
│ │ │ │ -<li>the torrent properties are set, such as tracker url, web seeds,
│ │ │ │ -DHT nodes etc.</li>
│ │ │ │ -<li>Read through all the files in the torrent, SHA-1 all the data
│ │ │ │ -and set the piece hashes.</li>
│ │ │ │ -<li>The torrent is bencoded into a file or buffer.</li>
│ │ │ │ -</ol>
│ │ │ │ -<p>If there are a lot of files and or deep directory hierarchies to
│ │ │ │ -traverse, step one can be time consuming.</p>
│ │ │ │ -<p>Typically step 3 is by far the most time consuming step, since it
│ │ │ │ -requires to read all the bytes from all the files in the torrent.</p>
│ │ │ │ -<p>All of these classes and functions are declared by including
│ │ │ │ -<tt class="docutils literal">libtorrent/create_torrent.hpp</tt>.</p>
│ │ │ │ -<p>example:</p>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="name">file_storage</span><span class="whitespace"> </span><span class="name">fs</span><span class="punctuation">;</span><span class="whitespace">
│ │ │ │ -
│ │ │ │ -</span><span class="comment single">// recursively adds files in directories
│ │ │ │ -</span><span class="name">add_files</span><span class="punctuation">(</span><span class="name">fs</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="literal string">&quot;./my_torrent&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -
│ │ │ │ -</span><span class="name">create_torrent</span><span class="whitespace"> </span><span class="name function">t</span><span class="punctuation">(</span><span class="name">fs</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="name">t</span><span class="punctuation">.</span><span class="name">add_tracker</span><span class="punctuation">(</span><span class="literal string">&quot;http://my.tracker.com/announce&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="name">t</span><span class="punctuation">.</span><span class="name">set_creator</span><span class="punctuation">(</span><span class="literal string">&quot;libtorrent example&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -
│ │ │ │ -</span><span class="comment single">// reads the files and calculates the hashes
│ │ │ │ -</span><span class="name">set_piece_hashes</span><span class="punctuation">(</span><span class="name">t</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="literal string">&quot;.&quot;</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -
│ │ │ │ -</span><span class="name">ofstream</span><span class="whitespace"> </span><span class="name">out</span><span class="punctuation">(</span><span class="literal string">&quot;my_torrent.torrent&quot;</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">std</span><span class="operator">::</span><span class="name">ios_base</span><span class="operator">::</span><span class="name">binary</span><span class="punctuation">);</span><span class="whitespace">
│ │ │ │ -</span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">buf</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">t</span><span class="punctuation">.</span><span class="name">generate_buf</span><span class="punctuation">();</span><span class="whitespace">
│ │ │ │ -</span><span class="name">out</span><span class="punctuation">.</span><span class="name">write</span><span class="punctuation">(</span><span class="name">buf</span><span class="punctuation">.</span><span class="name">data</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="name">buf</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">());</span><span class="whitespace">
│ │ │ │ -
│ │ │ │ -</span><span class="comment single">// alternatively, generate an entry and encode it directly to an ostream
│ │ │ │ -// iterator
│ │ │ │ -</span><span class="name">bencode</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">ostream_iterator</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;</span><span class="punctuation">(</span><span class="name">out</span><span class="punctuation">),</span><span class="whitespace"> </span><span class="name">t</span><span class="punctuation">.</span><span class="name">generate</span><span class="punctuation">());</span>
│ │ │ │ -</pre>
│ │ │ │ -<a name="create_torrent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+create_torrent&labels=documentation&body=Documentation+under+heading+%22class+create_torrent%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="create-torrent">
│ │ │ │ -<h1>create_torrent</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/create_torrent.hpp">libtorrent/create_torrent.hpp</a>&quot;</p>
│ │ │ │ -<p>This class holds state for creating a torrent. After having added
│ │ │ │ -all information to it, call <a class="reference external" href="reference-Create_Torrents.html#generate()">create_torrent::generate()</a> to generate
│ │ │ │ -the torrent. The <a class="reference external" href="reference-Bencoding.html#entry">entry</a> that's returned can then be bencoded into a
│ │ │ │ -.torrent file using <a class="reference external" href="reference-Bencoding.html#bencode()">bencode()</a>.</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct create_torrent
│ │ │ │ -{
│ │ │ │ -   explicit <strong>create_torrent</strong> (file_storage&amp; fs, int piece_size = 0
│ │ │ │ -      , create_flags_t flags = {});
│ │ │ │ -   explicit <strong>create_torrent</strong> (torrent_info const&amp; ti);
│ │ │ │ -   entry <strong>generate</strong> () const;
│ │ │ │ -   std::vector&lt;char&gt; <strong>generate_buf</strong> () const;
│ │ │ │ -   file_storage const&amp; <strong>files</strong> () const;
│ │ │ │ -   void <strong>set_comment</strong> (char const* str);
│ │ │ │ -   void <strong>set_creator</strong> (char const* str);
│ │ │ │ -   void <strong>set_creation_date</strong> (std::time_t timestamp);
│ │ │ │ -   void <strong>set_hash</strong> (piece_index_t index, sha1_hash const&amp; h);
│ │ │ │ -   void <strong>set_hash2</strong> (file_index_t file, piece_index_t::diff_type piece, sha256_hash const&amp; h);
│ │ │ │ -   void <strong>add_url_seed</strong> (string_view url);
│ │ │ │ -   void <strong>add_http_seed</strong> (string_view url);
│ │ │ │ -   void <strong>add_node</strong> (std::pair&lt;std::string, int&gt; node);
│ │ │ │ -   void <strong>add_tracker</strong> (string_view url, int tier = 0);
│ │ │ │ -   void <strong>set_root_cert</strong> (string_view cert);
│ │ │ │ -   void <strong>set_priv</strong> (bool p);
│ │ │ │ -   bool <strong>priv</strong> () const;
│ │ │ │ -   bool <strong>is_v1_only</strong> () const;
│ │ │ │ -   bool <strong>is_v2_only</strong> () const;
│ │ │ │ -   int <strong>num_pieces</strong> () const;
│ │ │ │ -   piece_index_t <strong>end_piece</strong> () const;
│ │ │ │ -   index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │ -   file_index_t <strong>end_file</strong> () const;
│ │ │ │ -   index_range&lt;file_index_t&gt; <strong>file_range</strong> () const noexcept;
│ │ │ │ -   index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t f);
│ │ │ │ -   std::int64_t <strong>total_size</strong> () const;
│ │ │ │ -   int <strong>piece_length</strong> () const;
│ │ │ │ -   int <strong>piece_size</strong> (piece_index_t i) const;
│ │ │ │ -   void <strong>add_similar_torrent</strong> (sha1_hash ih);
│ │ │ │ -   void <strong>add_collection</strong> (string_view c);
│ │ │ │  
│ │ │ │ -   static constexpr create_flags_t <strong>modification_time</strong>  = 2_bit;
│ │ │ │ -   static constexpr create_flags_t <strong>symlinks</strong>  = 3_bit;
│ │ │ │ -   static constexpr create_flags_t <strong>v2_only</strong>  = 5_bit;
│ │ │ │ -   static constexpr create_flags_t <strong>v1_only</strong>  = 6_bit;
│ │ │ │ -   static constexpr create_flags_t <strong>canonical_files</strong>  = 7_bit;
│ │ │ │ -   static constexpr create_flags_t <strong>no_attributes</strong>  = 8_bit;
│ │ │ │ -   static constexpr create_flags_t <strong>canonical_files_no_tail_padding</strong>  = 9_bit;
│ │ │ │ +   node_ids_t nids;
│ │ │ │ +   std::vector&lt;udp::endpoint&gt; nodes;
│ │ │ │ +   std::vector&lt;udp::endpoint&gt; nodes6;
│ │ │ │  };
│ │ │ │  </pre>
│ │ │ │ -<a name="create_torrent()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bcreate_torrent%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bcreate_torrent%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="create-torrent-1">
│ │ │ │ -<h2>create_torrent()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -explicit <strong>create_torrent</strong> (file_storage&amp; fs, int piece_size = 0
│ │ │ │ -      , create_flags_t flags = {});
│ │ │ │ -explicit <strong>create_torrent</strong> (torrent_info const&amp; ti);
│ │ │ │ -</pre>
│ │ │ │ -<p>The <tt class="docutils literal">piece_size</tt> is the size of each piece in bytes. It must be a
│ │ │ │ -power of 2 and a minimum of 16 kiB. If a piece size of 0 is
│ │ │ │ -specified, a piece_size will be set automatically.
│ │ │ │ -Piece sizes greater than 128 MiB are considered unreasonable and will
│ │ │ │ -be rejected (with an lt::system_error exception).</p>
│ │ │ │ -<p>The <tt class="docutils literal">flags</tt> arguments specifies options for the torrent creation. It can
│ │ │ │ -be any combination of the flags defined by create_flags_t.</p>
│ │ │ │ -<p>The <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> (<tt class="docutils literal">fs</tt>) parameter defines the files, sizes and
│ │ │ │ -their properties for the torrent to be created. Set this up first,
│ │ │ │ -before passing it to the <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> constructor.</p>
│ │ │ │ -<p>The overload that takes a <tt class="docutils literal">torrent_info</tt> object will make a verbatim
│ │ │ │ -copy of its info dictionary (to preserve the info-hash). The copy of
│ │ │ │ -the info dictionary will be used by <a class="reference external" href="reference-Create_Torrents.html#generate()">create_torrent::generate()</a>. This means
│ │ │ │ -that none of the member functions of <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> that affects
│ │ │ │ -the content of the info dictionary (such as <a class="reference external" href="reference-Create_Torrents.html#set_hash()">set_hash()</a>), will
│ │ │ │ -have any affect. Instead of using this overload, consider using
│ │ │ │ -<a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a> instead.</p>
│ │ │ │ -<div class="admonition warning">
│ │ │ │ -<p class="first admonition-title">Warning</p>
│ │ │ │ -<p class="last">The <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> and <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> objects must stay alive for the
│ │ │ │ -entire duration of the <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> object.</p>
│ │ │ │ -</div>
│ │ │ │ -<a name="generate()"></a>
│ │ │ │ -<a name="generate_buf()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bgenerate%28%29+generate_buf%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bgenerate%28%29+generate_buf%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="generate-generate-buf">
│ │ │ │ -<h2>generate() generate_buf()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -entry <strong>generate</strong> () const;
│ │ │ │ -std::vector&lt;char&gt; <strong>generate_buf</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>This function will generate the .torrent file as a bencode tree, or a
│ │ │ │ -bencoded into a buffer.
│ │ │ │ -In order to encode the <a class="reference external" href="reference-Bencoding.html#entry">entry</a> into a flat file, use the <a class="reference external" href="reference-Bencoding.html#bencode()">bencode()</a> function.</p>
│ │ │ │ -<p>The function returning an <a class="reference external" href="reference-Bencoding.html#entry">entry</a> may be useful to add custom entries
│ │ │ │ -to the torrent file before bencoding it and saving it to disk.</p>
│ │ │ │ -<p>Whether the resulting torrent object is v1, v2 or hybrid depends on
│ │ │ │ -whether any of the v1_only or v2_only flags were set on the
│ │ │ │ -constructor. If neither were set, the resulting torrent depends on
│ │ │ │ -which hashes were set. If both v1 and v2 hashes were set, a hybrid
│ │ │ │ -torrent is created.</p>
│ │ │ │ -<p>Any failure will cause this function to throw system_error, with an
│ │ │ │ -appropriate error message. These are the reasons this call may throw:</p>
│ │ │ │ -<ul class="simple">
│ │ │ │ -<li>the file storage has 0 files</li>
│ │ │ │ -<li>the total size of the file storage is 0 bytes (i.e. it only has
│ │ │ │ -empty files)</li>
│ │ │ │ -<li>not all v1 hashes (<a class="reference external" href="reference-Create_Torrents.html#set_hash()">set_hash()</a>) and not all v2 hashes (<a class="reference external" href="reference-Create_Torrents.html#set_hash2()">set_hash2()</a>)
│ │ │ │ -were set</li>
│ │ │ │ -<li>for v2 torrents, you may not have a directory with the same name as
│ │ │ │ -a file. If that's encountered in the file storage, <a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>
│ │ │ │ -fails.</li>
│ │ │ │ -</ul>
│ │ │ │ -<a name="files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bfiles%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bfiles%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="files">
│ │ │ │ -<h2>files()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -file_storage const&amp; <strong>files</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns an immutable reference to the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> used to create
│ │ │ │ -the torrent from.</p>
│ │ │ │ -<a name="set_comment()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_comment%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_comment%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-comment">
│ │ │ │ -<h2>set_comment()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_comment</strong> (char const* str);
│ │ │ │ -</pre>
│ │ │ │ -<p>Sets the comment for the torrent. The string <tt class="docutils literal">str</tt> should be utf-8 encoded.
│ │ │ │ -The comment in a torrent file is optional.</p>
│ │ │ │ -<a name="set_creator()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_creator%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_creator%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-creator">
│ │ │ │ -<h2>set_creator()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_creator</strong> (char const* str);
│ │ │ │ -</pre>
│ │ │ │ -<p>Sets the creator of the torrent. The string <tt class="docutils literal">str</tt> should be utf-8 encoded.
│ │ │ │ -This is optional.</p>
│ │ │ │ -<a name="set_creation_date()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_creation_date%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_creation_date%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-creation-date">
│ │ │ │ -<h2>set_creation_date()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_creation_date</strong> (std::time_t timestamp);
│ │ │ │ -</pre>
│ │ │ │ -<p>sets the &quot;creation time&quot; field. Defaults to the system clock at the
│ │ │ │ -time of construction of the <a class="reference external" href="reference-Create_Torrents.html#create_torrent">create_torrent</a> object. The timestamp is
│ │ │ │ -specified in seconds, posix time. If the creation date is set to 0,
│ │ │ │ -the &quot;creation date&quot; field will be omitted from the generated torrent.</p>
│ │ │ │ -<a name="set_hash()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_hash%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_hash%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-hash">
│ │ │ │ -<h2>set_hash()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_hash</strong> (piece_index_t index, sha1_hash const&amp; h);
│ │ │ │ -</pre>
│ │ │ │ -<p>This sets the SHA-1 hash for the specified piece (<tt class="docutils literal">index</tt>). You are required
│ │ │ │ -to set the hash for every piece in the torrent before generating it. If you have
│ │ │ │ -the files on disk, you can use the high level convenience function to do this.
│ │ │ │ -See <a class="reference external" href="reference-Create_Torrents.html#set_piece_hashes()">set_piece_hashes()</a>.
│ │ │ │ -A SHA-1 hash of all zeros is internally used to indicate a hash that
│ │ │ │ -has not been set. Setting such hash will not be considered set when
│ │ │ │ -calling <a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>.
│ │ │ │ -This function will throw <tt class="docutils literal"><span class="pre">std::system_error</span></tt> if it is called on an
│ │ │ │ -object constructed with the v2_only flag.</p>
│ │ │ │ -<a name="set_hash2()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_hash2%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_hash2%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-hash2">
│ │ │ │ -<h2>set_hash2()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_hash2</strong> (file_index_t file, piece_index_t::diff_type piece, sha256_hash const&amp; h);
│ │ │ │ -</pre>
│ │ │ │ -<p>sets the bittorrent v2 hash for file <cite>file</cite> of the piece <cite>piece</cite>.
│ │ │ │ -<cite>piece</cite> is relative to the first piece of the file, starting at 0. The
│ │ │ │ -first piece in the file can be computed with
│ │ │ │ -<a class="reference external" href="reference-Storage.html#file_index_at_piece()">file_storage::file_index_at_piece()</a>.
│ │ │ │ -The hash, <cite>h</cite>, is the root of the merkle tree formed by the piece's
│ │ │ │ -16 kiB blocks. Note that piece sizes must be powers-of-2, so all
│ │ │ │ -per-piece merkle trees are complete.
│ │ │ │ -A SHA-256 hash of all zeros is internally used to indicate a hash
│ │ │ │ -that has not been set. Setting such hash will not be considered set
│ │ │ │ -when calling <a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>.
│ │ │ │ -This function will throw <tt class="docutils literal"><span class="pre">std::system_error</span></tt> if it is called on an
│ │ │ │ -object constructed with the v1_only flag.</p>
│ │ │ │ -<a name="add_http_seed()"></a>
│ │ │ │ -<a name="add_url_seed()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_http_seed%28%29+add_url_seed%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_http_seed%28%29+add_url_seed%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-http-seed-add-url-seed">
│ │ │ │ -<h2>add_http_seed() add_url_seed()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_url_seed</strong> (string_view url);
│ │ │ │ -void <strong>add_http_seed</strong> (string_view url);
│ │ │ │ -</pre>
│ │ │ │ -<p>This adds a url seed to the torrent. You can have any number of url seeds. For a
│ │ │ │ -single file torrent, this should be an HTTP url, pointing to a file with identical
│ │ │ │ -content as the file of the torrent. For a multi-file torrent, it should point to
│ │ │ │ -a directory containing a directory with the same name as this torrent, and all the
│ │ │ │ -files of the torrent in it.</p>
│ │ │ │ -<p>The second function, <tt class="docutils literal">add_http_seed()</tt> adds an HTTP seed instead.</p>
│ │ │ │ -<a name="add_node()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_node%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_node%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-node-1">
│ │ │ │ -<h2>add_node()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_node</strong> (std::pair&lt;std::string, int&gt; node);
│ │ │ │ -</pre>
│ │ │ │ -<p>This adds a DHT node to the torrent. This especially useful if you're creating a
│ │ │ │ -tracker less torrent. It can be used by clients to bootstrap their DHT node from.
│ │ │ │ -The node is a hostname and a port number where there is a DHT node running.
│ │ │ │ -You can have any number of DHT nodes in a torrent.</p>
│ │ │ │ -<a name="add_tracker()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_tracker%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_tracker%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-tracker">
│ │ │ │ -<h2>add_tracker()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_tracker</strong> (string_view url, int tier = 0);
│ │ │ │ -</pre>
│ │ │ │ -<p>Adds a tracker to the torrent. This is not strictly required, but most torrents
│ │ │ │ -use a tracker as their main source of peers. The url should be an <a class="reference external" href="http://">http://</a> or udp://
│ │ │ │ -url to a machine running a bittorrent tracker that accepts announces for this torrent's
│ │ │ │ -info-hash. The tier is the fallback priority of the tracker. All trackers with tier 0 are
│ │ │ │ -tried first (in any order). If all fail, trackers with tier 1 are tried. If all of those
│ │ │ │ -fail, trackers with tier 2 are tried, and so on.</p>
│ │ │ │ -<a name="set_root_cert()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_root_cert%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_root_cert%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-root-cert">
│ │ │ │ -<h2>set_root_cert()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_root_cert</strong> (string_view cert);
│ │ │ │ -</pre>
│ │ │ │ -<p>This function sets an X.509 certificate in PEM format to the torrent. This makes the
│ │ │ │ -torrent an <em>SSL torrent</em>. An SSL torrent requires that each peer has a valid certificate
│ │ │ │ -signed by this root certificate. For SSL torrents, all peers are connecting over SSL
│ │ │ │ -connections. For more information, see the section on <a class="reference external" href="manual-ref.html#ssl-torrents">ssl torrents</a>.</p>
│ │ │ │ -<p>The string is not the path to the cert, it's the actual content of the
│ │ │ │ -certificate.</p>
│ │ │ │ -<a name="set_priv()"></a>
│ │ │ │ -<a name="priv()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bset_priv%28%29+priv%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bset_priv%28%29+priv%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-priv-priv">
│ │ │ │ -<h2>set_priv() priv()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>set_priv</strong> (bool p);
│ │ │ │ -bool <strong>priv</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>Sets and queries the private flag of the torrent.
│ │ │ │ -Torrents with the private flag set ask the client to not use any other
│ │ │ │ -sources than the tracker for peers, and to not use DHT to advertise itself publicly,
│ │ │ │ -only the tracker.</p>
│ │ │ │ -<a name="num_pieces()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bnum_pieces%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bnum_pieces%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="num-pieces">
│ │ │ │ -<h2>num_pieces()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>num_pieces</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>returns the number of pieces in the associated <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object.</p>
│ │ │ │ -<a name="piece_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bpiece_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bpiece_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-range-1">
│ │ │ │ -<h2>piece_range()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -index_range&lt;piece_index_t&gt; <strong>piece_range</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>all piece indices in the torrent to be created</p>
│ │ │ │ -<a name="file_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bfile_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bfile_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-range-1">
│ │ │ │ -<h2>file_range()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -index_range&lt;file_index_t&gt; <strong>file_range</strong> () const noexcept;
│ │ │ │ -</pre>
│ │ │ │ -<p>all file indices in the torrent to be created</p>
│ │ │ │ -<a name="file_piece_range()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bfile_piece_range%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bfile_piece_range%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="file-piece-range">
│ │ │ │ -<h2>file_piece_range()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -index_range&lt;piece_index_t::diff_type&gt; <strong>file_piece_range</strong> (file_index_t f);
│ │ │ │ -</pre>
│ │ │ │ -<p>for v2 and hybrid torrents only, the pieces in the
│ │ │ │ -specified file, specified as delta from the first piece in the file.
│ │ │ │ -i.e. the first index is 0.</p>
│ │ │ │ -<a name="total_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Btotal_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Btotal_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="total-size-2">
│ │ │ │ -<h2>total_size()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -std::int64_t <strong>total_size</strong> () const;
│ │ │ │ -</pre>
│ │ │ │ -<p>the total number of bytes of all files and pad files</p>
│ │ │ │ -<a name="piece_length()"></a>
│ │ │ │ -<a name="piece_size()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bpiece_length%28%29+piece_size%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bpiece_length%28%29+piece_size%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="piece-length-piece-size">
│ │ │ │ -<h2>piece_length() piece_size()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -int <strong>piece_length</strong> () const;
│ │ │ │ -int <strong>piece_size</strong> (piece_index_t i) const;
│ │ │ │ -</pre>
│ │ │ │ -<p><tt class="docutils literal">piece_length()</tt> returns the piece size of all pieces but the
│ │ │ │ -last one. <tt class="docutils literal">piece_size()</tt> returns the size of the specified piece.
│ │ │ │ -these functions are just forwarding to the associated <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a>.</p>
│ │ │ │ -<a name="add_similar_torrent()"></a>
│ │ │ │ -<a name="add_collection()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Badd_similar_torrent%28%29+add_collection%28%29%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Badd_similar_torrent%28%29+add_collection%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="add-similar-torrent-add-collection">
│ │ │ │ -<h2>add_similar_torrent() add_collection()</h2>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_similar_torrent</strong> (sha1_hash ih);
│ │ │ │ -void <strong>add_collection</strong> (string_view c);
│ │ │ │ -</pre>
│ │ │ │ -<p>Add similar torrents (by info-hash) or collections of similar torrents.
│ │ │ │ -Similar torrents are expected to share some files with this torrent.
│ │ │ │ -Torrents sharing a collection name with this torrent are also expected
│ │ │ │ -to share files with this torrent. A torrent may have more than one
│ │ │ │ -collection and more than one similar torrents. For more information,
│ │ │ │ -see <a class="reference external" href="https://www.bittorrent.org/beps/bep_0038.html">BEP 38</a>.</p>
│ │ │ │ -<a name="modification_time"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bmodification_time%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bmodification_time%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>modification_time</dt>
│ │ │ │ -<dd>This will include the file modification time as part of the torrent.
│ │ │ │ -This is not enabled by default, as it might cause problems when you
│ │ │ │ -create a torrent from separate files with the same content, hoping to
│ │ │ │ -yield the same info-hash. If the files have different modification times,
│ │ │ │ -with this option enabled, you would get different info-hashes for the
│ │ │ │ -files.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="symlinks"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bsymlinks%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bsymlinks%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>symlinks</dt>
│ │ │ │ -<dd>If this flag is set, files that are symlinks get a symlink attribute
│ │ │ │ -set on them and their data will not be included in the torrent. This
│ │ │ │ -is useful if you need to reconstruct a file hierarchy which contains
│ │ │ │ -symlinks.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="v2_only"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bv2_only%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bv2_only%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>v2_only</dt>
│ │ │ │ -<dd>Do not generate v1 metadata. The resulting torrent will only be usable by
│ │ │ │ -clients which support v2. This requires setting all v2 hashes, with
│ │ │ │ -<a class="reference external" href="reference-Create_Torrents.html#set_hash2()">set_hash2()</a> before calling <a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>. Setting v1 hashes (with
│ │ │ │ -<a class="reference external" href="reference-Create_Torrents.html#set_hash()">set_hash()</a>) is an error with this flag set.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="v1_only"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bv1_only%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bv1_only%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>v1_only</dt>
│ │ │ │ -<dd>do not generate v2 metadata or enforce v2 alignment and padding rules
│ │ │ │ -this is mainly for tests, not recommended for production use. This
│ │ │ │ -requires setting all v1 hashes, with <a class="reference external" href="reference-Create_Torrents.html#set_hash()">set_hash()</a>, before calling
│ │ │ │ -<a class="reference external" href="reference-Create_Torrents.html#generate()">generate()</a>. Setting v2 hashes (with <a class="reference external" href="reference-Create_Torrents.html#set_hash2()">set_hash2()</a>) is an error with
│ │ │ │ -this flag set.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="canonical_files"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bcanonical_files%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bcanonical_files%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>canonical_files</dt>
│ │ │ │ -<dd>This flag only affects v1-only torrents, and is only relevant
│ │ │ │ -together with the v1_only_flag. This flag will force the
│ │ │ │ -same file order and padding as a v2 (or hybrid) torrent would have.
│ │ │ │ -It has the effect of ordering files and inserting pad files to align
│ │ │ │ -them with piece boundaries.</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="no_attributes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bno_attributes%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bno_attributes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>no_attributes</dt>
│ │ │ │ -<dd>passing this flag to <a class="reference external" href="reference-Create_Torrents.html#add_files()">add_files()</a> will ignore file attributes (such as
│ │ │ │ -executable or hidden) when adding the files to the file storage.
│ │ │ │ -Since not all filesystems and operating systems support all file
│ │ │ │ -attributes the resulting torrent may differ depending on where it's
│ │ │ │ -created. If it's important for torrents to be created consistently
│ │ │ │ -across systems, this flag should be set.</dd>
│ │ │ │ +<a name="nodes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_state%3A%3A%5Bnodes%5D&labels=documentation&body=Documentation+under+heading+%22dht_state%3A%3A%5Bnodes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>nodes</dt>
│ │ │ │ +<dd>the bootstrap nodes saved from the buckets node</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="canonical_files_no_tail_padding"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:create_torrent%3A%3A%5Bcanonical_files_no_tail_padding%5D&labels=documentation&body=Documentation+under+heading+%22create_torrent%3A%3A%5Bcanonical_files_no_tail_padding%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>canonical_files_no_tail_padding</dt>
│ │ │ │ -<dd>this flag enforces the file layout to be canonical according to the
│ │ │ │ -bittorrent v2 specification (just like the <tt class="docutils literal">canonical_files</tt> flag)
│ │ │ │ -with the one exception that tail padding is not added to the last
│ │ │ │ -file.
│ │ │ │ -This behavior deviates from the specification but was the way
│ │ │ │ -libtorrent created torrents in version up to and including 2.0.7.
│ │ │ │ -This flag is here for backwards compatibility.</dd>
│ │ │ │ +<a name="nodes6"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_state%3A%3A%5Bnodes6%5D&labels=documentation&body=Documentation+under+heading+%22dht_state%3A%3A%5Bnodes6%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ +<dt>nodes6</dt>
│ │ │ │ +<dd>the bootstrap nodes saved from the IPv6 buckets node</dd>
│ │ │ │  </dl>
│ │ │ │ -<a name="add_files()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_files%28%29&labels=documentation&body=Documentation+under+heading+%22add_files%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="add-files">
│ │ │ │ -<h1>add_files()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/create_torrent.hpp">libtorrent/create_torrent.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -void <strong>add_files</strong> (file_storage&amp; fs, std::string const&amp; file
│ │ │ │ -   , std::function&lt;bool(std::string)&gt; p, create_flags_t flags = {});
│ │ │ │ -void <strong>add_files</strong> (file_storage&amp; fs, std::string const&amp; file
│ │ │ │ -   , create_flags_t flags = {});
│ │ │ │ -</pre>
│ │ │ │ -<p>Adds the file specified by <tt class="docutils literal">path</tt> to the <a class="reference external" href="reference-Storage.html#file_storage">file_storage</a> object. In case <tt class="docutils literal">path</tt>
│ │ │ │ -refers to a directory, files will be added recursively from the directory.</p>
│ │ │ │ -<p>If specified, the predicate <tt class="docutils literal">p</tt> is called once for every file and directory that
│ │ │ │ -is encountered. Files for which <tt class="docutils literal">p</tt> returns true are added, and directories for
│ │ │ │ -which <tt class="docutils literal">p</tt> returns true are traversed. <tt class="docutils literal">p</tt> must have the following signature:</p>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="keyword type">bool</span><span class="whitespace"> </span><span class="name function">Pred</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">string</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&amp;</span><span class="whitespace"> </span><span class="name">p</span><span class="punctuation">);</span>
│ │ │ │ -</pre>
│ │ │ │ -<p>The path that is passed in to the predicate is the full path of the file or
│ │ │ │ -directory. If no predicate is specified, all files are added, and all directories
│ │ │ │ -are traversed.</p>
│ │ │ │ -<p>The &quot;..&quot; directory is never traversed.</p>
│ │ │ │ -<p>The <tt class="docutils literal">flags</tt> argument should be the same as the flags passed to the <a class="reference internal" href="#create-torrent">create_torrent</a>
│ │ │ │ -constructor.</p>
│ │ │ │ -<a name="set_piece_hashes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:set_piece_hashes%28%29&labels=documentation&body=Documentation+under+heading+%22set_piece_hashes%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="set-piece-hashes">
│ │ │ │ -<h1>set_piece_hashes()</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/create_torrent.hpp">libtorrent/create_torrent.hpp</a>&quot;</p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p, error_code&amp; ec);
│ │ │ │ -inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ -   , settings_interface const&amp; settings
│ │ │ │ -   , std::function&lt;void(piece_index_t)&gt; const&amp; f);
│ │ │ │ -void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ -   , settings_interface const&amp; settings, disk_io_constructor_type disk_io
│ │ │ │ -   , std::function&lt;void(piece_index_t)&gt; const&amp; f, error_code&amp; ec);
│ │ │ │ -inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ -   , std::function&lt;void(piece_index_t)&gt; const&amp; f);
│ │ │ │ -void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ -   , settings_interface const&amp; settings
│ │ │ │ -   , std::function&lt;void(piece_index_t)&gt; const&amp; f, error_code&amp; ec);
│ │ │ │ -inline void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p);
│ │ │ │ -void <strong>set_piece_hashes</strong> (create_torrent&amp; t, std::string const&amp; p
│ │ │ │ -   , std::function&lt;void(piece_index_t)&gt; const&amp; f, error_code&amp; ec);
│ │ │ │ -</pre>
│ │ │ │ -<p>This function will assume that the files added to the torrent file exists at path
│ │ │ │ -<tt class="docutils literal">p</tt>, read those files and hash the content and set the hashes in the <tt class="docutils literal">create_torrent</tt>
│ │ │ │ -object. The optional function <tt class="docutils literal">f</tt> is called in between every hash that is set. <tt class="docutils literal">f</tt>
│ │ │ │ -must have the following signature:</p>
│ │ │ │ -<pre class="code c++ literal-block">
│ │ │ │ -<span class="keyword type">void</span><span class="whitespace"> </span><span class="name function">Fun</span><span class="punctuation">(</span><span class="name">piece_index_t</span><span class="punctuation">);</span>
│ │ │ │ -</pre>
│ │ │ │ -<p>The overloads taking a <a class="reference external" href="reference-Settings.html#settings_pack">settings_pack</a> may be used to configure the
│ │ │ │ -underlying disk access. Such as <tt class="docutils literal"><span class="pre">settings_pack::aio_threads</span></tt>.</p>
│ │ │ │ -<p>The overloads that don't take an <tt class="docutils literal">error_code&amp;</tt> may throw an exception in case of a
│ │ │ │ -file error, the other overloads sets the error code to reflect the error, if any.</p>
│ │ │ │  <a name="dht_storage_counters"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_storage_counters&labels=documentation&body=Documentation+under+heading+%22class+dht_storage_counters%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="dht-storage-counters">
│ │ │ │  <h1>dht_storage_counters</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/kademlia/dht_storage.hpp">libtorrent/kademlia/dht_storage.hpp</a>&quot;</p>
│ │ │ │  <p>This structure hold the relevant <a class="reference external" href="reference-Stats.html#counters">counters</a> for the storage</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  struct dht_storage_counters
│ │ │ │ @@ -20308,42 +20592,16 @@
│ │ │ │  <a name="counters()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_storage_interface%3A%3A%5Bcounters%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_storage_interface%3A%3A%5Bcounters%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="counters-2">
│ │ │ │  <h2>counters()</h2>
│ │ │ │  <pre class="literal-block">
│ │ │ │  virtual dht_storage_counters <strong>counters</strong> () const = 0;
│ │ │ │  </pre>
│ │ │ │  <p>return stats <a class="reference external" href="reference-Stats.html#counters">counters</a> for the store</p>
│ │ │ │ -<a name="dht_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_state&labels=documentation&body=Documentation+under+heading+%22class+dht_state%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -</div>
│ │ │ │ -<div class="section" id="dht-state">
│ │ │ │ -<h1>dht_state</h1>
│ │ │ │ -<p>Declared in &quot;<a class="reference external" href="include/libtorrent/kademlia/dht_state.hpp">libtorrent/kademlia/dht_state.hpp</a>&quot;</p>
│ │ │ │ -<p>This structure helps to store and load the state
│ │ │ │ -of the <tt class="docutils literal">dht_tracker</tt>.
│ │ │ │ -At this moment the library is only a dual stack
│ │ │ │ -implementation of the DHT. See <a class="reference external" href="https://www.bittorrent.org/beps/bep_0032.html">BEP 32</a></p>
│ │ │ │ -<pre class="literal-block">
│ │ │ │ -struct dht_state
│ │ │ │ -{
│ │ │ │ -   void <strong>clear</strong> ();
│ │ │ │ -
│ │ │ │ -   node_ids_t nids;
│ │ │ │ -   std::vector&lt;udp::endpoint&gt; nodes;
│ │ │ │ -   std::vector&lt;udp::endpoint&gt; nodes6;
│ │ │ │ -};
│ │ │ │ -</pre>
│ │ │ │ -<a name="nodes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_state%3A%3A%5Bnodes%5D&labels=documentation&body=Documentation+under+heading+%22dht_state%3A%3A%5Bnodes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>nodes</dt>
│ │ │ │ -<dd>the bootstrap nodes saved from the buckets node</dd>
│ │ │ │ -</dl>
│ │ │ │ -<a name="nodes6"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_state%3A%3A%5Bnodes6%5D&labels=documentation&body=Documentation+under+heading+%22dht_state%3A%3A%5Bnodes6%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
│ │ │ │ -<dt>nodes6</dt>
│ │ │ │ -<dd>the bootstrap nodes saved from the IPv6 buckets node</dd>
│ │ │ │ -</dl>
│ │ │ │  <a name="dht_default_storage_constructor()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_default_storage_constructor%28%29&labels=documentation&body=Documentation+under+heading+%22dht_default_storage_constructor%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +</div>
│ │ │ │  <div class="section" id="dht-default-storage-constructor">
│ │ │ │  <h1>dht_default_storage_constructor()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/kademlia/dht_storage.hpp">libtorrent/kademlia/dht_storage.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │  std::unique_ptr&lt;dht_storage_interface&gt; <strong>dht_default_storage_constructor</strong> (
│ │ │ │     settings_interface const&amp; settings);
│ │ │ │  </pre>
│ │ │ │ @@ -20387,22 +20645,22 @@
│ │ │ │  <dd>Specify the port number for the SSL listen socket in the DHT announce.</dd>
│ │ │ │  </dl>
│ │ │ │  <a name="read_resume_data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:read_resume_data%28%29&labels=documentation&body=Documentation+under+heading+%22read_resume_data%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="read-resume-data">
│ │ │ │  <h1>read_resume_data()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/read_resume_data.hpp">libtorrent/read_resume_data.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -add_torrent_params <strong>read_resume_data</strong> (span&lt;char const&gt; buffer
│ │ │ │ -   , load_torrent_limits const&amp; cfg = {});
│ │ │ │  add_torrent_params <strong>read_resume_data</strong> (bdecode_node const&amp; rd
│ │ │ │     , int piece_limit = 0x200000);
│ │ │ │ -add_torrent_params <strong>read_resume_data</strong> (bdecode_node const&amp; rd
│ │ │ │ -   , error_code&amp; ec, int piece_limit = 0x200000);
│ │ │ │ +add_torrent_params <strong>read_resume_data</strong> (span&lt;char const&gt; buffer
│ │ │ │ +   , load_torrent_limits const&amp; cfg = {});
│ │ │ │  add_torrent_params <strong>read_resume_data</strong> (span&lt;char const&gt; buffer
│ │ │ │     , error_code&amp; ec, load_torrent_limits const&amp; cfg = {});
│ │ │ │ +add_torrent_params <strong>read_resume_data</strong> (bdecode_node const&amp; rd
│ │ │ │ +   , error_code&amp; ec, int piece_limit = 0x200000);
│ │ │ │  </pre>
│ │ │ │  <p>these functions are used to parse resume data and populate the appropriate
│ │ │ │  fields in an <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object. This object can then be used to add
│ │ │ │  the actual <a class="reference external" href="reference-Torrent_Info.html#torrent_info">torrent_info</a> object to and pass to session::add_torrent() or
│ │ │ │  session::async_add_torrent().</p>
│ │ │ │  <p>If the client wants to override any field that was loaded from the resume
│ │ │ │  data, e.g. save_path, those fields must be changed after loading resume
│ │ │ │ @@ -20410,22 +20668,22 @@
│ │ │ │  <p>The <tt class="docutils literal">piece_limit</tt> parameter determines the largest number of pieces
│ │ │ │  allowed in the torrent that may be loaded as part of the resume data, if
│ │ │ │  it contains an <tt class="docutils literal">info</tt> field. The overloads that take a flat buffer are
│ │ │ │  instead configured with limits on torrent sizes via load_torrent limits.</p>
│ │ │ │  <p>In order to support large torrents, it may also be necessary to raise the
│ │ │ │  <a class="reference external" href="reference-Settings.html#max_piece_count">settings_pack::max_piece_count</a> setting and pass a higher limit to calls
│ │ │ │  to <a class="reference external" href="reference-Torrent_Info.html#parse_info_section()">torrent_info::parse_info_section()</a>.</p>
│ │ │ │ -<a name="write_resume_data_buf()"></a>
│ │ │ │ -<a name="write_resume_data()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:write_resume_data_buf%28%29+write_resume_data%28%29&labels=documentation&body=Documentation+under+heading+%22write_resume_data_buf%28%29+write_resume_data%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ -<div class="section" id="write-resume-data-buf-write-resume-data">
│ │ │ │ -<h1>write_resume_data_buf() write_resume_data()</h1>
│ │ │ │ +<a name="write_resume_data()"></a>
│ │ │ │ +<a name="write_resume_data_buf()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:write_resume_data%28%29+write_resume_data_buf%28%29&labels=documentation&body=Documentation+under+heading+%22write_resume_data%28%29+write_resume_data_buf%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │ +<div class="section" id="write-resume-data-write-resume-data-buf">
│ │ │ │ +<h1>write_resume_data() write_resume_data_buf()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/write_resume_data.hpp">libtorrent/write_resume_data.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -entry <strong>write_resume_data</strong> (add_torrent_params const&amp; atp);
│ │ │ │  std::vector&lt;char&gt; <strong>write_resume_data_buf</strong> (add_torrent_params const&amp; atp);
│ │ │ │ +entry <strong>write_resume_data</strong> (add_torrent_params const&amp; atp);
│ │ │ │  </pre>
│ │ │ │  <p>this function turns the resume data in an <tt class="docutils literal">add_torrent_params</tt> object
│ │ │ │  into a bencoded structure</p>
│ │ │ │  <a name="write_torrent_file_buf()"></a>
│ │ │ │  <a name="write_torrent_file()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:write_torrent_file_buf%28%29+write_torrent_file%28%29&labels=documentation&body=Documentation+under+heading+%22write_torrent_file_buf%28%29+write_torrent_file%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="write-torrent-file-buf-write-torrent-file">
│ │ │ │  <h1>write_torrent_file_buf() write_torrent_file()</h1>
│ │ │ │ @@ -20510,18 +20768,18 @@
│ │ │ │  </pre>
│ │ │ │  <p>Verifies the signature on the given message using <tt class="docutils literal">pk</tt></p>
│ │ │ │  <a name="ed25519_add_scalar()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:ed25519_add_scalar%28%29&labels=documentation&body=Documentation+under+heading+%22ed25519_add_scalar%28%29%22+could+be+improved">report issue</a>]</span></div>
│ │ │ │  <div class="section" id="ed25519-add-scalar">
│ │ │ │  <h1>ed25519_add_scalar()</h1>
│ │ │ │  <p>Declared in &quot;<a class="reference external" href="include/libtorrent/kademlia/ed25519.hpp">libtorrent/kademlia/ed25519.hpp</a>&quot;</p>
│ │ │ │  <pre class="literal-block">
│ │ │ │ -public_key <strong>ed25519_add_scalar</strong> (public_key const&amp; pk
│ │ │ │ -   , std::array&lt;char, 32&gt; const&amp; scalar);
│ │ │ │  secret_key <strong>ed25519_add_scalar</strong> (secret_key const&amp; sk
│ │ │ │     , std::array&lt;char, 32&gt; const&amp; scalar);
│ │ │ │ +public_key <strong>ed25519_add_scalar</strong> (public_key const&amp; pk
│ │ │ │ +   , std::array&lt;char, 32&gt; const&amp; scalar);
│ │ │ │  </pre>
│ │ │ │  <p>Adds a scalar to the given key pair where scalar is a 32 byte buffer
│ │ │ │  (possibly generated with <cite>ed25519_create_seed</cite>), generating a new key pair.</p>
│ │ │ │  <p>You can calculate the public key sum without knowing the private key and
│ │ │ │  vice versa by passing in null for the key you don't know. This is useful
│ │ │ │  when a third party (an authoritative server for example) needs to enforce
│ │ │ │  randomness on a key pair while only knowing the public key of the other
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -1,113 +1,161 @@
│ │ │ │ │  >
│ │ │ │ │  _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_]
│ │ │ │ │  VVeerrssiioonn:: 2.0.11
│ │ │ │ │  _h_o_m_e
│ │ │ │ │  Table of contents
│ │ │ │ │ -    * _p_i_e_c_e___b_l_o_c_k
│ │ │ │ │ -    * _i_n_f_o___h_a_s_h___t
│ │ │ │ │ -          o _i_n_f_o___h_a_s_h___t_(_)
│ │ │ │ │ -          o _h_a_s___v_1_(_)_ _h_a_s___v_2_(_)_ _h_a_s_(_)
│ │ │ │ │ -          o _g_e_t_(_)
│ │ │ │ │ -          o _g_e_t___b_e_s_t_(_)
│ │ │ │ │ -          o _f_o_r___e_a_c_h_(_)
│ │ │ │ │ -    * _p_e_e_r___i_n_f_o
│ │ │ │ │ -          o _i_2_p___d_e_s_t_i_n_a_t_i_o_n_(_)
│ │ │ │ │ -    * _p_e_e_r___r_e_q_u_e_s_t
│ │ │ │ │ -          o _o_p_e_r_a_t_o_r_=_=_(_)
│ │ │ │ │ -    * _t_o_r_r_e_n_t___p_e_e_r___e_q_u_a_l_(_)
│ │ │ │ │ -    * _m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ -    * _p_a_r_s_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ -    * _t_r_u_n_c_a_t_e___f_i_l_e_s_(_)
│ │ │ │ │ -    * _v_e_r_s_i_o_n_(_)
│ │ │ │ │ -    * _l_o_a_d___t_o_r_r_e_n_t___b_u_f_f_e_r_(_)_ _l_o_a_d___t_o_r_r_e_n_t___f_i_l_e_(_)_ _l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_)
│ │ │ │ │ -    * _e_n_u_m_ _p_r_o_t_o_c_o_l___v_e_r_s_i_o_n
│ │ │ │ │ -    * _e_n_u_m_ _s_o_c_k_e_t___t_y_p_e___t
│ │ │ │ │ -    * _e_n_u_m_ _p_o_r_t_m_a_p___t_r_a_n_s_p_o_r_t
│ │ │ │ │ -    * _e_n_u_m_ _p_o_r_t_m_a_p___p_r_o_t_o_c_o_l
│ │ │ │ │ -    * _e_n_u_m_ _e_v_e_n_t___t
│ │ │ │ │ -    * _e_n_u_m_ _c_o_n_n_e_c_t_i_o_n___t_y_p_e
│ │ │ │ │ -    * _t_o_r_r_e_n_t___f_l_a_g_s___t
│ │ │ │ │ -    * _p_e_x___f_l_a_g_s___t
│ │ │ │ │ -    * _d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t
│ │ │ │ │ -    * _i_n_t
│ │ │ │ │ -    * _c_h_a_r_ _c_o_n_s_t_*
│ │ │ │ │ -    * _s_t_d_:_:_u_i_n_t_6_4___t
│ │ │ │ │ -    * _b_l_o_c_k___i_n_f_o
│ │ │ │ │ -          o _s_e_t___p_e_e_r_(_)_ _p_e_e_r_(_)
│ │ │ │ │ -          o _e_n_u_m_ _b_l_o_c_k___s_t_a_t_e___t
│ │ │ │ │ -    * _p_a_r_t_i_a_l___p_i_e_c_e___i_n_f_o
│ │ │ │ │ -    * _t_o_r_r_e_n_t___h_a_n_d_l_e
│ │ │ │ │ -          o _t_o_r_r_e_n_t___h_a_n_d_l_e_(_)
│ │ │ │ │ -          o _a_d_d___p_i_e_c_e_(_)
│ │ │ │ │ -          o _r_e_a_d___p_i_e_c_e_(_)
│ │ │ │ │ -          o _h_a_v_e___p_i_e_c_e_(_)
│ │ │ │ │ -          o _g_e_t___p_e_e_r___i_n_f_o_(_)_ _p_o_s_t___p_e_e_r___i_n_f_o_(_)
│ │ │ │ │ -          o _p_o_s_t___s_t_a_t_u_s_(_)_ _s_t_a_t_u_s_(_)
│ │ │ │ │ -          o _g_e_t___d_o_w_n_l_o_a_d___q_u_e_u_e_(_)_ _p_o_s_t___d_o_w_n_l_o_a_d___q_u_e_u_e_(_)
│ │ │ │ │ -          o _c_l_e_a_r___p_i_e_c_e___d_e_a_d_l_i_n_e_s_(_)_ _r_e_s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_)_ _s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_)
│ │ │ │ │ -          o _f_i_l_e___p_r_o_g_r_e_s_s_(_)_ _p_o_s_t___f_i_l_e___p_r_o_g_r_e_s_s_(_)
│ │ │ │ │ -          o _f_i_l_e___s_t_a_t_u_s_(_)
│ │ │ │ │ -          o _c_l_e_a_r___e_r_r_o_r_(_)
│ │ │ │ │ -          o _a_d_d___t_r_a_c_k_e_r_(_)_ _r_e_p_l_a_c_e___t_r_a_c_k_e_r_s_(_)_ _t_r_a_c_k_e_r_s_(_)_ _p_o_s_t___t_r_a_c_k_e_r_s_(_)
│ │ │ │ │ -          o _u_r_l___s_e_e_d_s_(_)_ _r_e_m_o_v_e___u_r_l___s_e_e_d_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)
│ │ │ │ │ -          o _a_d_d___h_t_t_p___s_e_e_d_(_)_ _r_e_m_o_v_e___h_t_t_p___s_e_e_d_(_)_ _h_t_t_p___s_e_e_d_s_(_)
│ │ │ │ │ -          o _a_d_d___e_x_t_e_n_s_i_o_n_(_)
│ │ │ │ │ -          o _s_e_t___m_e_t_a_d_a_t_a_(_)
│ │ │ │ │ -          o _i_s___v_a_l_i_d_(_)
│ │ │ │ │ -          o _r_e_s_u_m_e_(_)_ _p_a_u_s_e_(_)
│ │ │ │ │ -          o _f_l_a_g_s_(_)_ _u_n_s_e_t___f_l_a_g_s_(_)_ _s_e_t___f_l_a_g_s_(_)
│ │ │ │ │ -          o _f_l_u_s_h___c_a_c_h_e_(_)
│ │ │ │ │ -          o _f_o_r_c_e___r_e_c_h_e_c_k_(_)
│ │ │ │ │ -          o _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ -          o _n_e_e_d___s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ -          o _q_u_e_u_e___p_o_s_i_t_i_o_n___b_o_t_t_o_m_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n___u_p_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n___t_o_p_(_)
│ │ │ │ │ -            _q_u_e_u_e___p_o_s_i_t_i_o_n___d_o_w_n_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n_(_)
│ │ │ │ │ -          o _q_u_e_u_e___p_o_s_i_t_i_o_n___s_e_t_(_)
│ │ │ │ │ -          o _s_e_t___s_s_l___c_e_r_t_i_f_i_c_a_t_e___b_u_f_f_e_r_(_)_ _s_e_t___s_s_l___c_e_r_t_i_f_i_c_a_t_e_(_)
│ │ │ │ │ -          o _t_o_r_r_e_n_t___f_i_l_e_(_)_ _t_o_r_r_e_n_t___f_i_l_e___w_i_t_h___h_a_s_h_e_s_(_)
│ │ │ │ │ -          o _p_i_e_c_e___l_a_y_e_r_s_(_)
│ │ │ │ │ -          o _p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y_(_)_ _p_o_s_t___p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y_(_)
│ │ │ │ │ -          o _g_e_t___p_i_e_c_e___p_r_i_o_r_i_t_i_e_s_(_)_ _p_i_e_c_e___p_r_i_o_r_i_t_y_(_)_ _p_r_i_o_r_i_t_i_z_e___p_i_e_c_e_s_(_)
│ │ │ │ │ -          o _g_e_t___f_i_l_e___p_r_i_o_r_i_t_i_e_s_(_)_ _f_i_l_e___p_r_i_o_r_i_t_y_(_)_ _p_r_i_o_r_i_t_i_z_e___f_i_l_e_s_(_)
│ │ │ │ │ -          o _f_o_r_c_e___r_e_a_n_n_o_u_n_c_e_(_)_ _f_o_r_c_e___d_h_t___a_n_n_o_u_n_c_e_(_)_ _f_o_r_c_e___l_s_d___a_n_n_o_u_n_c_e_(_)
│ │ │ │ │ -          o _s_c_r_a_p_e___t_r_a_c_k_e_r_(_)
│ │ │ │ │ -          o _s_e_t___d_o_w_n_l_o_a_d___l_i_m_i_t_(_)_ _d_o_w_n_l_o_a_d___l_i_m_i_t_(_)_ _u_p_l_o_a_d___l_i_m_i_t_(_)
│ │ │ │ │ -            _s_e_t___u_p_l_o_a_d___l_i_m_i_t_(_)
│ │ │ │ │ -          o _c_o_n_n_e_c_t___p_e_e_r_(_)
│ │ │ │ │ -          o _c_l_e_a_r___p_e_e_r_s_(_)
│ │ │ │ │ -          o _s_e_t___m_a_x___u_p_l_o_a_d_s_(_)_ _m_a_x___u_p_l_o_a_d_s_(_)
│ │ │ │ │ -          o _m_a_x___c_o_n_n_e_c_t_i_o_n_s_(_)_ _s_e_t___m_a_x___c_o_n_n_e_c_t_i_o_n_s_(_)
│ │ │ │ │ -          o _m_o_v_e___s_t_o_r_a_g_e_(_)
│ │ │ │ │ -          o _r_e_n_a_m_e___f_i_l_e_(_)
│ │ │ │ │ -          o _i_n_f_o___h_a_s_h_e_s_(_)_ _i_n_f_o___h_a_s_h_(_)
│ │ │ │ │ -          o _o_p_e_r_a_t_o_r_!_=_(_)_ _o_p_e_r_a_t_o_r_=_=_(_)_ _o_p_e_r_a_t_o_r_<_(_)
│ │ │ │ │ -          o _i_d_(_)
│ │ │ │ │ -          o _n_a_t_i_v_e___h_a_n_d_l_e_(_)
│ │ │ │ │ -          o _u_s_e_r_d_a_t_a_(_)
│ │ │ │ │ -          o _i_n___s_e_s_s_i_o_n_(_)
│ │ │ │ │ -    * _h_a_s_h___v_a_l_u_e_(_)
│ │ │ │ │ +    * _a_ _w_o_r_d_ _o_f_ _c_a_u_t_i_o_n
│ │ │ │ │ +    * _p_l_u_g_i_n_-_i_n_t_e_r_f_a_c_e
│ │ │ │ │ +    * _c_u_s_t_o_m_ _a_l_e_r_t_s
│ │ │ │ │ +    * _p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e
│ │ │ │ │ +    * _b_t___p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e
│ │ │ │ │ +    * _p_l_u_g_i_n
│ │ │ │ │ +          o _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_)
│ │ │ │ │ +          o _n_e_w___t_o_r_r_e_n_t_(_)
│ │ │ │ │ +          o _a_d_d_e_d_(_)
│ │ │ │ │ +          o _a_b_o_r_t_(_)
│ │ │ │ │ +          o _o_n___d_h_t___r_e_q_u_e_s_t_(_)
│ │ │ │ │ +          o _o_n___a_l_e_r_t_(_)
│ │ │ │ │ +          o _o_n___u_n_k_n_o_w_n___t_o_r_r_e_n_t_(_)
│ │ │ │ │ +          o _o_n___t_i_c_k_(_)
│ │ │ │ │ +          o _g_e_t___u_n_c_h_o_k_e___p_r_i_o_r_i_t_y_(_)
│ │ │ │ │ +          o _l_o_a_d___s_t_a_t_e_(_)
│ │ │ │ │ +    * _t_o_r_r_e_n_t___p_l_u_g_i_n
│ │ │ │ │ +          o _n_e_w___c_o_n_n_e_c_t_i_o_n_(_)
│ │ │ │ │ +          o _o_n___p_i_e_c_e___p_a_s_s_(_)_ _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)
│ │ │ │ │ +          o _t_i_c_k_(_)
│ │ │ │ │ +          o _o_n___r_e_s_u_m_e_(_)_ _o_n___p_a_u_s_e_(_)
│ │ │ │ │ +          o _o_n___f_i_l_e_s___c_h_e_c_k_e_d_(_)
│ │ │ │ │ +          o _o_n___s_t_a_t_e_(_)
│ │ │ │ │ +          o _o_n___a_d_d___p_e_e_r_(_)
│ │ │ │ │ +    * _p_e_e_r___p_l_u_g_i_n
│ │ │ │ │ +          o _t_y_p_e_(_)
│ │ │ │ │ +          o _a_d_d___h_a_n_d_s_h_a_k_e_(_)
│ │ │ │ │ +          o _o_n___d_i_s_c_o_n_n_e_c_t_(_)
│ │ │ │ │ +          o _o_n___c_o_n_n_e_c_t_e_d_(_)
│ │ │ │ │ +          o _o_n___h_a_n_d_s_h_a_k_e_(_)
│ │ │ │ │ +          o _o_n___e_x_t_e_n_s_i_o_n___h_a_n_d_s_h_a_k_e_(_)
│ │ │ │ │ +          o _o_n___h_a_v_e_(_)_ _o_n___h_a_v_e___a_l_l_(_)_ _o_n___r_e_q_u_e_s_t_(_)_ _o_n___b_i_t_f_i_e_l_d_(_)
│ │ │ │ │ +            _o_n___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _o_n___c_h_o_k_e_(_)_ _o_n___a_l_l_o_w_e_d___f_a_s_t_(_)_ _o_n___h_a_v_e___n_o_n_e_(_)
│ │ │ │ │ +            _o_n___u_n_c_h_o_k_e_(_)_ _o_n___i_n_t_e_r_e_s_t_e_d_(_)_ _o_n___d_o_n_t___h_a_v_e_(_)
│ │ │ │ │ +          o _o_n___p_i_e_c_e_(_)
│ │ │ │ │ +          o _s_e_n_t___h_a_v_e_(_)_ _s_e_n_t___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___p_i_e_c_e_(_)
│ │ │ │ │ +            _s_e_n_t___u_n_c_h_o_k_e_(_)
│ │ │ │ │ +          o _s_e_n_t___p_a_y_l_o_a_d_(_)
│ │ │ │ │ +          o _c_a_n___d_i_s_c_o_n_n_e_c_t_(_)
│ │ │ │ │ +          o _o_n___e_x_t_e_n_d_e_d_(_)
│ │ │ │ │ +          o _o_n___u_n_k_n_o_w_n___m_e_s_s_a_g_e_(_)
│ │ │ │ │ +          o _o_n___p_i_e_c_e___p_a_s_s_(_)_ _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)
│ │ │ │ │ +          o _t_i_c_k_(_)
│ │ │ │ │ +          o _w_r_i_t_e___r_e_q_u_e_s_t_(_)
│ │ │ │ │ +    * _c_r_y_p_t_o___p_l_u_g_i_n
│ │ │ │ │ +          o _d_e_c_r_y_p_t_(_)
│ │ │ │ │ +    * _c_r_e_a_t_e___u_t___p_e_x___p_l_u_g_i_n_(_)
│ │ │ │ │ +    * _c_r_e_a_t_e___s_m_a_r_t___b_a_n___p_l_u_g_i_n_(_)
│ │ │ │ │ +    * _c_r_e_a_t_e___u_t___m_e_t_a_d_a_t_a___p_l_u_g_i_n_(_)
│ │ │ │ │ +    * _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s
│ │ │ │ │ +    * _c_l_i_e_n_t___d_a_t_a___t
│ │ │ │ │ +          o _c_l_i_e_n_t___d_a_t_a___t_(_)
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_=_(_)_ _c_o_n_s_t_*_(_)_ _v_o_i_d_*_(_)
│ │ │ │ │ +    * _s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e
│ │ │ │ │ +    * _b_u_f_f_e_r___a_l_l_o_c_a_t_o_r___i_n_t_e_r_f_a_c_e
│ │ │ │ │ +    * _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r
│ │ │ │ │ +          o _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ +          o _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ +          o _~_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ +          o _d_a_t_a_(_)
│ │ │ │ │ +          o _r_e_s_e_t_(_)
│ │ │ │ │ +          o _s_w_a_p_(_)
│ │ │ │ │ +          o _i_s___m_u_t_a_b_l_e_(_)
│ │ │ │ │ +          o _b_o_o_l_(_)
│ │ │ │ │ +    * _o_p_e_n___f_i_l_e___s_t_a_t_e
│ │ │ │ │ +    * _d_i_s_k___i_n_t_e_r_f_a_c_e
│ │ │ │ │ +          o _n_e_w___t_o_r_r_e_n_t_(_)
│ │ │ │ │ +          o _r_e_m_o_v_e___t_o_r_r_e_n_t_(_)
│ │ │ │ │ +          o _a_s_y_n_c___r_e_a_d_(_)_ _a_s_y_n_c___w_r_i_t_e_(_)
│ │ │ │ │ +          o _a_s_y_n_c___h_a_s_h_(_)
│ │ │ │ │ +          o _a_s_y_n_c___h_a_s_h_2_(_)
│ │ │ │ │ +          o _a_s_y_n_c___m_o_v_e___s_t_o_r_a_g_e_(_)
│ │ │ │ │ +          o _a_s_y_n_c___r_e_l_e_a_s_e___f_i_l_e_s_(_)
│ │ │ │ │ +          o _a_s_y_n_c___c_h_e_c_k___f_i_l_e_s_(_)
│ │ │ │ │ +          o _a_s_y_n_c___s_t_o_p___t_o_r_r_e_n_t_(_)
│ │ │ │ │ +          o _a_s_y_n_c___r_e_n_a_m_e___f_i_l_e_(_)
│ │ │ │ │ +          o _a_s_y_n_c___d_e_l_e_t_e___f_i_l_e_s_(_)
│ │ │ │ │ +          o _a_s_y_n_c___s_e_t___f_i_l_e___p_r_i_o_r_i_t_y_(_)
│ │ │ │ │ +          o _a_s_y_n_c___c_l_e_a_r___p_i_e_c_e_(_)
│ │ │ │ │ +          o _u_p_d_a_t_e___s_t_a_t_s___c_o_u_n_t_e_r_s_(_)
│ │ │ │ │ +          o _g_e_t___s_t_a_t_u_s_(_)
│ │ │ │ │ +          o _a_b_o_r_t_(_)
│ │ │ │ │ +          o _s_u_b_m_i_t___j_o_b_s_(_)
│ │ │ │ │ +          o _s_e_t_t_i_n_g_s___u_p_d_a_t_e_d_(_)
│ │ │ │ │ +    * _s_t_o_r_a_g_e___h_o_l_d_e_r
│ │ │ │ │ +    * _d_i_s_k___o_b_s_e_r_v_e_r
│ │ │ │ │ +          o _o_n___d_i_s_k_(_)
│ │ │ │ │ +    * _f_i_l_e___o_p_e_n___m_o_d_e___t
│ │ │ │ │ +    * _s_e_t_t_i_n_g_s___p_a_c_k
│ │ │ │ │ +          o _s_e_t___s_t_r_(_)_ _s_e_t___i_n_t_(_)_ _s_e_t___b_o_o_l_(_)
│ │ │ │ │ +          o _h_a_s___v_a_l_(_)
│ │ │ │ │ +          o _c_l_e_a_r_(_)
│ │ │ │ │ +          o _c_l_e_a_r_(_)
│ │ │ │ │ +          o _g_e_t___i_n_t_(_)_ _g_e_t___b_o_o_l_(_)_ _g_e_t___s_t_r_(_)
│ │ │ │ │ +          o _e_n_u_m_ _t_y_p_e___b_a_s_e_s
│ │ │ │ │ +          o _e_n_u_m_ _m_m_a_p___w_r_i_t_e___m_o_d_e___t
│ │ │ │ │ +          o _e_n_u_m_ _s_u_g_g_e_s_t___m_o_d_e___t
│ │ │ │ │ +          o _e_n_u_m_ _c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m___t
│ │ │ │ │ +          o _e_n_u_m_ _s_e_e_d___c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m___t
│ │ │ │ │ +          o _e_n_u_m_ _i_o___b_u_f_f_e_r___m_o_d_e___t
│ │ │ │ │ +          o _e_n_u_m_ _b_a_n_d_w_i_d_t_h___m_i_x_e_d___a_l_g_o___t
│ │ │ │ │ +          o _e_n_u_m_ _e_n_c___p_o_l_i_c_y
│ │ │ │ │ +          o _e_n_u_m_ _e_n_c___l_e_v_e_l
│ │ │ │ │ +          o _e_n_u_m_ _p_r_o_x_y___t_y_p_e___t
│ │ │ │ │ +    * _s_e_t_t_i_n_g___b_y___n_a_m_e_(_)_ _n_a_m_e___f_o_r___s_e_t_t_i_n_g_(_)
│ │ │ │ │ +    * _d_e_f_a_u_l_t___s_e_t_t_i_n_g_s_(_)
│ │ │ │ │ +    * _h_i_g_h___p_e_r_f_o_r_m_a_n_c_e___s_e_e_d_(_)_ _m_i_n___m_e_m_o_r_y___u_s_a_g_e_(_)
│ │ │ │ │ +    * _g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_t_(_)
│ │ │ │ │ +    * _c_r_e_a_t_e___t_o_r_r_e_n_t
│ │ │ │ │ +          o _c_r_e_a_t_e___t_o_r_r_e_n_t_(_)
│ │ │ │ │ +          o _g_e_n_e_r_a_t_e_(_)_ _g_e_n_e_r_a_t_e___b_u_f_(_)
│ │ │ │ │ +          o _f_i_l_e_s_(_)
│ │ │ │ │ +          o _s_e_t___c_o_m_m_e_n_t_(_)
│ │ │ │ │ +          o _s_e_t___c_r_e_a_t_o_r_(_)
│ │ │ │ │ +          o _s_e_t___c_r_e_a_t_i_o_n___d_a_t_e_(_)
│ │ │ │ │ +          o _s_e_t___h_a_s_h_(_)
│ │ │ │ │ +          o _s_e_t___h_a_s_h_2_(_)
│ │ │ │ │ +          o _a_d_d___u_r_l___s_e_e_d_(_)_ _a_d_d___h_t_t_p___s_e_e_d_(_)
│ │ │ │ │ +          o _a_d_d___n_o_d_e_(_)
│ │ │ │ │ +          o _a_d_d___t_r_a_c_k_e_r_(_)
│ │ │ │ │ +          o _s_e_t___r_o_o_t___c_e_r_t_(_)
│ │ │ │ │ +          o _p_r_i_v_(_)_ _s_e_t___p_r_i_v_(_)
│ │ │ │ │ +          o _n_u_m___p_i_e_c_e_s_(_)
│ │ │ │ │ +          o _p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │ +          o _f_i_l_e___r_a_n_g_e_(_)
│ │ │ │ │ +          o _f_i_l_e___p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │ +          o _t_o_t_a_l___s_i_z_e_(_)
│ │ │ │ │ +          o _p_i_e_c_e___l_e_n_g_t_h_(_)_ _p_i_e_c_e___s_i_z_e_(_)
│ │ │ │ │ +          o _a_d_d___c_o_l_l_e_c_t_i_o_n_(_)_ _a_d_d___s_i_m_i_l_a_r___t_o_r_r_e_n_t_(_)
│ │ │ │ │ +    * _a_d_d___f_i_l_e_s_(_)
│ │ │ │ │ +    * _s_e_t___p_i_e_c_e___h_a_s_h_e_s_(_)
│ │ │ │ │      * _w_e_b___s_e_e_d___e_n_t_r_y
│ │ │ │ │            o _o_p_e_r_a_t_o_r_=_=_(_)
│ │ │ │ │            o _o_p_e_r_a_t_o_r_<_(_)
│ │ │ │ │            o _e_n_u_m_ _t_y_p_e___t
│ │ │ │ │      * _l_o_a_d___t_o_r_r_e_n_t___l_i_m_i_t_s
│ │ │ │ │      * _t_o_r_r_e_n_t___i_n_f_o
│ │ │ │ │            o _t_o_r_r_e_n_t___i_n_f_o_(_)
│ │ │ │ │            o _~_t_o_r_r_e_n_t___i_n_f_o_(_)
│ │ │ │ │            o _f_i_l_e_s_(_)_ _o_r_i_g___f_i_l_e_s_(_)
│ │ │ │ │            o _r_e_n_a_m_e___f_i_l_e_(_)
│ │ │ │ │            o _r_e_m_a_p___f_i_l_e_s_(_)
│ │ │ │ │ -          o _a_d_d___t_r_a_c_k_e_r_(_)_ _c_l_e_a_r___t_r_a_c_k_e_r_s_(_)_ _t_r_a_c_k_e_r_s_(_)
│ │ │ │ │ +          o _c_l_e_a_r___t_r_a_c_k_e_r_s_(_)_ _a_d_d___t_r_a_c_k_e_r_(_)_ _t_r_a_c_k_e_r_s_(_)
│ │ │ │ │            o _c_o_l_l_e_c_t_i_o_n_s_(_)_ _s_i_m_i_l_a_r___t_o_r_r_e_n_t_s_(_)
│ │ │ │ │ -          o _a_d_d___h_t_t_p___s_e_e_d_(_)_ _s_e_t___w_e_b___s_e_e_d_s_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)_ _w_e_b___s_e_e_d_s_(_)
│ │ │ │ │ +          o _a_d_d___u_r_l___s_e_e_d_(_)_ _w_e_b___s_e_e_d_s_(_)_ _s_e_t___w_e_b___s_e_e_d_s_(_)_ _a_d_d___h_t_t_p___s_e_e_d_(_)
│ │ │ │ │            o _t_o_t_a_l___s_i_z_e_(_)
│ │ │ │ │            o _p_i_e_c_e___l_e_n_g_t_h_(_)_ _n_u_m___p_i_e_c_e_s_(_)
│ │ │ │ │            o _b_l_o_c_k_s___p_e_r___p_i_e_c_e_(_)
│ │ │ │ │ -          o _l_a_s_t___p_i_e_c_e_(_)_ _e_n_d___p_i_e_c_e_(_)_ _p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │ +          o _p_i_e_c_e___r_a_n_g_e_(_)_ _l_a_s_t___p_i_e_c_e_(_)_ _e_n_d___p_i_e_c_e_(_)
│ │ │ │ │            o _i_n_f_o___h_a_s_h_e_s_(_)_ _i_n_f_o___h_a_s_h_(_)
│ │ │ │ │            o _v_1_(_)_ _v_2_(_)
│ │ │ │ │            o _n_u_m___f_i_l_e_s_(_)
│ │ │ │ │            o _m_a_p___b_l_o_c_k_(_)
│ │ │ │ │            o _m_a_p___f_i_l_e_(_)
│ │ │ │ │            o _s_s_l___c_e_r_t_(_)
│ │ │ │ │            o _i_s___v_a_l_i_d_(_)
│ │ │ │ │ @@ -122,119 +170,188 @@
│ │ │ │ │            o _n_o_d_e_s_(_)
│ │ │ │ │            o _a_d_d___n_o_d_e_(_)
│ │ │ │ │            o _p_a_r_s_e___i_n_f_o___s_e_c_t_i_o_n_(_)
│ │ │ │ │            o _i_n_f_o_(_)
│ │ │ │ │            o _i_n_f_o___s_e_c_t_i_o_n_(_)
│ │ │ │ │            o _p_i_e_c_e___l_a_y_e_r_(_)
│ │ │ │ │            o _f_r_e_e___p_i_e_c_e___l_a_y_e_r_s_(_)
│ │ │ │ │ -    * _h_a_s_h_e_r
│ │ │ │ │ -          o _o_p_e_r_a_t_o_r_=_(_)_ _h_a_s_h_e_r_(_)
│ │ │ │ │ -          o _u_p_d_a_t_e_(_)
│ │ │ │ │ -          o _f_i_n_a_l_(_)
│ │ │ │ │ -          o _r_e_s_e_t_(_)
│ │ │ │ │ -    * _h_a_s_h_e_r_2_5_6
│ │ │ │ │ -          o _o_p_e_r_a_t_o_r_=_(_)_ _h_a_s_h_e_r_2_5_6_(_)
│ │ │ │ │ -          o _u_p_d_a_t_e_(_)
│ │ │ │ │ -          o _f_i_n_a_l_(_)
│ │ │ │ │ -          o _r_e_s_e_t_(_)
│ │ │ │ │ -    * _b_i_t_f_i_e_l_d
│ │ │ │ │ -          o _b_i_t_f_i_e_l_d_(_)
│ │ │ │ │ -          o _a_s_s_i_g_n_(_)
│ │ │ │ │ -          o _o_p_e_r_a_t_o_r_[_]_(_)_ _g_e_t___b_i_t_(_)
│ │ │ │ │ -          o _c_l_e_a_r___b_i_t_(_)_ _s_e_t___b_i_t_(_)
│ │ │ │ │ -          o _a_l_l___s_e_t_(_)
│ │ │ │ │ -          o _n_o_n_e___s_e_t_(_)
│ │ │ │ │ -          o _s_i_z_e_(_)
│ │ │ │ │ -          o _n_u_m___w_o_r_d_s_(_)
│ │ │ │ │ -          o _n_u_m___b_y_t_e_s_(_)
│ │ │ │ │ +    * _i_p___f_i_l_t_e_r
│ │ │ │ │            o _e_m_p_t_y_(_)
│ │ │ │ │ -          o _d_a_t_a_(_)
│ │ │ │ │ -          o _s_w_a_p_(_)
│ │ │ │ │ -          o _c_o_u_n_t_(_)
│ │ │ │ │ -          o _f_i_n_d___f_i_r_s_t___s_e_t_(_)
│ │ │ │ │ -          o _f_i_n_d___l_a_s_t___c_l_e_a_r_(_)
│ │ │ │ │ +          o _a_d_d___r_u_l_e_(_)
│ │ │ │ │ +          o _a_c_c_e_s_s_(_)
│ │ │ │ │ +          o _e_x_p_o_r_t___f_i_l_t_e_r_(_)
│ │ │ │ │ +          o _e_n_u_m_ _a_c_c_e_s_s___f_l_a_g_s
│ │ │ │ │ +    * _p_o_r_t___f_i_l_t_e_r
│ │ │ │ │ +          o _a_d_d___r_u_l_e_(_)
│ │ │ │ │ +          o _a_c_c_e_s_s_(_)
│ │ │ │ │ +          o _e_n_u_m_ _a_c_c_e_s_s___f_l_a_g_s
│ │ │ │ │ +    * _b_l_o_c_k___i_n_f_o
│ │ │ │ │ +          o _p_e_e_r_(_)_ _s_e_t___p_e_e_r_(_)
│ │ │ │ │ +          o _e_n_u_m_ _b_l_o_c_k___s_t_a_t_e___t
│ │ │ │ │ +    * _p_a_r_t_i_a_l___p_i_e_c_e___i_n_f_o
│ │ │ │ │ +    * _t_o_r_r_e_n_t___h_a_n_d_l_e
│ │ │ │ │ +          o _t_o_r_r_e_n_t___h_a_n_d_l_e_(_)
│ │ │ │ │ +          o _a_d_d___p_i_e_c_e_(_)
│ │ │ │ │ +          o _r_e_a_d___p_i_e_c_e_(_)
│ │ │ │ │ +          o _h_a_v_e___p_i_e_c_e_(_)
│ │ │ │ │ +          o _g_e_t___p_e_e_r___i_n_f_o_(_)_ _p_o_s_t___p_e_e_r___i_n_f_o_(_)
│ │ │ │ │ +          o _p_o_s_t___s_t_a_t_u_s_(_)_ _s_t_a_t_u_s_(_)
│ │ │ │ │ +          o _p_o_s_t___d_o_w_n_l_o_a_d___q_u_e_u_e_(_)_ _g_e_t___d_o_w_n_l_o_a_d___q_u_e_u_e_(_)
│ │ │ │ │ +          o _s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_)_ _r_e_s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_)_ _c_l_e_a_r___p_i_e_c_e___d_e_a_d_l_i_n_e_s_(_)
│ │ │ │ │ +          o _f_i_l_e___p_r_o_g_r_e_s_s_(_)_ _p_o_s_t___f_i_l_e___p_r_o_g_r_e_s_s_(_)
│ │ │ │ │ +          o _f_i_l_e___s_t_a_t_u_s_(_)
│ │ │ │ │ +          o _c_l_e_a_r___e_r_r_o_r_(_)
│ │ │ │ │ +          o _a_d_d___t_r_a_c_k_e_r_(_)_ _r_e_p_l_a_c_e___t_r_a_c_k_e_r_s_(_)_ _t_r_a_c_k_e_r_s_(_)_ _p_o_s_t___t_r_a_c_k_e_r_s_(_)
│ │ │ │ │ +          o _r_e_m_o_v_e___u_r_l___s_e_e_d_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)_ _u_r_l___s_e_e_d_s_(_)
│ │ │ │ │ +          o _h_t_t_p___s_e_e_d_s_(_)_ _r_e_m_o_v_e___h_t_t_p___s_e_e_d_(_)_ _a_d_d___h_t_t_p___s_e_e_d_(_)
│ │ │ │ │ +          o _a_d_d___e_x_t_e_n_s_i_o_n_(_)
│ │ │ │ │ +          o _s_e_t___m_e_t_a_d_a_t_a_(_)
│ │ │ │ │ +          o _i_s___v_a_l_i_d_(_)
│ │ │ │ │ +          o _p_a_u_s_e_(_)_ _r_e_s_u_m_e_(_)
│ │ │ │ │ +          o _s_e_t___f_l_a_g_s_(_)_ _u_n_s_e_t___f_l_a_g_s_(_)_ _f_l_a_g_s_(_)
│ │ │ │ │ +          o _f_l_u_s_h___c_a_c_h_e_(_)
│ │ │ │ │ +          o _f_o_r_c_e___r_e_c_h_e_c_k_(_)
│ │ │ │ │ +          o _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ +          o _n_e_e_d___s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ +          o _q_u_e_u_e___p_o_s_i_t_i_o_n___t_o_p_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n___d_o_w_n_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n___b_o_t_t_o_m_(_)
│ │ │ │ │ +            _q_u_e_u_e___p_o_s_i_t_i_o_n___u_p_(_)_ _q_u_e_u_e___p_o_s_i_t_i_o_n_(_)
│ │ │ │ │ +          o _q_u_e_u_e___p_o_s_i_t_i_o_n___s_e_t_(_)
│ │ │ │ │ +          o _s_e_t___s_s_l___c_e_r_t_i_f_i_c_a_t_e_(_)_ _s_e_t___s_s_l___c_e_r_t_i_f_i_c_a_t_e___b_u_f_f_e_r_(_)
│ │ │ │ │ +          o _t_o_r_r_e_n_t___f_i_l_e___w_i_t_h___h_a_s_h_e_s_(_)_ _t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │ +          o _p_i_e_c_e___l_a_y_e_r_s_(_)
│ │ │ │ │ +          o _p_o_s_t___p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y_(_)_ _p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y_(_)
│ │ │ │ │ +          o _p_i_e_c_e___p_r_i_o_r_i_t_y_(_)_ _p_r_i_o_r_i_t_i_z_e___p_i_e_c_e_s_(_)_ _g_e_t___p_i_e_c_e___p_r_i_o_r_i_t_i_e_s_(_)
│ │ │ │ │ +          o _g_e_t___f_i_l_e___p_r_i_o_r_i_t_i_e_s_(_)_ _p_r_i_o_r_i_t_i_z_e___f_i_l_e_s_(_)_ _f_i_l_e___p_r_i_o_r_i_t_y_(_)
│ │ │ │ │ +          o _f_o_r_c_e___l_s_d___a_n_n_o_u_n_c_e_(_)_ _f_o_r_c_e___r_e_a_n_n_o_u_n_c_e_(_)_ _f_o_r_c_e___d_h_t___a_n_n_o_u_n_c_e_(_)
│ │ │ │ │ +          o _s_c_r_a_p_e___t_r_a_c_k_e_r_(_)
│ │ │ │ │ +          o _s_e_t___d_o_w_n_l_o_a_d___l_i_m_i_t_(_)_ _s_e_t___u_p_l_o_a_d___l_i_m_i_t_(_)_ _u_p_l_o_a_d___l_i_m_i_t_(_)
│ │ │ │ │ +            _d_o_w_n_l_o_a_d___l_i_m_i_t_(_)
│ │ │ │ │ +          o _c_o_n_n_e_c_t___p_e_e_r_(_)
│ │ │ │ │ +          o _c_l_e_a_r___p_e_e_r_s_(_)
│ │ │ │ │ +          o _s_e_t___m_a_x___u_p_l_o_a_d_s_(_)_ _m_a_x___u_p_l_o_a_d_s_(_)
│ │ │ │ │ +          o _m_a_x___c_o_n_n_e_c_t_i_o_n_s_(_)_ _s_e_t___m_a_x___c_o_n_n_e_c_t_i_o_n_s_(_)
│ │ │ │ │ +          o _m_o_v_e___s_t_o_r_a_g_e_(_)
│ │ │ │ │ +          o _r_e_n_a_m_e___f_i_l_e_(_)
│ │ │ │ │ +          o _i_n_f_o___h_a_s_h_e_s_(_)_ _i_n_f_o___h_a_s_h_(_)
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_!_=_(_)_ _o_p_e_r_a_t_o_r_=_=_(_)_ _o_p_e_r_a_t_o_r_<_(_)
│ │ │ │ │ +          o _i_d_(_)
│ │ │ │ │ +          o _n_a_t_i_v_e___h_a_n_d_l_e_(_)
│ │ │ │ │ +          o _u_s_e_r_d_a_t_a_(_)
│ │ │ │ │ +          o _i_n___s_e_s_s_i_o_n_(_)
│ │ │ │ │ +    * _h_a_s_h___v_a_l_u_e_(_)
│ │ │ │ │      * _s_e_s_s_i_o_n___p_r_o_x_y
│ │ │ │ │            o _o_p_e_r_a_t_o_r_=_(_)_ _s_e_s_s_i_o_n___p_r_o_x_y_(_)_ _~_s_e_s_s_i_o_n___p_r_o_x_y_(_)
│ │ │ │ │      * _s_e_s_s_i_o_n
│ │ │ │ │            o _s_e_s_s_i_o_n_(_)
│ │ │ │ │            o _s_e_s_s_i_o_n_(_)
│ │ │ │ │            o _~_s_e_s_s_i_o_n_(_)
│ │ │ │ │            o _a_b_o_r_t_(_)
│ │ │ │ │      * _s_e_s_s_i_o_n___p_a_r_a_m_s
│ │ │ │ │            o _s_e_s_s_i_o_n___p_a_r_a_m_s_(_)
│ │ │ │ │            o _s_e_s_s_i_o_n___p_a_r_a_m_s_(_)
│ │ │ │ │      * _s_e_s_s_i_o_n___h_a_n_d_l_e
│ │ │ │ │            o _i_s___v_a_l_i_d_(_)
│ │ │ │ │            o _s_e_s_s_i_o_n___s_t_a_t_e_(_)
│ │ │ │ │ -          o _r_e_f_r_e_s_h___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)_ _g_e_t___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)
│ │ │ │ │ +          o _g_e_t___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)_ _r_e_f_r_e_s_h___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)
│ │ │ │ │            o _p_o_s_t___t_o_r_r_e_n_t___u_p_d_a_t_e_s_(_)
│ │ │ │ │            o _p_o_s_t___s_e_s_s_i_o_n___s_t_a_t_s_(_)
│ │ │ │ │            o _p_o_s_t___d_h_t___s_t_a_t_s_(_)
│ │ │ │ │            o _s_e_t___d_h_t___s_t_a_t_e_(_)
│ │ │ │ │            o _f_i_n_d___t_o_r_r_e_n_t_(_)_ _g_e_t___t_o_r_r_e_n_t_s_(_)
│ │ │ │ │ -          o _a_d_d___t_o_r_r_e_n_t_(_)_ _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -          o _i_s___p_a_u_s_e_d_(_)_ _r_e_s_u_m_e_(_)_ _p_a_u_s_e_(_)
│ │ │ │ │ +          o _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_)_ _a_d_d___t_o_r_r_e_n_t_(_)
│ │ │ │ │ +          o _i_s___p_a_u_s_e_d_(_)_ _p_a_u_s_e_(_)_ _r_e_s_u_m_e_(_)
│ │ │ │ │            o _i_s___d_h_t___r_u_n_n_i_n_g_(_)
│ │ │ │ │            o _s_e_t___d_h_t___s_t_o_r_a_g_e_(_)
│ │ │ │ │            o _a_d_d___d_h_t___n_o_d_e_(_)
│ │ │ │ │            o _d_h_t___g_e_t___i_t_e_m_(_)
│ │ │ │ │            o _d_h_t___g_e_t___i_t_e_m_(_)
│ │ │ │ │            o _d_h_t___p_u_t___i_t_e_m_(_)
│ │ │ │ │            o _d_h_t___p_u_t___i_t_e_m_(_)
│ │ │ │ │ -          o _d_h_t___g_e_t___p_e_e_r_s_(_)_ _d_h_t___a_n_n_o_u_n_c_e_(_)
│ │ │ │ │ +          o _d_h_t___a_n_n_o_u_n_c_e_(_)_ _d_h_t___g_e_t___p_e_e_r_s_(_)
│ │ │ │ │            o _d_h_t___l_i_v_e___n_o_d_e_s_(_)
│ │ │ │ │            o _d_h_t___s_a_m_p_l_e___i_n_f_o_h_a_s_h_e_s_(_)
│ │ │ │ │            o _d_h_t___d_i_r_e_c_t___r_e_q_u_e_s_t_(_)
│ │ │ │ │            o _a_d_d___e_x_t_e_n_s_i_o_n_(_)
│ │ │ │ │            o _s_e_t___i_p___f_i_l_t_e_r_(_)_ _g_e_t___i_p___f_i_l_t_e_r_(_)
│ │ │ │ │            o _s_e_t___p_o_r_t___f_i_l_t_e_r_(_)
│ │ │ │ │ -          o _l_i_s_t_e_n___p_o_r_t_(_)_ _i_s___l_i_s_t_e_n_i_n_g_(_)_ _s_s_l___l_i_s_t_e_n___p_o_r_t_(_)
│ │ │ │ │ +          o _s_s_l___l_i_s_t_e_n___p_o_r_t_(_)_ _i_s___l_i_s_t_e_n_i_n_g_(_)_ _l_i_s_t_e_n___p_o_r_t_(_)
│ │ │ │ │            o _g_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_)_ _s_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_)
│ │ │ │ │            o _s_e_t___p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_(_)_ _g_e_t___p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_(_)
│ │ │ │ │            o _c_r_e_a_t_e___p_e_e_r___c_l_a_s_s_(_)
│ │ │ │ │            o _d_e_l_e_t_e___p_e_e_r___c_l_a_s_s_(_)
│ │ │ │ │            o _g_e_t___p_e_e_r___c_l_a_s_s_(_)_ _s_e_t___p_e_e_r___c_l_a_s_s_(_)
│ │ │ │ │            o _r_e_m_o_v_e___t_o_r_r_e_n_t_(_)
│ │ │ │ │            o _a_p_p_l_y___s_e_t_t_i_n_g_s_(_)_ _g_e_t___s_e_t_t_i_n_g_s_(_)
│ │ │ │ │ -          o _p_o_p___a_l_e_r_t_s_(_)_ _w_a_i_t___f_o_r___a_l_e_r_t_(_)_ _s_e_t___a_l_e_r_t___n_o_t_i_f_y_(_)
│ │ │ │ │ +          o _p_o_p___a_l_e_r_t_s_(_)_ _s_e_t___a_l_e_r_t___n_o_t_i_f_y_(_)_ _w_a_i_t___f_o_r___a_l_e_r_t_(_)
│ │ │ │ │            o _a_d_d___p_o_r_t___m_a_p_p_i_n_g_(_)_ _d_e_l_e_t_e___p_o_r_t___m_a_p_p_i_n_g_(_)
│ │ │ │ │            o _r_e_o_p_e_n___n_e_t_w_o_r_k___s_o_c_k_e_t_s_(_)
│ │ │ │ │            o _n_a_t_i_v_e___h_a_n_d_l_e_(_)
│ │ │ │ │ -    * _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s___b_u_f_(_)_ _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)_ _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)
│ │ │ │ │ -    * _s_t_a_t_s___m_e_t_r_i_c
│ │ │ │ │ +    * _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)_ _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s___b_u_f_(_)_ _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)
│ │ │ │ │      * _c_o_u_n_t_e_r_s
│ │ │ │ │            o _o_p_e_r_a_t_o_r_[_]_(_)_ _i_n_c___s_t_a_t_s___c_o_u_n_t_e_r_(_)
│ │ │ │ │ +    * _s_t_a_t_s___m_e_t_r_i_c
│ │ │ │ │      * _s_e_s_s_i_o_n___s_t_a_t_s___m_e_t_r_i_c_s_(_)
│ │ │ │ │      * _f_i_n_d___m_e_t_r_i_c___i_d_x_(_)
│ │ │ │ │      * _e_n_u_m_ _m_e_t_r_i_c___t_y_p_e___t
│ │ │ │ │ -    * _i_p___f_i_l_t_e_r
│ │ │ │ │ -          o _e_m_p_t_y_(_)
│ │ │ │ │ -          o _a_d_d___r_u_l_e_(_)
│ │ │ │ │ -          o _a_c_c_e_s_s_(_)
│ │ │ │ │ -          o _e_x_p_o_r_t___f_i_l_t_e_r_(_)
│ │ │ │ │ -          o _e_n_u_m_ _a_c_c_e_s_s___f_l_a_g_s
│ │ │ │ │ -    * _p_o_r_t___f_i_l_t_e_r
│ │ │ │ │ -          o _a_d_d___r_u_l_e_(_)
│ │ │ │ │ -          o _a_c_c_e_s_s_(_)
│ │ │ │ │ -          o _e_n_u_m_ _a_c_c_e_s_s___f_l_a_g_s
│ │ │ │ │ -    * _c_l_i_e_n_t___d_a_t_a___t
│ │ │ │ │ -          o _c_l_i_e_n_t___d_a_t_a___t_(_)
│ │ │ │ │ -          o _c_o_n_s_t_*_(_)_ _v_o_i_d_*_(_)_ _o_p_e_r_a_t_o_r_=_(_)
│ │ │ │ │ -    * _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s
│ │ │ │ │      * _a_n_n_o_u_n_c_e___i_n_f_o_h_a_s_h
│ │ │ │ │      * _a_n_n_o_u_n_c_e___e_n_d_p_o_i_n_t
│ │ │ │ │      * _a_n_n_o_u_n_c_e___e_n_t_r_y
│ │ │ │ │            o _o_p_e_r_a_t_o_r_=_(_)_ _~_a_n_n_o_u_n_c_e___e_n_t_r_y_(_)_ _a_n_n_o_u_n_c_e___e_n_t_r_y_(_)
│ │ │ │ │            o _e_n_u_m_ _t_r_a_c_k_e_r___s_o_u_r_c_e
│ │ │ │ │ -    * _a_l_e_r_t
│ │ │ │ │ -          o _t_i_m_e_s_t_a_m_p_(_)
│ │ │ │ │ -          o _t_y_p_e_(_)
│ │ │ │ │ -          o _w_h_a_t_(_)
│ │ │ │ │ -          o _m_e_s_s_a_g_e_(_)
│ │ │ │ │ -          o _c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _p_e_e_r___c_l_a_s_s___i_n_f_o
│ │ │ │ │ +    * _p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r
│ │ │ │ │ +          o _r_e_m_o_v_e_(_)_ _a_d_d_(_)
│ │ │ │ │ +          o _a_l_l_o_w_(_)_ _d_i_s_a_l_l_o_w_(_)
│ │ │ │ │ +          o _a_p_p_l_y_(_)
│ │ │ │ │ +          o _e_n_u_m_ _s_o_c_k_e_t___t_y_p_e___t
│ │ │ │ │ +    * _s_t_o_r_a_g_e___p_a_r_a_m_s
│ │ │ │ │ +    * _f_i_l_e___s_l_i_c_e
│ │ │ │ │ +    * _f_i_l_e___s_t_o_r_a_g_e
│ │ │ │ │ +          o _i_s___v_a_l_i_d_(_)
│ │ │ │ │ +          o _r_e_s_e_r_v_e_(_)
│ │ │ │ │ +          o _a_d_d___f_i_l_e___b_o_r_r_o_w_(_)_ _a_d_d___f_i_l_e_(_)
│ │ │ │ │ +          o _r_e_n_a_m_e___f_i_l_e_(_)
│ │ │ │ │ +          o _m_a_p___b_l_o_c_k_(_)
│ │ │ │ │ +          o _m_a_p___f_i_l_e_(_)
│ │ │ │ │ +          o _n_u_m___f_i_l_e_s_(_)
│ │ │ │ │ +          o _e_n_d___f_i_l_e_(_)
│ │ │ │ │ +          o _f_i_l_e___r_a_n_g_e_(_)
│ │ │ │ │ +          o _t_o_t_a_l___s_i_z_e_(_)
│ │ │ │ │ +          o _s_e_t___n_u_m___p_i_e_c_e_s_(_)_ _n_u_m___p_i_e_c_e_s_(_)
│ │ │ │ │ +          o _e_n_d___p_i_e_c_e_(_)
│ │ │ │ │ +          o _l_a_s_t___p_i_e_c_e_(_)
│ │ │ │ │ +          o _p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │ +          o _p_i_e_c_e___l_e_n_g_t_h_(_)_ _s_e_t___p_i_e_c_e___l_e_n_g_t_h_(_)
│ │ │ │ │ +          o _p_i_e_c_e___s_i_z_e_(_)
│ │ │ │ │ +          o _p_i_e_c_e___s_i_z_e_2_(_)
│ │ │ │ │ +          o _b_l_o_c_k_s___i_n___p_i_e_c_e_2_(_)
│ │ │ │ │ +          o _b_l_o_c_k_s___p_e_r___p_i_e_c_e_(_)
│ │ │ │ │ +          o _n_a_m_e_(_)_ _s_e_t___n_a_m_e_(_)
│ │ │ │ │ +          o _s_w_a_p_(_)
│ │ │ │ │ +          o _c_a_n_o_n_i_c_a_l_i_z_e_(_)
│ │ │ │ │ +          o _f_i_l_e___o_f_f_s_e_t_(_)_ _s_y_m_l_i_n_k_(_)_ _h_a_s_h_(_)_ _f_i_l_e___n_a_m_e_(_)_ _f_i_l_e___s_i_z_e_(_)_ _r_o_o_t___p_t_r_(_)
│ │ │ │ │ +            _r_o_o_t_(_)_ _f_i_l_e___p_a_t_h_(_)_ _p_a_d___f_i_l_e___a_t_(_)_ _m_t_i_m_e_(_)
│ │ │ │ │ +          o _f_i_l_e___n_u_m___p_i_e_c_e_s_(_)_ _f_i_l_e___p_i_e_c_e___r_a_n_g_e_(_)_ _f_i_l_e___n_u_m___b_l_o_c_k_s_(_)
│ │ │ │ │ +          o _f_i_l_e___f_i_r_s_t___b_l_o_c_k___n_o_d_e_(_)_ _f_i_l_e___f_i_r_s_t___p_i_e_c_e___n_o_d_e_(_)
│ │ │ │ │ +          o _f_i_l_e___p_a_t_h___h_a_s_h_(_)
│ │ │ │ │ +          o _a_l_l___p_a_t_h___h_a_s_h_e_s_(_)
│ │ │ │ │ +          o _f_i_l_e___f_l_a_g_s_(_)
│ │ │ │ │ +          o _f_i_l_e___a_b_s_o_l_u_t_e___p_a_t_h_(_)
│ │ │ │ │ +          o _f_i_l_e___i_n_d_e_x___a_t___p_i_e_c_e_(_)_ _f_i_l_e___i_n_d_e_x___a_t___o_f_f_s_e_t_(_)
│ │ │ │ │ +          o _f_i_l_e___i_n_d_e_x___f_o_r___r_o_o_t_(_)
│ │ │ │ │ +          o _p_i_e_c_e___i_n_d_e_x___a_t___f_i_l_e_(_)
│ │ │ │ │ +          o _s_a_n_i_t_i_z_e___s_y_m_l_i_n_k_s_(_)
│ │ │ │ │ +          o _v_2_(_)
│ │ │ │ │ +    * _m_m_a_p___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ +    * _d_e_f_a_u_l_t___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ +    * _d_i_s_a_b_l_e_d___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ +    * _p_o_s_i_x___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ +    * _e_n_u_m_ _s_t_o_r_a_g_e___m_o_d_e___t
│ │ │ │ │ +    * _e_n_u_m_ _s_t_a_t_u_s___t
│ │ │ │ │ +    * _e_n_u_m_ _m_o_v_e___f_l_a_g_s___t
│ │ │ │ │      * _d_h_t___r_o_u_t_i_n_g___b_u_c_k_e_t
│ │ │ │ │      * _t_o_r_r_e_n_t___a_l_e_r_t
│ │ │ │ │            o _m_e_s_s_a_g_e_(_)
│ │ │ │ │      * _p_e_e_r___a_l_e_r_t
│ │ │ │ │      * _t_r_a_c_k_e_r___a_l_e_r_t
│ │ │ │ │            o _t_r_a_c_k_e_r___u_r_l_(_)
│ │ │ │ │      * _t_o_r_r_e_n_t___r_e_m_o_v_e_d___a_l_e_r_t
│ │ │ │ │ @@ -359,1121 +476,4420 @@
│ │ │ │ │      * _o_v_e_r_s_i_z_e_d___f_i_l_e___a_l_e_r_t
│ │ │ │ │      * _t_o_r_r_e_n_t___c_o_n_f_l_i_c_t___a_l_e_r_t
│ │ │ │ │      * _p_e_e_r___i_n_f_o___a_l_e_r_t
│ │ │ │ │      * _f_i_l_e___p_r_o_g_r_e_s_s___a_l_e_r_t
│ │ │ │ │      * _p_i_e_c_e___i_n_f_o___a_l_e_r_t
│ │ │ │ │      * _p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y___a_l_e_r_t
│ │ │ │ │      * _t_r_a_c_k_e_r___l_i_s_t___a_l_e_r_t
│ │ │ │ │ +    * _a_l_e_r_t
│ │ │ │ │ +          o _t_i_m_e_s_t_a_m_p_(_)
│ │ │ │ │ +          o _t_y_p_e_(_)
│ │ │ │ │ +          o _w_h_a_t_(_)
│ │ │ │ │ +          o _m_e_s_s_a_g_e_(_)
│ │ │ │ │ +          o _c_a_t_e_g_o_r_y_(_)
│ │ │ │ │      * _a_l_e_r_t___c_a_s_t_(_)
│ │ │ │ │      * _o_p_e_r_a_t_i_o_n___n_a_m_e_(_)
│ │ │ │ │      * _e_n_u_m_ _o_p_e_r_a_t_i_o_n___t
│ │ │ │ │ -    * _a_l_e_r_t___c_a_t_e_g_o_r_y___t
│ │ │ │ │      * _i_n_t
│ │ │ │ │ -    * _s_t_o_r_a_g_e___p_a_r_a_m_s
│ │ │ │ │ -    * _f_i_l_e___s_l_i_c_e
│ │ │ │ │ -    * _f_i_l_e___s_t_o_r_a_g_e
│ │ │ │ │ -          o _i_s___v_a_l_i_d_(_)
│ │ │ │ │ -          o _r_e_s_e_r_v_e_(_)
│ │ │ │ │ -          o _a_d_d___f_i_l_e_(_)_ _a_d_d___f_i_l_e___b_o_r_r_o_w_(_)
│ │ │ │ │ -          o _r_e_n_a_m_e___f_i_l_e_(_)
│ │ │ │ │ -          o _m_a_p___b_l_o_c_k_(_)
│ │ │ │ │ -          o _m_a_p___f_i_l_e_(_)
│ │ │ │ │ -          o _n_u_m___f_i_l_e_s_(_)
│ │ │ │ │ -          o _e_n_d___f_i_l_e_(_)
│ │ │ │ │ -          o _f_i_l_e___r_a_n_g_e_(_)
│ │ │ │ │ -          o _t_o_t_a_l___s_i_z_e_(_)
│ │ │ │ │ -          o _n_u_m___p_i_e_c_e_s_(_)_ _s_e_t___n_u_m___p_i_e_c_e_s_(_)
│ │ │ │ │ -          o _e_n_d___p_i_e_c_e_(_)
│ │ │ │ │ -          o _l_a_s_t___p_i_e_c_e_(_)
│ │ │ │ │ -          o _p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │ -          o _s_e_t___p_i_e_c_e___l_e_n_g_t_h_(_)_ _p_i_e_c_e___l_e_n_g_t_h_(_)
│ │ │ │ │ -          o _p_i_e_c_e___s_i_z_e_(_)
│ │ │ │ │ -          o _p_i_e_c_e___s_i_z_e_2_(_)
│ │ │ │ │ -          o _b_l_o_c_k_s___i_n___p_i_e_c_e_2_(_)
│ │ │ │ │ -          o _b_l_o_c_k_s___p_e_r___p_i_e_c_e_(_)
│ │ │ │ │ -          o _n_a_m_e_(_)_ _s_e_t___n_a_m_e_(_)
│ │ │ │ │ -          o _s_w_a_p_(_)
│ │ │ │ │ -          o _c_a_n_o_n_i_c_a_l_i_z_e_(_)
│ │ │ │ │ -          o _r_o_o_t_(_)_ _m_t_i_m_e_(_)_ _s_y_m_l_i_n_k_(_)_ _f_i_l_e___o_f_f_s_e_t_(_)_ _h_a_s_h_(_)_ _p_a_d___f_i_l_e___a_t_(_)
│ │ │ │ │ -            _r_o_o_t___p_t_r_(_)_ _f_i_l_e___n_a_m_e_(_)_ _f_i_l_e___p_a_t_h_(_)_ _f_i_l_e___s_i_z_e_(_)
│ │ │ │ │ -          o _f_i_l_e___p_i_e_c_e___r_a_n_g_e_(_)_ _f_i_l_e___n_u_m___b_l_o_c_k_s_(_)_ _f_i_l_e___n_u_m___p_i_e_c_e_s_(_)
│ │ │ │ │ -          o _f_i_l_e___f_i_r_s_t___p_i_e_c_e___n_o_d_e_(_)_ _f_i_l_e___f_i_r_s_t___b_l_o_c_k___n_o_d_e_(_)
│ │ │ │ │ -          o _f_i_l_e___p_a_t_h___h_a_s_h_(_)
│ │ │ │ │ -          o _a_l_l___p_a_t_h___h_a_s_h_e_s_(_)
│ │ │ │ │ -          o _f_i_l_e___f_l_a_g_s_(_)
│ │ │ │ │ -          o _f_i_l_e___a_b_s_o_l_u_t_e___p_a_t_h_(_)
│ │ │ │ │ -          o _f_i_l_e___i_n_d_e_x___a_t___o_f_f_s_e_t_(_)_ _f_i_l_e___i_n_d_e_x___a_t___p_i_e_c_e_(_)
│ │ │ │ │ -          o _f_i_l_e___i_n_d_e_x___f_o_r___r_o_o_t_(_)
│ │ │ │ │ -          o _p_i_e_c_e___i_n_d_e_x___a_t___f_i_l_e_(_)
│ │ │ │ │ -          o _s_a_n_i_t_i_z_e___s_y_m_l_i_n_k_s_(_)
│ │ │ │ │ -          o _v_2_(_)
│ │ │ │ │ -    * _d_e_f_a_u_l_t___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ -    * _p_o_s_i_x___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ -    * _d_i_s_a_b_l_e_d___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ -    * _m_m_a_p___d_i_s_k___i_o___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │ -    * _e_n_u_m_ _s_t_o_r_a_g_e___m_o_d_e___t
│ │ │ │ │ -    * _e_n_u_m_ _s_t_a_t_u_s___t
│ │ │ │ │ -    * _e_n_u_m_ _m_o_v_e___f_l_a_g_s___t
│ │ │ │ │ -    * _a_ _w_o_r_d_ _o_f_ _c_a_u_t_i_o_n
│ │ │ │ │ -    * _p_l_u_g_i_n_-_i_n_t_e_r_f_a_c_e
│ │ │ │ │ -    * _c_u_s_t_o_m_ _a_l_e_r_t_s
│ │ │ │ │ -    * _p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e
│ │ │ │ │ -    * _b_t___p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e
│ │ │ │ │ -    * _p_l_u_g_i_n
│ │ │ │ │ -          o _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_)
│ │ │ │ │ -          o _n_e_w___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -          o _a_d_d_e_d_(_)
│ │ │ │ │ -          o _a_b_o_r_t_(_)
│ │ │ │ │ -          o _o_n___d_h_t___r_e_q_u_e_s_t_(_)
│ │ │ │ │ -          o _o_n___a_l_e_r_t_(_)
│ │ │ │ │ -          o _o_n___u_n_k_n_o_w_n___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -          o _o_n___t_i_c_k_(_)
│ │ │ │ │ -          o _g_e_t___u_n_c_h_o_k_e___p_r_i_o_r_i_t_y_(_)
│ │ │ │ │ -          o _l_o_a_d___s_t_a_t_e_(_)
│ │ │ │ │ -    * _t_o_r_r_e_n_t___p_l_u_g_i_n
│ │ │ │ │ -          o _n_e_w___c_o_n_n_e_c_t_i_o_n_(_)
│ │ │ │ │ -          o _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)_ _o_n___p_i_e_c_e___p_a_s_s_(_)
│ │ │ │ │ -          o _t_i_c_k_(_)
│ │ │ │ │ -          o _o_n___r_e_s_u_m_e_(_)_ _o_n___p_a_u_s_e_(_)
│ │ │ │ │ -          o _o_n___f_i_l_e_s___c_h_e_c_k_e_d_(_)
│ │ │ │ │ -          o _o_n___s_t_a_t_e_(_)
│ │ │ │ │ -          o _o_n___a_d_d___p_e_e_r_(_)
│ │ │ │ │ -    * _p_e_e_r___p_l_u_g_i_n
│ │ │ │ │ -          o _t_y_p_e_(_)
│ │ │ │ │ -          o _a_d_d___h_a_n_d_s_h_a_k_e_(_)
│ │ │ │ │ -          o _o_n___d_i_s_c_o_n_n_e_c_t_(_)
│ │ │ │ │ -          o _o_n___c_o_n_n_e_c_t_e_d_(_)
│ │ │ │ │ -          o _o_n___h_a_n_d_s_h_a_k_e_(_)
│ │ │ │ │ -          o _o_n___e_x_t_e_n_s_i_o_n___h_a_n_d_s_h_a_k_e_(_)
│ │ │ │ │ -          o _o_n___c_h_o_k_e_(_)_ _o_n___u_n_c_h_o_k_e_(_)_ _o_n___h_a_v_e___a_l_l_(_)_ _o_n___h_a_v_e___n_o_n_e_(_)_ _o_n___b_i_t_f_i_e_l_d_(_)
│ │ │ │ │ -            _o_n___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _o_n___r_e_q_u_e_s_t_(_)_ _o_n___h_a_v_e_(_)_ _o_n___d_o_n_t___h_a_v_e_(_)
│ │ │ │ │ -            _o_n___i_n_t_e_r_e_s_t_e_d_(_)_ _o_n___a_l_l_o_w_e_d___f_a_s_t_(_)
│ │ │ │ │ -          o _o_n___p_i_e_c_e_(_)
│ │ │ │ │ -          o _s_e_n_t___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___h_a_v_e_(_)_ _s_e_n_t___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___p_i_e_c_e_(_)
│ │ │ │ │ -            _s_e_n_t___u_n_c_h_o_k_e_(_)
│ │ │ │ │ -          o _s_e_n_t___p_a_y_l_o_a_d_(_)
│ │ │ │ │ -          o _c_a_n___d_i_s_c_o_n_n_e_c_t_(_)
│ │ │ │ │ -          o _o_n___e_x_t_e_n_d_e_d_(_)
│ │ │ │ │ -          o _o_n___u_n_k_n_o_w_n___m_e_s_s_a_g_e_(_)
│ │ │ │ │ -          o _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)_ _o_n___p_i_e_c_e___p_a_s_s_(_)
│ │ │ │ │ -          o _t_i_c_k_(_)
│ │ │ │ │ -          o _w_r_i_t_e___r_e_q_u_e_s_t_(_)
│ │ │ │ │ -    * _c_r_y_p_t_o___p_l_u_g_i_n
│ │ │ │ │ -          o _d_e_c_r_y_p_t_(_)
│ │ │ │ │ -    * _c_r_e_a_t_e___s_m_a_r_t___b_a_n___p_l_u_g_i_n_(_)
│ │ │ │ │ -    * _c_r_e_a_t_e___u_t___p_e_x___p_l_u_g_i_n_(_)
│ │ │ │ │ -    * _c_r_e_a_t_e___u_t___m_e_t_a_d_a_t_a___p_l_u_g_i_n_(_)
│ │ │ │ │ -    * _t_o_r_r_e_n_t___s_t_a_t_u_s
│ │ │ │ │ -          o _o_p_e_r_a_t_o_r_=_=_(_)
│ │ │ │ │ -          o _e_n_u_m_ _s_t_a_t_e___t
│ │ │ │ │ -    * _p_e_e_r___c_l_a_s_s___i_n_f_o
│ │ │ │ │ -    * _p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r
│ │ │ │ │ -          o _r_e_m_o_v_e_(_)_ _a_d_d_(_)
│ │ │ │ │ -          o _d_i_s_a_l_l_o_w_(_)_ _a_l_l_o_w_(_)
│ │ │ │ │ -          o _a_p_p_l_y_(_)
│ │ │ │ │ -          o _e_n_u_m_ _s_o_c_k_e_t___t_y_p_e___t
│ │ │ │ │ -    * _d_i_s_k___o_b_s_e_r_v_e_r
│ │ │ │ │ -          o _o_n___d_i_s_k_(_)
│ │ │ │ │ -    * _o_p_e_n___f_i_l_e___s_t_a_t_e
│ │ │ │ │ -    * _d_i_s_k___i_n_t_e_r_f_a_c_e
│ │ │ │ │ -          o _n_e_w___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -          o _r_e_m_o_v_e___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -          o _a_s_y_n_c___r_e_a_d_(_)_ _a_s_y_n_c___w_r_i_t_e_(_)
│ │ │ │ │ -          o _a_s_y_n_c___h_a_s_h_(_)
│ │ │ │ │ -          o _a_s_y_n_c___h_a_s_h_2_(_)
│ │ │ │ │ -          o _a_s_y_n_c___m_o_v_e___s_t_o_r_a_g_e_(_)
│ │ │ │ │ -          o _a_s_y_n_c___r_e_l_e_a_s_e___f_i_l_e_s_(_)
│ │ │ │ │ -          o _a_s_y_n_c___c_h_e_c_k___f_i_l_e_s_(_)
│ │ │ │ │ -          o _a_s_y_n_c___s_t_o_p___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -          o _a_s_y_n_c___r_e_n_a_m_e___f_i_l_e_(_)
│ │ │ │ │ -          o _a_s_y_n_c___d_e_l_e_t_e___f_i_l_e_s_(_)
│ │ │ │ │ -          o _a_s_y_n_c___s_e_t___f_i_l_e___p_r_i_o_r_i_t_y_(_)
│ │ │ │ │ -          o _a_s_y_n_c___c_l_e_a_r___p_i_e_c_e_(_)
│ │ │ │ │ -          o _u_p_d_a_t_e___s_t_a_t_s___c_o_u_n_t_e_r_s_(_)
│ │ │ │ │ -          o _g_e_t___s_t_a_t_u_s_(_)
│ │ │ │ │ -          o _a_b_o_r_t_(_)
│ │ │ │ │ -          o _s_u_b_m_i_t___j_o_b_s_(_)
│ │ │ │ │ -          o _s_e_t_t_i_n_g_s___u_p_d_a_t_e_d_(_)
│ │ │ │ │ -    * _s_t_o_r_a_g_e___h_o_l_d_e_r
│ │ │ │ │ -    * _s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e
│ │ │ │ │ -    * _b_u_f_f_e_r___a_l_l_o_c_a_t_o_r___i_n_t_e_r_f_a_c_e
│ │ │ │ │ -    * _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r
│ │ │ │ │ -          o _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ -          o _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ -          o _~_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_(_)
│ │ │ │ │ -          o _d_a_t_a_(_)
│ │ │ │ │ +    * _a_l_e_r_t___c_a_t_e_g_o_r_y___t
│ │ │ │ │ +    * _h_a_s_h_e_r
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_=_(_)_ _h_a_s_h_e_r_(_)
│ │ │ │ │ +          o _u_p_d_a_t_e_(_)
│ │ │ │ │ +          o _f_i_n_a_l_(_)
│ │ │ │ │ +          o _r_e_s_e_t_(_)
│ │ │ │ │ +    * _h_a_s_h_e_r_2_5_6
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_=_(_)_ _h_a_s_h_e_r_2_5_6_(_)
│ │ │ │ │ +          o _u_p_d_a_t_e_(_)
│ │ │ │ │ +          o _f_i_n_a_l_(_)
│ │ │ │ │            o _r_e_s_e_t_(_)
│ │ │ │ │ +    * _b_i_t_f_i_e_l_d
│ │ │ │ │ +          o _b_i_t_f_i_e_l_d_(_)
│ │ │ │ │ +          o _a_s_s_i_g_n_(_)
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_[_]_(_)_ _g_e_t___b_i_t_(_)
│ │ │ │ │ +          o _s_e_t___b_i_t_(_)_ _c_l_e_a_r___b_i_t_(_)
│ │ │ │ │ +          o _a_l_l___s_e_t_(_)
│ │ │ │ │ +          o _n_o_n_e___s_e_t_(_)
│ │ │ │ │ +          o _s_i_z_e_(_)
│ │ │ │ │ +          o _n_u_m___w_o_r_d_s_(_)
│ │ │ │ │ +          o _n_u_m___b_y_t_e_s_(_)
│ │ │ │ │ +          o _e_m_p_t_y_(_)
│ │ │ │ │ +          o _d_a_t_a_(_)
│ │ │ │ │            o _s_w_a_p_(_)
│ │ │ │ │ -          o _i_s___m_u_t_a_b_l_e_(_)
│ │ │ │ │ -          o _b_o_o_l_(_)
│ │ │ │ │ -    * _f_i_l_e___o_p_e_n___m_o_d_e___t
│ │ │ │ │ -    * _s_e_t_t_i_n_g_s___p_a_c_k
│ │ │ │ │ -          o _s_e_t___b_o_o_l_(_)_ _s_e_t___i_n_t_(_)_ _s_e_t___s_t_r_(_)
│ │ │ │ │ -          o _h_a_s___v_a_l_(_)
│ │ │ │ │ -          o _c_l_e_a_r_(_)
│ │ │ │ │ -          o _c_l_e_a_r_(_)
│ │ │ │ │ -          o _g_e_t___s_t_r_(_)_ _g_e_t___b_o_o_l_(_)_ _g_e_t___i_n_t_(_)
│ │ │ │ │ -          o _e_n_u_m_ _t_y_p_e___b_a_s_e_s
│ │ │ │ │ -          o _e_n_u_m_ _m_m_a_p___w_r_i_t_e___m_o_d_e___t
│ │ │ │ │ -          o _e_n_u_m_ _s_u_g_g_e_s_t___m_o_d_e___t
│ │ │ │ │ -          o _e_n_u_m_ _c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m___t
│ │ │ │ │ -          o _e_n_u_m_ _s_e_e_d___c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m___t
│ │ │ │ │ -          o _e_n_u_m_ _i_o___b_u_f_f_e_r___m_o_d_e___t
│ │ │ │ │ -          o _e_n_u_m_ _b_a_n_d_w_i_d_t_h___m_i_x_e_d___a_l_g_o___t
│ │ │ │ │ -          o _e_n_u_m_ _e_n_c___p_o_l_i_c_y
│ │ │ │ │ -          o _e_n_u_m_ _e_n_c___l_e_v_e_l
│ │ │ │ │ -          o _e_n_u_m_ _p_r_o_x_y___t_y_p_e___t
│ │ │ │ │ -    * _m_i_n___m_e_m_o_r_y___u_s_a_g_e_(_)_ _h_i_g_h___p_e_r_f_o_r_m_a_n_c_e___s_e_e_d_(_)
│ │ │ │ │ -    * _g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_t_(_)
│ │ │ │ │ -    * _n_a_m_e___f_o_r___s_e_t_t_i_n_g_(_)_ _s_e_t_t_i_n_g___b_y___n_a_m_e_(_)
│ │ │ │ │ -    * _d_e_f_a_u_l_t___s_e_t_t_i_n_g_s_(_)
│ │ │ │ │ -    * _s_t_o_r_a_g_e___e_r_r_o_r
│ │ │ │ │ -          o _b_o_o_l_(_)
│ │ │ │ │ -          o _f_i_l_e_(_)
│ │ │ │ │ -    * _l_i_b_t_o_r_r_e_n_t___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _h_t_t_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _i_2_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _b_d_e_c_o_d_e___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _p_c_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _s_o_c_k_s___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _g_z_i_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _u_p_n_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ -    * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ -    * _e_n_u_m_ _h_t_t_p___e_r_r_o_r_s
│ │ │ │ │ -    * _e_n_u_m_ _i_2_p___e_r_r_o_r___c_o_d_e
│ │ │ │ │ -    * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ -    * _e_n_u_m_ _p_c_p___e_r_r_o_r_s
│ │ │ │ │ -    * _e_n_u_m_ _s_o_c_k_s___e_r_r_o_r___c_o_d_e
│ │ │ │ │ -    * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ -    * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +          o _c_o_u_n_t_(_)
│ │ │ │ │ +          o _f_i_n_d___f_i_r_s_t___s_e_t_(_)
│ │ │ │ │ +          o _f_i_n_d___l_a_s_t___c_l_e_a_r_(_)
│ │ │ │ │ +    * _p_e_e_r___r_e_q_u_e_s_t
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_=_=_(_)
│ │ │ │ │ +    * _p_i_e_c_e___b_l_o_c_k
│ │ │ │ │ +    * _p_e_e_r___i_n_f_o
│ │ │ │ │ +          o _i_2_p___d_e_s_t_i_n_a_t_i_o_n_(_)
│ │ │ │ │ +    * _i_n_f_o___h_a_s_h___t
│ │ │ │ │ +          o _i_n_f_o___h_a_s_h___t_(_)
│ │ │ │ │ +          o _h_a_s___v_2_(_)_ _h_a_s___v_1_(_)_ _h_a_s_(_)
│ │ │ │ │ +          o _g_e_t_(_)
│ │ │ │ │ +          o _g_e_t___b_e_s_t_(_)
│ │ │ │ │ +          o _f_o_r___e_a_c_h_(_)
│ │ │ │ │ +    * _l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_)_ _l_o_a_d___t_o_r_r_e_n_t___f_i_l_e_(_)_ _l_o_a_d___t_o_r_r_e_n_t___b_u_f_f_e_r_(_)
│ │ │ │ │ +    * _t_r_u_n_c_a_t_e___f_i_l_e_s_(_)
│ │ │ │ │ +    * _m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ +    * _p_a_r_s_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ +    * _t_o_r_r_e_n_t___p_e_e_r___e_q_u_a_l_(_)
│ │ │ │ │ +    * _v_e_r_s_i_o_n_(_)
│ │ │ │ │ +    * _e_n_u_m_ _e_v_e_n_t___t
│ │ │ │ │ +    * _e_n_u_m_ _p_o_r_t_m_a_p___t_r_a_n_s_p_o_r_t
│ │ │ │ │ +    * _e_n_u_m_ _p_o_r_t_m_a_p___p_r_o_t_o_c_o_l
│ │ │ │ │ +    * _e_n_u_m_ _p_r_o_t_o_c_o_l___v_e_r_s_i_o_n
│ │ │ │ │ +    * _e_n_u_m_ _s_o_c_k_e_t___t_y_p_e___t
│ │ │ │ │ +    * _e_n_u_m_ _c_o_n_n_e_c_t_i_o_n___t_y_p_e
│ │ │ │ │ +    * _t_o_r_r_e_n_t___f_l_a_g_s___t
│ │ │ │ │ +    * _i_n_t
│ │ │ │ │ +    * _p_e_x___f_l_a_g_s___t
│ │ │ │ │ +    * _c_h_a_r_ _c_o_n_s_t_*
│ │ │ │ │ +    * _s_t_d_:_:_u_i_n_t_6_4___t
│ │ │ │ │ +    * _d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t
│ │ │ │ │      * _b_d_e_c_o_d_e___n_o_d_e
│ │ │ │ │            o _b_d_e_c_o_d_e___n_o_d_e_(_)
│ │ │ │ │ -          o _o_p_e_r_a_t_o_r_=_(_)_ _b_d_e_c_o_d_e___n_o_d_e_(_)
│ │ │ │ │ +          o _b_d_e_c_o_d_e___n_o_d_e_(_)_ _o_p_e_r_a_t_o_r_=_(_)
│ │ │ │ │            o _t_y_p_e_(_)
│ │ │ │ │            o _b_o_o_l_(_)
│ │ │ │ │            o _n_o_n___o_w_n_i_n_g_(_)
│ │ │ │ │            o _d_a_t_a___s_e_c_t_i_o_n_(_)_ _d_a_t_a___o_f_f_s_e_t_(_)
│ │ │ │ │ -          o _l_i_s_t___s_t_r_i_n_g___v_a_l_u_e___a_t_(_)_ _l_i_s_t___i_n_t___v_a_l_u_e___a_t_(_)_ _l_i_s_t___s_i_z_e_(_)_ _l_i_s_t___a_t_(_)
│ │ │ │ │ -          o _d_i_c_t___f_i_n_d___i_n_t_(_)_ _d_i_c_t___s_i_z_e_(_)_ _d_i_c_t___a_t___n_o_d_e_(_)_ _d_i_c_t___a_t_(_)
│ │ │ │ │ -            _d_i_c_t___f_i_n_d___s_t_r_i_n_g_(_)_ _d_i_c_t___f_i_n_d___s_t_r_i_n_g___v_a_l_u_e_(_)_ _d_i_c_t___f_i_n_d_(_)
│ │ │ │ │ -            _d_i_c_t___f_i_n_d___i_n_t___v_a_l_u_e_(_)_ _d_i_c_t___f_i_n_d___l_i_s_t_(_)_ _d_i_c_t___f_i_n_d___d_i_c_t_(_)
│ │ │ │ │ +          o _l_i_s_t___s_i_z_e_(_)_ _l_i_s_t___a_t_(_)_ _l_i_s_t___s_t_r_i_n_g___v_a_l_u_e___a_t_(_)_ _l_i_s_t___i_n_t___v_a_l_u_e___a_t_(_)
│ │ │ │ │ +          o _d_i_c_t___a_t___n_o_d_e_(_)_ _d_i_c_t___f_i_n_d___i_n_t_(_)_ _d_i_c_t___f_i_n_d___i_n_t___v_a_l_u_e_(_)_ _d_i_c_t___f_i_n_d___l_i_s_t
│ │ │ │ │ +            _(_)_ _d_i_c_t___f_i_n_d_(_)_ _d_i_c_t___a_t_(_)_ _d_i_c_t___s_i_z_e_(_)_ _d_i_c_t___f_i_n_d___s_t_r_i_n_g_(_)
│ │ │ │ │ +            _d_i_c_t___f_i_n_d___s_t_r_i_n_g___v_a_l_u_e_(_)_ _d_i_c_t___f_i_n_d___d_i_c_t_(_)
│ │ │ │ │            o _i_n_t___v_a_l_u_e_(_)
│ │ │ │ │ -          o _s_t_r_i_n_g___v_a_l_u_e_(_)_ _s_t_r_i_n_g___o_f_f_s_e_t_(_)_ _s_t_r_i_n_g___l_e_n_g_t_h_(_)_ _s_t_r_i_n_g___p_t_r_(_)
│ │ │ │ │ +          o _s_t_r_i_n_g___o_f_f_s_e_t_(_)_ _s_t_r_i_n_g___p_t_r_(_)_ _s_t_r_i_n_g___v_a_l_u_e_(_)_ _s_t_r_i_n_g___l_e_n_g_t_h_(_)
│ │ │ │ │            o _c_l_e_a_r_(_)
│ │ │ │ │            o _s_w_a_p_(_)
│ │ │ │ │            o _r_e_s_e_r_v_e_(_)
│ │ │ │ │            o _s_w_i_t_c_h___u_n_d_e_r_l_y_i_n_g___b_u_f_f_e_r_(_)
│ │ │ │ │            o _h_a_s___s_o_f_t___e_r_r_o_r_(_)
│ │ │ │ │            o _e_n_u_m_ _t_y_p_e___t
│ │ │ │ │      * _p_r_i_n_t___e_n_t_r_y_(_)
│ │ │ │ │      * _b_d_e_c_o_d_e_(_)
│ │ │ │ │ +    * _t_o_r_r_e_n_t___s_t_a_t_u_s
│ │ │ │ │ +          o _o_p_e_r_a_t_o_r_=_=_(_)
│ │ │ │ │ +          o _e_n_u_m_ _s_t_a_t_e___t
│ │ │ │ │      * _e_n_t_r_y
│ │ │ │ │            o _t_y_p_e_(_)
│ │ │ │ │            o _e_n_t_r_y_(_)
│ │ │ │ │            o _e_n_t_r_y_(_)
│ │ │ │ │            o _e_n_t_r_y_(_)
│ │ │ │ │            o _o_p_e_r_a_t_o_r_=_(_)
│ │ │ │ │ -          o _p_r_e_f_o_r_m_a_t_t_e_d_(_)_ _d_i_c_t_(_)_ _l_i_s_t_(_)_ _s_t_r_i_n_g_(_)_ _i_n_t_e_g_e_r_(_)
│ │ │ │ │ +          o _s_t_r_i_n_g_(_)_ _p_r_e_f_o_r_m_a_t_t_e_d_(_)_ _l_i_s_t_(_)_ _i_n_t_e_g_e_r_(_)_ _d_i_c_t_(_)
│ │ │ │ │            o _s_w_a_p_(_)
│ │ │ │ │            o _o_p_e_r_a_t_o_r_[_]_(_)
│ │ │ │ │            o _f_i_n_d___k_e_y_(_)
│ │ │ │ │            o _t_o___s_t_r_i_n_g_(_)
│ │ │ │ │            o _e_n_u_m_ _d_a_t_a___t_y_p_e
│ │ │ │ │      * _b_e_n_c_o_d_e_(_)
│ │ │ │ │      * _o_p_e_r_a_t_o_r_<_<_(_)
│ │ │ │ │ -    * _c_r_e_a_t_e___t_o_r_r_e_n_t
│ │ │ │ │ -          o _c_r_e_a_t_e___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -          o _g_e_n_e_r_a_t_e_(_)_ _g_e_n_e_r_a_t_e___b_u_f_(_)
│ │ │ │ │ -          o _f_i_l_e_s_(_)
│ │ │ │ │ -          o _s_e_t___c_o_m_m_e_n_t_(_)
│ │ │ │ │ -          o _s_e_t___c_r_e_a_t_o_r_(_)
│ │ │ │ │ -          o _s_e_t___c_r_e_a_t_i_o_n___d_a_t_e_(_)
│ │ │ │ │ -          o _s_e_t___h_a_s_h_(_)
│ │ │ │ │ -          o _s_e_t___h_a_s_h_2_(_)
│ │ │ │ │ -          o _a_d_d___h_t_t_p___s_e_e_d_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)
│ │ │ │ │ -          o _a_d_d___n_o_d_e_(_)
│ │ │ │ │ -          o _a_d_d___t_r_a_c_k_e_r_(_)
│ │ │ │ │ -          o _s_e_t___r_o_o_t___c_e_r_t_(_)
│ │ │ │ │ -          o _s_e_t___p_r_i_v_(_)_ _p_r_i_v_(_)
│ │ │ │ │ -          o _n_u_m___p_i_e_c_e_s_(_)
│ │ │ │ │ -          o _p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │ -          o _f_i_l_e___r_a_n_g_e_(_)
│ │ │ │ │ -          o _f_i_l_e___p_i_e_c_e___r_a_n_g_e_(_)
│ │ │ │ │ -          o _t_o_t_a_l___s_i_z_e_(_)
│ │ │ │ │ -          o _p_i_e_c_e___l_e_n_g_t_h_(_)_ _p_i_e_c_e___s_i_z_e_(_)
│ │ │ │ │ -          o _a_d_d___s_i_m_i_l_a_r___t_o_r_r_e_n_t_(_)_ _a_d_d___c_o_l_l_e_c_t_i_o_n_(_)
│ │ │ │ │ -    * _a_d_d___f_i_l_e_s_(_)
│ │ │ │ │ -    * _s_e_t___p_i_e_c_e___h_a_s_h_e_s_(_)
│ │ │ │ │ +    * _s_t_o_r_a_g_e___e_r_r_o_r
│ │ │ │ │ +          o _b_o_o_l_(_)
│ │ │ │ │ +          o _f_i_l_e_(_)
│ │ │ │ │ +    * _g_z_i_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _u_p_n_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _b_d_e_c_o_d_e___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _p_c_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _i_2_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _l_i_b_t_o_r_r_e_n_t___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _h_t_t_p___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _s_o_c_k_s___c_a_t_e_g_o_r_y_(_)
│ │ │ │ │ +    * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +    * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +    * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +    * _e_n_u_m_ _p_c_p___e_r_r_o_r_s
│ │ │ │ │ +    * _e_n_u_m_ _i_2_p___e_r_r_o_r___c_o_d_e
│ │ │ │ │ +    * _e_n_u_m_ _e_r_r_o_r___c_o_d_e___e_n_u_m
│ │ │ │ │ +    * _e_n_u_m_ _h_t_t_p___e_r_r_o_r_s
│ │ │ │ │ +    * _e_n_u_m_ _s_o_c_k_s___e_r_r_o_r___c_o_d_e
│ │ │ │ │ +    * _d_h_t___s_t_a_t_e
│ │ │ │ │      * _d_h_t___s_t_o_r_a_g_e___c_o_u_n_t_e_r_s
│ │ │ │ │            o _r_e_s_e_t_(_)
│ │ │ │ │      * _d_h_t___s_t_o_r_a_g_e___i_n_t_e_r_f_a_c_e
│ │ │ │ │            o _u_p_d_a_t_e___n_o_d_e___i_d_s_(_)
│ │ │ │ │            o _g_e_t___p_e_e_r_s_(_)
│ │ │ │ │            o _a_n_n_o_u_n_c_e___p_e_e_r_(_)
│ │ │ │ │            o _g_e_t___i_m_m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │            o _p_u_t___i_m_m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │            o _g_e_t___m_u_t_a_b_l_e___i_t_e_m___s_e_q_(_)
│ │ │ │ │            o _g_e_t___m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │            o _p_u_t___m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │            o _g_e_t___i_n_f_o_h_a_s_h_e_s___s_a_m_p_l_e_(_)
│ │ │ │ │            o _t_i_c_k_(_)
│ │ │ │ │            o _c_o_u_n_t_e_r_s_(_)
│ │ │ │ │ -    * _d_h_t___s_t_a_t_e
│ │ │ │ │      * _d_h_t___d_e_f_a_u_l_t___s_t_o_r_a_g_e___c_o_n_s_t_r_u_c_t_o_r_(_)
│ │ │ │ │      * _s_i_g_n___m_u_t_a_b_l_e___i_t_e_m_(_)
│ │ │ │ │      * _a_n_n_o_u_n_c_e___f_l_a_g_s___t
│ │ │ │ │      * _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ -    * _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a___b_u_f_(_)_ _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ +    * _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_)_ _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a___b_u_f_(_)
│ │ │ │ │      * _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e___b_u_f_(_)_ _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │      * _w_r_i_t_e___t_o_r_r_e_n_t___f_l_a_g_s___t
│ │ │ │ │      * _e_d_2_5_5_1_9___c_r_e_a_t_e___s_e_e_d_(_)
│ │ │ │ │      * _e_d_2_5_5_1_9___c_r_e_a_t_e___k_e_y_p_a_i_r_(_)
│ │ │ │ │      * _e_d_2_5_5_1_9___s_i_g_n_(_)
│ │ │ │ │      * _e_d_2_5_5_1_9___v_e_r_i_f_y_(_)
│ │ │ │ │      * _e_d_2_5_5_1_9___a_d_d___s_c_a_l_a_r_(_)
│ │ │ │ │      * _e_d_2_5_5_1_9___k_e_y___e_x_c_h_a_n_g_e_(_)
│ │ │ │ │ +libtorrent has a _p_l_u_g_i_n interface for implementing extensions to the protocol.
│ │ │ │ │ +These can be general extensions for transferring metadata or peer exchange
│ │ │ │ │ +extensions, or it could be used to provide a way to customize the protocol to
│ │ │ │ │ +fit a particular (closed) network.
│ │ │ │ │ +In short, the _p_l_u_g_i_n interface makes it possible to:
│ │ │ │ │ +    * register extension messages (sent in the extension handshake), see
│ │ │ │ │ +      _e_x_t_e_n_s_i_o_n_s.
│ │ │ │ │ +    * add data and parse data from the extension handshake.
│ │ │ │ │ +    * send extension messages and standard bittorrent messages.
│ │ │ │ │ +    * override or block the handling of standard bittorrent messages.
│ │ │ │ │ +    * save and restore state via the _s_e_s_s_i_o_n state
│ │ │ │ │ +    * see all alerts that are posted
│ │ │ │ │ +************ aa wwoorrdd ooff ccaauuttiioonn ************
│ │ │ │ │ +Writing your own _p_l_u_g_i_n is a very easy way to introduce serious bugs such as
│ │ │ │ │ +dead locks and race conditions. Since a _p_l_u_g_i_n has access to internal
│ │ │ │ │ +structures it is also quite easy to sabotage libtorrent's operation.
│ │ │ │ │ +All the callbacks are always called from the libtorrent network thread. In case
│ │ │ │ │ +portions of your _p_l_u_g_i_n are called from other threads, typically the main
│ │ │ │ │ +thread, you cannot use any of the member functions on the internal structures
│ │ │ │ │ +in libtorrent, since those require being called from the libtorrent network
│ │ │ │ │ +thread . Furthermore, you also need to synchronize your own shared data within
│ │ │ │ │ +the _p_l_u_g_i_n, to make sure it is not accessed at the same time from the
│ │ │ │ │ +libtorrent thread (through a callback). If you need to send out a message from
│ │ │ │ │ +another thread, it is advised to use an internal queue, and do the actual
│ │ │ │ │ +sending in tick().
│ │ │ │ │ +Since the _p_l_u_g_i_n interface gives you easy access to internal structures, it is
│ │ │ │ │ +not supported as a stable API. Plugins should be considered specific to a
│ │ │ │ │ +specific version of libtorrent. Although, in practice the internals mostly
│ │ │ │ │ +don't change that dramatically.
│ │ │ │ │ +************ pplluuggiinn--iinntteerrffaaccee ************
│ │ │ │ │ +The _p_l_u_g_i_n interface consists of three base classes that the _p_l_u_g_i_n may
│ │ │ │ │ +implement. These are called _p_l_u_g_i_n, _t_o_r_r_e_n_t___p_l_u_g_i_n and _p_e_e_r___p_l_u_g_i_n. They are
│ │ │ │ │ +found in the <libtorrent/extensions.hpp> header.
│ │ │ │ │ +These plugins are instantiated for each _s_e_s_s_i_o_n, torrent and possibly each
│ │ │ │ │ +peer, respectively.
│ │ │ │ │ +For plugins that only need per torrent state, it is enough to only implement
│ │ │ │ │ +torrent_plugin and pass a constructor function or function object to session::
│ │ │ │ │ +add_extension() or torrent_handle::add_extension() (if the torrent has already
│ │ │ │ │ +been started and you want to hook in the extension at run-time).
│ │ │ │ │ +The signature of the function is:
│ │ │ │ │ +std::shared_ptr<torrent_plugin> (*)(torrent_handle const&, client_data_t);
│ │ │ │ │ +The second argument is the userdata passed to session::add_torrent() or
│ │ │ │ │ +torrent_handle::add_extension().
│ │ │ │ │ +The function should return a std::shared_ptr<torrent_plugin> which may or may
│ │ │ │ │ +not be 0. If it is a nullptr, the extension is simply ignored for this torrent.
│ │ │ │ │ +If it is a valid pointer (to a class inheriting torrent_plugin), it will be
│ │ │ │ │ +associated with this torrent and callbacks will be made on torrent events.
│ │ │ │ │ +For more elaborate plugins which require _s_e_s_s_i_o_n wide state, you would
│ │ │ │ │ +implement plugin, construct an object (in a std::shared_ptr) and pass it in to
│ │ │ │ │ +session::add_extension().
│ │ │ │ │ +************ ccuussttoomm aalleerrttss ************
│ │ │ │ │ +Since plugins are running within internal libtorrent threads, one convenient
│ │ │ │ │ +way to communicate with the client is to post custom alerts.
│ │ │ │ │ +The expected interface of any _a_l_e_r_t, apart from deriving from the _a_l_e_r_t base
│ │ │ │ │ +class, looks like this:
│ │ │ │ │ +static const int alert_type = <<uunniiqquuee aalleerrtt IIDD>>;
│ │ │ │ │ +virtual int type() const { return alert_type; }
│ │ │ │ │ +
│ │ │ │ │ +virtual std::string message() const;
│ │ │ │ │ +
│ │ │ │ │ +static const alert_category_t static_category = <<bbiittmmaasskk ooff aalleerrtt::::ccaatteeggoorryy__tt
│ │ │ │ │ +ffllaaggss>>;
│ │ │ │ │ +virtual alert_category_t category() const { return static_category; }
│ │ │ │ │ +
│ │ │ │ │ +virtual char const* what() const { return <<ssttrriinngg lliitteerraall ooff tthhee nnaammee ooff tthhiiss
│ │ │ │ │ +aalleerrtt>>; }
│ │ │ │ │ +The alert_type is used for the type-checking in alert_cast. It must not collide
│ │ │ │ │ +with any other _a_l_e_r_t. The built-in alerts in libtorrent will not use _a_l_e_r_t type
│ │ │ │ │ +IDs greater than user_alert_id. When defining your own _a_l_e_r_t, make sure it's
│ │ │ │ │ +greater than this constant.
│ │ │ │ │ +type() is the run-time equivalence of the alert_type.
│ │ │ │ │ +The message() virtual function is expected to construct a useful string
│ │ │ │ │ +representation of the _a_l_e_r_t and the event or data it represents. Something
│ │ │ │ │ +convenient to put in a log file for instance.
│ │ │ │ │ +clone() is used internally to copy alerts. The suggested implementation of
│ │ │ │ │ +simply allocating a new instance as a copy of *this is all that's expected.
│ │ │ │ │ +The static category is required for checking whether or not the category for a
│ │ │ │ │ +specific _a_l_e_r_t is enabled or not, without instantiating the _a_l_e_r_t. The category
│ │ │ │ │ +virtual function is the run-time equivalence.
│ │ │ │ │ +The what() virtual function may simply be a string literal of the class name of
│ │ │ │ │ +your _a_l_e_r_t.
│ │ │ │ │ +For more information, see the _a_l_e_r_t_ _s_e_c_t_i_o_n.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppiieeccee__bblloocckk ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_i_e_c_e___b_l_o_c_k_._h_p_p"
│ │ │ │ │ -struct piece_block
│ │ │ │ │ +************ ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e_._h_p_p"
│ │ │ │ │ +the _p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e class provides a handle to the internal peer
│ │ │ │ │ +connection object, to be used by plugins. This is a low level interface that
│ │ │ │ │ +may not be stable across libtorrent versions
│ │ │ │ │ +struct peer_connection_handle
│ │ │ │ │  {
│ │ │ │ │ -   ppiieeccee__bblloocckk () = default;
│ │ │ │ │ -   ppiieeccee__bblloocckk (piece_index_t p_index, int b_index);
│ │ │ │ │ -   bool ooppeerraattoorr<< (piece_block const& b) const;
│ │ │ │ │ -   bool ooppeerraattoorr==== (piece_block const& b) const;
│ │ │ │ │ -   bool ooppeerraattoorr!!== (piece_block const& b) const;
│ │ │ │ │ -
│ │ │ │ │ -   static const piece_block invalid;
│ │ │ │ │ -   piece_index_t piece_index {0};
│ │ │ │ │ -   int bblloocckk__iinnddeexx  = 0;
│ │ │ │ │ +   explicit ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee (std::weak_ptr<peer_connection> impl);
│ │ │ │ │ +   connection_type ttyyppee () const;
│ │ │ │ │ +   void aadddd__eexxtteennssiioonn (std::shared_ptr<peer_plugin>);
│ │ │ │ │ +   peer_plugin const* ffiinndd__pplluuggiinn (string_view type) const;
│ │ │ │ │ +   bool iiss__sseeeedd () const;
│ │ │ │ │ +   bool uuppllooaadd__oonnllyy () const;
│ │ │ │ │ +   bool hhaass__ppiieeccee (piece_index_t i) const;
│ │ │ │ │ +   peer_id const& ppiidd () const;
│ │ │ │ │ +   bool iiss__cchhookkeedd () const;
│ │ │ │ │ +   bool iiss__iinntteerreessttiinngg () const;
│ │ │ │ │ +   bool iiss__ppeeeerr__iinntteerreesstteedd () const;
│ │ │ │ │ +   bool hhaass__ppeeeerr__cchhookkeedd () const;
│ │ │ │ │ +   void mmaayybbee__uunncchhookkee__tthhiiss__ppeeeerr ();
│ │ │ │ │ +   void cchhookkee__tthhiiss__ppeeeerr ();
│ │ │ │ │ +   void ggeett__ppeeeerr__iinnffoo (peer_info& p) const;
│ │ │ │ │ +   torrent_handle aassssoocciiaatteedd__ttoorrrreenntt () const;
│ │ │ │ │ +   _t_c_p_:_:_e_n_d_p_o_i_n_t llooccaall__eennddppooiinntt () const;
│ │ │ │ │ +   _t_c_p_:_:_e_n_d_p_o_i_n_t const& rreemmoottee () const;
│ │ │ │ │ +   bool iiss__oouuttggooiinngg () const;
│ │ │ │ │ +   void ddiissccoonnnneecctt (error_code const& ec, operation_t op
│ │ │ │ │ +      , disconnect_severity_t = peer_connection_interface::normal);
│ │ │ │ │ +   bool iiss__ccoonnnneeccttiinngg () const;
│ │ │ │ │ +   bool iiss__ddiissccoonnnneeccttiinngg () const;
│ │ │ │ │ +   bool iiggnnoorree__uunncchhookkee__sslloottss () const;
│ │ │ │ │ +   bool oonn__llooccaall__nneettwwoorrkk () const;
│ │ │ │ │ +   bool ffaaiilleedd () const;
│ │ │ │ │ +   bool sshhoouulldd__lloogg (peer_log_alert::direction_t direction) const;
│ │ │ │ │ +   void ppeeeerr__lloogg (peer_log_alert::direction_t direction
│ │ │ │ │ +      , char const* event, char const* fmt = "", ...) const TORRENT_FORMAT
│ │ │ │ │ +(4,5);
│ │ │ │ │ +   bool ccaann__ddiissccoonnnneecctt (error_code const& ec) const;
│ │ │ │ │ +   bool hhaass__mmeettaaddaattaa () const;
│ │ │ │ │ +   bool iinn__hhaannddsshhaakkee () const;
│ │ │ │ │ +   void sseenndd__bbuuffffeerr (char const* begin, int size);
│ │ │ │ │ +   std::time_t llaasstt__sseeeenn__ccoommpplleettee () const;
│ │ │ │ │ +   time_point ttiimmee__ooff__llaasstt__uunncchhookkee () const;
│ │ │ │ │ +   bool ooppeerraattoorr<< (peer_connection_handle const& o) const;
│ │ │ │ │ +   bool ooppeerraattoorr==== (peer_connection_handle const& o) const;
│ │ │ │ │ +   bool ooppeerraattoorr!!== (peer_connection_handle const& o) const;
│ │ │ │ │ +   std::shared_ptr<peer_connection> nnaattiivvee__hhaannddllee () const;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ iinnffoo__hhaasshh__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_n_f_o___h_a_s_h_._h_p_p"
│ │ │ │ │ -class holding the info-hash of a torrent. It can hold a v1 info-hash (SHA-1) or
│ │ │ │ │ -a v2 info-hash (SHA-256) or both.
│ │ │ │ │ -Note
│ │ │ │ │ -If has_v2() is false then the v1 hash might actually be a truncated v2 hash
│ │ │ │ │ -struct info_hash_t
│ │ │ │ │ +************ bbtt__ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e_._h_p_p"
│ │ │ │ │ +The _b_t___p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e provides a handle to the internal bittorrent peer
│ │ │ │ │ +connection object to plugins. It's low level and may not be a stable API across
│ │ │ │ │ +libtorrent versions.
│ │ │ │ │ +struct bt_peer_connection_handle : peer_connection_handle
│ │ │ │ │  {
│ │ │ │ │ -   iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ │ -   iinnffoo__hhaasshh__tt () noexcept = default;
│ │ │ │ │ -   explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept;
│ │ │ │ │ -   explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept;
│ │ │ │ │ -   bool hhaass__vv22 () const;
│ │ │ │ │ -   bool hhaass (protocol_version v) const;
│ │ │ │ │ -   bool hhaass__vv11 () const;
│ │ │ │ │ -   sha1_hash ggeett (protocol_version v) const;
│ │ │ │ │ -   sha1_hash ggeett__bbeesstt () const;
│ │ │ │ │ -   friend bool ooppeerraattoorr!!== (info_hash_t const& lhs, info_hash_t const& rhs);
│ │ │ │ │ -   friend bool ooppeerraattoorr==== (info_hash_t const& lhs, info_hash_t const& rhs)
│ │ │ │ │ -noexcept;
│ │ │ │ │ -   template <typename F> void ffoorr__eeaacchh (F f) const;
│ │ │ │ │ -   bool ooppeerraattoorr<< (info_hash_t const& o) const;
│ │ │ │ │ -   friend std::ostream& ooppeerraattoorr<<<< (std::ostream& os, info_hash_t const& ih);
│ │ │ │ │ +   explicit bbtt__ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee (peer_connection_handle pc);
│ │ │ │ │ +   bool ppaacckkeett__ffiinniisshheedd () const;
│ │ │ │ │ +   bool ssuuppppoorrtt__eexxtteennssiioonnss () const;
│ │ │ │ │ +   bool ssuuppppoorrttss__eennccrryyppttiioonn () const;
│ │ │ │ │ +   void sswwiittcchh__rreeccvv__ccrryyppttoo (std::shared_ptr<crypto_plugin> crypto);
│ │ │ │ │ +   void sswwiittcchh__sseenndd__ccrryyppttoo (std::shared_ptr<crypto_plugin> crypto);
│ │ │ │ │ +   std::shared_ptr<bt_peer_connection> nnaattiivvee__hhaannddllee () const;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ pplluuggiinn ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p"
│ │ │ │ │ +this is the base class for a _s_e_s_s_i_o_n _p_l_u_g_i_n. One primary feature is that it is
│ │ │ │ │ +notified of all torrents that are added to the _s_e_s_s_i_o_n, and can add its own
│ │ │ │ │ +torrent_plugins.
│ │ │ │ │ +struct plugin
│ │ │ │ │ +{
│ │ │ │ │ +   virtual feature_flags_t iimmpplleemmeenntteedd__ffeeaattuurreess ();
│ │ │ │ │ +   virtual std::shared_ptr<torrent_plugin> nneeww__ttoorrrreenntt (torrent_handle const&,
│ │ │ │ │ +client_data_t);
│ │ │ │ │ +   virtual void aaddddeedd (session_handle const&);
│ │ │ │ │ +   virtual void aabboorrtt ();
│ │ │ │ │ +   virtual bool oonn__ddhhtt__rreeqquueesstt (string_view //** qquueerryy **//
│ │ │ │ │ +      , udp::endpoint const& //** ssoouurrccee **//, bdecode_node const& //** mmeessssaaggee **//
│ │ │ │ │ +      , entry& //** rreessppoonnssee **//);
│ │ │ │ │ +   virtual void oonn__aalleerrtt (alert const*);
│ │ │ │ │ +   virtual bool oonn__uunnkknnoowwnn__ttoorrrreenntt (info_hash_t const& //** iinnffoo__hhaasshh **//
│ │ │ │ │ +      , peer_connection_handle const& //** ppcc **//, add_torrent_params& //** pp **//);
│ │ │ │ │ +   virtual void oonn__ttiicckk ();
│ │ │ │ │ +   virtual uint64_t ggeett__uunncchhookkee__pprriioorriittyy (peer_connection_handle const& //** ppeeeerr
│ │ │ │ │ +**//);
│ │ │ │ │ +   virtual std::map<std::string, std::string> ssaavvee__ssttaattee () const;
│ │ │ │ │ +   virtual void llooaadd__ssttaattee (std::map<std::string, std::string> const&);
│ │ │ │ │  
│ │ │ │ │ -   sha1_hash v1;
│ │ │ │ │ -   sha256_hash v2;
│ │ │ │ │ +   static constexpr feature_flags_t ooppttiimmiissttiicc__uunncchhookkee__ffeeaattuurree  = 1_bit;
│ │ │ │ │ +   static constexpr feature_flags_t ttiicckk__ffeeaattuurree  = 2_bit;
│ │ │ │ │ +   static constexpr feature_flags_t ddhhtt__rreeqquueesstt__ffeeaattuurree  = 3_bit;
│ │ │ │ │ +   static constexpr feature_flags_t aalleerrtt__ffeeaattuurree  = 4_bit;
│ │ │ │ │ +   static constexpr feature_flags_t uunnkknnoowwnn__ttoorrrreenntt__ffeeaattuurree  = 5_bit;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iinnffoo__hhaasshh__tt(()) **********
│ │ │ │ │ -iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ │ -iinnffoo__hhaasshh__tt () noexcept = default;
│ │ │ │ │ -explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept;
│ │ │ │ │ -explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept;
│ │ │ │ │ -The default constructor creates an object that has neither a v1 or v2 hash.
│ │ │ │ │ -For backwards compatibility, make it possible to construct directly from a v1
│ │ │ │ │ -hash. This constructor allows iimmpplliicciitt conversion from a v1 hash, but the
│ │ │ │ │ -implicitness is deprecated.
│ │ │ │ │ +********** iimmpplleemmeenntteedd__ffeeaattuurreess(()) **********
│ │ │ │ │ +virtual feature_flags_t iimmpplleemmeenntteedd__ffeeaattuurreess ();
│ │ │ │ │ +This function is expected to return a bitmask indicating which features this
│ │ │ │ │ +_p_l_u_g_i_n implements. Some callbacks on this object may not be called unless the
│ │ │ │ │ +corresponding feature flag is returned here. Note that callbacks may still be
│ │ │ │ │ +called even if the corresponding feature is not specified in the return value
│ │ │ │ │ +here. See feature_flags_t for possible flags to return.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** hhaass__vv11(()) hhaass__vv22(()) hhaass(()) **********
│ │ │ │ │ -bool hhaass__vv22 () const;
│ │ │ │ │ -bool hhaass (protocol_version v) const;
│ │ │ │ │ -bool hhaass__vv11 () const;
│ │ │ │ │ -returns true if the corresponding info hash is present in this object.
│ │ │ │ │ +********** nneeww__ttoorrrreenntt(()) **********
│ │ │ │ │ +virtual std::shared_ptr<torrent_plugin> nneeww__ttoorrrreenntt (torrent_handle const&,
│ │ │ │ │ +client_data_t);
│ │ │ │ │ +this is called by the _s_e_s_s_i_o_n every time a new torrent is added. The torrent*
│ │ │ │ │ +points to the internal torrent object created for the new torrent. The
│ │ │ │ │ +_c_l_i_e_n_t___d_a_t_a___t is the userdata pointer as passed in via _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s.
│ │ │ │ │ +If the _p_l_u_g_i_n returns a _t_o_r_r_e_n_t___p_l_u_g_i_n instance, it will be added to the new
│ │ │ │ │ +torrent. Otherwise, return an empty shared_ptr to a _t_o_r_r_e_n_t___p_l_u_g_i_n (the
│ │ │ │ │ +default).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett(()) **********
│ │ │ │ │ -sha1_hash ggeett (protocol_version v) const;
│ │ │ │ │ -returns the has for the specified protocol version
│ │ │ │ │ +********** aaddddeedd(()) **********
│ │ │ │ │ +virtual void aaddddeedd (session_handle const&);
│ │ │ │ │ +called when _p_l_u_g_i_n is added to a _s_e_s_s_i_o_n
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett__bbeesstt(()) **********
│ │ │ │ │ -sha1_hash ggeett__bbeesstt () const;
│ │ │ │ │ -returns the v2 (truncated) info-hash, if there is one, otherwise returns the v1
│ │ │ │ │ -info-hash
│ │ │ │ │ +********** aabboorrtt(()) **********
│ │ │ │ │ +virtual void aabboorrtt ();
│ │ │ │ │ +called when the _s_e_s_s_i_o_n is aborted the _p_l_u_g_i_n should perform any cleanup
│ │ │ │ │ +necessary to allow the session's destruction (e.g. cancel outstanding async
│ │ │ │ │ +operations)
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffoorr__eeaacchh(()) **********
│ │ │ │ │ -template <typename F> void ffoorr__eeaacchh (F f) const;
│ │ │ │ │ -calls the function object f for each hash that is available. starting with v1.
│ │ │ │ │ -The signature of F is:
│ │ │ │ │ -void(sha1_hash const&, protocol_version);
│ │ │ │ │ +********** oonn__ddhhtt__rreeqquueesstt(()) **********
│ │ │ │ │ +virtual bool oonn__ddhhtt__rreeqquueesstt (string_view //** qquueerryy **//
│ │ │ │ │ +      , udp::endpoint const& //** ssoouurrccee **//, bdecode_node const& //** mmeessssaaggee **//
│ │ │ │ │ +      , entry& //** rreessppoonnssee **//);
│ │ │ │ │ +called when a dht request is received. If your _p_l_u_g_i_n expects this to be
│ │ │ │ │ +called, make sure to include the flag dht_request_feature in the return value
│ │ │ │ │ +from _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppeeeerr__iinnffoo ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___i_n_f_o_._h_p_p"
│ │ │ │ │ -holds information and statistics about one peer that libtorrent is connected to
│ │ │ │ │ -struct peer_info
│ │ │ │ │ +********** oonn__aalleerrtt(()) **********
│ │ │ │ │ +virtual void oonn__aalleerrtt (alert const*);
│ │ │ │ │ +called when an _a_l_e_r_t is posted alerts that are filtered are not posted. If your
│ │ │ │ │ +_p_l_u_g_i_n expects this to be called, make sure to include the flag alert_feature
│ │ │ │ │ +in the return value from _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** oonn__uunnkknnoowwnn__ttoorrrreenntt(()) **********
│ │ │ │ │ +virtual bool oonn__uunnkknnoowwnn__ttoorrrreenntt (info_hash_t const& //** iinnffoo__hhaasshh **//
│ │ │ │ │ +      , peer_connection_handle const& //** ppcc **//, add_torrent_params& //** pp **//);
│ │ │ │ │ +return true if the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s should be added
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** oonn__ttiicckk(()) **********
│ │ │ │ │ +virtual void oonn__ttiicckk ();
│ │ │ │ │ +called once per second. If your _p_l_u_g_i_n expects this to be called, make sure to
│ │ │ │ │ +include the flag tick_feature in the return value from _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ggeett__uunncchhookkee__pprriioorriittyy(()) **********
│ │ │ │ │ +virtual uint64_t ggeett__uunncchhookkee__pprriioorriittyy (peer_connection_handle const& //** ppeeeerr **//
│ │ │ │ │ +);
│ │ │ │ │ +called when choosing peers to optimistically unchoke. The return value
│ │ │ │ │ +indicates the peer's priority for unchoking. Lower return values correspond to
│ │ │ │ │ +higher priority. Priorities above 2^63-1 are reserved. If your _p_l_u_g_i_n has no
│ │ │ │ │ +priority to assign a peer it should return 2^64-1. If your _p_l_u_g_i_n expects this
│ │ │ │ │ +to be called, make sure to include the flag optimistic_unchoke_feature in the
│ │ │ │ │ +return value from _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_). If multiple plugins implement this
│ │ │ │ │ +function the lowest return value (i.e. the highest priority) is used.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** llooaadd__ssttaattee(()) **********
│ │ │ │ │ +virtual void llooaadd__ssttaattee (std::map<std::string, std::string> const&);
│ │ │ │ │ +called on startup while loading settings state from the _s_e_s_s_i_o_n___p_a_r_a_m_s
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  optimistic_unchoke_feature
│ │ │ │ │ +      include this bit if your _p_l_u_g_i_n needs to alter the order of the
│ │ │ │ │ +      optimistic unchoke of peers. i.e. have the on_optimistic_unchoke()
│ │ │ │ │ +      callback be called.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  tick_feature
│ │ │ │ │ +      include this bit if your _p_l_u_g_i_n needs to have _o_n___t_i_c_k_(_) called
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  dht_request_feature
│ │ │ │ │ +      include this bit if your _p_l_u_g_i_n needs to have _o_n___d_h_t___r_e_q_u_e_s_t_(_) called
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  alert_feature
│ │ │ │ │ +      include this bit if your _p_l_u_g_i_n needs to have _o_n___a_l_e_r_t_(_) called
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  unknown_torrent_feature
│ │ │ │ │ +      include this bit if your _p_l_u_g_i_n needs to have _o_n___u_n_k_n_o_w_n___t_o_r_r_e_n_t_(_) called
│ │ │ │ │ +      even if there is no active torrent in the _s_e_s_s_i_o_n
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ttoorrrreenntt__pplluuggiinn ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p"
│ │ │ │ │ +Torrent plugins are associated with a single torrent and have a number of
│ │ │ │ │ +functions called at certain events. Many of its functions have the ability to
│ │ │ │ │ +change or override the default libtorrent behavior.
│ │ │ │ │ +struct torrent_plugin
│ │ │ │ │  {
│ │ │ │ │ -   sha256_hash ii22pp__ddeessttiinnaattiioonn () const;
│ │ │ │ │ +   virtual std::shared_ptr<peer_plugin> nneeww__ccoonnnneeccttiioonn (peer_connection_handle
│ │ │ │ │ +const&);
│ │ │ │ │ +   virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │ +   virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ +   virtual void ttiicckk ();
│ │ │ │ │ +   virtual bool oonn__rreessuummee ();
│ │ │ │ │ +   virtual bool oonn__ppaauussee ();
│ │ │ │ │ +   virtual void oonn__ffiilleess__cchheecckkeedd ();
│ │ │ │ │ +   virtual void oonn__ssttaattee (torrent_status::state_t);
│ │ │ │ │ +   virtual void oonn__aadddd__ppeeeerr (tcp::endpoint const&,
│ │ │ │ │ +      peer_source_flags_t, add_peer_flags_t);
│ │ │ │ │  
│ │ │ │ │ -   std::string client;
│ │ │ │ │ -   typed_bitfield<piece_index_t> pieces;
│ │ │ │ │ -   std::int64_t total_download;
│ │ │ │ │ -   std::int64_t total_upload;
│ │ │ │ │ -   time_duration last_request;
│ │ │ │ │ -   time_duration last_active;
│ │ │ │ │ -   time_duration download_queue_time;
│ │ │ │ │ -   static constexpr peer_flags_t iinntteerreessttiinngg  = 0_bit;
│ │ │ │ │ -   static constexpr peer_flags_t cchhookkeedd  = 1_bit;
│ │ │ │ │ -   static constexpr peer_flags_t rreemmoottee__iinntteerreesstteedd  = 2_bit;
│ │ │ │ │ -   static constexpr peer_flags_t rreemmoottee__cchhookkeedd  = 3_bit;
│ │ │ │ │ -   static constexpr peer_flags_t ssuuppppoorrttss__eexxtteennssiioonnss  = 4_bit;
│ │ │ │ │ -   static constexpr peer_flags_t oouuttggooiinngg__ccoonnnneeccttiioonn  = 5_bit;
│ │ │ │ │ -   static constexpr peer_flags_t llooccaall__ccoonnnneeccttiioonn  = 5_bit;
│ │ │ │ │ -   static constexpr peer_flags_t hhaannddsshhaakkee  = 6_bit;
│ │ │ │ │ -   static constexpr peer_flags_t ccoonnnneeccttiinngg  = 7_bit;
│ │ │ │ │ -   static constexpr peer_flags_t oonn__ppaarroollee  = 9_bit;
│ │ │ │ │ -   static constexpr peer_flags_t sseeeedd  = 10_bit;
│ │ │ │ │ -   static constexpr peer_flags_t ooppttiimmiissttiicc__uunncchhookkee  = 11_bit;
│ │ │ │ │ -   static constexpr peer_flags_t ssnnuubbbbeedd  = 12_bit;
│ │ │ │ │ -   static constexpr peer_flags_t uuppllooaadd__oonnllyy  = 13_bit;
│ │ │ │ │ -   static constexpr peer_flags_t eennddggaammee__mmooddee  = 14_bit;
│ │ │ │ │ -   static constexpr peer_flags_t hhoolleeppuunncchheedd  = 15_bit;
│ │ │ │ │ -   static constexpr peer_flags_t ii22pp__ssoocckkeett  = 16_bit;
│ │ │ │ │ -   static constexpr peer_flags_t uuttpp__ssoocckkeett  = 17_bit;
│ │ │ │ │ -   static constexpr peer_flags_t ssssll__ssoocckkeett  = 18_bit;
│ │ │ │ │ -   static constexpr peer_flags_t rrcc44__eennccrryypptteedd  = 19_bit;
│ │ │ │ │ -   static constexpr peer_flags_t ppllaaiinntteexxtt__eennccrryypptteedd  = 20_bit;
│ │ │ │ │ -   peer_flags_t flags;
│ │ │ │ │ -   static constexpr peer_source_flags_t ttrraacckkeerr  = 0_bit;
│ │ │ │ │ -   static constexpr peer_source_flags_t ddhhtt  = 1_bit;
│ │ │ │ │ -   static constexpr peer_source_flags_t ppeexx  = 2_bit;
│ │ │ │ │ -   static constexpr peer_source_flags_t llssdd  = 3_bit;
│ │ │ │ │ -   static constexpr peer_source_flags_t rreessuummee__ddaattaa  = 4_bit;
│ │ │ │ │ -   static constexpr peer_source_flags_t iinnccoommiinngg  = 5_bit;
│ │ │ │ │ -   peer_source_flags_t source;
│ │ │ │ │ -   int up_speed;
│ │ │ │ │ -   int down_speed;
│ │ │ │ │ -   int payload_up_speed;
│ │ │ │ │ -   int payload_down_speed;
│ │ │ │ │ -   peer_id pid;
│ │ │ │ │ -   int queue_bytes;
│ │ │ │ │ -   int request_timeout;
│ │ │ │ │ -   int send_buffer_size;
│ │ │ │ │ -   int used_send_buffer;
│ │ │ │ │ -   int receive_buffer_size;
│ │ │ │ │ -   int used_receive_buffer;
│ │ │ │ │ -   int receive_buffer_watermark;
│ │ │ │ │ -   int num_hashfails;
│ │ │ │ │ -   int download_queue_length;
│ │ │ │ │ -   int timed_out_requests;
│ │ │ │ │ -   int busy_requests;
│ │ │ │ │ -   int requests_in_buffer;
│ │ │ │ │ -   int target_dl_queue_length;
│ │ │ │ │ -   int upload_queue_length;
│ │ │ │ │ -   int failcount;
│ │ │ │ │ -   piece_index_t downloading_piece_index;
│ │ │ │ │ -   int downloading_block_index;
│ │ │ │ │ -   int downloading_progress;
│ │ │ │ │ -   int downloading_total;
│ │ │ │ │ -   static constexpr connection_type_t ssttaannddaarrdd__bbiittttoorrrreenntt  = 0_bit;
│ │ │ │ │ -   static constexpr connection_type_t wweebb__sseeeedd  = 1_bit;
│ │ │ │ │ -   static constexpr connection_type_t hhttttpp__sseeeedd  = 2_bit;
│ │ │ │ │ -   connection_type_t connection_type;
│ │ │ │ │ -   int pending_disk_bytes;
│ │ │ │ │ -   int pending_disk_read_bytes;
│ │ │ │ │ -   int send_quota;
│ │ │ │ │ -   int receive_quota;
│ │ │ │ │ -   int rtt;
│ │ │ │ │ -   int num_pieces;
│ │ │ │ │ -   int download_rate_peak;
│ │ │ │ │ -   int upload_rate_peak;
│ │ │ │ │ -   float progress;
│ │ │ │ │ -   int progress_ppm;
│ │ │ │ │ -   _t_c_p_:_:_e_n_d_p_o_i_n_t ip;
│ │ │ │ │ -   _t_c_p_:_:_e_n_d_p_o_i_n_t local_endpoint;
│ │ │ │ │ -   static constexpr bandwidth_state_flags_t bbww__iiddllee  = 0_bit;
│ │ │ │ │ -   static constexpr bandwidth_state_flags_t bbww__lliimmiitt  = 1_bit;
│ │ │ │ │ -   static constexpr bandwidth_state_flags_t bbww__nneettwwoorrkk  = 2_bit;
│ │ │ │ │ -   static constexpr bandwidth_state_flags_t bbww__ddiisskk  = 4_bit;
│ │ │ │ │ -   bandwidth_state_flags_t read_state;
│ │ │ │ │ -   bandwidth_state_flags_t write_state;
│ │ │ │ │ +   static constexpr add_peer_flags_t ffiirrsstt__ttiimmee  = 1_bit;
│ │ │ │ │ +   static constexpr add_peer_flags_t ffiilltteerreedd  = 2_bit;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ii22pp__ddeessttiinnaattiioonn(()) **********
│ │ │ │ │ -sha256_hash ii22pp__ddeessttiinnaattiioonn () const;
│ │ │ │ │ -If this peer is an i2p peer, this function returns the destination address of
│ │ │ │ │ -the peer
│ │ │ │ │ +********** nneeww__ccoonnnneeccttiioonn(()) **********
│ │ │ │ │ +virtual std::shared_ptr<peer_plugin> nneeww__ccoonnnneeccttiioonn (peer_connection_handle
│ │ │ │ │ +const&);
│ │ │ │ │ +This function is called each time a new peer is connected to the torrent. You
│ │ │ │ │ +may choose to ignore this by just returning a default constructed shared_ptr
│ │ │ │ │ +(in which case you don't need to override this member function).
│ │ │ │ │ +If you need an extension to the peer connection (which most plugins do) you are
│ │ │ │ │ +supposed to return an instance of your _p_e_e_r___p_l_u_g_i_n class. Which in turn will
│ │ │ │ │ +have its hook functions called on event specific to that peer.
│ │ │ │ │ +The peer_connection_handle will be valid as long as the shared_ptr is being
│ │ │ │ │ +held by the torrent object. So, it is generally a good idea to not keep a
│ │ │ │ │ +shared_ptr to your own _p_e_e_r___p_l_u_g_i_n. If you want to keep references to it, use
│ │ │ │ │ +weak_ptr.
│ │ │ │ │ +If this function throws an exception, the connection will be closed.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  client
│ │ │ │ │ -      A human readable string describing the software at the other end of the
│ │ │ │ │ -      connection. In some cases this information is not available, then it will
│ │ │ │ │ -      contain a string that may give away something about which software is
│ │ │ │ │ -      running in the other end. In the case of a web seed, the server type and
│ │ │ │ │ -      version will be a part of this string. This is UTF-8 encoded.
│ │ │ │ │ +********** oonn__ppiieeccee__ppaassss(()) oonn__ppiieeccee__ffaaiilleedd(()) **********
│ │ │ │ │ +virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │ +virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ +These hooks are called when a piece passes the hash check or fails the hash
│ │ │ │ │ +check, respectively. The index is the piece index that was downloaded. It is
│ │ │ │ │ +possible to access the list of peers that participated in sending the piece
│ │ │ │ │ +through the torrent and the piece_picker.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  pieces
│ │ │ │ │ -      a _b_i_t_f_i_e_l_d, with one bit per piece in the torrent. Each bit tells you if
│ │ │ │ │ -      the peer has that piece (if it's set to 1) or if the peer miss that piece
│ │ │ │ │ -      (set to 0).
│ │ │ │ │ +********** ttiicckk(()) **********
│ │ │ │ │ +virtual void ttiicckk ();
│ │ │ │ │ +This hook is called approximately once per second. It is a way of making it
│ │ │ │ │ +easy for plugins to do timed events, for sending messages or whatever.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  total_download total_upload
│ │ │ │ │ -      the total number of bytes downloaded from and uploaded to this peer.
│ │ │ │ │ -      These numbers do not include the protocol chatter, but only the payload
│ │ │ │ │ -      data.
│ │ │ │ │ +********** oonn__rreessuummee(()) oonn__ppaauussee(()) **********
│ │ │ │ │ +virtual bool oonn__rreessuummee ();
│ │ │ │ │ +virtual bool oonn__ppaauussee ();
│ │ │ │ │ +These hooks are called when the torrent is paused and resumed respectively. The
│ │ │ │ │ +return value indicates if the event was handled. A return value of true
│ │ │ │ │ +indicates that it was handled, and no other _p_l_u_g_i_n after this one will have
│ │ │ │ │ +this hook function called, and the standard handler will also not be invoked.
│ │ │ │ │ +So, returning true effectively overrides the standard behavior of pause or
│ │ │ │ │ +resume.
│ │ │ │ │ +Note that if you call pause() or resume() on the torrent from your handler it
│ │ │ │ │ +will recurse back into your handler, so in order to invoke the standard
│ │ │ │ │ +handler, you have to keep your own state on whether you want standard behavior
│ │ │ │ │ +or overridden behavior.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  last_request last_active
│ │ │ │ │ -      the time since we last sent a request to this peer and since any transfer
│ │ │ │ │ -      occurred with this peer
│ │ │ │ │ +********** oonn__ffiilleess__cchheecckkeedd(()) **********
│ │ │ │ │ +virtual void oonn__ffiilleess__cchheecckkeedd ();
│ │ │ │ │ +This function is called when the initial files of the torrent have been
│ │ │ │ │ +checked. If there are no files to check, this function is called immediately.
│ │ │ │ │ +i.e. This function is always called when the torrent is in a state where it can
│ │ │ │ │ +start downloading.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  download_queue_time
│ │ │ │ │ -      the time until all blocks in the request queue will be downloaded
│ │ │ │ │ +********** oonn__ssttaattee(()) **********
│ │ │ │ │ +virtual void oonn__ssttaattee (torrent_status::state_t);
│ │ │ │ │ +called when the torrent changes state the state is one of _t_o_r_r_e_n_t___s_t_a_t_u_s_:_:
│ │ │ │ │ +_s_t_a_t_e___t enum members
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  interesting
│ │ │ │ │ -      wwee are interested in pieces from this peer.
│ │ │ │ │ +********** oonn__aadddd__ppeeeerr(()) **********
│ │ │ │ │ +virtual void oonn__aadddd__ppeeeerr (tcp::endpoint const&,
│ │ │ │ │ +      peer_source_flags_t, add_peer_flags_t);
│ │ │ │ │ +called every time a new peer is added to the peer list. This is before the peer
│ │ │ │ │ +is connected to. For flags, see torrent_plugin::flags_t. The source argument
│ │ │ │ │ +refers to the source where we learned about this peer from. It's a bitmask,
│ │ │ │ │ +because many sources may have told us about the same peer. For peer source
│ │ │ │ │ +flags, see peer_info::peer_source_flags.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  choked
│ │ │ │ │ -      wwee have choked this peer.
│ │ │ │ │ +  first_time
│ │ │ │ │ +      this is the first time we see this peer
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  remote_interested
│ │ │ │ │ -      the peer is interested in uuss
│ │ │ │ │ +  filtered
│ │ │ │ │ +      this peer was not added because it was filtered by the IP filter
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  remote_choked
│ │ │ │ │ -      the peer has choked uuss.
│ │ │ │ │ +************ ppeeeerr__pplluuggiinn ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p"
│ │ │ │ │ +peer plugins are associated with a specific peer. A peer could be both a
│ │ │ │ │ +regular bittorrent peer (bt_peer_connection) or one of the web seed connections
│ │ │ │ │ +(web_peer_connection or http_seed_connection). In order to only attach to
│ │ │ │ │ +certain peers, make your torrent_plugin::new_connection only return a _p_l_u_g_i_n
│ │ │ │ │ +for certain peer connection types
│ │ │ │ │ +struct peer_plugin
│ │ │ │ │ +{
│ │ │ │ │ +   virtual string_view ttyyppee () const;
│ │ │ │ │ +   virtual void aadddd__hhaannddsshhaakkee (entry&);
│ │ │ │ │ +   virtual void oonn__ddiissccoonnnneecctt (error_code const&);
│ │ │ │ │ +   virtual void oonn__ccoonnnneecctteedd ();
│ │ │ │ │ +   virtual bool oonn__hhaannddsshhaakkee (span<char const>);
│ │ │ │ │ +   virtual bool oonn__eexxtteennssiioonn__hhaannddsshhaakkee (bdecode_node const&);
│ │ │ │ │ +   virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//);
│ │ │ │ │ +   virtual bool oonn__ddoonntt__hhaavvee (piece_index_t);
│ │ │ │ │ +   virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t);
│ │ │ │ │ +   virtual bool oonn__hhaavvee__aallll ();
│ │ │ │ │ +   virtual bool oonn__cchhookkee ();
│ │ │ │ │ +   virtual bool oonn__rreeqquueesstt (peer_request const&);
│ │ │ │ │ +   virtual bool oonn__hhaavvee__nnoonnee ();
│ │ │ │ │ +   virtual bool oonn__hhaavvee (piece_index_t);
│ │ │ │ │ +   virtual bool oonn__uunncchhookkee ();
│ │ │ │ │ +   virtual bool oonn__nnoott__iinntteerreesstteedd ();
│ │ │ │ │ +   virtual bool oonn__iinntteerreesstteedd ();
│ │ │ │ │ +   virtual bool oonn__ppiieeccee (peer_request const& //**ppiieeccee**//
│ │ │ │ │ +      , span<char const> //**bbuuff**//);
│ │ │ │ │ +   virtual bool oonn__ccaanncceell (peer_request const&);
│ │ │ │ │ +   virtual bool oonn__ssuuggggeesstt (piece_index_t);
│ │ │ │ │ +   virtual bool oonn__rreejjeecctt (peer_request const&);
│ │ │ │ │ +   virtual void sseenntt__hhaavvee__nnoonnee ();
│ │ │ │ │ +   virtual void sseenntt__cchhookkee ();
│ │ │ │ │ +   virtual void sseenntt__ssuuggggeesstt (piece_index_t);
│ │ │ │ │ +   virtual void sseenntt__rreejjeecctt__rreeqquueesstt (peer_request const&);
│ │ │ │ │ +   virtual void sseenntt__rreeqquueesstt (peer_request const&);
│ │ │ │ │ +   virtual void sseenntt__aallllooww__ffaasstt (piece_index_t);
│ │ │ │ │ +   virtual void sseenntt__ccaanncceell (peer_request const&);
│ │ │ │ │ +   virtual void sseenntt__hhaavvee__aallll ();
│ │ │ │ │ +   virtual void sseenntt__hhaavvee (piece_index_t);
│ │ │ │ │ +   virtual void sseenntt__iinntteerreesstteedd ();
│ │ │ │ │ +   virtual void sseenntt__uunncchhookkee ();
│ │ │ │ │ +   virtual void sseenntt__ppiieeccee (peer_request const&);
│ │ │ │ │ +   virtual void sseenntt__nnoott__iinntteerreesstteedd ();
│ │ │ │ │ +   virtual void sseenntt__ppaayyllooaadd (int //** bbyytteess **//);
│ │ │ │ │ +   virtual bool ccaann__ddiissccoonnnneecctt (error_code const& //**eecc**//);
│ │ │ │ │ +   virtual bool oonn__eexxtteennddeedd (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │ +      span<char const> //**bbooddyy**//);
│ │ │ │ │ +   virtual bool oonn__uunnkknnoowwnn__mmeessssaaggee (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │ +      span<char const> //**bbooddyy**//);
│ │ │ │ │ +   virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │ +   virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ +   virtual void ttiicckk ();
│ │ │ │ │ +   virtual bool wwrriittee__rreeqquueesstt (peer_request const&);
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  supports_extensions
│ │ │ │ │ -      means that this peer supports the _e_x_t_e_n_s_i_o_n_ _p_r_o_t_o_c_o_l.
│ │ │ │ │ +********** ttyyppee(()) **********
│ │ │ │ │ +virtual string_view ttyyppee () const;
│ │ │ │ │ +This function is expected to return the name of the _p_l_u_g_i_n.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  outgoing_connection
│ │ │ │ │ -      The connection was initiated by us, the peer has a listen port open, and
│ │ │ │ │ -      that port is the same as in the address of this peer. If this flag is not
│ │ │ │ │ -      set, this peer connection was opened by this peer connecting to us.
│ │ │ │ │ +********** aadddd__hhaannddsshhaakkee(()) **********
│ │ │ │ │ +virtual void aadddd__hhaannddsshhaakkee (entry&);
│ │ │ │ │ +can add entries to the extension handshake this is not called for web seeds
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  local_connection
│ │ │ │ │ -      deprecated synonym for outgoing_connection
│ │ │ │ │ +********** oonn__ddiissccoonnnneecctt(()) **********
│ │ │ │ │ +virtual void oonn__ddiissccoonnnneecctt (error_code const&);
│ │ │ │ │ +called when the peer is being disconnected.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  handshake
│ │ │ │ │ -      The connection is opened, and waiting for the handshake. Until the
│ │ │ │ │ -      handshake is done, the peer cannot be identified.
│ │ │ │ │ +********** oonn__ccoonnnneecctteedd(()) **********
│ │ │ │ │ +virtual void oonn__ccoonnnneecctteedd ();
│ │ │ │ │ +called when the peer is successfully connected. Note that incoming connections
│ │ │ │ │ +will have been connected by the time the peer _p_l_u_g_i_n is attached to it, and
│ │ │ │ │ +won't have this hook called.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  connecting
│ │ │ │ │ -      The connection is in a half-open state (i.e. it is being connected).
│ │ │ │ │ +********** oonn__hhaannddsshhaakkee(()) **********
│ │ │ │ │ +virtual bool oonn__hhaannddsshhaakkee (span<char const>);
│ │ │ │ │ +this is called when the initial bittorrent handshake is received. Returning
│ │ │ │ │ +false means that the other end doesn't support this extension and will remove
│ │ │ │ │ +it from the list of plugins. this is not called for web seeds
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  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.
│ │ │ │ │ +********** oonn__eexxtteennssiioonn__hhaannddsshhaakkee(()) **********
│ │ │ │ │ +virtual bool oonn__eexxtteennssiioonn__hhaannddsshhaakkee (bdecode_node const&);
│ │ │ │ │ +called when the extension handshake from the other end is received if this
│ │ │ │ │ +returns false, it means that this extension isn't supported by this peer. It
│ │ │ │ │ +will result in this _p_e_e_r___p_l_u_g_i_n being removed from the peer_connection and
│ │ │ │ │ +destructed. this is not called for web seeds
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  seed
│ │ │ │ │ -      This peer is a seed (it has all the pieces).
│ │ │ │ │ +********** oonn__hhaavvee(()) oonn__hhaavvee__aallll(()) oonn__rreeqquueesstt(()) oonn__bbiittffiieelldd(()) oonn__nnoott__iinntteerreesstteedd(())
│ │ │ │ │ +oonn__cchhookkee(()) oonn__aalllloowweedd__ffaasstt(()) oonn__hhaavvee__nnoonnee(()) oonn__uunncchhookkee(()) oonn__iinntteerreesstteedd(())
│ │ │ │ │ +oonn__ddoonntt__hhaavvee(()) **********
│ │ │ │ │ +virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//);
│ │ │ │ │ +virtual bool oonn__ddoonntt__hhaavvee (piece_index_t);
│ │ │ │ │ +virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t);
│ │ │ │ │ +virtual bool oonn__hhaavvee__aallll ();
│ │ │ │ │ +virtual bool oonn__cchhookkee ();
│ │ │ │ │ +virtual bool oonn__rreeqquueesstt (peer_request const&);
│ │ │ │ │ +virtual bool oonn__hhaavvee__nnoonnee ();
│ │ │ │ │ +virtual bool oonn__hhaavvee (piece_index_t);
│ │ │ │ │ +virtual bool oonn__uunncchhookkee ();
│ │ │ │ │ +virtual bool oonn__nnoott__iinntteerreesstteedd ();
│ │ │ │ │ +virtual bool oonn__iinntteerreesstteedd ();
│ │ │ │ │ +returning true from any of the message handlers indicates that the _p_l_u_g_i_n has
│ │ │ │ │ +handled the message. it will break the _p_l_u_g_i_n chain traversing and not let
│ │ │ │ │ +anyone else handle the message, including the default handler.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  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.
│ │ │ │ │ +********** oonn__ppiieeccee(()) **********
│ │ │ │ │ +virtual bool oonn__ppiieeccee (peer_request const& //**ppiieeccee**//
│ │ │ │ │ +      , span<char const> //**bbuuff**//);
│ │ │ │ │ +This function is called when the peer connection is receiving a piece. buf
│ │ │ │ │ +points (non-owning pointer) to the data in an internal immutable disk buffer.
│ │ │ │ │ +The length of the data is specified in the length member of the piece
│ │ │ │ │ +parameter. returns true to indicate that the piece is handled and the rest of
│ │ │ │ │ +the logic should be ignored.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  snubbed
│ │ │ │ │ -      This peer has recently failed to send a block within the request timeout
│ │ │ │ │ -      from when the request was sent. We're currently picking one block at a
│ │ │ │ │ -      time from this peer.
│ │ │ │ │ +********** sseenntt__hhaavvee(()) sseenntt__iinntteerreesstteedd(()) sseenntt__nnoott__iinntteerreesstteedd(()) sseenntt__ppiieeccee(())
│ │ │ │ │ +sseenntt__uunncchhookkee(()) **********
│ │ │ │ │ +virtual void sseenntt__hhaavvee (piece_index_t);
│ │ │ │ │ +virtual void sseenntt__iinntteerreesstteedd ();
│ │ │ │ │ +virtual void sseenntt__uunncchhookkee ();
│ │ │ │ │ +virtual void sseenntt__ppiieeccee (peer_request const&);
│ │ │ │ │ +virtual void sseenntt__nnoott__iinntteerreesstteedd ();
│ │ │ │ │ +called after a choke message has been sent to the peer
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  upload_only
│ │ │ │ │ -      This peer has either explicitly (with an extension) or implicitly (by
│ │ │ │ │ -      becoming a seed) told us that it will not downloading anything more,
│ │ │ │ │ -      regardless of which pieces we have.
│ │ │ │ │ +********** sseenntt__ppaayyllooaadd(()) **********
│ │ │ │ │ +virtual void sseenntt__ppaayyllooaadd (int //** bbyytteess **//);
│ │ │ │ │ +called after piece data has been sent to the peer this can be used for stats
│ │ │ │ │ +book keeping
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  endgame_mode
│ │ │ │ │ -      This means the last time this peer picket a piece, it could not pick as
│ │ │ │ │ -      many as it wanted because there were not enough free ones. i.e. all
│ │ │ │ │ -      pieces this peer has were already requested from other peers.
│ │ │ │ │ +********** ccaann__ddiissccoonnnneecctt(()) **********
│ │ │ │ │ +virtual bool ccaann__ddiissccoonnnneecctt (error_code const& //**eecc**//);
│ │ │ │ │ +called when libtorrent think this peer should be disconnected. if the _p_l_u_g_i_n
│ │ │ │ │ +returns false, the peer will not be disconnected.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  holepunched
│ │ │ │ │ -      This flag is set if the peer was in holepunch mode when the connection
│ │ │ │ │ -      succeeded. This typically only happens if both peers are behind a NAT and
│ │ │ │ │ -      the peers connect via the NAT holepunch mechanism.
│ │ │ │ │ +********** oonn__eexxtteennddeedd(()) **********
│ │ │ │ │ +virtual bool oonn__eexxtteennddeedd (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │ +      span<char const> //**bbooddyy**//);
│ │ │ │ │ +called when an extended message is received. If returning true, the message is
│ │ │ │ │ +not processed by any other _p_l_u_g_i_n and if false is returned the next _p_l_u_g_i_n in
│ │ │ │ │ +the chain will receive it to be able to handle it. This is not called for web
│ │ │ │ │ +seeds. thus function may be called more than once per incoming message, but
│ │ │ │ │ +only the last of the calls will the body size equal the length. i.e. Every time
│ │ │ │ │ +another fragment of the message is received, this function will be called,
│ │ │ │ │ +until finally the whole message has been received. The purpose of this is to
│ │ │ │ │ +allow early disconnects for invalid messages and for reporting progress of
│ │ │ │ │ +receiving large messages.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  i2p_socket
│ │ │ │ │ -      indicates that this socket is running on top of the I2P transport.
│ │ │ │ │ +********** oonn__uunnkknnoowwnn__mmeessssaaggee(()) **********
│ │ │ │ │ +virtual bool oonn__uunnkknnoowwnn__mmeessssaaggee (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │ +      span<char const> //**bbooddyy**//);
│ │ │ │ │ +this is not called for web seeds
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  utp_socket
│ │ │ │ │ -      indicates that this socket is a uTP socket
│ │ │ │ │ +********** oonn__ppiieeccee__ppaassss(()) oonn__ppiieeccee__ffaaiilleedd(()) **********
│ │ │ │ │ +virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │ +virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ +called when a piece that this peer participated in either fails or passes the
│ │ │ │ │ +hash_check
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  ssl_socket
│ │ │ │ │ -      indicates that this socket is running on top of an SSL (TLS) channel
│ │ │ │ │ +********** ttiicckk(()) **********
│ │ │ │ │ +virtual void ttiicckk ();
│ │ │ │ │ +called approximately once every second
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  rc4_encrypted
│ │ │ │ │ -      this connection is obfuscated with RC4
│ │ │ │ │ +********** wwrriittee__rreeqquueesstt(()) **********
│ │ │ │ │ +virtual bool wwrriittee__rreeqquueesstt (peer_request const&);
│ │ │ │ │ +called each time a request message is to be sent. If true is returned, the
│ │ │ │ │ +original request message won't be sent and no other _p_l_u_g_i_n will have this
│ │ │ │ │ +function called.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  plaintext_encrypted
│ │ │ │ │ -      the handshake of this connection was obfuscated with a Diffie-Hellman
│ │ │ │ │ -      exchange
│ │ │ │ │ +************ ccrryyppttoo__pplluuggiinn ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p"
│ │ │ │ │ +struct crypto_plugin
│ │ │ │ │ +{
│ │ │ │ │ +   virtual void sseett__iinnccoommiinngg__kkeeyy (span<char const> key) = 0;
│ │ │ │ │ +   virtual void sseett__oouuttggooiinngg__kkeeyy (span<char const> key) = 0;
│ │ │ │ │ +   eennccrryypptt (span<span<char>> //**sseenndd__vveecc**//) = 0;
│ │ │ │ │ +   virtual std::tuple<int, int, int> ddeeccrryypptt (span<span<char>> //**rreecceeiivvee__vveecc**//
│ │ │ │ │ +) = 0;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ddeeccrryypptt(()) **********
│ │ │ │ │ +virtual std::tuple<int, int, int> ddeeccrryypptt (span<span<char>> //**rreecceeiivvee__vveecc**//) =
│ │ │ │ │ +0;
│ │ │ │ │ +decrypt the provided buffers. returns is a tuple representing the values
│ │ │ │ │ +(consume, produce, packet_size)
│ │ │ │ │ +consume is set to the number of bytes which should be trimmed from the head of
│ │ │ │ │ +the buffers, default is 0
│ │ │ │ │ +produce is set to the number of bytes of payload which are now ready to be sent
│ │ │ │ │ +to the upper layer. default is the number of bytes passed in receive_vec
│ │ │ │ │ +packet_size is set to the minimum number of bytes which must be read to advance
│ │ │ │ │ +the next step of decryption. default is 0
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ccrreeaattee__uutt__ppeexx__pplluuggiinn(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_/_u_t___p_e_x_._h_p_p"
│ │ │ │ │ +std::shared_ptr<torrent_plugin> ccrreeaattee__uutt__ppeexx__pplluuggiinn (torrent_handle const&,
│ │ │ │ │ +client_data_t);
│ │ │ │ │ +constructor function for the ut_pex extension. The ut_pex extension allows
│ │ │ │ │ +peers to gossip about their connections, allowing the swarm stay well connected
│ │ │ │ │ +and peers aware of more peers in the swarm. This extension is enabled by
│ │ │ │ │ +default unless explicitly disabled in the _s_e_s_s_i_o_n constructor.
│ │ │ │ │ +This can either be passed in the add_torrent_params::extensions field, or via
│ │ │ │ │ +_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ccrreeaattee__ssmmaarrtt__bbaann__pplluuggiinn(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_/_s_m_a_r_t___b_a_n_._h_p_p"
│ │ │ │ │ +std::shared_ptr<torrent_plugin> ccrreeaattee__ssmmaarrtt__bbaann__pplluuggiinn (torrent_handle const&,
│ │ │ │ │ +client_data_t);
│ │ │ │ │ +constructor function for the smart ban extension. The extension keeps track of
│ │ │ │ │ +the data peers have sent us for failing pieces and once the piece completes and
│ │ │ │ │ +passes the hash check bans the peers that turned out to have sent corrupt data.
│ │ │ │ │ +This function can either be passed in the add_torrent_params::extensions field,
│ │ │ │ │ +or via _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ccrreeaattee__uutt__mmeettaaddaattaa__pplluuggiinn(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_/_u_t___m_e_t_a_d_a_t_a_._h_p_p"
│ │ │ │ │ +std::shared_ptr<torrent_plugin> ccrreeaattee__uutt__mmeettaaddaattaa__pplluuggiinn (torrent_handle
│ │ │ │ │ +const&, client_data_t);
│ │ │ │ │ +constructor function for the ut_metadata extension. The ut_metadata extension
│ │ │ │ │ +allows peers to request the .torrent file (or more specifically the info-
│ │ │ │ │ +dictionary of the .torrent file) from each other. This is the main building
│ │ │ │ │ +block in making magnet links work. This extension is enabled by default unless
│ │ │ │ │ +explicitly disabled in the _s_e_s_s_i_o_n constructor.
│ │ │ │ │ +This can either be passed in the add_torrent_params::extensions field, or via
│ │ │ │ │ +_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ aadddd__ttoorrrreenntt__ppaarraammss ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_._h_p_p"
│ │ │ │ │ +The _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s contains all the information in a .torrent file along
│ │ │ │ │ +with all information necessary to add that torrent to a _s_e_s_s_i_o_n. The key fields
│ │ │ │ │ +when adding a torrent are:
│ │ │ │ │ +    * ti - the immutable info-dict part of the torrent
│ │ │ │ │ +    * info_hash - when you don't have the metadata (.torrent file). This
│ │ │ │ │ +      uniquely identifies the torrent and can validate the info-dict when
│ │ │ │ │ +      received from the swarm.
│ │ │ │ │ +In order to add a torrent to a _s_e_s_s_i_o_n, one of those fields must be set in
│ │ │ │ │ +addition to save_path. The _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object can then be passed into
│ │ │ │ │ +one of the session::add_torrent() overloads or session::async_add_torrent().
│ │ │ │ │ +If you only specify the info-hash, the torrent file will be downloaded from
│ │ │ │ │ +peers, which requires them to support the metadata extension. For the metadata
│ │ │ │ │ +extension to work, libtorrent must be built with extensions enabled
│ │ │ │ │ +(TORRENT_DISABLE_EXTENSIONS must not be defined). It also takes an optional
│ │ │ │ │ +name argument. This may be left empty in case no name should be assigned to the
│ │ │ │ │ +torrent. In case it's not, the name is used for the torrent as long as it
│ │ │ │ │ +doesn't have metadata. See torrent_handle::name.
│ │ │ │ │ +The add_torrent_params is also used when requesting resume data for a torrent.
│ │ │ │ │ +It can be saved to and restored from a file and added back to a new _s_e_s_s_i_o_n.
│ │ │ │ │ +For serialization and de-serialization of add_torrent_params objects, see
│ │ │ │ │ +_r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) and _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_).
│ │ │ │ │ +The add_torrent_params is also used to represent a parsed .torrent file. It can
│ │ │ │ │ +be loaded via _l_o_a_d___t_o_r_r_e_n_t___f_i_l_e_(_), _l_o_a_d___t_o_r_r_e_n_t___b_u_f_f_e_r_(_) and
│ │ │ │ │ +_l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_). It can be saved via _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_).
│ │ │ │ │ +struct add_torrent_params
│ │ │ │ │ +{
│ │ │ │ │ +   int vveerrssiioonn  = LIBTORRENT_VERSION_NUM;
│ │ │ │ │ +   std::shared_ptr<torrent_info> ti;
│ │ │ │ │ +   aux::noexcept_movable<std::vector<std::string>> trackers;
│ │ │ │ │ +   aux::noexcept_movable<std::vector<int>> tracker_tiers;
│ │ │ │ │ +   aux::noexcept_movable<std::vector<std::pair<std::string, int>>> dht_nodes;
│ │ │ │ │ +   std::string name;
│ │ │ │ │ +   std::string save_path;
│ │ │ │ │ +   storage_mode_t ssttoorraaggee__mmooddee  = storage_mode_sparse;
│ │ │ │ │ +   client_data_t userdata;
│ │ │ │ │ +   aux::noexcept_movable<std::vector<download_priority_t>> file_priorities;
│ │ │ │ │ +   std::string trackerid;
│ │ │ │ │ +   torrent_flags_t ffllaaggss  = torrent_flags::default_flags;
│ │ │ │ │ +   info_hash_t info_hashes;
│ │ │ │ │ +   int mmaaxx__uuppllooaaddss  = -1;
│ │ │ │ │ +   int mmaaxx__ccoonnnneeccttiioonnss  = -1;
│ │ │ │ │ +   int uuppllooaadd__lliimmiitt  = -1;
│ │ │ │ │ +   int ddoowwnnllooaadd__lliimmiitt  = -1;
│ │ │ │ │ +   std::int64_t ttoottaall__uuppllooaaddeedd  = 0;
│ │ │ │ │ +   std::int64_t ttoottaall__ddoowwnnllooaaddeedd  = 0;
│ │ │ │ │ +   int aaccttiivvee__ttiimmee  = 0;
│ │ │ │ │ +   int ffiinniisshheedd__ttiimmee  = 0;
│ │ │ │ │ +   int sseeeeddiinngg__ttiimmee  = 0;
│ │ │ │ │ +   std::time_t aaddddeedd__ttiimmee  = 0;
│ │ │ │ │ +   std::time_t ccoommpplleetteedd__ttiimmee  = 0;
│ │ │ │ │ +   std::time_t llaasstt__sseeeenn__ccoommpplleettee  = 0;
│ │ │ │ │ +   int nnuumm__ccoommpplleettee  = -1;
│ │ │ │ │ +   int nnuumm__iinnccoommpplleettee  = -1;
│ │ │ │ │ +   int nnuumm__ddoowwnnllooaaddeedd  = -1;
│ │ │ │ │ +   aux::noexcept_movable<std::vector<std::string>> http_seeds;
│ │ │ │ │ +   aux::noexcept_movable<std::vector<std::string>> url_seeds;
│ │ │ │ │ +   aux::noexcept_movable<std::vector<tcp::endpoint>> peers;
│ │ │ │ │ +   aux::noexcept_movable<std::vector<tcp::endpoint>> banned_peers;
│ │ │ │ │ +   aux::noexcept_movable<std::map<piece_index_t, bitfield>> unfinished_pieces;
│ │ │ │ │ +   typed_bitfield<piece_index_t> have_pieces;
│ │ │ │ │ +   typed_bitfield<piece_index_t> verified_pieces;
│ │ │ │ │ +   aux::noexcept_movable<std::vector<download_priority_t>> piece_priorities;
│ │ │ │ │ +   aux::vector<std::vector<sha256_hash>, file_index_t> merkle_trees;
│ │ │ │ │ +   aux::vector<std::vector<bool>, file_index_t> merkle_tree_mask;
│ │ │ │ │ +   aux::vector<std::vector<bool>, file_index_t> verified_leaf_hashes;
│ │ │ │ │ +   aux::noexcept_movable<std::map<file_index_t, std::string>> renamed_files;
│ │ │ │ │ +   std::time_t llaasstt__ddoowwnnllooaadd  = 0;
│ │ │ │ │ +   std::time_t llaasstt__uuppllooaadd  = 0;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  version
│ │ │ │ │ +      filled in by the constructor and should be left untouched. It is used for
│ │ │ │ │ +      forward binary compatibility.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  ti
│ │ │ │ │ +      _t_o_r_r_e_n_t___i_n_f_o object with the torrent to add. Unless the info_hash is set,
│ │ │ │ │ +      this is required to be initialized.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  trackers
│ │ │ │ │ +      If the torrent doesn't have a tracker, but relies on the DHT to find
│ │ │ │ │ +      peers, the trackers can specify tracker URLs for the torrent.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  tracker_tiers
│ │ │ │ │ +      the tiers the URLs in trackers belong to. Trackers belonging to different
│ │ │ │ │ +      tiers may be treated differently, as defined by the multi tracker
│ │ │ │ │ +      extension. This is optional, if not specified trackers are assumed to be
│ │ │ │ │ +      part of tier 0, or whichever the last tier was as iterating over the
│ │ │ │ │ +      trackers.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  dht_nodes
│ │ │ │ │ +      a list of hostname and port pairs, representing DHT nodes to be added to
│ │ │ │ │ +      the _s_e_s_s_i_o_n (if DHT is enabled). The hostname may be an IP address.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  name
│ │ │ │ │ +      in case there's no other name in this torrent, this name will be used.
│ │ │ │ │ +      The name out of the _t_o_r_r_e_n_t___i_n_f_o object takes precedence if available.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  save_path
│ │ │ │ │ +      the path where the torrent is or will be stored.
│ │ │ │ │ +      Note
│ │ │ │ │ +      On windows this path (and other paths) are interpreted as UNC paths. This
│ │ │ │ │ +      means they must use backslashes as directory separators and may not
│ │ │ │ │ +      contain the special directories "." or "..".
│ │ │ │ │ +      Setting this to an absolute path performs slightly better than a relative
│ │ │ │ │ +      path.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  storage_mode
│ │ │ │ │ +      One of the values from _s_t_o_r_a_g_e___m_o_d_e___t. For more information, see _s_t_o_r_a_g_e
│ │ │ │ │ +      _a_l_l_o_c_a_t_i_o_n.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  userdata
│ │ │ │ │ +      The userdata parameter is optional and will be passed on to the extension
│ │ │ │ │ +      constructor functions, if any (see _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_)). It
│ │ │ │ │ +      will also be stored in the torrent object and can be retrieved by calling
│ │ │ │ │ +      _u_s_e_r_d_a_t_a_(_).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  file_priorities
│ │ │ │ │ +      can be set to control the initial file priorities when adding a torrent.
│ │ │ │ │ +      The semantics are the same as for torrent_handle::prioritize_files(). The
│ │ │ │ │ +      file priorities specified in here take precedence over those specified in
│ │ │ │ │ +      the resume data, if any. If this vector of file priorities is shorter
│ │ │ │ │ +      than the number of files in the torrent, the remaining files (not covered
│ │ │ │ │ +      by this) will still have the default download priority. This default can
│ │ │ │ │ +      be changed by setting the default_dont_download torrent_flag.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  trackerid
│ │ │ │ │ +      the default tracker id to be used when announcing to trackers. By default
│ │ │ │ │ +      this is empty, and no tracker ID is used, since this is an optional
│ │ │ │ │ +      argument. If a tracker returns a tracker ID, that ID is used instead of
│ │ │ │ │ +      this.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    flags
│ │ │ │ │ -      tells you in which state the peer is in. It is set to any combination of
│ │ │ │ │ -      the peer_flags_t flags above.
│ │ │ │ │ +      flags controlling aspects of this torrent and how it's added. See
│ │ │ │ │ +      _t_o_r_r_e_n_t___f_l_a_g_s___t for details.
│ │ │ │ │ +      Note
│ │ │ │ │ +      The flags field is initialized with default flags by the constructor. In
│ │ │ │ │ +      order to preserve default behavior when clearing or setting other flags,
│ │ │ │ │ +      make sure to bitwise OR or in a flag or bitwise AND the inverse of a flag
│ │ │ │ │ +      to clear it.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  tracker
│ │ │ │ │ -      The peer was received from the tracker.
│ │ │ │ │ +  info_hashes
│ │ │ │ │ +      set this to the info hash of the torrent to add in case the info-hash is
│ │ │ │ │ +      the only known property of the torrent. i.e. you don't have a .torrent
│ │ │ │ │ +      file nor a magnet link. To add a magnet link, use _p_a_r_s_e___m_a_g_n_e_t___u_r_i_(_) to
│ │ │ │ │ +      populate fields in the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  dht
│ │ │ │ │ -      The peer was received from the kademlia DHT.
│ │ │ │ │ +  max_uploads max_connections
│ │ │ │ │ +      max_uploads, max_connections, upload_limit, download_limit correspond to
│ │ │ │ │ +      the set_max_uploads(), set_max_connections(), set_upload_limit() and
│ │ │ │ │ +      set_download_limit() functions on _t_o_r_r_e_n_t___h_a_n_d_l_e. These values let you
│ │ │ │ │ +      initialize these settings when the torrent is added, instead of calling
│ │ │ │ │ +      these functions immediately following adding it.
│ │ │ │ │ +      -1 means unlimited on these settings just like their counterpart
│ │ │ │ │ +      functions on _t_o_r_r_e_n_t___h_a_n_d_l_e
│ │ │ │ │ +      For fine grained control over rate limits, including making them apply to
│ │ │ │ │ +      local peers, see _p_e_e_r_ _c_l_a_s_s_e_s.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  pex
│ │ │ │ │ -      The peer was received from the peer exchange extension.
│ │ │ │ │ +  upload_limit download_limit
│ │ │ │ │ +      the upload and download rate limits for this torrent, specified in bytes
│ │ │ │ │ +      per second. -1 means unlimited.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  lsd
│ │ │ │ │ -      The peer was received from the local service discovery (The peer is on
│ │ │ │ │ -      the local network).
│ │ │ │ │ +  total_uploaded total_downloaded
│ │ │ │ │ +      the total number of bytes uploaded and downloaded by this torrent so far.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  resume_data
│ │ │ │ │ -      The peer was added from the fast resume data.
│ │ │ │ │ +  active_time finished_time seeding_time
│ │ │ │ │ +      the number of seconds this torrent has spent in started, finished and
│ │ │ │ │ +      seeding state so far, respectively.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  incoming
│ │ │ │ │ -      we received an incoming connection from this peer
│ │ │ │ │ +  added_time completed_time
│ │ │ │ │ +      if set to a non-zero value, this is the posix time of when this torrent
│ │ │ │ │ +      was first added, including previous runs/sessions. If set to zero, the
│ │ │ │ │ +      internal added_time will be set to the time of when _a_d_d___t_o_r_r_e_n_t_(_) is
│ │ │ │ │ +      called.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  source
│ │ │ │ │ -      a combination of flags describing from which sources this peer was
│ │ │ │ │ -      received. A combination of the peer_source_flags_t above.
│ │ │ │ │ +  last_seen_complete
│ │ │ │ │ +      if set to non-zero, initializes the time (expressed in posix time) when
│ │ │ │ │ +      we last saw a seed or peers that together formed a complete copy of the
│ │ │ │ │ +      torrent. If left set to zero, the internal counterpart to this field will
│ │ │ │ │ +      be updated when we see a seed or a distributed copies >= 1.0.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  up_speed down_speed
│ │ │ │ │ -      the current upload and download speed we have to and from this peer
│ │ │ │ │ -      (including any protocol messages). updated about once per second
│ │ │ │ │ +  num_complete num_incomplete num_downloaded
│ │ │ │ │ +      these field can be used to initialize the torrent's cached scrape data.
│ │ │ │ │ +      The scrape data is high level metadata about the current state of the
│ │ │ │ │ +      swarm, as returned by the tracker (either when announcing to it or by
│ │ │ │ │ +      sending a specific scrape request). num_complete is the number of peers
│ │ │ │ │ +      in the swarm that are seeds, or have every piece in the torrent.
│ │ │ │ │ +      num_incomplete is the number of peers in the swarm that do not have every
│ │ │ │ │ +      piece. num_downloaded is the number of times the torrent has been
│ │ │ │ │ +      downloaded (not initiated, but the number of times a download has
│ │ │ │ │ +      completed).
│ │ │ │ │ +      Leaving any of these values set to -1 indicates we don't know, or we have
│ │ │ │ │ +      not received any scrape data.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  payload_up_speed payload_down_speed
│ │ │ │ │ -      The transfer rates of payload data only updated about once per second
│ │ │ │ │ +  http_seeds url_seeds
│ │ │ │ │ +      URLs can be added to these two lists to specify additional web seeds to
│ │ │ │ │ +      be used by the torrent. If the flag_override_web_seeds is set, these will
│ │ │ │ │ +      be the _only_ ones to be used. i.e. any web seeds found in the .torrent
│ │ │ │ │ +      file will be overridden.
│ │ │ │ │ +      http_seeds expects URLs to web servers implementing the original HTTP
│ │ │ │ │ +      seed specification _B_E_P_ _1_7.
│ │ │ │ │ +      url_seeds expects URLs to regular web servers, aka "get right" style,
│ │ │ │ │ +      specified in _B_E_P_ _1_9.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  pid
│ │ │ │ │ -      the peer's id as used in the bittorrent protocol. This id can be used to
│ │ │ │ │ -      extract 'fingerprints' from the peer. Sometimes it can tell you which
│ │ │ │ │ -      client the peer is using. See identify_client()_
│ │ │ │ │ +  peers
│ │ │ │ │ +      peers to add to the torrent, to be tried to be connected to as bittorrent
│ │ │ │ │ +      peers.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  queue_bytes
│ │ │ │ │ -      the number of bytes we have requested from this peer, but not yet
│ │ │ │ │ -      received.
│ │ │ │ │ +  banned_peers
│ │ │ │ │ +      peers banned from this torrent. The will not be connected to
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  request_timeout
│ │ │ │ │ -      the number of seconds until the current front piece request will time
│ │ │ │ │ -      out. This timeout can be adjusted through settings_pack::request_timeout.
│ │ │ │ │ -      -1 means that there is not outstanding request.
│ │ │ │ │ +  unfinished_pieces
│ │ │ │ │ +      this is a map of partially downloaded piece. The key is the piece index
│ │ │ │ │ +      and the value is a _b_i_t_f_i_e_l_d where each bit represents a 16 kiB block. A
│ │ │ │ │ +      set bit means we have that block.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  send_buffer_size used_send_buffer
│ │ │ │ │ -      the number of bytes allocated and used for the peer's send buffer,
│ │ │ │ │ -      respectively.
│ │ │ │ │ +  have_pieces
│ │ │ │ │ +      this is a _b_i_t_f_i_e_l_d indicating which pieces we already have of this
│ │ │ │ │ +      torrent.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  receive_buffer_size used_receive_buffer receive_buffer_watermark
│ │ │ │ │ -      the number of bytes allocated and used as receive buffer, respectively.
│ │ │ │ │ +  verified_pieces
│ │ │ │ │ +      when in seed_mode, pieces with a set bit in this _b_i_t_f_i_e_l_d have been
│ │ │ │ │ +      verified to be valid. Other pieces will be verified the first time a peer
│ │ │ │ │ +      requests it.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  num_hashfails
│ │ │ │ │ -      the number of pieces this peer has participated in sending us that turned
│ │ │ │ │ -      out to fail the hash check.
│ │ │ │ │ +  piece_priorities
│ │ │ │ │ +      this sets the priorities for each individual piece in the torrent. Each
│ │ │ │ │ +      element in the vector represent the piece with the same index. If you set
│ │ │ │ │ +      both file- and piece priorities, file priorities will take precedence.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  download_queue_length
│ │ │ │ │ -      this is the number of requests we have sent to this peer that we haven't
│ │ │ │ │ -      got a response for yet
│ │ │ │ │ +  merkle_trees
│ │ │ │ │ +      v2 hashes, if known
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  timed_out_requests
│ │ │ │ │ -      the number of block requests that have timed out, and are still in the
│ │ │ │ │ -      download queue
│ │ │ │ │ +  merkle_tree_mask
│ │ │ │ │ +      if set, indicates which hashes are included in the corresponding vector
│ │ │ │ │ +      of merkle_trees. These bitmasks always cover the full tree, a cleared bit
│ │ │ │ │ +      means the hash is all zeros (i.e. not set) and set bit means the next
│ │ │ │ │ +      hash in the corresponding vector in merkle_trees is the hash for that
│ │ │ │ │ +      node. This is an optimization to avoid storing a lot of zeros.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  busy_requests
│ │ │ │ │ -      the number of busy requests in the download queue. A busy request is a
│ │ │ │ │ -      request for a block we've also requested from a different peer
│ │ │ │ │ +  verified_leaf_hashes
│ │ │ │ │ +      bit-fields indicating which v2 leaf hashes have been verified against the
│ │ │ │ │ +      root hash. If this vector is empty and merkle_trees is non-empty it
│ │ │ │ │ +      implies that all hashes in merkle_trees are verified.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  requests_in_buffer
│ │ │ │ │ -      the number of requests messages that are currently in the send buffer
│ │ │ │ │ -      waiting to be sent.
│ │ │ │ │ +  renamed_files
│ │ │ │ │ +      this is a map of file indices in the torrent and new filenames to be
│ │ │ │ │ +      applied before the torrent is added.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  target_dl_queue_length
│ │ │ │ │ -      the number of requests that is tried to be maintained (this is typically
│ │ │ │ │ -      a function of download speed)
│ │ │ │ │ +  last_download last_upload
│ │ │ │ │ +      the posix time of the last time payload was received or sent for this
│ │ │ │ │ +      torrent, respectively. A value of 0 means we don't know when we last
│ │ │ │ │ +      uploaded or downloaded, or we have never uploaded or downloaded any
│ │ │ │ │ +      payload for this torrent.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  upload_queue_length
│ │ │ │ │ -      the number of piece-requests we have received from this peer that we
│ │ │ │ │ -      haven't answered with a piece yet.
│ │ │ │ │ +************ cclliieenntt__ddaattaa__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_l_i_e_n_t___d_a_t_a_._h_p_p"
│ │ │ │ │ +A thin wrapper around a void pointer used as "user data". i.e. an opaque cookie
│ │ │ │ │ +passed in to libtorrent and returned on demand. It adds type-safety by
│ │ │ │ │ +requiring the same type be requested out of it as was assigned to it.
│ │ │ │ │ +struct client_data_t
│ │ │ │ │ +{
│ │ │ │ │ +   cclliieenntt__ddaattaa__tt () = default;
│ │ │ │ │ +   explicit cclliieenntt__ddaattaa__tt (T* v);
│ │ │ │ │ +   client_data_t& ooppeerraattoorr== (T* v);
│ │ │ │ │ +   explicit operator TT () const;
│ │ │ │ │ +   T* ggeett () const;
│ │ │ │ │ +   operator vvooiidd** () const = delete;
│ │ │ │ │ +   client_data_t& ooppeerraattoorr== (void const*) = delete;
│ │ │ │ │ +   client_data_t& ooppeerraattoorr== (void*) = delete;
│ │ │ │ │ +   operator void ccoonnsstt** () const = delete;
│ │ │ │ │ +
│ │ │ │ │ +   template <typename T, typename UU  = typename std::enable_if<std::
│ │ │ │ │ +is_pointer<T>::value>::type>
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  failcount
│ │ │ │ │ -      the number of times this peer has "failed". i.e. failed to connect or
│ │ │ │ │ -      disconnected us. The failcount is decremented when we see this peer in a
│ │ │ │ │ -      tracker response or peer exchange message.
│ │ │ │ │ +********** cclliieenntt__ddaattaa__tt(()) **********
│ │ │ │ │ +cclliieenntt__ddaattaa__tt () = default;
│ │ │ │ │ +construct a nullptr client data
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  downloading_piece_index downloading_block_index downloading_progress
│ │ │ │ │ -  downloading_total
│ │ │ │ │ -      You can know which piece, and which part of that piece, that is currently
│ │ │ │ │ -      being downloaded from a specific peer by looking at these four members.
│ │ │ │ │ -      downloading_piece_index is the index of the piece that is currently being
│ │ │ │ │ -      downloaded. This may be set to -1 if there's currently no piece
│ │ │ │ │ -      downloading from this peer. If it is >= 0, the other three members are
│ │ │ │ │ -      valid. downloading_block_index is the index of the block (or sub-piece)
│ │ │ │ │ -      that is being downloaded. downloading_progress is the number of bytes of
│ │ │ │ │ -      this block we have received from the peer, and downloading_total is the
│ │ │ │ │ -      total number of bytes in this block.
│ │ │ │ │ +********** ooppeerraattoorr==(()) ccoonnsstt**(()) vvooiidd**(()) **********
│ │ │ │ │ +operator vvooiidd** () const = delete;
│ │ │ │ │ +client_data_t& ooppeerraattoorr== (void const*) = delete;
│ │ │ │ │ +client_data_t& ooppeerraattoorr== (void*) = delete;
│ │ │ │ │ +operator void ccoonnsstt** () const = delete;
│ │ │ │ │ +we don't allow type-unsafe operations
│ │ │ │ │ +The disk I/O can be customized in libtorrent. In previous versions, the
│ │ │ │ │ +customization was at the level of each torrent. Now, the customization point is
│ │ │ │ │ +at the _s_e_s_s_i_o_n level. All torrents added to a _s_e_s_s_i_o_n will use the same disk I/
│ │ │ │ │ +O subsystem, as determined by the disk_io_constructor (in _s_e_s_s_i_o_n___p_a_r_a_m_s).
│ │ │ │ │ +This allows the disk subsystem to also customize threading and disk job
│ │ │ │ │ +management.
│ │ │ │ │ +To customize the disk subsystem, implement _d_i_s_k___i_n_t_e_r_f_a_c_e and provide a factory
│ │ │ │ │ +function to the _s_e_s_s_i_o_n constructor (via _s_e_s_s_i_o_n___p_a_r_a_m_s).
│ │ │ │ │ +Example use:
│ │ │ │ │ +struct temp_storage
│ │ │ │ │ +{
│ │ │ │ │ +  explicit temp_storage(lt::file_storage const& fs) : m_files(fs) {}
│ │ │ │ │ +
│ │ │ │ │ +  lt::span<char const> readv(lt::peer_request const r, lt::storage_error& ec)
│ │ │ │ │ +const
│ │ │ │ │ +  {
│ │ │ │ │ +    auto const i = m_file_data.find(r.piece);
│ │ │ │ │ +    if (i == m_file_data.end())
│ │ │ │ │ +    {
│ │ │ │ │ +      ec.operation = lt::operation_t::file_read;
│ │ │ │ │ +      ec.ec = boost::asio::error::eof;
│ │ │ │ │ +      return {};
│ │ │ │ │ +    }
│ │ │ │ │ +    if (int(i->second.size()) <= r.start)
│ │ │ │ │ +    {
│ │ │ │ │ +      ec.operation = lt::operation_t::file_read;
│ │ │ │ │ +      ec.ec = boost::asio::error::eof;
│ │ │ │ │ +      return {};
│ │ │ │ │ +    }
│ │ │ │ │ +    return { i->second.data() + r.start, std::min(r.length, int(i->second.size
│ │ │ │ │ +()) - r.start) };
│ │ │ │ │ +  }
│ │ │ │ │ +  void writev(lt::span<char const> const b, lt::piece_index_t const piece, int
│ │ │ │ │ +const offset)
│ │ │ │ │ +  {
│ │ │ │ │ +    auto& data = m_file_data[piece];
│ │ │ │ │ +    if (data.empty())
│ │ │ │ │ +    {
│ │ │ │ │ +      // allocate the whole piece, otherwise we'll invalidate the pointers
│ │ │ │ │ +      // we have returned back to libtorrent
│ │ │ │ │ +      int const size = piece_size(piece);
│ │ │ │ │ +      data.resize(std::size_t(size));
│ │ │ │ │ +    }
│ │ │ │ │ +    TORRENT_ASSERT(offset + b.size() <= int(data.size()));
│ │ │ │ │ +    std::memcpy(data.data() + offset, b.data(), std::size_t(b.size()));
│ │ │ │ │ +  }
│ │ │ │ │ +  lt::sha1_hash hash(lt::piece_index_t const piece
│ │ │ │ │ +    , lt::span<lt::sha256_hash> const block_hashes, lt::storage_error& ec)
│ │ │ │ │ +const
│ │ │ │ │ +  {
│ │ │ │ │ +    auto const i = m_file_data.find(piece);
│ │ │ │ │ +    if (i == m_file_data.end())
│ │ │ │ │ +    {
│ │ │ │ │ +      ec.operation = lt::operation_t::file_read;
│ │ │ │ │ +      ec.ec = boost::asio::error::eof;
│ │ │ │ │ +      return {};
│ │ │ │ │ +    }
│ │ │ │ │ +    if (!block_hashes.empty())
│ │ │ │ │ +    {
│ │ │ │ │ +      int const piece_size2 = m_files.piece_size2(piece);
│ │ │ │ │ +      int const blocks_in_piece2 = m_files.blocks_in_piece2(piece);
│ │ │ │ │ +      char const* buf = i->second.data();
│ │ │ │ │ +      std::int64_t offset = 0;
│ │ │ │ │ +      for (int k = 0; k < blocks_in_piece2; ++k)
│ │ │ │ │ +      {
│ │ │ │ │ +        lt::hasher256 h2;
│ │ │ │ │ +        std::ptrdiff_t const len2 = std::min(lt::default_block_size, int
│ │ │ │ │ +(piece_size2 - offset));
│ │ │ │ │ +        h2.update({ buf, len2 });
│ │ │ │ │ +        buf += len2;
│ │ │ │ │ +        offset += len2;
│ │ │ │ │ +        block_hashes[k] = h2.final();
│ │ │ │ │ +      }
│ │ │ │ │ +    }
│ │ │ │ │ +    return lt::hasher(i->second).final();
│ │ │ │ │ +  }
│ │ │ │ │ +  lt::sha256_hash hash2(lt::piece_index_t const piece, int const offset, lt::
│ │ │ │ │ +storage_error& ec)
│ │ │ │ │ +  {
│ │ │ │ │ +    auto const i = m_file_data.find(piece);
│ │ │ │ │ +    if (i == m_file_data.end())
│ │ │ │ │ +    {
│ │ │ │ │ +      ec.operation = lt::operation_t::file_read;
│ │ │ │ │ +      ec.ec = boost::asio::error::eof;
│ │ │ │ │ +      return {};
│ │ │ │ │ +    }
│ │ │ │ │ +
│ │ │ │ │ +    int const piece_size = m_files.piece_size2(piece);
│ │ │ │ │ +
│ │ │ │ │ +    std::ptrdiff_t const len = std::min(lt::default_block_size, piece_size -
│ │ │ │ │ +offset);
│ │ │ │ │ +
│ │ │ │ │ +    lt::span<char const> b = {i->second.data() + offset, len};
│ │ │ │ │ +    return lt::hasher256(b).final();
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +private:
│ │ │ │ │ +  int piece_size(lt::piece_index_t piece) const
│ │ │ │ │ +  {
│ │ │ │ │ +    int const num_pieces = static_cast<int>((m_files.total_size() +
│ │ │ │ │ +m_files.piece_length() - 1) / m_files.piece_length());
│ │ │ │ │ +    return static_cast<int>(piece) < num_pieces - 1
│ │ │ │ │ +      ? m_files.piece_length() : static_cast<int>(m_files.total_size() - std::
│ │ │ │ │ +int64_t(num_pieces - 1) * m_files.piece_length());
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  lt::file_storage const& m_files;
│ │ │ │ │ +  std::map<lt::piece_index_t, std::vector<char>> m_file_data;
│ │ │ │ │ +};
│ │ │ │ │ +
│ │ │ │ │ +lt::storage_index_t pop(std::vector<lt::storage_index_t>& q)
│ │ │ │ │ +{
│ │ │ │ │ +  TORRENT_ASSERT(!q.empty());
│ │ │ │ │ +  lt::storage_index_t const ret = q.back();
│ │ │ │ │ +  q.pop_back();
│ │ │ │ │ +  return ret;
│ │ │ │ │ +}
│ │ │ │ │ +
│ │ │ │ │ +struct temp_disk_io final : lt::disk_interface
│ │ │ │ │ +  , lt::buffer_allocator_interface
│ │ │ │ │ +{
│ │ │ │ │ +  explicit temp_disk_io(lt::io_context& ioc): m_ioc(ioc) {}
│ │ │ │ │ +
│ │ │ │ │ +  void settings_updated() override {}
│ │ │ │ │ +
│ │ │ │ │ +  lt::storage_holder new_torrent(lt::storage_params const& params
│ │ │ │ │ +    , std::shared_ptr<void> const&) override
│ │ │ │ │ +  {
│ │ │ │ │ +    lt::storage_index_t const idx = m_free_slots.empty()
│ │ │ │ │ +      ? m_torrents.end_index()
│ │ │ │ │ +      : pop(m_free_slots);
│ │ │ │ │ +    auto storage = std::make_unique<temp_storage>(params.files);
│ │ │ │ │ +    if (idx == m_torrents.end_index()) m_torrents.emplace_back(std::move
│ │ │ │ │ +(storage));
│ │ │ │ │ +    else m_torrents[idx] = std::move(storage);
│ │ │ │ │ +    return lt::storage_holder(idx, *this);
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void remove_torrent(lt::storage_index_t const idx) override
│ │ │ │ │ +  {
│ │ │ │ │ +    m_torrents[idx].reset();
│ │ │ │ │ +    m_free_slots.push_back(idx);
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void abort(bool) override {}
│ │ │ │ │ +
│ │ │ │ │ +  void async_read(lt::storage_index_t storage, lt::peer_request const& r
│ │ │ │ │ +    , std::function<void(lt::disk_buffer_holder block, lt::storage_error const&
│ │ │ │ │ +se)> handler
│ │ │ │ │ +    , lt::disk_job_flags_t) override
│ │ │ │ │ +  {
│ │ │ │ │ +    // this buffer is owned by the storage. It will remain valid for as
│ │ │ │ │ +    // long as the torrent remains in the session. We don't need any lifetime
│ │ │ │ │ +    // management of it.
│ │ │ │ │ +    lt::storage_error error;
│ │ │ │ │ +    lt::span<char const> b = m_torrents[storage]->readv(r, error);
│ │ │ │ │ +
│ │ │ │ │ +    post(m_ioc, [handler, error, b, this]
│ │ │ │ │ +      { handler(lt::disk_buffer_holder(*this, const_cast<char*>(b.data()), int
│ │ │ │ │ +(b.size())), error); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  bool async_write(lt::storage_index_t storage, lt::peer_request const& r
│ │ │ │ │ +    , char const* buf, std::shared_ptr<lt::disk_observer>
│ │ │ │ │ +    , std::function<void(lt::storage_error const&)> handler
│ │ │ │ │ +    , lt::disk_job_flags_t) override
│ │ │ │ │ +  {
│ │ │ │ │ +    lt::span<char const> const b = { buf, r.length };
│ │ │ │ │ +
│ │ │ │ │ +    m_torrents[storage]->writev(b, r.piece, r.start);
│ │ │ │ │ +
│ │ │ │ │ +    post(m_ioc, [=]{ handler(lt::storage_error()); });
│ │ │ │ │ +    return false;
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_hash(lt::storage_index_t storage, lt::piece_index_t const piece
│ │ │ │ │ +    , lt::span<lt::sha256_hash> block_hashes, lt::disk_job_flags_t
│ │ │ │ │ +    , std::function<void(lt::piece_index_t, lt::sha1_hash const&, lt::
│ │ │ │ │ +storage_error const&)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    lt::storage_error error;
│ │ │ │ │ +    lt::sha1_hash const hash = m_torrents[storage]->hash(piece, block_hashes,
│ │ │ │ │ +error);
│ │ │ │ │ +    post(m_ioc, [=]{ handler(piece, hash, error); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_hash2(lt::storage_index_t storage, lt::piece_index_t const piece
│ │ │ │ │ +    , int const offset, lt::disk_job_flags_t
│ │ │ │ │ +    , std::function<void(lt::piece_index_t, lt::sha256_hash const&, lt::
│ │ │ │ │ +storage_error const&)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    lt::storage_error error;
│ │ │ │ │ +    lt::sha256_hash const hash = m_torrents[storage]->hash2(piece, offset,
│ │ │ │ │ +error);
│ │ │ │ │ +    post(m_ioc, [=]{ handler(piece, hash, error); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_move_storage(lt::storage_index_t, std::string p, lt::move_flags_t
│ │ │ │ │ +    , std::function<void(lt::status_t, std::string const&, lt::storage_error
│ │ │ │ │ +const&)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{
│ │ │ │ │ +      handler(lt::status_t::fatal_disk_error, p
│ │ │ │ │ +        , lt::storage_error(lt::error_code(boost::system::errc::
│ │ │ │ │ +operation_not_supported, lt::system_category())));
│ │ │ │ │ +    });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_release_files(lt::storage_index_t, std::function<void()>) override
│ │ │ │ │ +{}
│ │ │ │ │ +
│ │ │ │ │ +  void async_delete_files(lt::storage_index_t, lt::remove_flags_t
│ │ │ │ │ +    , std::function<void(lt::storage_error const&)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{ handler(lt::storage_error()); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_check_files(lt::storage_index_t
│ │ │ │ │ +    , lt::add_torrent_params const*
│ │ │ │ │ +    , lt::aux::vector<std::string, lt::file_index_t>
│ │ │ │ │ +    , std::function<void(lt::status_t, lt::storage_error const&)> handler)
│ │ │ │ │ +override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{ handler(lt::status_t::no_error, lt::storage_error()); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_rename_file(lt::storage_index_t
│ │ │ │ │ +    , lt::file_index_t const idx
│ │ │ │ │ +    , std::string const name
│ │ │ │ │ +    , std::function<void(std::string const&, lt::file_index_t, lt::
│ │ │ │ │ +storage_error const&)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{ handler(name, idx, lt::storage_error()); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_stop_torrent(lt::storage_index_t, std::function<void()> handler)
│ │ │ │ │ +override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, handler);
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_set_file_priority(lt::storage_index_t
│ │ │ │ │ +    , lt::aux::vector<lt::download_priority_t, lt::file_index_t> prio
│ │ │ │ │ +    , std::function<void(lt::storage_error const&
│ │ │ │ │ +      , lt::aux::vector<lt::download_priority_t, lt::file_index_t>)> handler)
│ │ │ │ │ +override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{
│ │ │ │ │ +      handler(lt::storage_error(lt::error_code(
│ │ │ │ │ +        boost::system::errc::operation_not_supported, lt::system_category())),
│ │ │ │ │ +std::move(prio));
│ │ │ │ │ +    });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void async_clear_piece(lt::storage_index_t, lt::piece_index_t index
│ │ │ │ │ +    , std::function<void(lt::piece_index_t)> handler) override
│ │ │ │ │ +  {
│ │ │ │ │ +    post(m_ioc, [=]{ handler(index); });
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  // implements buffer_allocator_interface
│ │ │ │ │ +  void free_disk_buffer(char*) override
│ │ │ │ │ +  {
│ │ │ │ │ +    // never free any buffer. We only return buffers owned by the storage
│ │ │ │ │ +    // object
│ │ │ │ │ +  }
│ │ │ │ │ +
│ │ │ │ │ +  void update_stats_counters(lt::counters&) const override {}
│ │ │ │ │ +
│ │ │ │ │ +  std::vector<lt::open_file_state> get_status(lt::storage_index_t) const
│ │ │ │ │ +override
│ │ │ │ │ +  { return {}; }
│ │ │ │ │ +
│ │ │ │ │ +  void submit_jobs() override {}
│ │ │ │ │ +
│ │ │ │ │ +private:
│ │ │ │ │ +
│ │ │ │ │ +  lt::aux::vector<std::shared_ptr<temp_storage>, lt::storage_index_t>
│ │ │ │ │ +m_torrents;
│ │ │ │ │ +
│ │ │ │ │ +  // slots that are unused in the m_torrents vector
│ │ │ │ │ +  std::vector<lt::storage_index_t> m_free_slots;
│ │ │ │ │ +
│ │ │ │ │ +  // callbacks are posted on this
│ │ │ │ │ +  lt::io_context& m_ioc;
│ │ │ │ │ +};
│ │ │ │ │ +
│ │ │ │ │ +std::unique_ptr<lt::disk_interface> temp_disk_constructor(
│ │ │ │ │ +  lt::io_context& ioc, lt::settings_interface const&, lt::counters&)
│ │ │ │ │ +{
│ │ │ │ │ +  return std::make_unique<temp_disk_io>(ioc);
│ │ │ │ │ +}
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  standard_bittorrent
│ │ │ │ │ -      Regular bittorrent connection
│ │ │ │ │ +************ sseettttiinnggss__iinntteerrffaaccee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ +the common interface to _s_e_t_t_i_n_g_s___p_a_c_k and the internal representation of
│ │ │ │ │ +settings.
│ │ │ │ │ +struct settings_interface
│ │ │ │ │ +{
│ │ │ │ │ +   virtual void sseett__iinntt (int name, int val) = 0;
│ │ │ │ │ +   virtual bool hhaass__vvaall (int name) const = 0;
│ │ │ │ │ +   virtual void sseett__bbooooll (int name, bool val) = 0;
│ │ │ │ │ +   virtual void sseett__ssttrr (int name, std::string val) = 0;
│ │ │ │ │ +   virtual bool ggeett__bbooooll (int name) const = 0;
│ │ │ │ │ +   virtual int ggeett__iinntt (int name) const = 0;
│ │ │ │ │ +   virtual std::string const& ggeett__ssttrr (int name) const = 0;
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  web_seed
│ │ │ │ │ -      HTTP connection using the _B_E_P_ _1_9 protocol
│ │ │ │ │ +************ bbuuffffeerr__aallllooccaattoorr__iinntteerrffaaccee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_._h_p_p"
│ │ │ │ │ +the interface for freeing disk buffers, used by the _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r. when
│ │ │ │ │ +implementing _d_i_s_k___i_n_t_e_r_f_a_c_e, this must also be implemented in order to return
│ │ │ │ │ +disk buffers back to libtorrent
│ │ │ │ │ +struct buffer_allocator_interface
│ │ │ │ │ +{
│ │ │ │ │ +   virtual void ffrreeee__ddiisskk__bbuuffffeerr (char* b) = 0;
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  http_seed
│ │ │ │ │ -      HTTP connection using the _B_E_P_ _1_7 protocol
│ │ │ │ │ +************ ddiisskk__bbuuffffeerr__hhoollddeerr ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_._h_p_p"
│ │ │ │ │ +The disk buffer holder acts like a unique_ptr that frees a disk buffer when
│ │ │ │ │ +it's destructed
│ │ │ │ │ +If this buffer holder is moved-from, default constructed or reset, data() will
│ │ │ │ │ +return nullptr.
│ │ │ │ │ +struct disk_buffer_holder
│ │ │ │ │ +{
│ │ │ │ │ +   disk_buffer_holder& ooppeerraattoorr== (disk_buffer_holder&&) & noexcept;
│ │ │ │ │ +   ddiisskk__bbuuffffeerr__hhoollddeerr (disk_buffer_holder&&) noexcept;
│ │ │ │ │ +   ddiisskk__bbuuffffeerr__hhoollddeerr (disk_buffer_holder const&) = delete;
│ │ │ │ │ +   disk_buffer_holder& ooppeerraattoorr== (disk_buffer_holder const&) = delete;
│ │ │ │ │ +   ddiisskk__bbuuffffeerr__hhoollddeerr (buffer_allocator_interface& alloc
│ │ │ │ │ +      , char* buf, int sz) noexcept;
│ │ │ │ │ +   ddiisskk__bbuuffffeerr__hhoollddeerr () noexcept = default;
│ │ │ │ │ +   ~~ddiisskk__bbuuffffeerr__hhoollddeerr ();
│ │ │ │ │ +   char* ddaattaa () const noexcept;
│ │ │ │ │ +   void rreesseett ();
│ │ │ │ │ +   void sswwaapp (disk_buffer_holder& h) noexcept;
│ │ │ │ │ +   bool iiss__mmuuttaabbllee () const noexcept;
│ │ │ │ │ +   explicit operator bbooooll () const noexcept;
│ │ │ │ │ +   std::ptrdiff_t ssiizzee () const;
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  connection_type
│ │ │ │ │ -      the kind of connection this peer uses. See connection_type_t.
│ │ │ │ │ +********** ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ +ddiisskk__bbuuffffeerr__hhoollddeerr (buffer_allocator_interface& alloc
│ │ │ │ │ +      , char* buf, int sz) noexcept;
│ │ │ │ │ +construct a buffer holder that will free the held buffer using a disk buffer
│ │ │ │ │ +pool directly (there's only one disk_buffer_pool per _s_e_s_s_i_o_n)
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  pending_disk_bytes
│ │ │ │ │ -      the number of bytes this peer has pending in the disk-io thread.
│ │ │ │ │ -      Downloaded and waiting to be written to disk. This is what is capped by
│ │ │ │ │ -      settings_pack::max_queued_disk_bytes.
│ │ │ │ │ +********** ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ +ddiisskk__bbuuffffeerr__hhoollddeerr () noexcept = default;
│ │ │ │ │ +default construct a holder that does not own any buffer
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  pending_disk_read_bytes
│ │ │ │ │ -      number of outstanding bytes to read from disk
│ │ │ │ │ +********** ~~ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ +~~ddiisskk__bbuuffffeerr__hhoollddeerr ();
│ │ │ │ │ +frees disk buffer held by this object
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  send_quota receive_quota
│ │ │ │ │ -      the number of bytes this peer has been assigned to be allowed to send and
│ │ │ │ │ -      receive until it has to request more quota from the bandwidth manager.
│ │ │ │ │ +********** ddaattaa(()) **********
│ │ │ │ │ +char* ddaattaa () const noexcept;
│ │ │ │ │ +return a pointer to the held buffer, if any. Otherwise returns nullptr.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  rtt
│ │ │ │ │ -      an estimated round trip time to this peer, in milliseconds. It is
│ │ │ │ │ -      estimated by timing the TCP connect(). It may be 0 for incoming
│ │ │ │ │ -      connections.
│ │ │ │ │ +********** rreesseett(()) **********
│ │ │ │ │ +void rreesseett ();
│ │ │ │ │ +free the held disk buffer, if any, and clear the holder. This sets the holder
│ │ │ │ │ +object to a default-constructed state
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  num_pieces
│ │ │ │ │ -      the number of pieces this peer has.
│ │ │ │ │ +********** sswwaapp(()) **********
│ │ │ │ │ +void sswwaapp (disk_buffer_holder& h) noexcept;
│ │ │ │ │ +swap pointers of two disk buffer holders.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  download_rate_peak upload_rate_peak
│ │ │ │ │ -      the highest download and upload rates seen on this connection. They are
│ │ │ │ │ -      given in bytes per second. This number is reset to 0 on reconnect.
│ │ │ │ │ +********** iiss__mmuuttaabbllee(()) **********
│ │ │ │ │ +bool iiss__mmuuttaabbllee () const noexcept;
│ │ │ │ │ +if this returns true, the buffer may not be modified in place
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  progress
│ │ │ │ │ -      the progress of the peer in the range [0, 1]. This is always 0 when
│ │ │ │ │ -      floating point operations are disabled, instead use progress_ppm.
│ │ │ │ │ +********** bbooooll(()) **********
│ │ │ │ │ +explicit operator bbooooll () const noexcept;
│ │ │ │ │ +implicitly convertible to true if the object is currently holding a buffer
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  progress_ppm
│ │ │ │ │ -      indicates the download progress of the peer in the range [0, 1000000]
│ │ │ │ │ -      (parts per million).
│ │ │ │ │ +************ ooppeenn__ffiillee__ssttaattee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___i_n_t_e_r_f_a_c_e_._h_p_p"
│ │ │ │ │ +this contains information about a file that's currently open by the libtorrent
│ │ │ │ │ +disk I/O subsystem. It's associated with a single torrent.
│ │ │ │ │ +struct open_file_state
│ │ │ │ │ +{
│ │ │ │ │ +   file_index_t file_index;
│ │ │ │ │ +   file_open_mode_t open_mode;
│ │ │ │ │ +   time_point last_use;
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  ip
│ │ │ │ │ -      the IP-address to this peer. The type is an asio endpoint. For more info,
│ │ │ │ │ -      see the _a_s_i_o documentation. This field is not valid for i2p peers.
│ │ │ │ │ -      Instead use the _i_2_p___d_e_s_t_i_n_a_t_i_o_n_(_) function.
│ │ │ │ │ +  file_index
│ │ │ │ │ +      the index of the file this _e_n_t_r_y refers to into the file_storage file
│ │ │ │ │ +      list of this torrent. This starts indexing at 0.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  local_endpoint
│ │ │ │ │ -      the IP and port pair the socket is bound to locally. i.e. the IP address
│ │ │ │ │ -      of the interface it's going out over. This may be useful for multi-homed
│ │ │ │ │ -      clients with multiple interfaces to the internet. This field is not valid
│ │ │ │ │ -      for i2p peers.
│ │ │ │ │ +  open_mode
│ │ │ │ │ +      open_mode is a bitmask of the file flags this file is currently opened
│ │ │ │ │ +      with. For possible flags, see _f_i_l_e___o_p_e_n___m_o_d_e___t.
│ │ │ │ │ +      Note that the read/write mode is not a bitmask. The two least significant
│ │ │ │ │ +      bits are used to represent the read/write mode. Those bits can be masked
│ │ │ │ │ +      out using the rw_mask constant.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  last_use
│ │ │ │ │ +      a (high precision) timestamp of when the file was last used.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ddiisskk__iinntteerrffaaccee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___i_n_t_e_r_f_a_c_e_._h_p_p"
│ │ │ │ │ +The _d_i_s_k___i_n_t_e_r_f_a_c_e is the customization point for disk I/O in libtorrent.
│ │ │ │ │ +implement this interface and provide a factory function to the _s_e_s_s_i_o_n
│ │ │ │ │ +constructor use custom disk I/O. All functions on the disk subsystem
│ │ │ │ │ +(implementing _d_i_s_k___i_n_t_e_r_f_a_c_e) are called from within libtorrent's network
│ │ │ │ │ +thread. For disk I/O to be performed in a separate thread, the disk subsystem
│ │ │ │ │ +has to manage that itself.
│ │ │ │ │ +Although the functions are called async_*, they do not technically hhaavvee to be
│ │ │ │ │ +asynchronous, but they support being asynchronous, by expecting the result
│ │ │ │ │ +passed back into a callback. The callbacks must be posted back onto the network
│ │ │ │ │ +thread via the io_context object passed into the constructor. The callbacks
│ │ │ │ │ +will be run in the network thread.
│ │ │ │ │ +struct disk_interface
│ │ │ │ │ +{
│ │ │ │ │ +   virtual storage_holder nneeww__ttoorrrreenntt (storage_params const& p
│ │ │ │ │ +      , std::shared_ptr<void> const& torrent) = 0;
│ │ │ │ │ +   virtual void rreemmoovvee__ttoorrrreenntt (storage_index_t) = 0;
│ │ │ │ │ +   virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r
│ │ │ │ │ +      , std::function<void(disk_buffer_holder, storage_error const&)> handler
│ │ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │ +   virtual bool aassyynncc__wwrriittee (storage_index_t storage, peer_request const& r
│ │ │ │ │ +      , char const* buf, std::shared_ptr<disk_observer> o
│ │ │ │ │ +      , std::function<void(storage_error const&)> handler
│ │ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │ +   virtual void aassyynncc__hhaasshh (storage_index_t storage, piece_index_t piece,
│ │ │ │ │ +span<sha256_hash> v2
│ │ │ │ │ +      , disk_job_flags_t flags
│ │ │ │ │ +      , std::function<void(piece_index_t, sha1_hash const&, storage_error
│ │ │ │ │ +const&)> handler) = 0;
│ │ │ │ │ +   virtual void aassyynncc__hhaasshh22 (storage_index_t storage, piece_index_t piece, int
│ │ │ │ │ +offset, disk_job_flags_t flags
│ │ │ │ │ +      , std::function<void(piece_index_t, sha256_hash const&, storage_error
│ │ │ │ │ +const&)> handler) = 0;
│ │ │ │ │ +   virtual void aassyynncc__mmoovvee__ssttoorraaggee (storage_index_t storage, std::string p,
│ │ │ │ │ +move_flags_t flags
│ │ │ │ │ +      , std::function<void(status_t, std::string const&, storage_error const&)>
│ │ │ │ │ +handler) = 0;
│ │ │ │ │ +   virtual void aassyynncc__rreelleeaassee__ffiilleess (storage_index_t storage
│ │ │ │ │ +      , std::function<void()> handler = std::function<void()>()) = 0;
│ │ │ │ │ +   virtual void aassyynncc__cchheecckk__ffiilleess (storage_index_t storage
│ │ │ │ │ +      , add_torrent_params const* resume_data
│ │ │ │ │ +      , aux::vector<std::string, file_index_t> links
│ │ │ │ │ +      , std::function<void(status_t, storage_error const&)> handler) = 0;
│ │ │ │ │ +   virtual void aassyynncc__ssttoopp__ttoorrrreenntt (storage_index_t storage
│ │ │ │ │ +      , std::function<void()> handler = std::function<void()>()) = 0;
│ │ │ │ │ +   virtual void aassyynncc__rreennaammee__ffiillee (storage_index_t storage
│ │ │ │ │ +      , file_index_t index, std::string name
│ │ │ │ │ +      , std::function<void(std::string const&, file_index_t, storage_error
│ │ │ │ │ +const&)> handler) = 0;
│ │ │ │ │ +   virtual void aassyynncc__ddeelleettee__ffiilleess (storage_index_t storage, remove_flags_t
│ │ │ │ │ +options
│ │ │ │ │ +      , std::function<void(storage_error const&)> handler) = 0;
│ │ │ │ │ +   virtual void aassyynncc__sseett__ffiillee__pprriioorriittyy (storage_index_t storage
│ │ │ │ │ +      , aux::vector<download_priority_t, file_index_t> prio
│ │ │ │ │ +      , std::function<void(storage_error const&
│ │ │ │ │ +      , aux::vector<download_priority_t, file_index_t>)> handler) = 0;
│ │ │ │ │ +   virtual void aassyynncc__cclleeaarr__ppiieeccee (storage_index_t storage, piece_index_t index
│ │ │ │ │ +      , std::function<void(piece_index_t)> handler) = 0;
│ │ │ │ │ +   virtual void uuppddaattee__ssttaattss__ccoouunntteerrss (counters& c) const = 0;
│ │ │ │ │ +   virtual std::vector<open_file_state> ggeett__ssttaattuuss (storage_index_t) const = 0;
│ │ │ │ │ +   virtual void aabboorrtt (bool wait) = 0;
│ │ │ │ │ +   virtual void ssuubbmmiitt__jjoobbss () = 0;
│ │ │ │ │ +   virtual void sseettttiinnggss__uuppddaatteedd () = 0;
│ │ │ │ │ +
│ │ │ │ │ +   static constexpr disk_job_flags_t ffoorrccee__ccooppyy  = 0_bit;
│ │ │ │ │ +   static constexpr disk_job_flags_t sseeqquueennttiiaall__aacccceessss  = 3_bit;
│ │ │ │ │ +   static constexpr disk_job_flags_t vvoollaattiillee__rreeaadd  = 4_bit;
│ │ │ │ │ +   static constexpr disk_job_flags_t vv11__hhaasshh  = 5_bit;
│ │ │ │ │ +   static constexpr disk_job_flags_t fflluusshh__ppiieeccee  = 7_bit;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** nneeww__ttoorrrreenntt(()) **********
│ │ │ │ │ +virtual storage_holder nneeww__ttoorrrreenntt (storage_params const& p
│ │ │ │ │ +      , std::shared_ptr<void> const& torrent) = 0;
│ │ │ │ │ +this is called when a new torrent is added. The shared_ptr can be used to hold
│ │ │ │ │ +the internal torrent object alive as long as there are outstanding disk
│ │ │ │ │ +operations on the storage. The returned _s_t_o_r_a_g_e___h_o_l_d_e_r is an owning reference
│ │ │ │ │ +to the underlying storage that was just created. It is fundamentally a
│ │ │ │ │ +storage_index_t
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** rreemmoovvee__ttoorrrreenntt(()) **********
│ │ │ │ │ +virtual void rreemmoovvee__ttoorrrreenntt (storage_index_t) = 0;
│ │ │ │ │ +remove the storage with the specified index. This is not expected to delete any
│ │ │ │ │ +files from disk, just to clean up any resources associated with the specified
│ │ │ │ │ +storage.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__rreeaadd(()) aassyynncc__wwrriittee(()) **********
│ │ │ │ │ +virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r
│ │ │ │ │ +      , std::function<void(disk_buffer_holder, storage_error const&)> handler
│ │ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │ +virtual bool aassyynncc__wwrriittee (storage_index_t storage, peer_request const& r
│ │ │ │ │ +      , char const* buf, std::shared_ptr<disk_observer> o
│ │ │ │ │ +      , std::function<void(storage_error const&)> handler
│ │ │ │ │ +      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │ +perform a read or write operation from/to the specified storage index and the
│ │ │ │ │ +specified request. When the operation completes, call handler possibly with a
│ │ │ │ │ +_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r, holding the buffer with the result. Flags may be set to
│ │ │ │ │ +affect the read operation. See disk_job_flags_t.
│ │ │ │ │ +The _d_i_s_k___o_b_s_e_r_v_e_r is a callback to indicate that the store buffer/disk write
│ │ │ │ │ +queue is below the watermark to let peers start writing buffers to disk again.
│ │ │ │ │ +When async_write() returns true, indicating the write queue is full, the peer
│ │ │ │ │ +will stop further writes and wait for the passed-in disk_observer to be
│ │ │ │ │ +notified before resuming.
│ │ │ │ │ +Note that for async_read, the _p_e_e_r___r_e_q_u_e_s_t (r) is not necessarily aligned to
│ │ │ │ │ +blocks (but it is most of the time). However, all writes (passed to
│ │ │ │ │ +async_write) are guaranteed to be block aligned.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__hhaasshh(()) **********
│ │ │ │ │ +virtual void aassyynncc__hhaasshh (storage_index_t storage, piece_index_t piece,
│ │ │ │ │ +span<sha256_hash> v2
│ │ │ │ │ +      , disk_job_flags_t flags
│ │ │ │ │ +      , std::function<void(piece_index_t, sha1_hash const&, storage_error
│ │ │ │ │ +const&)> handler) = 0;
│ │ │ │ │ +Compute hash(es) for the specified piece. Unless the v1_hash flag is set (in
│ │ │ │ │ +flags), the SHA-1 hash of the whole piece does not need to be computed.
│ │ │ │ │ +Thev2span is optional and can be empty, which means v2 hashes should not be
│ │ │ │ │ +computed. If v2 is non-empty it must be at least large enough to hold all v2
│ │ │ │ │ +blocks in the piece, and this function will fill in the span with the SHA-256
│ │ │ │ │ +block hashes of the piece.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__hhaasshh22(()) **********
│ │ │ │ │ +virtual void aassyynncc__hhaasshh22 (storage_index_t storage, piece_index_t piece, int
│ │ │ │ │ +offset, disk_job_flags_t flags
│ │ │ │ │ +      , std::function<void(piece_index_t, sha256_hash const&, storage_error
│ │ │ │ │ +const&)> handler) = 0;
│ │ │ │ │ +computes the v2 hash (SHA-256) of a single block. The block at offset in piece
│ │ │ │ │ +piece.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__mmoovvee__ssttoorraaggee(()) **********
│ │ │ │ │ +virtual void aassyynncc__mmoovvee__ssttoorraaggee (storage_index_t storage, std::string p,
│ │ │ │ │ +move_flags_t flags
│ │ │ │ │ +      , std::function<void(status_t, std::string const&, storage_error const&)>
│ │ │ │ │ +handler) = 0;
│ │ │ │ │ +called to request the files for the specified storage/torrent be moved to a new
│ │ │ │ │ +location. It is the disk I/O object's responsibility to synchronize this with
│ │ │ │ │ +any currently outstanding disk operations to the storage. Whether files are
│ │ │ │ │ +replaced at the destination path or not is controlled by flags (see
│ │ │ │ │ +_m_o_v_e___f_l_a_g_s___t).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__rreelleeaassee__ffiilleess(()) **********
│ │ │ │ │ +virtual void aassyynncc__rreelleeaassee__ffiilleess (storage_index_t storage
│ │ │ │ │ +      , std::function<void()> handler = std::function<void()>()) = 0;
│ │ │ │ │ +This is called on disk I/O objects to request they close all open files for the
│ │ │ │ │ +specified storage/torrent. If file handles are not pooled/cached, it can be a
│ │ │ │ │ +no-op. For truly asynchronous disk I/O, this should provide at least one point
│ │ │ │ │ +in time when all files are closed. It is possible that later asynchronous
│ │ │ │ │ +operations will re-open some of the files, by the time this completion handler
│ │ │ │ │ +is called, that's fine.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__cchheecckk__ffiilleess(()) **********
│ │ │ │ │ +virtual void aassyynncc__cchheecckk__ffiilleess (storage_index_t storage
│ │ │ │ │ +      , add_torrent_params const* resume_data
│ │ │ │ │ +      , aux::vector<std::string, file_index_t> links
│ │ │ │ │ +      , std::function<void(status_t, storage_error const&)> handler) = 0;
│ │ │ │ │ +this is called when torrents are added to validate their resume data against
│ │ │ │ │ +the files on disk. This function is expected to do a few things:
│ │ │ │ │ +if links is non-empty, it contains a string for each file in the torrent. The
│ │ │ │ │ +string being a path to an existing identical file. The default behavior is to
│ │ │ │ │ +create hard links of those files into the storage of the new torrent (specified
│ │ │ │ │ +by storage). An empty string indicates that there is no known identical file.
│ │ │ │ │ +This is part of the "mutable torrent" feature, where files can be reused from
│ │ │ │ │ +other torrents.
│ │ │ │ │ +The resume_data points the resume data passed in by the client.
│ │ │ │ │ +If the resume_data->flags field has the seed_mode flag set, all files/pieces
│ │ │ │ │ +are expected to be on disk already. This should be verified. Not just the
│ │ │ │ │ +existence of the file, but also that it has the correct size.
│ │ │ │ │ +Any file with a piece set in the resume_data->have_pieces bitmask should exist
│ │ │ │ │ +on disk, this should be verified. Pad files and files with zero priority may be
│ │ │ │ │ +skipped.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__ssttoopp__ttoorrrreenntt(()) **********
│ │ │ │ │ +virtual void aassyynncc__ssttoopp__ttoorrrreenntt (storage_index_t storage
│ │ │ │ │ +      , std::function<void()> handler = std::function<void()>()) = 0;
│ │ │ │ │ +This is called when a torrent is stopped. It gives the disk I/O object an
│ │ │ │ │ +opportunity to flush any data to disk that's currently kept cached. This
│ │ │ │ │ +function should at least do the same thing as _a_s_y_n_c___r_e_l_e_a_s_e___f_i_l_e_s_(_).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__rreennaammee__ffiillee(()) **********
│ │ │ │ │ +virtual void aassyynncc__rreennaammee__ffiillee (storage_index_t storage
│ │ │ │ │ +      , file_index_t index, std::string name
│ │ │ │ │ +      , std::function<void(std::string const&, file_index_t, storage_error
│ │ │ │ │ +const&)> handler) = 0;
│ │ │ │ │ +This function is called when the name of a file in the specified storage has
│ │ │ │ │ +been requested to be renamed. The disk I/O object is responsible for renaming
│ │ │ │ │ +the file without racing with other potentially outstanding operations against
│ │ │ │ │ +the file (such as read, write, move, etc.).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__ddeelleettee__ffiilleess(()) **********
│ │ │ │ │ +virtual void aassyynncc__ddeelleettee__ffiilleess (storage_index_t storage, remove_flags_t
│ │ │ │ │ +options
│ │ │ │ │ +      , std::function<void(storage_error const&)> handler) = 0;
│ │ │ │ │ +This function is called when some file(s) on disk have been requested to be
│ │ │ │ │ +removed by the client. storage indicates which torrent is referred to. See
│ │ │ │ │ +_s_e_s_s_i_o_n___h_a_n_d_l_e for remove_flags_t flags indicating which files are to be
│ │ │ │ │ +removed. e.g. _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_d_e_l_e_t_e___f_i_l_e_s - delete all files _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:
│ │ │ │ │ +_d_e_l_e_t_e___p_a_r_t_f_i_l_e - only delete part file.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__sseett__ffiillee__pprriioorriittyy(()) **********
│ │ │ │ │ +virtual void aassyynncc__sseett__ffiillee__pprriioorriittyy (storage_index_t storage
│ │ │ │ │ +      , aux::vector<download_priority_t, file_index_t> prio
│ │ │ │ │ +      , std::function<void(storage_error const&
│ │ │ │ │ +      , aux::vector<download_priority_t, file_index_t>)> handler) = 0;
│ │ │ │ │ +This is called to set the priority of some or all files. Changing the priority
│ │ │ │ │ +from or to 0 may involve moving data to and from the partfile. The disk I/
│ │ │ │ │ +O object is responsible for correctly synchronizing this work to not race with
│ │ │ │ │ +any potentially outstanding asynchronous operations affecting these files.
│ │ │ │ │ +prio is a vector of the file priority for all files. If it's shorter than the
│ │ │ │ │ +total number of files in the torrent, they are assumed to be set to the default
│ │ │ │ │ +priority.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aassyynncc__cclleeaarr__ppiieeccee(()) **********
│ │ │ │ │ +virtual void aassyynncc__cclleeaarr__ppiieeccee (storage_index_t storage, piece_index_t index
│ │ │ │ │ +      , std::function<void(piece_index_t)> handler) = 0;
│ │ │ │ │ +This is called when a piece fails the hash check, to ensure there are no
│ │ │ │ │ +outstanding disk operations to the piece before blocks are re-requested from
│ │ │ │ │ +peers to overwrite the existing blocks. The disk I/O object does not need to
│ │ │ │ │ +perform any action other than synchronize with all outstanding disk operations
│ │ │ │ │ +to the specified piece before posting the result back.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** uuppddaattee__ssttaattss__ccoouunntteerrss(()) **********
│ │ │ │ │ +virtual void uuppddaattee__ssttaattss__ccoouunntteerrss (counters& c) const = 0;
│ │ │ │ │ +_u_p_d_a_t_e___s_t_a_t_s___c_o_u_n_t_e_r_s_(_) is called to give the disk storage an opportunity to
│ │ │ │ │ +update gauges in the c stats _c_o_u_n_t_e_r_s, that aren't updated continuously as
│ │ │ │ │ +operations are performed. This is called before a snapshot of the _c_o_u_n_t_e_r_s are
│ │ │ │ │ +passed to the client.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ggeett__ssttaattuuss(()) **********
│ │ │ │ │ +virtual std::vector<open_file_state> ggeett__ssttaattuuss (storage_index_t) const = 0;
│ │ │ │ │ +Return a list of all the files that are currently open for the specified
│ │ │ │ │ +storage/torrent. This is is just used for the client to query the currently
│ │ │ │ │ +open files, and which modes those files are open in.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aabboorrtt(()) **********
│ │ │ │ │ +virtual void aabboorrtt (bool wait) = 0;
│ │ │ │ │ +this is called when the _s_e_s_s_i_o_n is starting to shut down. The disk I/O object
│ │ │ │ │ +is expected to flush any outstanding write jobs, cancel hash jobs and initiate
│ │ │ │ │ +tearing down of any internal threads. If wait is true, this should be
│ │ │ │ │ +asynchronous. i.e. this call should not return until all threads have stopped
│ │ │ │ │ +and all jobs have either been aborted or completed and the disk I/O object is
│ │ │ │ │ +ready to be destructed.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ssuubbmmiitt__jjoobbss(()) **********
│ │ │ │ │ +virtual void ssuubbmmiitt__jjoobbss () = 0;
│ │ │ │ │ +This will be called after a batch of disk jobs has been issues (via the async_*
│ │ │ │ │ +). It gives the disk I/O object an opportunity to notify any potential
│ │ │ │ │ +condition variables to wake up the disk thread(s). The async_* calls can of
│ │ │ │ │ +course also notify condition variables, but doing it in this call allows for
│ │ │ │ │ +batching jobs, by issuing the notification once for a collection of jobs.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sseettttiinnggss__uuppddaatteedd(()) **********
│ │ │ │ │ +virtual void sseettttiinnggss__uuppddaatteedd () = 0;
│ │ │ │ │ +This is called to notify the disk I/O object that the settings have been
│ │ │ │ │ +updated. In the disk io constructor, a _s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e reference is passed
│ │ │ │ │ +in. Whenever these settings are updated, this function is called to allow the
│ │ │ │ │ +disk I/O object to react to any changed settings relevant to its operations.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  force_copy
│ │ │ │ │ +      force making a copy of the cached block, rather than getting a reference
│ │ │ │ │ +      to a block already in the cache. This is used the block is expected to be
│ │ │ │ │ +      overwritten very soon, by async_write()`, and we need access to the
│ │ │ │ │ +      previous content.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  sequential_access
│ │ │ │ │ +      hint that there may be more disk operations with sequential access to the
│ │ │ │ │ +      file
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  volatile_read
│ │ │ │ │ +      don't keep the read block in cache. This is a hint that this block is
│ │ │ │ │ +      unlikely to be read again anytime soon, and caching it would be wasteful.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  v1_hash
│ │ │ │ │ +      compute a v1 piece hash. This is only used by the _a_s_y_n_c___h_a_s_h_(_) call. If
│ │ │ │ │ +      this flag is not set in the _a_s_y_n_c___h_a_s_h_(_) call, the SHA-1 piece hash does
│ │ │ │ │ +      not need to be computed.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  flush_piece
│ │ │ │ │ +      this flag instructs a hash job that we just completed this piece, and it
│ │ │ │ │ +      should be flushed to disk
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ssttoorraaggee__hhoollddeerr ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___i_n_t_e_r_f_a_c_e_._h_p_p"
│ │ │ │ │ +a unique, owning, reference to the storage of a torrent in a disk io subsystem
│ │ │ │ │ +(class that implements _d_i_s_k___i_n_t_e_r_f_a_c_e). This is held by the internal libtorrent
│ │ │ │ │ +torrent object to tie the storage object allocated for a torrent to the
│ │ │ │ │ +lifetime of the internal torrent object. When a torrent is removed from the
│ │ │ │ │ +_s_e_s_s_i_o_n, this holder is destructed and will inform the disk object.
│ │ │ │ │ +struct storage_holder
│ │ │ │ │ +{
│ │ │ │ │ +   ssttoorraaggee__hhoollddeerr () = default;
│ │ │ │ │ +   ssttoorraaggee__hhoollddeerr (storage_index_t idx, disk_interface& disk_io);
│ │ │ │ │ +   ~~ssttoorraaggee__hhoollddeerr ();
│ │ │ │ │ +   explicit operator bbooooll () const;
│ │ │ │ │ +   operator ssttoorraaggee__iinnddeexx__tt () const;
│ │ │ │ │ +   void rreesseett ();
│ │ │ │ │ +   ssttoorraaggee__hhoollddeerr (storage_holder const&) = delete;
│ │ │ │ │ +   storage_holder& ooppeerraattoorr== (storage_holder const&) = delete;
│ │ │ │ │ +   ssttoorraaggee__hhoollddeerr (storage_holder&& rhs) noexcept;
│ │ │ │ │ +   storage_holder& ooppeerraattoorr== (storage_holder&& rhs) noexcept;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ddiisskk__oobbsseerrvveerr ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___o_b_s_e_r_v_e_r_._h_p_p"
│ │ │ │ │ +struct disk_observer
│ │ │ │ │ +{
│ │ │ │ │ +   virtual void oonn__ddiisskk () = 0;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** oonn__ddiisskk(()) **********
│ │ │ │ │ +virtual void oonn__ddiisskk () = 0;
│ │ │ │ │ +called when the disk cache size has dropped below the low watermark again and
│ │ │ │ │ +we can resume downloading from peers
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ffiillee__ooppeenn__mmooddee__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___i_n_t_e_r_f_a_c_e_._h_p_p"
│ │ │ │ │ +  read_only
│ │ │ │ │ +      open the file for reading only
│ │ │ │ │ +  write_only
│ │ │ │ │ +      open the file for writing only
│ │ │ │ │ +  read_write
│ │ │ │ │ +      open the file for reading and writing
│ │ │ │ │ +  rw_mask
│ │ │ │ │ +      the mask for the bits determining read or write mode
│ │ │ │ │ +  sparse
│ │ │ │ │ +      open the file in sparse mode (if supported by the filesystem).
│ │ │ │ │ +  no_atime
│ │ │ │ │ +      don't update the access timestamps on the file (if supported by the
│ │ │ │ │ +      operating system and filesystem). this generally improves disk
│ │ │ │ │ +      performance.
│ │ │ │ │ +  random_access
│ │ │ │ │ +      When this is not set, the kernel is hinted that access to this file will
│ │ │ │ │ +      be made sequentially.
│ │ │ │ │ +  mmapped
│ │ │ │ │ +      the file is memory mapped
│ │ │ │ │ +You have some control over _s_e_s_s_i_o_n configuration through the session::
│ │ │ │ │ +apply_settings() member function. To change one or more configuration options,
│ │ │ │ │ +create a _s_e_t_t_i_n_g_s___p_a_c_k object and fill it with the settings to be set and pass
│ │ │ │ │ +it in to session::apply_settings().
│ │ │ │ │ +The _s_e_t_t_i_n_g_s___p_a_c_k object is a collection of settings updates that are applied
│ │ │ │ │ +to the _s_e_s_s_i_o_n when passed to session::apply_settings(). It's empty when
│ │ │ │ │ +constructed.
│ │ │ │ │ +You have control over proxy and authorization settings and also the user-agent
│ │ │ │ │ +that will be sent to the tracker. The user-agent will also be used to identify
│ │ │ │ │ +the client with other peers.
│ │ │ │ │ +Each configuration option is named with an enum value inside the _s_e_t_t_i_n_g_s___p_a_c_k
│ │ │ │ │ +class. These are the available settings:
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ sseettttiinnggss__ppaacckk ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ +The settings_pack struct, contains the names of all settings as enum values.
│ │ │ │ │ +These values are passed in to the set_str(), set_int(), set_bool() functions,
│ │ │ │ │ +to specify the setting to change.
│ │ │ │ │ +The settings_pack only stores values for settings that have been explicitly set
│ │ │ │ │ +on this object. However, it can still be queried for settings that have not
│ │ │ │ │ +been set and returns the default value for those settings.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ |
│ │ │ │ │ +|_u_s_e_r___a_g_e_n_t_|_s_t_r_i_n_g_|_l_i_b_t_o_r_r_e_n_t_/|
│ │ │ │ │ +this is the client identification to the tracker. The recommended format of
│ │ │ │ │ +this string is: "client-name/client-version libtorrent/libtorrent-version".
│ │ │ │ │ +This name will not only be used when making HTTP requests, but also when
│ │ │ │ │ +sending extended headers to peers that support that extension. It may not
│ │ │ │ │ +contain r or n
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_n_n_o_u_n_c_e___i_p_|_s_t_r_i_n_g_|_n_u_l_l_p_t_r|
│ │ │ │ │ +announce_ip is the ip address passed along to trackers as the &ip= parameter.
│ │ │ │ │ +If left as the default, that parameter is omitted.
│ │ │ │ │ +Note
│ │ │ │ │ +This setting is only meant for very special cases where a seed is running on
│ │ │ │ │ +the same host as the tracker, and the tracker accepts the IP parameter (which
│ │ │ │ │ +normal trackers don't). Do not set this option unless you also control the
│ │ │ │ │ +tracker.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_h_a_n_d_s_h_a_k_e___c_l_i_e_n_t___v_e_r_s_i_o_n_|_s_t_r_i_n_g_|_n_u_l_l_p_t_r|
│ │ │ │ │ +this is the client name and version identifier sent to peers in the handshake
│ │ │ │ │ +message. If this is an empty string, the user_agent is used instead. This
│ │ │ │ │ +string must be a UTF-8 encoded unicode string.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_o_u_t_g_o_i_n_g___i_n_t_e_r_f_a_c_e_s_|_s_t_r_i_n_g_|_ _ _ _ _ _ _ |
│ │ │ │ │ +This controls which IP address outgoing TCP peer connections are bound to, in
│ │ │ │ │ +addition to controlling whether such connections are also bound to a specific
│ │ │ │ │ +network interface/adapter (bbiinndd--ttoo--ddeevviiccee).
│ │ │ │ │ +This string is a comma-separated list of IP addresses and interface names. An
│ │ │ │ │ +empty string will not bind TCP sockets to a device, and let the network stack
│ │ │ │ │ +assign the local address.
│ │ │ │ │ +A list of names will be used to bind outgoing TCP sockets in a round-robin
│ │ │ │ │ +fashion. An IP address will simply be used tobind()the socket. An interface
│ │ │ │ │ +name will attempt to bind the socket to that interface. If that fails, or is
│ │ │ │ │ +unsupported, one of the IP addresses configured for that interface is used
│ │ │ │ │ +tobind()the socket to. If the interface or adapter doesn't exist, the outgoing
│ │ │ │ │ +peer connection will fail with an error message suggesting the device cannot be
│ │ │ │ │ +found. Adapter names on Unix systems are of the form "eth0", "eth1", "tun0",
│ │ │ │ │ +etc. This may be useful for clients that are multi-homed. Binding an outgoing
│ │ │ │ │ +connection to a local IP does not necessarily make the connection via the
│ │ │ │ │ +associated NIC/Adapter.
│ │ │ │ │ +When outgoing interfaces are specified, incoming connections or packets sent to
│ │ │ │ │ +a local interface or IP that's nnoott in this list will be rejected with a
│ │ │ │ │ +_p_e_e_r___b_l_o_c_k_e_d___a_l_e_r_t with invalid_local_interface as the reason.
│ │ │ │ │ +Note that these are just interface/adapter names or IP addresses. There are no
│ │ │ │ │ +ports specified in this list. IPv6 addresses without port should be specified
│ │ │ │ │ +without enclosing [, ].
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_l_i_s_t_e_n___i_n_t_e_r_f_a_c_e_s_|_s_t_r_i_n_g_|_0_._0_._0_._0_:_6_8_8_1_,_[_:_:_]_:_6_8_8_1|
│ │ │ │ │ +a comma-separated list of (IP or device name, port) pairs. These are the listen
│ │ │ │ │ +ports that will be opened for accepting incoming uTP and TCP peer connections.
│ │ │ │ │ +These are also used for oouuttggooiinngg uTP and UDP tracker connections and DHT nodes.
│ │ │ │ │ +It is possible to listen on multiple interfaces and multiple ports. Binding to
│ │ │ │ │ +port 0 will make the operating system pick the port.
│ │ │ │ │ +Note
│ │ │ │ │ +There are reasons to stick to the same port across sessions, which would mean
│ │ │ │ │ +only using port 0 on the first start, and recording the port that was picked
│ │ │ │ │ +for subsequent startups. Trackers, the DHT and other peers will remember the
│ │ │ │ │ +port they see you use and hand that port out to other peers trying to connect
│ │ │ │ │ +to you, as well as trying to connect to you themselves.
│ │ │ │ │ +A port that has an "s" suffix will accept SSL peer connections. (note that SSL
│ │ │ │ │ +sockets are only available in builds with SSL support)
│ │ │ │ │ +A port that has an "l" suffix will be considered a local network. i.e. it's
│ │ │ │ │ +assumed to only be able to reach hosts in the same local network as the IP
│ │ │ │ │ +address (based on the netmask associated with the IP, queried from the
│ │ │ │ │ +operating system).
│ │ │ │ │ +if binding fails, the _l_i_s_t_e_n___f_a_i_l_e_d___a_l_e_r_t is posted. Once a socket binding
│ │ │ │ │ +succeeds (if it does), the _l_i_s_t_e_n___s_u_c_c_e_e_d_e_d___a_l_e_r_t is posted. There may be
│ │ │ │ │ +multiple failures before a success.
│ │ │ │ │ +If a device name that does not exist is configured, no listen socket will be
│ │ │ │ │ +opened for that interface. If this is the only interface configured, it will be
│ │ │ │ │ +as if no listen ports are configured.
│ │ │ │ │ +If no listen ports are configured (e.g. listen_interfaces is an empty string),
│ │ │ │ │ +networking will be disabled. No DHT will start, no outgoing uTP or tracker
│ │ │ │ │ +connections will be made. No incoming TCP or uTP connections will be accepted.
│ │ │ │ │ +(outgoing TCP connections will still be possible, depending on _s_e_t_t_i_n_g_s___p_a_c_k_:_:
│ │ │ │ │ +_o_u_t_g_o_i_n_g___i_n_t_e_r_f_a_c_e_s).
│ │ │ │ │ +For example: [::1]:8888 - will only accept connections on the IPv6 loopback
│ │ │ │ │ +address on port 8888.
│ │ │ │ │ +eth0:4444,eth1:4444 - will accept connections on port 4444 on any IP address
│ │ │ │ │ +bound to device eth0 or eth1.
│ │ │ │ │ +[::]:0s - will accept SSL connections on a port chosen by the OS. And not
│ │ │ │ │ +accept non-SSL connections at all.
│ │ │ │ │ +0.0.0.0:6881,[::]:6881 - binds to all interfaces on port 6881.
│ │ │ │ │ +10.0.1.13:6881l - binds to the local IP address, port 6881, but only allow
│ │ │ │ │ +talking to peers on the same local network. The netmask is queried from the
│ │ │ │ │ +operating system. Interfaces marked l are not announced to trackers, unless the
│ │ │ │ │ +tracker is also on the same local network.
│ │ │ │ │ +Windows OS network adapter device name must be specified with GUID. It can be
│ │ │ │ │ +obtained from "netsh lan show interfaces" command output. GUID must be
│ │ │ │ │ +uppercased string embraced in curly brackets. {E4F0B674-0DFC-48BB-98A5-
│ │ │ │ │ +2AA730BDB6D6}:7777 - will accept connections on port 7777 on adapter with this
│ │ │ │ │ +GUID.
│ │ │ │ │ +For more information, see the _M_u_l_t_i_-_h_o_m_e_d_ _h_o_s_t_s section.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_r_o_x_y___h_o_s_t_n_a_m_e_|_s_t_r_i_n_g_|_ _ _ _ _ _ _ |
│ │ │ │ │ +when using a proxy, this is the hostname where the proxy is running see
│ │ │ │ │ +proxy_type. Note that when using a proxy, the _s_e_t_t_i_n_g_s___p_a_c_k_:_:_l_i_s_t_e_n___i_n_t_e_r_f_a_c_e_s
│ │ │ │ │ +setting is overridden and only a single interface is created, just to contact
│ │ │ │ │ +the proxy. This means a proxy cannot be combined with SSL torrents or multiple
│ │ │ │ │ +listen interfaces. This proxy listen interface will not accept incoming TCP
│ │ │ │ │ +connections, will not map ports with any gateway and will not enable local
│ │ │ │ │ +service discovery. All traffic is supposed to be channeled through the proxy.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_r_o_x_y___u_s_e_r_n_a_m_e_|_s_t_r_i_n_g_|_ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_r_o_x_y___p_a_s_s_w_o_r_d_|_s_t_r_i_n_g_|_ _ _ _ _ _ _ |
│ │ │ │ │ +when using a proxy, these are the credentials (if any) to use when connecting
│ │ │ │ │ +to it. see proxy_type
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_i_2_p___h_o_s_t_n_a_m_e_|_s_t_r_i_n_g_|_ _ _ _ _ _ _ |
│ │ │ │ │ +sets the _i_2_p SAM bridge to connect to. set the port with the i2p_port setting.
│ │ │ │ │ +Unless this is set, i2p torrents are not supported. This setting is separate
│ │ │ │ │ +from the other proxy settings since i2p torrents and their peers are
│ │ │ │ │ +orthogonal. You can have i2p peers as well as regular peers via a proxy.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt_ |
│ │ │ │ │ +|_p_e_e_r___f_i_n_g_e_r_p_r_i_n_t_|_s_t_r_i_n_g_|_-_L_T_2_0_B_0_-|
│ │ │ │ │ +this is the fingerprint for the client. It will be used as the prefix to the
│ │ │ │ │ +peer_id. If this is 20 bytes (or longer) it will be truncated to 20 bytes and
│ │ │ │ │ +used as the entire peer-id
│ │ │ │ │ +There is a utility function, _g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_t_(_) that can be used to
│ │ │ │ │ +generate a standard client peer ID fingerprint prefix.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_h_t___b_o_o_t_s_t_r_a_p___n_o_d_e_s_|_s_t_r_i_n_g_|_d_h_t_._l_i_b_t_o_r_r_e_n_t_._o_r_g_:_2_5_4_0_1|
│ │ │ │ │ +This is a comma-separated list of IP port-pairs. They will be added to the DHT
│ │ │ │ │ +node (if it's enabled) as back-up nodes in case we don't know of any.
│ │ │ │ │ +Changing these after the DHT has been started may not have any effect until the
│ │ │ │ │ +DHT is restarted. Here are some other bootstrap nodes that may work:
│ │ │ │ │ +router.bittorrent.com:6881, dht.transmissionbt.com:6881 router.bt.ouinet.work:
│ │ │ │ │ +6881,
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_l_l_o_w___m_u_l_t_i_p_l_e___c_o_n_n_e_c_t_i_o_n_s___p_e_r___i_p_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +determines if connections from the same IP address as existing connections
│ │ │ │ │ +should be rejected or not. Rejecting multiple connections from the same IP
│ │ │ │ │ +address will prevent abusive behavior by peers. The logic for determining
│ │ │ │ │ +whether connections are to the same peer is more complicated with this enabled,
│ │ │ │ │ +and more likely to fail in some edge cases. It is not recommended to enable
│ │ │ │ │ +this feature.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_e_n_d___r_e_d_u_n_d_a_n_t___h_a_v_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +send_redundant_have controls if have messages will be sent to peers that
│ │ │ │ │ +already have the piece. This is typically not necessary, but it might be
│ │ │ │ │ +necessary for collecting statistics in some cases.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_s_e___d_h_t___a_s___f_a_l_l_b_a_c_k_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +use_dht_as_fallback determines how the DHT is used. If this is true, the DHT
│ │ │ │ │ +will only be used for torrents where all trackers in its tracker list has
│ │ │ │ │ +failed. Either by an explicit error message or a time out. If this is false,
│ │ │ │ │ +the DHT is used regardless of if the trackers fail or not.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_p_n_p___i_g_n_o_r_e___n_o_n_r_o_u_t_e_r_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +upnp_ignore_nonrouters indicates whether or not the UPnP implementation should
│ │ │ │ │ +ignore any broadcast response from a device whose address is not on our subnet.
│ │ │ │ │ +i.e. it's a way to not talk to other people's routers by mistake.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_s_e___p_a_r_o_l_e___m_o_d_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +use_parole_mode specifies if parole mode should be used. Parole mode means that
│ │ │ │ │ +peers that participate in pieces that fail the hash check are put in a mode
│ │ │ │ │ +where they are only allowed to download whole pieces. If the whole piece a peer
│ │ │ │ │ +in parole mode fails the hash check, it is banned. If a peer participates in a
│ │ │ │ │ +piece that passes the hash check, it is taken out of parole mode.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_u_t_o___m_a_n_a_g_e___p_r_e_f_e_r___s_e_e_d_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +if true, prefer seeding torrents when determining which torrents to give active
│ │ │ │ │ +slots to. If false, give preference to downloading torrents
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_o_n_t___c_o_u_n_t___s_l_o_w___t_o_r_r_e_n_t_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +if dont_count_slow_torrents is true, torrents without any payload transfers are
│ │ │ │ │ +not subject to the active_seeds and active_downloads limits. This is intended
│ │ │ │ │ +to make it more likely to utilize all available bandwidth, and avoid having
│ │ │ │ │ +torrents that don't transfer anything block the active slots.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_c_l_o_s_e___r_e_d_u_n_d_a_n_t___c_o_n_n_e_c_t_i_o_n_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +close_redundant_connections specifies whether libtorrent should close
│ │ │ │ │ +connections where both ends have no utility in keeping the connection open. For
│ │ │ │ │ +instance if both ends have completed their downloads, there's no point in
│ │ │ │ │ +keeping it open.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_r_i_o_r_i_t_i_z_e___p_a_r_t_i_a_l___p_i_e_c_e_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +If prioritize_partial_pieces is true, partial pieces are picked before pieces
│ │ │ │ │ +that are more rare. If false, rare pieces are always prioritized, unless the
│ │ │ │ │ +number of partial pieces is growing out of proportion.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_r_a_t_e___l_i_m_i_t___i_p___o_v_e_r_h_e_a_d_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +if set to true, the estimated TCP/IP overhead is drained from the rate
│ │ │ │ │ +limiters, to avoid exceeding the limits with the total traffic
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_n_n_o_u_n_c_e___t_o___a_l_l___t_i_e_r_s_ _ _ _|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +|_a_n_n_o_u_n_c_e___t_o___a_l_l___t_r_a_c_k_e_r_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +announce_to_all_trackers controls how multi tracker torrents are treated. If
│ │ │ │ │ +this is set to true, all trackers in the same tier are announced to in
│ │ │ │ │ +parallel. If all trackers in tier 0 fails, all trackers in tier 1 are announced
│ │ │ │ │ +as well. If it's set to false, the behavior is as defined by the multi tracker
│ │ │ │ │ +specification.
│ │ │ │ │ +announce_to_all_tiers also controls how multi tracker torrents are treated.
│ │ │ │ │ +When this is set to true, one tracker from each tier is announced to. This is
│ │ │ │ │ +the uTorrent behavior. To be compliant with the Multi-tracker specification,
│ │ │ │ │ +set it to false.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_r_e_f_e_r___u_d_p___t_r_a_c_k_e_r_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +prefer_udp_trackers: true means that trackers may be rearranged in a way that
│ │ │ │ │ +udp trackers are always tried before http trackers for the same hostname.
│ │ │ │ │ +Setting this to false means that the tracker's tier is respected and there's no
│ │ │ │ │ +preference of one protocol over another.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_i_s_a_b_l_e___h_a_s_h___c_h_e_c_k_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +when set to true, all data downloaded from peers will be assumed to be correct,
│ │ │ │ │ +and not tested to match the hashes in the torrent this is only useful for
│ │ │ │ │ +simulation and testing purposes (typically combined with disabled_storage)
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_l_l_o_w___i_2_p___m_i_x_e_d_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +if this is true, i2p torrents are allowed to also get peers from other sources
│ │ │ │ │ +than the tracker, and connect to regular IPs, not providing any anonymization.
│ │ │ │ │ +This may be useful if the user is not interested in the anonymization of i2p,
│ │ │ │ │ +but still wants to be able to connect to i2p peers.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_n_o___a_t_i_m_e___s_t_o_r_a_g_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +no_atime_storage this is a Linux-only option and passes in the O_NOATIME to
│ │ │ │ │ +open() when opening files. This may lead to some disk performance improvements.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_i_n_c_o_m_i_n_g___s_t_a_r_t_s___q_u_e_u_e_d___t_o_r_r_e_n_t_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +incoming_starts_queued_torrents. If a torrent has been paused by the auto
│ │ │ │ │ +managed feature in libtorrent, i.e. the torrent is paused and auto managed,
│ │ │ │ │ +this feature affects whether or not it is automatically started on an incoming
│ │ │ │ │ +connection. The main reason to queue torrents, is not to make them unavailable,
│ │ │ │ │ +but to save on the overhead of announcing to the trackers, the DHT and to avoid
│ │ │ │ │ +spreading one's unchoke slots too thin. If a peer managed to find us, even
│ │ │ │ │ +though we're no in the torrent anymore, this setting can make us start the
│ │ │ │ │ +torrent and serve it.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_r_e_p_o_r_t___t_r_u_e___d_o_w_n_l_o_a_d_e_d_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +when set to true, the downloaded counter sent to trackers will include the
│ │ │ │ │ +actual number of payload bytes downloaded including redundant bytes. If set to
│ │ │ │ │ +false, it will not include any redundancy bytes
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_t_r_i_c_t___e_n_d___g_a_m_e___m_o_d_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +strict_end_game_mode controls when a block may be requested twice. If this is
│ │ │ │ │ +true, a block may only be requested twice when there's at least one request to
│ │ │ │ │ +every piece that's left to download in the torrent. This may slow down progress
│ │ │ │ │ +on some pieces sometimes, but it may also avoid downloading a lot of redundant
│ │ │ │ │ +bytes. If this is false, libtorrent attempts to use each peer connection to its
│ │ │ │ │ +max, by always requesting something, even if it means requesting something that
│ │ │ │ │ +has been requested from another peer already.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_e_n_a_b_l_e___o_u_t_g_o_i_n_g___u_t_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +|_e_n_a_b_l_e___i_n_c_o_m_i_n_g___u_t_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +|_e_n_a_b_l_e___o_u_t_g_o_i_n_g___t_c_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +|_e_n_a_b_l_e___i_n_c_o_m_i_n_g___t_c_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +Enables incoming and outgoing, TCP and uTP peer connections. false is disabled
│ │ │ │ │ +and true is enabled. When outgoing connections are disabled, libtorrent will
│ │ │ │ │ +simply not make outgoing peer connections with the specific transport protocol.
│ │ │ │ │ +Disabled incoming peer connections will simply be rejected. These options only
│ │ │ │ │ +apply to peer connections, not tracker- or any other kinds of connections.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_n_o___r_e_c_h_e_c_k___i_n_c_o_m_p_l_e_t_e___r_e_s_u_m_e_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +no_recheck_incomplete_resume determines if the storage should check the whole
│ │ │ │ │ +files when resume data is incomplete or missing or whether it should simply
│ │ │ │ │ +assume we don't have any of the data. If false, any existing files will be
│ │ │ │ │ +checked. By setting this setting to true, the files won't be checked, but will
│ │ │ │ │ +go straight to download mode.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_n_o_n_y_m_o_u_s___m_o_d_e_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +anonymous_mode: When set to true, the client tries to hide its identity to a
│ │ │ │ │ +certain degree.
│ │ │ │ │ +    * A generic user-agent will be used for trackers (except for private
│ │ │ │ │ +      torrents).
│ │ │ │ │ +    * Your local IPv4 and IPv6 address won't be sent as query string parameters
│ │ │ │ │ +      to private trackers.
│ │ │ │ │ +    * If announce_ip is configured, it will not be sent to trackers
│ │ │ │ │ +    * The client version will not be sent to peers in the extension handshake.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_r_e_p_o_r_t___w_e_b___s_e_e_d___d_o_w_n_l_o_a_d_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +specifies whether downloads from web seeds is reported to the tracker or not.
│ │ │ │ │ +Turning it off also excludes web seed traffic from other stats and download
│ │ │ │ │ +rate reporting via the libtorrent API.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_e_e_d_i_n_g___o_u_t_g_o_i_n_g___c_o_n_n_e_c_t_i_o_n_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +seeding_outgoing_connections determines if seeding (and finished) torrents
│ │ │ │ │ +should attempt to make outgoing connections or not. It may be set to false in
│ │ │ │ │ +very specific applications where the cost of making outgoing connections is
│ │ │ │ │ +high, and there are no or small benefits of doing so. For instance, if no nodes
│ │ │ │ │ +are behind a firewall or a NAT, seeds don't need to make outgoing connections.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_n_o___c_o_n_n_e_c_t___p_r_i_v_i_l_e_g_e_d___p_o_r_t_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +when this is true, libtorrent will not attempt to make outgoing connections to
│ │ │ │ │ +peers whose port is < 1024. This is a safety precaution to avoid being part of
│ │ │ │ │ +a DDoS attack
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_m_o_o_t_h___c_o_n_n_e_c_t_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +smooth_connects means the number of connection attempts per second may be
│ │ │ │ │ +limited to below the connection_speed, in case we're close to bump up against
│ │ │ │ │ +the limit of number of connections. The intention of this setting is to more
│ │ │ │ │ +evenly distribute our connection attempts over time, instead of attempting to
│ │ │ │ │ +connect in batches, and timing them out in batches.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_l_w_a_y_s___s_e_n_d___u_s_e_r___a_g_e_n_t_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +always send user-agent in every web seed request. If false, only the first
│ │ │ │ │ +request per http connection will include the user agent
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_p_p_l_y___i_p___f_i_l_t_e_r___t_o___t_r_a_c_k_e_r_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +apply_ip_filter_to_trackers determines whether the IP filter applies to
│ │ │ │ │ +trackers as well as peers. If this is set to false, trackers are exempt from
│ │ │ │ │ +the IP filter (if there is one). If no IP filter is set, this setting is
│ │ │ │ │ +irrelevant.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_b_a_n___w_e_b___s_e_e_d_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +when true, web seeds sending bad data will be banned
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_u_p_p_o_r_t___s_h_a_r_e___m_o_d_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +if false, prevents libtorrent to advertise share-mode support
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_r_e_p_o_r_t___r_e_d_u_n_d_a_n_t___b_y_t_e_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +if this is true, the number of redundant bytes is sent to the tracker
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_l_i_s_t_e_n___s_y_s_t_e_m___p_o_r_t___f_a_l_l_b_a_c_k_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +if this is true, libtorrent will fall back to listening on a port chosen by the
│ │ │ │ │ +operating system (i.e. binding to port 0). If a failure is preferred, set this
│ │ │ │ │ +to false.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_n_n_o_u_n_c_e___c_r_y_p_t_o___s_u_p_p_o_r_t_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +when this is true, and incoming encrypted connections are enabled,
│ │ │ │ │ +&supportcrypt=1 is included in http tracker announces
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_e_n_a_b_l_e___u_p_n_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +Starts and stops the UPnP service. When started, the listen port and the DHT
│ │ │ │ │ +port are attempted to be forwarded on local UPnP router devices.
│ │ │ │ │ +The upnp object returned by start_upnp() can be used to add and remove
│ │ │ │ │ +arbitrary port mappings. Mapping status is returned through the _p_o_r_t_m_a_p___a_l_e_r_t
│ │ │ │ │ +and the _p_o_r_t_m_a_p___e_r_r_o_r___a_l_e_r_t. The object will be valid until stop_upnp() is
│ │ │ │ │ +called. See _u_p_n_p_ _a_n_d_ _n_a_t_ _p_m_p.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_e_n_a_b_l_e___n_a_t_p_m_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +Starts and stops the NAT-PMP service. When started, the listen port and the DHT
│ │ │ │ │ +port are attempted to be forwarded on the router through NAT-PMP.
│ │ │ │ │ +The natpmp object returned by start_natpmp() can be used to add and remove
│ │ │ │ │ +arbitrary port mappings. Mapping status is returned through the _p_o_r_t_m_a_p___a_l_e_r_t
│ │ │ │ │ +and the _p_o_r_t_m_a_p___e_r_r_o_r___a_l_e_r_t. The object will be valid until stop_natpmp() is
│ │ │ │ │ +called. See _u_p_n_p_ _a_n_d_ _n_a_t_ _p_m_p.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_e_n_a_b_l_e___l_s_d_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +Starts and stops Local Service Discovery. This service will broadcast the info-
│ │ │ │ │ +hashes of all the non-private torrents on the local network to look for peers
│ │ │ │ │ +on the same swarm within multicast reach.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_e_n_a_b_l_e___d_h_t_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +starts the dht node and makes the trackerless service available to torrents.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_r_e_f_e_r___r_c_4_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +if the allowed encryption level is both, setting this to true will prefer RC4
│ │ │ │ │ +if both methods are offered, plain text otherwise
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_r_o_x_y___h_o_s_t_n_a_m_e_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +if true, hostname lookups are done via the configured proxy (if any). This is
│ │ │ │ │ +only supported by SOCKS5 and HTTP.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_r_o_x_y___p_e_e_r___c_o_n_n_e_c_t_i_o_n_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +if true, peer connections are made (and accepted) over the configured proxy, if
│ │ │ │ │ +any. Web seeds as well as regular bittorrent peer connections are considered
│ │ │ │ │ +"peer connections". Anything transporting actual torrent payload (trackers and
│ │ │ │ │ +DHT traffic are not considered peer connections).
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_u_t_o___s_e_q_u_e_n_t_i_a_l_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +if this setting is true, torrents with a very high availability of pieces (and
│ │ │ │ │ +seeds) are downloaded sequentially. This is more efficient for the disk I/O.
│ │ │ │ │ +With many seeds, the download order is unlikely to matter anyway
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_r_o_x_y___t_r_a_c_k_e_r___c_o_n_n_e_c_t_i_o_n_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +if true, tracker connections are made over the configured proxy, if any.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_e_n_a_b_l_e___i_p___n_o_t_i_f_i_e_r_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +Starts and stops the internal IP table route changes notifier.
│ │ │ │ │ +The current implementation supports multiple platforms, and it is recommended
│ │ │ │ │ +to have it enable, but you may want to disable it if it's supported but
│ │ │ │ │ +unreliable, or if you have a better way to detect the changes. In the later
│ │ │ │ │ +case, you should manually call session_handle::reopen_network_sockets to ensure
│ │ │ │ │ +network changes are taken in consideration.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___p_r_e_f_e_r___v_e_r_i_f_i_e_d___n_o_d_e___i_d_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +when this is true, nodes whose IDs are derived from their source IP according
│ │ │ │ │ +to _B_E_P_ _4_2 are preferred in the routing table.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___r_e_s_t_r_i_c_t___r_o_u_t_i_n_g___i_p_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +determines if the routing table entries should restrict entries to one per IP.
│ │ │ │ │ +This defaults to true, which helps mitigate some attacks on the DHT. It
│ │ │ │ │ +prevents adding multiple nodes with IPs with a very close CIDR distance.
│ │ │ │ │ +when set, nodes whose IP address that's in the same /24 (or /64 for IPv6) range
│ │ │ │ │ +in the same routing table bucket. This is an attempt to mitigate node ID
│ │ │ │ │ +spoofing attacks also restrict any IP to only have a single _e_n_t_r_y in the whole
│ │ │ │ │ +routing table
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___r_e_s_t_r_i_c_t___s_e_a_r_c_h___i_p_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +determines if DHT searches should prevent adding nodes with IPs with very close
│ │ │ │ │ +CIDR distance. This also defaults to true and helps mitigate certain attacks on
│ │ │ │ │ +the DHT.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___e_x_t_e_n_d_e_d___r_o_u_t_i_n_g___t_a_b_l_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +makes the first buckets in the DHT routing table fit 128, 64, 32 and 16 nodes
│ │ │ │ │ +respectively, as opposed to the standard size of 8. All other buckets have size
│ │ │ │ │ +8 still.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___a_g_g_r_e_s_s_i_v_e___l_o_o_k_u_p_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +slightly changes the lookup behavior in terms of how many outstanding requests
│ │ │ │ │ +we keep. Instead of having branch factor be a hard limit, we always keep bbrraanncchh
│ │ │ │ │ +ffaaccttoorr outstanding requests to the closest nodes. i.e. every time we get
│ │ │ │ │ +results back with closer nodes, we query them right away. It lowers the lookup
│ │ │ │ │ +times at the cost of more outstanding queries.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___p_r_i_v_a_c_y___l_o_o_k_u_p_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +when set, perform lookups in a way that is slightly more expensive, but which
│ │ │ │ │ +minimizes the amount of information leaked about you.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___e_n_f_o_r_c_e___n_o_d_e___i_d_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +when set, node's whose IDs that are not correctly generated based on its
│ │ │ │ │ +external IP are ignored. When a query arrives from such node, an error message
│ │ │ │ │ +is returned with a message saying "invalid node ID".
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___i_g_n_o_r_e___d_a_r_k___i_n_t_e_r_n_e_t_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +ignore DHT messages from parts of the internet we wouldn't expect to see any
│ │ │ │ │ +traffic from
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___r_e_a_d___o_n_l_y_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +when set, the other nodes won't keep this node in their routing tables, it's
│ │ │ │ │ +meant for low-power and/or ephemeral devices that cannot support the DHT, it is
│ │ │ │ │ +also useful for mobile devices which are sensitive to network traffic and
│ │ │ │ │ +battery life. this node no longer responds to 'query' messages, and will place
│ │ │ │ │ +a 'ro' key (value = 1) in the top-level message dictionary of outgoing query
│ │ │ │ │ +messages.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_i_e_c_e___e_x_t_e_n_t___a_f_f_i_n_i_t_y_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +when this is true, create an affinity for downloading 4 MiB extents of adjacent
│ │ │ │ │ +pieces. This is an attempt to achieve better disk I/O throughput by downloading
│ │ │ │ │ +larger extents of bytes, for torrents with small piece sizes
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_v_a_l_i_d_a_t_e___h_t_t_p_s___t_r_a_c_k_e_r_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +when set to true, the certificate of HTTPS trackers and HTTPS web seeds will be
│ │ │ │ │ +validated against the system's certificate store (as defined by OpenSSL). If
│ │ │ │ │ +the system does not have a certificate store, this option may have to be
│ │ │ │ │ +disabled in order to get trackers and web seeds to work).
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_s_r_f___m_i_t_i_g_a_t_i_o_n_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ +when enabled, tracker and web seed requests are subject to certain
│ │ │ │ │ +restrictions.
│ │ │ │ │ +An HTTP(s) tracker requests to localhost (loopback) must have the request path
│ │ │ │ │ +start with "/announce". This is the conventional bittorrent tracker request.
│ │ │ │ │ +Any other HTTP(S) tracker request to loopback will be rejected. This applies to
│ │ │ │ │ +trackers that redirect to loopback as well.
│ │ │ │ │ +Web seeds that end up on the client's local network (i.e. in a private IP
│ │ │ │ │ +address range) may not include query string arguments. This applies to web
│ │ │ │ │ +seeds redirecting to the local network as well.
│ │ │ │ │ +Web seeds on global IPs (i.e. not local network) may not redirect to a local
│ │ │ │ │ +network address
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_l_l_o_w___i_d_n_a_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +when disabled, any tracker or web seed with an IDNA hostname (internationalized
│ │ │ │ │ +domain name) is ignored. This is a security precaution to avoid various unicode
│ │ │ │ │ +encoding attacks that might happen at the application level.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_e_n_a_b_l_e___s_e_t___f_i_l_e___v_a_l_i_d___d_a_t_a_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +when set to true, enables the attempt to use SetFileValidData() to pre-allocate
│ │ │ │ │ +disk space. This system call will only work when running with Administrator
│ │ │ │ │ +privileges on Windows, and so this setting is only relevant in that scenario.
│ │ │ │ │ +Using SetFileValidData() poses a security risk, as it may reveal previously
│ │ │ │ │ +deleted information from the disk.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_o_c_k_s_5___u_d_p___s_e_n_d___l_o_c_a_l___e_p_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ +When using a SOCKS5 proxy, UDP traffic is routed through the proxy by sending a
│ │ │ │ │ +UDP ASSOCIATE command. If this option is true, the UDP ASSOCIATE command will
│ │ │ │ │ +include the IP address and listen port to the local UDP socket. This indicates
│ │ │ │ │ +to the proxy which source endpoint to expect our packets from. The benefit is
│ │ │ │ │ +that incoming packets can be forwarded correctly, before any outgoing packets
│ │ │ │ │ +are sent. The risk is that if there's a NAT between the client and the proxy,
│ │ │ │ │ +the IP address specified in the protocol may not be valid from the proxy's
│ │ │ │ │ +point of view.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_t_r_a_c_k_e_r___c_o_m_p_l_e_t_i_o_n___t_i_m_e_o_u_t_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ +tracker_completion_timeout is the number of seconds the tracker connection will
│ │ │ │ │ +wait from when it sent the request until it considers the tracker to have
│ │ │ │ │ +timed-out.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_t_r_a_c_k_e_r___r_e_c_e_i_v_e___t_i_m_e_o_u_t_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ +tracker_receive_timeout is the number of seconds to wait to receive any data
│ │ │ │ │ +from the tracker. If no data is received for this number of seconds, the
│ │ │ │ │ +tracker will be considered as having timed out. If a tracker is down, this is
│ │ │ │ │ +the kind of timeout that will occur.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_t_o_p___t_r_a_c_k_e_r___t_i_m_e_o_u_t_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ +stop_tracker_timeout is the number of seconds to wait when sending a stopped
│ │ │ │ │ +message before considering a tracker to have timed out. This is usually
│ │ │ │ │ +shorter, to make the client quit faster. If the value is set to 0, the
│ │ │ │ │ +connections to trackers with the stopped event are suppressed.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ |
│ │ │ │ │ +|_t_r_a_c_k_e_r___m_a_x_i_m_u_m___r_e_s_p_o_n_s_e___l_e_n_g_t_h_|_i_n_t_ _|_1_0_2_4_*_1_0_2_4|
│ │ │ │ │ +this is the maximum number of bytes in a tracker response. If a response size
│ │ │ │ │ +passes this number of bytes it will be rejected and the connection will be
│ │ │ │ │ +closed. On gzipped responses this size is measured on the uncompressed data.
│ │ │ │ │ +So, if you get 20 bytes of gzip response that'll expand to 2 megabytes, it will
│ │ │ │ │ +be interrupted before the entire response has been uncompressed (assuming the
│ │ │ │ │ +limit is lower than 2 MiB).
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_i_e_c_e___t_i_m_e_o_u_t_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ +the number of seconds from a request is sent until it times out if no piece
│ │ │ │ │ +response is returned.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_r_e_q_u_e_s_t___t_i_m_e_o_u_t_|_i_n_t_ _|_6_0_ _ _ _ _ |
│ │ │ │ │ +the number of seconds one block (16 kiB) is expected to be received within. If
│ │ │ │ │ +it's not, the block is requested from a different peer
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_r_e_q_u_e_s_t___q_u_e_u_e___t_i_m_e_|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ +the length of the request queue given in the number of seconds it should take
│ │ │ │ │ +for the other end to send all the pieces. i.e. the actual number of requests
│ │ │ │ │ +depends on the download rate and this number.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_a_x___a_l_l_o_w_e_d___i_n___r_e_q_u_e_s_t___q_u_e_u_e_|_i_n_t_ _|_2_0_0_0_ _ _ |
│ │ │ │ │ +the number of outstanding block requests a peer is allowed to queue up in the
│ │ │ │ │ +client. If a peer sends more requests than this (before the first one has been
│ │ │ │ │ +sent) the last request will be dropped. the higher this is, the faster upload
│ │ │ │ │ +speeds the client can get to a single peer.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_a_x___o_u_t___r_e_q_u_e_s_t___q_u_e_u_e_|_i_n_t_ _|_5_0_0_ _ _ _ |
│ │ │ │ │ +max_out_request_queue is the maximum number of outstanding requests to send to
│ │ │ │ │ +a peer. This limit takes precedence over request_queue_time. i.e. no matter the
│ │ │ │ │ +download speed, the number of outstanding requests will never exceed this
│ │ │ │ │ +limit.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_w_h_o_l_e___p_i_e_c_e_s___t_h_r_e_s_h_o_l_d_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ +if a whole piece can be downloaded in this number of seconds, or less, the
│ │ │ │ │ +peer_connection will prefer to request whole pieces at a time from this peer.
│ │ │ │ │ +The benefit of this is to better utilize disk caches by doing localized
│ │ │ │ │ +accesses and also to make it easier to identify bad peers if a piece fails the
│ │ │ │ │ +hash check.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_e_e_r___t_i_m_e_o_u_t_|_i_n_t_ _|_1_2_0_ _ _ _ |
│ │ │ │ │ +peer_timeout is the number of seconds the peer connection should wait (for any
│ │ │ │ │ +activity on the peer connection) before closing it due to time out. 120 seconds
│ │ │ │ │ +is specified in the protocol specification. After half the time out, a keep
│ │ │ │ │ +alive message is sent.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_r_l_s_e_e_d___t_i_m_e_o_u_t_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ +same as peer_timeout, but only applies to url-seeds. this is usually set lower,
│ │ │ │ │ +because web servers are expected to be more reliable.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_r_l_s_e_e_d___p_i_p_e_l_i_n_e___s_i_z_e_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ +controls the pipelining size of url and http seeds. i.e. the number of HTTP
│ │ │ │ │ +request to keep outstanding before waiting for the first one to complete. It's
│ │ │ │ │ +common for web servers to limit this to a relatively low number, like 5
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_r_l_s_e_e_d___w_a_i_t___r_e_t_r_y_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ +number of seconds until a new retry of a url-seed takes place. Default retry
│ │ │ │ │ +value for http-seeds that don't provide a valid retry-after header.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_f_i_l_e___p_o_o_l___s_i_z_e_|_i_n_t_ _|_4_0_ _ _ _ _ |
│ │ │ │ │ +sets the upper limit on the total number of files this _s_e_s_s_i_o_n will keep open.
│ │ │ │ │ +The reason why files are left open at all is that some anti virus software
│ │ │ │ │ +hooks on every file close, and scans the file for viruses. deferring the
│ │ │ │ │ +closing of the files will be the difference between a usable system and a
│ │ │ │ │ +completely hogged down system. Most operating systems also has a limit on the
│ │ │ │ │ +total number of file descriptors a process may have open.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_a_x___f_a_i_l_c_o_u_n_t_|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ +max_failcount is the maximum times we try to connect to a peer before stop
│ │ │ │ │ +connecting again. If a peer succeeds, the failure counter is reset. If a peer
│ │ │ │ │ +is retrieved from a peer source (other than DHT) the failcount is decremented
│ │ │ │ │ +by one, allowing another try.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_i_n___r_e_c_o_n_n_e_c_t___t_i_m_e_|_i_n_t_ _|_6_0_ _ _ _ _ |
│ │ │ │ │ +the number of seconds to wait to reconnect to a peer. this time is multiplied
│ │ │ │ │ +with the failcount.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_e_e_r___c_o_n_n_e_c_t___t_i_m_e_o_u_t_|_i_n_t_ _|_1_5_ _ _ _ _ |
│ │ │ │ │ +peer_connect_timeout the number of seconds to wait after a connection attempt
│ │ │ │ │ +is initiated to a peer until it is considered as having timed out. This setting
│ │ │ │ │ +is especially important in case the number of half-open connections are
│ │ │ │ │ +limited, since stale half-open connection may delay the connection of other
│ │ │ │ │ +peers considerably.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_c_o_n_n_e_c_t_i_o_n___s_p_e_e_d_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ +connection_speed is the number of connection attempts that are made per second.
│ │ │ │ │ +If a number < 0 is specified, it will default to 200 connections per second. If
│ │ │ │ │ +0 is specified, it means don't make outgoing connections at all.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_i_n_a_c_t_i_v_i_t_y___t_i_m_e_o_u_t_|_i_n_t_ _|_6_0_0_ _ _ _ |
│ │ │ │ │ +if a peer is uninteresting and uninterested for longer than this number of
│ │ │ │ │ +seconds, it will be disconnected.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_n_c_h_o_k_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_1_5_ _ _ _ _ |
│ │ │ │ │ +unchoke_interval is the number of seconds between chokes/unchokes. On this
│ │ │ │ │ +interval, peers are re-evaluated for being choked/unchoked. This is defined as
│ │ │ │ │ +30 seconds in the protocol, and it should be significantly longer than what it
│ │ │ │ │ +takes for TCP to ramp up to it's max rate.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_o_p_t_i_m_i_s_t_i_c___u_n_c_h_o_k_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ +optimistic_unchoke_interval is the number of seconds between each ooppttiimmiissttiicc
│ │ │ │ │ +unchoke. On this timer, the currently optimistically unchoked peer will change.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_n_u_m___w_a_n_t_|_i_n_t_ _|_2_0_0_ _ _ _ |
│ │ │ │ │ +num_want is the number of peers we want from each tracker request. It defines
│ │ │ │ │ +what is sent as the &num_want= parameter to the tracker.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_i_n_i_t_i_a_l___p_i_c_k_e_r___t_h_r_e_s_h_o_l_d_|_i_n_t_ _|_4_ _ _ _ _ _ |
│ │ │ │ │ +initial_picker_threshold specifies the number of pieces we need before we
│ │ │ │ │ +switch to rarest first picking. The first initial_picker_threshold pieces in
│ │ │ │ │ +any torrent are picked at random , the following pieces are picked in rarest
│ │ │ │ │ +first order.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_l_l_o_w_e_d___f_a_s_t___s_e_t___s_i_z_e_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ +the number of allowed pieces to send to peers that supports the fast extensions
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_u_g_g_e_s_t___m_o_d_e_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_n_o___p_i_e_c_e___s_u_g_g_e_s_t_i_o_n_s|
│ │ │ │ │ +suggest_mode controls whether or not libtorrent will send out suggest messages
│ │ │ │ │ +to create a bias of its peers to request certain pieces. The modes are:
│ │ │ │ │ +    * no_piece_suggestions which will not send out suggest messages.
│ │ │ │ │ +    * suggest_read_cache which will send out suggest messages for the most
│ │ │ │ │ +      recent pieces that are in the read cache.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ |
│ │ │ │ │ +|_m_a_x___q_u_e_u_e_d___d_i_s_k___b_y_t_e_s_|_i_n_t_ _|_1_0_2_4_ _*_ _1_0_2_4|
│ │ │ │ │ +max_queued_disk_bytes is the maximum number of bytes, to be written to disk,
│ │ │ │ │ +that can wait in the disk I/O thread queue. This queue is only for waiting for
│ │ │ │ │ +the disk I/O thread to receive the job and either write it to disk or insert it
│ │ │ │ │ +in the write cache. When this limit is reached, the peer connections will stop
│ │ │ │ │ +reading data from their sockets, until the disk thread catches up. Setting this
│ │ │ │ │ +too low will severely limit your download rate.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_h_a_n_d_s_h_a_k_e___t_i_m_e_o_u_t_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ +the number of seconds to wait for a handshake response from a peer. If no
│ │ │ │ │ +response is received within this time, the peer is disconnected.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ |
│ │ │ │ │ +|_s_e_n_d___b_u_f_f_e_r___l_o_w___w_a_t_e_r_m_a_r_k_ _ _ _|_i_n_t_ _|_1_0_ _*_ _1_0_2_4_ |
│ │ │ │ │ +|_s_e_n_d___b_u_f_f_e_r___w_a_t_e_r_m_a_r_k_ _ _ _ _ _ _ _|_i_n_t_ _|_5_0_0_ _*_ _1_0_2_4|
│ │ │ │ │ +|_s_e_n_d___b_u_f_f_e_r___w_a_t_e_r_m_a_r_k___f_a_c_t_o_r_|_i_n_t_ _|_5_0_ _ _ _ _ _ _ _ |
│ │ │ │ │ +send_buffer_low_watermark the minimum send buffer target size (send buffer
│ │ │ │ │ +includes bytes pending being read from disk). For good and snappy seeding
│ │ │ │ │ +performance, set this fairly high, to at least fit a few blocks. This is
│ │ │ │ │ +essentially the initial window size which will determine how fast we can ramp
│ │ │ │ │ +up the send rate
│ │ │ │ │ +if the send buffer has fewer bytes than send_buffer_watermark, we'll read
│ │ │ │ │ +another 16 kiB block onto it. If set too small, upload rate capacity will
│ │ │ │ │ +suffer. If set too high, memory will be wasted. The actual watermark may be
│ │ │ │ │ +lower than this in case the upload rate is low, this is the upper limit.
│ │ │ │ │ +the current upload rate to a peer is multiplied by this factor to get the send
│ │ │ │ │ +buffer watermark. The factor is specified as a percentage. i.e. 50 -> 0.5 This
│ │ │ │ │ +product is clamped to the send_buffer_watermark setting to not exceed the max.
│ │ │ │ │ +For high speed upload, this should be set to a greater value than 100. For high
│ │ │ │ │ +capacity connections, setting this higher can improve upload performance and
│ │ │ │ │ +disk throughput. Setting it too high may waste RAM and create a bias towards
│ │ │ │ │ +read jobs over write jobs.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m_ _ _ _ _ _|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_f_i_x_e_d___s_l_o_t_s___c_h_o_k_e_r|
│ │ │ │ │ +|_s_e_e_d___c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_r_o_u_n_d___r_o_b_i_n_ _ _ _ _ _ _ |
│ │ │ │ │ +choking_algorithm specifies which algorithm to use to determine how many peers
│ │ │ │ │ +to unchoke. The unchoking algorithm for downloading torrents is always "tit-
│ │ │ │ │ +for-tat", i.e. the peers we download the fastest from are unchoked.
│ │ │ │ │ +The options for choking algorithms are defined in the _c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m___t enum.
│ │ │ │ │ +seed_choking_algorithm controls the seeding unchoke behavior. i.e. How we
│ │ │ │ │ +select which peers to unchoke for seeding torrents. Since a seeding torrent
│ │ │ │ │ +isn't downloading anything, the tit-for-tat mechanism cannot be used. The
│ │ │ │ │ +available options are defined in the _s_e_e_d___c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m___t enum.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_i_s_k___i_o___w_r_i_t_e___m_o_d_e_|_i_n_t_ _|_D_I_S_K___W_R_I_T_E___M_O_D_E_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_i_s_k___i_o___r_e_a_d___m_o_d_e_ _|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_e_n_a_b_l_e___o_s___c_a_c_h_e|
│ │ │ │ │ +determines how files are opened when they're in read only mode versus read and
│ │ │ │ │ +write mode. The options are:
│ │ │ │ │ +  enable_os_cache
│ │ │ │ │ +      Files are opened normally, with the OS caching reads and writes.
│ │ │ │ │ +  disable_os_cache
│ │ │ │ │ +      This opens all files in no-cache mode. This corresponds to the OS not
│ │ │ │ │ +      letting blocks for the files linger in the cache. This makes sense in
│ │ │ │ │ +      order to avoid the bittorrent client to potentially evict all other
│ │ │ │ │ +      processes' cache by simply handling high throughput and large files. If
│ │ │ │ │ +      libtorrent's read cache is disabled, enabling this may reduce
│ │ │ │ │ +      performance.
│ │ │ │ │ +  write_through
│ │ │ │ │ +      flush pieces to disk as they complete validation.
│ │ │ │ │ +One reason to disable caching is that it may help the operating system from
│ │ │ │ │ +growing its file cache indefinitely.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_o_u_t_g_o_i_n_g___p_o_r_t_ _ _ _ _ _|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +|_n_u_m___o_u_t_g_o_i_n_g___p_o_r_t_s_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +this is the first port to use for binding outgoing connections to. This is
│ │ │ │ │ +useful for users that have routers that allow QoS settings based on local port.
│ │ │ │ │ +when binding outgoing connections to specific ports, num_outgoing_ports is the
│ │ │ │ │ +size of the range. It should be more than a few
│ │ │ │ │ +Warning
│ │ │ │ │ +setting outgoing ports will limit the ability to keep multiple connections to
│ │ │ │ │ +the same client, even for different torrents. It is not recommended to change
│ │ │ │ │ +this setting. Its main purpose is to use as an escape hatch for cheap routers
│ │ │ │ │ +with QoS capability but can only classify flows based on port numbers.
│ │ │ │ │ +It is a range instead of a single port because of the problems with failing to
│ │ │ │ │ +reconnect to peers if a previous socket to that peer and port is in TIME_WAIT
│ │ │ │ │ +state.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_e_e_r___d_s_c_p_|_i_n_t_ _|_0_x_0_4_ _ _ |
│ │ │ │ │ +peer_dscp determines the DSCP field in the IP header of every packet sent to
│ │ │ │ │ +peers (including web seeds). 0x0 means no marking, 0x04 represents Lower
│ │ │ │ │ +Effort. For more details see _R_F_C_ _8_6_2_2.
│ │ │ │ │ +peer_tos is the backwards compatible name for this setting.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_c_t_i_v_e___d_o_w_n_l_o_a_d_s_ _ _ _ _|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ +|_a_c_t_i_v_e___s_e_e_d_s_ _ _ _ _ _ _ _ _|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ +|_a_c_t_i_v_e___c_h_e_c_k_i_n_g_ _ _ _ _ _|_i_n_t_ _|_1_ _ _ _ _ _ |
│ │ │ │ │ +|_a_c_t_i_v_e___d_h_t___l_i_m_i_t_ _ _ _ _|_i_n_t_ _|_8_8_ _ _ _ _ |
│ │ │ │ │ +|_a_c_t_i_v_e___t_r_a_c_k_e_r___l_i_m_i_t_|_i_n_t_ _|_1_6_0_0_ _ _ |
│ │ │ │ │ +|_a_c_t_i_v_e___l_s_d___l_i_m_i_t_ _ _ _ _|_i_n_t_ _|_6_0_ _ _ _ _ |
│ │ │ │ │ +|_a_c_t_i_v_e___l_i_m_i_t_ _ _ _ _ _ _ _ _|_i_n_t_ _|_5_0_0_ _ _ _ |
│ │ │ │ │ +for auto managed torrents, these are the limits they are subject to. If there
│ │ │ │ │ +are too many torrents some of the auto managed ones will be paused until some
│ │ │ │ │ +slots free up. active_downloads and active_seeds controls how many active
│ │ │ │ │ +seeding and downloading torrents the queuing mechanism allows. The target
│ │ │ │ │ +number of active torrents is min(active_downloads + active_seeds,
│ │ │ │ │ +active_limit). active_downloads and active_seeds are upper limits on the number
│ │ │ │ │ +of downloading torrents and seeding torrents respectively. Setting the value to
│ │ │ │ │ +-1 means unlimited.
│ │ │ │ │ +For example if there are 10 seeding torrents and 10 downloading torrents, and
│ │ │ │ │ +active_downloads is 4 and active_seeds is 4, there will be 4 seeds active and 4
│ │ │ │ │ +downloading torrents. If the settings are active_downloads = 2 and active_seeds
│ │ │ │ │ += 4, then there will be 2 downloading torrents and 4 seeding torrents active.
│ │ │ │ │ +Torrents that are not auto managed are not counted against these limits.
│ │ │ │ │ +active_checking is the limit of number of simultaneous checking torrents.
│ │ │ │ │ +active_limit is a hard limit on the number of active (auto managed) torrents.
│ │ │ │ │ +This limit also applies to slow torrents.
│ │ │ │ │ +active_dht_limit is the max number of torrents to announce to the DHT.
│ │ │ │ │ +active_tracker_limit is the max number of torrents to announce to their
│ │ │ │ │ +trackers.
│ │ │ │ │ +active_lsd_limit is the max number of torrents to announce to the local network
│ │ │ │ │ +over the local service discovery protocol.
│ │ │ │ │ +You can have more torrents aaccttiivvee, even though they are not announced to the
│ │ │ │ │ +DHT, lsd or their tracker. If some peer knows about you for any reason and
│ │ │ │ │ +tries to connect, it will still be accepted, unless the torrent is paused,
│ │ │ │ │ +which means it won't accept any connections.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_u_t_o___m_a_n_a_g_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ +auto_manage_interval is the number of seconds between the torrent queue is
│ │ │ │ │ +updated, and rotated.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ |
│ │ │ │ │ +|_s_e_e_d___t_i_m_e___l_i_m_i_t_|_i_n_t_ _|_2_4_ _*_ _6_0_ _*_ _6_0|
│ │ │ │ │ +this is the limit on the time a torrent has been an active seed (specified in
│ │ │ │ │ +seconds) before it is considered having met the seed limit criteria. See
│ │ │ │ │ +_q_u_e_u_i_n_g.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_u_t_o___s_c_r_a_p_e___i_n_t_e_r_v_a_l_ _ _ _ _|_i_n_t_ _|_1_8_0_0_ _ _ |
│ │ │ │ │ +|_a_u_t_o___s_c_r_a_p_e___m_i_n___i_n_t_e_r_v_a_l_|_i_n_t_ _|_3_0_0_ _ _ _ |
│ │ │ │ │ +auto_scrape_interval is the number of seconds between scrapes of queued
│ │ │ │ │ +torrents (auto managed and paused torrents). Auto managed torrents that are
│ │ │ │ │ +paused, are scraped regularly in order to keep track of their downloader/seed
│ │ │ │ │ +ratio. This ratio is used to determine which torrents to seed and which to
│ │ │ │ │ +pause.
│ │ │ │ │ +auto_scrape_min_interval is the minimum number of seconds between any automatic
│ │ │ │ │ +scrape (regardless of torrent). In case there are a large number of paused auto
│ │ │ │ │ +managed torrents, this puts a limit on how often a scrape request is sent.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_a_x___p_e_e_r_l_i_s_t___s_i_z_e_ _ _ _ _ _ _ _|_i_n_t_ _|_3_0_0_0_ _ _ |
│ │ │ │ │ +|_m_a_x___p_a_u_s_e_d___p_e_e_r_l_i_s_t___s_i_z_e_|_i_n_t_ _|_1_0_0_0_ _ _ |
│ │ │ │ │ +max_peerlist_size is the maximum number of peers in the list of known peers.
│ │ │ │ │ +These peers are not necessarily connected, so this number should be much
│ │ │ │ │ +greater than the maximum number of connected peers. Peers are evicted from the
│ │ │ │ │ +cache when the list grows passed 90% of this limit, and once the size hits the
│ │ │ │ │ +limit, peers are no longer added to the list. If this limit is set to 0, there
│ │ │ │ │ +is no limit on how many peers we'll keep in the peer list.
│ │ │ │ │ +max_paused_peerlist_size is the max peer list size used for torrents that are
│ │ │ │ │ +paused. This can be used to save memory for paused torrents, since it's not as
│ │ │ │ │ +important for them to keep a large peer list.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_i_n___a_n_n_o_u_n_c_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_5_ _*_ _6_0_ |
│ │ │ │ │ +this is the minimum allowed announce interval for a tracker. This is specified
│ │ │ │ │ +in seconds and is used as a sanity check on what is returned from a tracker. It
│ │ │ │ │ +mitigates hammering mis-configured trackers.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_u_t_o___m_a_n_a_g_e___s_t_a_r_t_u_p_|_i_n_t_ _|_6_0_ _ _ _ _ |
│ │ │ │ │ +this is the number of seconds a torrent is considered active after it was
│ │ │ │ │ +started, regardless of upload and download speed. This is so that newly started
│ │ │ │ │ +torrents are not considered inactive until they have a fair chance to start
│ │ │ │ │ +downloading.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_e_e_d_i_n_g___p_i_e_c_e___q_u_o_t_a_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ +seeding_piece_quota is the number of pieces to send to a peer, when seeding,
│ │ │ │ │ +before rotating in another peer to the unchoke set.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_a_x___r_e_j_e_c_t_s_|_i_n_t_ _|_5_0_ _ _ _ _ |
│ │ │ │ │ +max_rejects is the number of piece requests we will reject in a row while a
│ │ │ │ │ +peer is choked before the peer is considered abusive and is disconnected.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_r_e_c_v___s_o_c_k_e_t___b_u_f_f_e_r___s_i_z_e_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +|_s_e_n_d___s_o_c_k_e_t___b_u_f_f_e_r___s_i_z_e_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +specifies the buffer sizes set on peer sockets. 0 means the OS default (i.e.
│ │ │ │ │ +don't change the buffer sizes). The socket buffer sizes are changed using
│ │ │ │ │ +setsockopt() with SOL_SOCKET/SO_RCVBUF and SO_SNDBUFFER.
│ │ │ │ │ +Note that uTP peers share a single UDP socket buffer for each of the
│ │ │ │ │ +listen_interfaces, along with DHT and UDP tracker traffic. If the buffer size
│ │ │ │ │ +is too small for the combined traffic through the socket, packets may be
│ │ │ │ │ +dropped.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_m_a_x___p_e_e_r___r_e_c_v___b_u_f_f_e_r___s_i_z_e_|_i_n_t_ _|_2_ _*_ _1_0_2_4_ _*_ _1_0_2_4|
│ │ │ │ │ +the max number of bytes a single peer connection's receive buffer is allowed to
│ │ │ │ │ +grow to.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_o_p_t_i_m_i_s_t_i_c___d_i_s_k___r_e_t_r_y_|_i_n_t_ _|_1_0_ _*_ _6_0|
│ │ │ │ │ +optimistic_disk_retry is the number of seconds from a disk write errors occur
│ │ │ │ │ +on a torrent until libtorrent will take it out of the upload mode, to test if
│ │ │ │ │ +the error condition has been fixed.
│ │ │ │ │ +libtorrent will only do this automatically for auto managed torrents.
│ │ │ │ │ +You can explicitly take a torrent out of upload only mode using set_upload_mode
│ │ │ │ │ +().
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_a_x___s_u_g_g_e_s_t___p_i_e_c_e_s_|_i_n_t_ _|_1_6_ _ _ _ _ |
│ │ │ │ │ +max_suggest_pieces is the max number of suggested piece indices received from a
│ │ │ │ │ +peer that's remembered. If a peer floods suggest messages, this limit prevents
│ │ │ │ │ +libtorrent from using too much RAM.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_l_o_c_a_l___s_e_r_v_i_c_e___a_n_n_o_u_n_c_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_5_ _*_ _6_0_ |
│ │ │ │ │ +local_service_announce_interval is the time between local network announces for
│ │ │ │ │ +a torrent. This interval is specified in seconds.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___a_n_n_o_u_n_c_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_1_5_ _*_ _6_0|
│ │ │ │ │ +dht_announce_interval is the number of seconds between announcing torrents to
│ │ │ │ │ +the distributed hash table (DHT).
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_d_p___t_r_a_c_k_e_r___t_o_k_e_n___e_x_p_i_r_y_|_i_n_t_ _|_6_0_ _ _ _ _ |
│ │ │ │ │ +udp_tracker_token_expiry is the number of seconds libtorrent will keep UDP
│ │ │ │ │ +tracker connection tokens around for. This is specified to be 60 seconds. The
│ │ │ │ │ +higher this value is, the fewer packets have to be sent to the UDP tracker. In
│ │ │ │ │ +order for higher values to work, the tracker needs to be configured to match
│ │ │ │ │ +the expiration time for tokens.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_n_u_m___o_p_t_i_m_i_s_t_i_c___u_n_c_h_o_k_e___s_l_o_t_s_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +num_optimistic_unchoke_slots is the number of optimistic unchoke slots to use.
│ │ │ │ │ +Having a higher number of optimistic unchoke slots mean you will find the good
│ │ │ │ │ +peers faster but with the trade-off to use up more bandwidth. 0 means
│ │ │ │ │ +automatic, where libtorrent opens up 20% of your allowed upload slots as
│ │ │ │ │ +optimistic unchoke slots.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_a_x___p_e_x___p_e_e_r_s_|_i_n_t_ _|_5_0_ _ _ _ _ |
│ │ │ │ │ +the max number of peers we accept from pex messages from a single peer. this
│ │ │ │ │ +limits the number of concurrent peers any of our peers claims to be connected
│ │ │ │ │ +to. If they claim to be connected to more than this, we'll ignore any peer that
│ │ │ │ │ +exceeds this limit
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_t_i_c_k___i_n_t_e_r_v_a_l_|_i_n_t_ _|_5_0_0_ _ _ _ |
│ │ │ │ │ +tick_interval specifies the number of milliseconds between internal ticks. This
│ │ │ │ │ +is the frequency with which bandwidth quota is distributed to peers. It should
│ │ │ │ │ +not be more than one second (i.e. 1000 ms). Setting this to a low value (around
│ │ │ │ │ +100) means higher resolution bandwidth quota distribution, setting it to a
│ │ │ │ │ +higher value saves CPU cycles.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_h_a_r_e___m_o_d_e___t_a_r_g_e_t_|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ +share_mode_target specifies the target share ratio for share mode torrents. If
│ │ │ │ │ +set to 3, we'll try to upload 3 times as much as we download. Setting this very
│ │ │ │ │ +high, will make it very conservative and you might end up not downloading
│ │ │ │ │ +anything ever (and not affecting your share ratio). It does not make any sense
│ │ │ │ │ +to set this any lower than 2. For instance, if only 3 peers need to download
│ │ │ │ │ +the rarest piece, it's impossible to download a single piece and upload it more
│ │ │ │ │ +than 3 times. If the share_mode_target is set to more than 3, nothing is
│ │ │ │ │ +downloaded.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_p_l_o_a_d___r_a_t_e___l_i_m_i_t_ _ _|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +|_d_o_w_n_l_o_a_d___r_a_t_e___l_i_m_i_t_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +upload_rate_limit and download_rate_limit sets the session-global limits of
│ │ │ │ │ +upload and download rate limits, in bytes per second. By default peers on the
│ │ │ │ │ +local network are not rate limited.
│ │ │ │ │ +A value of 0 means unlimited.
│ │ │ │ │ +For fine grained control over rate limits, including making them apply to local
│ │ │ │ │ +peers, see _p_e_e_r_ _c_l_a_s_s_e_s.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___u_p_l_o_a_d___r_a_t_e___l_i_m_i_t_|_i_n_t_ _|_8_0_0_0_ _ _ |
│ │ │ │ │ +the number of bytes per second (on average) the DHT is allowed to send. If the
│ │ │ │ │ +incoming requests causes to many bytes to be sent in responses, incoming
│ │ │ │ │ +requests will be dropped until the quota has been replenished.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_n_c_h_o_k_e___s_l_o_t_s___l_i_m_i_t_|_i_n_t_ _|_8_ _ _ _ _ _ |
│ │ │ │ │ +unchoke_slots_limit is the max number of unchoked peers in the _s_e_s_s_i_o_n. The
│ │ │ │ │ +number of unchoke slots may be ignored depending on what choking_algorithm is
│ │ │ │ │ +set to. Setting this limit to -1 means unlimited, i.e. all peers will always be
│ │ │ │ │ +unchoked.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_c_o_n_n_e_c_t_i_o_n_s___l_i_m_i_t_|_i_n_t_ _|_2_0_0_ _ _ _ |
│ │ │ │ │ +connections_limit sets a global limit on the number of connections opened. The
│ │ │ │ │ +number of connections is set to a hard minimum of at least two per torrent, so
│ │ │ │ │ +if you set a too low connections limit, and open too many torrents, the limit
│ │ │ │ │ +will not be met.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_c_o_n_n_e_c_t_i_o_n_s___s_l_a_c_k_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ +connections_slack is the number of incoming connections exceeding the
│ │ │ │ │ +connection limit to accept in order to potentially replace existing ones.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_t_p___t_a_r_g_e_t___d_e_l_a_y_ _ _ _|_i_n_t_ _|_1_0_0_ _ _ _ |
│ │ │ │ │ +|_u_t_p___g_a_i_n___f_a_c_t_o_r_ _ _ _ _|_i_n_t_ _|_3_0_0_0_ _ _ |
│ │ │ │ │ +|_u_t_p___m_i_n___t_i_m_e_o_u_t_ _ _ _ _|_i_n_t_ _|_5_0_0_ _ _ _ |
│ │ │ │ │ +|_u_t_p___s_y_n___r_e_s_e_n_d_s_ _ _ _ _|_i_n_t_ _|_2_ _ _ _ _ _ |
│ │ │ │ │ +|_u_t_p___f_i_n___r_e_s_e_n_d_s_ _ _ _ _|_i_n_t_ _|_2_ _ _ _ _ _ |
│ │ │ │ │ +|_u_t_p___n_u_m___r_e_s_e_n_d_s_ _ _ _ _|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ +|_u_t_p___c_o_n_n_e_c_t___t_i_m_e_o_u_t_|_i_n_t_ _|_3_0_0_0_ _ _ |
│ │ │ │ │ +|_u_t_p___l_o_s_s___m_u_l_t_i_p_l_i_e_r_|_i_n_t_ _|_5_0_ _ _ _ _ |
│ │ │ │ │ +utp_target_delay is the target delay for uTP sockets in milliseconds. A high
│ │ │ │ │ +value will make uTP connections more aggressive and cause longer queues in the
│ │ │ │ │ +upload bottleneck. It cannot be too low, since the noise in the measurements
│ │ │ │ │ +would cause it to send too slow. utp_gain_factor is the number of bytes the uTP
│ │ │ │ │ +congestion window can increase at the most in one RTT. If this is set too high,
│ │ │ │ │ +the congestion controller reacts too hard to noise and will not be stable, if
│ │ │ │ │ +it's set too low, it will react slow to congestion and not back off as fast.
│ │ │ │ │ +utp_min_timeout is the shortest allowed uTP socket timeout, specified in
│ │ │ │ │ +milliseconds. The timeout depends on the RTT of the connection, but is never
│ │ │ │ │ +smaller than this value. A connection times out when every packet in a window
│ │ │ │ │ +is lost, or when a packet is lost twice in a row (i.e. the resent packet is
│ │ │ │ │ +lost as well).
│ │ │ │ │ +The shorter the timeout is, the faster the connection will recover from this
│ │ │ │ │ +situation, assuming the RTT is low enough. utp_syn_resends is the number of SYN
│ │ │ │ │ +packets that are sent (and timed out) before giving up and closing the socket.
│ │ │ │ │ +utp_num_resends is the number of times a packet is sent (and lost or timed out)
│ │ │ │ │ +before giving up and closing the connection. utp_connect_timeout is the number
│ │ │ │ │ +of milliseconds of timeout for the initial SYN packet for uTP connections. For
│ │ │ │ │ +each timed out packet (in a row), the timeout is doubled. utp_loss_multiplier
│ │ │ │ │ +controls how the congestion window is changed when a packet loss is
│ │ │ │ │ +experienced. It's specified as a percentage multiplier for cwnd. Do not change
│ │ │ │ │ +this value unless you know what you're doing. Never set it higher than 100.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_m_i_x_e_d___m_o_d_e___a_l_g_o_r_i_t_h_m_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_p_e_e_r___p_r_o_p_o_r_t_i_o_n_a_l|
│ │ │ │ │ +The mixed_mode_algorithm determines how to treat TCP connections when there are
│ │ │ │ │ +uTP connections. Since uTP is designed to yield to TCP, there's an inherent
│ │ │ │ │ +problem when using swarms that have both TCP and uTP connections. If nothing is
│ │ │ │ │ +done, uTP connections would often be starved out for bandwidth by the TCP
│ │ │ │ │ +connections. This mode is prefer_tcp. The peer_proportional mode simply looks
│ │ │ │ │ +at the current throughput and rate limits all TCP connections to their
│ │ │ │ │ +proportional share based on how many of the connections are TCP. This works
│ │ │ │ │ +best if uTP connections are not rate limited by the global rate limiter (which
│ │ │ │ │ +they aren't by default).
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_l_i_s_t_e_n___q_u_e_u_e___s_i_z_e_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ +listen_queue_size is the value passed in to listen() for the listen socket. It
│ │ │ │ │ +is the number of outstanding incoming connections to queue up while we're not
│ │ │ │ │ +actively waiting for a connection to be accepted. 5 should be sufficient for
│ │ │ │ │ +any normal client. If this is a high performance server which expects to
│ │ │ │ │ +receive a lot of connections, or used in a simulator or test, it might make
│ │ │ │ │ +sense to raise this number. It will not take affect until the listen_interfaces
│ │ │ │ │ +settings is updated.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_t_o_r_r_e_n_t___c_o_n_n_e_c_t___b_o_o_s_t_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ +torrent_connect_boost is the number of peers to try to connect to immediately
│ │ │ │ │ +when the first tracker response is received for a torrent. This is a boost to
│ │ │ │ │ +given to new torrents to accelerate them starting up. The normal connect
│ │ │ │ │ +scheduler is run once every second, this allows peers to be connected
│ │ │ │ │ +immediately instead of waiting for the _s_e_s_s_i_o_n tick to trigger connections.
│ │ │ │ │ +This may not be set higher than 255.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_l_e_r_t___q_u_e_u_e___s_i_z_e_|_i_n_t_ _|_2_0_0_0_ _ _ |
│ │ │ │ │ +alert_queue_size is the maximum number of alerts queued up internally. If
│ │ │ │ │ +alerts are not popped, the queue will eventually fill up to this level. Once
│ │ │ │ │ +the _a_l_e_r_t queue is full, additional alerts will be dropped, and not delivered
│ │ │ │ │ +to the client. Once the client drains the queue, new alerts may be delivered
│ │ │ │ │ +again. In order to know that alerts have been dropped, see session_handle::
│ │ │ │ │ +dropped_alerts().
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_m_a_x___m_e_t_a_d_a_t_a___s_i_z_e_|_i_n_t_ _|_3_ _*_ _1_0_2_4_ _*_ _1_0_2_4_0|
│ │ │ │ │ +max_metadata_size is the maximum allowed size (in bytes) to be received by the
│ │ │ │ │ +metadata extension, i.e. magnet links.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_h_a_s_h_i_n_g___t_h_r_e_a_d_s_|_i_n_t_ _|_1_ _ _ _ _ _ |
│ │ │ │ │ +hashing_threads is the number of disk I/O threads to use for piece hash
│ │ │ │ │ +verification. These threads are iinn aaddddiittiioonn to the regular disk I/O threads
│ │ │ │ │ +specified by _s_e_t_t_i_n_g_s___p_a_c_k_:_:_a_i_o___t_h_r_e_a_d_s. These threads are only used for full
│ │ │ │ │ +checking of torrents. The hash checking done while downloading are done by the
│ │ │ │ │ +regular disk I/O threads. The _h_a_s_h_e_r threads do not only compute hashes, but
│ │ │ │ │ +also perform the read from disk. On storage optimal for sequential access, such
│ │ │ │ │ +as hard drives, this setting should be set to 1, which is also the default.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_c_h_e_c_k_i_n_g___m_e_m___u_s_a_g_e_|_i_n_t_ _|_2_5_6_ _ _ _ |
│ │ │ │ │ +the number of blocks to keep outstanding at any given time when checking
│ │ │ │ │ +torrents. Higher numbers give faster re-checks but uses more memory. Specified
│ │ │ │ │ +in number of 16 kiB blocks
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_r_e_d_i_c_t_i_v_e___p_i_e_c_e___a_n_n_o_u_n_c_e_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +if set to > 0, pieces will be announced to other peers before they are fully
│ │ │ │ │ +downloaded (and before they are hash checked). The intention is to gain 1.5
│ │ │ │ │ +potential round trip times per downloaded piece. When non-zero, this indicates
│ │ │ │ │ +how many milliseconds in advance pieces should be announced, before they are
│ │ │ │ │ +expected to be completed.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_i_o___t_h_r_e_a_d_s_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ +for some aio back-ends, aio_threads specifies the number of io-threads to use.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_t_r_a_c_k_e_r___b_a_c_k_o_f_f_|_i_n_t_ _|_2_5_0_ _ _ _ |
│ │ │ │ │ +tracker_backoff determines how aggressively to back off from retrying failing
│ │ │ │ │ +trackers. This value determines xx in the following formula, determining the
│ │ │ │ │ +number of seconds to wait until the next retry:
│ │ │ │ │ +     delay = 5 + 5 * x / 100 * fails^2
│ │ │ │ │ +This setting may be useful to make libtorrent more or less aggressive in
│ │ │ │ │ +hitting trackers.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_h_a_r_e___r_a_t_i_o___l_i_m_i_t_ _ _ _ _|_i_n_t_ _|_2_0_0_ _ _ _ |
│ │ │ │ │ +|_s_e_e_d___t_i_m_e___r_a_t_i_o___l_i_m_i_t_|_i_n_t_ _|_7_0_0_ _ _ _ |
│ │ │ │ │ +when a seeding torrent reaches either the share ratio (bytes up / bytes down)
│ │ │ │ │ +or the seed time ratio (seconds as seed / seconds as downloader) or the seed
│ │ │ │ │ +time limit (seconds as seed) it is considered done, and it will leave room for
│ │ │ │ │ +other torrents. These are specified as percentages. Torrents that are
│ │ │ │ │ +considered done will still be allowed to be seeded, they just won't have
│ │ │ │ │ +priority anymore. For more, see _q_u_e_u_i_n_g.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_e_e_r___t_u_r_n_o_v_e_r_ _ _ _ _ _ _ _ _ _|_i_n_t_ _|_4_ _ _ _ _ _ |
│ │ │ │ │ +|_p_e_e_r___t_u_r_n_o_v_e_r___c_u_t_o_f_f_ _ _|_i_n_t_ _|_9_0_ _ _ _ _ |
│ │ │ │ │ +|_p_e_e_r___t_u_r_n_o_v_e_r___i_n_t_e_r_v_a_l_|_i_n_t_ _|_3_0_0_ _ _ _ |
│ │ │ │ │ +peer_turnover is the percentage of peers to disconnect every turnover
│ │ │ │ │ +peer_turnover_interval (if we're at the peer limit), this is specified in
│ │ │ │ │ +percent when we are connected to more than limit * peer_turnover_cutoff peers
│ │ │ │ │ +disconnect peer_turnover fraction of the peers. It is specified in percent
│ │ │ │ │ +peer_turnover_interval is the interval (in seconds) between optimistic
│ │ │ │ │ +disconnects if the disconnects happen and how many peers are disconnected is
│ │ │ │ │ +controlled by peer_turnover and peer_turnover_cutoff
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_c_o_n_n_e_c_t___s_e_e_d___e_v_e_r_y___n___d_o_w_n_l_o_a_d_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ +this setting controls the priority of downloading torrents over seeding or
│ │ │ │ │ +finished torrents when it comes to making peer connections. Peer connections
│ │ │ │ │ +are throttled by the connection_speed and the half-open connection limit. This
│ │ │ │ │ +makes peer connections a limited resource. Torrents that still have pieces to
│ │ │ │ │ +download are prioritized by default, to avoid having many seeding torrents use
│ │ │ │ │ +most of the connection attempts and only give one peer every now and then to
│ │ │ │ │ +the downloading torrent. libtorrent will loop over the downloading torrents to
│ │ │ │ │ +connect a peer each, and every n:th connection attempt, a finished torrent is
│ │ │ │ │ +picked to be allowed to connect to a peer. This setting controls n.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ |
│ │ │ │ │ +|_m_a_x___h_t_t_p___r_e_c_v___b_u_f_f_e_r___s_i_z_e_|_i_n_t_ _|_4_*_1_0_2_4_*_2_0_4|
│ │ │ │ │ +the max number of bytes to allow an HTTP response to be when announcing to
│ │ │ │ │ +trackers or downloading .torrent files via the url provided in
│ │ │ │ │ +add_torrent_params.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_a_x___r_e_t_r_y___p_o_r_t___b_i_n_d_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ +if binding to a specific port fails, should the port be incremented by one and
│ │ │ │ │ +tried again? This setting specifies how many times to retry a failed port bind
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_l_e_r_t___m_a_s_k_|_i_n_t_ _|_i_n_t_ _ _ _ |
│ │ │ │ │ +a bitmask combining flags from _a_l_e_r_t___c_a_t_e_g_o_r_y___t defining which kinds of alerts
│ │ │ │ │ +to receive
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_o_u_t___e_n_c___p_o_l_i_c_y_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_p_e___e_n_a_b_l_e_d|
│ │ │ │ │ +|_i_n___e_n_c___p_o_l_i_c_y_ _|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_p_e___e_n_a_b_l_e_d|
│ │ │ │ │ +control the settings for incoming and outgoing connections respectively. see
│ │ │ │ │ +_e_n_c___p_o_l_i_c_y enum for the available options. Keep in mind that protocol
│ │ │ │ │ +encryption degrades performance in several respects:
│ │ │ │ │ +   1. It prevents "zero copy" disk buffers being sent to peers, since each peer
│ │ │ │ │ +      needs to mutate the data (i.e. encrypt it) the data must be copied per
│ │ │ │ │ +      peer connection rather than sending the same buffer to multiple peers.
│ │ │ │ │ +   2. The encryption itself requires more CPU than plain bittorrent protocol.
│ │ │ │ │ +      The highest cost is the Diffie Hellman exchange on connection setup.
│ │ │ │ │ +   3. The encryption handshake adds several round-trips to the connection
│ │ │ │ │ +      setup, and delays transferring data.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_a_l_l_o_w_e_d___e_n_c___l_e_v_e_l_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_p_e___b_o_t_h|
│ │ │ │ │ +determines the encryption level of the connections. This setting will adjust
│ │ │ │ │ +which encryption scheme is offered to the other peer, as well as which
│ │ │ │ │ +encryption scheme is selected by the client. See _e_n_c___l_e_v_e_l enum for options.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_i_n_a_c_t_i_v_e___d_o_w_n___r_a_t_e_|_i_n_t_ _|_2_0_4_8_ _ _ |
│ │ │ │ │ +|_i_n_a_c_t_i_v_e___u_p___r_a_t_e_ _ _|_i_n_t_ _|_2_0_4_8_ _ _ |
│ │ │ │ │ +the download and upload rate limits for a torrent to be considered active by
│ │ │ │ │ +the queuing mechanism. A torrent whose download rate is less than
│ │ │ │ │ +inactive_down_rate and whose upload rate is less than inactive_up_rate for
│ │ │ │ │ +auto_manage_startup seconds, is considered inactive, and another queued torrent
│ │ │ │ │ +may be started. This logic is disabled if dont_count_slow_torrents is false.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_r_o_x_y___t_y_p_e_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_n_o_n_e|
│ │ │ │ │ +proxy to use. see _p_r_o_x_y___t_y_p_e___t.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_p_r_o_x_y___p_o_r_t_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +the port of the proxy server
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_i_2_p___p_o_r_t_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +sets the _i_2_p SAM bridge port to connect to. set the hostname with the
│ │ │ │ │ +i2p_hostname setting.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_u_r_l_s_e_e_d___m_a_x___r_e_q_u_e_s_t___b_y_t_e_s_|_i_n_t_ _|_1_6_ _*_ _1_0_2_4_ _*_ _1_0_2_4|
│ │ │ │ │ +The maximum request range of an url seed in bytes. This value defines the
│ │ │ │ │ +largest possible sequential web seed request. Lower values are possible but
│ │ │ │ │ +will be ignored if they are lower then piece size. This value should be related
│ │ │ │ │ +to your download speed to prevent libtorrent from creating too many expensive
│ │ │ │ │ +http requests per second. You can select a value as high as you want but keep
│ │ │ │ │ +in mind that libtorrent can't create parallel requests if the first request did
│ │ │ │ │ +already select the whole file. If you combine bittorrent seeds with web seeds
│ │ │ │ │ +and pick strategies like rarest first you may find your web seed requests split
│ │ │ │ │ +into smaller parts because we don't download already picked pieces twice.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_w_e_b___s_e_e_d___n_a_m_e___l_o_o_k_u_p___r_e_t_r_y_|_i_n_t_ _|_1_8_0_0_ _ _ |
│ │ │ │ │ +time to wait until a new retry of a web seed name lookup
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_c_l_o_s_e___f_i_l_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_C_L_O_S_E___F_I_L_E___I_N_T_E_R_V_A_L|
│ │ │ │ │ +the number of seconds between closing the file opened the longest ago. 0 means
│ │ │ │ │ +to disable the feature. The purpose of this is to periodically close files to
│ │ │ │ │ +trigger the operating system flushing disk cache. Specifically it has been
│ │ │ │ │ +observed to be required on windows to not have the disk cache grow
│ │ │ │ │ +indefinitely. This defaults to 240 seconds on windows, and disabled on other
│ │ │ │ │ +systems.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_t_p___c_w_n_d___r_e_d_u_c_e___t_i_m_e_r_|_i_n_t_ _|_1_0_0_ _ _ _ |
│ │ │ │ │ +When uTP experiences packet loss, it will reduce the congestion window, and not
│ │ │ │ │ +reduce it again for this many milliseconds, even if experiencing another lost
│ │ │ │ │ +packet.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_a_x___w_e_b___s_e_e_d___c_o_n_n_e_c_t_i_o_n_s_|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ +the max number of web seeds to have connected per torrent at any given time.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_r_e_s_o_l_v_e_r___c_a_c_h_e___t_i_m_e_o_u_t_|_i_n_t_ _|_1_2_0_0_ _ _ |
│ │ │ │ │ +the number of seconds before the internal host name resolver considers a cache
│ │ │ │ │ +value timed out, negative values are interpreted as zero.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_s_e_n_d___n_o_t___s_e_n_t___l_o_w___w_a_t_e_r_m_a_r_k_|_i_n_t_ _|_1_6_3_8_4_ _ |
│ │ │ │ │ +specify the not-sent low watermark for socket send buffers. This corresponds to
│ │ │ │ │ +the, Linux-specific, TCP_NOTSENT_LOWAT TCP socket option.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_r_a_t_e___c_h_o_k_e_r___i_n_i_t_i_a_l___t_h_r_e_s_h_o_l_d_|_i_n_t_ _|_1_0_2_4_ _ _ |
│ │ │ │ │ +the rate based choker compares the upload rate to peers against a threshold
│ │ │ │ │ +that increases proportionally by its size for every peer it visits, visiting
│ │ │ │ │ +peers in decreasing upload rate. The number of upload slots is determined by
│ │ │ │ │ +the number of peers whose upload rate exceeds the threshold. This option sets
│ │ │ │ │ +the start value for this threshold. A higher value leads to fewer unchoke
│ │ │ │ │ +slots, a lower value leads to more.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_u_p_n_p___l_e_a_s_e___d_u_r_a_t_i_o_n_|_i_n_t_ _|_3_6_0_0_ _ _ |
│ │ │ │ │ +The expiration time of UPnP port-mappings, specified in seconds. 0 means
│ │ │ │ │ +permanent lease. Some routers do not support expiration times on port-maps (nor
│ │ │ │ │ +correctly returning an error indicating lack of support). In those cases, set
│ │ │ │ │ +this to 0. Otherwise, don't set it any lower than 5 minutes.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_a_x___c_o_n_c_u_r_r_e_n_t___h_t_t_p___a_n_n_o_u_n_c_e_s_|_i_n_t_ _|_5_0_ _ _ _ _ |
│ │ │ │ │ +limits the number of concurrent HTTP tracker announces. Once the limit is hit,
│ │ │ │ │ +tracker requests are queued and issued when an outstanding announce completes.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___m_a_x___p_e_e_r_s___r_e_p_l_y_|_i_n_t_ _|_1_0_0_ _ _ _ |
│ │ │ │ │ +the maximum number of peers to send in a reply to get_peers
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___s_e_a_r_c_h___b_r_a_n_c_h_i_n_g_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ +the number of concurrent search request the node will send when announcing and
│ │ │ │ │ +refreshing the routing table. This parameter is called alpha in the kademlia
│ │ │ │ │ +paper
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___m_a_x___f_a_i_l___c_o_u_n_t_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ +the maximum number of failed tries to contact a node before it is removed from
│ │ │ │ │ +the routing table. If there are known working nodes that are ready to replace a
│ │ │ │ │ +failing node, it will be replaced immediately, this limit is only used to clear
│ │ │ │ │ +out nodes that don't have any node that can replace them.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___m_a_x___t_o_r_r_e_n_t_s_|_i_n_t_ _|_2_0_0_0_ _ _ |
│ │ │ │ │ +the total number of torrents to track from the DHT. This is simply an upper
│ │ │ │ │ +limit to make sure malicious DHT nodes cannot make us allocate an unbounded
│ │ │ │ │ +amount of memory.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___m_a_x___d_h_t___i_t_e_m_s_|_i_n_t_ _|_7_0_0_ _ _ _ |
│ │ │ │ │ +max number of items the DHT will store
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___m_a_x___p_e_e_r_s_|_i_n_t_ _|_5_0_0_ _ _ _ |
│ │ │ │ │ +the max number of peers to store per torrent (for the DHT)
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___m_a_x___t_o_r_r_e_n_t___s_e_a_r_c_h___r_e_p_l_y_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ +the max number of torrents to return in a torrent search query to the DHT
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___b_l_o_c_k___t_i_m_e_o_u_t_|_i_n_t_ _|_5_ _*_ _6_0_ |
│ │ │ │ │ +the number of seconds a DHT node is banned if it exceeds the rate limit. The
│ │ │ │ │ +rate limit is averaged over 10 seconds to allow for bursts above the limit.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___b_l_o_c_k___r_a_t_e_l_i_m_i_t_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ +the max number of packets per second a DHT node is allowed to send without
│ │ │ │ │ +getting banned.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___i_t_e_m___l_i_f_e_t_i_m_e_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +the number of seconds a immutable/mutable item will be expired. default is 0,
│ │ │ │ │ +means never expires.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___s_a_m_p_l_e___i_n_f_o_h_a_s_h_e_s___i_n_t_e_r_v_a_l_|_i_n_t_ _|_2_1_6_0_0_ _ |
│ │ │ │ │ +the info-hashes sample recomputation interval (in seconds). The node will
│ │ │ │ │ +precompute a subset of the tracked info-hashes and return that instead of
│ │ │ │ │ +calculating it upon each request. The permissible range is between 0 and 21600
│ │ │ │ │ +seconds (inclusive).
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_d_h_t___m_a_x___i_n_f_o_h_a_s_h_e_s___s_a_m_p_l_e___c_o_u_n_t_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ +the maximum number of elements in the sampled subset of info-hashes. If this
│ │ │ │ │ +number is too big, expect the DHT storage implementations to clamp it in order
│ │ │ │ │ +to allow UDP packets go through
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ |
│ │ │ │ │ +|_m_a_x___p_i_e_c_e___c_o_u_n_t_|_i_n_t_ _|_0_x_2_0_0_0_0_0|
│ │ │ │ │ +max_piece_count is the maximum allowed number of pieces in metadata received
│ │ │ │ │ +via magnet links. Loading large torrents (with more pieces than the default
│ │ │ │ │ +limit) may also require passing in a higher limit to _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) and
│ │ │ │ │ +_t_o_r_r_e_n_t___i_n_f_o_:_:_p_a_r_s_e___i_n_f_o___s_e_c_t_i_o_n_(_), if those are used.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_e_t_a_d_a_t_a___t_o_k_e_n___l_i_m_i_t_|_i_n_t_ _|_2_5_0_0_0_0_0|
│ │ │ │ │ +when receiving metadata (torrent file) from peers, this is the max number of
│ │ │ │ │ +bencoded tokens we're willing to parse. This limit is meant to prevent DoS
│ │ │ │ │ +attacks on peers. For very large torrents, this limit may have to be raised.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_i_s_k___w_r_i_t_e___m_o_d_e_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_m_m_a_p___w_r_i_t_e___m_o_d_e___t_:_:_a_u_t_o___m_m_a_p___w_r_i_t_e|
│ │ │ │ │ +controls whether disk writes will be made through a memory mapped file or via
│ │ │ │ │ +normal write calls. This only affects the mmap_disk_io. When saving to a non-
│ │ │ │ │ +local drive (network share, NFS or NAS) using memory mapped files is most
│ │ │ │ │ +likely inferior. When writing to a local SSD (especially in DAX mode) using
│ │ │ │ │ +memory mapped files likely gives the best performance. The values for this
│ │ │ │ │ +setting are specified as _m_m_a_p___w_r_i_t_e___m_o_d_e___t.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_m_m_a_p___f_i_l_e___s_i_z_e___c_u_t_o_f_f_|_i_n_t_ _|_4_0_ _ _ _ _ |
│ │ │ │ │ +when using mmap_disk_io, files smaller than this number of blocks will not be
│ │ │ │ │ +memory mapped, but will use normal pread/pwrite operations. This file size
│ │ │ │ │ +limit is specified in 16 kiB blocks.
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_i_2_p___i_n_b_o_u_n_d___q_u_a_n_t_i_t_y_ _|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ +|_i_2_p___o_u_t_b_o_u_n_d___q_u_a_n_t_i_t_y_|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ +|_i_2_p___i_n_b_o_u_n_d___l_e_n_g_t_h_ _ _ _|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ +|_i_2_p___o_u_t_b_o_u_n_d___l_e_n_g_t_h_ _ _|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ +Configures the SAM _s_e_s_s_i_o_n quantity of I2P inbound and outbound tunnels
│ │ │ │ │ +[1..16]. number of hops for I2P inbound and outbound tunnels [0..7] Changing
│ │ │ │ │ +these will not trigger a reconnect to the SAM bridge, they will take effect the
│ │ │ │ │ +next time the SAM connection is re-established (by restarting or changing
│ │ │ │ │ +i2p_hostname or i2p_port).
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ +|_a_n_n_o_u_n_c_e___p_o_r_t_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ +announce_port is the port passed along as the port parameter to remote trackers
│ │ │ │ │ +such as HTTP or DHT. This setting does not affect the effective listening port
│ │ │ │ │ +nor local service discovery announcements. If left as zero (default), the
│ │ │ │ │ +listening port value is used.
│ │ │ │ │ +Note
│ │ │ │ │ +This setting is only meant for very special cases where a seed's listening port
│ │ │ │ │ +differs from the external port. As an example, if a local proxy is used and
│ │ │ │ │ +that the proxy supports reverse tunnels through NAT-PMP, the tracker must
│ │ │ │ │ +connect to the external NAT-PMP port (configured using announce_port) instead
│ │ │ │ │ +of the actual local listening port.
│ │ │ │ │ +struct settings_pack final : settings_interface
│ │ │ │ │ +{
│ │ │ │ │ +   friend  void aappppllyy__ppaacckk__iimmppll (settings_pack const*
│ │ │ │ │ +      , aux::session_settings_single_thread&
│ │ │ │ │ +      , std::vector<void(aux::session_impl::*)()>*);
│ │ │ │ │ +   void sseett__iinntt (int name, int val) override;
│ │ │ │ │ +   void sseett__bbooooll (int name, bool val) override;
│ │ │ │ │ +   void sseett__iinntt (int name, flags::bitfield_flag<Type, Tag> const val);
│ │ │ │ │ +   void sseett__ssttrr (int name, std::string val) override;
│ │ │ │ │ +   bool hhaass__vvaall (int name) const override;
│ │ │ │ │ +   void cclleeaarr ();
│ │ │ │ │ +   void cclleeaarr (int name);
│ │ │ │ │ +   std::string const& ggeett__ssttrr (int name) const override;
│ │ │ │ │ +   int ggeett__iinntt (int name) const override;
│ │ │ │ │ +   bool ggeett__bbooooll (int name) const override;
│ │ │ │ │ +   void ffoorr__eeaacchh (Fun&& f) const;
│ │ │ │ │ +
│ │ │ │ │ +   enum type_bases
│ │ │ │ │ +   {
│ │ │ │ │ +      string_type_base,
│ │ │ │ │ +      int_type_base,
│ │ │ │ │ +      bool_type_base,
│ │ │ │ │ +      type_mask,
│ │ │ │ │ +      index_mask,
│ │ │ │ │ +   };
│ │ │ │ │ +
│ │ │ │ │ +   enum mmap_write_mode_t
│ │ │ │ │ +   {
│ │ │ │ │ +      always_pwrite,
│ │ │ │ │ +      always_mmap_write,
│ │ │ │ │ +      auto_mmap_write,
│ │ │ │ │ +   };
│ │ │ │ │ +
│ │ │ │ │ +   enum suggest_mode_t
│ │ │ │ │ +   {
│ │ │ │ │ +      no_piece_suggestions,
│ │ │ │ │ +      suggest_read_cache,
│ │ │ │ │ +   };
│ │ │ │ │ +
│ │ │ │ │ +   enum choking_algorithm_t
│ │ │ │ │ +   {
│ │ │ │ │ +      fixed_slots_choker,
│ │ │ │ │ +      rate_based_choker,
│ │ │ │ │ +      deprecated_bittyrant_choker,
│ │ │ │ │ +   };
│ │ │ │ │ +
│ │ │ │ │ +   enum seed_choking_algorithm_t
│ │ │ │ │ +   {
│ │ │ │ │ +      round_robin,
│ │ │ │ │ +      fastest_upload,
│ │ │ │ │ +      anti_leech,
│ │ │ │ │ +   };
│ │ │ │ │ +
│ │ │ │ │ +   enum io_buffer_mode_t
│ │ │ │ │ +   {
│ │ │ │ │ +      enable_os_cache,
│ │ │ │ │ +      deprecated_disable_os_cache_for_aligned_files,
│ │ │ │ │ +      disable_os_cache,
│ │ │ │ │ +      write_through,
│ │ │ │ │ +   };
│ │ │ │ │ +
│ │ │ │ │ +   enum bandwidth_mixed_algo_t
│ │ │ │ │ +   {
│ │ │ │ │ +      prefer_tcp,
│ │ │ │ │ +      peer_proportional,
│ │ │ │ │ +   };
│ │ │ │ │ +
│ │ │ │ │ +   enum enc_policy
│ │ │ │ │ +   {
│ │ │ │ │ +      pe_forced,
│ │ │ │ │ +      pe_enabled,
│ │ │ │ │ +      pe_disabled,
│ │ │ │ │ +   };
│ │ │ │ │ +
│ │ │ │ │ +   enum enc_level
│ │ │ │ │ +   {
│ │ │ │ │ +      pe_plaintext,
│ │ │ │ │ +      pe_rc4,
│ │ │ │ │ +      pe_both,
│ │ │ │ │ +   };
│ │ │ │ │ +
│ │ │ │ │ +   enum proxy_type_t
│ │ │ │ │ +   {
│ │ │ │ │ +      none,
│ │ │ │ │ +      socks4,
│ │ │ │ │ +      socks5,
│ │ │ │ │ +      socks5_pw,
│ │ │ │ │ +      http,
│ │ │ │ │ +      http_pw,
│ │ │ │ │ +   };
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sseett__ssttrr(()) sseett__iinntt(()) sseett__bbooooll(()) **********
│ │ │ │ │ +void sseett__iinntt (int name, int val) override;
│ │ │ │ │ +void sseett__bbooooll (int name, bool val) override;
│ │ │ │ │ +void sseett__iinntt (int name, flags::bitfield_flag<Type, Tag> const val);
│ │ │ │ │ +void sseett__ssttrr (int name, std::string val) override;
│ │ │ │ │ +set a configuration option in the _s_e_t_t_i_n_g_s___p_a_c_k. name is one of the enum values
│ │ │ │ │ +from string_types, int_types or bool_types. They must match the respective type
│ │ │ │ │ +of the set_* function.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** hhaass__vvaall(()) **********
│ │ │ │ │ +bool hhaass__vvaall (int name) const override;
│ │ │ │ │ +queries whether the specified configuration option has a value set in this
│ │ │ │ │ +pack. name can be any enumeration value from string_types, int_types or
│ │ │ │ │ +bool_types.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** cclleeaarr(()) **********
│ │ │ │ │ +void cclleeaarr ();
│ │ │ │ │ +clear the settings pack from all settings
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** cclleeaarr(()) **********
│ │ │ │ │ +void cclleeaarr (int name);
│ │ │ │ │ +clear a specific setting from the pack
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ggeett__iinntt(()) ggeett__bbooooll(()) ggeett__ssttrr(()) **********
│ │ │ │ │ +std::string const& ggeett__ssttrr (int name) const override;
│ │ │ │ │ +int ggeett__iinntt (int name) const override;
│ │ │ │ │ +bool ggeett__bbooooll (int name) const override;
│ │ │ │ │ +queries the current configuration option from the _s_e_t_t_i_n_g_s___p_a_c_k. name is one of
│ │ │ │ │ +the enumeration values from string_types, int_types or bool_types. The enum
│ │ │ │ │ +value must match the type of the get_* function. If the specified setting field
│ │ │ │ │ +has not been set, the default value is returned.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm ttyyppee__bbaasseess **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_s_t_r_i_n_g___t_y_p_e___b_a_s_e_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_n_t___t_y_p_e___b_a_s_e_ _ _ _|_1_6_3_8_4_|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_b_o_o_l___t_y_p_e___b_a_s_e_ _ _|_3_2_7_6_8_|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_t_y_p_e___m_a_s_k_ _ _ _ _ _ _ _|_4_9_1_5_2_|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_n_d_e_x___m_a_s_k_ _ _ _ _ _ _|_1_6_3_8_3_|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm mmmmaapp__wwrriittee__mmooddee__tt **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|always_pwrite    |0    |disable writing to disk via mmap, always use normal |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_r_i_t_e_ _c_a_l_l_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|always_mmap_write|1    |prefer using memory mapped files for disk writes (at|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_l_e_a_s_t_ _f_o_r_ _l_a_r_g_e_ _f_i_l_e_s_ _w_h_e_r_e_ _i_t_ _m_i_g_h_t_ _m_a_k_e_ _s_e_n_s_e_)_ _ _ _ |
│ │ │ │ │ +|                 |     |determine whether to use pwrite or memory mapped    |
│ │ │ │ │ +|auto_mmap_write  |2    |files for disk writes depending on the kind of      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_t_o_r_a_g_e_ _b_e_h_i_n_d_ _t_h_e_ _s_a_v_e_ _p_a_t_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm ssuuggggeesstt__mmooddee__tt **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_n_o___p_i_e_c_e___s_u_g_g_e_s_t_i_o_n_s_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_u_g_g_e_s_t___r_e_a_d___c_a_c_h_e_ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm cchhookkiinngg__aallggoorriitthhmm__tt **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                           |     |This is the traditional choker with a fixed|
│ │ │ │ │ +|fixed_slots_choker         |0    |number of unchoke slots (as specified by   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_u_n_c_h_o_k_e___s_l_o_t_s___l_i_m_i_t_)_._ _ _ _ _ _ _ |
│ │ │ │ │ +|                           |     |This opens up unchoke slots based on the   |
│ │ │ │ │ +|                           |     |upload rate achieved to peers. The more    |
│ │ │ │ │ +|                           |     |slots that are opened, the marginal upload |
│ │ │ │ │ +|                           |     |rate required to open up another slot      |
│ │ │ │ │ +|rate_based_choker          |2    |increases. Configure the initial threshold |
│ │ │ │ │ +|                           |     |with _s_e_t_t_i_n_g_s___p_a_c_k_:_:                       |
│ │ │ │ │ +|                           |     |_r_a_t_e___c_h_o_k_e_r___i_n_i_t_i_a_l___t_h_r_e_s_h_o_l_d.             |
│ │ │ │ │ +|                           |     |For more information, see _r_a_t_e_ _b_a_s_e_d       |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_h_o_k_i_n_g_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_e_p_r_e_c_a_t_e_d___b_i_t_t_y_r_a_n_t___c_h_o_k_e_r_|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm sseeeedd__cchhookkiinngg__aallggoorriitthhmm__tt **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|              |     |which round-robins the peers that are unchoked when     |
│ │ │ │ │ +|round_robin   |0    |seeding. This distributes the upload bandwidth uniformly|
│ │ │ │ │ +|              |     |and fairly. It minimizes the ability for a peer to      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_o_w_n_l_o_a_d_ _e_v_e_r_y_t_h_i_n_g_ _w_i_t_h_o_u_t_ _r_e_d_i_s_t_r_i_b_u_t_i_n_g_ _i_t_._ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|              |     |unchokes the peers we can send to the fastest. This     |
│ │ │ │ │ +|fastest_upload|1    |might be a bit more reliable in utilizing all available |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_a_p_a_c_i_t_y_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|              |     |prioritizes peers who have just started or are just     |
│ │ │ │ │ +|              |     |about to finish the download. The intention is to force |
│ │ │ │ │ +|anti_leech    |2    |peers in the middle of the download to trade with each  |
│ │ │ │ │ +|              |     |other. This does not just take into account the pieces a|
│ │ │ │ │ +|              |     |peer is reporting having downloaded, but also the pieces|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_e_ _h_a_v_e_ _s_e_n_t_ _t_o_ _i_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm iioo__bbuuffffeerr__mmooddee__tt **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_e_n_a_b_l_e___o_s___c_a_c_h_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_e_p_r_e_c_a_t_e_d___d_i_s_a_b_l_e___o_s___c_a_c_h_e___f_o_r___a_l_i_g_n_e_d___f_i_l_e_s_|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_i_s_a_b_l_e___o_s___c_a_c_h_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_w_r_i_t_e___t_h_r_o_u_g_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm bbaannddwwiiddtthh__mmiixxeedd__aallggoo__tt **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_r_e_f_e_r___t_c_p_ _ _ _ _ _ _ _|_0_ _ _ _ _|_d_i_s_a_b_l_e_s_ _t_h_e_ _m_i_x_e_d_ _m_o_d_e_ _b_a_n_d_w_i_d_t_h_ _b_a_l_a_n_c_i_n_g_ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|peer_proportional|1    |does not throttle uTP, throttles TCP to the same     |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_r_o_p_o_r_t_i_o_n_ _o_f_ _t_h_r_o_u_g_h_p_u_t_ _a_s_ _t_h_e_r_e_ _a_r_e_ _T_C_P_ _c_o_n_n_e_c_t_i_o_n_s|
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm eenncc__ppoolliiccyy **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|           |     |Only encrypted connections are allowed. Incoming          |
│ │ │ │ │ +|pe_forced  |0    |connections that are not encrypted are closed and if the  |
│ │ │ │ │ +|           |     |encrypted outgoing connection fails, a non-encrypted retry|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_i_l_l_ _n_o_t_ _b_e_ _m_a_d_e_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|           |     |encrypted connections are enabled, but non-encrypted      |
│ │ │ │ │ +|           |     |connections are allowed. An incoming non-encrypted        |
│ │ │ │ │ +|pe_enabled |1    |connection will be accepted, and if an outgoing encrypted |
│ │ │ │ │ +|           |     |connection fails, a non- encrypted connection will be     |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_r_i_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_e___d_i_s_a_b_l_e_d_|_2_ _ _ _ _|_o_n_l_y_ _n_o_n_-_e_n_c_r_y_p_t_e_d_ _c_o_n_n_e_c_t_i_o_n_s_ _a_r_e_ _a_l_l_o_w_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm eenncc__lleevveell **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_e___p_l_a_i_n_t_e_x_t_|_1_ _ _ _ _|_u_s_e_ _o_n_l_y_ _p_l_a_i_n_ _t_e_x_t_ _e_n_c_r_y_p_t_i_o_n|
│ │ │ │ │ +|_p_e___r_c_4_ _ _ _ _ _ _|_2_ _ _ _ _|_u_s_e_ _o_n_l_y_ _R_C_4_ _e_n_c_r_y_p_t_i_o_n_ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_e___b_o_t_h_ _ _ _ _ _|_3_ _ _ _ _|_a_l_l_o_w_ _b_o_t_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm pprrooxxyy__ttyyppee__tt **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_o_n_e_ _ _ _ _ _|_0_ _ _ _ _|_N_o_ _p_r_o_x_y_ _s_e_r_v_e_r_ _i_s_ _u_s_e_d_ _a_n_d_ _a_l_l_ _o_t_h_e_r_ _f_i_e_l_d_s_ _a_r_e_ _i_g_n_o_r_e_d_._ _ _ _ |
│ │ │ │ │ +|socks4   |1    |The server is assumed to be a _S_O_C_K_S_4_ _s_e_r_v_e_r that requires a  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_u_s_e_r_n_a_m_e_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|         |     |The server is assumed to be a SOCKS5 server (_R_F_C_ _1_9_2_8) that  |
│ │ │ │ │ +|socks5   |2    |does not require any authentication. The username and        |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_a_s_s_w_o_r_d_ _a_r_e_ _i_g_n_o_r_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|         |     |The server is assumed to be a SOCKS5 server that supports    |
│ │ │ │ │ +|socks5_pw|3    |plain text username and password authentication (_R_F_C_ _1_9_2_9).  |
│ │ │ │ │ +|         |     |The username and password specified may be sent to the proxy |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_f_ _i_t_ _r_e_q_u_i_r_e_s_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|         |     |The server is assumed to be an HTTP proxy. If the transport  |
│ │ │ │ │ +|         |     |used for the connection is non-HTTP, the server is assumed to|
│ │ │ │ │ +|http     |4    |support the _C_O_N_N_E_C_T method. i.e. for web seeds and HTTP      |
│ │ │ │ │ +|         |     |trackers, a plain proxy will suffice. The proxy is assumed to|
│ │ │ │ │ +|         |     |not require authorization. The username and password will not|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_e_ _u_s_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|         |     |The server is assumed to be an HTTP proxy that requires user |
│ │ │ │ │ +|http_pw  |5    |authorization. The username and password will be sent to the |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_r_o_x_y_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ sseettttiinngg__bbyy__nnaammee(()) nnaammee__ffoorr__sseettttiinngg(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ +char const* nnaammee__ffoorr__sseettttiinngg (int s);
│ │ │ │ │ +int sseettttiinngg__bbyy__nnaammee (string_view name);
│ │ │ │ │ +converts a setting integer (from the enums string_types, int_types or
│ │ │ │ │ +bool_types) to a string, and vice versa.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ddeeffaauulltt__sseettttiinnggss(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ +settings_pack ddeeffaauulltt__sseettttiinnggss ();
│ │ │ │ │ +returns a _s_e_t_t_i_n_g_s___p_a_c_k with every setting set to its default value
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ hhiigghh__ppeerrffoorrmmaannccee__sseeeedd(()) mmiinn__mmeemmoorryy__uussaaggee(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n_._h_p_p"
│ │ │ │ │ +settings_pack mmiinn__mmeemmoorryy__uussaaggee ();
│ │ │ │ │ +settings_pack hhiigghh__ppeerrffoorrmmaannccee__sseeeedd ();
│ │ │ │ │ +The default values of the _s_e_s_s_i_o_n settings are set for a regular bittorrent
│ │ │ │ │ +client running on a desktop system. There are functions that can set the
│ │ │ │ │ +_s_e_s_s_i_o_n settings to pre set settings for other environments. These can be used
│ │ │ │ │ +for the basis, and should be tweaked to fit your needs better.
│ │ │ │ │ +min_memory_usage 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.
│ │ │ │ │ +This configuration is intended to be the starting point for embedded devices.
│ │ │ │ │ +It will significantly reduce memory usage.
│ │ │ │ │ +high_performance_seed 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.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ggeenneerraattee__ffiinnggeerrpprriinntt(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_f_i_n_g_e_r_p_r_i_n_t_._h_p_p"
│ │ │ │ │ +std::string ggeenneerraattee__ffiinnggeerrpprriinntt (std::string name
│ │ │ │ │ +   , int major, int minor = 0, int revision = 0, int tag = 0);
│ │ │ │ │ +This is a utility function to produce a client ID fingerprint formatted to the
│ │ │ │ │ +most common convention. The fingerprint can be set via the peer_fingerprint
│ │ │ │ │ +setting, in _s_e_t_t_i_n_g_s___p_a_c_k.
│ │ │ │ │ +The name string should contain exactly two characters. These are the characters
│ │ │ │ │ +unique to your client, used to identify it. Make sure not to clash with anybody
│ │ │ │ │ +else. Here are some taken id's:
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_ii_dd_ _cc_hh_aa_rr_ss_|_cc_ll_ii_ee_nn_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_L_T_ _ _ _ _ _ _|_l_i_b_t_o_r_r_e_n_t_ _(_d_e_f_a_u_l_t_)|
│ │ │ │ │ +|_U_T_ _ _ _ _ _ _|_u_T_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_U_M_ _ _ _ _ _ _|_u_T_o_r_r_e_n_t_ _M_a_c_ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_q_B_ _ _ _ _ _ _|_q_B_i_t_t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_B_P_ _ _ _ _ _ _|_B_i_t_T_o_r_r_e_n_t_ _P_r_o_ _ _ _ _ _ |
│ │ │ │ │ +|_B_T_ _ _ _ _ _ _|_B_i_t_T_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_D_E_ _ _ _ _ _ _|_D_e_l_u_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_A_Z_ _ _ _ _ _ _|_A_z_u_r_e_u_s_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_T_L_ _ _ _ _ _ _|_T_r_i_b_l_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +There's an informal directory of client id's _h_e_r_e.
│ │ │ │ │ +The major, minor, revision and tag parameters are used to identify the version
│ │ │ │ │ +of your client.
│ │ │ │ │ +This section describes the functions and classes that are used to create
│ │ │ │ │ +torrent files. It is a layered API with low level classes and higher level
│ │ │ │ │ +convenience functions. A torrent is created in 4 steps:
│ │ │ │ │ +   1. first the files that will be part of the torrent are determined.
│ │ │ │ │ +   2. the torrent properties are set, such as tracker url, web seeds, DHT nodes
│ │ │ │ │ +      etc.
│ │ │ │ │ +   3. Read through all the files in the torrent, SHA-1 all the data and set the
│ │ │ │ │ +      piece hashes.
│ │ │ │ │ +   4. The torrent is bencoded into a file or buffer.
│ │ │ │ │ +If there are a lot of files and or deep directory hierarchies to traverse, step
│ │ │ │ │ +one can be time consuming.
│ │ │ │ │ +Typically step 3 is by far the most time consuming step, since it requires to
│ │ │ │ │ +read all the bytes from all the files in the torrent.
│ │ │ │ │ +All of these classes and functions are declared by including libtorrent/
│ │ │ │ │ +create_torrent.hpp.
│ │ │ │ │ +example:
│ │ │ │ │ +file_storage fs;
│ │ │ │ │ +
│ │ │ │ │ +// recursively adds files in directories
│ │ │ │ │ +add_files(fs, "./my_torrent");
│ │ │ │ │ +
│ │ │ │ │ +create_torrent t(fs);
│ │ │ │ │ +t.add_tracker("http://my.tracker.com/announce");
│ │ │ │ │ +t.set_creator("libtorrent example");
│ │ │ │ │ +
│ │ │ │ │ +// reads the files and calculates the hashes
│ │ │ │ │ +set_piece_hashes(t, ".");
│ │ │ │ │ +
│ │ │ │ │ +ofstream out("my_torrent.torrent", std::ios_base::binary);
│ │ │ │ │ +std::vector<char> buf = t.generate_buf();
│ │ │ │ │ +out.write(buf.data(), buf.size());
│ │ │ │ │ +
│ │ │ │ │ +// alternatively, generate an entry and encode it directly to an ostream
│ │ │ │ │ +// iterator
│ │ │ │ │ +bencode(std::ostream_iterator<char>(out), t.generate());
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ccrreeaattee__ttoorrrreenntt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_r_e_a_t_e___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │ +This class holds state for creating a torrent. After having added all
│ │ │ │ │ +information to it, call _c_r_e_a_t_e___t_o_r_r_e_n_t_:_:_g_e_n_e_r_a_t_e_(_) to generate the torrent. The
│ │ │ │ │ +_e_n_t_r_y that's returned can then be bencoded into a .torrent file using _b_e_n_c_o_d_e
│ │ │ │ │ +_(_).
│ │ │ │ │ +struct create_torrent
│ │ │ │ │ +{
│ │ │ │ │ +   explicit ccrreeaattee__ttoorrrreenntt (file_storage& fs, int piece_size = 0
│ │ │ │ │ +      , create_flags_t flags = {});
│ │ │ │ │ +   explicit ccrreeaattee__ttoorrrreenntt (torrent_info const& ti);
│ │ │ │ │ +   entry ggeenneerraattee () const;
│ │ │ │ │ +   std::vector<char> ggeenneerraattee__bbuuff () const;
│ │ │ │ │ +   file_storage const& ffiilleess () const;
│ │ │ │ │ +   void sseett__ccoommmmeenntt (char const* str);
│ │ │ │ │ +   void sseett__ccrreeaattoorr (char const* str);
│ │ │ │ │ +   void sseett__ccrreeaattiioonn__ddaattee (std::time_t timestamp);
│ │ │ │ │ +   void sseett__hhaasshh (piece_index_t index, sha1_hash const& h);
│ │ │ │ │ +   void sseett__hhaasshh22 (file_index_t file, piece_index_t::diff_type piece,
│ │ │ │ │ +sha256_hash const& h);
│ │ │ │ │ +   void aadddd__hhttttpp__sseeeedd (string_view url);
│ │ │ │ │ +   void aadddd__uurrll__sseeeedd (string_view url);
│ │ │ │ │ +   void aadddd__nnooddee (std::pair<std::string, int> node);
│ │ │ │ │ +   void aadddd__ttrraacckkeerr (string_view url, int tier = 0);
│ │ │ │ │ +   void sseett__rroooott__cceerrtt (string_view cert);
│ │ │ │ │ +   bool pprriivv () const;
│ │ │ │ │ +   void sseett__pprriivv (bool p);
│ │ │ │ │ +   bool iiss__vv22__oonnllyy () const;
│ │ │ │ │ +   bool iiss__vv11__oonnllyy () const;
│ │ │ │ │ +   int nnuumm__ppiieecceess () const;
│ │ │ │ │ +   piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ +   index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │ +   file_index_t eenndd__ffiillee () const;
│ │ │ │ │ +   index_range<file_index_t> ffiillee__rraannggee () const noexcept;
│ │ │ │ │ +   index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t f);
│ │ │ │ │ +   std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ +   int ppiieeccee__ssiizzee (piece_index_t i) const;
│ │ │ │ │ +   int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ +   void aadddd__ccoolllleeccttiioonn (string_view c);
│ │ │ │ │ +   void aadddd__ssiimmiillaarr__ttoorrrreenntt (sha1_hash ih);
│ │ │ │ │ +
│ │ │ │ │ +   static constexpr create_flags_t mmooddiiffiiccaattiioonn__ttiimmee  = 2_bit;
│ │ │ │ │ +   static constexpr create_flags_t ssyymmlliinnkkss  = 3_bit;
│ │ │ │ │ +   static constexpr create_flags_t vv22__oonnllyy  = 5_bit;
│ │ │ │ │ +   static constexpr create_flags_t vv11__oonnllyy  = 6_bit;
│ │ │ │ │ +   static constexpr create_flags_t ccaannoonniiccaall__ffiilleess  = 7_bit;
│ │ │ │ │ +   static constexpr create_flags_t nnoo__aattttrriibbuutteess  = 8_bit;
│ │ │ │ │ +   static constexpr create_flags_t ccaannoonniiccaall__ffiilleess__nnoo__ttaaiill__ppaaddddiinngg  = 9_bit;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ccrreeaattee__ttoorrrreenntt(()) **********
│ │ │ │ │ +explicit ccrreeaattee__ttoorrrreenntt (file_storage& fs, int piece_size = 0
│ │ │ │ │ +      , create_flags_t flags = {});
│ │ │ │ │ +explicit ccrreeaattee__ttoorrrreenntt (torrent_info const& ti);
│ │ │ │ │ +The piece_size is the size of each piece in bytes. It must be a power of 2 and
│ │ │ │ │ +a minimum of 16 kiB. If a piece size of 0 is specified, a piece_size will be
│ │ │ │ │ +set automatically. Piece sizes greater than 128 MiB are considered unreasonable
│ │ │ │ │ +and will be rejected (with an lt::system_error exception).
│ │ │ │ │ +The flags arguments specifies options for the torrent creation. It can be any
│ │ │ │ │ +combination of the flags defined by create_flags_t.
│ │ │ │ │ +The _f_i_l_e___s_t_o_r_a_g_e (fs) parameter defines the files, sizes and their properties
│ │ │ │ │ +for the torrent to be created. Set this up first, before passing it to the
│ │ │ │ │ +_c_r_e_a_t_e___t_o_r_r_e_n_t constructor.
│ │ │ │ │ +The overload that takes a torrent_info object will make a verbatim copy of its
│ │ │ │ │ +info dictionary (to preserve the info-hash). The copy of the info dictionary
│ │ │ │ │ +will be used by _c_r_e_a_t_e___t_o_r_r_e_n_t_:_:_g_e_n_e_r_a_t_e_(_). This means that none of the member
│ │ │ │ │ +functions of _c_r_e_a_t_e___t_o_r_r_e_n_t that affects the content of the info dictionary
│ │ │ │ │ +(such as _s_e_t___h_a_s_h_(_)), will have any affect. Instead of using this overload,
│ │ │ │ │ +consider using _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_) instead.
│ │ │ │ │ +Warning
│ │ │ │ │ +The _f_i_l_e___s_t_o_r_a_g_e and _t_o_r_r_e_n_t___i_n_f_o objects must stay alive for the entire
│ │ │ │ │ +duration of the _c_r_e_a_t_e___t_o_r_r_e_n_t object.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ggeenneerraattee(()) ggeenneerraattee__bbuuff(()) **********
│ │ │ │ │ +entry ggeenneerraattee () const;
│ │ │ │ │ +std::vector<char> ggeenneerraattee__bbuuff () const;
│ │ │ │ │ +This function will generate the .torrent file as a bencode tree, or a bencoded
│ │ │ │ │ +into a buffer. In order to encode the _e_n_t_r_y into a flat file, use the _b_e_n_c_o_d_e_(_)
│ │ │ │ │ +function.
│ │ │ │ │ +The function returning an _e_n_t_r_y may be useful to add custom entries to the
│ │ │ │ │ +torrent file before bencoding it and saving it to disk.
│ │ │ │ │ +Whether the resulting torrent object is v1, v2 or hybrid depends on whether any
│ │ │ │ │ +of the v1_only or v2_only flags were set on the constructor. If neither were
│ │ │ │ │ +set, the resulting torrent depends on which hashes were set. If both v1 and v2
│ │ │ │ │ +hashes were set, a hybrid torrent is created.
│ │ │ │ │ +Any failure will cause this function to throw system_error, with an appropriate
│ │ │ │ │ +error message. These are the reasons this call may throw:
│ │ │ │ │ +    * the file storage has 0 files
│ │ │ │ │ +    * the total size of the file storage is 0 bytes (i.e. it only has empty
│ │ │ │ │ +      files)
│ │ │ │ │ +    * not all v1 hashes (_s_e_t___h_a_s_h_(_)) and not all v2 hashes (_s_e_t___h_a_s_h_2_(_)) were
│ │ │ │ │ +      set
│ │ │ │ │ +    * for v2 torrents, you may not have a directory with the same name as a
│ │ │ │ │ +      file. If that's encountered in the file storage, _g_e_n_e_r_a_t_e_(_) fails.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiilleess(()) **********
│ │ │ │ │ +file_storage const& ffiilleess () const;
│ │ │ │ │ +returns an immutable reference to the _f_i_l_e___s_t_o_r_a_g_e used to create the torrent
│ │ │ │ │ +from.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sseett__ccoommmmeenntt(()) **********
│ │ │ │ │ +void sseett__ccoommmmeenntt (char const* str);
│ │ │ │ │ +Sets the comment for the torrent. The string str should be utf-8 encoded. The
│ │ │ │ │ +comment in a torrent file is optional.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sseett__ccrreeaattoorr(()) **********
│ │ │ │ │ +void sseett__ccrreeaattoorr (char const* str);
│ │ │ │ │ +Sets the creator of the torrent. The string str should be utf-8 encoded. This
│ │ │ │ │ +is optional.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sseett__ccrreeaattiioonn__ddaattee(()) **********
│ │ │ │ │ +void sseett__ccrreeaattiioonn__ddaattee (std::time_t timestamp);
│ │ │ │ │ +sets the "creation time" field. Defaults to the system clock at the time of
│ │ │ │ │ +construction of the _c_r_e_a_t_e___t_o_r_r_e_n_t object. The timestamp is specified in
│ │ │ │ │ +seconds, posix time. If the creation date is set to 0, the "creation date"
│ │ │ │ │ +field will be omitted from the generated torrent.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sseett__hhaasshh(()) **********
│ │ │ │ │ +void sseett__hhaasshh (piece_index_t index, sha1_hash const& h);
│ │ │ │ │ +This sets the SHA-1 hash for the specified piece (index). You are required to
│ │ │ │ │ +set the hash for every piece in the torrent before generating it. If you have
│ │ │ │ │ +the files on disk, you can use the high level convenience function to do this.
│ │ │ │ │ +See _s_e_t___p_i_e_c_e___h_a_s_h_e_s_(_). A SHA-1 hash of all zeros is internally used to
│ │ │ │ │ +indicate a hash that has not been set. Setting such hash will not be considered
│ │ │ │ │ +set when calling _g_e_n_e_r_a_t_e_(_). This function will throw std::system_error if it
│ │ │ │ │ +is called on an object constructed with the v2_only flag.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sseett__hhaasshh22(()) **********
│ │ │ │ │ +void sseett__hhaasshh22 (file_index_t file, piece_index_t::diff_type piece, sha256_hash
│ │ │ │ │ +const& h);
│ │ │ │ │ +sets the bittorrent v2 hash for filefileof the piecepiece.pieceis relative to
│ │ │ │ │ +the first piece of the file, starting at 0. The first piece in the file can be
│ │ │ │ │ +computed with _f_i_l_e___s_t_o_r_a_g_e_:_:_f_i_l_e___i_n_d_e_x___a_t___p_i_e_c_e_(_). The hash,h, is the root of
│ │ │ │ │ +the merkle tree formed by the piece's 16 kiB blocks. Note that piece sizes must
│ │ │ │ │ +be powers-of-2, so all per-piece merkle trees are complete. A SHA-256 hash of
│ │ │ │ │ +all zeros is internally used to indicate a hash that has not been set. Setting
│ │ │ │ │ +such hash will not be considered set when calling _g_e_n_e_r_a_t_e_(_). This function
│ │ │ │ │ +will throw std::system_error if it is called on an object constructed with the
│ │ │ │ │ +v1_only flag.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aadddd__uurrll__sseeeedd(()) aadddd__hhttttpp__sseeeedd(()) **********
│ │ │ │ │ +void aadddd__hhttttpp__sseeeedd (string_view url);
│ │ │ │ │ +void aadddd__uurrll__sseeeedd (string_view url);
│ │ │ │ │ +This adds a url seed to the torrent. You can have any number of url seeds. For
│ │ │ │ │ +a single file torrent, this should be an HTTP url, pointing to a file with
│ │ │ │ │ +identical content as the file of the torrent. For a multi-file torrent, it
│ │ │ │ │ +should point to a directory containing a directory with the same name as this
│ │ │ │ │ +torrent, and all the files of the torrent in it.
│ │ │ │ │ +The second function, add_http_seed() adds an HTTP seed instead.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aadddd__nnooddee(()) **********
│ │ │ │ │ +void aadddd__nnooddee (std::pair<std::string, int> node);
│ │ │ │ │ +This adds a DHT node to the torrent. This especially useful if you're creating
│ │ │ │ │ +a tracker less torrent. It can be used by clients to bootstrap their DHT node
│ │ │ │ │ +from. The node is a hostname and a port number where there is a DHT node
│ │ │ │ │ +running. You can have any number of DHT nodes in a torrent.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aadddd__ttrraacckkeerr(()) **********
│ │ │ │ │ +void aadddd__ttrraacckkeerr (string_view url, int tier = 0);
│ │ │ │ │ +Adds a tracker to the torrent. This is not strictly required, but most torrents
│ │ │ │ │ +use a tracker as their main source of peers. The url should be an _h_t_t_p_:_/_/ or
│ │ │ │ │ +udp:// url to a machine running a bittorrent tracker that accepts announces for
│ │ │ │ │ +this torrent's info-hash. The tier is the fallback priority of the tracker. All
│ │ │ │ │ +trackers with tier 0 are tried first (in any order). If all fail, trackers with
│ │ │ │ │ +tier 1 are tried. If all of those fail, trackers with tier 2 are tried, and so
│ │ │ │ │ +on.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sseett__rroooott__cceerrtt(()) **********
│ │ │ │ │ +void sseett__rroooott__cceerrtt (string_view cert);
│ │ │ │ │ +This function sets an X.509 certificate in PEM format to the torrent. This
│ │ │ │ │ +makes the torrent an SSSSLL ttoorrrreenntt. An SSL torrent requires that each peer has a
│ │ │ │ │ +valid certificate signed by this root certificate. For SSL torrents, all peers
│ │ │ │ │ +are connecting over SSL connections. For more information, see the section on
│ │ │ │ │ +_s_s_l_ _t_o_r_r_e_n_t_s.
│ │ │ │ │ +The string is not the path to the cert, it's the actual content of the
│ │ │ │ │ +certificate.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** pprriivv(()) sseett__pprriivv(()) **********
│ │ │ │ │ +bool pprriivv () const;
│ │ │ │ │ +void sseett__pprriivv (bool p);
│ │ │ │ │ +Sets and queries the private flag of the torrent. Torrents with the private
│ │ │ │ │ +flag set ask the client to not use any other sources than the tracker for
│ │ │ │ │ +peers, and to not use DHT to advertise itself publicly, only the tracker.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** nnuumm__ppiieecceess(()) **********
│ │ │ │ │ +int nnuumm__ppiieecceess () const;
│ │ │ │ │ +returns the number of pieces in the associated _f_i_l_e___s_t_o_r_a_g_e object.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ppiieeccee__rraannggee(()) **********
│ │ │ │ │ +index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │ +all piece indices in the torrent to be created
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__rraannggee(()) **********
│ │ │ │ │ +index_range<file_index_t> ffiillee__rraannggee () const noexcept;
│ │ │ │ │ +all file indices in the torrent to be created
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__ppiieeccee__rraannggee(()) **********
│ │ │ │ │ +index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t f);
│ │ │ │ │ +for v2 and hybrid torrents only, the pieces in the specified file, specified as
│ │ │ │ │ +delta from the first piece in the file. i.e. the first index is 0.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ttoottaall__ssiizzee(()) **********
│ │ │ │ │ +std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ +the total number of bytes of all files and pad files
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ppiieeccee__lleennggtthh(()) ppiieeccee__ssiizzee(()) **********
│ │ │ │ │ +int ppiieeccee__ssiizzee (piece_index_t i) const;
│ │ │ │ │ +int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ +piece_length() returns the piece size of all pieces but the last one.
│ │ │ │ │ +piece_size() returns the size of the specified piece. these functions are just
│ │ │ │ │ +forwarding to the associated _f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aadddd__ccoolllleeccttiioonn(()) aadddd__ssiimmiillaarr__ttoorrrreenntt(()) **********
│ │ │ │ │ +void aadddd__ccoolllleeccttiioonn (string_view c);
│ │ │ │ │ +void aadddd__ssiimmiillaarr__ttoorrrreenntt (sha1_hash ih);
│ │ │ │ │ +Add similar torrents (by info-hash) or collections of similar torrents. Similar
│ │ │ │ │ +torrents are expected to share some files with this torrent. Torrents sharing a
│ │ │ │ │ +collection name with this torrent are also expected to share files with this
│ │ │ │ │ +torrent. A torrent may have more than one collection and more than one similar
│ │ │ │ │ +torrents. For more information, see _B_E_P_ _3_8.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  modification_time
│ │ │ │ │ +      This will include the file modification time as part of the torrent. This
│ │ │ │ │ +      is not enabled by default, as it might cause problems when you create a
│ │ │ │ │ +      torrent from separate files with the same content, hoping to yield the
│ │ │ │ │ +      same info-hash. If the files have different modification times, with this
│ │ │ │ │ +      option enabled, you would get different info-hashes for the files.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  symlinks
│ │ │ │ │ +      If this flag is set, files that are symlinks get a symlink attribute set
│ │ │ │ │ +      on them and their data will not be included in the torrent. This is
│ │ │ │ │ +      useful if you need to reconstruct a file hierarchy which contains
│ │ │ │ │ +      symlinks.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  v2_only
│ │ │ │ │ +      Do not generate v1 metadata. The resulting torrent will only be usable by
│ │ │ │ │ +      clients which support v2. This requires setting all v2 hashes, with
│ │ │ │ │ +      _s_e_t___h_a_s_h_2_(_) before calling _g_e_n_e_r_a_t_e_(_). Setting v1 hashes (with _s_e_t___h_a_s_h
│ │ │ │ │ +      _(_)) is an error with this flag set.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  v1_only
│ │ │ │ │ +      do not generate v2 metadata or enforce v2 alignment and padding rules
│ │ │ │ │ +      this is mainly for tests, not recommended for production use. This
│ │ │ │ │ +      requires setting all v1 hashes, with _s_e_t___h_a_s_h_(_), before calling _g_e_n_e_r_a_t_e
│ │ │ │ │ +      _(_). Setting v2 hashes (with _s_e_t___h_a_s_h_2_(_)) is an error with this flag set.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  canonical_files
│ │ │ │ │ +      This flag only affects v1-only torrents, and is only relevant together
│ │ │ │ │ +      with the v1_only_flag. This flag will force the same file order and
│ │ │ │ │ +      padding as a v2 (or hybrid) torrent would have. It has the effect of
│ │ │ │ │ +      ordering files and inserting pad files to align them with piece
│ │ │ │ │ +      boundaries.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  no_attributes
│ │ │ │ │ +      passing this flag to _a_d_d___f_i_l_e_s_(_) will ignore file attributes (such as
│ │ │ │ │ +      executable or hidden) when adding the files to the file storage. Since
│ │ │ │ │ +      not all filesystems and operating systems support all file attributes the
│ │ │ │ │ +      resulting torrent may differ depending on where it's created. If it's
│ │ │ │ │ +      important for torrents to be created consistently across systems, this
│ │ │ │ │ +      flag should be set.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  canonical_files_no_tail_padding
│ │ │ │ │ +      this flag enforces the file layout to be canonical according to the
│ │ │ │ │ +      bittorrent v2 specification (just like the canonical_files flag) with the
│ │ │ │ │ +      one exception that tail padding is not added to the last file. This
│ │ │ │ │ +      behavior deviates from the specification but was the way libtorrent
│ │ │ │ │ +      created torrents in version up to and including 2.0.7. This flag is here
│ │ │ │ │ +      for backwards compatibility.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ aadddd__ffiilleess(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_r_e_a_t_e___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │ +void aadddd__ffiilleess (file_storage& fs, std::string const& file
│ │ │ │ │ +   , std::function<bool(std::string)> p, create_flags_t flags = {});
│ │ │ │ │ +void aadddd__ffiilleess (file_storage& fs, std::string const& file
│ │ │ │ │ +   , create_flags_t flags = {});
│ │ │ │ │ +Adds the file specified by path to the _f_i_l_e___s_t_o_r_a_g_e object. In case path refers
│ │ │ │ │ +to a directory, files will be added recursively from the directory.
│ │ │ │ │ +If specified, the predicate p is called once for every file and directory that
│ │ │ │ │ +is encountered. Files for which p returns true are added, and directories for
│ │ │ │ │ +which p returns true are traversed. p must have the following signature:
│ │ │ │ │ +bool Pred(std::string const& p);
│ │ │ │ │ +The path that is passed in to the predicate is the full path of the file or
│ │ │ │ │ +directory. If no predicate is specified, all files are added, and all
│ │ │ │ │ +directories are traversed.
│ │ │ │ │ +The ".." directory is never traversed.
│ │ │ │ │ +The flags argument should be the same as the flags passed to the _c_r_e_a_t_e___t_o_r_r_e_n_t
│ │ │ │ │ +constructor.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ sseett__ppiieeccee__hhaasshheess(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_r_e_a_t_e___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │ +void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ +   , std::function<void(piece_index_t)> const& f, error_code& ec);
│ │ │ │ │ +void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ +   , settings_interface const& settings
│ │ │ │ │ +   , std::function<void(piece_index_t)> const& f, error_code& ec);
│ │ │ │ │ +inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ +   , settings_interface const& settings
│ │ │ │ │ +   , std::function<void(piece_index_t)> const& f);
│ │ │ │ │ +inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ +   , std::function<void(piece_index_t)> const& f);
│ │ │ │ │ +void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ +   , settings_interface const& settings, disk_io_constructor_type disk_io
│ │ │ │ │ +   , std::function<void(piece_index_t)> const& f, error_code& ec);
│ │ │ │ │ +inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p,
│ │ │ │ │ +error_code& ec);
│ │ │ │ │ +inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p);
│ │ │ │ │ +This function will assume that the files added to the torrent file exists at
│ │ │ │ │ +path p, read those files and hash the content and set the hashes in the
│ │ │ │ │ +create_torrent object. The optional function f is called in between every hash
│ │ │ │ │ +that is set. f must have the following signature:
│ │ │ │ │ +void Fun(piece_index_t);
│ │ │ │ │ +The overloads taking a _s_e_t_t_i_n_g_s___p_a_c_k may be used to configure the underlying
│ │ │ │ │ +disk access. Such as settings_pack::aio_threads.
│ │ │ │ │ +The overloads that don't take an error_code& may throw an exception in case of
│ │ │ │ │ +a file error, the other overloads sets the error code to reflect the error, if
│ │ │ │ │ +any.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ wweebb__sseeeedd__eennttrryy ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___i_n_f_o_._h_p_p"
│ │ │ │ │ +the _w_e_b___s_e_e_d___e_n_t_r_y holds information about a web seed (also known as URL seed
│ │ │ │ │ +or HTTP seed). It is essentially a URL with some state associated with it. For
│ │ │ │ │ +more information, see _B_E_P_ _1_7 and _B_E_P_ _1_9.
│ │ │ │ │ +struct web_seed_entry
│ │ │ │ │ +{
│ │ │ │ │ +   bool ooppeerraattoorr==== (web_seed_entry const& e) const;
│ │ │ │ │ +   bool ooppeerraattoorr<< (web_seed_entry const& e) const;
│ │ │ │ │ +
│ │ │ │ │ +   enum type_t
│ │ │ │ │ +   {
│ │ │ │ │ +      url_seed,
│ │ │ │ │ +      http_seed,
│ │ │ │ │ +   };
│ │ │ │ │ +
│ │ │ │ │ +   std::string url;
│ │ │ │ │ +   std::string auth;
│ │ │ │ │ +   headers_t extra_headers;
│ │ │ │ │ +   std::uint8_t type;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ooppeerraattoorr====(()) **********
│ │ │ │ │ +bool ooppeerraattoorr==== (web_seed_entry const& e) const;
│ │ │ │ │ +URL and type comparison
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ooppeerraattoorr<<(()) **********
│ │ │ │ │ +bool ooppeerraattoorr<< (web_seed_entry const& e) const;
│ │ │ │ │ +URL and type less-than comparison
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm ttyyppee__tt **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___i_n_f_o_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_u_r_l___s_e_e_d_ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_h_t_t_p___s_e_e_d_|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  url
│ │ │ │ │ +      The URL of the web seed
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  auth
│ │ │ │ │ +      Optional authentication. If this is set, it's passed in as HTTP basic
│ │ │ │ │ +      auth to the web seed. The format is: username:password.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  extra_headers
│ │ │ │ │ +      Any extra HTTP headers that need to be passed to the web seed
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  type
│ │ │ │ │ +      The type of web seed (see _t_y_p_e___t)
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ llooaadd__ttoorrrreenntt__lliimmiittss ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___i_n_f_o_._h_p_p"
│ │ │ │ │ +this object holds configuration options for limits to use when loading
│ │ │ │ │ +torrents. They are meant to prevent loading potentially malicious torrents that
│ │ │ │ │ +cause excessive memory allocations.
│ │ │ │ │ +struct load_torrent_limits
│ │ │ │ │ +{
│ │ │ │ │ +   int mmaaxx__bbuuffffeerr__ssiizzee  = 10000000;
│ │ │ │ │ +   int mmaaxx__ppiieecceess  = 0x200000;
│ │ │ │ │ +   int mmaaxx__ddeeccooddee__ddeepptthh  = 100;
│ │ │ │ │ +   int mmaaxx__ddeeccooddee__ttookkeennss  = 3000000;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  max_buffer_size
│ │ │ │ │ +      the max size of a .torrent file to load into RAM
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  max_pieces
│ │ │ │ │ +      the max number of pieces allowed in the torrent
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  max_decode_depth
│ │ │ │ │ +      the max recursion depth in the bdecoded structure
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  max_decode_tokens
│ │ │ │ │ +      the max number of bdecode tokens
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ttoorrrreenntt__iinnffoo ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___i_n_f_o_._h_p_p"
│ │ │ │ │ +the _t_o_r_r_e_n_t___i_n_f_o class holds the information found in a .torrent file.
│ │ │ │ │ +class torrent_info
│ │ │ │ │ +{
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec);
│ │ │ │ │ +   explicit ttoorrrreenntt__iinnffoo (span<char const> buffer, from_span_t);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (char const* buffer, int size);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (torrent_info const& t);
│ │ │ │ │ +   explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file);
│ │ │ │ │ +   explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (span<char const> buffer, load_torrent_limits const& cfg,
│ │ │ │ │ +from_span_t);
│ │ │ │ │ +   explicit ttoorrrreenntt__iinnffoo (std::string const& filename);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (span<char const> buffer, error_code& ec, from_span_t);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, load_torrent_limits const&
│ │ │ │ │ +cfg);
│ │ │ │ │ +   ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ +   ~~ttoorrrreenntt__iinnffoo ();
│ │ │ │ │ +   file_storage const& ffiilleess () const;
│ │ │ │ │ +   file_storage const& oorriigg__ffiilleess () const;
│ │ │ │ │ +   void rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
│ │ │ │ │ +   void rreemmaapp__ffiilleess (file_storage const& f);
│ │ │ │ │ +   void aadddd__ttrraacckkeerr (std::string const& url, int tier
│ │ │ │ │ +      , announce_entry::tracker_source source);
│ │ │ │ │ +   void cclleeaarr__ttrraacckkeerrss ();
│ │ │ │ │ +   void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0);
│ │ │ │ │ +   std::vector<announce_entry> const& ttrraacckkeerrss () const;
│ │ │ │ │ +   std::vector<sha1_hash> ssiimmiillaarr__ttoorrrreennttss () const;
│ │ │ │ │ +   std::vector<std::string> ccoolllleeccttiioonnss () const;
│ │ │ │ │ +   void aadddd__uurrll__sseeeedd (std::string const& url
│ │ │ │ │ +      , std::string const& ext_auth = std::string()
│ │ │ │ │ +      , web_seed_entry::headers_t const& ext_headers = web_seed_entry::
│ │ │ │ │ +headers_t());
│ │ │ │ │ +   std::vector<web_seed_entry> const& wweebb__sseeeeddss () const;
│ │ │ │ │ +   void aadddd__hhttttpp__sseeeedd (std::string const& url
│ │ │ │ │ +      , std::string const& extern_auth = std::string()
│ │ │ │ │ +      , web_seed_entry::headers_t const& extra_headers = web_seed_entry::
│ │ │ │ │ +headers_t());
│ │ │ │ │ +   void sseett__wweebb__sseeeeddss (std::vector<web_seed_entry> seeds);
│ │ │ │ │ +   std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ +   int nnuumm__ppiieecceess () const;
│ │ │ │ │ +   int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ +   int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │ +   piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ +   index_range<piece_index_t> ppiieeccee__rraannggee () const;
│ │ │ │ │ +   piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │ +   info_hash_t const& iinnffoo__hhaasshheess () const;
│ │ │ │ │ +   sha1_hash iinnffoo__hhaasshh () const noexcept;
│ │ │ │ │ +   bool vv11 () const;
│ │ │ │ │ +   bool vv22 () const;
│ │ │ │ │ +   int nnuumm__ffiilleess () const;
│ │ │ │ │ +   std::vector<file_slice> mmaapp__bblloocckk (piece_index_t const piece
│ │ │ │ │ +      , std::int64_t offset, int size) const;
│ │ │ │ │ +   peer_request mmaapp__ffiillee (file_index_t const file, std::int64_t offset, int
│ │ │ │ │ +size) const;
│ │ │ │ │ +   string_view ssssll__cceerrtt () const;
│ │ │ │ │ +   bool iiss__vvaalliidd () const;
│ │ │ │ │ +   bool pprriivv () const;
│ │ │ │ │ +   bool iiss__ii22pp () const;
│ │ │ │ │ +   int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │ +   char const* hhaasshh__ffoorr__ppiieeccee__ppttrr (piece_index_t const index) const;
│ │ │ │ │ +   sha1_hash hhaasshh__ffoorr__ppiieeccee (piece_index_t index) const;
│ │ │ │ │ +   bool iiss__llooaaddeedd () const;
│ │ │ │ │ +   const std::string& nnaammee () const;
│ │ │ │ │ +   std::time_t ccrreeaattiioonn__ddaattee () const;
│ │ │ │ │ +   const std::string& ccrreeaattoorr () const;
│ │ │ │ │ +   const std::string& ccoommmmeenntt () const;
│ │ │ │ │ +   std::vector<std::pair<std::string, int>> const& nnooddeess () const;
│ │ │ │ │ +   void aadddd__nnooddee (std::pair<std::string, int> const& node);
│ │ │ │ │ +   bool ppaarrssee__iinnffoo__sseeccttiioonn (bdecode_node const& info, error_code& ec, int
│ │ │ │ │ +max_pieces);
│ │ │ │ │ +   bdecode_node iinnffoo (char const* key) const;
│ │ │ │ │ +   span<char const> iinnffoo__sseeccttiioonn () const;
│ │ │ │ │ +   span<char const> ppiieeccee__llaayyeerr (file_index_t) const;
│ │ │ │ │ +   void ffrreeee__ppiieeccee__llaayyeerrss ();
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ttoorrrreenntt__iinnffoo(()) **********
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec);
│ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (span<char const> buffer, from_span_t);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (char const* buffer, int size);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (torrent_info const& t);
│ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file);
│ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (span<char const> buffer, load_torrent_limits const& cfg,
│ │ │ │ │ +from_span_t);
│ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (std::string const& filename);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (span<char const> buffer, error_code& ec, from_span_t);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, load_torrent_limits const&
│ │ │ │ │ +cfg);
│ │ │ │ │ +ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ +The constructor that takes an info-hash will initialize the info-hash to the
│ │ │ │ │ +given value, but leave all other fields empty. This is used internally when
│ │ │ │ │ +downloading torrents without the metadata. The metadata will be created by
│ │ │ │ │ +libtorrent as soon as it has been downloaded from the swarm.
│ │ │ │ │ +The constructor that takes a _b_d_e_c_o_d_e___n_o_d_e will create a _t_o_r_r_e_n_t___i_n_f_o object
│ │ │ │ │ +from the information found in the given torrent_file. The _b_d_e_c_o_d_e___n_o_d_e
│ │ │ │ │ +represents a tree node in an bencoded file. To load an ordinary .torrent file
│ │ │ │ │ +into a _b_d_e_c_o_d_e___n_o_d_e, use _b_d_e_c_o_d_e_(_).
│ │ │ │ │ +The version that takes a buffer pointer and a size will decode it as a .torrent
│ │ │ │ │ +file and initialize the _t_o_r_r_e_n_t___i_n_f_o object for you.
│ │ │ │ │ +The version that takes a filename will simply load the torrent file and decode
│ │ │ │ │ +it inside the constructor, for convenience. This might not be the most suitable
│ │ │ │ │ +for applications that want to be able to report detailed errors on what might
│ │ │ │ │ +go wrong.
│ │ │ │ │ +There is an upper limit on the size of the torrent file that will be loaded by
│ │ │ │ │ +the overload taking a filename. If it's important that even very large torrent
│ │ │ │ │ +files are loaded, use one of the other overloads.
│ │ │ │ │ +The overloads that takes an error_code const& never throws if an error occur,
│ │ │ │ │ +they will simply set the error code to describe what went wrong and not fully
│ │ │ │ │ +initialize the _t_o_r_r_e_n_t___i_n_f_o object. The overloads that do not take the extra
│ │ │ │ │ +error_code parameter will always throw if an error occurs. These overloads are
│ │ │ │ │ +not available when building without exception support.
│ │ │ │ │ +The overload that takes a span also needs an extra parameter of type
│ │ │ │ │ +from_span_t to disambiguate the std::string overload for string literals. There
│ │ │ │ │ +is an object in the libtorrent namespace of this type called from_span.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ~~ttoorrrreenntt__iinnffoo(()) **********
│ │ │ │ │ +~~ttoorrrreenntt__iinnffoo ();
│ │ │ │ │ +frees all storage associated with this _t_o_r_r_e_n_t___i_n_f_o object
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiilleess(()) oorriigg__ffiilleess(()) **********
│ │ │ │ │ +file_storage const& ffiilleess () const;
│ │ │ │ │ +file_storage const& oorriigg__ffiilleess () const;
│ │ │ │ │ +The _f_i_l_e___s_t_o_r_a_g_e object contains the information on how to map the pieces to
│ │ │ │ │ +files. It is separated from the _t_o_r_r_e_n_t___i_n_f_o object because when creating
│ │ │ │ │ +torrents a storage object needs to be created without having a torrent file.
│ │ │ │ │ +When renaming files in a storage, the storage needs to make its own copy of the
│ │ │ │ │ +_f_i_l_e___s_t_o_r_a_g_e in order to make its mapping differ from the one in the torrent
│ │ │ │ │ +file.
│ │ │ │ │ +orig_files() returns the original (unmodified) file storage for this torrent.
│ │ │ │ │ +This is used by the web server connection, which needs to request files with
│ │ │ │ │ +the original names. Filename may be changed using torrent_info::rename_file().
│ │ │ │ │ +For more information on the _f_i_l_e___s_t_o_r_a_g_e object, see the separate document on
│ │ │ │ │ +how to create torrents.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** rreennaammee__ffiillee(()) **********
│ │ │ │ │ +void rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
│ │ │ │ │ +Renames the file with the specified index to the new name. The new filename is
│ │ │ │ │ +reflected by the file_storage returned by files() but not by the one returned
│ │ │ │ │ +by orig_files().
│ │ │ │ │ +If you want to rename the base name of the torrent (for a multi file torrent),
│ │ │ │ │ +you can copy the file_storage (see _f_i_l_e_s_(_) and _o_r_i_g___f_i_l_e_s_(_) ), change the name,
│ │ │ │ │ +and then use _r_e_m_a_p___f_i_l_e_s_(_).
│ │ │ │ │ +The new_filename can both be a relative path, in which case the file name is
│ │ │ │ │ +relative to the save_path of the torrent. If the new_filename is an absolute
│ │ │ │ │ +path (i.e. is_complete(new_filename) == true), then the file is detached from
│ │ │ │ │ +the save_path of the torrent. In this case the file is not moved when
│ │ │ │ │ +_m_o_v_e___s_t_o_r_a_g_e_(_) is invoked.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** rreemmaapp__ffiilleess(()) **********
│ │ │ │ │ +void rreemmaapp__ffiilleess (file_storage const& f);
│ │ │ │ │ +Warning
│ │ │ │ │ +Usingremap_files()is discouraged as it's incompatible with v2 torrents. This is
│ │ │ │ │ +because the piece boundaries and piece hashes in v2 torrents are intimately
│ │ │ │ │ +tied to the file boundaries. Instead, just rename individual files, or
│ │ │ │ │ +implement a custom _d_i_s_k___i_n_t_e_r_f_a_c_e to customize how to store files.
│ │ │ │ │ +Remaps the file storage to a new file layout. This can be used to, for
│ │ │ │ │ +instance, download all data in a torrent to a single file, or to a number of
│ │ │ │ │ +fixed size sector aligned files, regardless of the number and sizes of the
│ │ │ │ │ +files in the torrent.
│ │ │ │ │ +The new specified file_storage must have the exact same size as the current
│ │ │ │ │ +one.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** cclleeaarr__ttrraacckkeerrss(()) aadddd__ttrraacckkeerr(()) ttrraacckkeerrss(()) **********
│ │ │ │ │ +void aadddd__ttrraacckkeerr (std::string const& url, int tier
│ │ │ │ │ +      , announce_entry::tracker_source source);
│ │ │ │ │ +void cclleeaarr__ttrraacckkeerrss ();
│ │ │ │ │ +void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0);
│ │ │ │ │ +std::vector<announce_entry> const& ttrraacckkeerrss () const;
│ │ │ │ │ +add_tracker() adds a tracker to the announce-list. The tier determines the
│ │ │ │ │ +order in which the trackers are to be tried. The trackers() function will
│ │ │ │ │ +return a sorted vector of _a_n_n_o_u_n_c_e___e_n_t_r_y. Each announce _e_n_t_r_y contains a
│ │ │ │ │ +string, which is the tracker url, and a tier index. The tier index is the high-
│ │ │ │ │ +level priority. No matter which trackers that works or not, the ones with lower
│ │ │ │ │ +tier will always be tried before the one with higher tier number. For more
│ │ │ │ │ +information, see _a_n_n_o_u_n_c_e___e_n_t_r_y.
│ │ │ │ │ +trackers() returns all entries from announce-list.
│ │ │ │ │ +clear_trackers() removes all trackers from announce-list.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ccoolllleeccttiioonnss(()) ssiimmiillaarr__ttoorrrreennttss(()) **********
│ │ │ │ │ +std::vector<sha1_hash> ssiimmiillaarr__ttoorrrreennttss () const;
│ │ │ │ │ +std::vector<std::string> ccoolllleeccttiioonnss () const;
│ │ │ │ │ +These two functions are related to _B_E_P_ _3_8 (mutable torrents). The vectors
│ │ │ │ │ +returned from these correspond to the "similar" and "collections" keys in the
│ │ │ │ │ +.torrent file. Both info-hashes and collections from within the info-dict and
│ │ │ │ │ +from outside of it are included.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aadddd__uurrll__sseeeedd(()) wweebb__sseeeeddss(()) sseett__wweebb__sseeeeddss(()) aadddd__hhttttpp__sseeeedd(()) **********
│ │ │ │ │ +void aadddd__uurrll__sseeeedd (std::string const& url
│ │ │ │ │ +      , std::string const& ext_auth = std::string()
│ │ │ │ │ +      , web_seed_entry::headers_t const& ext_headers = web_seed_entry::
│ │ │ │ │ +headers_t());
│ │ │ │ │ +std::vector<web_seed_entry> const& wweebb__sseeeeddss () const;
│ │ │ │ │ +void aadddd__hhttttpp__sseeeedd (std::string const& url
│ │ │ │ │ +      , std::string const& extern_auth = std::string()
│ │ │ │ │ +      , web_seed_entry::headers_t const& extra_headers = web_seed_entry::
│ │ │ │ │ +headers_t());
│ │ │ │ │ +void sseett__wweebb__sseeeeddss (std::vector<web_seed_entry> seeds);
│ │ │ │ │ +web_seeds() returns all url seeds and http seeds in the torrent. Each _e_n_t_r_y is
│ │ │ │ │ +a web_seed_entry and may refer to either a url seed or http seed.
│ │ │ │ │ +add_url_seed() and add_http_seed() adds one url to the list of url/http seeds.
│ │ │ │ │ +set_web_seeds() replaces all web seeds with the ones specified in the seeds
│ │ │ │ │ +vector.
│ │ │ │ │ +The extern_auth argument can be used for other authorization schemes than basic
│ │ │ │ │ +HTTP authorization. If set, it will override any username and password found in
│ │ │ │ │ +the URL itself. The string will be sent as the HTTP authorization header's
│ │ │ │ │ +value (without specifying "Basic").
│ │ │ │ │ +The extra_headers argument defaults to an empty list, but can be used to insert
│ │ │ │ │ +custom HTTP headers in the requests to a specific web seed.
│ │ │ │ │ +See _h_t_t_p_ _s_e_e_d_i_n_g for more information.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ttoottaall__ssiizzee(()) **********
│ │ │ │ │ +std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ +total_size() returns the total number of bytes the torrent-file represents.
│ │ │ │ │ +Note that this is the number of pieces times the piece size (modulo the last
│ │ │ │ │ +piece possibly being smaller). With pad files, the total size will be larger
│ │ │ │ │ +than the sum of all (regular) file sizes.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ppiieeccee__lleennggtthh(()) nnuumm__ppiieecceess(()) **********
│ │ │ │ │ +int nnuumm__ppiieecceess () const;
│ │ │ │ │ +int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ +piece_length() and num_pieces() returns the number of byte for each piece and
│ │ │ │ │ +the total number of pieces, respectively. The difference between piece_size()
│ │ │ │ │ +and piece_length() is that piece_size() takes the piece index as argument and
│ │ │ │ │ +gives you the exact size of that piece. It will always be the same as
│ │ │ │ │ +piece_length() except in the case of the last piece, which may be smaller.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** bblloocckkss__ppeerr__ppiieeccee(()) **********
│ │ │ │ │ +int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │ +returns the number of blocks there are in the typical piece. There may be fewer
│ │ │ │ │ +in the last piece)
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ppiieeccee__rraannggee(()) llaasstt__ppiieeccee(()) eenndd__ppiieeccee(()) **********
│ │ │ │ │ +piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ +index_range<piece_index_t> ppiieeccee__rraannggee () const;
│ │ │ │ │ +piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │ +last_piece() returns the index to the last piece in the torrent and end_piece()
│ │ │ │ │ +returns the index to the one-past-end piece in the torrent piece_range()
│ │ │ │ │ +returns an implementation-defined type that can be used as the container in a
│ │ │ │ │ +range-for loop. Where the values are the indices of all pieces in the
│ │ │ │ │ +_f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** iinnffoo__hhaasshheess(()) iinnffoo__hhaasshh(()) **********
│ │ │ │ │ +info_hash_t const& iinnffoo__hhaasshheess () const;
│ │ │ │ │ +sha1_hash iinnffoo__hhaasshh () const noexcept;
│ │ │ │ │ +returns the info-hash of the torrent. For BitTorrent v2 support, use
│ │ │ │ │ +info_hashes() to get an object that may hold both a v1 and v2 info-hash
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** vv11(()) vv22(()) **********
│ │ │ │ │ +bool vv11 () const;
│ │ │ │ │ +bool vv22 () const;
│ │ │ │ │ +returns whether this torrent has v1 and/or v2 metadata, respectively. Hybrid
│ │ │ │ │ +torrents have both. These are shortcuts for info_hashes().has_v1() and
│ │ │ │ │ +info_hashes().has_v2() calls.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** nnuumm__ffiilleess(()) **********
│ │ │ │ │ +int nnuumm__ffiilleess () const;
│ │ │ │ │ +If you need index-access to files you can use the num_files() along with the
│ │ │ │ │ +file_path(), file_size()-family of functions to access files using indices.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** mmaapp__bblloocckk(()) **********
│ │ │ │ │ +std::vector<file_slice> mmaapp__bblloocckk (piece_index_t const piece
│ │ │ │ │ +      , std::int64_t offset, int size) const;
│ │ │ │ │ +This function will map a piece index, a byte offset within that piece and a
│ │ │ │ │ +size (in bytes) into the corresponding files with offsets where that data for
│ │ │ │ │ +that piece is supposed to be stored. See _f_i_l_e___s_l_i_c_e.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  bw_idle
│ │ │ │ │ -      The peer is not waiting for any external events to send or receive data.
│ │ │ │ │ +********** mmaapp__ffiillee(()) **********
│ │ │ │ │ +peer_request mmaapp__ffiillee (file_index_t const file, std::int64_t offset, int size)
│ │ │ │ │ +const;
│ │ │ │ │ +This function will map a range in a specific file into a range in the torrent.
│ │ │ │ │ +The file_offset parameter is the offset in the file, given in bytes, where 0 is
│ │ │ │ │ +the start of the file. See _p_e_e_r___r_e_q_u_e_s_t.
│ │ │ │ │ +The input range is assumed to be valid within the torrent. file_offset + size
│ │ │ │ │ +is not allowed to be greater than the file size. file_index must refer to a
│ │ │ │ │ +valid file, i.e. it cannot be >= num_files().
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  bw_limit
│ │ │ │ │ -      The peer is waiting for the rate limiter.
│ │ │ │ │ +********** ssssll__cceerrtt(()) **********
│ │ │ │ │ +string_view ssssll__cceerrtt () const;
│ │ │ │ │ +Returns the SSL root certificate for the torrent, if it is an SSL torrent.
│ │ │ │ │ +Otherwise returns an empty string. The certificate is the public certificate in
│ │ │ │ │ +x509 format.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  bw_network
│ │ │ │ │ -      The peer has quota and is currently waiting for a network read or write
│ │ │ │ │ -      operation to complete. This is the state all peers are in if there are no
│ │ │ │ │ -      bandwidth limits.
│ │ │ │ │ +********** iiss__vvaalliidd(()) **********
│ │ │ │ │ +bool iiss__vvaalliidd () const;
│ │ │ │ │ +returns true if this _t_o_r_r_e_n_t___i_n_f_o object has a torrent loaded. This is
│ │ │ │ │ +primarily used to determine if a magnet link has had its metadata resolved yet
│ │ │ │ │ +or not.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  bw_disk
│ │ │ │ │ -      The peer is waiting for the disk I/O thread to catch up writing buffers
│ │ │ │ │ -      to disk before downloading more.
│ │ │ │ │ +********** pprriivv(()) **********
│ │ │ │ │ +bool pprriivv () const;
│ │ │ │ │ +returns true if this torrent is private. i.e., the client should not advertise
│ │ │ │ │ +itself on the trackerless network (the Kademlia DHT) for this torrent.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  read_state write_state
│ │ │ │ │ -      bitmasks indicating what state this peer is in with regards to sending
│ │ │ │ │ -      and receiving data. The states are defined as independent flags of type
│ │ │ │ │ -      bandwidth_state_flags_t, in this class.
│ │ │ │ │ +********** iiss__ii22pp(()) **********
│ │ │ │ │ +bool iiss__ii22pp () const;
│ │ │ │ │ +returns true if this is an i2p torrent. This is determined by whether or not it
│ │ │ │ │ +has a tracker whose URL domain name ends with ".i2p". i2p torrents disable the
│ │ │ │ │ +DHT and local peer discovery as well as talking to peers over anything other
│ │ │ │ │ +than the i2p network.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppeeeerr__rreeqquueesstt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___r_e_q_u_e_s_t_._h_p_p"
│ │ │ │ │ -represents a byte range within a piece. Internally this is is used for incoming
│ │ │ │ │ -piece requests.
│ │ │ │ │ -struct peer_request
│ │ │ │ │ -{
│ │ │ │ │ -   bool ooppeerraattoorr==== (peer_request const& r) const;
│ │ │ │ │ -
│ │ │ │ │ -   piece_index_t piece;
│ │ │ │ │ -   int start;
│ │ │ │ │ -   int length;
│ │ │ │ │ -};
│ │ │ │ │ +********** ppiieeccee__ssiizzee(()) **********
│ │ │ │ │ +int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │ +returns the piece size of file with index. This will be the same as
│ │ │ │ │ +_p_i_e_c_e___l_e_n_g_t_h_(_), except for the last piece, which may be shorter.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr====(()) **********
│ │ │ │ │ -bool ooppeerraattoorr==== (peer_request const& r) const;
│ │ │ │ │ -returns true if the right hand side _p_e_e_r___r_e_q_u_e_s_t refers to the same range as
│ │ │ │ │ -this does.
│ │ │ │ │ +********** hhaasshh__ffoorr__ppiieeccee__ppttrr(()) hhaasshh__ffoorr__ppiieeccee(()) **********
│ │ │ │ │ +char const* hhaasshh__ffoorr__ppiieeccee__ppttrr (piece_index_t const index) const;
│ │ │ │ │ +sha1_hash hhaasshh__ffoorr__ppiieeccee (piece_index_t index) const;
│ │ │ │ │ +hash_for_piece() takes a piece-index and returns the 20-bytes sha1-hash for
│ │ │ │ │ +that piece and info_hash() returns the 20-bytes sha1-hash for the info-section
│ │ │ │ │ +of the torrent file. hash_for_piece_ptr() returns a pointer to the 20 byte sha1
│ │ │ │ │ +digest for the piece. Note that the string is not 0-terminated.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  piece
│ │ │ │ │ -      The index of the piece in which the range starts.
│ │ │ │ │ +********** nnaammee(()) **********
│ │ │ │ │ +const std::string& nnaammee () const;
│ │ │ │ │ +name() returns the name of the torrent. name contains UTF-8 encoded string.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  start
│ │ │ │ │ -      The byte offset within that piece where the range starts.
│ │ │ │ │ +********** ccrreeaattiioonn__ddaattee(()) **********
│ │ │ │ │ +std::time_t ccrreeaattiioonn__ddaattee () const;
│ │ │ │ │ +creation_date() returns the creation date of the torrent as time_t (_p_o_s_i_x
│ │ │ │ │ +_t_i_m_e). If there's no time stamp in the torrent file, 0 is returned. .. posix
│ │ │ │ │ +time: _h_t_t_p_:_/_/_w_w_w_._o_p_e_n_g_r_o_u_p_._o_r_g_/_o_n_l_i_n_e_p_u_b_s_/_0_0_9_6_9_5_3_9_9_/_f_u_n_c_t_i_o_n_s_/_t_i_m_e_._h_t_m_l
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  length
│ │ │ │ │ -      The size of the range, in bytes.
│ │ │ │ │ +********** ccrreeaattoorr(()) **********
│ │ │ │ │ +const std::string& ccrreeaattoorr () const;
│ │ │ │ │ +creator() returns the creator string in the torrent. If there is no creator
│ │ │ │ │ +string it will return an empty string.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ttoorrrreenntt__ppeeeerr__eeqquuaall(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___p_e_e_r_._h_p_p"
│ │ │ │ │ -inline bool ttoorrrreenntt__ppeeeerr__eeqquuaall (torrent_peer const* lhs, torrent_peer const*
│ │ │ │ │ -rhs);
│ │ │ │ │ +********** ccoommmmeenntt(()) **********
│ │ │ │ │ +const std::string& ccoommmmeenntt () const;
│ │ │ │ │ +comment() returns the comment associated with the torrent. If there's no
│ │ │ │ │ +comment, it will return an empty string. comment contains UTF-8 encoded string.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ mmaakkee__mmaaggnneett__uurrii(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_m_a_g_n_e_t___u_r_i_._h_p_p"
│ │ │ │ │ -std::string mmaakkee__mmaaggnneett__uurrii (torrent_handle const& handle);
│ │ │ │ │ -std::string mmaakkee__mmaaggnneett__uurrii (add_torrent_params const& atp);
│ │ │ │ │ -std::string mmaakkee__mmaaggnneett__uurrii (torrent_info const& info);
│ │ │ │ │ -Generates a magnet URI from the specified torrent.
│ │ │ │ │ -Several fields from the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s objects are recorded in the magnet
│ │ │ │ │ -link. In order to not include them, they have to be cleared before calling
│ │ │ │ │ -_m_a_k_e___m_a_g_n_e_t___u_r_i_(_). These fields are used:
│ │ │ │ │ -     ti, info_hashes, url_seeds, dht_nodes, file_priorities, trackers,
│ │ │ │ │ -     name, peers.
│ │ │ │ │ -Depending on what the use case for the resulting magnet link is, clearing peers
│ │ │ │ │ -and dht_nodes is probably a good idea if the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s came from a
│ │ │ │ │ -running torrent. Those lists may be long and be ephemeral.
│ │ │ │ │ -If none of the info_hashes or ti fields are set, there is not info-hash
│ │ │ │ │ -available, and a magnet link cannot be created. In this case _m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ -returns an empty string.
│ │ │ │ │ -The recommended way to generate a magnet link from a _t_o_r_r_e_n_t___h_a_n_d_l_e is to call
│ │ │ │ │ -_s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_), which will post a _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t containing an
│ │ │ │ │ -_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object. This can then be passed to _m_a_k_e___m_a_g_n_e_t___u_r_i_(_).
│ │ │ │ │ -The overload that takes a _t_o_r_r_e_n_t___h_a_n_d_l_e will make blocking calls to query
│ │ │ │ │ -information about the torrent. If the torrent handle is invalid, an empty
│ │ │ │ │ -string is returned.
│ │ │ │ │ -For more information about magnet links, see _m_a_g_n_e_t_ _l_i_n_k_s.
│ │ │ │ │ +********** nnooddeess(()) **********
│ │ │ │ │ +std::vector<std::pair<std::string, int>> const& nnooddeess () const;
│ │ │ │ │ +If this torrent contains any DHT nodes, they are put in this vector in their
│ │ │ │ │ +original form (host name and port number).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppaarrssee__mmaaggnneett__uurrii(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_m_a_g_n_e_t___u_r_i_._h_p_p"
│ │ │ │ │ -add_torrent_params ppaarrssee__mmaaggnneett__uurrii (string_view uri, error_code& ec);
│ │ │ │ │ -add_torrent_params ppaarrssee__mmaaggnneett__uurrii (string_view uri);
│ │ │ │ │ -void ppaarrssee__mmaaggnneett__uurrii (string_view uri, add_torrent_params& p, error_code& ec);
│ │ │ │ │ -This function parses out information from the magnet link and populates the
│ │ │ │ │ -_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object. The overload that does not take an error_code
│ │ │ │ │ -reference will throw a system_error on error The overload taking an
│ │ │ │ │ -add_torrent_params reference will fill in the fields specified in the magnet
│ │ │ │ │ -URI.
│ │ │ │ │ +********** aadddd__nnooddee(()) **********
│ │ │ │ │ +void aadddd__nnooddee (std::pair<std::string, int> const& node);
│ │ │ │ │ +This is used when creating torrent. Use this to add a known DHT node. It may be
│ │ │ │ │ +used, by the client, to bootstrap into the DHT network.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ttrruunnccaattee__ffiilleess(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_r_u_n_c_a_t_e_._h_p_p"
│ │ │ │ │ -void ttrruunnccaattee__ffiilleess (file_storage const& fs, std::string const& save_path,
│ │ │ │ │ -storage_error& ec);
│ │ │ │ │ -Truncates files larger than specified in the _f_i_l_e___s_t_o_r_a_g_e, saved under the
│ │ │ │ │ -specified save_path.
│ │ │ │ │ +********** ppaarrssee__iinnffoo__sseeccttiioonn(()) **********
│ │ │ │ │ +bool ppaarrssee__iinnffoo__sseeccttiioonn (bdecode_node const& info, error_code& ec, int
│ │ │ │ │ +max_pieces);
│ │ │ │ │ +populates the _t_o_r_r_e_n_t___i_n_f_o by providing just the info-dict buffer. This is used
│ │ │ │ │ +when loading a torrent from a magnet link for instance, where we only have the
│ │ │ │ │ +info-dict. The _b_d_e_c_o_d_e___n_o_d_e e points to a parsed info-dictionary. ec returns an
│ │ │ │ │ +error code if something fails (typically if the info dictionary is malformed).
│ │ │ │ │ +Themax_piecesparameter allows limiting the amount of memory dedicated to
│ │ │ │ │ +loading the torrent, and fails for torrents that exceed the limit. To load
│ │ │ │ │ +large torrents, this limit may also need to be raised in _s_e_t_t_i_n_g_s___p_a_c_k_:_:
│ │ │ │ │ +_m_a_x___p_i_e_c_e___c_o_u_n_t and in calls to _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ vveerrssiioonn(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ -char const* vveerrssiioonn ();
│ │ │ │ │ -returns the libtorrent version as string form in this format:
│ │ │ │ │ -"<major>.<minor>.<tiny>.<tag>"
│ │ │ │ │ +********** iinnffoo(()) **********
│ │ │ │ │ +bdecode_node iinnffoo (char const* key) const;
│ │ │ │ │ +This function looks up keys from the info-dictionary of the loaded torrent
│ │ │ │ │ +file. It can be used to access extension values put in the .torrent file. If
│ │ │ │ │ +the specified key cannot be found, it returns nullptr.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ llooaadd__ttoorrrreenntt__bbuuffffeerr(()) llooaadd__ttoorrrreenntt__ffiillee(()) llooaadd__ttoorrrreenntt__ppaarrsseedd(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_l_o_a_d___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ffiillee (
│ │ │ │ │ -   std::string const& filename);
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr (
│ │ │ │ │ -   span<char const> buffer, load_torrent_limits const& cfg);
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr (
│ │ │ │ │ -   span<char const> buffer);
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ffiillee (
│ │ │ │ │ -   std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ppaarrsseedd (
│ │ │ │ │ -   bdecode_node const& torrent_file);
│ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ppaarrsseedd (
│ │ │ │ │ -   bdecode_node const& torrent_file, load_torrent_limits const& cfg);
│ │ │ │ │ -These functions load the content of a .torrent file into an _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s
│ │ │ │ │ -object. The immutable part of a torrent file (the info-dictionary) is stored in
│ │ │ │ │ -the ti field in the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object (as a _t_o_r_r_e_n_t___i_n_f_o object). The
│ │ │ │ │ -returned object is suitable to be:
│ │ │ │ │ -         * added to a _s_e_s_s_i_o_n via _a_d_d___t_o_r_r_e_n_t_(_) or _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_)
│ │ │ │ │ -         * saved as a .torrent_file via _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │ -         * turned into a magnet link via _m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ +********** iinnffoo__sseeccttiioonn(()) **********
│ │ │ │ │ +span<char const> iinnffoo__sseeccttiioonn () const;
│ │ │ │ │ +returns a the raw info section of the torrent file. The underlying buffer is
│ │ │ │ │ +still owned by the _t_o_r_r_e_n_t___i_n_f_o object
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm pprroottooccooll__vveerrssiioonn ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_n_f_o___h_a_s_h_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_V_1_ _ _|_0_ _ _ _ _|_T_h_e_ _o_r_i_g_i_n_a_l_ _B_i_t_T_o_r_r_e_n_t_ _v_e_r_s_i_o_n_,_ _u_s_i_n_g_ _S_H_A_-_1_ _h_a_s_h_e_s_ _ _ _ _ _ _ |
│ │ │ │ │ -|_V_2_ _ _|_1_ _ _ _ _|_V_e_r_s_i_o_n_ _2_ _o_f_ _t_h_e_ _B_i_t_T_o_r_r_e_n_t_ _p_r_o_t_o_c_o_l_,_ _u_s_i_n_g_ _S_H_A_-_2_5_6_ _h_a_s_h_e_s|
│ │ │ │ │ -|_N_U_M_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +********** ppiieeccee__llaayyeerr(()) **********
│ │ │ │ │ +span<char const> ppiieeccee__llaayyeerr (file_index_t) const;
│ │ │ │ │ +return the bytes of the piece layer hashes for the specified file. If the file
│ │ │ │ │ +doesn't have a piece layer, an empty span is returned. The span size is
│ │ │ │ │ +divisible by 32, the size of a SHA-256 hash. If the size of the file is smaller
│ │ │ │ │ +than or equal to the piece size, the files "root hash" is the hash of the file
│ │ │ │ │ +and is not saved separately in the "piece layers" field, but this function
│ │ │ │ │ +still returns the root hash of the file in that case.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ssoocckkeett__ttyyppee__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_o_c_k_e_t___t_y_p_e_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_t_c_p_ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_o_c_k_s_5_ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_h_t_t_p_ _ _ _ _ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_u_t_p_ _ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_2_p_ _ _ _ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_t_c_p___s_s_l_ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_o_c_k_s_5___s_s_l_|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_h_t_t_p___s_s_l_ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_u_t_p___s_s_l_ _ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +********** ffrreeee__ppiieeccee__llaayyeerrss(()) **********
│ │ │ │ │ +void ffrreeee__ppiieeccee__llaayyeerrss ();
│ │ │ │ │ +clears the piece layers from the _t_o_r_r_e_n_t___i_n_f_o. This is done by the _s_e_s_s_i_o_n when
│ │ │ │ │ +a torrent is added, to avoid storing it twice. The piece layer (or other hashes
│ │ │ │ │ +part of the merkle tree) are stored in the internal torrent object.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ppoorrttmmaapp__ttrraannssppoorrtt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_r_t_m_a_p_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_a_t_p_m_p_|_0_ _ _ _ _|_n_a_t_p_m_p_ _c_a_n_ _b_e_ _N_A_T_-_P_M_P_ _o_r_ _P_C_P|
│ │ │ │ │ -|_u_p_n_p_ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +************ iipp__ffiilltteerr ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_p___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ +The ip_filter class is a set of rules that uniquely categorizes all ip
│ │ │ │ │ +addresses as allowed or disallowed. The default constructor creates a single
│ │ │ │ │ +rule that allows all addresses (0.0.0.0 - 255.255.255.255 for the IPv4 range,
│ │ │ │ │ +and the equivalent range covering all addresses for the IPv6 range).
│ │ │ │ │ +A default constructed _i_p___f_i_l_t_e_r does not filter any address.
│ │ │ │ │ +struct ip_filter
│ │ │ │ │ +{
│ │ │ │ │ +   iipp__ffiilltteerr ();
│ │ │ │ │ +   ip_filter& ooppeerraattoorr== (ip_filter const&);
│ │ │ │ │ +   iipp__ffiilltteerr (ip_filter const&);
│ │ │ │ │ +   iipp__ffiilltteerr (ip_filter&&);
│ │ │ │ │ +   ip_filter& ooppeerraattoorr== (ip_filter&&);
│ │ │ │ │ +   ~~iipp__ffiilltteerr ();
│ │ │ │ │ +   bool eemmppttyy () const;
│ │ │ │ │ +   void aadddd__rruullee (address const& first, address const& last, std::uint32_t
│ │ │ │ │ +flags);
│ │ │ │ │ +   std::uint32_t aacccceessss (address const& addr) const;
│ │ │ │ │ +   filter_tuple_t eexxppoorrtt__ffiilltteerr () const;
│ │ │ │ │ +
│ │ │ │ │ +   enum access_flags
│ │ │ │ │ +   {
│ │ │ │ │ +      blocked,
│ │ │ │ │ +   };
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ppoorrttmmaapp__pprroottooccooll ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_r_t_m_a_p_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_n_o_n_e_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_t_c_p_ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_u_d_p_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +********** eemmppttyy(()) **********
│ │ │ │ │ +bool eemmppttyy () const;
│ │ │ │ │ +returns true if the filter does not contain any rules
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm eevveenntt__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_r_a_c_k_e_r___m_a_n_a_g_e_r_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_n_o_n_e_ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_c_o_m_p_l_e_t_e_d_|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_t_a_r_t_e_d_ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_t_o_p_p_e_d_ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_a_u_s_e_d_ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +********** aadddd__rruullee(()) **********
│ │ │ │ │ +void aadddd__rruullee (address const& first, address const& last, std::uint32_t flags);
│ │ │ │ │ +Adds a rule to the filter. first and last defines a range of ip addresses that
│ │ │ │ │ +will be marked with the given flags. The flags can currently be 0, which means
│ │ │ │ │ +allowed, or ip_filter::blocked, which means disallowed.
│ │ │ │ │ +precondition: first.is_v4() == last.is_v4() && first.is_v6() == last.is_v6()
│ │ │ │ │ +postcondition: access(x) == flags for every x in the range [first, last]
│ │ │ │ │ +This means that in a case of overlapping ranges, the last one applied takes
│ │ │ │ │ +precedence.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ccoonnnneeccttiioonn__ttyyppee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_b_i_t_t_o_r_r_e_n_t_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_u_r_l___s_e_e_d_ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_h_t_t_p___s_e_e_d_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +********** aacccceessss(()) **********
│ │ │ │ │ +std::uint32_t aacccceessss (address const& addr) const;
│ │ │ │ │ +Returns the access permissions for the given address (addr). The permission can
│ │ │ │ │ +currently be 0 or ip_filter::blocked. The complexity of this operation is O(log
│ │ │ │ │ +n), where n is the minimum number of non-overlapping ranges to describe the
│ │ │ │ │ +current filter.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ttoorrrreenntt__ffllaaggss__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___f_l_a_g_s_._h_p_p"
│ │ │ │ │ -  seed_mode
│ │ │ │ │ -      If seed_mode is set, libtorrent will assume that all files are present
│ │ │ │ │ -      for this torrent and that they all match the hashes in the torrent file.
│ │ │ │ │ -      Each time a peer requests to download a block, the piece is verified
│ │ │ │ │ -      against the hash, unless it has been verified already. If a hash fails,
│ │ │ │ │ -      the torrent will automatically leave the seed mode and recheck all the
│ │ │ │ │ -      files. The use case for this mode is if a torrent is created and seeded,
│ │ │ │ │ -      or if the user already know that the files are complete, this is a way to
│ │ │ │ │ -      avoid the initial file checks, and significantly reduce the startup time.
│ │ │ │ │ -      Setting seed_mode on a torrent without metadata (a .torrent file) is a
│ │ │ │ │ -      no-op and will be ignored.
│ │ │ │ │ -      It is not possible to sseett the seed_mode flag on a torrent after it has
│ │ │ │ │ -      been added to a _s_e_s_s_i_o_n. It is possible to cclleeaarr it though.
│ │ │ │ │ -  upload_mode
│ │ │ │ │ -      If upload_mode is set, the torrent will be initialized in upload-mode,
│ │ │ │ │ -      which means it will not make any piece requests. This state is typically
│ │ │ │ │ -      entered on disk I/O errors, and if the torrent is also auto managed, it
│ │ │ │ │ -      will be taken out of this state periodically (see settings_pack::
│ │ │ │ │ -      optimistic_disk_retry).
│ │ │ │ │ -      This mode can be used to avoid race conditions when adjusting priorities
│ │ │ │ │ -      of pieces before allowing the torrent to start downloading.
│ │ │ │ │ -      If the torrent is auto-managed (auto_managed), the torrent will
│ │ │ │ │ -      eventually be taken out of upload-mode, regardless of how it got there.
│ │ │ │ │ -      If it's important to manually control when the torrent leaves upload
│ │ │ │ │ -      mode, don't make it auto managed.
│ │ │ │ │ -  share_mode
│ │ │ │ │ -      determines if the torrent should be added in sshhaarree mmooddee or not. Share
│ │ │ │ │ -      mode indicates that we are not interested in downloading the torrent, but
│ │ │ │ │ -      merely want to improve our share ratio (i.e. increase it). A torrent
│ │ │ │ │ -      started in share mode will do its best to never download more than it
│ │ │ │ │ -      uploads to the swarm. If the swarm does not have enough demand for upload
│ │ │ │ │ -      capacity, the torrent will not download anything. This mode is intended
│ │ │ │ │ -      to be safe to add any number of torrents to, without manual screening,
│ │ │ │ │ -      without the risk of downloading more than is uploaded.
│ │ │ │ │ -      A torrent in share mode sets the priority to all pieces to 0, except for
│ │ │ │ │ -      the pieces that are downloaded, when pieces are decided to be downloaded.
│ │ │ │ │ -      This affects the progress bar, which might be set to "100% finished" most
│ │ │ │ │ -      of the time. Do not change file or piece priorities for torrents in share
│ │ │ │ │ -      mode, it will make it not work.
│ │ │ │ │ -      The share mode has one setting, the share ratio target, see
│ │ │ │ │ -      settings_pack::share_mode_target for more info.
│ │ │ │ │ -  apply_ip_filter
│ │ │ │ │ -      determines if the IP filter should apply to this torrent or not. By
│ │ │ │ │ -      default all torrents are subject to filtering by the IP filter (i.e. this
│ │ │ │ │ -      flag is set by default). This is useful if certain torrents needs to be
│ │ │ │ │ -      exempt for some reason, being an auto-update torrent for instance.
│ │ │ │ │ -  paused
│ │ │ │ │ -      specifies whether or not the torrent is paused. i.e. it won't connect to
│ │ │ │ │ -      the tracker or any of the peers until it's resumed. Note that a paused
│ │ │ │ │ -      torrent that also has the auto_managed flag set can be started at any
│ │ │ │ │ -      time by libtorrent's queuing logic. See _q_u_e_u_i_n_g.
│ │ │ │ │ -  auto_managed
│ │ │ │ │ -      If the torrent is auto-managed (auto_managed), the torrent may be resumed
│ │ │ │ │ -      at any point, regardless of how it paused. If it's important to manually
│ │ │ │ │ -      control when the torrent is paused and resumed, don't make it auto
│ │ │ │ │ -      managed.
│ │ │ │ │ -      If auto_managed is set, the torrent will be queued, started and seeded
│ │ │ │ │ -      automatically by libtorrent. When this is set, the torrent should also be
│ │ │ │ │ -      started as paused. The default queue order is the order the torrents were
│ │ │ │ │ -      added. They are all downloaded in that order. For more details, see
│ │ │ │ │ -      _q_u_e_u_i_n_g.
│ │ │ │ │ -  duplicate_is_error
│ │ │ │ │ -      used in _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s to indicate that it's an error to attempt to
│ │ │ │ │ -      add a torrent that's already in the _s_e_s_s_i_o_n. If it's not considered an
│ │ │ │ │ -      error, a handle to the existing torrent is returned. This flag is not
│ │ │ │ │ -      saved by _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_), since it is only meant for adding torrents.
│ │ │ │ │ -  update_subscribe
│ │ │ │ │ -      on by default and means that this torrent will be part of state updates
│ │ │ │ │ -      when calling _p_o_s_t___t_o_r_r_e_n_t___u_p_d_a_t_e_s_(_). This flag is not saved by
│ │ │ │ │ -      _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_).
│ │ │ │ │ -  super_seeding
│ │ │ │ │ -      sets the torrent into super seeding/initial seeding mode. If the torrent
│ │ │ │ │ -      is not a seed, this flag has no effect.
│ │ │ │ │ -  sequential_download
│ │ │ │ │ -      sets the sequential download state for the torrent. In this mode the
│ │ │ │ │ -      piece picker will pick pieces with low index numbers before pieces with
│ │ │ │ │ -      high indices. The actual pieces that are picked depend on other factors
│ │ │ │ │ -      still, such as which pieces a peer has and whether it is in parole mode
│ │ │ │ │ -      or "prefer whole pieces"-mode. Sequential mode is not ideal for streaming
│ │ │ │ │ -      media. For that, see _s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_) instead.
│ │ │ │ │ -  stop_when_ready
│ │ │ │ │ -      When this flag is set, the torrent will ffoorrccee ssttoopp whenever it
│ │ │ │ │ -      transitions from a non-data-transferring state into a data-transferring
│ │ │ │ │ -      state (referred to as being ready to download or seed). This is useful
│ │ │ │ │ -      for torrents that should not start downloading or seeding yet, but want
│ │ │ │ │ -      to be made ready to do so. A torrent may need to have its files checked
│ │ │ │ │ -      for instance, so it needs to be started and possibly queued for checking
│ │ │ │ │ -      (auto-managed and started) but as soon as it's done, it should be
│ │ │ │ │ -      stopped.
│ │ │ │ │ -      FFoorrccee ssttooppppeedd means auto-managed is set to false and it's paused. As if
│ │ │ │ │ -      the auto_manages flag is cleared and the paused flag is set on the
│ │ │ │ │ -      torrent.
│ │ │ │ │ -      Note that the torrent may transition into a downloading state while
│ │ │ │ │ -      setting this flag, and since the logic is edge triggered you may miss the
│ │ │ │ │ -      edge. To avoid this race, if the torrent already is in a downloading
│ │ │ │ │ -      state when this call is made, it will trigger the stop-when-ready
│ │ │ │ │ -      immediately.
│ │ │ │ │ -      When the stop-when-ready logic fires, the flag is cleared. Any subsequent
│ │ │ │ │ -      transitions between downloading and non-downloading states will not be
│ │ │ │ │ -      affected, until this flag is set again.
│ │ │ │ │ -      The behavior is more robust when setting this flag as part of adding the
│ │ │ │ │ -      torrent. See _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s.
│ │ │ │ │ -      The stop-when-ready flag fixes the inherent race condition of waiting for
│ │ │ │ │ -      the _s_t_a_t_e___c_h_a_n_g_e_d___a_l_e_r_t and then call _p_a_u_s_e_(_). The download/seeding will
│ │ │ │ │ -      most likely start in between posting the _a_l_e_r_t and receiving the call to
│ │ │ │ │ -      pause.
│ │ │ │ │ -      A downloading state is one where peers are being connected. Which means
│ │ │ │ │ -      just downloading the metadata via the ut_metadata extension counts as a
│ │ │ │ │ -      downloading state. In order to stop a torrent once the metadata has been
│ │ │ │ │ -      downloaded, instead set all file priorities to dont_download
│ │ │ │ │ -  override_trackers
│ │ │ │ │ -      when this flag is set, the tracker list in the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object
│ │ │ │ │ -      override any trackers from the torrent file. If the flag is not set, the
│ │ │ │ │ -      trackers from the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object will be added to the list of
│ │ │ │ │ -      trackers used by the torrent. This flag is set by _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) if
│ │ │ │ │ -      there are trackers present in the resume data file. This effectively
│ │ │ │ │ -      makes the trackers saved in the resume data take precedence over the
│ │ │ │ │ -      original trackers. This includes if there's an empty list of trackers, to
│ │ │ │ │ -      support the case where they were explicitly removed in the previous
│ │ │ │ │ -      _s_e_s_s_i_o_n. This flag is not saved by _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ -  override_web_seeds
│ │ │ │ │ -      If this flag is set, the web seeds from the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object
│ │ │ │ │ -      will override any web seeds in the torrent file. If it's not set, web
│ │ │ │ │ -      seeds in the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object will be added to the list of web
│ │ │ │ │ -      seeds used by the torrent. This flag is set by _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) if
│ │ │ │ │ -      there are web seeds present in the resume data file. This effectively
│ │ │ │ │ -      makes the web seeds saved in the resume data take precedence over the
│ │ │ │ │ -      original ones. This includes if there's an empty list of web seeds, to
│ │ │ │ │ -      support the case where they were explicitly removed in the previous
│ │ │ │ │ -      _s_e_s_s_i_o_n. This flag is not saved by _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ -  need_save_resume
│ │ │ │ │ -      if this flag is set (which it is by default) the torrent will be
│ │ │ │ │ -      considered needing to save its resume data immediately, in the category
│ │ │ │ │ -      if_metadata_changed. See resume_data_flags_t and _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) for
│ │ │ │ │ -      details.
│ │ │ │ │ -      This flag is cleared by a successful call to _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) This flag
│ │ │ │ │ -      is not saved by _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_), since it represents an ephemeral
│ │ │ │ │ -      state of a running torrent.
│ │ │ │ │ -  disable_dht
│ │ │ │ │ -      set this flag to disable DHT for this torrent. This lets you have the DHT
│ │ │ │ │ -      enabled for the whole client, and still have specific torrents not
│ │ │ │ │ -      participating in it. i.e. not announcing to the DHT nor picking up peers
│ │ │ │ │ -      from it.
│ │ │ │ │ -  disable_lsd
│ │ │ │ │ -      set this flag to disable local service discovery for this torrent.
│ │ │ │ │ -  disable_pex
│ │ │ │ │ -      set this flag to disable peer exchange for this torrent.
│ │ │ │ │ -  no_verify_files
│ │ │ │ │ -      if this flag is set, the resume data will be assumed to be correct
│ │ │ │ │ -      without validating it against any files on disk. This may be used when
│ │ │ │ │ -      restoring a _s_e_s_s_i_o_n by loading resume data from disk. It will save time
│ │ │ │ │ -      and also delay any hard disk errors until files are actually needed. If
│ │ │ │ │ -      the resume data cannot be trusted, or if a torrent is added for the first
│ │ │ │ │ -      time to some save path that may already have some of the files, this flag
│ │ │ │ │ -      should not be set.
│ │ │ │ │ -  default_dont_download
│ │ │ │ │ -      default all file priorities to dont_download. This is useful for adding
│ │ │ │ │ -      magnet links where the number of files is unknown, but the
│ │ │ │ │ -      file_priorities is still set for some files. Any file not covered by the
│ │ │ │ │ -      file_priorities list will be set to normal download priority, unless this
│ │ │ │ │ -      flag is set, in which case they will be set to 0 (dont_download).
│ │ │ │ │ -  i2p_torrent
│ │ │ │ │ -      this flag makes the torrent be considered an "i2p torrent" for purposes
│ │ │ │ │ -      of the allow_i2p_mixed setting. When mixing regular peers and i2p peers
│ │ │ │ │ -      is disabled, i2p torrents won't add normal peers to its peer list. Note
│ │ │ │ │ -      that non i2p torrents may still allow i2p peers (on the off-chance that a
│ │ │ │ │ -      tracker return them and the _s_e_s_s_i_o_n is configured with a SAM connection).
│ │ │ │ │ -      This flag is set automatically when adding a torrent that has at least
│ │ │ │ │ -      one tracker whose hostname ends with .i2p. It's also set by
│ │ │ │ │ -      _p_a_r_s_e___m_a_g_n_e_t___u_r_i_(_) if the tracker list contains such URL.
│ │ │ │ │ -  all
│ │ │ │ │ -      all torrent flags combined. Can conveniently be used when creating masks
│ │ │ │ │ -      for flags
│ │ │ │ │ +********** eexxppoorrtt__ffiilltteerr(()) **********
│ │ │ │ │ +filter_tuple_t eexxppoorrtt__ffiilltteerr () const;
│ │ │ │ │ +This function will return the current state of the filter in the minimum number
│ │ │ │ │ +of ranges possible. They are sorted from ranges in low addresses to high
│ │ │ │ │ +addresses. Each _e_n_t_r_y in the returned vector is a range with the access control
│ │ │ │ │ +specified in its flags field.
│ │ │ │ │ +The return value is a tuple containing two range-lists. One for IPv4 addresses
│ │ │ │ │ +and one for IPv6 addresses.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppeexx__ffllaaggss__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_x___f_l_a_g_s_._h_p_p"
│ │ │ │ │ -  pex_encryption
│ │ │ │ │ -      the peer supports protocol encryption
│ │ │ │ │ -  pex_seed
│ │ │ │ │ -      the peer is a seed
│ │ │ │ │ -  pex_utp
│ │ │ │ │ -      the peer supports the uTP, transport protocol over UDP.
│ │ │ │ │ -  pex_holepunch
│ │ │ │ │ -      the peer supports the holepunch extension If this flag is received from a
│ │ │ │ │ -      peer, it can be used as a rendezvous point in case direct connections to
│ │ │ │ │ -      the peer fail
│ │ │ │ │ -  pex_lt_v2
│ │ │ │ │ -      protocol v2 this is not a standard flag, it is only used internally
│ │ │ │ │ +********** eennuumm aacccceessss__ffllaaggss **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_p___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|blocked|1    |indicates that IPs in this range should not be connected to nor|
│ │ │ │ │ +|_ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_c_c_e_p_t_e_d_ _a_s_ _i_n_c_o_m_i_n_g_ _c_o_n_n_e_c_t_i_o_n_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddoowwnnllooaadd__pprriioorriittyy__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y_._h_p_p"
│ │ │ │ │ -  dont_download
│ │ │ │ │ -      Don't download the file or piece. Partial pieces may still be downloaded
│ │ │ │ │ -      when setting file priorities.
│ │ │ │ │ -  default_priority
│ │ │ │ │ -      The default priority for files and pieces.
│ │ │ │ │ -  low_priority
│ │ │ │ │ -      The lowest priority for files and pieces.
│ │ │ │ │ -  top_priority
│ │ │ │ │ -      The highest priority for files and pieces.
│ │ │ │ │ +************ ppoorrtt__ffiilltteerr ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_p___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ +the port filter maps non-overlapping port ranges to flags. This is primarily
│ │ │ │ │ +used to indicate whether a range of ports should be connected to or not. The
│ │ │ │ │ +default is to have the full port range (0-65535) set to flag 0.
│ │ │ │ │ +class port_filter
│ │ │ │ │ +{
│ │ │ │ │ +   ppoorrtt__ffiilltteerr (port_filter const&);
│ │ │ │ │ +   ~~ppoorrtt__ffiilltteerr ();
│ │ │ │ │ +   port_filter& ooppeerraattoorr== (port_filter const&);
│ │ │ │ │ +   port_filter& ooppeerraattoorr== (port_filter&&);
│ │ │ │ │ +   ppoorrtt__ffiilltteerr (port_filter&&);
│ │ │ │ │ +   ppoorrtt__ffiilltteerr ();
│ │ │ │ │ +   void aadddd__rruullee (std::uint16_t first, std::uint16_t last, std::uint32_t
│ │ │ │ │ +flags);
│ │ │ │ │ +   std::uint32_t aacccceessss (std::uint16_t port) const;
│ │ │ │ │ +
│ │ │ │ │ +   enum access_flags
│ │ │ │ │ +   {
│ │ │ │ │ +      blocked,
│ │ │ │ │ +   };
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ iinntt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ -  version_major
│ │ │ │ │ -      the major, minor and tiny versions of libtorrent
│ │ │ │ │ -  version_minor
│ │ │ │ │ -      the major, minor and tiny versions of libtorrent
│ │ │ │ │ -  version_tiny
│ │ │ │ │ -      the major, minor and tiny versions of libtorrent
│ │ │ │ │ +********** aadddd__rruullee(()) **********
│ │ │ │ │ +void aadddd__rruullee (std::uint16_t first, std::uint16_t last, std::uint32_t flags);
│ │ │ │ │ +set the flags for the specified port range (first, last) to flags overwriting
│ │ │ │ │ +any existing rule for those ports. The range is inclusive, i.e. the port last
│ │ │ │ │ +also has the flag set on it.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ cchhaarr ccoonnsstt** ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ -  version_str
│ │ │ │ │ -      the libtorrent version in string form
│ │ │ │ │ +********** aacccceessss(()) **********
│ │ │ │ │ +std::uint32_t aacccceessss (std::uint16_t port) const;
│ │ │ │ │ +test the specified port (port) for whether it is blocked or not. The returned
│ │ │ │ │ +value is the flags set for this port. see _a_c_c_e_s_s___f_l_a_g_s.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ssttdd::::uuiinntt6644__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ -  version_revision
│ │ │ │ │ -      the git commit of this libtorrent version
│ │ │ │ │ +********** eennuumm aacccceessss__ffllaaggss **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_p___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|blocked|1    |this flag indicates that destination ports in the range should|
│ │ │ │ │ +|_ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_o_t_ _b_e_ _c_o_n_n_e_c_t_e_d_ _t_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ bblloocckk__iinnffoo ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___h_a_n_d_l_e_._h_p_p"
│ │ │ │ │  holds the state of a block in a piece. Who we requested it from and how far
│ │ │ │ │  along we are at downloading it.
│ │ │ │ │  struct block_info
│ │ │ │ │  {
│ │ │ │ │ -   _t_c_p_:_:_e_n_d_p_o_i_n_t ppeeeerr () const;
│ │ │ │ │     void sseett__ppeeeerr (tcp::endpoint const& ep);
│ │ │ │ │ +   _t_c_p_:_:_e_n_d_p_o_i_n_t ppeeeerr () const;
│ │ │ │ │  
│ │ │ │ │     enum block_state_t
│ │ │ │ │     {
│ │ │ │ │        none,
│ │ │ │ │        requested,
│ │ │ │ │        writing,
│ │ │ │ │        finished,
│ │ │ │ │ @@ -1481,17 +4897,17 @@
│ │ │ │ │  
│ │ │ │ │     unsigned bytes_progress:15;
│ │ │ │ │     unsigned block_size:15;
│ │ │ │ │     unsigned state:2;
│ │ │ │ │     unsigned num_peers:14;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__ppeeeerr(()) ppeeeerr(()) **********
│ │ │ │ │ -_t_c_p_:_:_e_n_d_p_o_i_n_t ppeeeerr () const;
│ │ │ │ │ +********** ppeeeerr(()) sseett__ppeeeerr(()) **********
│ │ │ │ │  void sseett__ppeeeerr (tcp::endpoint const& ep);
│ │ │ │ │ +_t_c_p_:_:_e_n_d_p_o_i_n_t ppeeeerr () const;
│ │ │ │ │  The peer is the ip address of the peer this block was downloaded from.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** eennuumm bblloocckk__ssttaattee__tt **********
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___h_a_n_d_l_e_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |none     |0    |This block has not been downloaded or requested form any   |
│ │ │ │ │ @@ -1585,96 +5001,96 @@
│ │ │ │ │     ttoorrrreenntt__hhaannddllee () noexcept = default;
│ │ │ │ │     void aadddd__ppiieeccee (piece_index_t piece, char const* data, add_piece_flags_t
│ │ │ │ │  flags = {}) const;
│ │ │ │ │     void aadddd__ppiieeccee (piece_index_t piece, std::vector<char> data,
│ │ │ │ │  add_piece_flags_t flags = {}) const;
│ │ │ │ │     void rreeaadd__ppiieeccee (piece_index_t piece) const;
│ │ │ │ │     bool hhaavvee__ppiieeccee (piece_index_t piece) const;
│ │ │ │ │ -   void ggeett__ppeeeerr__iinnffoo (std::vector<peer_info>& v) const;
│ │ │ │ │     void ppoosstt__ppeeeerr__iinnffoo () const;
│ │ │ │ │ +   void ggeett__ppeeeerr__iinnffoo (std::vector<peer_info>& v) const;
│ │ │ │ │     torrent_status ssttaattuuss (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ │     void ppoosstt__ssttaattuuss (status_flags_t flags = status_flags_t::all()) const;
│ │ │ │ │ -   void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector<partial_piece_info>& queue) const;
│ │ │ │ │ -   void ppoosstt__ddoowwnnllooaadd__qquueeuuee () const;
│ │ │ │ │     std::vector<partial_piece_info> ggeett__ddoowwnnllooaadd__qquueeuuee () const;
│ │ │ │ │ +   void ppoosstt__ddoowwnnllooaadd__qquueeuuee () const;
│ │ │ │ │ +   void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector<partial_piece_info>& queue) const;
│ │ │ │ │ +   void rreesseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index) const;
│ │ │ │ │     void cclleeaarr__ppiieeccee__ddeeaaddlliinneess () const;
│ │ │ │ │     void sseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index, int deadline, deadline_flags_t
│ │ │ │ │  flags = {}) const;
│ │ │ │ │ -   void rreesseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index) const;
│ │ │ │ │ -   void ffiillee__pprrooggrreessss (std::vector<std::int64_t>& progress,
│ │ │ │ │ -file_progress_flags_t flags = {}) const;
│ │ │ │ │     void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const;
│ │ │ │ │     std::vector<std::int64_t> ffiillee__pprrooggrreessss (file_progress_flags_t flags = {})
│ │ │ │ │  const;
│ │ │ │ │ +   void ffiillee__pprrooggrreessss (std::vector<std::int64_t>& progress,
│ │ │ │ │ +file_progress_flags_t flags = {}) const;
│ │ │ │ │     std::vector<open_file_state> ffiillee__ssttaattuuss () const;
│ │ │ │ │     void cclleeaarr__eerrrroorr () const;
│ │ │ │ │     void ppoosstt__ttrraacckkeerrss () const;
│ │ │ │ │ -   std::vector<announce_entry> ttrraacckkeerrss () const;
│ │ │ │ │     void aadddd__ttrraacckkeerr (announce_entry const&) const;
│ │ │ │ │ +   std::vector<announce_entry> ttrraacckkeerrss () const;
│ │ │ │ │     void rreeppllaaccee__ttrraacckkeerrss (std::vector<announce_entry> const&) const;
│ │ │ │ │ -   void aadddd__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │ -   std::set<std::string> uurrll__sseeeeddss () const;
│ │ │ │ │     void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │ +   std::set<std::string> uurrll__sseeeeddss () const;
│ │ │ │ │ +   void aadddd__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │ +   void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const;
│ │ │ │ │     std::set<std::string> hhttttpp__sseeeeddss () const;
│ │ │ │ │     void aadddd__hhttttpp__sseeeedd (std::string const& url) const;
│ │ │ │ │ -   void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const;
│ │ │ │ │     void aadddd__eexxtteennssiioonn (
│ │ │ │ │        std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&,
│ │ │ │ │  client_data_t)> const& ext
│ │ │ │ │        , client_data_t userdata = client_data_t{});
│ │ │ │ │     bool sseett__mmeettaaddaattaa (span<char const> metadata) const;
│ │ │ │ │     bool iiss__vvaalliidd () const;
│ │ │ │ │     void rreessuummee () const;
│ │ │ │ │     void ppaauussee (pause_flags_t flags = {}) const;
│ │ │ │ │     void sseett__ffllaaggss (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ │     void sseett__ffllaaggss (torrent_flags_t flags) const;
│ │ │ │ │ -   torrent_flags_t ffllaaggss () const;
│ │ │ │ │     void uunnsseett__ffllaaggss (torrent_flags_t flags) const;
│ │ │ │ │ +   torrent_flags_t ffllaaggss () const;
│ │ │ │ │     void fflluusshh__ccaacchhee () const;
│ │ │ │ │     void ffoorrccee__rreecchheecckk () const;
│ │ │ │ │     void ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags = {}) const;
│ │ │ │ │     bool nneeeedd__ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags) const;
│ │ │ │ │     bool nneeeedd__ssaavvee__rreessuummee__ddaattaa () const;
│ │ │ │ │ -   void qquueeuuee__ppoossiittiioonn__uupp () const;
│ │ │ │ │ -   void qquueeuuee__ppoossiittiioonn__ttoopp () const;
│ │ │ │ │     void qquueeuuee__ppoossiittiioonn__bboottttoomm () const;
│ │ │ │ │ +   void qquueeuuee__ppoossiittiioonn__ttoopp () const;
│ │ │ │ │     void qquueeuuee__ppoossiittiioonn__ddoowwnn () const;
│ │ │ │ │     queue_position_t qquueeuuee__ppoossiittiioonn () const;
│ │ │ │ │ +   void qquueeuuee__ppoossiittiioonn__uupp () const;
│ │ │ │ │     void qquueeuuee__ppoossiittiioonn__sseett (queue_position_t p) const;
│ │ │ │ │     void sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr (std::string const& certificate
│ │ │ │ │        , std::string const& private_key
│ │ │ │ │        , std::string const& dh_params);
│ │ │ │ │     void sseett__ssssll__cceerrttiiffiiccaattee (std::string const& certificate
│ │ │ │ │        , std::string const& private_key
│ │ │ │ │        , std::string const& dh_params
│ │ │ │ │        , std::string const& passphrase = "");
│ │ │ │ │     std::shared_ptr<torrent_info> ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess () const;
│ │ │ │ │     std::shared_ptr<const torrent_info> ttoorrrreenntt__ffiillee () const;
│ │ │ │ │     std::vector<std::vector<sha256_hash>> ppiieeccee__llaayyeerrss () const;
│ │ │ │ │ -   void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector<int>& avail) const;
│ │ │ │ │     void ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy () const;
│ │ │ │ │ -   std::vector<download_priority_t> ggeett__ppiieeccee__pprriioorriittiieess () const;
│ │ │ │ │ +   void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector<int>& avail) const;
│ │ │ │ │     void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority)
│ │ │ │ │  const;
│ │ │ │ │     download_priority_t ppiieeccee__pprriioorriittyy (piece_index_t index) const;
│ │ │ │ │     void pprriioorriittiizzee__ppiieecceess (std::vector<download_priority_t> const& pieces)
│ │ │ │ │  const;
│ │ │ │ │     void pprriioorriittiizzee__ppiieecceess (std::vector<std::pair<piece_index_t,
│ │ │ │ │  download_priority_t>> const& pieces) const;
│ │ │ │ │ -   std::vector<download_priority_t> ggeett__ffiillee__pprriioorriittiieess () const;
│ │ │ │ │ +   std::vector<download_priority_t> ggeett__ppiieeccee__pprriioorriittiieess () const;
│ │ │ │ │     download_priority_t ffiillee__pprriioorriittyy (file_index_t index) const;
│ │ │ │ │     void pprriioorriittiizzee__ffiilleess (std::vector<download_priority_t> const& files) const;
│ │ │ │ │     void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const;
│ │ │ │ │ +   std::vector<download_priority_t> ggeett__ffiillee__pprriioorriittiieess () const;
│ │ │ │ │ +   void ffoorrccee__llssdd__aannnnoouunnccee () const;
│ │ │ │ │     void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t =
│ │ │ │ │  {}) const;
│ │ │ │ │     void ffoorrccee__ddhhtt__aannnnoouunnccee () const;
│ │ │ │ │ -   void ffoorrccee__llssdd__aannnnoouunnccee () const;
│ │ │ │ │     void ssccrraappee__ttrraacckkeerr (int idx = -1) const;
│ │ │ │ │ -   void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const;
│ │ │ │ │     void sseett__uuppllooaadd__lliimmiitt (int limit) const;
│ │ │ │ │ +   void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const;
│ │ │ │ │     int uuppllooaadd__lliimmiitt () const;
│ │ │ │ │     int ddoowwnnllooaadd__lliimmiitt () const;
│ │ │ │ │     void ccoonnnneecctt__ppeeeerr (tcp::endpoint const& adr, peer_source_flags_t source = {}
│ │ │ │ │        , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
│ │ │ │ │     void cclleeaarr__ppeeeerrss ();
│ │ │ │ │     void sseett__mmaaxx__uuppllooaaddss (int max_uploads) const;
│ │ │ │ │     int mmaaxx__uuppllooaaddss () const;
│ │ │ │ │ @@ -1682,17 +5098,17 @@
│ │ │ │ │     void sseett__mmaaxx__ccoonnnneeccttiioonnss (int max_connections) const;
│ │ │ │ │     void mmoovvee__ssttoorraaggee (std::string const& save_path
│ │ │ │ │        , move_flags_t flags = move_flags_t::always_replace_files
│ │ │ │ │        ) const;
│ │ │ │ │     void rreennaammee__ffiillee (file_index_t index, std::string const& new_name) const;
│ │ │ │ │     info_hash_t iinnffoo__hhaasshheess () const;
│ │ │ │ │     sha1_hash iinnffoo__hhaasshh () const;
│ │ │ │ │ -   bool ooppeerraattoorr!!== (const torrent_handle& h) const;
│ │ │ │ │     bool ooppeerraattoorr<< (const torrent_handle& h) const;
│ │ │ │ │     bool ooppeerraattoorr==== (const torrent_handle& h) const;
│ │ │ │ │ +   bool ooppeerraattoorr!!== (const torrent_handle& h) const;
│ │ │ │ │     std::uint32_t iidd () const;
│ │ │ │ │     std::shared_ptr<torrent> nnaattiivvee__hhaannddllee () const;
│ │ │ │ │     client_data_t uusseerrddaattaa () const;
│ │ │ │ │     bool iinn__sseessssiioonn () const;
│ │ │ │ │  
│ │ │ │ │     static constexpr add_piece_flags_t oovveerrwwrriittee__eexxiissttiinngg  = 0_bit;
│ │ │ │ │     static constexpr status_flags_t qquueerryy__ddiissttrriibbuutteedd__ccooppiieess  = 0_bit;
│ │ │ │ │ @@ -1759,16 +5175,16 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** hhaavvee__ppiieeccee(()) **********
│ │ │ │ │  bool hhaavvee__ppiieeccee (piece_index_t piece) const;
│ │ │ │ │  Returns true if this piece has been completely downloaded and written to disk,
│ │ │ │ │  and false otherwise.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ggeett__ppeeeerr__iinnffoo(()) ppoosstt__ppeeeerr__iinnffoo(()) **********
│ │ │ │ │ -void ggeett__ppeeeerr__iinnffoo (std::vector<peer_info>& v) const;
│ │ │ │ │  void ppoosstt__ppeeeerr__iinnffoo () const;
│ │ │ │ │ +void ggeett__ppeeeerr__iinnffoo (std::vector<peer_info>& v) const;
│ │ │ │ │  Query information about connected peers for this torrent. If the _t_o_r_r_e_n_t___h_a_n_d_l_e
│ │ │ │ │  is invalid, it will throw a system_error exception.
│ │ │ │ │  post_peer_info() is asynchronous and will trigger the posting of a
│ │ │ │ │  _p_e_e_r___i_n_f_o___a_l_e_r_t. The _a_l_e_r_t contain a list of _p_e_e_r___i_n_f_o objects, one for each
│ │ │ │ │  connected peer.
│ │ │ │ │  get_peer_info() is synchronous and takes a reference to a vector that will be
│ │ │ │ │  cleared and filled with one _e_n_t_r_y for each peer connected to this torrent,
│ │ │ │ │ @@ -1789,29 +5205,29 @@
│ │ │ │ │  It will trigger posting of a _s_t_a_t_e___u_p_d_a_t_e___a_l_e_r_t with a single _t_o_r_r_e_n_t___s_t_a_t_u_s
│ │ │ │ │  object for this torrent.
│ │ │ │ │  In order to get regular updates for torrents whose status changes, consider
│ │ │ │ │  calling session::post_torrent_updates()`` instead.
│ │ │ │ │  By default everything is included. The flags you can use to decide what to
│ │ │ │ │  iinncclluuddee are defined in this class.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett__ddoowwnnllooaadd__qquueeuuee(()) ppoosstt__ddoowwnnllooaadd__qquueeuuee(()) **********
│ │ │ │ │ -void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector<partial_piece_info>& queue) const;
│ │ │ │ │ -void ppoosstt__ddoowwnnllooaadd__qquueeuuee () const;
│ │ │ │ │ +********** ppoosstt__ddoowwnnllooaadd__qquueeuuee(()) ggeett__ddoowwnnllooaadd__qquueeuuee(()) **********
│ │ │ │ │  std::vector<partial_piece_info> ggeett__ddoowwnnllooaadd__qquueeuuee () const;
│ │ │ │ │ +void ppoosstt__ddoowwnnllooaadd__qquueeuuee () const;
│ │ │ │ │ +void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector<partial_piece_info>& queue) const;
│ │ │ │ │  post_download_queue() triggers a download_queue_alert to be posted.
│ │ │ │ │  get_download_queue() is a synchronous call and returns a vector with
│ │ │ │ │  information about pieces that are partially downloaded or not downloaded but
│ │ │ │ │  partially requested. See _p_a_r_t_i_a_l___p_i_e_c_e___i_n_f_o for the fields in the returned
│ │ │ │ │  vector.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** cclleeaarr__ppiieeccee__ddeeaaddlliinneess(()) rreesseett__ppiieeccee__ddeeaaddlliinnee(()) sseett__ppiieeccee__ddeeaaddlliinnee(()) **********
│ │ │ │ │ +********** sseett__ppiieeccee__ddeeaaddlliinnee(()) rreesseett__ppiieeccee__ddeeaaddlliinnee(()) cclleeaarr__ppiieeccee__ddeeaaddlliinneess(()) **********
│ │ │ │ │ +void rreesseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index) const;
│ │ │ │ │  void cclleeaarr__ppiieeccee__ddeeaaddlliinneess () const;
│ │ │ │ │  void sseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index, int deadline, deadline_flags_t
│ │ │ │ │  flags = {}) const;
│ │ │ │ │ -void rreesseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index) const;
│ │ │ │ │  This function sets or resets the deadline associated with a specific piece
│ │ │ │ │  index (index). libtorrent will attempt to download this entire piece before the
│ │ │ │ │  deadline expires. This is not necessarily possible, but pieces with a more
│ │ │ │ │  recent deadline will always be prioritized over pieces with a deadline further
│ │ │ │ │  ahead in time. The deadline (and flags) of a piece can be changed by calling
│ │ │ │ │  this function again.
│ │ │ │ │  If the piece is already downloaded when this call is made, nothing happens,
│ │ │ │ │ @@ -1820,19 +5236,19 @@
│ │ │ │ │  deadline is the number of milliseconds until this piece should be completed.
│ │ │ │ │  reset_piece_deadline removes the deadline from the piece. If it hasn't already
│ │ │ │ │  been downloaded, it will no longer be considered a priority.
│ │ │ │ │  clear_piece_deadlines() removes deadlines on all pieces in the torrent. As if
│ │ │ │ │  _r_e_s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_) was called on all pieces.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ffiillee__pprrooggrreessss(()) ppoosstt__ffiillee__pprrooggrreessss(()) **********
│ │ │ │ │ -void ffiillee__pprrooggrreessss (std::vector<std::int64_t>& progress, file_progress_flags_t
│ │ │ │ │ -flags = {}) const;
│ │ │ │ │  void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const;
│ │ │ │ │  std::vector<std::int64_t> ffiillee__pprrooggrreessss (file_progress_flags_t flags = {})
│ │ │ │ │  const;
│ │ │ │ │ +void ffiillee__pprrooggrreessss (std::vector<std::int64_t>& progress, file_progress_flags_t
│ │ │ │ │ +flags = {}) const;
│ │ │ │ │  This function fills in the supplied vector, or returns a vector, with the
│ │ │ │ │  number of bytes downloaded of each file in this torrent. The progress values
│ │ │ │ │  are ordered the same as the files in the _t_o_r_r_e_n_t___i_n_f_o.
│ │ │ │ │  This operation is not very cheap. Its complexity is OO((nn ++ mmjj)). Where nn is the
│ │ │ │ │  number of files, mm is the number of currently downloading pieces and jj is the
│ │ │ │ │  number of blocks in a piece.
│ │ │ │ │  The flags parameter can be used to specify the granularity of the file
│ │ │ │ │ @@ -1855,16 +5271,16 @@
│ │ │ │ │  ********** cclleeaarr__eerrrroorr(()) **********
│ │ │ │ │  void cclleeaarr__eerrrroorr () const;
│ │ │ │ │  If the torrent is in an error state (i.e. torrent_status::error is non-empty),
│ │ │ │ │  this will clear the error and start the torrent again.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aadddd__ttrraacckkeerr(()) rreeppllaaccee__ttrraacckkeerrss(()) ttrraacckkeerrss(()) ppoosstt__ttrraacckkeerrss(()) **********
│ │ │ │ │  void ppoosstt__ttrraacckkeerrss () const;
│ │ │ │ │ -std::vector<announce_entry> ttrraacckkeerrss () const;
│ │ │ │ │  void aadddd__ttrraacckkeerr (announce_entry const&) const;
│ │ │ │ │ +std::vector<announce_entry> ttrraacckkeerrss () const;
│ │ │ │ │  void rreeppllaaccee__ttrraacckkeerrss (std::vector<announce_entry> const&) const;
│ │ │ │ │  trackers() returns the list of trackers for this torrent. The announce _e_n_t_r_y
│ │ │ │ │  contains both a string url which specify the announce url for the tracker as
│ │ │ │ │  well as an _i_n_t tier, which is specifies the order in which this tracker is
│ │ │ │ │  tried. If you want libtorrent to use another list of trackers for this torrent,
│ │ │ │ │  you can use replace_trackers() which takes a list of the same form as the one
│ │ │ │ │  returned from trackers() and will replace it. If you want an immediate effect,
│ │ │ │ │ @@ -1874,30 +5290,30 @@
│ │ │ │ │  add_tracker() will look if the specified tracker is already in the set. If it
│ │ │ │ │  is, it doesn't do anything. If it's not in the current set of trackers, it will
│ │ │ │ │  insert it in the tier specified in the _a_n_n_o_u_n_c_e___e_n_t_r_y.
│ │ │ │ │  The updated set of trackers will be saved in the resume data, and when a
│ │ │ │ │  torrent is started with resume data, the trackers from the resume data will
│ │ │ │ │  replace the original ones.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** uurrll__sseeeeddss(()) rreemmoovvee__uurrll__sseeeedd(()) aadddd__uurrll__sseeeedd(()) **********
│ │ │ │ │ -void aadddd__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │ -std::set<std::string> uurrll__sseeeeddss () const;
│ │ │ │ │ +********** rreemmoovvee__uurrll__sseeeedd(()) aadddd__uurrll__sseeeedd(()) uurrll__sseeeeddss(()) **********
│ │ │ │ │  void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │ +std::set<std::string> uurrll__sseeeeddss () const;
│ │ │ │ │ +void aadddd__uurrll__sseeeedd (std::string const& url) const;
│ │ │ │ │  add_url_seed() adds another url to the torrent's list of url seeds. If the
│ │ │ │ │  given url already exists in that list, the call has no effect. The torrent will
│ │ │ │ │  connect to the server and try to download pieces from it, unless it's paused,
│ │ │ │ │  queued, checking or seeding. remove_url_seed() removes the given url if it
│ │ │ │ │  exists already. url_seeds() return a set of the url seeds currently in this
│ │ │ │ │  torrent. Note that URLs that fails may be removed automatically from the list.
│ │ │ │ │  See _h_t_t_p_ _s_e_e_d_i_n_g for more information.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__hhttttpp__sseeeedd(()) rreemmoovvee__hhttttpp__sseeeedd(()) hhttttpp__sseeeeddss(()) **********
│ │ │ │ │ +********** hhttttpp__sseeeeddss(()) rreemmoovvee__hhttttpp__sseeeedd(()) aadddd__hhttttpp__sseeeedd(()) **********
│ │ │ │ │ +void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const;
│ │ │ │ │  std::set<std::string> hhttttpp__sseeeeddss () const;
│ │ │ │ │  void aadddd__hhttttpp__sseeeedd (std::string const& url) const;
│ │ │ │ │ -void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const;
│ │ │ │ │  These functions are identical as the *_url_seed() variants, but they operate on
│ │ │ │ │  _B_E_P_ _1_7 web seeds instead of _B_E_P_ _1_9.
│ │ │ │ │  See _h_t_t_p_ _s_e_e_d_i_n_g for more information.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aadddd__eexxtteennssiioonn(()) **********
│ │ │ │ │  void aadddd__eexxtteennssiioonn (
│ │ │ │ │        std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&,
│ │ │ │ │ @@ -1928,15 +5344,15 @@
│ │ │ │ │  and false afterward.
│ │ │ │ │  Clients should only use _i_s___v_a_l_i_d_(_) to determine if the result of session::
│ │ │ │ │  find_torrent() was successful.
│ │ │ │ │  Unlike other member functions which return a value, _i_s___v_a_l_i_d_(_) completes
│ │ │ │ │  immediately, without blocking on a result from the network thread. Also unlike
│ │ │ │ │  other functions, it never throws the system_error exception.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreessuummee(()) ppaauussee(()) **********
│ │ │ │ │ +********** ppaauussee(()) rreessuummee(()) **********
│ │ │ │ │  void rreessuummee () const;
│ │ │ │ │  void ppaauussee (pause_flags_t flags = {}) const;
│ │ │ │ │  pause(), and resume() will disconnect all peers and reconnect all peers
│ │ │ │ │  respectively. When a torrent is paused, it will however remember all share
│ │ │ │ │  ratios to all peers and remember all potential (not connected) peers. Torrents
│ │ │ │ │  may be paused automatically if there is a file error (e.g. disk full) or
│ │ │ │ │  something similar. See _f_i_l_e___e_r_r_o_r___a_l_e_r_t.
│ │ │ │ │ @@ -1945,19 +5361,19 @@
│ │ │ │ │  for the torrent_status::paused flag.
│ │ │ │ │  Note
│ │ │ │ │  Torrents that are auto-managed may be automatically resumed again. It does not
│ │ │ │ │  make sense to pause an auto-managed torrent without making it not auto-managed
│ │ │ │ │  first. Torrents are auto-managed by default when added to the _s_e_s_s_i_o_n. For more
│ │ │ │ │  information, see _q_u_e_u_i_n_g.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffllaaggss(()) uunnsseett__ffllaaggss(()) sseett__ffllaaggss(()) **********
│ │ │ │ │ +********** sseett__ffllaaggss(()) uunnsseett__ffllaaggss(()) ffllaaggss(()) **********
│ │ │ │ │  void sseett__ffllaaggss (torrent_flags_t flags, torrent_flags_t mask) const;
│ │ │ │ │  void sseett__ffllaaggss (torrent_flags_t flags) const;
│ │ │ │ │ -torrent_flags_t ffllaaggss () const;
│ │ │ │ │  void uunnsseett__ffllaaggss (torrent_flags_t flags) const;
│ │ │ │ │ +torrent_flags_t ffllaaggss () const;
│ │ │ │ │  sets and gets the torrent state flags. See _t_o_r_r_e_n_t___f_l_a_g_s___t. The set_flags
│ │ │ │ │  overload that take a mask will affect all flags part of the mask, and set their
│ │ │ │ │  values to what the flags argument is set to. This allows clearing and setting
│ │ │ │ │  flags in a single function call. The set_flags overload that just takes flags,
│ │ │ │ │  sets all the specified flags and leave any other flags unchanged. unset_flags
│ │ │ │ │  clears the specified flags, while leaving any other flags unchanged.
│ │ │ │ │  Theseed_modeflag is special, it can only be cleared once the torrent has been
│ │ │ │ │ @@ -2081,21 +5497,21 @@
│ │ │ │ │  thread. A way to avoid blocking is to instead call _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) directly,
│ │ │ │ │  specifying the conditions under which resume data should be saved.
│ │ │ │ │  Note
│ │ │ │ │  A torrent's resume data is considered saved as soon as the
│ │ │ │ │  _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t is posted. It is important to make sure this _a_l_e_r_t is
│ │ │ │ │  received and handled in order for this function to be meaningful.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** qquueeuuee__ppoossiittiioonn__bboottttoomm(()) qquueeuuee__ppoossiittiioonn__uupp(()) qquueeuuee__ppoossiittiioonn__ttoopp(())
│ │ │ │ │ -qquueeuuee__ppoossiittiioonn__ddoowwnn(()) qquueeuuee__ppoossiittiioonn(()) **********
│ │ │ │ │ -void qquueeuuee__ppoossiittiioonn__uupp () const;
│ │ │ │ │ -void qquueeuuee__ppoossiittiioonn__ttoopp () const;
│ │ │ │ │ +********** qquueeuuee__ppoossiittiioonn__ttoopp(()) qquueeuuee__ppoossiittiioonn__ddoowwnn(()) qquueeuuee__ppoossiittiioonn__bboottttoomm(())
│ │ │ │ │ +qquueeuuee__ppoossiittiioonn__uupp(()) qquueeuuee__ppoossiittiioonn(()) **********
│ │ │ │ │  void qquueeuuee__ppoossiittiioonn__bboottttoomm () const;
│ │ │ │ │ +void qquueeuuee__ppoossiittiioonn__ttoopp () const;
│ │ │ │ │  void qquueeuuee__ppoossiittiioonn__ddoowwnn () const;
│ │ │ │ │  queue_position_t qquueeuuee__ppoossiittiioonn () const;
│ │ │ │ │ +void qquueeuuee__ppoossiittiioonn__uupp () const;
│ │ │ │ │  Every torrent that is added is assigned a queue position exactly one greater
│ │ │ │ │  than the greatest queue position of all existing torrents. Torrents that are
│ │ │ │ │  being seeded have -1 as their queue position, since they're no longer in line
│ │ │ │ │  to be downloaded.
│ │ │ │ │  When a torrent is removed or turns into a seed, all torrents with greater queue
│ │ │ │ │  positions have their positions decreased to fill in the space in the sequence.
│ │ │ │ │  queue_position() returns the torrent's position in the download queue. The
│ │ │ │ │ @@ -2109,15 +5525,15 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** qquueeuuee__ppoossiittiioonn__sseett(()) **********
│ │ │ │ │  void qquueeuuee__ppoossiittiioonn__sseett (queue_position_t p) const;
│ │ │ │ │  updates the position in the queue for this torrent. The relative order of all
│ │ │ │ │  other torrents remain intact but their numerical queue position shifts to make
│ │ │ │ │  space for this torrent's new position
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr(()) sseett__ssssll__cceerrttiiffiiccaattee(()) **********
│ │ │ │ │ +********** sseett__ssssll__cceerrttiiffiiccaattee(()) sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr(()) **********
│ │ │ │ │  void sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr (std::string const& certificate
│ │ │ │ │        , std::string const& private_key
│ │ │ │ │        , std::string const& dh_params);
│ │ │ │ │  void sseett__ssssll__cceerrttiiffiiccaattee (std::string const& certificate
│ │ │ │ │        , std::string const& private_key
│ │ │ │ │        , std::string const& dh_params
│ │ │ │ │        , std::string const& passphrase = "");
│ │ │ │ │ @@ -2138,15 +5554,15 @@
│ │ │ │ │  Note that when a torrent first starts up, and it needs a certificate, it will
│ │ │ │ │  suspend connecting to any peers until it has one. It's typically desirable to
│ │ │ │ │  resume the torrent after setting the SSL certificate.
│ │ │ │ │  If you receive a _t_o_r_r_e_n_t___n_e_e_d___c_e_r_t___a_l_e_r_t, you need to call this to provide a
│ │ │ │ │  valid cert. If you don't have a cert you won't be allowed to connect to any
│ │ │ │ │  peers.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttoorrrreenntt__ffiillee(()) ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess(()) **********
│ │ │ │ │ +********** ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess(()) ttoorrrreenntt__ffiillee(()) **********
│ │ │ │ │  std::shared_ptr<torrent_info> ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess () const;
│ │ │ │ │  std::shared_ptr<const torrent_info> ttoorrrreenntt__ffiillee () const;
│ │ │ │ │  _t_o_r_r_e_n_t___f_i_l_e_(_) returns a pointer to the _t_o_r_r_e_n_t___i_n_f_o object associated with
│ │ │ │ │  this torrent. The _t_o_r_r_e_n_t___i_n_f_o object may be a copy of the internal object. If
│ │ │ │ │  the torrent doesn't have metadata, the pointer will not be initialized (i.e. a
│ │ │ │ │  nullptr). The torrent may be in a state without metadata only if it was started
│ │ │ │ │  without a .torrent file, e.g. by being added by magnet link.
│ │ │ │ │ @@ -2174,33 +5590,33 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ppiieeccee__llaayyeerrss(()) **********
│ │ │ │ │  std::vector<std::vector<sha256_hash>> ppiieeccee__llaayyeerrss () const;
│ │ │ │ │  returns the piece layers for all files in the torrent. If this is a v1 torrent
│ │ │ │ │  (and doesn't have any piece layers) it returns an empty vector. This is a
│ │ │ │ │  blocking call that will synchronize with the libtorrent network thread.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__aavvaaiillaabbiilliittyy(()) ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy(()) **********
│ │ │ │ │ -void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector<int>& avail) const;
│ │ │ │ │ +********** ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy(()) ppiieeccee__aavvaaiillaabbiilliittyy(()) **********
│ │ │ │ │  void ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy () const;
│ │ │ │ │ +void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector<int>& avail) const;
│ │ │ │ │  The piece availability is the number of peers that we are connected that has
│ │ │ │ │  advertised having a particular piece. This is the information that libtorrent
│ │ │ │ │  uses in order to prefer picking rare pieces.
│ │ │ │ │  post_piece_availability() will trigger a _p_i_e_c_e___a_v_a_i_l_a_b_i_l_i_t_y___a_l_e_r_t to be posted.
│ │ │ │ │  piece_availability() fills the specified std::vector<int> with the availability
│ │ │ │ │  for each piece in this torrent. libtorrent does not keep track of availability
│ │ │ │ │  for seeds, so if the torrent is seeding the availability for all pieces is
│ │ │ │ │  reported as 0.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett__ppiieeccee__pprriioorriittiieess(()) ppiieeccee__pprriioorriittyy(()) pprriioorriittiizzee__ppiieecceess(()) **********
│ │ │ │ │ -std::vector<download_priority_t> ggeett__ppiieeccee__pprriioorriittiieess () const;
│ │ │ │ │ +********** ppiieeccee__pprriioorriittyy(()) pprriioorriittiizzee__ppiieecceess(()) ggeett__ppiieeccee__pprriioorriittiieess(()) **********
│ │ │ │ │  void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority) const;
│ │ │ │ │  download_priority_t ppiieeccee__pprriioorriittyy (piece_index_t index) const;
│ │ │ │ │  void pprriioorriittiizzee__ppiieecceess (std::vector<download_priority_t> const& pieces) const;
│ │ │ │ │  void pprriioorriittiizzee__ppiieecceess (std::vector<std::pair<piece_index_t,
│ │ │ │ │  download_priority_t>> const& pieces) const;
│ │ │ │ │ +std::vector<download_priority_t> ggeett__ppiieeccee__pprriioorriittiieess () const;
│ │ │ │ │  These functions are used to set and get the priority of individual pieces. By
│ │ │ │ │  default all pieces have priority 4. That means that the random rarest first
│ │ │ │ │  algorithm is effectively active for all pieces. You may however change the
│ │ │ │ │  priority of individual pieces. There are 8 priority levels. 0 means not to
│ │ │ │ │  download the piece at all. Otherwise, lower priority values means less likely
│ │ │ │ │  to be picked. Piece priority takes precedence over piece availability. Every
│ │ │ │ │  piece with priority 7 will be attempted to be picked before a priority 6 piece
│ │ │ │ │ @@ -2220,19 +5636,19 @@
│ │ │ │ │  where the piece index or priority is out of range, are not allowed.
│ │ │ │ │  get_piece_priorities returns a vector with one element for each piece in the
│ │ │ │ │  torrent. Each element is the current priority of that piece.
│ │ │ │ │  It's possible to cancel the effect of ffiillee priorities by setting the priorities
│ │ │ │ │  for the affected pieces. Care has to be taken when mixing usage of file- and
│ │ │ │ │  piece priorities.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett__ffiillee__pprriioorriittiieess(()) ffiillee__pprriioorriittyy(()) pprriioorriittiizzee__ffiilleess(()) **********
│ │ │ │ │ -std::vector<download_priority_t> ggeett__ffiillee__pprriioorriittiieess () const;
│ │ │ │ │ +********** ggeett__ffiillee__pprriioorriittiieess(()) pprriioorriittiizzee__ffiilleess(()) ffiillee__pprriioorriittyy(()) **********
│ │ │ │ │  download_priority_t ffiillee__pprriioorriittyy (file_index_t index) const;
│ │ │ │ │  void pprriioorriittiizzee__ffiilleess (std::vector<download_priority_t> const& files) const;
│ │ │ │ │  void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const;
│ │ │ │ │ +std::vector<download_priority_t> ggeett__ffiillee__pprriioorriittiieess () const;
│ │ │ │ │  index must be in the range [0, number_of_files).
│ │ │ │ │  file_priority() queries or sets the priority of file index.
│ │ │ │ │  prioritize_files() takes a vector that has at as many elements as there are
│ │ │ │ │  files in the torrent. Each _e_n_t_r_y is the priority of that file. The function
│ │ │ │ │  sets the priorities of all the pieces in the torrent based on the vector.
│ │ │ │ │  get_file_priorities() returns a vector with the priorities of all files.
│ │ │ │ │  The priority values are the same as for _p_i_e_c_e___p_r_i_o_r_i_t_y_(_). See
│ │ │ │ │ @@ -2251,19 +5667,19 @@
│ │ │ │ │  When combining file- and piece priorities, the resume file will record both.
│ │ │ │ │  When loading the resume data, the file priorities will be applied first, then
│ │ │ │ │  the piece priorities.
│ │ │ │ │  Moving data from a file into the part file is currently not supported. If a
│ │ │ │ │  file has its priority set to 0 aafftteerr it has already been created, it will not
│ │ │ │ │  be moved into the partfile.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffoorrccee__rreeaannnnoouunnccee(()) ffoorrccee__ddhhtt__aannnnoouunnccee(()) ffoorrccee__llssdd__aannnnoouunnccee(()) **********
│ │ │ │ │ +********** ffoorrccee__llssdd__aannnnoouunnccee(()) ffoorrccee__rreeaannnnoouunnccee(()) ffoorrccee__ddhhtt__aannnnoouunnccee(()) **********
│ │ │ │ │ +void ffoorrccee__llssdd__aannnnoouunnccee () const;
│ │ │ │ │  void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t = {})
│ │ │ │ │  const;
│ │ │ │ │  void ffoorrccee__ddhhtt__aannnnoouunnccee () const;
│ │ │ │ │ -void ffoorrccee__llssdd__aannnnoouunnccee () const;
│ │ │ │ │  force_reannounce() will force this torrent to do another tracker request, to
│ │ │ │ │  receive new peers. The seconds argument specifies how many seconds from now to
│ │ │ │ │  issue the tracker announces.
│ │ │ │ │  If the tracker's min_interval has not passed since the last announce, the
│ │ │ │ │  forced announce will be scheduled to happen immediately as the min_interval
│ │ │ │ │  expires. This is to honor trackers minimum re-announce interval settings.
│ │ │ │ │  The tracker_index argument specifies which tracker to re-announce. If set to -
│ │ │ │ │ @@ -2281,18 +5697,18 @@
│ │ │ │ │  A scrape request queries the tracker for statistics such as total number of
│ │ │ │ │  incomplete peers, complete peers, number of downloads etc.
│ │ │ │ │  This request will specifically update the num_complete and num_incomplete
│ │ │ │ │  fields in the _t_o_r_r_e_n_t___s_t_a_t_u_s struct once it completes. When it completes, it
│ │ │ │ │  will generate a _s_c_r_a_p_e___r_e_p_l_y___a_l_e_r_t. If it fails, it will generate a
│ │ │ │ │  _s_c_r_a_p_e___f_a_i_l_e_d___a_l_e_r_t.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__ddoowwnnllooaadd__lliimmiitt(()) ddoowwnnllooaadd__lliimmiitt(()) uuppllooaadd__lliimmiitt(()) sseett__uuppllooaadd__lliimmiitt(())
│ │ │ │ │ +********** sseett__ddoowwnnllooaadd__lliimmiitt(()) sseett__uuppllooaadd__lliimmiitt(()) uuppllooaadd__lliimmiitt(()) ddoowwnnllooaadd__lliimmiitt(())
│ │ │ │ │  **********
│ │ │ │ │ -void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const;
│ │ │ │ │  void sseett__uuppllooaadd__lliimmiitt (int limit) const;
│ │ │ │ │ +void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const;
│ │ │ │ │  int uuppllooaadd__lliimmiitt () const;
│ │ │ │ │  int ddoowwnnllooaadd__lliimmiitt () const;
│ │ │ │ │  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. set_download_limit works the same way but for
│ │ │ │ │  download bandwidth instead of upload bandwidth. Note that setting a higher
│ │ │ │ │  limit on a torrent then the global limit (settings_pack::upload_rate_limit)
│ │ │ │ │ @@ -2396,17 +5812,17 @@
│ │ │ │ │  returns the info-hash(es) of the torrent. If this handle is to a torrent that
│ │ │ │ │  hasn't loaded yet (for instance by being added) by a URL, the returned value is
│ │ │ │ │  undefined. The info_hash() returns the SHA-1 info-hash for v1 torrents and a
│ │ │ │ │  truncated hash for v2 torrents. For the full v2 info-hash, use info_hashes()
│ │ │ │ │  instead.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ooppeerraattoorr!!==(()) ooppeerraattoorr====(()) ooppeerraattoorr<<(()) **********
│ │ │ │ │ -bool ooppeerraattoorr!!== (const torrent_handle& h) const;
│ │ │ │ │  bool ooppeerraattoorr<< (const torrent_handle& h) const;
│ │ │ │ │  bool ooppeerraattoorr==== (const torrent_handle& h) const;
│ │ │ │ │ +bool ooppeerraattoorr!!== (const torrent_handle& h) const;
│ │ │ │ │  comparison operators. The order of the torrents is unspecified but stable.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** iidd(()) **********
│ │ │ │ │  std::uint32_t iidd () const;
│ │ │ │ │  returns a unique identifier for this torrent. It's not a dense index. It's not
│ │ │ │ │  preserved across sessions.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ @@ -2540,699 +5956,39 @@
│ │ │ │ │        is announced immediately.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ hhaasshh__vvaalluuee(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___h_a_n_d_l_e_._h_p_p"
│ │ │ │ │  std::size_t hhaasshh__vvaalluuee (torrent_handle const& h);
│ │ │ │ │  for std::hash (and to support using this type in unordered_map etc.)
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ wweebb__sseeeedd__eennttrryy ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___i_n_f_o_._h_p_p"
│ │ │ │ │ -the _w_e_b___s_e_e_d___e_n_t_r_y holds information about a web seed (also known as URL seed
│ │ │ │ │ -or HTTP seed). It is essentially a URL with some state associated with it. For
│ │ │ │ │ -more information, see _B_E_P_ _1_7 and _B_E_P_ _1_9.
│ │ │ │ │ -struct web_seed_entry
│ │ │ │ │ -{
│ │ │ │ │ -   bool ooppeerraattoorr==== (web_seed_entry const& e) const;
│ │ │ │ │ -   bool ooppeerraattoorr<< (web_seed_entry const& e) const;
│ │ │ │ │ -
│ │ │ │ │ -   enum type_t
│ │ │ │ │ -   {
│ │ │ │ │ -      url_seed,
│ │ │ │ │ -      http_seed,
│ │ │ │ │ -   };
│ │ │ │ │ -
│ │ │ │ │ -   std::string url;
│ │ │ │ │ -   std::string auth;
│ │ │ │ │ -   headers_t extra_headers;
│ │ │ │ │ -   std::uint8_t type;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr====(()) **********
│ │ │ │ │ -bool ooppeerraattoorr==== (web_seed_entry const& e) const;
│ │ │ │ │ -URL and type comparison
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr<<(()) **********
│ │ │ │ │ -bool ooppeerraattoorr<< (web_seed_entry const& e) const;
│ │ │ │ │ -URL and type less-than comparison
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm ttyyppee__tt **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___i_n_f_o_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_u_r_l___s_e_e_d_ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_h_t_t_p___s_e_e_d_|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  url
│ │ │ │ │ -      The URL of the web seed
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  auth
│ │ │ │ │ -      Optional authentication. If this is set, it's passed in as HTTP basic
│ │ │ │ │ -      auth to the web seed. The format is: username:password.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  extra_headers
│ │ │ │ │ -      Any extra HTTP headers that need to be passed to the web seed
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  type
│ │ │ │ │ -      The type of web seed (see _t_y_p_e___t)
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ llooaadd__ttoorrrreenntt__lliimmiittss ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___i_n_f_o_._h_p_p"
│ │ │ │ │ -this object holds configuration options for limits to use when loading
│ │ │ │ │ -torrents. They are meant to prevent loading potentially malicious torrents that
│ │ │ │ │ -cause excessive memory allocations.
│ │ │ │ │ -struct load_torrent_limits
│ │ │ │ │ -{
│ │ │ │ │ -   int mmaaxx__bbuuffffeerr__ssiizzee  = 10000000;
│ │ │ │ │ -   int mmaaxx__ppiieecceess  = 0x200000;
│ │ │ │ │ -   int mmaaxx__ddeeccooddee__ddeepptthh  = 100;
│ │ │ │ │ -   int mmaaxx__ddeeccooddee__ttookkeennss  = 3000000;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  max_buffer_size
│ │ │ │ │ -      the max size of a .torrent file to load into RAM
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  max_pieces
│ │ │ │ │ -      the max number of pieces allowed in the torrent
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  max_decode_depth
│ │ │ │ │ -      the max recursion depth in the bdecoded structure
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  max_decode_tokens
│ │ │ │ │ -      the max number of bdecode tokens
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ttoorrrreenntt__iinnffoo ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___i_n_f_o_._h_p_p"
│ │ │ │ │ -the _t_o_r_r_e_n_t___i_n_f_o class holds the information found in a .torrent file.
│ │ │ │ │ -class torrent_info
│ │ │ │ │ -{
│ │ │ │ │ -   explicit ttoorrrreenntt__iinnffoo (span<char const> buffer, from_span_t);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, load_torrent_limits const&
│ │ │ │ │ -cfg);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (char const* buffer, int size);
│ │ │ │ │ -   explicit ttoorrrreenntt__iinnffoo (std::string const& filename);
│ │ │ │ │ -   explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file);
│ │ │ │ │ -   explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (span<char const> buffer, error_code& ec, from_span_t);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (span<char const> buffer, load_torrent_limits const& cfg,
│ │ │ │ │ -from_span_t);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec);
│ │ │ │ │ -   ttoorrrreenntt__iinnffoo (torrent_info const& t);
│ │ │ │ │ -   ~~ttoorrrreenntt__iinnffoo ();
│ │ │ │ │ -   file_storage const& ffiilleess () const;
│ │ │ │ │ -   file_storage const& oorriigg__ffiilleess () const;
│ │ │ │ │ -   void rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
│ │ │ │ │ -   void rreemmaapp__ffiilleess (file_storage const& f);
│ │ │ │ │ -   void aadddd__ttrraacckkeerr (std::string const& url, int tier
│ │ │ │ │ -      , announce_entry::tracker_source source);
│ │ │ │ │ -   void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0);
│ │ │ │ │ -   std::vector<announce_entry> const& ttrraacckkeerrss () const;
│ │ │ │ │ -   void cclleeaarr__ttrraacckkeerrss ();
│ │ │ │ │ -   std::vector<sha1_hash> ssiimmiillaarr__ttoorrrreennttss () const;
│ │ │ │ │ -   std::vector<std::string> ccoolllleeccttiioonnss () const;
│ │ │ │ │ -   void sseett__wweebb__sseeeeddss (std::vector<web_seed_entry> seeds);
│ │ │ │ │ -   void aadddd__hhttttpp__sseeeedd (std::string const& url
│ │ │ │ │ -      , std::string const& extern_auth = std::string()
│ │ │ │ │ -      , web_seed_entry::headers_t const& extra_headers = web_seed_entry::
│ │ │ │ │ -headers_t());
│ │ │ │ │ -   std::vector<web_seed_entry> const& wweebb__sseeeeddss () const;
│ │ │ │ │ -   void aadddd__uurrll__sseeeedd (std::string const& url
│ │ │ │ │ -      , std::string const& ext_auth = std::string()
│ │ │ │ │ -      , web_seed_entry::headers_t const& ext_headers = web_seed_entry::
│ │ │ │ │ -headers_t());
│ │ │ │ │ -   std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ -   int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ -   int nnuumm__ppiieecceess () const;
│ │ │ │ │ -   int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │ -   piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │ -   piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ -   index_range<piece_index_t> ppiieeccee__rraannggee () const;
│ │ │ │ │ -   sha1_hash iinnffoo__hhaasshh () const noexcept;
│ │ │ │ │ -   info_hash_t const& iinnffoo__hhaasshheess () const;
│ │ │ │ │ -   bool vv22 () const;
│ │ │ │ │ -   bool vv11 () const;
│ │ │ │ │ -   int nnuumm__ffiilleess () const;
│ │ │ │ │ -   std::vector<file_slice> mmaapp__bblloocckk (piece_index_t const piece
│ │ │ │ │ -      , std::int64_t offset, int size) const;
│ │ │ │ │ -   peer_request mmaapp__ffiillee (file_index_t const file, std::int64_t offset, int
│ │ │ │ │ -size) const;
│ │ │ │ │ -   string_view ssssll__cceerrtt () const;
│ │ │ │ │ -   bool iiss__vvaalliidd () const;
│ │ │ │ │ -   bool pprriivv () const;
│ │ │ │ │ -   bool iiss__ii22pp () const;
│ │ │ │ │ -   int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │ -   sha1_hash hhaasshh__ffoorr__ppiieeccee (piece_index_t index) const;
│ │ │ │ │ -   char const* hhaasshh__ffoorr__ppiieeccee__ppttrr (piece_index_t const index) const;
│ │ │ │ │ -   bool iiss__llooaaddeedd () const;
│ │ │ │ │ -   const std::string& nnaammee () const;
│ │ │ │ │ -   std::time_t ccrreeaattiioonn__ddaattee () const;
│ │ │ │ │ -   const std::string& ccrreeaattoorr () const;
│ │ │ │ │ -   const std::string& ccoommmmeenntt () const;
│ │ │ │ │ -   std::vector<std::pair<std::string, int>> const& nnooddeess () const;
│ │ │ │ │ -   void aadddd__nnooddee (std::pair<std::string, int> const& node);
│ │ │ │ │ -   bool ppaarrssee__iinnffoo__sseeccttiioonn (bdecode_node const& info, error_code& ec, int
│ │ │ │ │ -max_pieces);
│ │ │ │ │ -   bdecode_node iinnffoo (char const* key) const;
│ │ │ │ │ -   span<char const> iinnffoo__sseeccttiioonn () const;
│ │ │ │ │ -   span<char const> ppiieeccee__llaayyeerr (file_index_t) const;
│ │ │ │ │ -   void ffrreeee__ppiieeccee__llaayyeerrss ();
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttoorrrreenntt__iinnffoo(()) **********
│ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (span<char const> buffer, from_span_t);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, load_torrent_limits const&
│ │ │ │ │ -cfg);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (char const* buffer, int size);
│ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (std::string const& filename);
│ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file);
│ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (span<char const> buffer, error_code& ec, from_span_t);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (span<char const> buffer, load_torrent_limits const& cfg,
│ │ │ │ │ -from_span_t);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec);
│ │ │ │ │ -ttoorrrreenntt__iinnffoo (torrent_info const& t);
│ │ │ │ │ -The constructor that takes an info-hash will initialize the info-hash to the
│ │ │ │ │ -given value, but leave all other fields empty. This is used internally when
│ │ │ │ │ -downloading torrents without the metadata. The metadata will be created by
│ │ │ │ │ -libtorrent as soon as it has been downloaded from the swarm.
│ │ │ │ │ -The constructor that takes a _b_d_e_c_o_d_e___n_o_d_e will create a _t_o_r_r_e_n_t___i_n_f_o object
│ │ │ │ │ -from the information found in the given torrent_file. The _b_d_e_c_o_d_e___n_o_d_e
│ │ │ │ │ -represents a tree node in an bencoded file. To load an ordinary .torrent file
│ │ │ │ │ -into a _b_d_e_c_o_d_e___n_o_d_e, use _b_d_e_c_o_d_e_(_).
│ │ │ │ │ -The version that takes a buffer pointer and a size will decode it as a .torrent
│ │ │ │ │ -file and initialize the _t_o_r_r_e_n_t___i_n_f_o object for you.
│ │ │ │ │ -The version that takes a filename will simply load the torrent file and decode
│ │ │ │ │ -it inside the constructor, for convenience. This might not be the most suitable
│ │ │ │ │ -for applications that want to be able to report detailed errors on what might
│ │ │ │ │ -go wrong.
│ │ │ │ │ -There is an upper limit on the size of the torrent file that will be loaded by
│ │ │ │ │ -the overload taking a filename. If it's important that even very large torrent
│ │ │ │ │ -files are loaded, use one of the other overloads.
│ │ │ │ │ -The overloads that takes an error_code const& never throws if an error occur,
│ │ │ │ │ -they will simply set the error code to describe what went wrong and not fully
│ │ │ │ │ -initialize the _t_o_r_r_e_n_t___i_n_f_o object. The overloads that do not take the extra
│ │ │ │ │ -error_code parameter will always throw if an error occurs. These overloads are
│ │ │ │ │ -not available when building without exception support.
│ │ │ │ │ -The overload that takes a span also needs an extra parameter of type
│ │ │ │ │ -from_span_t to disambiguate the std::string overload for string literals. There
│ │ │ │ │ -is an object in the libtorrent namespace of this type called from_span.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ~~ttoorrrreenntt__iinnffoo(()) **********
│ │ │ │ │ -~~ttoorrrreenntt__iinnffoo ();
│ │ │ │ │ -frees all storage associated with this _t_o_r_r_e_n_t___i_n_f_o object
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiilleess(()) oorriigg__ffiilleess(()) **********
│ │ │ │ │ -file_storage const& ffiilleess () const;
│ │ │ │ │ -file_storage const& oorriigg__ffiilleess () const;
│ │ │ │ │ -The _f_i_l_e___s_t_o_r_a_g_e object contains the information on how to map the pieces to
│ │ │ │ │ -files. It is separated from the _t_o_r_r_e_n_t___i_n_f_o object because when creating
│ │ │ │ │ -torrents a storage object needs to be created without having a torrent file.
│ │ │ │ │ -When renaming files in a storage, the storage needs to make its own copy of the
│ │ │ │ │ -_f_i_l_e___s_t_o_r_a_g_e in order to make its mapping differ from the one in the torrent
│ │ │ │ │ -file.
│ │ │ │ │ -orig_files() returns the original (unmodified) file storage for this torrent.
│ │ │ │ │ -This is used by the web server connection, which needs to request files with
│ │ │ │ │ -the original names. Filename may be changed using torrent_info::rename_file().
│ │ │ │ │ -For more information on the _f_i_l_e___s_t_o_r_a_g_e object, see the separate document on
│ │ │ │ │ -how to create torrents.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreennaammee__ffiillee(()) **********
│ │ │ │ │ -void rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
│ │ │ │ │ -Renames the file with the specified index to the new name. The new filename is
│ │ │ │ │ -reflected by the file_storage returned by files() but not by the one returned
│ │ │ │ │ -by orig_files().
│ │ │ │ │ -If you want to rename the base name of the torrent (for a multi file torrent),
│ │ │ │ │ -you can copy the file_storage (see _f_i_l_e_s_(_) and _o_r_i_g___f_i_l_e_s_(_) ), change the name,
│ │ │ │ │ -and then use _r_e_m_a_p___f_i_l_e_s_(_).
│ │ │ │ │ -The new_filename can both be a relative path, in which case the file name is
│ │ │ │ │ -relative to the save_path of the torrent. If the new_filename is an absolute
│ │ │ │ │ -path (i.e. is_complete(new_filename) == true), then the file is detached from
│ │ │ │ │ -the save_path of the torrent. In this case the file is not moved when
│ │ │ │ │ -_m_o_v_e___s_t_o_r_a_g_e_(_) is invoked.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreemmaapp__ffiilleess(()) **********
│ │ │ │ │ -void rreemmaapp__ffiilleess (file_storage const& f);
│ │ │ │ │ -Warning
│ │ │ │ │ -Usingremap_files()is discouraged as it's incompatible with v2 torrents. This is
│ │ │ │ │ -because the piece boundaries and piece hashes in v2 torrents are intimately
│ │ │ │ │ -tied to the file boundaries. Instead, just rename individual files, or
│ │ │ │ │ -implement a custom _d_i_s_k___i_n_t_e_r_f_a_c_e to customize how to store files.
│ │ │ │ │ -Remaps the file storage to a new file layout. This can be used to, for
│ │ │ │ │ -instance, download all data in a torrent to a single file, or to a number of
│ │ │ │ │ -fixed size sector aligned files, regardless of the number and sizes of the
│ │ │ │ │ -files in the torrent.
│ │ │ │ │ -The new specified file_storage must have the exact same size as the current
│ │ │ │ │ -one.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__ttrraacckkeerr(()) cclleeaarr__ttrraacckkeerrss(()) ttrraacckkeerrss(()) **********
│ │ │ │ │ -void aadddd__ttrraacckkeerr (std::string const& url, int tier
│ │ │ │ │ -      , announce_entry::tracker_source source);
│ │ │ │ │ -void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0);
│ │ │ │ │ -std::vector<announce_entry> const& ttrraacckkeerrss () const;
│ │ │ │ │ -void cclleeaarr__ttrraacckkeerrss ();
│ │ │ │ │ -add_tracker() adds a tracker to the announce-list. The tier determines the
│ │ │ │ │ -order in which the trackers are to be tried. The trackers() function will
│ │ │ │ │ -return a sorted vector of _a_n_n_o_u_n_c_e___e_n_t_r_y. Each announce _e_n_t_r_y contains a
│ │ │ │ │ -string, which is the tracker url, and a tier index. The tier index is the high-
│ │ │ │ │ -level priority. No matter which trackers that works or not, the ones with lower
│ │ │ │ │ -tier will always be tried before the one with higher tier number. For more
│ │ │ │ │ -information, see _a_n_n_o_u_n_c_e___e_n_t_r_y.
│ │ │ │ │ -trackers() returns all entries from announce-list.
│ │ │ │ │ -clear_trackers() removes all trackers from announce-list.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccoolllleeccttiioonnss(()) ssiimmiillaarr__ttoorrrreennttss(()) **********
│ │ │ │ │ -std::vector<sha1_hash> ssiimmiillaarr__ttoorrrreennttss () const;
│ │ │ │ │ -std::vector<std::string> ccoolllleeccttiioonnss () const;
│ │ │ │ │ -These two functions are related to _B_E_P_ _3_8 (mutable torrents). The vectors
│ │ │ │ │ -returned from these correspond to the "similar" and "collections" keys in the
│ │ │ │ │ -.torrent file. Both info-hashes and collections from within the info-dict and
│ │ │ │ │ -from outside of it are included.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__hhttttpp__sseeeedd(()) sseett__wweebb__sseeeeddss(()) aadddd__uurrll__sseeeedd(()) wweebb__sseeeeddss(()) **********
│ │ │ │ │ -void sseett__wweebb__sseeeeddss (std::vector<web_seed_entry> seeds);
│ │ │ │ │ -void aadddd__hhttttpp__sseeeedd (std::string const& url
│ │ │ │ │ -      , std::string const& extern_auth = std::string()
│ │ │ │ │ -      , web_seed_entry::headers_t const& extra_headers = web_seed_entry::
│ │ │ │ │ -headers_t());
│ │ │ │ │ -std::vector<web_seed_entry> const& wweebb__sseeeeddss () const;
│ │ │ │ │ -void aadddd__uurrll__sseeeedd (std::string const& url
│ │ │ │ │ -      , std::string const& ext_auth = std::string()
│ │ │ │ │ -      , web_seed_entry::headers_t const& ext_headers = web_seed_entry::
│ │ │ │ │ -headers_t());
│ │ │ │ │ -web_seeds() returns all url seeds and http seeds in the torrent. Each _e_n_t_r_y is
│ │ │ │ │ -a web_seed_entry and may refer to either a url seed or http seed.
│ │ │ │ │ -add_url_seed() and add_http_seed() adds one url to the list of url/http seeds.
│ │ │ │ │ -set_web_seeds() replaces all web seeds with the ones specified in the seeds
│ │ │ │ │ -vector.
│ │ │ │ │ -The extern_auth argument can be used for other authorization schemes than basic
│ │ │ │ │ -HTTP authorization. If set, it will override any username and password found in
│ │ │ │ │ -the URL itself. The string will be sent as the HTTP authorization header's
│ │ │ │ │ -value (without specifying "Basic").
│ │ │ │ │ -The extra_headers argument defaults to an empty list, but can be used to insert
│ │ │ │ │ -custom HTTP headers in the requests to a specific web seed.
│ │ │ │ │ -See _h_t_t_p_ _s_e_e_d_i_n_g for more information.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttoottaall__ssiizzee(()) **********
│ │ │ │ │ -std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ -total_size() returns the total number of bytes the torrent-file represents.
│ │ │ │ │ -Note that this is the number of pieces times the piece size (modulo the last
│ │ │ │ │ -piece possibly being smaller). With pad files, the total size will be larger
│ │ │ │ │ -than the sum of all (regular) file sizes.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__lleennggtthh(()) nnuumm__ppiieecceess(()) **********
│ │ │ │ │ -int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ -int nnuumm__ppiieecceess () const;
│ │ │ │ │ -piece_length() and num_pieces() returns the number of byte for each piece and
│ │ │ │ │ -the total number of pieces, respectively. The difference between piece_size()
│ │ │ │ │ -and piece_length() is that piece_size() takes the piece index as argument and
│ │ │ │ │ -gives you the exact size of that piece. It will always be the same as
│ │ │ │ │ -piece_length() except in the case of the last piece, which may be smaller.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** bblloocckkss__ppeerr__ppiieeccee(()) **********
│ │ │ │ │ -int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │ -returns the number of blocks there are in the typical piece. There may be fewer
│ │ │ │ │ -in the last piece)
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** llaasstt__ppiieeccee(()) eenndd__ppiieeccee(()) ppiieeccee__rraannggee(()) **********
│ │ │ │ │ -piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │ -piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ -index_range<piece_index_t> ppiieeccee__rraannggee () const;
│ │ │ │ │ -last_piece() returns the index to the last piece in the torrent and end_piece()
│ │ │ │ │ -returns the index to the one-past-end piece in the torrent piece_range()
│ │ │ │ │ -returns an implementation-defined type that can be used as the container in a
│ │ │ │ │ -range-for loop. Where the values are the indices of all pieces in the
│ │ │ │ │ -_f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iinnffoo__hhaasshheess(()) iinnffoo__hhaasshh(()) **********
│ │ │ │ │ -sha1_hash iinnffoo__hhaasshh () const noexcept;
│ │ │ │ │ -info_hash_t const& iinnffoo__hhaasshheess () const;
│ │ │ │ │ -returns the info-hash of the torrent. For BitTorrent v2 support, use
│ │ │ │ │ -info_hashes() to get an object that may hold both a v1 and v2 info-hash
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** vv11(()) vv22(()) **********
│ │ │ │ │ -bool vv22 () const;
│ │ │ │ │ -bool vv11 () const;
│ │ │ │ │ -returns whether this torrent has v1 and/or v2 metadata, respectively. Hybrid
│ │ │ │ │ -torrents have both. These are shortcuts for info_hashes().has_v1() and
│ │ │ │ │ -info_hashes().has_v2() calls.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnuumm__ffiilleess(()) **********
│ │ │ │ │ -int nnuumm__ffiilleess () const;
│ │ │ │ │ -If you need index-access to files you can use the num_files() along with the
│ │ │ │ │ -file_path(), file_size()-family of functions to access files using indices.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** mmaapp__bblloocckk(()) **********
│ │ │ │ │ -std::vector<file_slice> mmaapp__bblloocckk (piece_index_t const piece
│ │ │ │ │ -      , std::int64_t offset, int size) const;
│ │ │ │ │ -This function will map a piece index, a byte offset within that piece and a
│ │ │ │ │ -size (in bytes) into the corresponding files with offsets where that data for
│ │ │ │ │ -that piece is supposed to be stored. See _f_i_l_e___s_l_i_c_e.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** mmaapp__ffiillee(()) **********
│ │ │ │ │ -peer_request mmaapp__ffiillee (file_index_t const file, std::int64_t offset, int size)
│ │ │ │ │ -const;
│ │ │ │ │ -This function will map a range in a specific file into a range in the torrent.
│ │ │ │ │ -The file_offset parameter is the offset in the file, given in bytes, where 0 is
│ │ │ │ │ -the start of the file. See _p_e_e_r___r_e_q_u_e_s_t.
│ │ │ │ │ -The input range is assumed to be valid within the torrent. file_offset + size
│ │ │ │ │ -is not allowed to be greater than the file size. file_index must refer to a
│ │ │ │ │ -valid file, i.e. it cannot be >= num_files().
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ssssll__cceerrtt(()) **********
│ │ │ │ │ -string_view ssssll__cceerrtt () const;
│ │ │ │ │ -Returns the SSL root certificate for the torrent, if it is an SSL torrent.
│ │ │ │ │ -Otherwise returns an empty string. The certificate is the public certificate in
│ │ │ │ │ -x509 format.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iiss__vvaalliidd(()) **********
│ │ │ │ │ -bool iiss__vvaalliidd () const;
│ │ │ │ │ -returns true if this _t_o_r_r_e_n_t___i_n_f_o object has a torrent loaded. This is
│ │ │ │ │ -primarily used to determine if a magnet link has had its metadata resolved yet
│ │ │ │ │ -or not.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** pprriivv(()) **********
│ │ │ │ │ -bool pprriivv () const;
│ │ │ │ │ -returns true if this torrent is private. i.e., the client should not advertise
│ │ │ │ │ -itself on the trackerless network (the Kademlia DHT) for this torrent.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iiss__ii22pp(()) **********
│ │ │ │ │ -bool iiss__ii22pp () const;
│ │ │ │ │ -returns true if this is an i2p torrent. This is determined by whether or not it
│ │ │ │ │ -has a tracker whose URL domain name ends with ".i2p". i2p torrents disable the
│ │ │ │ │ -DHT and local peer discovery as well as talking to peers over anything other
│ │ │ │ │ -than the i2p network.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__ssiizzee(()) **********
│ │ │ │ │ -int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │ -returns the piece size of file with index. This will be the same as
│ │ │ │ │ -_p_i_e_c_e___l_e_n_g_t_h_(_), except for the last piece, which may be shorter.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** hhaasshh__ffoorr__ppiieeccee__ppttrr(()) hhaasshh__ffoorr__ppiieeccee(()) **********
│ │ │ │ │ -sha1_hash hhaasshh__ffoorr__ppiieeccee (piece_index_t index) const;
│ │ │ │ │ -char const* hhaasshh__ffoorr__ppiieeccee__ppttrr (piece_index_t const index) const;
│ │ │ │ │ -hash_for_piece() takes a piece-index and returns the 20-bytes sha1-hash for
│ │ │ │ │ -that piece and info_hash() returns the 20-bytes sha1-hash for the info-section
│ │ │ │ │ -of the torrent file. hash_for_piece_ptr() returns a pointer to the 20 byte sha1
│ │ │ │ │ -digest for the piece. Note that the string is not 0-terminated.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnaammee(()) **********
│ │ │ │ │ -const std::string& nnaammee () const;
│ │ │ │ │ -name() returns the name of the torrent. name contains UTF-8 encoded string.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccrreeaattiioonn__ddaattee(()) **********
│ │ │ │ │ -std::time_t ccrreeaattiioonn__ddaattee () const;
│ │ │ │ │ -creation_date() returns the creation date of the torrent as time_t (_p_o_s_i_x
│ │ │ │ │ -_t_i_m_e). If there's no time stamp in the torrent file, 0 is returned. .. posix
│ │ │ │ │ -time: _h_t_t_p_:_/_/_w_w_w_._o_p_e_n_g_r_o_u_p_._o_r_g_/_o_n_l_i_n_e_p_u_b_s_/_0_0_9_6_9_5_3_9_9_/_f_u_n_c_t_i_o_n_s_/_t_i_m_e_._h_t_m_l
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccrreeaattoorr(()) **********
│ │ │ │ │ -const std::string& ccrreeaattoorr () const;
│ │ │ │ │ -creator() returns the creator string in the torrent. If there is no creator
│ │ │ │ │ -string it will return an empty string.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccoommmmeenntt(()) **********
│ │ │ │ │ -const std::string& ccoommmmeenntt () const;
│ │ │ │ │ -comment() returns the comment associated with the torrent. If there's no
│ │ │ │ │ -comment, it will return an empty string. comment contains UTF-8 encoded string.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnooddeess(()) **********
│ │ │ │ │ -std::vector<std::pair<std::string, int>> const& nnooddeess () const;
│ │ │ │ │ -If this torrent contains any DHT nodes, they are put in this vector in their
│ │ │ │ │ -original form (host name and port number).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__nnooddee(()) **********
│ │ │ │ │ -void aadddd__nnooddee (std::pair<std::string, int> const& node);
│ │ │ │ │ -This is used when creating torrent. Use this to add a known DHT node. It may be
│ │ │ │ │ -used, by the client, to bootstrap into the DHT network.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppaarrssee__iinnffoo__sseeccttiioonn(()) **********
│ │ │ │ │ -bool ppaarrssee__iinnffoo__sseeccttiioonn (bdecode_node const& info, error_code& ec, int
│ │ │ │ │ -max_pieces);
│ │ │ │ │ -populates the _t_o_r_r_e_n_t___i_n_f_o by providing just the info-dict buffer. This is used
│ │ │ │ │ -when loading a torrent from a magnet link for instance, where we only have the
│ │ │ │ │ -info-dict. The _b_d_e_c_o_d_e___n_o_d_e e points to a parsed info-dictionary. ec returns an
│ │ │ │ │ -error code if something fails (typically if the info dictionary is malformed).
│ │ │ │ │ -Themax_piecesparameter allows limiting the amount of memory dedicated to
│ │ │ │ │ -loading the torrent, and fails for torrents that exceed the limit. To load
│ │ │ │ │ -large torrents, this limit may also need to be raised in _s_e_t_t_i_n_g_s___p_a_c_k_:_:
│ │ │ │ │ -_m_a_x___p_i_e_c_e___c_o_u_n_t and in calls to _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iinnffoo(()) **********
│ │ │ │ │ -bdecode_node iinnffoo (char const* key) const;
│ │ │ │ │ -This function looks up keys from the info-dictionary of the loaded torrent
│ │ │ │ │ -file. It can be used to access extension values put in the .torrent file. If
│ │ │ │ │ -the specified key cannot be found, it returns nullptr.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iinnffoo__sseeccttiioonn(()) **********
│ │ │ │ │ -span<char const> iinnffoo__sseeccttiioonn () const;
│ │ │ │ │ -returns a the raw info section of the torrent file. The underlying buffer is
│ │ │ │ │ -still owned by the _t_o_r_r_e_n_t___i_n_f_o object
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__llaayyeerr(()) **********
│ │ │ │ │ -span<char const> ppiieeccee__llaayyeerr (file_index_t) const;
│ │ │ │ │ -return the bytes of the piece layer hashes for the specified file. If the file
│ │ │ │ │ -doesn't have a piece layer, an empty span is returned. The span size is
│ │ │ │ │ -divisible by 32, the size of a SHA-256 hash. If the size of the file is smaller
│ │ │ │ │ -than or equal to the piece size, the files "root hash" is the hash of the file
│ │ │ │ │ -and is not saved separately in the "piece layers" field, but this function
│ │ │ │ │ -still returns the root hash of the file in that case.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffrreeee__ppiieeccee__llaayyeerrss(()) **********
│ │ │ │ │ -void ffrreeee__ppiieeccee__llaayyeerrss ();
│ │ │ │ │ -clears the piece layers from the _t_o_r_r_e_n_t___i_n_f_o. This is done by the _s_e_s_s_i_o_n when
│ │ │ │ │ -a torrent is added, to avoid storing it twice. The piece layer (or other hashes
│ │ │ │ │ -part of the merkle tree) are stored in the internal torrent object.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ hhaasshheerr ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_h_a_s_h_e_r_._h_p_p"
│ │ │ │ │ -this is a SHA-1 hash class.
│ │ │ │ │ -You use it by first instantiating it, then call update() to feed it with data.
│ │ │ │ │ -i.e. you don't have to keep the entire buffer of which you want to create the
│ │ │ │ │ -hash in memory. You can feed the _h_a_s_h_e_r parts of it at a time. When You have
│ │ │ │ │ -fed the _h_a_s_h_e_r with all the data, you call final() and it will return the sha1-
│ │ │ │ │ -hash of the data.
│ │ │ │ │ -The constructor that takes a char const* and an integer will construct the sha1
│ │ │ │ │ -context and feed it the data passed in.
│ │ │ │ │ -If you want to reuse the _h_a_s_h_e_r object once you have created a hash, you have
│ │ │ │ │ -to call reset() to reinitialize it.
│ │ │ │ │ -The built-in software version of sha1-algorithm was implemented by Steve Reid
│ │ │ │ │ -and released as public domain. For more info, see src/sha1.cpp.
│ │ │ │ │ -class hasher
│ │ │ │ │ -{
│ │ │ │ │ -   hhaasshheerr ();
│ │ │ │ │ -   hasher& ooppeerraattoorr== (hasher const&) &;
│ │ │ │ │ -   hhaasshheerr (char const* data, int len);
│ │ │ │ │ -   explicit hhaasshheerr (span<char const> data);
│ │ │ │ │ -   hhaasshheerr (hasher const&);
│ │ │ │ │ -   hasher& uuppddaattee (span<char const> data);
│ │ │ │ │ -   hasher& uuppddaattee (char const* data, int len);
│ │ │ │ │ -   sha1_hash ffiinnaall ();
│ │ │ │ │ -   void rreesseett ();
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr==(()) hhaasshheerr(()) **********
│ │ │ │ │ -hasher& ooppeerraattoorr== (hasher const&) &;
│ │ │ │ │ -hhaasshheerr (char const* data, int len);
│ │ │ │ │ -explicit hhaasshheerr (span<char const> data);
│ │ │ │ │ -hhaasshheerr (hasher const&);
│ │ │ │ │ -this is the same as default constructing followed by a call to update(data,
│ │ │ │ │ -len).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** uuppddaattee(()) **********
│ │ │ │ │ -hasher& uuppddaattee (span<char const> data);
│ │ │ │ │ -hasher& uuppddaattee (char const* data, int len);
│ │ │ │ │ -append the following bytes to what is being hashed
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiinnaall(()) **********
│ │ │ │ │ -sha1_hash ffiinnaall ();
│ │ │ │ │ -returns the SHA-1 digest of the buffers previously passed to _u_p_d_a_t_e_(_) and the
│ │ │ │ │ -_h_a_s_h_e_r constructor.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreesseett(()) **********
│ │ │ │ │ -void rreesseett ();
│ │ │ │ │ -restore the _h_a_s_h_e_r state to be as if the _h_a_s_h_e_r has just been default
│ │ │ │ │ -constructed.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ hhaasshheerr225566 ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_h_a_s_h_e_r_._h_p_p"
│ │ │ │ │ -class hasher256
│ │ │ │ │ -{
│ │ │ │ │ -   hhaasshheerr225566 ();
│ │ │ │ │ -   hhaasshheerr225566 (hasher256 const&);
│ │ │ │ │ -   explicit hhaasshheerr225566 (span<char const> data);
│ │ │ │ │ -   hhaasshheerr225566 (char const* data, int len);
│ │ │ │ │ -   hasher256& ooppeerraattoorr== (hasher256 const&) &;
│ │ │ │ │ -   hasher256& uuppddaattee (span<char const> data);
│ │ │ │ │ -   hasher256& uuppddaattee (char const* data, int len);
│ │ │ │ │ -   sha256_hash ffiinnaall ();
│ │ │ │ │ -   void rreesseett ();
│ │ │ │ │ -   ~~hhaasshheerr225566 ();
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr==(()) hhaasshheerr225566(()) **********
│ │ │ │ │ -hhaasshheerr225566 (hasher256 const&);
│ │ │ │ │ -explicit hhaasshheerr225566 (span<char const> data);
│ │ │ │ │ -hhaasshheerr225566 (char const* data, int len);
│ │ │ │ │ -hasher256& ooppeerraattoorr== (hasher256 const&) &;
│ │ │ │ │ -this is the same as default constructing followed by a call to update(data,
│ │ │ │ │ -len).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** uuppddaattee(()) **********
│ │ │ │ │ -hasher256& uuppddaattee (span<char const> data);
│ │ │ │ │ -hasher256& uuppddaattee (char const* data, int len);
│ │ │ │ │ -append the following bytes to what is being hashed
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiinnaall(()) **********
│ │ │ │ │ -sha256_hash ffiinnaall ();
│ │ │ │ │ -returns the SHA-1 digest of the buffers previously passed to _u_p_d_a_t_e_(_) and the
│ │ │ │ │ -_h_a_s_h_e_r constructor.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreesseett(()) **********
│ │ │ │ │ -void rreesseett ();
│ │ │ │ │ -restore the _h_a_s_h_e_r state to be as if the _h_a_s_h_e_r has just been default
│ │ │ │ │ -constructed.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ bbiittffiieelldd ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_i_t_f_i_e_l_d_._h_p_p"
│ │ │ │ │ -The _b_i_t_f_i_e_l_d type stores any number of bits as a _b_i_t_f_i_e_l_d in a heap allocated
│ │ │ │ │ -array.
│ │ │ │ │ -struct bitfield
│ │ │ │ │ -{
│ │ │ │ │ -   bbiittffiieelldd (int bits, bool val);
│ │ │ │ │ -   bbiittffiieelldd () noexcept = default;
│ │ │ │ │ -   explicit bbiittffiieelldd (int bits);
│ │ │ │ │ -   bbiittffiieelldd (char const* b, int bits);
│ │ │ │ │ -   bbiittffiieelldd (bitfield const& rhs);
│ │ │ │ │ -   bbiittffiieelldd (bitfield&& rhs) noexcept = default;
│ │ │ │ │ -   void aassssiiggnn (char const* b, int const bits);
│ │ │ │ │ -   bool ooppeerraattoorr[[]] (int index) const noexcept;
│ │ │ │ │ -   bool ggeett__bbiitt (int index) const noexcept;
│ │ │ │ │ -   void cclleeaarr__bbiitt (int index) noexcept;
│ │ │ │ │ -   void sseett__bbiitt (int index) noexcept;
│ │ │ │ │ -   bool aallll__sseett () const noexcept;
│ │ │ │ │ -   bool nnoonnee__sseett () const noexcept;
│ │ │ │ │ -   int ssiizzee () const noexcept;
│ │ │ │ │ -   int nnuumm__wwoorrddss () const noexcept;
│ │ │ │ │ -   int nnuumm__bbyytteess () const noexcept;
│ │ │ │ │ -   bool eemmppttyy () const noexcept;
│ │ │ │ │ -   char* ddaattaa () noexcept;
│ │ │ │ │ -   char const* ddaattaa () const noexcept;
│ │ │ │ │ -   void sswwaapp (bitfield& rhs) noexcept;
│ │ │ │ │ -   int ccoouunntt () const noexcept;
│ │ │ │ │ -   int ffiinndd__ffiirrsstt__sseett () const noexcept;
│ │ │ │ │ -   int ffiinndd__llaasstt__cclleeaarr () const noexcept;
│ │ │ │ │ -   bool ooppeerraattoorr==== (lt::bitfield const& rhs) const;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** bbiittffiieelldd(()) **********
│ │ │ │ │ -bbiittffiieelldd (int bits, bool val);
│ │ │ │ │ -bbiittffiieelldd () noexcept = default;
│ │ │ │ │ -explicit bbiittffiieelldd (int bits);
│ │ │ │ │ -bbiittffiieelldd (char const* b, int bits);
│ │ │ │ │ -bbiittffiieelldd (bitfield const& rhs);
│ │ │ │ │ -bbiittffiieelldd (bitfield&& rhs) noexcept = default;
│ │ │ │ │ -constructs a new _b_i_t_f_i_e_l_d. The default constructor creates an empty _b_i_t_f_i_e_l_d.
│ │ │ │ │ -bits is the size of the _b_i_t_f_i_e_l_d (specified in bits). val is the value to
│ │ │ │ │ -initialize the bits to. If not specified all bits are initialized to 0.
│ │ │ │ │ -The constructor taking a pointer b and bits copies a _b_i_t_f_i_e_l_d from the
│ │ │ │ │ -specified buffer, and bits number of bits (rounded up to the nearest byte
│ │ │ │ │ -boundary).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassssiiggnn(()) **********
│ │ │ │ │ -void aassssiiggnn (char const* b, int const bits);
│ │ │ │ │ -copy _b_i_t_f_i_e_l_d from buffer b of bits number of bits, rounded up to the nearest
│ │ │ │ │ -byte boundary.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr[[]](()) ggeett__bbiitt(()) **********
│ │ │ │ │ -bool ooppeerraattoorr[[]] (int index) const noexcept;
│ │ │ │ │ -bool ggeett__bbiitt (int index) const noexcept;
│ │ │ │ │ -query bit at index. Returns true if bit is 1, otherwise false.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** cclleeaarr__bbiitt(()) sseett__bbiitt(()) **********
│ │ │ │ │ -void cclleeaarr__bbiitt (int index) noexcept;
│ │ │ │ │ -void sseett__bbiitt (int index) noexcept;
│ │ │ │ │ -set bit at index to 0 (clear_bit) or 1 (set_bit).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aallll__sseett(()) **********
│ │ │ │ │ -bool aallll__sseett () const noexcept;
│ │ │ │ │ -returns true if all bits in the _b_i_t_f_i_e_l_d are set
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnoonnee__sseett(()) **********
│ │ │ │ │ -bool nnoonnee__sseett () const noexcept;
│ │ │ │ │ -returns true if no bit in the _b_i_t_f_i_e_l_d is set
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ssiizzee(()) **********
│ │ │ │ │ -int ssiizzee () const noexcept;
│ │ │ │ │ -returns the size of the _b_i_t_f_i_e_l_d in bits.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnuumm__wwoorrddss(()) **********
│ │ │ │ │ -int nnuumm__wwoorrddss () const noexcept;
│ │ │ │ │ -returns the number of 32 bit words are needed to represent all bits in this
│ │ │ │ │ -_b_i_t_f_i_e_l_d.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnuumm__bbyytteess(()) **********
│ │ │ │ │ -int nnuumm__bbyytteess () const noexcept;
│ │ │ │ │ -returns the number of bytes needed to represent all bits in this _b_i_t_f_i_e_l_d
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eemmppttyy(()) **********
│ │ │ │ │ -bool eemmppttyy () const noexcept;
│ │ │ │ │ -returns true if the _b_i_t_f_i_e_l_d has zero size.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddaattaa(()) **********
│ │ │ │ │ -char* ddaattaa () noexcept;
│ │ │ │ │ -char const* ddaattaa () const noexcept;
│ │ │ │ │ -returns a pointer to the internal buffer of the _b_i_t_f_i_e_l_d, or nullptr if it's
│ │ │ │ │ -empty.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sswwaapp(()) **********
│ │ │ │ │ -void sswwaapp (bitfield& rhs) noexcept;
│ │ │ │ │ -swaps the bit-fields two variables refer to
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccoouunntt(()) **********
│ │ │ │ │ -int ccoouunntt () const noexcept;
│ │ │ │ │ -count the number of bits in the _b_i_t_f_i_e_l_d that are set to 1.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiinndd__ffiirrsstt__sseett(()) **********
│ │ │ │ │ -int ffiinndd__ffiirrsstt__sseett () const noexcept;
│ │ │ │ │ -returns the index of the first set bit in the _b_i_t_f_i_e_l_d, i.e. 1 bit.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiinndd__llaasstt__cclleeaarr(()) **********
│ │ │ │ │ -int ffiinndd__llaasstt__cclleeaarr () const noexcept;
│ │ │ │ │ -returns the index to the last cleared bit in the _b_i_t_f_i_e_l_d, i.e. 0 bit.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ sseessssiioonn__pprrooxxyy ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n_._h_p_p"
│ │ │ │ │  this is a holder for the internal _s_e_s_s_i_o_n implementation object. Once the
│ │ │ │ │  _s_e_s_s_i_o_n destruction is explicitly initiated, this holder is used to synchronize
│ │ │ │ │  the completion of the shutdown. The lifetime of this object may outlive
│ │ │ │ │  _s_e_s_s_i_o_n, causing the _s_e_s_s_i_o_n destructor to not block. The _s_e_s_s_i_o_n___p_r_o_x_y
│ │ │ │ │  destructor will block however, until the underlying _s_e_s_s_i_o_n is done shutting
│ │ │ │ │  down.
│ │ │ │ │  struct session_proxy
│ │ │ │ │  {
│ │ │ │ │ +   sseessssiioonn__pprrooxxyy ();
│ │ │ │ │     session_proxy& ooppeerraattoorr== (session_proxy const&) &;
│ │ │ │ │ -   sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept;
│ │ │ │ │     ~~sseessssiioonn__pprrooxxyy ();
│ │ │ │ │ -   sseessssiioonn__pprrooxxyy ();
│ │ │ │ │ -   sseessssiioonn__pprrooxxyy (session_proxy const&);
│ │ │ │ │     session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept;
│ │ │ │ │ +   sseessssiioonn__pprrooxxyy (session_proxy const&);
│ │ │ │ │ +   sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ooppeerraattoorr==(()) sseessssiioonn__pprrooxxyy(()) ~~sseessssiioonn__pprrooxxyy(()) **********
│ │ │ │ │ +sseessssiioonn__pprrooxxyy ();
│ │ │ │ │  session_proxy& ooppeerraattoorr== (session_proxy const&) &;
│ │ │ │ │ -sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept;
│ │ │ │ │  ~~sseessssiioonn__pprrooxxyy ();
│ │ │ │ │ -sseessssiioonn__pprrooxxyy ();
│ │ │ │ │ -sseessssiioonn__pprrooxxyy (session_proxy const&);
│ │ │ │ │  session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept;
│ │ │ │ │ +sseessssiioonn__pprrooxxyy (session_proxy const&);
│ │ │ │ │ +sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept;
│ │ │ │ │  default constructor, does not refer to any _s_e_s_s_i_o_n implementation object.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ sseessssiioonn ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n_._h_p_p"
│ │ │ │ │  The _s_e_s_s_i_o_n holds all state that spans multiple torrents. Among other things it
│ │ │ │ │  runs the network loop and manages all torrents. Once it's created, the _s_e_s_s_i_o_n
│ │ │ │ │  object will spawn the main thread that will do all the work. The main thread
│ │ │ │ │ @@ -3241,46 +5997,46 @@
│ │ │ │ │  apply_settings() member function. To change one or more configuration options,
│ │ │ │ │  create a _s_e_t_t_i_n_g_s___p_a_c_k. object and fill it with the settings to be set and pass
│ │ │ │ │  it in to session::apply_settings().
│ │ │ │ │  see _a_p_p_l_y___s_e_t_t_i_n_g_s_(_).
│ │ │ │ │  struct session : session_handle
│ │ │ │ │  {
│ │ │ │ │     sseessssiioonn (session_params const& params, session_flags_t flags);
│ │ │ │ │ -   sseessssiioonn ();
│ │ │ │ │ +   sseessssiioonn (session_params&& params, session_flags_t flags);
│ │ │ │ │     explicit sseessssiioonn (session_params const& params);
│ │ │ │ │     explicit sseessssiioonn (session_params&& params);
│ │ │ │ │ -   sseessssiioonn (session_params&& params, session_flags_t flags);
│ │ │ │ │ -   sseessssiioonn (session_params&& params, io_context& ios);
│ │ │ │ │ +   sseessssiioonn ();
│ │ │ │ │     sseessssiioonn (session_params const& params, io_context& ios);
│ │ │ │ │     sseessssiioonn (session_params&& params, io_context& ios, session_flags_t);
│ │ │ │ │     sseessssiioonn (session_params const& params, io_context& ios, session_flags_t);
│ │ │ │ │ +   sseessssiioonn (session_params&& params, io_context& ios);
│ │ │ │ │     ~~sseessssiioonn ();
│ │ │ │ │     session_proxy aabboorrtt ();
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseessssiioonn(()) **********
│ │ │ │ │  sseessssiioonn (session_params const& params, session_flags_t flags);
│ │ │ │ │ -sseessssiioonn ();
│ │ │ │ │ +sseessssiioonn (session_params&& params, session_flags_t flags);
│ │ │ │ │  explicit sseessssiioonn (session_params const& params);
│ │ │ │ │  explicit sseessssiioonn (session_params&& params);
│ │ │ │ │ -sseessssiioonn (session_params&& params, session_flags_t flags);
│ │ │ │ │ +sseessssiioonn ();
│ │ │ │ │  Constructs the _s_e_s_s_i_o_n objects which acts as the container of torrents. In
│ │ │ │ │  order to avoid a race condition between starting the _s_e_s_s_i_o_n and configuring
│ │ │ │ │  it, you can pass in a _s_e_s_s_i_o_n___p_a_r_a_m_s object. Its settings will take effect
│ │ │ │ │  before the _s_e_s_s_i_o_n starts up.
│ │ │ │ │  The overloads taking flags can be used to start a _s_e_s_s_i_o_n in paused mode (by
│ │ │ │ │  passing in session::paused). Note that add_default_plugins do not have an
│ │ │ │ │  affect on constructors that take a _s_e_s_s_i_o_n___p_a_r_a_m_s object. It already contains
│ │ │ │ │  the plugins to use.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseessssiioonn(()) **********
│ │ │ │ │ -sseessssiioonn (session_params&& params, io_context& ios);
│ │ │ │ │  sseessssiioonn (session_params const& params, io_context& ios);
│ │ │ │ │  sseessssiioonn (session_params&& params, io_context& ios, session_flags_t);
│ │ │ │ │  sseessssiioonn (session_params const& params, io_context& ios, session_flags_t);
│ │ │ │ │ +sseessssiioonn (session_params&& params, io_context& ios);
│ │ │ │ │  Overload of the constructor that takes an external io_context to run the
│ │ │ │ │  _s_e_s_s_i_o_n object on. This is primarily useful for tests that may want to run
│ │ │ │ │  multiple sessions on a single io_context, or low resource systems where
│ │ │ │ │  additional threads are expensive and sharing an io_context with other events is
│ │ │ │ │  fine.
│ │ │ │ │  Warning
│ │ │ │ │  The _s_e_s_s_i_o_n object does not cleanly terminate with an external io_context. The
│ │ │ │ │ @@ -3314,44 +6070,44 @@
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ sseessssiioonn__ppaarraammss ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___p_a_r_a_m_s_._h_p_p"
│ │ │ │ │  The _s_e_s_s_i_o_n___p_a_r_a_m_s is a parameters pack for configuring the _s_e_s_s_i_o_n before it's
│ │ │ │ │  started.
│ │ │ │ │  struct session_params
│ │ │ │ │  {
│ │ │ │ │ -   sseessssiioonn__ppaarraammss (settings_pack const& sp);
│ │ │ │ │ -   sseessssiioonn__ppaarraammss (settings_pack&& sp);
│ │ │ │ │     sseessssiioonn__ppaarraammss ();
│ │ │ │ │ -   sseessssiioonn__ppaarraammss (settings_pack const& sp
│ │ │ │ │ -      , std::vector<std::shared_ptr<plugin>> exts);
│ │ │ │ │ +   sseessssiioonn__ppaarraammss (settings_pack&& sp);
│ │ │ │ │ +   sseessssiioonn__ppaarraammss (settings_pack const& sp);
│ │ │ │ │     sseessssiioonn__ppaarraammss (settings_pack&& sp
│ │ │ │ │        , std::vector<std::shared_ptr<plugin>> exts);
│ │ │ │ │ +   sseessssiioonn__ppaarraammss (settings_pack const& sp
│ │ │ │ │ +      , std::vector<std::shared_ptr<plugin>> exts);
│ │ │ │ │  
│ │ │ │ │     settings_pack settings;
│ │ │ │ │     std::vector<std::shared_ptr<plugin>> extensions;
│ │ │ │ │     dht::dht_state dht_state;
│ │ │ │ │     dht::dht_storage_constructor_type dht_storage_constructor;
│ │ │ │ │     disk_io_constructor_type disk_io_constructor;
│ │ │ │ │     std::map<std::string, std::string> ext_state;
│ │ │ │ │     libtorrent::ip_filter ip_filter;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseessssiioonn__ppaarraammss(()) **********
│ │ │ │ │ -sseessssiioonn__ppaarraammss (settings_pack const& sp);
│ │ │ │ │ -sseessssiioonn__ppaarraammss (settings_pack&& sp);
│ │ │ │ │  sseessssiioonn__ppaarraammss ();
│ │ │ │ │ +sseessssiioonn__ppaarraammss (settings_pack&& sp);
│ │ │ │ │ +sseessssiioonn__ppaarraammss (settings_pack const& sp);
│ │ │ │ │  This constructor can be used to start with the default plugins (ut_metadata,
│ │ │ │ │  ut_pex and smart_ban). Pass a _s_e_t_t_i_n_g_s___p_a_c_k to set the initial settings when
│ │ │ │ │  the _s_e_s_s_i_o_n starts.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseessssiioonn__ppaarraammss(()) **********
│ │ │ │ │ -sseessssiioonn__ppaarraammss (settings_pack const& sp
│ │ │ │ │ -      , std::vector<std::shared_ptr<plugin>> exts);
│ │ │ │ │  sseessssiioonn__ppaarraammss (settings_pack&& sp
│ │ │ │ │        , std::vector<std::shared_ptr<plugin>> exts);
│ │ │ │ │ +sseessssiioonn__ppaarraammss (settings_pack const& sp
│ │ │ │ │ +      , std::vector<std::shared_ptr<plugin>> exts);
│ │ │ │ │  This constructor helps to configure the set of initial plugins to be added to
│ │ │ │ │  the _s_e_s_s_i_o_n before it's started.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    settings
│ │ │ │ │        The settings to configure the _s_e_s_s_i_o_n with
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    extensions
│ │ │ │ │ @@ -3392,25 +6148,25 @@
│ │ │ │ │        , status_flags_t flags = {}) const;
│ │ │ │ │     std::vector<torrent_status> ggeett__ttoorrrreenntt__ssttaattuuss (
│ │ │ │ │        std::function<bool(torrent_status const&)> const& pred
│ │ │ │ │        , status_flags_t flags = {}) const;
│ │ │ │ │     void ppoosstt__ttoorrrreenntt__uuppddaatteess (status_flags_t flags = status_flags_t::all());
│ │ │ │ │     void ppoosstt__sseessssiioonn__ssttaattss ();
│ │ │ │ │     void ppoosstt__ddhhtt__ssttaattss ();
│ │ │ │ │ -   void sseett__ddhhtt__ssttaattee (dht::dht_state&& st);
│ │ │ │ │     void sseett__ddhhtt__ssttaattee (dht::dht_state const& st);
│ │ │ │ │ -   torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const;
│ │ │ │ │ +   void sseett__ddhhtt__ssttaattee (dht::dht_state&& st);
│ │ │ │ │     std::vector<torrent_handle> ggeett__ttoorrrreennttss () const;
│ │ │ │ │ +   torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const;
│ │ │ │ │ +   torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params, error_code& ec);
│ │ │ │ │     torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params, error_code&
│ │ │ │ │  ec);
│ │ │ │ │ -   torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params, error_code& ec);
│ │ │ │ │ -   torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │     void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │ -   torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │ +   torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │     void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │ +   torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │     void rreessuummee ();
│ │ │ │ │     void ppaauussee ();
│ │ │ │ │     bool iiss__ppaauusseedd () const;
│ │ │ │ │     bool iiss__ddhhtt__rruunnnniinngg () const;
│ │ │ │ │     void sseett__ddhhtt__ssttoorraaggee (dht::dht_storage_constructor_type sc);
│ │ │ │ │     void aadddd__ddhhtt__nnooddee (std::pair<std::string, int> const& node);
│ │ │ │ │     void ddhhtt__ggeett__iitteemm (sha1_hash const& target);
│ │ │ │ │ @@ -3425,41 +6181,41 @@
│ │ │ │ │     void ddhhtt__aannnnoouunnccee (sha1_hash const& info_hash, int port = 0, dht::
│ │ │ │ │  announce_flags_t flags = {});
│ │ │ │ │     void ddhhtt__lliivvee__nnooddeess (sha1_hash const& nid);
│ │ │ │ │     void ddhhtt__ssaammppllee__iinnffoohhaasshheess (udp::endpoint const& ep, sha1_hash const&
│ │ │ │ │  target);
│ │ │ │ │     void ddhhtt__ddiirreecctt__rreeqquueesstt (udp::endpoint const& ep, entry const& e,
│ │ │ │ │  client_data_t userdata = {});
│ │ │ │ │ +   void aadddd__eexxtteennssiioonn (std::shared_ptr<plugin> ext);
│ │ │ │ │     void aadddd__eexxtteennssiioonn (std::function<std::shared_ptr<torrent_plugin>(
│ │ │ │ │        torrent_handle const&, client_data_t)> ext);
│ │ │ │ │ -   void aadddd__eexxtteennssiioonn (std::shared_ptr<plugin> ext);
│ │ │ │ │ -   ip_filter ggeett__iipp__ffiilltteerr () const;
│ │ │ │ │     void sseett__iipp__ffiilltteerr (ip_filter f);
│ │ │ │ │ +   ip_filter ggeett__iipp__ffiilltteerr () const;
│ │ │ │ │     void sseett__ppoorrtt__ffiilltteerr (port_filter const& f);
│ │ │ │ │ -   unsigned short lliisstteenn__ppoorrtt () const;
│ │ │ │ │ -   bool iiss__lliisstteenniinngg () const;
│ │ │ │ │     unsigned short ssssll__lliisstteenn__ppoorrtt () const;
│ │ │ │ │ -   void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f);
│ │ │ │ │ +   bool iiss__lliisstteenniinngg () const;
│ │ │ │ │ +   unsigned short lliisstteenn__ppoorrtt () const;
│ │ │ │ │     ip_filter ggeett__ppeeeerr__ccllaassss__ffiilltteerr () const;
│ │ │ │ │ -   void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f);
│ │ │ │ │ +   void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f);
│ │ │ │ │     peer_class_type_filter ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr () const;
│ │ │ │ │ +   void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f);
│ │ │ │ │     peer_class_t ccrreeaattee__ppeeeerr__ccllaassss (char const* name);
│ │ │ │ │     void ddeelleettee__ppeeeerr__ccllaassss (peer_class_t cid);
│ │ │ │ │     void sseett__ppeeeerr__ccllaassss (peer_class_t cid, peer_class_info const& pci);
│ │ │ │ │     peer_class_info ggeett__ppeeeerr__ccllaassss (peer_class_t cid) const;
│ │ │ │ │     void rreemmoovvee__ttoorrrreenntt (const torrent_handle&, remove_flags_t = {});
│ │ │ │ │     void aappppllyy__sseettttiinnggss (settings_pack&&);
│ │ │ │ │ -   settings_pack ggeett__sseettttiinnggss () const;
│ │ │ │ │     void aappppllyy__sseettttiinnggss (settings_pack const&);
│ │ │ │ │ +   settings_pack ggeett__sseettttiinnggss () const;
│ │ │ │ │     void sseett__aalleerrtt__nnoottiiffyy (std::function<void()> const& fun);
│ │ │ │ │     alert* wwaaiitt__ffoorr__aalleerrtt (time_duration max_wait);
│ │ │ │ │     void ppoopp__aalleerrttss (std::vector<alert*>* alerts);
│ │ │ │ │ -   void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle);
│ │ │ │ │     std::vector<port_mapping_t> aadddd__ppoorrtt__mmaappppiinngg (portmap_protocol t, int
│ │ │ │ │  external_port, int local_port);
│ │ │ │ │ +   void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle);
│ │ │ │ │     void rreeooppeenn__nneettwwoorrkk__ssoocckkeettss (reopen_network_flags_t options =
│ │ │ │ │  reopen_map_ports);
│ │ │ │ │     std::shared_ptr<aux::session_impl> nnaattiivvee__hhaannddllee () const;
│ │ │ │ │  
│ │ │ │ │     static constexpr save_state_flags_t ssaavvee__sseettttiinnggss  = 0_bit;
│ │ │ │ │     static constexpr save_state_flags_t ssaavvee__ddhhtt__ssttaattee  = 2_bit;
│ │ │ │ │     static constexpr save_state_flags_t ssaavvee__eexxtteennssiioonn__ssttaattee  = 11_bit;
│ │ │ │ │ @@ -3485,15 +6241,15 @@
│ │ │ │ │  all()) const;
│ │ │ │ │  returns the current _s_e_s_s_i_o_n state. This can be passed to _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)
│ │ │ │ │  to save the state to disk and restored using _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_) when
│ │ │ │ │  constructing a new _s_e_s_s_i_o_n. The kind of state that's included is all settings,
│ │ │ │ │  the DHT routing table, possibly plugin-specific state. the flags parameter can
│ │ │ │ │  be used to only save certain parts of the _s_e_s_s_i_o_n state
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreeffrreesshh__ttoorrrreenntt__ssttaattuuss(()) ggeett__ttoorrrreenntt__ssttaattuuss(()) **********
│ │ │ │ │ +********** ggeett__ttoorrrreenntt__ssttaattuuss(()) rreeffrreesshh__ttoorrrreenntt__ssttaattuuss(()) **********
│ │ │ │ │  void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector<torrent_status>* ret
│ │ │ │ │        , status_flags_t flags = {}) const;
│ │ │ │ │  std::vector<torrent_status> ggeett__ttoorrrreenntt__ssttaattuuss (
│ │ │ │ │        std::function<bool(torrent_status const&)> const& pred
│ │ │ │ │        , status_flags_t flags = {}) const;
│ │ │ │ │  Note
│ │ │ │ │  these calls are potentially expensive and won't scale well with lots of
│ │ │ │ │ @@ -3543,37 +6299,37 @@
│ │ │ │ │  For more information, see the _s_e_s_s_i_o_n_ _s_t_a_t_i_s_t_i_c_s section.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ppoosstt__ddhhtt__ssttaattss(()) **********
│ │ │ │ │  void ppoosstt__ddhhtt__ssttaattss ();
│ │ │ │ │  This will cause a _d_h_t___s_t_a_t_s___a_l_e_r_t to be posted.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseett__ddhhtt__ssttaattee(()) **********
│ │ │ │ │ -void sseett__ddhhtt__ssttaattee (dht::dht_state&& st);
│ │ │ │ │  void sseett__ddhhtt__ssttaattee (dht::dht_state const& st);
│ │ │ │ │ +void sseett__ddhhtt__ssttaattee (dht::dht_state&& st);
│ │ │ │ │  set the DHT state for the _s_e_s_s_i_o_n. This will be taken into account the next
│ │ │ │ │  time the DHT is started, as if it had been passed in via the _s_e_s_s_i_o_n___p_a_r_a_m_s on
│ │ │ │ │  startup.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ffiinndd__ttoorrrreenntt(()) ggeett__ttoorrrreennttss(()) **********
│ │ │ │ │ -torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const;
│ │ │ │ │  std::vector<torrent_handle> ggeett__ttoorrrreennttss () const;
│ │ │ │ │ +torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const;
│ │ │ │ │  find_torrent() looks for a torrent with the given info-hash. In case there is
│ │ │ │ │  such a torrent in the _s_e_s_s_i_o_n, a _t_o_r_r_e_n_t___h_a_n_d_l_e to that torrent is returned. In
│ │ │ │ │  case the torrent cannot be found, an invalid _t_o_r_r_e_n_t___h_a_n_d_l_e is returned.
│ │ │ │ │  See torrent_handle::is_valid() to know if the torrent was found or not.
│ │ │ │ │  get_torrents() returns a vector of torrent_handles to all the torrents
│ │ │ │ │  currently in the _s_e_s_s_i_o_n.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__ttoorrrreenntt(()) aassyynncc__aadddd__ttoorrrreenntt(()) **********
│ │ │ │ │ -torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params, error_code& ec);
│ │ │ │ │ +********** aassyynncc__aadddd__ttoorrrreenntt(()) aadddd__ttoorrrreenntt(()) **********
│ │ │ │ │  torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params, error_code& ec);
│ │ │ │ │ -torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │ +torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params, error_code& ec);
│ │ │ │ │  void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │ -torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │ +torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params);
│ │ │ │ │  void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │ +torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params);
│ │ │ │ │  You add torrents through the _a_d_d___t_o_r_r_e_n_t_(_) function where you give an object
│ │ │ │ │  with all the parameters. The _a_d_d___t_o_r_r_e_n_t_(_) overloads will block until the
│ │ │ │ │  torrent has been added (or failed to be added) and returns an error code and a
│ │ │ │ │  _t_o_r_r_e_n_t___h_a_n_d_l_e. In order to add torrents more efficiently, consider using
│ │ │ │ │  _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_) which returns immediately, without waiting for the torrent
│ │ │ │ │  to add. Notification of the torrent being added is sent as _a_d_d___t_o_r_r_e_n_t___a_l_e_r_t.
│ │ │ │ │  The save_path field in _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s must be set to a valid path where the
│ │ │ │ │ @@ -3594,15 +6350,15 @@
│ │ │ │ │  torrent_flags::paused and torrent_flags::auto_managed. In order to add a magnet
│ │ │ │ │  link that will just download the metadata, but no payload, set the
│ │ │ │ │  torrent_flags::upload_mode flag.
│ │ │ │ │  Special consideration has to be taken when adding hybrid torrents (i.e.
│ │ │ │ │  torrents that are BitTorrent v2 torrents that are backwards compatible with
│ │ │ │ │  v1). For more details, see _B_i_t_T_o_r_r_e_n_t_ _v_2_ _t_o_r_r_e_n_t_s.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iiss__ppaauusseedd(()) rreessuummee(()) ppaauussee(()) **********
│ │ │ │ │ +********** iiss__ppaauusseedd(()) ppaauussee(()) rreessuummee(()) **********
│ │ │ │ │  void rreessuummee ();
│ │ │ │ │  void ppaauussee ();
│ │ │ │ │  bool iiss__ppaauusseedd () const;
│ │ │ │ │  Pausing the _s_e_s_s_i_o_n has the same effect as pausing every torrent in it, except
│ │ │ │ │  that torrents will not be resumed by the auto-manage mechanism. Resuming will
│ │ │ │ │  restore the torrents to their previous paused state. i.e. the _s_e_s_s_i_o_n pause
│ │ │ │ │  state is separate from the torrent pause state. A torrent is inactive if it is
│ │ │ │ │ @@ -3681,15 +6437,15 @@
│ │ │ │ │  and make the function entirely self-contained. The only reason data blob's
│ │ │ │ │  value is computed via a function instead of just passing in the new value is to
│ │ │ │ │  avoid race conditions. If you want to uuppddaattee the value in the DHT, you must
│ │ │ │ │  first retrieve it, then modify it, then write it back. The way the DHT works,
│ │ │ │ │  it is natural to always do a lookup before storing and calling the callback in
│ │ │ │ │  between is convenient.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddhhtt__ggeett__ppeeeerrss(()) ddhhtt__aannnnoouunnccee(()) **********
│ │ │ │ │ +********** ddhhtt__aannnnoouunnccee(()) ddhhtt__ggeett__ppeeeerrss(()) **********
│ │ │ │ │  void ddhhtt__ggeett__ppeeeerrss (sha1_hash const& info_hash);
│ │ │ │ │  void ddhhtt__aannnnoouunnccee (sha1_hash const& info_hash, int port = 0, dht::
│ │ │ │ │  announce_flags_t flags = {});
│ │ │ │ │  dht_get_peers() will issue a DHT get_peer request to the DHT for the specified
│ │ │ │ │  info-hash. The response (the peers) will be posted back in a
│ │ │ │ │  _d_h_t___g_e_t___p_e_e_r_s___r_e_p_l_y___a_l_e_r_t.
│ │ │ │ │  dht_announce() will issue a DHT announce request to the DHT to the specified
│ │ │ │ │ @@ -3724,17 +6480,17 @@
│ │ │ │ │  Send an arbitrary DHT request directly to the specified endpoint. This function
│ │ │ │ │  is intended for use by plugins. When a response is received or the request
│ │ │ │ │  times out, a _d_h_t___d_i_r_e_c_t___r_e_s_p_o_n_s_e___a_l_e_r_t will be posted with the response (if
│ │ │ │ │  any) and the userdata pointer passed in here. Since this _a_l_e_r_t is a response to
│ │ │ │ │  an explicit call, it will always be posted, regardless of the _a_l_e_r_t mask.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aadddd__eexxtteennssiioonn(()) **********
│ │ │ │ │ +void aadddd__eexxtteennssiioonn (std::shared_ptr<plugin> ext);
│ │ │ │ │  void aadddd__eexxtteennssiioonn (std::function<std::shared_ptr<torrent_plugin>(
│ │ │ │ │        torrent_handle const&, client_data_t)> ext);
│ │ │ │ │ -void aadddd__eexxtteennssiioonn (std::shared_ptr<plugin> ext);
│ │ │ │ │  This function adds an extension to this _s_e_s_s_i_o_n. The argument is a function
│ │ │ │ │  object that is called with a torrent_handle and which should return a std::
│ │ │ │ │  shared_ptr<torrent_plugin>. To write custom plugins, see _l_i_b_t_o_r_r_e_n_t_ _p_l_u_g_i_n_s.
│ │ │ │ │  For the typical bittorrent client all of these extensions should be added. The
│ │ │ │ │  main plugins implemented in libtorrent are:
│ │ │ │ │    uTorrent metadata
│ │ │ │ │        Allows peers to download the metadata (.torrent files) from the swarm
│ │ │ │ │ @@ -3750,16 +6506,16 @@
│ │ │ │ │        A _p_l_u_g_i_n that, with a small overhead, can ban peers that sends bad data
│ │ │ │ │        with very high accuracy. Should eliminate most problems on poisoned
│ │ │ │ │        torrents.
│ │ │ │ │  #include <libtorrent/extensions/smart_ban.hpp>
│ │ │ │ │  ses.add_extension(&lt::create_smart_ban_plugin);
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseett__iipp__ffiilltteerr(()) ggeett__iipp__ffiilltteerr(()) **********
│ │ │ │ │ -ip_filter ggeett__iipp__ffiilltteerr () const;
│ │ │ │ │  void sseett__iipp__ffiilltteerr (ip_filter f);
│ │ │ │ │ +ip_filter ggeett__iipp__ffiilltteerr () const;
│ │ │ │ │  Sets a filter that will be used to reject and accept incoming as well as
│ │ │ │ │  outgoing connections based on their originating ip address. The default filter
│ │ │ │ │  will allow connections to any ip address. To build a set of rules for which
│ │ │ │ │  addresses are accepted and not, see _i_p___f_i_l_t_e_r.
│ │ │ │ │  Each time a peer is blocked because of the IP filter, a _p_e_e_r___b_l_o_c_k_e_d___a_l_e_r_t is
│ │ │ │ │  generated. get_ip_filter() Returns the _i_p___f_i_l_t_e_r currently in the _s_e_s_s_i_o_n. See
│ │ │ │ │  _i_p___f_i_l_t_e_r.
│ │ │ │ │ @@ -3767,27 +6523,27 @@
│ │ │ │ │  ********** sseett__ppoorrtt__ffiilltteerr(()) **********
│ │ │ │ │  void sseett__ppoorrtt__ffiilltteerr (port_filter const& f);
│ │ │ │ │  apply _p_o_r_t___f_i_l_t_e_r f to incoming and outgoing peers. a port filter will reject
│ │ │ │ │  making outgoing peer connections to certain remote ports. The main intention is
│ │ │ │ │  to be able to avoid triggering certain anti-virus software by connecting to
│ │ │ │ │  SMTP, FTP ports.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** lliisstteenn__ppoorrtt(()) iiss__lliisstteenniinngg(()) ssssll__lliisstteenn__ppoorrtt(()) **********
│ │ │ │ │ -unsigned short lliisstteenn__ppoorrtt () const;
│ │ │ │ │ -bool iiss__lliisstteenniinngg () const;
│ │ │ │ │ +********** ssssll__lliisstteenn__ppoorrtt(()) iiss__lliisstteenniinngg(()) lliisstteenn__ppoorrtt(()) **********
│ │ │ │ │  unsigned short ssssll__lliisstteenn__ppoorrtt () const;
│ │ │ │ │ +bool iiss__lliisstteenniinngg () const;
│ │ │ │ │ +unsigned short lliisstteenn__ppoorrtt () const;
│ │ │ │ │  is_listening() will tell you whether or not the _s_e_s_s_i_o_n has successfully opened
│ │ │ │ │  a listening port. If it hasn't, this function will return false, and then you
│ │ │ │ │  can set a new _s_e_t_t_i_n_g_s___p_a_c_k_:_:_l_i_s_t_e_n___i_n_t_e_r_f_a_c_e_s to try another interface and
│ │ │ │ │  port to bind to.
│ │ │ │ │  listen_port() returns the port we ended up listening on.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ggeett__ppeeeerr__ccllaassss__ffiilltteerr(()) sseett__ppeeeerr__ccllaassss__ffiilltteerr(()) **********
│ │ │ │ │ -void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f);
│ │ │ │ │  ip_filter ggeett__ppeeeerr__ccllaassss__ffiilltteerr () const;
│ │ │ │ │ +void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f);
│ │ │ │ │  Sets the peer class filter for this _s_e_s_s_i_o_n. All new peer connections will take
│ │ │ │ │  this into account and be added to the peer classes specified by this filter,
│ │ │ │ │  based on the peer's IP address.
│ │ │ │ │  The ip-filter essentially maps an IP -> uint32. Each bit in that 32 bit integer
│ │ │ │ │  represents a peer class. The least significant bit represents class 0, the next
│ │ │ │ │  bit class 1 and so on.
│ │ │ │ │  For more info, see _i_p___f_i_l_t_e_r.
│ │ │ │ │ @@ -3805,16 +6561,16 @@
│ │ │ │ │  removed from a peer as a result of this call, peer classes are only added.
│ │ │ │ │  The peer_class argument cannot be greater than 31. The bitmasks representing
│ │ │ │ │  peer classes in the peer_class_filter are 32 bits.
│ │ │ │ │  The get_peer_class_filter() function returns the current filter.
│ │ │ │ │  For more information, see _p_e_e_r_ _c_l_a_s_s_e_s.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr(()) ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr(()) **********
│ │ │ │ │ -void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f);
│ │ │ │ │  peer_class_type_filter ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr () const;
│ │ │ │ │ +void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f);
│ │ │ │ │  Sets and gets the ppeeeerr ccllaassss ttyyppee ffiilltteerr. This is controls automatic peer class
│ │ │ │ │  assignments to peers based on what kind of socket it is.
│ │ │ │ │  It does not only support assigning peer classes, it also supports removing peer
│ │ │ │ │  classes based on socket type.
│ │ │ │ │  The order of these rules being applied are:
│ │ │ │ │     1. peer-class IP filter
│ │ │ │ │     2. peer-class type filter, removing classes
│ │ │ │ │ @@ -3884,21 +6640,21 @@
│ │ │ │ │  download queue is vacated and every subsequent torrent in the queue has their
│ │ │ │ │  queue positions updated. This can potentially cause a large state_update to be
│ │ │ │ │  posted. When removing all torrents, it is advised to remove them from the back
│ │ │ │ │  of the queue, to minimize the shifting.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aappppllyy__sseettttiinnggss(()) ggeett__sseettttiinnggss(()) **********
│ │ │ │ │  void aappppllyy__sseettttiinnggss (settings_pack&&);
│ │ │ │ │ -settings_pack ggeett__sseettttiinnggss () const;
│ │ │ │ │  void aappppllyy__sseettttiinnggss (settings_pack const&);
│ │ │ │ │ +settings_pack ggeett__sseettttiinnggss () const;
│ │ │ │ │  Applies the settings specified by the _s_e_t_t_i_n_g_s___p_a_c_k s. This is an asynchronous
│ │ │ │ │  operation that will return immediately and actually apply the settings to the
│ │ │ │ │  main thread of libtorrent some time later.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppoopp__aalleerrttss(()) wwaaiitt__ffoorr__aalleerrtt(()) sseett__aalleerrtt__nnoottiiffyy(()) **********
│ │ │ │ │ +********** ppoopp__aalleerrttss(()) sseett__aalleerrtt__nnoottiiffyy(()) wwaaiitt__ffoorr__aalleerrtt(()) **********
│ │ │ │ │  void sseett__aalleerrtt__nnoottiiffyy (std::function<void()> const& fun);
│ │ │ │ │  alert* wwaaiitt__ffoorr__aalleerrtt (time_duration max_wait);
│ │ │ │ │  void ppoopp__aalleerrttss (std::vector<alert*>* alerts);
│ │ │ │ │  Alerts is the main mechanism for libtorrent to report errors and events.
│ │ │ │ │  pop_alerts fills in the vector passed to it with pointers to new alerts. The
│ │ │ │ │  _s_e_s_s_i_o_n still owns these alerts and they will stay valid until the next time
│ │ │ │ │  pop_alerts is called. You may not delete the _a_l_e_r_t objects.
│ │ │ │ │ @@ -3941,17 +6697,17 @@
│ │ │ │ │  block. It should not perform any expensive work. It really should just notify
│ │ │ │ │  the main application thread.
│ │ │ │ │  The type of an _a_l_e_r_t is returned by the polymorphic function alert::type() but
│ │ │ │ │  can also be queries from a concrete type via T::alert_type, as a static
│ │ │ │ │  constant.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** aadddd__ppoorrtt__mmaappppiinngg(()) ddeelleettee__ppoorrtt__mmaappppiinngg(()) **********
│ │ │ │ │ -void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle);
│ │ │ │ │  std::vector<port_mapping_t> aadddd__ppoorrtt__mmaappppiinngg (portmap_protocol t, int
│ │ │ │ │  external_port, int local_port);
│ │ │ │ │ +void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle);
│ │ │ │ │  add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP,
│ │ │ │ │  whichever is enabled. A mapping is created for each listen socket in the
│ │ │ │ │  _s_e_s_s_i_o_n. The return values are all handles referring to the port mappings that
│ │ │ │ │  were just created. Pass them to _d_e_l_e_t_e___p_o_r_t___m_a_p_p_i_n_g_(_) to remove them.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** rreeooppeenn__nneettwwoorrkk__ssoocckkeettss(()) **********
│ │ │ │ │  void rreeooppeenn__nneettwwoorrkk__ssoocckkeettss (reopen_network_flags_t options =
│ │ │ │ │ @@ -3997,15 +6753,15 @@
│ │ │ │ │        protocols used by _a_d_d___p_o_r_t___m_a_p_p_i_n_g_(_)
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    reopen_map_ports
│ │ │ │ │        This option indicates if the ports are mapped using natpmp and upnp. If
│ │ │ │ │        mapping was already made, they are deleted and added again. This only
│ │ │ │ │        works if natpmp and/or upnp are configured to be enable.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ wwrriittee__sseessssiioonn__ppaarraammss__bbuuff(()) rreeaadd__sseessssiioonn__ppaarraammss(()) wwrriittee__sseessssiioonn__ppaarraammss(())
│ │ │ │ │ +************ rreeaadd__sseessssiioonn__ppaarraammss(()) wwrriittee__sseessssiioonn__ppaarraammss__bbuuff(()) wwrriittee__sseessssiioonn__ppaarraammss(())
│ │ │ │ │  ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___p_a_r_a_m_s_._h_p_p"
│ │ │ │ │  session_params rreeaadd__sseessssiioonn__ppaarraammss (span<char const> buf
│ │ │ │ │     , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ │  session_params rreeaadd__sseessssiioonn__ppaarraammss (bdecode_node const& e
│ │ │ │ │     , save_state_flags_t flags = save_state_flags_t::all());
│ │ │ │ │  std::vector<char> wwrriittee__sseessssiioonn__ppaarraammss__bbuuff (session_params const& sp
│ │ │ │ │ @@ -4017,14 +6773,32 @@
│ │ │ │ │  using the state from a previous one (or by programmatically configure the
│ │ │ │ │  _s_e_s_s_i_o_n up-front). The flags parameter can be used to only save and load
│ │ │ │ │  certain aspects of the session's state. The _buf suffix indicates the function
│ │ │ │ │  operates on buffer rather than the bencoded structure. The torrents in a
│ │ │ │ │  _s_e_s_s_i_o_n are not part of the _s_e_s_s_i_o_n___p_a_r_a_m_s state, they have to be restored
│ │ │ │ │  separately.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ccoouunntteerrss ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._h_p_p"
│ │ │ │ │ +struct counters
│ │ │ │ │ +{
│ │ │ │ │ +   ccoouunntteerrss () ;
│ │ │ │ │ +   counters& ooppeerraattoorr== (counters const&) & ;
│ │ │ │ │ +   ccoouunntteerrss (counters const&) ;
│ │ │ │ │ +   std::int64_t iinncc__ssttaattss__ccoouunntteerr (int c, std::int64_t value = 1) ;
│ │ │ │ │ +   std::int64_t ooppeerraattoorr[[]] (int i) const ;
│ │ │ │ │ +   void bblleenndd__ssttaattss__ccoouunntteerr (int c, std::int64_t value, int ratio) ;
│ │ │ │ │ +   void sseett__vvaalluuee (int c, std::int64_t value) ;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ooppeerraattoorr[[]](()) iinncc__ssttaattss__ccoouunntteerr(()) **********
│ │ │ │ │ +std::int64_t iinncc__ssttaattss__ccoouunntteerr (int c, std::int64_t value = 1) ;
│ │ │ │ │ +std::int64_t ooppeerraattoorr[[]] (int i) const ;
│ │ │ │ │ +returns the new value
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ssttaattss__mmeettrriicc ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___s_t_a_t_s_._h_p_p"
│ │ │ │ │  describes one statistics metric from the _s_e_s_s_i_o_n. For more information, see the
│ │ │ │ │  _s_e_s_s_i_o_n_ _s_t_a_t_i_s_t_i_c_s section.
│ │ │ │ │  struct stats_metric
│ │ │ │ │  {
│ │ │ │ │     char const* name;
│ │ │ │ │ @@ -4036,32 +6810,14 @@
│ │ │ │ │        the name of the counter or gauge
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    value_index type
│ │ │ │ │        the index into the _s_e_s_s_i_o_n stats array, where the underlying value of
│ │ │ │ │        this counter or gauge is found. The _s_e_s_s_i_o_n stats array is part of the
│ │ │ │ │        _s_e_s_s_i_o_n___s_t_a_t_s___a_l_e_r_t object.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ccoouunntteerrss ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._h_p_p"
│ │ │ │ │ -struct counters
│ │ │ │ │ -{
│ │ │ │ │ -   ccoouunntteerrss () ;
│ │ │ │ │ -   ccoouunntteerrss (counters const&) ;
│ │ │ │ │ -   counters& ooppeerraattoorr== (counters const&) & ;
│ │ │ │ │ -   std::int64_t iinncc__ssttaattss__ccoouunntteerr (int c, std::int64_t value = 1) ;
│ │ │ │ │ -   std::int64_t ooppeerraattoorr[[]] (int i) const ;
│ │ │ │ │ -   void bblleenndd__ssttaattss__ccoouunntteerr (int c, std::int64_t value, int ratio) ;
│ │ │ │ │ -   void sseett__vvaalluuee (int c, std::int64_t value) ;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr[[]](()) iinncc__ssttaattss__ccoouunntteerr(()) **********
│ │ │ │ │ -std::int64_t iinncc__ssttaattss__ccoouunntteerr (int c, std::int64_t value = 1) ;
│ │ │ │ │ -std::int64_t ooppeerraattoorr[[]] (int i) const ;
│ │ │ │ │ -returns the new value
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ sseessssiioonn__ssttaattss__mmeettrriiccss(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___s_t_a_t_s_._h_p_p"
│ │ │ │ │  std::vector<stats_metric> sseessssiioonn__ssttaattss__mmeettrriiccss ();
│ │ │ │ │  This free function returns the list of available metrics exposed by
│ │ │ │ │  libtorrent's statistics API. Each metric has a name and a vvaalluuee iinnddeexx. The
│ │ │ │ │  value index is the index into the array in _s_e_s_s_i_o_n___s_t_a_t_s___a_l_e_r_t where this
│ │ │ │ │  metric's value can be found when the _s_e_s_s_i_o_n stats is sampled (by calling
│ │ │ │ │ @@ -4077,407 +6833,14 @@
│ │ │ │ │  ************ eennuumm mmeettrriicc__ttyyppee__tt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___s_t_a_t_s_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │  |_c_o_u_n_t_e_r_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_g_a_u_g_e_ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ iipp__ffiilltteerr ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_p___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ -The ip_filter class is a set of rules that uniquely categorizes all ip
│ │ │ │ │ -addresses as allowed or disallowed. The default constructor creates a single
│ │ │ │ │ -rule that allows all addresses (0.0.0.0 - 255.255.255.255 for the IPv4 range,
│ │ │ │ │ -and the equivalent range covering all addresses for the IPv6 range).
│ │ │ │ │ -A default constructed _i_p___f_i_l_t_e_r does not filter any address.
│ │ │ │ │ -struct ip_filter
│ │ │ │ │ -{
│ │ │ │ │ -   iipp__ffiilltteerr ();
│ │ │ │ │ -   iipp__ffiilltteerr (ip_filter&&);
│ │ │ │ │ -   iipp__ffiilltteerr (ip_filter const&);
│ │ │ │ │ -   ~~iipp__ffiilltteerr ();
│ │ │ │ │ -   ip_filter& ooppeerraattoorr== (ip_filter const&);
│ │ │ │ │ -   ip_filter& ooppeerraattoorr== (ip_filter&&);
│ │ │ │ │ -   bool eemmppttyy () const;
│ │ │ │ │ -   void aadddd__rruullee (address const& first, address const& last, std::uint32_t
│ │ │ │ │ -flags);
│ │ │ │ │ -   std::uint32_t aacccceessss (address const& addr) const;
│ │ │ │ │ -   filter_tuple_t eexxppoorrtt__ffiilltteerr () const;
│ │ │ │ │ -
│ │ │ │ │ -   enum access_flags
│ │ │ │ │ -   {
│ │ │ │ │ -      blocked,
│ │ │ │ │ -   };
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eemmppttyy(()) **********
│ │ │ │ │ -bool eemmppttyy () const;
│ │ │ │ │ -returns true if the filter does not contain any rules
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__rruullee(()) **********
│ │ │ │ │ -void aadddd__rruullee (address const& first, address const& last, std::uint32_t flags);
│ │ │ │ │ -Adds a rule to the filter. first and last defines a range of ip addresses that
│ │ │ │ │ -will be marked with the given flags. The flags can currently be 0, which means
│ │ │ │ │ -allowed, or ip_filter::blocked, which means disallowed.
│ │ │ │ │ -precondition: first.is_v4() == last.is_v4() && first.is_v6() == last.is_v6()
│ │ │ │ │ -postcondition: access(x) == flags for every x in the range [first, last]
│ │ │ │ │ -This means that in a case of overlapping ranges, the last one applied takes
│ │ │ │ │ -precedence.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aacccceessss(()) **********
│ │ │ │ │ -std::uint32_t aacccceessss (address const& addr) const;
│ │ │ │ │ -Returns the access permissions for the given address (addr). The permission can
│ │ │ │ │ -currently be 0 or ip_filter::blocked. The complexity of this operation is O(log
│ │ │ │ │ -n), where n is the minimum number of non-overlapping ranges to describe the
│ │ │ │ │ -current filter.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eexxppoorrtt__ffiilltteerr(()) **********
│ │ │ │ │ -filter_tuple_t eexxppoorrtt__ffiilltteerr () const;
│ │ │ │ │ -This function will return the current state of the filter in the minimum number
│ │ │ │ │ -of ranges possible. They are sorted from ranges in low addresses to high
│ │ │ │ │ -addresses. Each _e_n_t_r_y in the returned vector is a range with the access control
│ │ │ │ │ -specified in its flags field.
│ │ │ │ │ -The return value is a tuple containing two range-lists. One for IPv4 addresses
│ │ │ │ │ -and one for IPv6 addresses.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm aacccceessss__ffllaaggss **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_p___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|blocked|1    |indicates that IPs in this range should not be connected to nor|
│ │ │ │ │ -|_ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_c_c_e_p_t_e_d_ _a_s_ _i_n_c_o_m_i_n_g_ _c_o_n_n_e_c_t_i_o_n_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppoorrtt__ffiilltteerr ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_p___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ -the port filter maps non-overlapping port ranges to flags. This is primarily
│ │ │ │ │ -used to indicate whether a range of ports should be connected to or not. The
│ │ │ │ │ -default is to have the full port range (0-65535) set to flag 0.
│ │ │ │ │ -class port_filter
│ │ │ │ │ -{
│ │ │ │ │ -   ~~ppoorrtt__ffiilltteerr ();
│ │ │ │ │ -   port_filter& ooppeerraattoorr== (port_filter const&);
│ │ │ │ │ -   ppoorrtt__ffiilltteerr (port_filter const&);
│ │ │ │ │ -   ppoorrtt__ffiilltteerr ();
│ │ │ │ │ -   port_filter& ooppeerraattoorr== (port_filter&&);
│ │ │ │ │ -   ppoorrtt__ffiilltteerr (port_filter&&);
│ │ │ │ │ -   void aadddd__rruullee (std::uint16_t first, std::uint16_t last, std::uint32_t
│ │ │ │ │ -flags);
│ │ │ │ │ -   std::uint32_t aacccceessss (std::uint16_t port) const;
│ │ │ │ │ -
│ │ │ │ │ -   enum access_flags
│ │ │ │ │ -   {
│ │ │ │ │ -      blocked,
│ │ │ │ │ -   };
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__rruullee(()) **********
│ │ │ │ │ -void aadddd__rruullee (std::uint16_t first, std::uint16_t last, std::uint32_t flags);
│ │ │ │ │ -set the flags for the specified port range (first, last) to flags overwriting
│ │ │ │ │ -any existing rule for those ports. The range is inclusive, i.e. the port last
│ │ │ │ │ -also has the flag set on it.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aacccceessss(()) **********
│ │ │ │ │ -std::uint32_t aacccceessss (std::uint16_t port) const;
│ │ │ │ │ -test the specified port (port) for whether it is blocked or not. The returned
│ │ │ │ │ -value is the flags set for this port. see _a_c_c_e_s_s___f_l_a_g_s.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm aacccceessss__ffllaaggss **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_p___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|blocked|1    |this flag indicates that destination ports in the range should|
│ │ │ │ │ -|_ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_o_t_ _b_e_ _c_o_n_n_e_c_t_e_d_ _t_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ cclliieenntt__ddaattaa__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_l_i_e_n_t___d_a_t_a_._h_p_p"
│ │ │ │ │ -A thin wrapper around a void pointer used as "user data". i.e. an opaque cookie
│ │ │ │ │ -passed in to libtorrent and returned on demand. It adds type-safety by
│ │ │ │ │ -requiring the same type be requested out of it as was assigned to it.
│ │ │ │ │ -struct client_data_t
│ │ │ │ │ -{
│ │ │ │ │ -   cclliieenntt__ddaattaa__tt () = default;
│ │ │ │ │ -   explicit cclliieenntt__ddaattaa__tt (T* v);
│ │ │ │ │ -   client_data_t& ooppeerraattoorr== (T* v);
│ │ │ │ │ -   explicit operator TT () const;
│ │ │ │ │ -   T* ggeett () const;
│ │ │ │ │ -   client_data_t& ooppeerraattoorr== (void const*) = delete;
│ │ │ │ │ -   client_data_t& ooppeerraattoorr== (void*) = delete;
│ │ │ │ │ -   operator vvooiidd** () const = delete;
│ │ │ │ │ -   operator void ccoonnsstt** () const = delete;
│ │ │ │ │ -
│ │ │ │ │ -   template <typename T, typename UU  = typename std::enable_if<std::
│ │ │ │ │ -is_pointer<T>::value>::type>
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** cclliieenntt__ddaattaa__tt(()) **********
│ │ │ │ │ -cclliieenntt__ddaattaa__tt () = default;
│ │ │ │ │ -construct a nullptr client data
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccoonnsstt**(()) vvooiidd**(()) ooppeerraattoorr==(()) **********
│ │ │ │ │ -client_data_t& ooppeerraattoorr== (void const*) = delete;
│ │ │ │ │ -client_data_t& ooppeerraattoorr== (void*) = delete;
│ │ │ │ │ -operator vvooiidd** () const = delete;
│ │ │ │ │ -operator void ccoonnsstt** () const = delete;
│ │ │ │ │ -we don't allow type-unsafe operations
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ aadddd__ttoorrrreenntt__ppaarraammss ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_._h_p_p"
│ │ │ │ │ -The _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s contains all the information in a .torrent file along
│ │ │ │ │ -with all information necessary to add that torrent to a _s_e_s_s_i_o_n. The key fields
│ │ │ │ │ -when adding a torrent are:
│ │ │ │ │ -    * ti - the immutable info-dict part of the torrent
│ │ │ │ │ -    * info_hash - when you don't have the metadata (.torrent file). This
│ │ │ │ │ -      uniquely identifies the torrent and can validate the info-dict when
│ │ │ │ │ -      received from the swarm.
│ │ │ │ │ -In order to add a torrent to a _s_e_s_s_i_o_n, one of those fields must be set in
│ │ │ │ │ -addition to save_path. The _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object can then be passed into
│ │ │ │ │ -one of the session::add_torrent() overloads or session::async_add_torrent().
│ │ │ │ │ -If you only specify the info-hash, the torrent file will be downloaded from
│ │ │ │ │ -peers, which requires them to support the metadata extension. For the metadata
│ │ │ │ │ -extension to work, libtorrent must be built with extensions enabled
│ │ │ │ │ -(TORRENT_DISABLE_EXTENSIONS must not be defined). It also takes an optional
│ │ │ │ │ -name argument. This may be left empty in case no name should be assigned to the
│ │ │ │ │ -torrent. In case it's not, the name is used for the torrent as long as it
│ │ │ │ │ -doesn't have metadata. See torrent_handle::name.
│ │ │ │ │ -The add_torrent_params is also used when requesting resume data for a torrent.
│ │ │ │ │ -It can be saved to and restored from a file and added back to a new _s_e_s_s_i_o_n.
│ │ │ │ │ -For serialization and de-serialization of add_torrent_params objects, see
│ │ │ │ │ -_r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) and _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_).
│ │ │ │ │ -The add_torrent_params is also used to represent a parsed .torrent file. It can
│ │ │ │ │ -be loaded via _l_o_a_d___t_o_r_r_e_n_t___f_i_l_e_(_), _l_o_a_d___t_o_r_r_e_n_t___b_u_f_f_e_r_(_) and
│ │ │ │ │ -_l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_). It can be saved via _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_).
│ │ │ │ │ -struct add_torrent_params
│ │ │ │ │ -{
│ │ │ │ │ -   int vveerrssiioonn  = LIBTORRENT_VERSION_NUM;
│ │ │ │ │ -   std::shared_ptr<torrent_info> ti;
│ │ │ │ │ -   aux::noexcept_movable<std::vector<std::string>> trackers;
│ │ │ │ │ -   aux::noexcept_movable<std::vector<int>> tracker_tiers;
│ │ │ │ │ -   aux::noexcept_movable<std::vector<std::pair<std::string, int>>> dht_nodes;
│ │ │ │ │ -   std::string name;
│ │ │ │ │ -   std::string save_path;
│ │ │ │ │ -   storage_mode_t ssttoorraaggee__mmooddee  = storage_mode_sparse;
│ │ │ │ │ -   client_data_t userdata;
│ │ │ │ │ -   aux::noexcept_movable<std::vector<download_priority_t>> file_priorities;
│ │ │ │ │ -   std::string trackerid;
│ │ │ │ │ -   torrent_flags_t ffllaaggss  = torrent_flags::default_flags;
│ │ │ │ │ -   info_hash_t info_hashes;
│ │ │ │ │ -   int mmaaxx__uuppllooaaddss  = -1;
│ │ │ │ │ -   int mmaaxx__ccoonnnneeccttiioonnss  = -1;
│ │ │ │ │ -   int uuppllooaadd__lliimmiitt  = -1;
│ │ │ │ │ -   int ddoowwnnllooaadd__lliimmiitt  = -1;
│ │ │ │ │ -   std::int64_t ttoottaall__uuppllooaaddeedd  = 0;
│ │ │ │ │ -   std::int64_t ttoottaall__ddoowwnnllooaaddeedd  = 0;
│ │ │ │ │ -   int aaccttiivvee__ttiimmee  = 0;
│ │ │ │ │ -   int ffiinniisshheedd__ttiimmee  = 0;
│ │ │ │ │ -   int sseeeeddiinngg__ttiimmee  = 0;
│ │ │ │ │ -   std::time_t aaddddeedd__ttiimmee  = 0;
│ │ │ │ │ -   std::time_t ccoommpplleetteedd__ttiimmee  = 0;
│ │ │ │ │ -   std::time_t llaasstt__sseeeenn__ccoommpplleettee  = 0;
│ │ │ │ │ -   int nnuumm__ccoommpplleettee  = -1;
│ │ │ │ │ -   int nnuumm__iinnccoommpplleettee  = -1;
│ │ │ │ │ -   int nnuumm__ddoowwnnllooaaddeedd  = -1;
│ │ │ │ │ -   aux::noexcept_movable<std::vector<std::string>> http_seeds;
│ │ │ │ │ -   aux::noexcept_movable<std::vector<std::string>> url_seeds;
│ │ │ │ │ -   aux::noexcept_movable<std::vector<tcp::endpoint>> peers;
│ │ │ │ │ -   aux::noexcept_movable<std::vector<tcp::endpoint>> banned_peers;
│ │ │ │ │ -   aux::noexcept_movable<std::map<piece_index_t, bitfield>> unfinished_pieces;
│ │ │ │ │ -   typed_bitfield<piece_index_t> have_pieces;
│ │ │ │ │ -   typed_bitfield<piece_index_t> verified_pieces;
│ │ │ │ │ -   aux::noexcept_movable<std::vector<download_priority_t>> piece_priorities;
│ │ │ │ │ -   aux::vector<std::vector<sha256_hash>, file_index_t> merkle_trees;
│ │ │ │ │ -   aux::vector<std::vector<bool>, file_index_t> merkle_tree_mask;
│ │ │ │ │ -   aux::vector<std::vector<bool>, file_index_t> verified_leaf_hashes;
│ │ │ │ │ -   aux::noexcept_movable<std::map<file_index_t, std::string>> renamed_files;
│ │ │ │ │ -   std::time_t llaasstt__ddoowwnnllooaadd  = 0;
│ │ │ │ │ -   std::time_t llaasstt__uuppllooaadd  = 0;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  version
│ │ │ │ │ -      filled in by the constructor and should be left untouched. It is used for
│ │ │ │ │ -      forward binary compatibility.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  ti
│ │ │ │ │ -      _t_o_r_r_e_n_t___i_n_f_o object with the torrent to add. Unless the info_hash is set,
│ │ │ │ │ -      this is required to be initialized.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  trackers
│ │ │ │ │ -      If the torrent doesn't have a tracker, but relies on the DHT to find
│ │ │ │ │ -      peers, the trackers can specify tracker URLs for the torrent.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  tracker_tiers
│ │ │ │ │ -      the tiers the URLs in trackers belong to. Trackers belonging to different
│ │ │ │ │ -      tiers may be treated differently, as defined by the multi tracker
│ │ │ │ │ -      extension. This is optional, if not specified trackers are assumed to be
│ │ │ │ │ -      part of tier 0, or whichever the last tier was as iterating over the
│ │ │ │ │ -      trackers.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  dht_nodes
│ │ │ │ │ -      a list of hostname and port pairs, representing DHT nodes to be added to
│ │ │ │ │ -      the _s_e_s_s_i_o_n (if DHT is enabled). The hostname may be an IP address.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  name
│ │ │ │ │ -      in case there's no other name in this torrent, this name will be used.
│ │ │ │ │ -      The name out of the _t_o_r_r_e_n_t___i_n_f_o object takes precedence if available.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  save_path
│ │ │ │ │ -      the path where the torrent is or will be stored.
│ │ │ │ │ -      Note
│ │ │ │ │ -      On windows this path (and other paths) are interpreted as UNC paths. This
│ │ │ │ │ -      means they must use backslashes as directory separators and may not
│ │ │ │ │ -      contain the special directories "." or "..".
│ │ │ │ │ -      Setting this to an absolute path performs slightly better than a relative
│ │ │ │ │ -      path.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  storage_mode
│ │ │ │ │ -      One of the values from _s_t_o_r_a_g_e___m_o_d_e___t. For more information, see _s_t_o_r_a_g_e
│ │ │ │ │ -      _a_l_l_o_c_a_t_i_o_n.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  userdata
│ │ │ │ │ -      The userdata parameter is optional and will be passed on to the extension
│ │ │ │ │ -      constructor functions, if any (see _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_)). It
│ │ │ │ │ -      will also be stored in the torrent object and can be retrieved by calling
│ │ │ │ │ -      _u_s_e_r_d_a_t_a_(_).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  file_priorities
│ │ │ │ │ -      can be set to control the initial file priorities when adding a torrent.
│ │ │ │ │ -      The semantics are the same as for torrent_handle::prioritize_files(). The
│ │ │ │ │ -      file priorities specified in here take precedence over those specified in
│ │ │ │ │ -      the resume data, if any. If this vector of file priorities is shorter
│ │ │ │ │ -      than the number of files in the torrent, the remaining files (not covered
│ │ │ │ │ -      by this) will still have the default download priority. This default can
│ │ │ │ │ -      be changed by setting the default_dont_download torrent_flag.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  trackerid
│ │ │ │ │ -      the default tracker id to be used when announcing to trackers. By default
│ │ │ │ │ -      this is empty, and no tracker ID is used, since this is an optional
│ │ │ │ │ -      argument. If a tracker returns a tracker ID, that ID is used instead of
│ │ │ │ │ -      this.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  flags
│ │ │ │ │ -      flags controlling aspects of this torrent and how it's added. See
│ │ │ │ │ -      _t_o_r_r_e_n_t___f_l_a_g_s___t for details.
│ │ │ │ │ -      Note
│ │ │ │ │ -      The flags field is initialized with default flags by the constructor. In
│ │ │ │ │ -      order to preserve default behavior when clearing or setting other flags,
│ │ │ │ │ -      make sure to bitwise OR or in a flag or bitwise AND the inverse of a flag
│ │ │ │ │ -      to clear it.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  info_hashes
│ │ │ │ │ -      set this to the info hash of the torrent to add in case the info-hash is
│ │ │ │ │ -      the only known property of the torrent. i.e. you don't have a .torrent
│ │ │ │ │ -      file nor a magnet link. To add a magnet link, use _p_a_r_s_e___m_a_g_n_e_t___u_r_i_(_) to
│ │ │ │ │ -      populate fields in the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  max_uploads max_connections
│ │ │ │ │ -      max_uploads, max_connections, upload_limit, download_limit correspond to
│ │ │ │ │ -      the set_max_uploads(), set_max_connections(), set_upload_limit() and
│ │ │ │ │ -      set_download_limit() functions on _t_o_r_r_e_n_t___h_a_n_d_l_e. These values let you
│ │ │ │ │ -      initialize these settings when the torrent is added, instead of calling
│ │ │ │ │ -      these functions immediately following adding it.
│ │ │ │ │ -      -1 means unlimited on these settings just like their counterpart
│ │ │ │ │ -      functions on _t_o_r_r_e_n_t___h_a_n_d_l_e
│ │ │ │ │ -      For fine grained control over rate limits, including making them apply to
│ │ │ │ │ -      local peers, see _p_e_e_r_ _c_l_a_s_s_e_s.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  upload_limit download_limit
│ │ │ │ │ -      the upload and download rate limits for this torrent, specified in bytes
│ │ │ │ │ -      per second. -1 means unlimited.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  total_uploaded total_downloaded
│ │ │ │ │ -      the total number of bytes uploaded and downloaded by this torrent so far.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  active_time finished_time seeding_time
│ │ │ │ │ -      the number of seconds this torrent has spent in started, finished and
│ │ │ │ │ -      seeding state so far, respectively.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  added_time completed_time
│ │ │ │ │ -      if set to a non-zero value, this is the posix time of when this torrent
│ │ │ │ │ -      was first added, including previous runs/sessions. If set to zero, the
│ │ │ │ │ -      internal added_time will be set to the time of when _a_d_d___t_o_r_r_e_n_t_(_) is
│ │ │ │ │ -      called.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  last_seen_complete
│ │ │ │ │ -      if set to non-zero, initializes the time (expressed in posix time) when
│ │ │ │ │ -      we last saw a seed or peers that together formed a complete copy of the
│ │ │ │ │ -      torrent. If left set to zero, the internal counterpart to this field will
│ │ │ │ │ -      be updated when we see a seed or a distributed copies >= 1.0.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  num_complete num_incomplete num_downloaded
│ │ │ │ │ -      these field can be used to initialize the torrent's cached scrape data.
│ │ │ │ │ -      The scrape data is high level metadata about the current state of the
│ │ │ │ │ -      swarm, as returned by the tracker (either when announcing to it or by
│ │ │ │ │ -      sending a specific scrape request). num_complete is the number of peers
│ │ │ │ │ -      in the swarm that are seeds, or have every piece in the torrent.
│ │ │ │ │ -      num_incomplete is the number of peers in the swarm that do not have every
│ │ │ │ │ -      piece. num_downloaded is the number of times the torrent has been
│ │ │ │ │ -      downloaded (not initiated, but the number of times a download has
│ │ │ │ │ -      completed).
│ │ │ │ │ -      Leaving any of these values set to -1 indicates we don't know, or we have
│ │ │ │ │ -      not received any scrape data.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  http_seeds url_seeds
│ │ │ │ │ -      URLs can be added to these two lists to specify additional web seeds to
│ │ │ │ │ -      be used by the torrent. If the flag_override_web_seeds is set, these will
│ │ │ │ │ -      be the _only_ ones to be used. i.e. any web seeds found in the .torrent
│ │ │ │ │ -      file will be overridden.
│ │ │ │ │ -      http_seeds expects URLs to web servers implementing the original HTTP
│ │ │ │ │ -      seed specification _B_E_P_ _1_7.
│ │ │ │ │ -      url_seeds expects URLs to regular web servers, aka "get right" style,
│ │ │ │ │ -      specified in _B_E_P_ _1_9.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  peers
│ │ │ │ │ -      peers to add to the torrent, to be tried to be connected to as bittorrent
│ │ │ │ │ -      peers.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  banned_peers
│ │ │ │ │ -      peers banned from this torrent. The will not be connected to
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  unfinished_pieces
│ │ │ │ │ -      this is a map of partially downloaded piece. The key is the piece index
│ │ │ │ │ -      and the value is a _b_i_t_f_i_e_l_d where each bit represents a 16 kiB block. A
│ │ │ │ │ -      set bit means we have that block.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  have_pieces
│ │ │ │ │ -      this is a _b_i_t_f_i_e_l_d indicating which pieces we already have of this
│ │ │ │ │ -      torrent.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  verified_pieces
│ │ │ │ │ -      when in seed_mode, pieces with a set bit in this _b_i_t_f_i_e_l_d have been
│ │ │ │ │ -      verified to be valid. Other pieces will be verified the first time a peer
│ │ │ │ │ -      requests it.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  piece_priorities
│ │ │ │ │ -      this sets the priorities for each individual piece in the torrent. Each
│ │ │ │ │ -      element in the vector represent the piece with the same index. If you set
│ │ │ │ │ -      both file- and piece priorities, file priorities will take precedence.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  merkle_trees
│ │ │ │ │ -      v2 hashes, if known
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  merkle_tree_mask
│ │ │ │ │ -      if set, indicates which hashes are included in the corresponding vector
│ │ │ │ │ -      of merkle_trees. These bitmasks always cover the full tree, a cleared bit
│ │ │ │ │ -      means the hash is all zeros (i.e. not set) and set bit means the next
│ │ │ │ │ -      hash in the corresponding vector in merkle_trees is the hash for that
│ │ │ │ │ -      node. This is an optimization to avoid storing a lot of zeros.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  verified_leaf_hashes
│ │ │ │ │ -      bit-fields indicating which v2 leaf hashes have been verified against the
│ │ │ │ │ -      root hash. If this vector is empty and merkle_trees is non-empty it
│ │ │ │ │ -      implies that all hashes in merkle_trees are verified.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  renamed_files
│ │ │ │ │ -      this is a map of file indices in the torrent and new filenames to be
│ │ │ │ │ -      applied before the torrent is added.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  last_download last_upload
│ │ │ │ │ -      the posix time of the last time payload was received or sent for this
│ │ │ │ │ -      torrent, respectively. A value of 0 means we don't know when we last
│ │ │ │ │ -      uploaded or downloaded, or we have never uploaded or downloaded any
│ │ │ │ │ -      payload for this torrent.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ aannnnoouunnccee__iinnffoohhaasshh ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_n_n_o_u_n_c_e___e_n_t_r_y_._h_p_p"
│ │ │ │ │  struct announce_infohash
│ │ │ │ │  {
│ │ │ │ │     std::string message;
│ │ │ │ │     error_code last_error;
│ │ │ │ │     int ssccrraappee__iinnccoommpplleettee  = -1;
│ │ │ │ │ @@ -4544,16 +6907,16 @@
│ │ │ │ │  ************ aannnnoouunnccee__eennttrryy ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_n_n_o_u_n_c_e___e_n_t_r_y_._h_p_p"
│ │ │ │ │  this class holds information about one bittorrent tracker, as it relates to a
│ │ │ │ │  specific torrent.
│ │ │ │ │  struct announce_entry
│ │ │ │ │  {
│ │ │ │ │     aannnnoouunnccee__eennttrryy (announce_entry const&);
│ │ │ │ │ -   announce_entry& ooppeerraattoorr== (announce_entry const&) &;
│ │ │ │ │     ~~aannnnoouunnccee__eennttrryy ();
│ │ │ │ │ +   announce_entry& ooppeerraattoorr== (announce_entry const&) &;
│ │ │ │ │     aannnnoouunnccee__eennttrryy ();
│ │ │ │ │     explicit aannnnoouunnccee__eennttrryy (string_view u);
│ │ │ │ │  
│ │ │ │ │     enum tracker_source
│ │ │ │ │     {
│ │ │ │ │        source_torrent,
│ │ │ │ │        source_client,
│ │ │ │ │ @@ -4568,16 +6931,16 @@
│ │ │ │ │     std::uint8_t ffaaiill__lliimmiitt  = 0;
│ │ │ │ │     std::uint8_t source:4;
│ │ │ │ │     bool verified:1;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ooppeerraattoorr==(()) ~~aannnnoouunnccee__eennttrryy(()) aannnnoouunnccee__eennttrryy(()) **********
│ │ │ │ │  aannnnoouunnccee__eennttrryy (announce_entry const&);
│ │ │ │ │ -announce_entry& ooppeerraattoorr== (announce_entry const&) &;
│ │ │ │ │  ~~aannnnoouunnccee__eennttrryy ();
│ │ │ │ │ +announce_entry& ooppeerraattoorr== (announce_entry const&) &;
│ │ │ │ │  aannnnoouunnccee__eennttrryy ();
│ │ │ │ │  explicit aannnnoouunnccee__eennttrryy (string_view u);
│ │ │ │ │  constructs a tracker announce _e_n_t_r_y with u as the URL.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** eennuumm ttrraacckkeerr__ssoouurrccee **********
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_n_n_o_u_n_c_e___e_n_t_r_y_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ @@ -4608,14 +6971,602 @@
│ │ │ │ │        this tracker is not used anymore. 0 means unlimited
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    source
│ │ │ │ │        a bitmask specifying which sources we got this tracker from.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    verified
│ │ │ │ │        set to true the first time we receive a valid response from this tracker.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ppeeeerr__ccllaassss__iinnffoo ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_l_a_s_s_._h_p_p"
│ │ │ │ │ +holds settings for a peer class. Used in _s_e_t___p_e_e_r___c_l_a_s_s_(_) and _g_e_t___p_e_e_r___c_l_a_s_s_(_)
│ │ │ │ │ +calls.
│ │ │ │ │ +struct peer_class_info
│ │ │ │ │ +{
│ │ │ │ │ +   bool ignore_unchoke_slots;
│ │ │ │ │ +   int connection_limit_factor;
│ │ │ │ │ +   std::string label;
│ │ │ │ │ +   int upload_limit;
│ │ │ │ │ +   int download_limit;
│ │ │ │ │ +   int upload_priority;
│ │ │ │ │ +   int download_priority;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  ignore_unchoke_slots
│ │ │ │ │ +      ignore_unchoke_slots determines whether peers should always unchoke a
│ │ │ │ │ +      peer, regardless of the choking algorithm, or if it should honor the
│ │ │ │ │ +      unchoke slot limits. It's used for local peers by default. If aannyy of the
│ │ │ │ │ +      peer classes a peer belongs to has this set to true, that peer will be
│ │ │ │ │ +      unchoked at all times.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  connection_limit_factor
│ │ │ │ │ +      adjusts the connection limit (global and per torrent) that applies to
│ │ │ │ │ +      this peer class. By default, local peers are allowed to exceed the normal
│ │ │ │ │ +      connection limit for instance. This is specified as a percent factor. 100
│ │ │ │ │ +      makes the peer class apply normally to the limit. 200 means as long as
│ │ │ │ │ +      there are fewer connections than twice the limit, we accept this peer.
│ │ │ │ │ +      This factor applies both to the global connection limit and the per-
│ │ │ │ │ +      torrent limit. Note that if not used carefully one peer class can
│ │ │ │ │ +      potentially completely starve out all other over time.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  label
│ │ │ │ │ +      not used by libtorrent. It's intended as a potentially user-facing
│ │ │ │ │ +      identifier of this peer class.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  upload_limit download_limit
│ │ │ │ │ +      transfer rates limits for the whole peer class. They are specified in
│ │ │ │ │ +      bytes per second and apply to the sum of all peers that are members of
│ │ │ │ │ +      this class.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  upload_priority download_priority
│ │ │ │ │ +      relative priorities used by the bandwidth allocator in the rate limiter.
│ │ │ │ │ +      If no rate limits are in use, the priority is not used either. Priorities
│ │ │ │ │ +      start at 1 (0 is not a valid priority) and may not exceed 255.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ +peer_class_type_filter is a simple container for rules for adding and
│ │ │ │ │ +subtracting peer-classes from peers. It is applied aafftteerr the peer class filter
│ │ │ │ │ +is applied (which is based on the peer's IP address).
│ │ │ │ │ +struct peer_class_type_filter
│ │ │ │ │ +{
│ │ │ │ │ +   void rreemmoovvee (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ +   void aadddd (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ +   void ddiissaallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ +   void aallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ +   std::uint32_t aappppllyy (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ │ │ +   friend bool ooppeerraattoorr==== (peer_class_type_filter const& lhs
│ │ │ │ │ +      , peer_class_type_filter const& rhs);
│ │ │ │ │ +
│ │ │ │ │ +   enum socket_type_t
│ │ │ │ │ +   {
│ │ │ │ │ +      tcp_socket,
│ │ │ │ │ +      utp_socket,
│ │ │ │ │ +      ssl_tcp_socket,
│ │ │ │ │ +      ssl_utp_socket,
│ │ │ │ │ +      i2p_socket,
│ │ │ │ │ +      num_socket_types,
│ │ │ │ │ +   };
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** rreemmoovvee(()) aadddd(()) **********
│ │ │ │ │ +void rreemmoovvee (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ +void aadddd (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ +add() and remove() adds and removes a peer class to be added to new peers based
│ │ │ │ │ +on socket type.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aallllooww(()) ddiissaallllooww(()) **********
│ │ │ │ │ +void ddiissaallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ +void aallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ +disallow() and allow() adds and removes a peer class to be removed from new
│ │ │ │ │ +peers based on socket type.
│ │ │ │ │ +The peer_class argument cannot be greater than 31. The bitmasks representing
│ │ │ │ │ +peer classes in the peer_class_type_filter are 32 bits.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aappppllyy(()) **********
│ │ │ │ │ +std::uint32_t aappppllyy (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ │ │ +takes a bitmask of peer classes and returns a new bitmask of peer classes after
│ │ │ │ │ +the rules have been applied, based on the socket type argument (st).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eennuumm ssoocckkeett__ttyyppee__tt **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|tcp_socket      |0    |these match the socket types from socket_type.hpp|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_h_i_f_t_e_d_ _o_n_e_ _d_o_w_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_u_t_p___s_o_c_k_e_t_ _ _ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_s_l___t_c_p___s_o_c_k_e_t_ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_s_l___u_t_p___s_o_c_k_e_t_ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_2_p___s_o_c_k_e_t_ _ _ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_u_m___s_o_c_k_e_t___t_y_p_e_s_|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ssttoorraaggee__ppaarraammss ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_t_o_r_a_g_e___d_e_f_s_._h_p_p"
│ │ │ │ │ +a parameter pack used to construct the storage for a torrent, used in
│ │ │ │ │ +_d_i_s_k___i_n_t_e_r_f_a_c_e
│ │ │ │ │ +struct storage_params
│ │ │ │ │ +{
│ │ │ │ │ +   ssttoorraaggee__ppaarraammss (file_storage const& f, file_storage const* mf
│ │ │ │ │ +      , std::string const& sp, storage_mode_t const sm
│ │ │ │ │ +      , aux::vector<download_priority_t, file_index_t> const& prio
│ │ │ │ │ +      , sha1_hash const& ih);
│ │ │ │ │ +
│ │ │ │ │ +   file_storage const& files;
│ │ │ │ │ +   file_storage const* mmaappppeedd__ffiilleess  = nullptr;
│ │ │ │ │ +   std::string const& path;
│ │ │ │ │ +   storage_mode_t mmooddee {storage_mode_sparse};
│ │ │ │ │ +   aux::vector<download_priority_t, file_index_t> const& priorities;
│ │ │ │ │ +   sha1_hash info_hash;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ffiillee__sslliiccee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_f_i_l_e___s_t_o_r_a_g_e_._h_p_p"
│ │ │ │ │ +represents a window of a file in a torrent.
│ │ │ │ │ +The file_index refers to the index of the file (in the _t_o_r_r_e_n_t___i_n_f_o). To get
│ │ │ │ │ +the path and filename, use file_path() and give the file_index as argument. The
│ │ │ │ │ +offset is the byte offset in the file where the range starts, and size is the
│ │ │ │ │ +number of bytes this range is. The size + offset will never be greater than the
│ │ │ │ │ +file size.
│ │ │ │ │ +struct file_slice
│ │ │ │ │ +{
│ │ │ │ │ +   file_index_t file_index;
│ │ │ │ │ +   std::int64_t offset;
│ │ │ │ │ +   std::int64_t size;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  file_index
│ │ │ │ │ +      the index of the file
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  offset
│ │ │ │ │ +      the offset from the start of the file, in bytes
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  size
│ │ │ │ │ +      the size of the window, in bytes
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ffiillee__ssttoorraaggee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_f_i_l_e___s_t_o_r_a_g_e_._h_p_p"
│ │ │ │ │ +The file_storage class represents a file list and the piece size. Everything
│ │ │ │ │ +necessary to interpret a regular bittorrent storage file structure.
│ │ │ │ │ +class file_storage
│ │ │ │ │ +{
│ │ │ │ │ +   bool iiss__vvaalliidd () const;
│ │ │ │ │ +   void rreesseerrvvee (int num_files);
│ │ │ │ │ +   void aadddd__ffiillee__bboorrrrooww (error_code& ec, string_view filename
│ │ │ │ │ +      , std::string const& path, std::int64_t file_size
│ │ │ │ │ +      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │ +      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ │ +   void aadddd__ffiillee (error_code& ec, std::string const& path, std::int64_t
│ │ │ │ │ +file_size
│ │ │ │ │ +      , file_flags_t file_flags = {}
│ │ │ │ │ +      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ │ +   void aadddd__ffiillee (std::string const& path, std::int64_t file_size
│ │ │ │ │ +      , file_flags_t file_flags = {}
│ │ │ │ │ +      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ │ +   void aadddd__ffiillee__bboorrrrooww (string_view filename
│ │ │ │ │ +      , std::string const& path, std::int64_t file_size
│ │ │ │ │ +      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │ +      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ │ +   void rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
│ │ │ │ │ +   std::vector<file_slice> mmaapp__bblloocckk (piece_index_t piece, std::int64_t offset
│ │ │ │ │ +      , std::int64_t size) const;
│ │ │ │ │ +   peer_request mmaapp__ffiillee (file_index_t file, std::int64_t offset, int size)
│ │ │ │ │ +const;
│ │ │ │ │ +   int nnuumm__ffiilleess () const noexcept;
│ │ │ │ │ +   file_index_t eenndd__ffiillee () const noexcept;
│ │ │ │ │ +   index_range<file_index_t> ffiillee__rraannggee () const noexcept;
│ │ │ │ │ +   std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ +   int nnuumm__ppiieecceess () const;
│ │ │ │ │ +   void sseett__nnuumm__ppiieecceess (int n);
│ │ │ │ │ +   piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ +   piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │ +   index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │ +   void sseett__ppiieeccee__lleennggtthh (int l);
│ │ │ │ │ +   int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ +   int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │ +   int ppiieeccee__ssiizzee22 (piece_index_t index) const;
│ │ │ │ │ +   int bblloocckkss__iinn__ppiieeccee22 (piece_index_t index) const;
│ │ │ │ │ +   int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │ +   std::string const& nnaammee () const;
│ │ │ │ │ +   void sseett__nnaammee (std::string const& n);
│ │ │ │ │ +   void sswwaapp (file_storage& ti) noexcept;
│ │ │ │ │ +   void ccaannoonniiccaalliizzee ();
│ │ │ │ │ +   sha256_hash rroooott (file_index_t index) const;
│ │ │ │ │ +   bool ppaadd__ffiillee__aatt (file_index_t index) const;
│ │ │ │ │ +   char const* rroooott__ppttrr (file_index_t const index) const;
│ │ │ │ │ +   std::string ssyymmlliinnkk (file_index_t index) const;
│ │ │ │ │ +   std::int64_t ffiillee__ssiizzee (file_index_t index) const;
│ │ │ │ │ +   std::int64_t ffiillee__ooffffsseett (file_index_t index) const;
│ │ │ │ │ +   string_view ffiillee__nnaammee (file_index_t index) const;
│ │ │ │ │ +   std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path =
│ │ │ │ │ +"") const;
│ │ │ │ │ +   sha1_hash hhaasshh (file_index_t index) const;
│ │ │ │ │ +   std::time_t mmttiimmee (file_index_t index) const;
│ │ │ │ │ +   index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t) const;
│ │ │ │ │ +   int ffiillee__nnuumm__bblloocckkss (file_index_t index) const;
│ │ │ │ │ +   int ffiillee__nnuumm__ppiieecceess (file_index_t index) const;
│ │ │ │ │ +   int ffiillee__ffiirrsstt__bblloocckk__nnooddee (file_index_t index) const;
│ │ │ │ │ +   int ffiillee__ffiirrsstt__ppiieeccee__nnooddee (file_index_t index) const;
│ │ │ │ │ +   std::uint32_t ffiillee__ppaatthh__hhaasshh (file_index_t index, std::string const&
│ │ │ │ │ +save_path) const;
│ │ │ │ │ +   void aallll__ppaatthh__hhaasshheess (std::unordered_set<std::uint32_t>& table) const;
│ │ │ │ │ +   file_flags_t ffiillee__ffllaaggss (file_index_t index) const;
│ │ │ │ │ +   bool ffiillee__aabbssoolluuttee__ppaatthh (file_index_t index) const;
│ │ │ │ │ +   file_index_t ffiillee__iinnddeexx__aatt__ooffffsseett (std::int64_t offset) const;
│ │ │ │ │ +   file_index_t ffiillee__iinnddeexx__aatt__ppiieeccee (piece_index_t piece) const;
│ │ │ │ │ +   file_index_t ffiillee__iinnddeexx__ffoorr__rroooott (sha256_hash const& root_hash) const;
│ │ │ │ │ +   piece_index_t ppiieeccee__iinnddeexx__aatt__ffiillee (file_index_t f) const;
│ │ │ │ │ +   void ssaanniittiizzee__ssyymmlliinnkkss ();
│ │ │ │ │ +   bool vv22 () const;
│ │ │ │ │ +
│ │ │ │ │ +   static constexpr file_flags_t ffllaagg__ppaadd__ffiillee  = 0_bit;
│ │ │ │ │ +   static constexpr file_flags_t ffllaagg__hhiiddddeenn  = 1_bit;
│ │ │ │ │ +   static constexpr file_flags_t ffllaagg__eexxeeccuuttaabbllee  = 2_bit;
│ │ │ │ │ +   static constexpr file_flags_t ffllaagg__ssyymmlliinnkk  = 3_bit;
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** iiss__vvaalliidd(()) **********
│ │ │ │ │ +bool iiss__vvaalliidd () const;
│ │ │ │ │ +returns true if the piece length has been initialized on the _f_i_l_e___s_t_o_r_a_g_e. This
│ │ │ │ │ +is typically taken as a proxy of whether the _f_i_l_e___s_t_o_r_a_g_e as a whole is
│ │ │ │ │ +initialized or not.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** rreesseerrvvee(()) **********
│ │ │ │ │ +void rreesseerrvvee (int num_files);
│ │ │ │ │ +allocates space for num_files in the internal file list. This can be used to
│ │ │ │ │ +avoid reallocating the internal file list when the number of files to be added
│ │ │ │ │ +is known up-front.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aadddd__ffiillee__bboorrrrooww(()) aadddd__ffiillee(()) **********
│ │ │ │ │ +void aadddd__ffiillee__bboorrrrooww (error_code& ec, string_view filename
│ │ │ │ │ +      , std::string const& path, std::int64_t file_size
│ │ │ │ │ +      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │ +      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ │ +void aadddd__ffiillee (error_code& ec, std::string const& path, std::int64_t file_size
│ │ │ │ │ +      , file_flags_t file_flags = {}
│ │ │ │ │ +      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ │ +void aadddd__ffiillee (std::string const& path, std::int64_t file_size
│ │ │ │ │ +      , file_flags_t file_flags = {}
│ │ │ │ │ +      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ │ +void aadddd__ffiillee__bboorrrrooww (string_view filename
│ │ │ │ │ +      , std::string const& path, std::int64_t file_size
│ │ │ │ │ +      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │ +      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ +      , char const* root_hash = nullptr);
│ │ │ │ │ +Adds a file to the file storage. The add_file_borrow version expects that
│ │ │ │ │ +filename is the file name (without a path) of the file that's being added. This
│ │ │ │ │ +memory is bboorrrroowweedd, i.e. it is the caller's responsibility to make sure it
│ │ │ │ │ +stays valid throughout the lifetime of this _f_i_l_e___s_t_o_r_a_g_e object or any copy of
│ │ │ │ │ +it. The same thing applies to filehash, which is an optional pointer to a 20
│ │ │ │ │ +byte binary SHA-1 hash of the file.
│ │ │ │ │ +if filename is empty, the filename from path is used and not borrowed.
│ │ │ │ │ +The path argument is the full path (in the torrent file) to the file to add.
│ │ │ │ │ +Note that this is not supposed to be an absolute path, but it is expected to
│ │ │ │ │ +include the name of the torrent as the first path element.
│ │ │ │ │ +file_size is the size of the file in bytes.
│ │ │ │ │ +The file_flags argument sets attributes on the file. The file attributes is an
│ │ │ │ │ +extension and may not work in all bittorrent clients.
│ │ │ │ │ +For possible file attributes, see file_storage::flags_t.
│ │ │ │ │ +The mtime argument is optional and can be set to 0. If non-zero, it is the
│ │ │ │ │ +posix time of the last modification time of this file.
│ │ │ │ │ +symlink_path is the path the file is a symlink to. To make this a symlink you
│ │ │ │ │ +also need to set the _f_i_l_e___s_t_o_r_a_g_e_:_:_f_l_a_g___s_y_m_l_i_n_k file flag.
│ │ │ │ │ +root_hash is an optional pointer to a 32 byte SHA-256 hash, being the merkle
│ │ │ │ │ +tree root hash for this file. This is only used for v2 torrents. If the root
│ │ │ │ │ +hash is specified for one file, it has to be specified for all, otherwise this
│ │ │ │ │ +function will fail. Note that the buffer root_hash points to must out-live the
│ │ │ │ │ +_f_i_l_e___s_t_o_r_a_g_e object, it will not be copied. This parameter is only used when
│ │ │ │ │ +llooaaddiinngg torrents, that already have their file hashes computed. When creating
│ │ │ │ │ +torrents, the file hashes will be computed by the piece hashes.
│ │ │ │ │ +If more files than one are added, certain restrictions to their paths apply. In
│ │ │ │ │ +a multi-file file storage (torrent), all files must share the same root
│ │ │ │ │ +directory.
│ │ │ │ │ +That is, the first path element of all files must be the same. This shared path
│ │ │ │ │ +element is also set to the name of the torrent. It can be changed by calling
│ │ │ │ │ +set_name.
│ │ │ │ │ +The overloads that take anerror_codereference will report failures via that
│ │ │ │ │ +variable, otherwisesystem_erroris thrown.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** rreennaammee__ffiillee(()) **********
│ │ │ │ │ +void rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
│ │ │ │ │ +renames the file at index to new_filename. Keep in mind that filenames are
│ │ │ │ │ +expected to be UTF-8 encoded.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** mmaapp__bblloocckk(()) **********
│ │ │ │ │ +std::vector<file_slice> mmaapp__bblloocckk (piece_index_t piece, std::int64_t offset
│ │ │ │ │ +      , std::int64_t size) const;
│ │ │ │ │ +returns a list of _f_i_l_e___s_l_i_c_e objects representing the portions of files the
│ │ │ │ │ +specified piece index, byte offset and size range overlaps. this is the inverse
│ │ │ │ │ +mapping of _m_a_p___f_i_l_e_(_).
│ │ │ │ │ +Preconditions of this function is that the input range is within the torrents
│ │ │ │ │ +address space. piece may not be negative and
│ │ │ │ │ +     piece * piece_size + offset + size
│ │ │ │ │ +may not exceed the total size of the torrent.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** mmaapp__ffiillee(()) **********
│ │ │ │ │ +peer_request mmaapp__ffiillee (file_index_t file, std::int64_t offset, int size) const;
│ │ │ │ │ +returns a _p_e_e_r___r_e_q_u_e_s_t representing the piece index, byte offset and size the
│ │ │ │ │ +specified file range overlaps. This is the inverse mapping over _m_a_p___b_l_o_c_k_(_).
│ │ │ │ │ +Note that the peer_request return type is meant to hold bittorrent block
│ │ │ │ │ +requests, which may not be larger than 16 kiB. Mapping a range larger than that
│ │ │ │ │ +may return an overflown integer.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** nnuumm__ffiilleess(()) **********
│ │ │ │ │ +int nnuumm__ffiilleess () const noexcept;
│ │ │ │ │ +returns the number of files in the _f_i_l_e___s_t_o_r_a_g_e
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eenndd__ffiillee(()) **********
│ │ │ │ │ +file_index_t eenndd__ffiillee () const noexcept;
│ │ │ │ │ +returns the index of the one-past-end file in the file storage
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__rraannggee(()) **********
│ │ │ │ │ +index_range<file_index_t> ffiillee__rraannggee () const noexcept;
│ │ │ │ │ +returns an implementation-defined type that can be used as the container in a
│ │ │ │ │ +range-for loop. Where the values are the indices of all files in the
│ │ │ │ │ +_f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ttoottaall__ssiizzee(()) **********
│ │ │ │ │ +std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ +returns the total number of bytes all the files in this torrent spans
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sseett__nnuumm__ppiieecceess(()) nnuumm__ppiieecceess(()) **********
│ │ │ │ │ +int nnuumm__ppiieecceess () const;
│ │ │ │ │ +void sseett__nnuumm__ppiieecceess (int n);
│ │ │ │ │ +set and get the number of pieces in the torrent
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eenndd__ppiieeccee(()) **********
│ │ │ │ │ +piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ +returns the index of the one-past-end piece in the file storage
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** llaasstt__ppiieeccee(()) **********
│ │ │ │ │ +piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │ +returns the index of the last piece in the torrent. The last piece is special
│ │ │ │ │ +in that it may be smaller than the other pieces (and the other pieces are all
│ │ │ │ │ +the same size).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ppiieeccee__rraannggee(()) **********
│ │ │ │ │ +index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │ +returns an implementation-defined type that can be used as the container in a
│ │ │ │ │ +range-for loop. Where the values are the indices of all pieces in the
│ │ │ │ │ +_f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ppiieeccee__lleennggtthh(()) sseett__ppiieeccee__lleennggtthh(()) **********
│ │ │ │ │ +void sseett__ppiieeccee__lleennggtthh (int l);
│ │ │ │ │ +int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ +set and get the size of each piece in this torrent. It must be a power of two
│ │ │ │ │ +and at least 16 kiB.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ppiieeccee__ssiizzee(()) **********
│ │ │ │ │ +int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │ +returns the piece size of index. This will be the same as _p_i_e_c_e___l_e_n_g_t_h_(_),
│ │ │ │ │ +except for the last piece, which may be shorter.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ppiieeccee__ssiizzee22(()) **********
│ │ │ │ │ +int ppiieeccee__ssiizzee22 (piece_index_t index) const;
│ │ │ │ │ +Returns the size of the given piece. If the piece spans multiple files, only
│ │ │ │ │ +the first file is considered part of the piece. This is used for v2 torrents,
│ │ │ │ │ +where all files are piece aligned and padded. i.e. The pad files are not
│ │ │ │ │ +considered part of the piece for this purpose.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** bblloocckkss__iinn__ppiieeccee22(()) **********
│ │ │ │ │ +int bblloocckkss__iinn__ppiieeccee22 (piece_index_t index) const;
│ │ │ │ │ +returns the number of blocks in the specified piece, for v2 torrents.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** bblloocckkss__ppeerr__ppiieeccee(()) **********
│ │ │ │ │ +int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │ +returns the number of blocks there are in the typical piece. There may be fewer
│ │ │ │ │ +in the last piece)
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** nnaammee(()) sseett__nnaammee(()) **********
│ │ │ │ │ +std::string const& nnaammee () const;
│ │ │ │ │ +void sseett__nnaammee (std::string const& n);
│ │ │ │ │ +set and get the name of this torrent. For multi-file torrents, this is also the
│ │ │ │ │ +name of the root directory all the files are stored in.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sswwaapp(()) **********
│ │ │ │ │ +void sswwaapp (file_storage& ti) noexcept;
│ │ │ │ │ +swap all content of tthhiiss with ttii.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ccaannoonniiccaalliizzee(()) **********
│ │ │ │ │ +void ccaannoonniiccaalliizzee ();
│ │ │ │ │ +arrange files and padding to match the canonical form required by BEP 52
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__ooffffsseett(()) ssyymmlliinnkk(()) hhaasshh(()) ffiillee__nnaammee(()) ffiillee__ssiizzee(()) rroooott__ppttrr(()) rroooott(())
│ │ │ │ │ +ffiillee__ppaatthh(()) ppaadd__ffiillee__aatt(()) mmttiimmee(()) **********
│ │ │ │ │ +sha256_hash rroooott (file_index_t index) const;
│ │ │ │ │ +bool ppaadd__ffiillee__aatt (file_index_t index) const;
│ │ │ │ │ +char const* rroooott__ppttrr (file_index_t const index) const;
│ │ │ │ │ +std::string ssyymmlliinnkk (file_index_t index) const;
│ │ │ │ │ +std::int64_t ffiillee__ssiizzee (file_index_t index) const;
│ │ │ │ │ +std::int64_t ffiillee__ooffffsseett (file_index_t index) const;
│ │ │ │ │ +string_view ffiillee__nnaammee (file_index_t index) const;
│ │ │ │ │ +std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path = "")
│ │ │ │ │ +const;
│ │ │ │ │ +sha1_hash hhaasshh (file_index_t index) const;
│ │ │ │ │ +std::time_t mmttiimmee (file_index_t index) const;
│ │ │ │ │ +These functions are used to query attributes of files at a given index.
│ │ │ │ │ +The hash() is a SHA-1 hash of the file, or 0 if none was provided in the
│ │ │ │ │ +torrent file. This can potentially be used to join a bittorrent network with
│ │ │ │ │ +other file sharing networks.
│ │ │ │ │ +root() returns the SHA-256 merkle tree root of the specified file, in case this
│ │ │ │ │ +is a v2 torrent. Otherwise returns zeros. root_ptr() returns a pointer to the
│ │ │ │ │ +SHA-256 merkle tree root hash for the specified file. The pointer points into
│ │ │ │ │ +storage referred to when the file was added, it is not owned by this object.
│ │ │ │ │ +Torrents that are not v2 torrents return nullptr.
│ │ │ │ │ +The mtime() is the modification time is the posix time when a file was last
│ │ │ │ │ +modified when the torrent was created, or 0 if it was not included in the
│ │ │ │ │ +torrent file.
│ │ │ │ │ +file_path() returns the full path to a file.
│ │ │ │ │ +file_size() returns the size of a file.
│ │ │ │ │ +pad_file_at() returns true if the file at the given index is a pad-file.
│ │ │ │ │ +file_name() returns jjuusstt the name of the file, whereas file_path() returns the
│ │ │ │ │ +path (inside the torrent file) with the filename appended.
│ │ │ │ │ +file_offset() returns the byte offset within the torrent file where this file
│ │ │ │ │ +starts. It can be used to map the file to a piece index (given the piece size).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__nnuumm__ppiieecceess(()) ffiillee__ppiieeccee__rraannggee(()) ffiillee__nnuumm__bblloocckkss(()) **********
│ │ │ │ │ +index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t) const;
│ │ │ │ │ +int ffiillee__nnuumm__bblloocckkss (file_index_t index) const;
│ │ │ │ │ +int ffiillee__nnuumm__ppiieecceess (file_index_t index) const;
│ │ │ │ │ +Returns the number of pieces or blocks the file atindexspans, under the
│ │ │ │ │ +assumption that the file is aligned to the start of a piece. This is only
│ │ │ │ │ +meaningful for v2 torrents, where files are guaranteed such alignment. These
│ │ │ │ │ +numbers are used to size and navigate the merkle hash tree for each file.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__ffiirrsstt__bblloocckk__nnooddee(()) ffiillee__ffiirrsstt__ppiieeccee__nnooddee(()) **********
│ │ │ │ │ +int ffiillee__ffiirrsstt__bblloocckk__nnooddee (file_index_t index) const;
│ │ │ │ │ +int ffiillee__ffiirrsstt__ppiieeccee__nnooddee (file_index_t index) const;
│ │ │ │ │ +index of first piece node in the merkle tree
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__ppaatthh__hhaasshh(()) **********
│ │ │ │ │ +std::uint32_t ffiillee__ppaatthh__hhaasshh (file_index_t index, std::string const& save_path)
│ │ │ │ │ +const;
│ │ │ │ │ +returns the crc32 hash of file_path(index)
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aallll__ppaatthh__hhaasshheess(()) **********
│ │ │ │ │ +void aallll__ppaatthh__hhaasshheess (std::unordered_set<std::uint32_t>& table) const;
│ │ │ │ │ +this will add the CRC32 hash of all directory entries to the table. No filename
│ │ │ │ │ +will be included, just directories. Every depth of directories are added
│ │ │ │ │ +separately to allow test for collisions with files at all levels. i.e. if one
│ │ │ │ │ +path in the torrent is foo/bar/baz, the CRC32 hashes for foo, foo/bar and foo/
│ │ │ │ │ +bar/baz will be added to the set.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__ffllaaggss(()) **********
│ │ │ │ │ +file_flags_t ffiillee__ffllaaggss (file_index_t index) const;
│ │ │ │ │ +returns a bitmask of flags from file_flags_t that apply to file at index.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__aabbssoolluuttee__ppaatthh(()) **********
│ │ │ │ │ +bool ffiillee__aabbssoolluuttee__ppaatthh (file_index_t index) const;
│ │ │ │ │ +returns true if the file at the specified index has been renamed to have an
│ │ │ │ │ +absolute path, i.e. is not anchored in the save path of the torrent.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__iinnddeexx__aatt__ppiieeccee(()) ffiillee__iinnddeexx__aatt__ooffffsseett(()) **********
│ │ │ │ │ +file_index_t ffiillee__iinnddeexx__aatt__ooffffsseett (std::int64_t offset) const;
│ │ │ │ │ +file_index_t ffiillee__iinnddeexx__aatt__ppiieeccee (piece_index_t piece) const;
│ │ │ │ │ +returns the index of the file at the given offset in the torrent
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiillee__iinnddeexx__ffoorr__rroooott(()) **********
│ │ │ │ │ +file_index_t ffiillee__iinnddeexx__ffoorr__rroooott (sha256_hash const& root_hash) const;
│ │ │ │ │ +finds the file with the given root hash and returns its index if there is no
│ │ │ │ │ +file with the root hash, file_index_t{-1} is returned
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ppiieeccee__iinnddeexx__aatt__ffiillee(()) **********
│ │ │ │ │ +piece_index_t ppiieeccee__iinnddeexx__aatt__ffiillee (file_index_t f) const;
│ │ │ │ │ +returns the piece index the given file starts at
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ssaanniittiizzee__ssyymmlliinnkkss(()) **********
│ │ │ │ │ +void ssaanniittiizzee__ssyymmlliinnkkss ();
│ │ │ │ │ +validate any symlinks, to ensure they all point to other files or directories
│ │ │ │ │ +inside this storage. Any invalid symlinks are updated to point to themselves.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** vv22(()) **********
│ │ │ │ │ +bool vv22 () const;
│ │ │ │ │ +returns true if this torrent contains v2 metadata.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  flag_pad_file
│ │ │ │ │ +      the file is a pad file. It's required to contain zeros at it will not be
│ │ │ │ │ +      saved to disk. Its purpose is to make the following file start on a piece
│ │ │ │ │ +      boundary.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  flag_hidden
│ │ │ │ │ +      this file has the hidden attribute set. This is primarily a windows
│ │ │ │ │ +      attribute
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  flag_executable
│ │ │ │ │ +      this file has the executable attribute set.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  flag_symlink
│ │ │ │ │ +      this file is a symbolic link. It should have a link target string
│ │ │ │ │ +      associated with it.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ mmmmaapp__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_m_m_a_p___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │ +std::unique_ptr<disk_interface> mmmmaapp__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ +   io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ +constructs a memory mapped file disk I/O object.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ddeeffaauulltt__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n_._h_p_p"
│ │ │ │ │ +std::unique_ptr<disk_interface> ddeeffaauulltt__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ +   io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ +the constructor function for the default storage. On systems that support
│ │ │ │ │ +memory mapped files (and a 64 bit address space) the memory mapped storage will
│ │ │ │ │ +be constructed, otherwise the portable posix storage.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ddiissaabblleedd__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_a_b_l_e_d___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │ +std::unique_ptr<disk_interface> ddiissaabblleedd__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ +   io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ +creates a disk io object that discards all data written to it, and only returns
│ │ │ │ │ +zero-buffers when read from. May be useful for testing and benchmarking.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ppoossiixx__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_s_i_x___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │ +std::unique_ptr<disk_interface> ppoossiixx__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ +   io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ +this is a simple posix disk I/O back-end, used for systems that don't have a 64
│ │ │ │ │ +bit virtual address space or don't support memory mapped files. It's
│ │ │ │ │ +implemented using portable C file functions and is single-threaded.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ssttoorraaggee__mmooddee__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_t_o_r_a_g_e___d_e_f_s_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                     |     |All pieces will be written to their final      |
│ │ │ │ │ +|                     |     |position, all files will be allocated in full  |
│ │ │ │ │ +|storage_mode_allocate|0    |when the torrent is first started. This mode   |
│ │ │ │ │ +|                     |     |minimizes fragmentation but could be a costly  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_p_e_r_a_t_i_o_n_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                     |     |All pieces will be written to the place where  |
│ │ │ │ │ +|storage_mode_sparse  |1    |they belong and sparse files will be used. This|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_s_ _t_h_e_ _r_e_c_o_m_m_e_n_d_e_d_,_ _a_n_d_ _d_e_f_a_u_l_t_ _m_o_d_e_._ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ssttaattuuss__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_t_o_r_a_g_e___d_e_f_s_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_f_a_t_a_l___d_i_s_k___e_r_r_o_r_|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_e_e_d___f_u_l_l___c_h_e_c_k_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_f_i_l_e___e_x_i_s_t_ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                |     |this is not an enum value, but a flag that can be set|
│ │ │ │ │ +|                |     |in the return from async_check_files, in case an     |
│ │ │ │ │ +|oversized_file  |16   |existing file was found larger than specified in the |
│ │ │ │ │ +|                |     |torrent. i.e. it has garbage at the end the _s_t_a_t_u_s___t |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_i_e_l_d_ _i_s_ _u_s_e_d_ _f_o_r_ _t_h_i_s_ _t_o_ _p_r_e_s_e_r_v_e_ _A_B_I_._ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm mmoovvee__ffllaaggss__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_t_o_r_a_g_e___d_e_f_s_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|always_replace_files     |0    |replace any files in the destination when    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_p_y_i_n_g_ _o_r_ _m_o_v_i_n_g_ _t_h_e_ _s_t_o_r_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                         |     |if any files that we want to copy exist in   |
│ │ │ │ │ +|                         |     |the destination exist, fail the whole        |
│ │ │ │ │ +|                         |     |operation and don't perform any copy or move.|
│ │ │ │ │ +|                         |     |There is an inherent race condition in this  |
│ │ │ │ │ +|fail_if_exist            |1    |mode. The files are checked for existence    |
│ │ │ │ │ +|                         |     |before the operation starts. In between the  |
│ │ │ │ │ +|                         |     |check and performing the copy, the           |
│ │ │ │ │ +|                         |     |destination files may be created, in which   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_a_s_e_ _t_h_e_y_ _a_r_e_ _r_e_p_l_a_c_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                         |     |if any file exist in the target, take those  |
│ │ │ │ │ +|dont_replace             |2    |files instead of the ones we may have in the |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_o_u_r_c_e_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                         |     |don't move any source files, just forget     |
│ │ │ │ │ +|reset_save_path          |3    |about them and begin checking files at new   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_a_v_e_ _p_a_t_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|reset_save_path_unchecked|4    |don't move any source files, just change save|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_a_t_h_ _a_n_d_ _c_o_n_t_i_n_u_e_ _w_o_r_k_i_n_g_ _w_i_t_h_o_u_t_ _a_n_y_ _c_h_e_c_k_s_ |
│ │ │ │ │  The _p_o_p___a_l_e_r_t_s_(_) function on _s_e_s_s_i_o_n is the main interface for retrieving
│ │ │ │ │  alerts (warnings, messages and errors from libtorrent). If no alerts have been
│ │ │ │ │  posted by libtorrent _p_o_p___a_l_e_r_t_s_(_) will return an empty list.
│ │ │ │ │  By default, only errors are reported. _s_e_t_t_i_n_g_s___p_a_c_k_:_:_a_l_e_r_t___m_a_s_k can be used to
│ │ │ │ │  specify which kinds of events should be reported. The _a_l_e_r_t mask is a
│ │ │ │ │  combination of the _a_l_e_r_t___c_a_t_e_g_o_r_y___t flags in the _a_l_e_r_t class.
│ │ │ │ │  Every _a_l_e_r_t belongs to one or more category. There is a cost associated with
│ │ │ │ │ @@ -4628,103 +7579,14 @@
│ │ │ │ │  that are generated for a specific torrent are derived from _t_o_r_r_e_n_t___a_l_e_r_t, and
│ │ │ │ │  tracker events derive from _t_r_a_c_k_e_r___a_l_e_r_t.
│ │ │ │ │  Alerts returned by _p_o_p___a_l_e_r_t_s_(_) are only valid until the next call to
│ │ │ │ │  _p_o_p___a_l_e_r_t_s_(_). You may not copy an _a_l_e_r_t object to access it after the next call
│ │ │ │ │  to _p_o_p___a_l_e_r_t_s_(_). Internal members of alerts also become invalid once _p_o_p___a_l_e_r_t_s
│ │ │ │ │  _(_) is called again.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ aalleerrtt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t_._h_p_p"
│ │ │ │ │ -The alert class is the base class that specific messages are derived from.
│ │ │ │ │ -_a_l_e_r_t types are not copyable, and cannot be constructed by the client. The
│ │ │ │ │ -pointers returned by libtorrent are short lived (the details are described
│ │ │ │ │ -under _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_p_o_p___a_l_e_r_t_s_(_))
│ │ │ │ │ -struct alert
│ │ │ │ │ -{
│ │ │ │ │ -   time_point ttiimmeessttaammpp () const;
│ │ │ │ │ -   virtual int ttyyppee () const noexcept = 0;
│ │ │ │ │ -   virtual char const* wwhhaatt () const noexcept = 0;
│ │ │ │ │ -   virtual std::string mmeessssaaggee () const = 0;
│ │ │ │ │ -   virtual alert_category_t ccaatteeggoorryy () const noexcept = 0;
│ │ │ │ │ -
│ │ │ │ │ -   static constexpr alert_category_t eerrrroorr__nnoottiiffiiccaattiioonn  = 0_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppeeeerr__nnoottiiffiiccaattiioonn  = 1_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppoorrtt__mmaappppiinngg__nnoottiiffiiccaattiioonn  = 2_bit;
│ │ │ │ │ -   static constexpr alert_category_t ssttoorraaggee__nnoottiiffiiccaattiioonn  = 3_bit;
│ │ │ │ │ -   static constexpr alert_category_t ttrraacckkeerr__nnoottiiffiiccaattiioonn  = 4_bit;
│ │ │ │ │ -   static constexpr alert_category_t ccoonnnneecctt__nnoottiiffiiccaattiioonn  = 5_bit;
│ │ │ │ │ -   static constexpr alert_category_t ssttaattuuss__nnoottiiffiiccaattiioonn  = 6_bit;
│ │ │ │ │ -   static constexpr alert_category_t iipp__bblloocckk__nnoottiiffiiccaattiioonn  = 8_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppeerrffoorrmmaannccee__wwaarrnniinngg  = 9_bit;
│ │ │ │ │ -   static constexpr alert_category_t ddhhtt__nnoottiiffiiccaattiioonn  = 10_bit;
│ │ │ │ │ -   static constexpr alert_category_t sseessssiioonn__lloogg__nnoottiiffiiccaattiioonn  = 13_bit;
│ │ │ │ │ -   static constexpr alert_category_t ttoorrrreenntt__lloogg__nnoottiiffiiccaattiioonn  = 14_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppeeeerr__lloogg__nnoottiiffiiccaattiioonn  = 15_bit;
│ │ │ │ │ -   static constexpr alert_category_t iinnccoommiinngg__rreeqquueesstt__nnoottiiffiiccaattiioonn  = 16_bit;
│ │ │ │ │ -   static constexpr alert_category_t ddhhtt__lloogg__nnoottiiffiiccaattiioonn  = 17_bit;
│ │ │ │ │ -   static constexpr alert_category_t ddhhtt__ooppeerraattiioonn__nnoottiiffiiccaattiioonn  = 18_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppoorrtt__mmaappppiinngg__lloogg__nnoottiiffiiccaattiioonn  = 19_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppiicckkeerr__lloogg__nnoottiiffiiccaattiioonn  = 20_bit;
│ │ │ │ │ -   static constexpr alert_category_t ffiillee__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 21_bit;
│ │ │ │ │ -   static constexpr alert_category_t ppiieeccee__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 22_bit;
│ │ │ │ │ -   static constexpr alert_category_t uuppllooaadd__nnoottiiffiiccaattiioonn  = 23_bit;
│ │ │ │ │ -   static constexpr alert_category_t bblloocckk__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 24_bit;
│ │ │ │ │ -   static constexpr alert_category_t aallll__ccaatteeggoorriieess  = alert_category_t::all();
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttiimmeessttaammpp(()) **********
│ │ │ │ │ -time_point ttiimmeessttaammpp () const;
│ │ │ │ │ -a timestamp is automatically created in the constructor
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttyyppee(()) **********
│ │ │ │ │ -virtual int ttyyppee () const noexcept = 0;
│ │ │ │ │ -returns an integer that is unique to this _a_l_e_r_t type. It can be compared
│ │ │ │ │ -against a specific _a_l_e_r_t by querying a static constant called alert_type in the
│ │ │ │ │ -_a_l_e_r_t. It can be used to determine the run-time type of an alert* in order to
│ │ │ │ │ -cast to that _a_l_e_r_t type and access specific members.
│ │ │ │ │ -e.g:
│ │ │ │ │ -std::vector<alert*> alerts;
│ │ │ │ │ -ses.pop_alerts(&alerts);
│ │ │ │ │ -for (alert* a : alerts) {
│ │ │ │ │ -        switch (a->type()) {
│ │ │ │ │ -
│ │ │ │ │ -                case read_piece_alert::alert_type:
│ │ │ │ │ -                {
│ │ │ │ │ -                        auto* p = static_cast<read_piece_alert*>(a);
│ │ │ │ │ -                        if (p->ec) {
│ │ │ │ │ -                                // read_piece failed
│ │ │ │ │ -                                break;
│ │ │ │ │ -                        }
│ │ │ │ │ -                        // use p
│ │ │ │ │ -                        break;
│ │ │ │ │ -                }
│ │ │ │ │ -                case file_renamed_alert::alert_type:
│ │ │ │ │ -                {
│ │ │ │ │ -                        // etc...
│ │ │ │ │ -                }
│ │ │ │ │ -        }
│ │ │ │ │ -}
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** wwhhaatt(()) **********
│ │ │ │ │ -virtual char const* wwhhaatt () const noexcept = 0;
│ │ │ │ │ -returns a string literal describing the type of the _a_l_e_r_t. It does not include
│ │ │ │ │ -any information that might be bundled with the _a_l_e_r_t.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** mmeessssaaggee(()) **********
│ │ │ │ │ -virtual std::string mmeessssaaggee () const = 0;
│ │ │ │ │ -generate a string describing the _a_l_e_r_t and the information bundled with it.
│ │ │ │ │ -This is mainly intended for debug and development use. It is not suitable to
│ │ │ │ │ -use this for applications that may be localized. Instead, handle each _a_l_e_r_t
│ │ │ │ │ -type individually and extract and render the information from the _a_l_e_r_t
│ │ │ │ │ -depending on the locale.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccaatteeggoorryy(()) **********
│ │ │ │ │ -virtual alert_category_t ccaatteeggoorryy () const noexcept = 0;
│ │ │ │ │ -returns a bitmask specifying which categories this _a_l_e_r_t belong to.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ddhhtt__rroouuttiinngg__bbuucckkeett ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │  struct to hold information about a single DHT routing table bucket
│ │ │ │ │  struct dht_routing_bucket
│ │ │ │ │  {
│ │ │ │ │     int num_nodes;
│ │ │ │ │     int num_replacements;
│ │ │ │ │ @@ -4866,25 +7728,25 @@
│ │ │ │ │  ************ ffiillee__rreennaammeedd__aalleerrtt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │  This is posted as a response to a _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_r_e_n_a_m_e___f_i_l_e_(_) call, if the
│ │ │ │ │  rename operation succeeds.
│ │ │ │ │  struct file_renamed_alert final : torrent_alert
│ │ │ │ │  {
│ │ │ │ │     std::string mmeessssaaggee () const override;
│ │ │ │ │ -   char const* nneeww__nnaammee () const;
│ │ │ │ │     char const* oolldd__nnaammee () const;
│ │ │ │ │ +   char const* nneeww__nnaammee () const;
│ │ │ │ │  
│ │ │ │ │     static constexpr alert_category_t ssttaattiicc__ccaatteeggoorryy  = alert_category::
│ │ │ │ │  storage;
│ │ │ │ │     file_index_t const index;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** nneeww__nnaammee(()) oolldd__nnaammee(()) **********
│ │ │ │ │ -char const* nneeww__nnaammee () const;
│ │ │ │ │  char const* oolldd__nnaammee () const;
│ │ │ │ │ +char const* nneeww__nnaammee () const;
│ │ │ │ │  returns the new and previous file name, respectively.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    index
│ │ │ │ │        refers to the index of the file that was renamed,
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ffiillee__rreennaammee__ffaaiilleedd__aalleerrtt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │ @@ -7038,18 +9900,107 @@
│ │ │ │ │     static constexpr alert_category_t ssttaattiicc__ccaatteeggoorryy  = alert_category::status;
│ │ │ │ │     std::vector<announce_entry> trackers;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    trackers
│ │ │ │ │        list of trackers and their status for the torrent
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ aalleerrtt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t_._h_p_p"
│ │ │ │ │ +The alert class is the base class that specific messages are derived from.
│ │ │ │ │ +_a_l_e_r_t types are not copyable, and cannot be constructed by the client. The
│ │ │ │ │ +pointers returned by libtorrent are short lived (the details are described
│ │ │ │ │ +under _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_p_o_p___a_l_e_r_t_s_(_))
│ │ │ │ │ +struct alert
│ │ │ │ │ +{
│ │ │ │ │ +   time_point ttiimmeessttaammpp () const;
│ │ │ │ │ +   virtual int ttyyppee () const noexcept = 0;
│ │ │ │ │ +   virtual char const* wwhhaatt () const noexcept = 0;
│ │ │ │ │ +   virtual std::string mmeessssaaggee () const = 0;
│ │ │ │ │ +   virtual alert_category_t ccaatteeggoorryy () const noexcept = 0;
│ │ │ │ │ +
│ │ │ │ │ +   static constexpr alert_category_t eerrrroorr__nnoottiiffiiccaattiioonn  = 0_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppeeeerr__nnoottiiffiiccaattiioonn  = 1_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppoorrtt__mmaappppiinngg__nnoottiiffiiccaattiioonn  = 2_bit;
│ │ │ │ │ +   static constexpr alert_category_t ssttoorraaggee__nnoottiiffiiccaattiioonn  = 3_bit;
│ │ │ │ │ +   static constexpr alert_category_t ttrraacckkeerr__nnoottiiffiiccaattiioonn  = 4_bit;
│ │ │ │ │ +   static constexpr alert_category_t ccoonnnneecctt__nnoottiiffiiccaattiioonn  = 5_bit;
│ │ │ │ │ +   static constexpr alert_category_t ssttaattuuss__nnoottiiffiiccaattiioonn  = 6_bit;
│ │ │ │ │ +   static constexpr alert_category_t iipp__bblloocckk__nnoottiiffiiccaattiioonn  = 8_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppeerrffoorrmmaannccee__wwaarrnniinngg  = 9_bit;
│ │ │ │ │ +   static constexpr alert_category_t ddhhtt__nnoottiiffiiccaattiioonn  = 10_bit;
│ │ │ │ │ +   static constexpr alert_category_t sseessssiioonn__lloogg__nnoottiiffiiccaattiioonn  = 13_bit;
│ │ │ │ │ +   static constexpr alert_category_t ttoorrrreenntt__lloogg__nnoottiiffiiccaattiioonn  = 14_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppeeeerr__lloogg__nnoottiiffiiccaattiioonn  = 15_bit;
│ │ │ │ │ +   static constexpr alert_category_t iinnccoommiinngg__rreeqquueesstt__nnoottiiffiiccaattiioonn  = 16_bit;
│ │ │ │ │ +   static constexpr alert_category_t ddhhtt__lloogg__nnoottiiffiiccaattiioonn  = 17_bit;
│ │ │ │ │ +   static constexpr alert_category_t ddhhtt__ooppeerraattiioonn__nnoottiiffiiccaattiioonn  = 18_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppoorrtt__mmaappppiinngg__lloogg__nnoottiiffiiccaattiioonn  = 19_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppiicckkeerr__lloogg__nnoottiiffiiccaattiioonn  = 20_bit;
│ │ │ │ │ +   static constexpr alert_category_t ffiillee__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 21_bit;
│ │ │ │ │ +   static constexpr alert_category_t ppiieeccee__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 22_bit;
│ │ │ │ │ +   static constexpr alert_category_t uuppllooaadd__nnoottiiffiiccaattiioonn  = 23_bit;
│ │ │ │ │ +   static constexpr alert_category_t bblloocckk__pprrooggrreessss__nnoottiiffiiccaattiioonn  = 24_bit;
│ │ │ │ │ +   static constexpr alert_category_t aallll__ccaatteeggoorriieess  = alert_category_t::all();
│ │ │ │ │ +};
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ttiimmeessttaammpp(()) **********
│ │ │ │ │ +time_point ttiimmeessttaammpp () const;
│ │ │ │ │ +a timestamp is automatically created in the constructor
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ttyyppee(()) **********
│ │ │ │ │ +virtual int ttyyppee () const noexcept = 0;
│ │ │ │ │ +returns an integer that is unique to this _a_l_e_r_t type. It can be compared
│ │ │ │ │ +against a specific _a_l_e_r_t by querying a static constant called alert_type in the
│ │ │ │ │ +_a_l_e_r_t. It can be used to determine the run-time type of an alert* in order to
│ │ │ │ │ +cast to that _a_l_e_r_t type and access specific members.
│ │ │ │ │ +e.g:
│ │ │ │ │ +std::vector<alert*> alerts;
│ │ │ │ │ +ses.pop_alerts(&alerts);
│ │ │ │ │ +for (alert* a : alerts) {
│ │ │ │ │ +        switch (a->type()) {
│ │ │ │ │ +
│ │ │ │ │ +                case read_piece_alert::alert_type:
│ │ │ │ │ +                {
│ │ │ │ │ +                        auto* p = static_cast<read_piece_alert*>(a);
│ │ │ │ │ +                        if (p->ec) {
│ │ │ │ │ +                                // read_piece failed
│ │ │ │ │ +                                break;
│ │ │ │ │ +                        }
│ │ │ │ │ +                        // use p
│ │ │ │ │ +                        break;
│ │ │ │ │ +                }
│ │ │ │ │ +                case file_renamed_alert::alert_type:
│ │ │ │ │ +                {
│ │ │ │ │ +                        // etc...
│ │ │ │ │ +                }
│ │ │ │ │ +        }
│ │ │ │ │ +}
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** wwhhaatt(()) **********
│ │ │ │ │ +virtual char const* wwhhaatt () const noexcept = 0;
│ │ │ │ │ +returns a string literal describing the type of the _a_l_e_r_t. It does not include
│ │ │ │ │ +any information that might be bundled with the _a_l_e_r_t.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** mmeessssaaggee(()) **********
│ │ │ │ │ +virtual std::string mmeessssaaggee () const = 0;
│ │ │ │ │ +generate a string describing the _a_l_e_r_t and the information bundled with it.
│ │ │ │ │ +This is mainly intended for debug and development use. It is not suitable to
│ │ │ │ │ +use this for applications that may be localized. Instead, handle each _a_l_e_r_t
│ │ │ │ │ +type individually and extract and render the information from the _a_l_e_r_t
│ │ │ │ │ +depending on the locale.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ccaatteeggoorryy(()) **********
│ │ │ │ │ +virtual alert_category_t ccaatteeggoorryy () const noexcept = 0;
│ │ │ │ │ +returns a bitmask specifying which categories this _a_l_e_r_t belong to.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ aalleerrtt__ccaasstt(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t_._h_p_p"
│ │ │ │ │ -template <typename T> T const* aalleerrtt__ccaasstt (alert const* a);
│ │ │ │ │  template <typename T> T* aalleerrtt__ccaasstt (alert* a);
│ │ │ │ │ +template <typename T> T const* aalleerrtt__ccaasstt (alert const* a);
│ │ │ │ │  When you get an _a_l_e_r_t, you can use alert_cast<> to attempt to cast the pointer
│ │ │ │ │  to a specific _a_l_e_r_t type, in order to query it for more information.
│ │ │ │ │  Note
│ │ │ │ │  alert_cast<> can only cast to an exact _a_l_e_r_t type, not a base class
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ooppeerraattiioonn__nnaammee(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_o_p_e_r_a_t_i_o_n_s_._h_p_p"
│ │ │ │ │ @@ -7114,14 +10065,21 @@
│ │ │ │ │  |_e_n_u_m___r_o_u_t_e_ _ _ _ _ _ _ _ _ _|_4_2_ _ _ _|_e_n_u_m_e_r_a_t_i_o_n_ _o_f_ _n_e_t_w_o_r_k_ _r_o_u_t_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |file_seek          |43   |moving read/write position in a file, _o_p_e_r_a_t_i_o_n___t_:_:|
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_o_s_t_n_a_m_e___l_o_o_k_u_p_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_t_i_m_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_4_4_ _ _ _|_a_n_ _a_s_y_n_c_ _w_a_i_t_ _o_p_e_r_a_t_i_o_n_ _o_n_ _a_ _t_i_m_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_f_i_l_e___m_m_a_p_ _ _ _ _ _ _ _ _ _ _|_4_5_ _ _ _|_c_a_l_l_ _t_o_ _m_m_a_p_(_)_ _(_o_r_ _w_i_n_d_o_w_s_ _c_o_u_n_t_e_r_p_a_r_t_)_ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_f_i_l_e___t_r_u_n_c_a_t_e_ _ _ _ _ _ _|_4_6_ _ _ _|_c_a_l_l_ _t_o_ _f_t_r_u_n_c_a_t_e_(_)_ _(_o_r_ _S_e_t_E_n_d_O_f_F_i_l_e_(_)_ _o_n_ _w_i_n_d_o_w_s_)_ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ iinntt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │ +  user_alert_id
│ │ │ │ │ +      user defined alerts should use IDs greater than this
│ │ │ │ │ +  num_alert_types
│ │ │ │ │ +      this constant represents "max_alert_index" + 1
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ aalleerrtt__ccaatteeggoorryy__tt ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t_._h_p_p"
│ │ │ │ │    error
│ │ │ │ │        Enables alerts that report an error. This includes:
│ │ │ │ │            * tracker errors
│ │ │ │ │            * tracker warnings
│ │ │ │ │            * file errors
│ │ │ │ │ @@ -7193,1083 +10151,1263 @@
│ │ │ │ │        rate.
│ │ │ │ │    all
│ │ │ │ │        The full bitmask, representing all available categories.
│ │ │ │ │        since the enum is signed, make sure this isn't interpreted as -1. For
│ │ │ │ │        instance, boost.python does that and fails when assigning it to an
│ │ │ │ │        unsigned parameter.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ iinntt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t___t_y_p_e_s_._h_p_p"
│ │ │ │ │ -  user_alert_id
│ │ │ │ │ -      user defined alerts should use IDs greater than this
│ │ │ │ │ -  num_alert_types
│ │ │ │ │ -      this constant represents "max_alert_index" + 1
│ │ │ │ │ +************ hhaasshheerr ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_h_a_s_h_e_r_._h_p_p"
│ │ │ │ │ +this is a SHA-1 hash class.
│ │ │ │ │ +You use it by first instantiating it, then call update() to feed it with data.
│ │ │ │ │ +i.e. you don't have to keep the entire buffer of which you want to create the
│ │ │ │ │ +hash in memory. You can feed the _h_a_s_h_e_r parts of it at a time. When You have
│ │ │ │ │ +fed the _h_a_s_h_e_r with all the data, you call final() and it will return the sha1-
│ │ │ │ │ +hash of the data.
│ │ │ │ │ +The constructor that takes a char const* and an integer will construct the sha1
│ │ │ │ │ +context and feed it the data passed in.
│ │ │ │ │ +If you want to reuse the _h_a_s_h_e_r object once you have created a hash, you have
│ │ │ │ │ +to call reset() to reinitialize it.
│ │ │ │ │ +The built-in software version of sha1-algorithm was implemented by Steve Reid
│ │ │ │ │ +and released as public domain. For more info, see src/sha1.cpp.
│ │ │ │ │ +class hasher
│ │ │ │ │ +{
│ │ │ │ │ +   hhaasshheerr ();
│ │ │ │ │ +   hhaasshheerr (char const* data, int len);
│ │ │ │ │ +   explicit hhaasshheerr (span<char const> data);
│ │ │ │ │ +   hhaasshheerr (hasher const&);
│ │ │ │ │ +   hasher& ooppeerraattoorr== (hasher const&) &;
│ │ │ │ │ +   hasher& uuppddaattee (span<char const> data);
│ │ │ │ │ +   hasher& uuppddaattee (char const* data, int len);
│ │ │ │ │ +   sha1_hash ffiinnaall ();
│ │ │ │ │ +   void rreesseett ();
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ssttoorraaggee__ppaarraammss ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_t_o_r_a_g_e___d_e_f_s_._h_p_p"
│ │ │ │ │ -a parameter pack used to construct the storage for a torrent, used in
│ │ │ │ │ -_d_i_s_k___i_n_t_e_r_f_a_c_e
│ │ │ │ │ -struct storage_params
│ │ │ │ │ +********** ooppeerraattoorr==(()) hhaasshheerr(()) **********
│ │ │ │ │ +hhaasshheerr (char const* data, int len);
│ │ │ │ │ +explicit hhaasshheerr (span<char const> data);
│ │ │ │ │ +hhaasshheerr (hasher const&);
│ │ │ │ │ +hasher& ooppeerraattoorr== (hasher const&) &;
│ │ │ │ │ +this is the same as default constructing followed by a call to update(data,
│ │ │ │ │ +len).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** uuppddaattee(()) **********
│ │ │ │ │ +hasher& uuppddaattee (span<char const> data);
│ │ │ │ │ +hasher& uuppddaattee (char const* data, int len);
│ │ │ │ │ +append the following bytes to what is being hashed
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiinnaall(()) **********
│ │ │ │ │ +sha1_hash ffiinnaall ();
│ │ │ │ │ +returns the SHA-1 digest of the buffers previously passed to _u_p_d_a_t_e_(_) and the
│ │ │ │ │ +_h_a_s_h_e_r constructor.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** rreesseett(()) **********
│ │ │ │ │ +void rreesseett ();
│ │ │ │ │ +restore the _h_a_s_h_e_r state to be as if the _h_a_s_h_e_r has just been default
│ │ │ │ │ +constructed.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ hhaasshheerr225566 ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_h_a_s_h_e_r_._h_p_p"
│ │ │ │ │ +class hasher256
│ │ │ │ │  {
│ │ │ │ │ -   ssttoorraaggee__ppaarraammss (file_storage const& f, file_storage const* mf
│ │ │ │ │ -      , std::string const& sp, storage_mode_t const sm
│ │ │ │ │ -      , aux::vector<download_priority_t, file_index_t> const& prio
│ │ │ │ │ -      , sha1_hash const& ih);
│ │ │ │ │ -
│ │ │ │ │ -   file_storage const& files;
│ │ │ │ │ -   file_storage const* mmaappppeedd__ffiilleess  = nullptr;
│ │ │ │ │ -   std::string const& path;
│ │ │ │ │ -   storage_mode_t mmooddee {storage_mode_sparse};
│ │ │ │ │ -   aux::vector<download_priority_t, file_index_t> const& priorities;
│ │ │ │ │ -   sha1_hash info_hash;
│ │ │ │ │ +   hhaasshheerr225566 ();
│ │ │ │ │ +   hasher256& ooppeerraattoorr== (hasher256 const&) &;
│ │ │ │ │ +   hhaasshheerr225566 (char const* data, int len);
│ │ │ │ │ +   explicit hhaasshheerr225566 (span<char const> data);
│ │ │ │ │ +   hhaasshheerr225566 (hasher256 const&);
│ │ │ │ │ +   hasher256& uuppddaattee (span<char const> data);
│ │ │ │ │ +   hasher256& uuppddaattee (char const* data, int len);
│ │ │ │ │ +   sha256_hash ffiinnaall ();
│ │ │ │ │ +   void rreesseett ();
│ │ │ │ │ +   ~~hhaasshheerr225566 ();
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ffiillee__sslliiccee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_f_i_l_e___s_t_o_r_a_g_e_._h_p_p"
│ │ │ │ │ -represents a window of a file in a torrent.
│ │ │ │ │ -The file_index refers to the index of the file (in the _t_o_r_r_e_n_t___i_n_f_o). To get
│ │ │ │ │ -the path and filename, use file_path() and give the file_index as argument. The
│ │ │ │ │ -offset is the byte offset in the file where the range starts, and size is the
│ │ │ │ │ -number of bytes this range is. The size + offset will never be greater than the
│ │ │ │ │ -file size.
│ │ │ │ │ -struct file_slice
│ │ │ │ │ +********** ooppeerraattoorr==(()) hhaasshheerr225566(()) **********
│ │ │ │ │ +hasher256& ooppeerraattoorr== (hasher256 const&) &;
│ │ │ │ │ +hhaasshheerr225566 (char const* data, int len);
│ │ │ │ │ +explicit hhaasshheerr225566 (span<char const> data);
│ │ │ │ │ +hhaasshheerr225566 (hasher256 const&);
│ │ │ │ │ +this is the same as default constructing followed by a call to update(data,
│ │ │ │ │ +len).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** uuppddaattee(()) **********
│ │ │ │ │ +hasher256& uuppddaattee (span<char const> data);
│ │ │ │ │ +hasher256& uuppddaattee (char const* data, int len);
│ │ │ │ │ +append the following bytes to what is being hashed
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiinnaall(()) **********
│ │ │ │ │ +sha256_hash ffiinnaall ();
│ │ │ │ │ +returns the SHA-1 digest of the buffers previously passed to _u_p_d_a_t_e_(_) and the
│ │ │ │ │ +_h_a_s_h_e_r constructor.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** rreesseett(()) **********
│ │ │ │ │ +void rreesseett ();
│ │ │ │ │ +restore the _h_a_s_h_e_r state to be as if the _h_a_s_h_e_r has just been default
│ │ │ │ │ +constructed.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ bbiittffiieelldd ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_i_t_f_i_e_l_d_._h_p_p"
│ │ │ │ │ +The _b_i_t_f_i_e_l_d type stores any number of bits as a _b_i_t_f_i_e_l_d in a heap allocated
│ │ │ │ │ +array.
│ │ │ │ │ +struct bitfield
│ │ │ │ │  {
│ │ │ │ │ -   file_index_t file_index;
│ │ │ │ │ -   std::int64_t offset;
│ │ │ │ │ -   std::int64_t size;
│ │ │ │ │ +   explicit bbiittffiieelldd (int bits);
│ │ │ │ │ +   bbiittffiieelldd (char const* b, int bits);
│ │ │ │ │ +   bbiittffiieelldd () noexcept = default;
│ │ │ │ │ +   bbiittffiieelldd (int bits, bool val);
│ │ │ │ │ +   bbiittffiieelldd (bitfield&& rhs) noexcept = default;
│ │ │ │ │ +   bbiittffiieelldd (bitfield const& rhs);
│ │ │ │ │ +   void aassssiiggnn (char const* b, int const bits);
│ │ │ │ │ +   bool ooppeerraattoorr[[]] (int index) const noexcept;
│ │ │ │ │ +   bool ggeett__bbiitt (int index) const noexcept;
│ │ │ │ │ +   void sseett__bbiitt (int index) noexcept;
│ │ │ │ │ +   void cclleeaarr__bbiitt (int index) noexcept;
│ │ │ │ │ +   bool aallll__sseett () const noexcept;
│ │ │ │ │ +   bool nnoonnee__sseett () const noexcept;
│ │ │ │ │ +   int ssiizzee () const noexcept;
│ │ │ │ │ +   int nnuumm__wwoorrddss () const noexcept;
│ │ │ │ │ +   int nnuumm__bbyytteess () const noexcept;
│ │ │ │ │ +   bool eemmppttyy () const noexcept;
│ │ │ │ │ +   char* ddaattaa () noexcept;
│ │ │ │ │ +   char const* ddaattaa () const noexcept;
│ │ │ │ │ +   void sswwaapp (bitfield& rhs) noexcept;
│ │ │ │ │ +   int ccoouunntt () const noexcept;
│ │ │ │ │ +   int ffiinndd__ffiirrsstt__sseett () const noexcept;
│ │ │ │ │ +   int ffiinndd__llaasstt__cclleeaarr () const noexcept;
│ │ │ │ │ +   bool ooppeerraattoorr==== (lt::bitfield const& rhs) const;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  file_index
│ │ │ │ │ -      the index of the file
│ │ │ │ │ +********** bbiittffiieelldd(()) **********
│ │ │ │ │ +explicit bbiittffiieelldd (int bits);
│ │ │ │ │ +bbiittffiieelldd (char const* b, int bits);
│ │ │ │ │ +bbiittffiieelldd () noexcept = default;
│ │ │ │ │ +bbiittffiieelldd (int bits, bool val);
│ │ │ │ │ +bbiittffiieelldd (bitfield&& rhs) noexcept = default;
│ │ │ │ │ +bbiittffiieelldd (bitfield const& rhs);
│ │ │ │ │ +constructs a new _b_i_t_f_i_e_l_d. The default constructor creates an empty _b_i_t_f_i_e_l_d.
│ │ │ │ │ +bits is the size of the _b_i_t_f_i_e_l_d (specified in bits). val is the value to
│ │ │ │ │ +initialize the bits to. If not specified all bits are initialized to 0.
│ │ │ │ │ +The constructor taking a pointer b and bits copies a _b_i_t_f_i_e_l_d from the
│ │ │ │ │ +specified buffer, and bits number of bits (rounded up to the nearest byte
│ │ │ │ │ +boundary).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  offset
│ │ │ │ │ -      the offset from the start of the file, in bytes
│ │ │ │ │ +********** aassssiiggnn(()) **********
│ │ │ │ │ +void aassssiiggnn (char const* b, int const bits);
│ │ │ │ │ +copy _b_i_t_f_i_e_l_d from buffer b of bits number of bits, rounded up to the nearest
│ │ │ │ │ +byte boundary.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  size
│ │ │ │ │ -      the size of the window, in bytes
│ │ │ │ │ +********** ooppeerraattoorr[[]](()) ggeett__bbiitt(()) **********
│ │ │ │ │ +bool ooppeerraattoorr[[]] (int index) const noexcept;
│ │ │ │ │ +bool ggeett__bbiitt (int index) const noexcept;
│ │ │ │ │ +query bit at index. Returns true if bit is 1, otherwise false.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ffiillee__ssttoorraaggee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_f_i_l_e___s_t_o_r_a_g_e_._h_p_p"
│ │ │ │ │ -The file_storage class represents a file list and the piece size. Everything
│ │ │ │ │ -necessary to interpret a regular bittorrent storage file structure.
│ │ │ │ │ -class file_storage
│ │ │ │ │ +********** sseett__bbiitt(()) cclleeaarr__bbiitt(()) **********
│ │ │ │ │ +void sseett__bbiitt (int index) noexcept;
│ │ │ │ │ +void cclleeaarr__bbiitt (int index) noexcept;
│ │ │ │ │ +set bit at index to 0 (clear_bit) or 1 (set_bit).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** aallll__sseett(()) **********
│ │ │ │ │ +bool aallll__sseett () const noexcept;
│ │ │ │ │ +returns true if all bits in the _b_i_t_f_i_e_l_d are set
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** nnoonnee__sseett(()) **********
│ │ │ │ │ +bool nnoonnee__sseett () const noexcept;
│ │ │ │ │ +returns true if no bit in the _b_i_t_f_i_e_l_d is set
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ssiizzee(()) **********
│ │ │ │ │ +int ssiizzee () const noexcept;
│ │ │ │ │ +returns the size of the _b_i_t_f_i_e_l_d in bits.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** nnuumm__wwoorrddss(()) **********
│ │ │ │ │ +int nnuumm__wwoorrddss () const noexcept;
│ │ │ │ │ +returns the number of 32 bit words are needed to represent all bits in this
│ │ │ │ │ +_b_i_t_f_i_e_l_d.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** nnuumm__bbyytteess(()) **********
│ │ │ │ │ +int nnuumm__bbyytteess () const noexcept;
│ │ │ │ │ +returns the number of bytes needed to represent all bits in this _b_i_t_f_i_e_l_d
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** eemmppttyy(()) **********
│ │ │ │ │ +bool eemmppttyy () const noexcept;
│ │ │ │ │ +returns true if the _b_i_t_f_i_e_l_d has zero size.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ddaattaa(()) **********
│ │ │ │ │ +char* ddaattaa () noexcept;
│ │ │ │ │ +char const* ddaattaa () const noexcept;
│ │ │ │ │ +returns a pointer to the internal buffer of the _b_i_t_f_i_e_l_d, or nullptr if it's
│ │ │ │ │ +empty.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** sswwaapp(()) **********
│ │ │ │ │ +void sswwaapp (bitfield& rhs) noexcept;
│ │ │ │ │ +swaps the bit-fields two variables refer to
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ccoouunntt(()) **********
│ │ │ │ │ +int ccoouunntt () const noexcept;
│ │ │ │ │ +count the number of bits in the _b_i_t_f_i_e_l_d that are set to 1.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiinndd__ffiirrsstt__sseett(()) **********
│ │ │ │ │ +int ffiinndd__ffiirrsstt__sseett () const noexcept;
│ │ │ │ │ +returns the index of the first set bit in the _b_i_t_f_i_e_l_d, i.e. 1 bit.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +********** ffiinndd__llaasstt__cclleeaarr(()) **********
│ │ │ │ │ +int ffiinndd__llaasstt__cclleeaarr () const noexcept;
│ │ │ │ │ +returns the index to the last cleared bit in the _b_i_t_f_i_e_l_d, i.e. 0 bit.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ppeeeerr__rreeqquueesstt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___r_e_q_u_e_s_t_._h_p_p"
│ │ │ │ │ +represents a byte range within a piece. Internally this is is used for incoming
│ │ │ │ │ +piece requests.
│ │ │ │ │ +struct peer_request
│ │ │ │ │  {
│ │ │ │ │ -   bool iiss__vvaalliidd () const;
│ │ │ │ │ -   void rreesseerrvvee (int num_files);
│ │ │ │ │ -   void aadddd__ffiillee__bboorrrrooww (string_view filename
│ │ │ │ │ -      , std::string const& path, std::int64_t file_size
│ │ │ │ │ -      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │ -      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ │ -   void aadddd__ffiillee__bboorrrrooww (error_code& ec, string_view filename
│ │ │ │ │ -      , std::string const& path, std::int64_t file_size
│ │ │ │ │ -      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │ -      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ │ -   void aadddd__ffiillee (std::string const& path, std::int64_t file_size
│ │ │ │ │ -      , file_flags_t file_flags = {}
│ │ │ │ │ -      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ │ -   void aadddd__ffiillee (error_code& ec, std::string const& path, std::int64_t
│ │ │ │ │ -file_size
│ │ │ │ │ -      , file_flags_t file_flags = {}
│ │ │ │ │ -      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ │ -   void rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
│ │ │ │ │ -   std::vector<file_slice> mmaapp__bblloocckk (piece_index_t piece, std::int64_t offset
│ │ │ │ │ -      , std::int64_t size) const;
│ │ │ │ │ -   peer_request mmaapp__ffiillee (file_index_t file, std::int64_t offset, int size)
│ │ │ │ │ -const;
│ │ │ │ │ -   int nnuumm__ffiilleess () const noexcept;
│ │ │ │ │ -   file_index_t eenndd__ffiillee () const noexcept;
│ │ │ │ │ -   index_range<file_index_t> ffiillee__rraannggee () const noexcept;
│ │ │ │ │ -   std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ -   int nnuumm__ppiieecceess () const;
│ │ │ │ │ -   void sseett__nnuumm__ppiieecceess (int n);
│ │ │ │ │ -   piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ -   piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │ -   index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │ -   int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ -   void sseett__ppiieeccee__lleennggtthh (int l);
│ │ │ │ │ -   int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │ -   int ppiieeccee__ssiizzee22 (piece_index_t index) const;
│ │ │ │ │ -   int bblloocckkss__iinn__ppiieeccee22 (piece_index_t index) const;
│ │ │ │ │ -   int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │ -   std::string const& nnaammee () const;
│ │ │ │ │ -   void sseett__nnaammee (std::string const& n);
│ │ │ │ │ -   void sswwaapp (file_storage& ti) noexcept;
│ │ │ │ │ -   void ccaannoonniiccaalliizzee ();
│ │ │ │ │ -   bool ppaadd__ffiillee__aatt (file_index_t index) const;
│ │ │ │ │ -   std::int64_t ffiillee__ssiizzee (file_index_t index) const;
│ │ │ │ │ -   std::int64_t ffiillee__ooffffsseett (file_index_t index) const;
│ │ │ │ │ -   std::string ssyymmlliinnkk (file_index_t index) const;
│ │ │ │ │ -   sha256_hash rroooott (file_index_t index) const;
│ │ │ │ │ -   string_view ffiillee__nnaammee (file_index_t index) const;
│ │ │ │ │ -   std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path =
│ │ │ │ │ -"") const;
│ │ │ │ │ -   std::time_t mmttiimmee (file_index_t index) const;
│ │ │ │ │ -   char const* rroooott__ppttrr (file_index_t const index) const;
│ │ │ │ │ -   sha1_hash hhaasshh (file_index_t index) const;
│ │ │ │ │ -   index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t) const;
│ │ │ │ │ -   int ffiillee__nnuumm__ppiieecceess (file_index_t index) const;
│ │ │ │ │ -   int ffiillee__nnuumm__bblloocckkss (file_index_t index) const;
│ │ │ │ │ -   int ffiillee__ffiirrsstt__bblloocckk__nnooddee (file_index_t index) const;
│ │ │ │ │ -   int ffiillee__ffiirrsstt__ppiieeccee__nnooddee (file_index_t index) const;
│ │ │ │ │ -   std::uint32_t ffiillee__ppaatthh__hhaasshh (file_index_t index, std::string const&
│ │ │ │ │ -save_path) const;
│ │ │ │ │ -   void aallll__ppaatthh__hhaasshheess (std::unordered_set<std::uint32_t>& table) const;
│ │ │ │ │ -   file_flags_t ffiillee__ffllaaggss (file_index_t index) const;
│ │ │ │ │ -   bool ffiillee__aabbssoolluuttee__ppaatthh (file_index_t index) const;
│ │ │ │ │ -   file_index_t ffiillee__iinnddeexx__aatt__ooffffsseett (std::int64_t offset) const;
│ │ │ │ │ -   file_index_t ffiillee__iinnddeexx__aatt__ppiieeccee (piece_index_t piece) const;
│ │ │ │ │ -   file_index_t ffiillee__iinnddeexx__ffoorr__rroooott (sha256_hash const& root_hash) const;
│ │ │ │ │ -   piece_index_t ppiieeccee__iinnddeexx__aatt__ffiillee (file_index_t f) const;
│ │ │ │ │ -   void ssaanniittiizzee__ssyymmlliinnkkss ();
│ │ │ │ │ -   bool vv22 () const;
│ │ │ │ │ +   bool ooppeerraattoorr==== (peer_request const& r) const;
│ │ │ │ │  
│ │ │ │ │ -   static constexpr file_flags_t ffllaagg__ppaadd__ffiillee  = 0_bit;
│ │ │ │ │ -   static constexpr file_flags_t ffllaagg__hhiiddddeenn  = 1_bit;
│ │ │ │ │ -   static constexpr file_flags_t ffllaagg__eexxeeccuuttaabbllee  = 2_bit;
│ │ │ │ │ -   static constexpr file_flags_t ffllaagg__ssyymmlliinnkk  = 3_bit;
│ │ │ │ │ +   piece_index_t piece;
│ │ │ │ │ +   int start;
│ │ │ │ │ +   int length;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iiss__vvaalliidd(()) **********
│ │ │ │ │ -bool iiss__vvaalliidd () const;
│ │ │ │ │ -returns true if the piece length has been initialized on the _f_i_l_e___s_t_o_r_a_g_e. This
│ │ │ │ │ -is typically taken as a proxy of whether the _f_i_l_e___s_t_o_r_a_g_e as a whole is
│ │ │ │ │ -initialized or not.
│ │ │ │ │ +********** ooppeerraattoorr====(()) **********
│ │ │ │ │ +bool ooppeerraattoorr==== (peer_request const& r) const;
│ │ │ │ │ +returns true if the right hand side _p_e_e_r___r_e_q_u_e_s_t refers to the same range as
│ │ │ │ │ +this does.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreesseerrvvee(()) **********
│ │ │ │ │ -void rreesseerrvvee (int num_files);
│ │ │ │ │ -allocates space for num_files in the internal file list. This can be used to
│ │ │ │ │ -avoid reallocating the internal file list when the number of files to be added
│ │ │ │ │ -is known up-front.
│ │ │ │ │ +  piece
│ │ │ │ │ +      The index of the piece in which the range starts.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__ffiillee(()) aadddd__ffiillee__bboorrrrooww(()) **********
│ │ │ │ │ -void aadddd__ffiillee__bboorrrrooww (string_view filename
│ │ │ │ │ -      , std::string const& path, std::int64_t file_size
│ │ │ │ │ -      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │ -      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ │ -void aadddd__ffiillee__bboorrrrooww (error_code& ec, string_view filename
│ │ │ │ │ -      , std::string const& path, std::int64_t file_size
│ │ │ │ │ -      , file_flags_t file_flags = {}, char const* filehash = nullptr
│ │ │ │ │ -      , std::int64_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ │ -void aadddd__ffiillee (std::string const& path, std::int64_t file_size
│ │ │ │ │ -      , file_flags_t file_flags = {}
│ │ │ │ │ -      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ │ -void aadddd__ffiillee (error_code& ec, std::string const& path, std::int64_t file_size
│ │ │ │ │ -      , file_flags_t file_flags = {}
│ │ │ │ │ -      , std::time_t mtime = 0, string_view symlink_path = string_view()
│ │ │ │ │ -      , char const* root_hash = nullptr);
│ │ │ │ │ -Adds a file to the file storage. The add_file_borrow version expects that
│ │ │ │ │ -filename is the file name (without a path) of the file that's being added. This
│ │ │ │ │ -memory is bboorrrroowweedd, i.e. it is the caller's responsibility to make sure it
│ │ │ │ │ -stays valid throughout the lifetime of this _f_i_l_e___s_t_o_r_a_g_e object or any copy of
│ │ │ │ │ -it. The same thing applies to filehash, which is an optional pointer to a 20
│ │ │ │ │ -byte binary SHA-1 hash of the file.
│ │ │ │ │ -if filename is empty, the filename from path is used and not borrowed.
│ │ │ │ │ -The path argument is the full path (in the torrent file) to the file to add.
│ │ │ │ │ -Note that this is not supposed to be an absolute path, but it is expected to
│ │ │ │ │ -include the name of the torrent as the first path element.
│ │ │ │ │ -file_size is the size of the file in bytes.
│ │ │ │ │ -The file_flags argument sets attributes on the file. The file attributes is an
│ │ │ │ │ -extension and may not work in all bittorrent clients.
│ │ │ │ │ -For possible file attributes, see file_storage::flags_t.
│ │ │ │ │ -The mtime argument is optional and can be set to 0. If non-zero, it is the
│ │ │ │ │ -posix time of the last modification time of this file.
│ │ │ │ │ -symlink_path is the path the file is a symlink to. To make this a symlink you
│ │ │ │ │ -also need to set the _f_i_l_e___s_t_o_r_a_g_e_:_:_f_l_a_g___s_y_m_l_i_n_k file flag.
│ │ │ │ │ -root_hash is an optional pointer to a 32 byte SHA-256 hash, being the merkle
│ │ │ │ │ -tree root hash for this file. This is only used for v2 torrents. If the root
│ │ │ │ │ -hash is specified for one file, it has to be specified for all, otherwise this
│ │ │ │ │ -function will fail. Note that the buffer root_hash points to must out-live the
│ │ │ │ │ -_f_i_l_e___s_t_o_r_a_g_e object, it will not be copied. This parameter is only used when
│ │ │ │ │ -llooaaddiinngg torrents, that already have their file hashes computed. When creating
│ │ │ │ │ -torrents, the file hashes will be computed by the piece hashes.
│ │ │ │ │ -If more files than one are added, certain restrictions to their paths apply. In
│ │ │ │ │ -a multi-file file storage (torrent), all files must share the same root
│ │ │ │ │ -directory.
│ │ │ │ │ -That is, the first path element of all files must be the same. This shared path
│ │ │ │ │ -element is also set to the name of the torrent. It can be changed by calling
│ │ │ │ │ -set_name.
│ │ │ │ │ -The overloads that take anerror_codereference will report failures via that
│ │ │ │ │ -variable, otherwisesystem_erroris thrown.
│ │ │ │ │ +  start
│ │ │ │ │ +      The byte offset within that piece where the range starts.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreennaammee__ffiillee(()) **********
│ │ │ │ │ -void rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
│ │ │ │ │ -renames the file at index to new_filename. Keep in mind that filenames are
│ │ │ │ │ -expected to be UTF-8 encoded.
│ │ │ │ │ +  length
│ │ │ │ │ +      The size of the range, in bytes.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** mmaapp__bblloocckk(()) **********
│ │ │ │ │ -std::vector<file_slice> mmaapp__bblloocckk (piece_index_t piece, std::int64_t offset
│ │ │ │ │ -      , std::int64_t size) const;
│ │ │ │ │ -returns a list of _f_i_l_e___s_l_i_c_e objects representing the portions of files the
│ │ │ │ │ -specified piece index, byte offset and size range overlaps. this is the inverse
│ │ │ │ │ -mapping of _m_a_p___f_i_l_e_(_).
│ │ │ │ │ -Preconditions of this function is that the input range is within the torrents
│ │ │ │ │ -address space. piece may not be negative and
│ │ │ │ │ -     piece * piece_size + offset + size
│ │ │ │ │ -may not exceed the total size of the torrent.
│ │ │ │ │ +************ ppiieeccee__bblloocckk ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_i_e_c_e___b_l_o_c_k_._h_p_p"
│ │ │ │ │ +struct piece_block
│ │ │ │ │ +{
│ │ │ │ │ +   ppiieeccee__bblloocckk (piece_index_t p_index, int b_index);
│ │ │ │ │ +   ppiieeccee__bblloocckk () = default;
│ │ │ │ │ +   bool ooppeerraattoorr<< (piece_block const& b) const;
│ │ │ │ │ +   bool ooppeerraattoorr==== (piece_block const& b) const;
│ │ │ │ │ +   bool ooppeerraattoorr!!== (piece_block const& b) const;
│ │ │ │ │ +
│ │ │ │ │ +   static const piece_block invalid;
│ │ │ │ │ +   piece_index_t piece_index {0};
│ │ │ │ │ +   int bblloocckk__iinnddeexx  = 0;
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** mmaapp__ffiillee(()) **********
│ │ │ │ │ -peer_request mmaapp__ffiillee (file_index_t file, std::int64_t offset, int size) const;
│ │ │ │ │ -returns a _p_e_e_r___r_e_q_u_e_s_t representing the piece index, byte offset and size the
│ │ │ │ │ -specified file range overlaps. This is the inverse mapping over _m_a_p___b_l_o_c_k_(_).
│ │ │ │ │ -Note that the peer_request return type is meant to hold bittorrent block
│ │ │ │ │ -requests, which may not be larger than 16 kiB. Mapping a range larger than that
│ │ │ │ │ -may return an overflown integer.
│ │ │ │ │ +************ ppeeeerr__iinnffoo ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___i_n_f_o_._h_p_p"
│ │ │ │ │ +holds information and statistics about one peer that libtorrent is connected to
│ │ │ │ │ +struct peer_info
│ │ │ │ │ +{
│ │ │ │ │ +   sha256_hash ii22pp__ddeessttiinnaattiioonn () const;
│ │ │ │ │ +
│ │ │ │ │ +   std::string client;
│ │ │ │ │ +   typed_bitfield<piece_index_t> pieces;
│ │ │ │ │ +   std::int64_t total_download;
│ │ │ │ │ +   std::int64_t total_upload;
│ │ │ │ │ +   time_duration last_request;
│ │ │ │ │ +   time_duration last_active;
│ │ │ │ │ +   time_duration download_queue_time;
│ │ │ │ │ +   static constexpr peer_flags_t iinntteerreessttiinngg  = 0_bit;
│ │ │ │ │ +   static constexpr peer_flags_t cchhookkeedd  = 1_bit;
│ │ │ │ │ +   static constexpr peer_flags_t rreemmoottee__iinntteerreesstteedd  = 2_bit;
│ │ │ │ │ +   static constexpr peer_flags_t rreemmoottee__cchhookkeedd  = 3_bit;
│ │ │ │ │ +   static constexpr peer_flags_t ssuuppppoorrttss__eexxtteennssiioonnss  = 4_bit;
│ │ │ │ │ +   static constexpr peer_flags_t oouuttggooiinngg__ccoonnnneeccttiioonn  = 5_bit;
│ │ │ │ │ +   static constexpr peer_flags_t llooccaall__ccoonnnneeccttiioonn  = 5_bit;
│ │ │ │ │ +   static constexpr peer_flags_t hhaannddsshhaakkee  = 6_bit;
│ │ │ │ │ +   static constexpr peer_flags_t ccoonnnneeccttiinngg  = 7_bit;
│ │ │ │ │ +   static constexpr peer_flags_t oonn__ppaarroollee  = 9_bit;
│ │ │ │ │ +   static constexpr peer_flags_t sseeeedd  = 10_bit;
│ │ │ │ │ +   static constexpr peer_flags_t ooppttiimmiissttiicc__uunncchhookkee  = 11_bit;
│ │ │ │ │ +   static constexpr peer_flags_t ssnnuubbbbeedd  = 12_bit;
│ │ │ │ │ +   static constexpr peer_flags_t uuppllooaadd__oonnllyy  = 13_bit;
│ │ │ │ │ +   static constexpr peer_flags_t eennddggaammee__mmooddee  = 14_bit;
│ │ │ │ │ +   static constexpr peer_flags_t hhoolleeppuunncchheedd  = 15_bit;
│ │ │ │ │ +   static constexpr peer_flags_t ii22pp__ssoocckkeett  = 16_bit;
│ │ │ │ │ +   static constexpr peer_flags_t uuttpp__ssoocckkeett  = 17_bit;
│ │ │ │ │ +   static constexpr peer_flags_t ssssll__ssoocckkeett  = 18_bit;
│ │ │ │ │ +   static constexpr peer_flags_t rrcc44__eennccrryypptteedd  = 19_bit;
│ │ │ │ │ +   static constexpr peer_flags_t ppllaaiinntteexxtt__eennccrryypptteedd  = 20_bit;
│ │ │ │ │ +   peer_flags_t flags;
│ │ │ │ │ +   static constexpr peer_source_flags_t ttrraacckkeerr  = 0_bit;
│ │ │ │ │ +   static constexpr peer_source_flags_t ddhhtt  = 1_bit;
│ │ │ │ │ +   static constexpr peer_source_flags_t ppeexx  = 2_bit;
│ │ │ │ │ +   static constexpr peer_source_flags_t llssdd  = 3_bit;
│ │ │ │ │ +   static constexpr peer_source_flags_t rreessuummee__ddaattaa  = 4_bit;
│ │ │ │ │ +   static constexpr peer_source_flags_t iinnccoommiinngg  = 5_bit;
│ │ │ │ │ +   peer_source_flags_t source;
│ │ │ │ │ +   int up_speed;
│ │ │ │ │ +   int down_speed;
│ │ │ │ │ +   int payload_up_speed;
│ │ │ │ │ +   int payload_down_speed;
│ │ │ │ │ +   peer_id pid;
│ │ │ │ │ +   int queue_bytes;
│ │ │ │ │ +   int request_timeout;
│ │ │ │ │ +   int send_buffer_size;
│ │ │ │ │ +   int used_send_buffer;
│ │ │ │ │ +   int receive_buffer_size;
│ │ │ │ │ +   int used_receive_buffer;
│ │ │ │ │ +   int receive_buffer_watermark;
│ │ │ │ │ +   int num_hashfails;
│ │ │ │ │ +   int download_queue_length;
│ │ │ │ │ +   int timed_out_requests;
│ │ │ │ │ +   int busy_requests;
│ │ │ │ │ +   int requests_in_buffer;
│ │ │ │ │ +   int target_dl_queue_length;
│ │ │ │ │ +   int upload_queue_length;
│ │ │ │ │ +   int failcount;
│ │ │ │ │ +   piece_index_t downloading_piece_index;
│ │ │ │ │ +   int downloading_block_index;
│ │ │ │ │ +   int downloading_progress;
│ │ │ │ │ +   int downloading_total;
│ │ │ │ │ +   static constexpr connection_type_t ssttaannddaarrdd__bbiittttoorrrreenntt  = 0_bit;
│ │ │ │ │ +   static constexpr connection_type_t wweebb__sseeeedd  = 1_bit;
│ │ │ │ │ +   static constexpr connection_type_t hhttttpp__sseeeedd  = 2_bit;
│ │ │ │ │ +   connection_type_t connection_type;
│ │ │ │ │ +   int pending_disk_bytes;
│ │ │ │ │ +   int pending_disk_read_bytes;
│ │ │ │ │ +   int send_quota;
│ │ │ │ │ +   int receive_quota;
│ │ │ │ │ +   int rtt;
│ │ │ │ │ +   int num_pieces;
│ │ │ │ │ +   int download_rate_peak;
│ │ │ │ │ +   int upload_rate_peak;
│ │ │ │ │ +   float progress;
│ │ │ │ │ +   int progress_ppm;
│ │ │ │ │ +   _t_c_p_:_:_e_n_d_p_o_i_n_t ip;
│ │ │ │ │ +   _t_c_p_:_:_e_n_d_p_o_i_n_t local_endpoint;
│ │ │ │ │ +   static constexpr bandwidth_state_flags_t bbww__iiddllee  = 0_bit;
│ │ │ │ │ +   static constexpr bandwidth_state_flags_t bbww__lliimmiitt  = 1_bit;
│ │ │ │ │ +   static constexpr bandwidth_state_flags_t bbww__nneettwwoorrkk  = 2_bit;
│ │ │ │ │ +   static constexpr bandwidth_state_flags_t bbww__ddiisskk  = 4_bit;
│ │ │ │ │ +   bandwidth_state_flags_t read_state;
│ │ │ │ │ +   bandwidth_state_flags_t write_state;
│ │ │ │ │ +};
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnuumm__ffiilleess(()) **********
│ │ │ │ │ -int nnuumm__ffiilleess () const noexcept;
│ │ │ │ │ -returns the number of files in the _f_i_l_e___s_t_o_r_a_g_e
│ │ │ │ │ +********** ii22pp__ddeessttiinnaattiioonn(()) **********
│ │ │ │ │ +sha256_hash ii22pp__ddeessttiinnaattiioonn () const;
│ │ │ │ │ +If this peer is an i2p peer, this function returns the destination address of
│ │ │ │ │ +the peer
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eenndd__ffiillee(()) **********
│ │ │ │ │ -file_index_t eenndd__ffiillee () const noexcept;
│ │ │ │ │ -returns the index of the one-past-end file in the file storage
│ │ │ │ │ +  client
│ │ │ │ │ +      A human readable string describing the software at the other end of the
│ │ │ │ │ +      connection. In some cases this information is not available, then it will
│ │ │ │ │ +      contain a string that may give away something about which software is
│ │ │ │ │ +      running in the other end. In the case of a web seed, the server type and
│ │ │ │ │ +      version will be a part of this string. This is UTF-8 encoded.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__rraannggee(()) **********
│ │ │ │ │ -index_range<file_index_t> ffiillee__rraannggee () const noexcept;
│ │ │ │ │ -returns an implementation-defined type that can be used as the container in a
│ │ │ │ │ -range-for loop. Where the values are the indices of all files in the
│ │ │ │ │ -_f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │ +  pieces
│ │ │ │ │ +      a _b_i_t_f_i_e_l_d, with one bit per piece in the torrent. Each bit tells you if
│ │ │ │ │ +      the peer has that piece (if it's set to 1) or if the peer miss that piece
│ │ │ │ │ +      (set to 0).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttoottaall__ssiizzee(()) **********
│ │ │ │ │ -std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ -returns the total number of bytes all the files in this torrent spans
│ │ │ │ │ +  total_download total_upload
│ │ │ │ │ +      the total number of bytes downloaded from and uploaded to this peer.
│ │ │ │ │ +      These numbers do not include the protocol chatter, but only the payload
│ │ │ │ │ +      data.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnuumm__ppiieecceess(()) sseett__nnuumm__ppiieecceess(()) **********
│ │ │ │ │ -int nnuumm__ppiieecceess () const;
│ │ │ │ │ -void sseett__nnuumm__ppiieecceess (int n);
│ │ │ │ │ -set and get the number of pieces in the torrent
│ │ │ │ │ +  last_request last_active
│ │ │ │ │ +      the time since we last sent a request to this peer and since any transfer
│ │ │ │ │ +      occurred with this peer
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eenndd__ppiieeccee(()) **********
│ │ │ │ │ -piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ -returns the index of the one-past-end piece in the file storage
│ │ │ │ │ +  download_queue_time
│ │ │ │ │ +      the time until all blocks in the request queue will be downloaded
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** llaasstt__ppiieeccee(()) **********
│ │ │ │ │ -piece_index_t llaasstt__ppiieeccee () const;
│ │ │ │ │ -returns the index of the last piece in the torrent. The last piece is special
│ │ │ │ │ -in that it may be smaller than the other pieces (and the other pieces are all
│ │ │ │ │ -the same size).
│ │ │ │ │ +  interesting
│ │ │ │ │ +      wwee are interested in pieces from this peer.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__rraannggee(()) **********
│ │ │ │ │ -index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │ -returns an implementation-defined type that can be used as the container in a
│ │ │ │ │ -range-for loop. Where the values are the indices of all pieces in the
│ │ │ │ │ -_f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │ +  choked
│ │ │ │ │ +      wwee have choked this peer.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__ppiieeccee__lleennggtthh(()) ppiieeccee__lleennggtthh(()) **********
│ │ │ │ │ -int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ -void sseett__ppiieeccee__lleennggtthh (int l);
│ │ │ │ │ -set and get the size of each piece in this torrent. It must be a power of two
│ │ │ │ │ -and at least 16 kiB.
│ │ │ │ │ +  remote_interested
│ │ │ │ │ +      the peer is interested in uuss
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__ssiizzee(()) **********
│ │ │ │ │ -int ppiieeccee__ssiizzee (piece_index_t index) const;
│ │ │ │ │ -returns the piece size of index. This will be the same as _p_i_e_c_e___l_e_n_g_t_h_(_),
│ │ │ │ │ -except for the last piece, which may be shorter.
│ │ │ │ │ +  remote_choked
│ │ │ │ │ +      the peer has choked uuss.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__ssiizzee22(()) **********
│ │ │ │ │ -int ppiieeccee__ssiizzee22 (piece_index_t index) const;
│ │ │ │ │ -Returns the size of the given piece. If the piece spans multiple files, only
│ │ │ │ │ -the first file is considered part of the piece. This is used for v2 torrents,
│ │ │ │ │ -where all files are piece aligned and padded. i.e. The pad files are not
│ │ │ │ │ -considered part of the piece for this purpose.
│ │ │ │ │ +  supports_extensions
│ │ │ │ │ +      means that this peer supports the _e_x_t_e_n_s_i_o_n_ _p_r_o_t_o_c_o_l.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** bblloocckkss__iinn__ppiieeccee22(()) **********
│ │ │ │ │ -int bblloocckkss__iinn__ppiieeccee22 (piece_index_t index) const;
│ │ │ │ │ -returns the number of blocks in the specified piece, for v2 torrents.
│ │ │ │ │ +  outgoing_connection
│ │ │ │ │ +      The connection was initiated by us, the peer has a listen port open, and
│ │ │ │ │ +      that port is the same as in the address of this peer. If this flag is not
│ │ │ │ │ +      set, this peer connection was opened by this peer connecting to us.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** bblloocckkss__ppeerr__ppiieeccee(()) **********
│ │ │ │ │ -int bblloocckkss__ppeerr__ppiieeccee () const;
│ │ │ │ │ -returns the number of blocks there are in the typical piece. There may be fewer
│ │ │ │ │ -in the last piece)
│ │ │ │ │ +  local_connection
│ │ │ │ │ +      deprecated synonym for outgoing_connection
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnaammee(()) sseett__nnaammee(()) **********
│ │ │ │ │ -std::string const& nnaammee () const;
│ │ │ │ │ -void sseett__nnaammee (std::string const& n);
│ │ │ │ │ -set and get the name of this torrent. For multi-file torrents, this is also the
│ │ │ │ │ -name of the root directory all the files are stored in.
│ │ │ │ │ +  handshake
│ │ │ │ │ +      The connection is opened, and waiting for the handshake. Until the
│ │ │ │ │ +      handshake is done, the peer cannot be identified.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sswwaapp(()) **********
│ │ │ │ │ -void sswwaapp (file_storage& ti) noexcept;
│ │ │ │ │ -swap all content of tthhiiss with ttii.
│ │ │ │ │ +  connecting
│ │ │ │ │ +      The connection is in a half-open state (i.e. it is being connected).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccaannoonniiccaalliizzee(()) **********
│ │ │ │ │ -void ccaannoonniiccaalliizzee ();
│ │ │ │ │ -arrange files and padding to match the canonical form required by BEP 52
│ │ │ │ │ +  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.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rroooott(()) mmttiimmee(()) ssyymmlliinnkk(()) ffiillee__ooffffsseett(()) hhaasshh(()) ppaadd__ffiillee__aatt(()) rroooott__ppttrr(())
│ │ │ │ │ -ffiillee__nnaammee(()) ffiillee__ppaatthh(()) ffiillee__ssiizzee(()) **********
│ │ │ │ │ -bool ppaadd__ffiillee__aatt (file_index_t index) const;
│ │ │ │ │ -std::int64_t ffiillee__ssiizzee (file_index_t index) const;
│ │ │ │ │ -std::int64_t ffiillee__ooffffsseett (file_index_t index) const;
│ │ │ │ │ -std::string ssyymmlliinnkk (file_index_t index) const;
│ │ │ │ │ -sha256_hash rroooott (file_index_t index) const;
│ │ │ │ │ -string_view ffiillee__nnaammee (file_index_t index) const;
│ │ │ │ │ -std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path = "")
│ │ │ │ │ -const;
│ │ │ │ │ -std::time_t mmttiimmee (file_index_t index) const;
│ │ │ │ │ -char const* rroooott__ppttrr (file_index_t const index) const;
│ │ │ │ │ -sha1_hash hhaasshh (file_index_t index) const;
│ │ │ │ │ -These functions are used to query attributes of files at a given index.
│ │ │ │ │ -The hash() is a SHA-1 hash of the file, or 0 if none was provided in the
│ │ │ │ │ -torrent file. This can potentially be used to join a bittorrent network with
│ │ │ │ │ -other file sharing networks.
│ │ │ │ │ -root() returns the SHA-256 merkle tree root of the specified file, in case this
│ │ │ │ │ -is a v2 torrent. Otherwise returns zeros. root_ptr() returns a pointer to the
│ │ │ │ │ -SHA-256 merkle tree root hash for the specified file. The pointer points into
│ │ │ │ │ -storage referred to when the file was added, it is not owned by this object.
│ │ │ │ │ -Torrents that are not v2 torrents return nullptr.
│ │ │ │ │ -The mtime() is the modification time is the posix time when a file was last
│ │ │ │ │ -modified when the torrent was created, or 0 if it was not included in the
│ │ │ │ │ -torrent file.
│ │ │ │ │ -file_path() returns the full path to a file.
│ │ │ │ │ -file_size() returns the size of a file.
│ │ │ │ │ -pad_file_at() returns true if the file at the given index is a pad-file.
│ │ │ │ │ -file_name() returns jjuusstt the name of the file, whereas file_path() returns the
│ │ │ │ │ -path (inside the torrent file) with the filename appended.
│ │ │ │ │ -file_offset() returns the byte offset within the torrent file where this file
│ │ │ │ │ -starts. It can be used to map the file to a piece index (given the piece size).
│ │ │ │ │ +  seed
│ │ │ │ │ +      This peer is a seed (it has all the pieces).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__ppiieeccee__rraannggee(()) ffiillee__nnuumm__bblloocckkss(()) ffiillee__nnuumm__ppiieecceess(()) **********
│ │ │ │ │ -index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t) const;
│ │ │ │ │ -int ffiillee__nnuumm__ppiieecceess (file_index_t index) const;
│ │ │ │ │ -int ffiillee__nnuumm__bblloocckkss (file_index_t index) const;
│ │ │ │ │ -Returns the number of pieces or blocks the file atindexspans, under the
│ │ │ │ │ -assumption that the file is aligned to the start of a piece. This is only
│ │ │ │ │ -meaningful for v2 torrents, where files are guaranteed such alignment. These
│ │ │ │ │ -numbers are used to size and navigate the merkle hash tree for each file.
│ │ │ │ │ +  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.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__ffiirrsstt__ppiieeccee__nnooddee(()) ffiillee__ffiirrsstt__bblloocckk__nnooddee(()) **********
│ │ │ │ │ -int ffiillee__ffiirrsstt__bblloocckk__nnooddee (file_index_t index) const;
│ │ │ │ │ -int ffiillee__ffiirrsstt__ppiieeccee__nnooddee (file_index_t index) const;
│ │ │ │ │ -index of first piece node in the merkle tree
│ │ │ │ │ +  snubbed
│ │ │ │ │ +      This peer has recently failed to send a block within the request timeout
│ │ │ │ │ +      from when the request was sent. We're currently picking one block at a
│ │ │ │ │ +      time from this peer.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__ppaatthh__hhaasshh(()) **********
│ │ │ │ │ -std::uint32_t ffiillee__ppaatthh__hhaasshh (file_index_t index, std::string const& save_path)
│ │ │ │ │ -const;
│ │ │ │ │ -returns the crc32 hash of file_path(index)
│ │ │ │ │ +  upload_only
│ │ │ │ │ +      This peer has either explicitly (with an extension) or implicitly (by
│ │ │ │ │ +      becoming a seed) told us that it will not downloading anything more,
│ │ │ │ │ +      regardless of which pieces we have.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aallll__ppaatthh__hhaasshheess(()) **********
│ │ │ │ │ -void aallll__ppaatthh__hhaasshheess (std::unordered_set<std::uint32_t>& table) const;
│ │ │ │ │ -this will add the CRC32 hash of all directory entries to the table. No filename
│ │ │ │ │ -will be included, just directories. Every depth of directories are added
│ │ │ │ │ -separately to allow test for collisions with files at all levels. i.e. if one
│ │ │ │ │ -path in the torrent is foo/bar/baz, the CRC32 hashes for foo, foo/bar and foo/
│ │ │ │ │ -bar/baz will be added to the set.
│ │ │ │ │ +  endgame_mode
│ │ │ │ │ +      This means the last time this peer picket a piece, it could not pick as
│ │ │ │ │ +      many as it wanted because there were not enough free ones. i.e. all
│ │ │ │ │ +      pieces this peer has were already requested from other peers.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__ffllaaggss(()) **********
│ │ │ │ │ -file_flags_t ffiillee__ffllaaggss (file_index_t index) const;
│ │ │ │ │ -returns a bitmask of flags from file_flags_t that apply to file at index.
│ │ │ │ │ +  holepunched
│ │ │ │ │ +      This flag is set if the peer was in holepunch mode when the connection
│ │ │ │ │ +      succeeded. This typically only happens if both peers are behind a NAT and
│ │ │ │ │ +      the peers connect via the NAT holepunch mechanism.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__aabbssoolluuttee__ppaatthh(()) **********
│ │ │ │ │ -bool ffiillee__aabbssoolluuttee__ppaatthh (file_index_t index) const;
│ │ │ │ │ -returns true if the file at the specified index has been renamed to have an
│ │ │ │ │ -absolute path, i.e. is not anchored in the save path of the torrent.
│ │ │ │ │ +  i2p_socket
│ │ │ │ │ +      indicates that this socket is running on top of the I2P transport.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__iinnddeexx__aatt__ooffffsseett(()) ffiillee__iinnddeexx__aatt__ppiieeccee(()) **********
│ │ │ │ │ -file_index_t ffiillee__iinnddeexx__aatt__ooffffsseett (std::int64_t offset) const;
│ │ │ │ │ -file_index_t ffiillee__iinnddeexx__aatt__ppiieeccee (piece_index_t piece) const;
│ │ │ │ │ -returns the index of the file at the given offset in the torrent
│ │ │ │ │ +  utp_socket
│ │ │ │ │ +      indicates that this socket is a uTP socket
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__iinnddeexx__ffoorr__rroooott(()) **********
│ │ │ │ │ -file_index_t ffiillee__iinnddeexx__ffoorr__rroooott (sha256_hash const& root_hash) const;
│ │ │ │ │ -finds the file with the given root hash and returns its index if there is no
│ │ │ │ │ -file with the root hash, file_index_t{-1} is returned
│ │ │ │ │ +  ssl_socket
│ │ │ │ │ +      indicates that this socket is running on top of an SSL (TLS) channel
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__iinnddeexx__aatt__ffiillee(()) **********
│ │ │ │ │ -piece_index_t ppiieeccee__iinnddeexx__aatt__ffiillee (file_index_t f) const;
│ │ │ │ │ -returns the piece index the given file starts at
│ │ │ │ │ +  rc4_encrypted
│ │ │ │ │ +      this connection is obfuscated with RC4
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ssaanniittiizzee__ssyymmlliinnkkss(()) **********
│ │ │ │ │ -void ssaanniittiizzee__ssyymmlliinnkkss ();
│ │ │ │ │ -validate any symlinks, to ensure they all point to other files or directories
│ │ │ │ │ -inside this storage. Any invalid symlinks are updated to point to themselves.
│ │ │ │ │ +  plaintext_encrypted
│ │ │ │ │ +      the handshake of this connection was obfuscated with a Diffie-Hellman
│ │ │ │ │ +      exchange
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** vv22(()) **********
│ │ │ │ │ -bool vv22 () const;
│ │ │ │ │ -returns true if this torrent contains v2 metadata.
│ │ │ │ │ +  flags
│ │ │ │ │ +      tells you in which state the peer is in. It is set to any combination of
│ │ │ │ │ +      the peer_flags_t flags above.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  flag_pad_file
│ │ │ │ │ -      the file is a pad file. It's required to contain zeros at it will not be
│ │ │ │ │ -      saved to disk. Its purpose is to make the following file start on a piece
│ │ │ │ │ -      boundary.
│ │ │ │ │ +  tracker
│ │ │ │ │ +      The peer was received from the tracker.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  flag_hidden
│ │ │ │ │ -      this file has the hidden attribute set. This is primarily a windows
│ │ │ │ │ -      attribute
│ │ │ │ │ +  dht
│ │ │ │ │ +      The peer was received from the kademlia DHT.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  flag_executable
│ │ │ │ │ -      this file has the executable attribute set.
│ │ │ │ │ +  pex
│ │ │ │ │ +      The peer was received from the peer exchange extension.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  flag_symlink
│ │ │ │ │ -      this file is a symbolic link. It should have a link target string
│ │ │ │ │ -      associated with it.
│ │ │ │ │ +  lsd
│ │ │ │ │ +      The peer was received from the local service discovery (The peer is on
│ │ │ │ │ +      the local network).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddeeffaauulltt__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n_._h_p_p"
│ │ │ │ │ -std::unique_ptr<disk_interface> ddeeffaauulltt__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ -   io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ -the constructor function for the default storage. On systems that support
│ │ │ │ │ -memory mapped files (and a 64 bit address space) the memory mapped storage will
│ │ │ │ │ -be constructed, otherwise the portable posix storage.
│ │ │ │ │ +  resume_data
│ │ │ │ │ +      The peer was added from the fast resume data.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppoossiixx__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_s_i_x___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │ -std::unique_ptr<disk_interface> ppoossiixx__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ -   io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ -this is a simple posix disk I/O back-end, used for systems that don't have a 64
│ │ │ │ │ -bit virtual address space or don't support memory mapped files. It's
│ │ │ │ │ -implemented using portable C file functions and is single-threaded.
│ │ │ │ │ +  incoming
│ │ │ │ │ +      we received an incoming connection from this peer
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddiissaabblleedd__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_a_b_l_e_d___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │ -std::unique_ptr<disk_interface> ddiissaabblleedd__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ -   io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ -creates a disk io object that discards all data written to it, and only returns
│ │ │ │ │ -zero-buffers when read from. May be useful for testing and benchmarking.
│ │ │ │ │ +  source
│ │ │ │ │ +      a combination of flags describing from which sources this peer was
│ │ │ │ │ +      received. A combination of the peer_source_flags_t above.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ mmmmaapp__ddiisskk__iioo__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_m_m_a_p___d_i_s_k___i_o_._h_p_p"
│ │ │ │ │ -std::unique_ptr<disk_interface> mmmmaapp__ddiisskk__iioo__ccoonnssttrruuccttoorr (
│ │ │ │ │ -   io_context& ios, settings_interface const&, counters& cnt);
│ │ │ │ │ -constructs a memory mapped file disk I/O object.
│ │ │ │ │ +  up_speed down_speed
│ │ │ │ │ +      the current upload and download speed we have to and from this peer
│ │ │ │ │ +      (including any protocol messages). updated about once per second
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ssttoorraaggee__mmooddee__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_t_o_r_a_g_e___d_e_f_s_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                     |     |All pieces will be written to their final      |
│ │ │ │ │ -|                     |     |position, all files will be allocated in full  |
│ │ │ │ │ -|storage_mode_allocate|0    |when the torrent is first started. This mode   |
│ │ │ │ │ -|                     |     |minimizes fragmentation but could be a costly  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_p_e_r_a_t_i_o_n_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                     |     |All pieces will be written to the place where  |
│ │ │ │ │ -|storage_mode_sparse  |1    |they belong and sparse files will be used. This|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_s_ _t_h_e_ _r_e_c_o_m_m_e_n_d_e_d_,_ _a_n_d_ _d_e_f_a_u_l_t_ _m_o_d_e_._ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +  payload_up_speed payload_down_speed
│ │ │ │ │ +      The transfer rates of payload data only updated about once per second
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ssttaattuuss__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_t_o_r_a_g_e___d_e_f_s_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_f_a_t_a_l___d_i_s_k___e_r_r_o_r_|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_e_e_d___f_u_l_l___c_h_e_c_k_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_f_i_l_e___e_x_i_s_t_ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                |     |this is not an enum value, but a flag that can be set|
│ │ │ │ │ -|                |     |in the return from async_check_files, in case an     |
│ │ │ │ │ -|oversized_file  |16   |existing file was found larger than specified in the |
│ │ │ │ │ -|                |     |torrent. i.e. it has garbage at the end the _s_t_a_t_u_s___t |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_i_e_l_d_ _i_s_ _u_s_e_d_ _f_o_r_ _t_h_i_s_ _t_o_ _p_r_e_s_e_r_v_e_ _A_B_I_._ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +  pid
│ │ │ │ │ +      the peer's id as used in the bittorrent protocol. This id can be used to
│ │ │ │ │ +      extract 'fingerprints' from the peer. Sometimes it can tell you which
│ │ │ │ │ +      client the peer is using. See identify_client()_
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm mmoovvee__ffllaaggss__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_t_o_r_a_g_e___d_e_f_s_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|always_replace_files     |0    |replace any files in the destination when    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_p_y_i_n_g_ _o_r_ _m_o_v_i_n_g_ _t_h_e_ _s_t_o_r_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                         |     |if any files that we want to copy exist in   |
│ │ │ │ │ -|                         |     |the destination exist, fail the whole        |
│ │ │ │ │ -|                         |     |operation and don't perform any copy or move.|
│ │ │ │ │ -|                         |     |There is an inherent race condition in this  |
│ │ │ │ │ -|fail_if_exist            |1    |mode. The files are checked for existence    |
│ │ │ │ │ -|                         |     |before the operation starts. In between the  |
│ │ │ │ │ -|                         |     |check and performing the copy, the           |
│ │ │ │ │ -|                         |     |destination files may be created, in which   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_a_s_e_ _t_h_e_y_ _a_r_e_ _r_e_p_l_a_c_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                         |     |if any file exist in the target, take those  |
│ │ │ │ │ -|dont_replace             |2    |files instead of the ones we may have in the |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_o_u_r_c_e_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                         |     |don't move any source files, just forget     |
│ │ │ │ │ -|reset_save_path          |3    |about them and begin checking files at new   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_a_v_e_ _p_a_t_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|reset_save_path_unchecked|4    |don't move any source files, just change save|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_a_t_h_ _a_n_d_ _c_o_n_t_i_n_u_e_ _w_o_r_k_i_n_g_ _w_i_t_h_o_u_t_ _a_n_y_ _c_h_e_c_k_s_ |
│ │ │ │ │ -libtorrent has a _p_l_u_g_i_n interface for implementing extensions to the protocol.
│ │ │ │ │ -These can be general extensions for transferring metadata or peer exchange
│ │ │ │ │ -extensions, or it could be used to provide a way to customize the protocol to
│ │ │ │ │ -fit a particular (closed) network.
│ │ │ │ │ -In short, the _p_l_u_g_i_n interface makes it possible to:
│ │ │ │ │ -    * register extension messages (sent in the extension handshake), see
│ │ │ │ │ -      _e_x_t_e_n_s_i_o_n_s.
│ │ │ │ │ -    * add data and parse data from the extension handshake.
│ │ │ │ │ -    * send extension messages and standard bittorrent messages.
│ │ │ │ │ -    * override or block the handling of standard bittorrent messages.
│ │ │ │ │ -    * save and restore state via the _s_e_s_s_i_o_n state
│ │ │ │ │ -    * see all alerts that are posted
│ │ │ │ │ -************ aa wwoorrdd ooff ccaauuttiioonn ************
│ │ │ │ │ -Writing your own _p_l_u_g_i_n is a very easy way to introduce serious bugs such as
│ │ │ │ │ -dead locks and race conditions. Since a _p_l_u_g_i_n has access to internal
│ │ │ │ │ -structures it is also quite easy to sabotage libtorrent's operation.
│ │ │ │ │ -All the callbacks are always called from the libtorrent network thread. In case
│ │ │ │ │ -portions of your _p_l_u_g_i_n are called from other threads, typically the main
│ │ │ │ │ -thread, you cannot use any of the member functions on the internal structures
│ │ │ │ │ -in libtorrent, since those require being called from the libtorrent network
│ │ │ │ │ -thread . Furthermore, you also need to synchronize your own shared data within
│ │ │ │ │ -the _p_l_u_g_i_n, to make sure it is not accessed at the same time from the
│ │ │ │ │ -libtorrent thread (through a callback). If you need to send out a message from
│ │ │ │ │ -another thread, it is advised to use an internal queue, and do the actual
│ │ │ │ │ -sending in tick().
│ │ │ │ │ -Since the _p_l_u_g_i_n interface gives you easy access to internal structures, it is
│ │ │ │ │ -not supported as a stable API. Plugins should be considered specific to a
│ │ │ │ │ -specific version of libtorrent. Although, in practice the internals mostly
│ │ │ │ │ -don't change that dramatically.
│ │ │ │ │ -************ pplluuggiinn--iinntteerrffaaccee ************
│ │ │ │ │ -The _p_l_u_g_i_n interface consists of three base classes that the _p_l_u_g_i_n may
│ │ │ │ │ -implement. These are called _p_l_u_g_i_n, _t_o_r_r_e_n_t___p_l_u_g_i_n and _p_e_e_r___p_l_u_g_i_n. They are
│ │ │ │ │ -found in the <libtorrent/extensions.hpp> header.
│ │ │ │ │ -These plugins are instantiated for each _s_e_s_s_i_o_n, torrent and possibly each
│ │ │ │ │ -peer, respectively.
│ │ │ │ │ -For plugins that only need per torrent state, it is enough to only implement
│ │ │ │ │ -torrent_plugin and pass a constructor function or function object to session::
│ │ │ │ │ -add_extension() or torrent_handle::add_extension() (if the torrent has already
│ │ │ │ │ -been started and you want to hook in the extension at run-time).
│ │ │ │ │ -The signature of the function is:
│ │ │ │ │ -std::shared_ptr<torrent_plugin> (*)(torrent_handle const&, client_data_t);
│ │ │ │ │ -The second argument is the userdata passed to session::add_torrent() or
│ │ │ │ │ -torrent_handle::add_extension().
│ │ │ │ │ -The function should return a std::shared_ptr<torrent_plugin> which may or may
│ │ │ │ │ -not be 0. If it is a nullptr, the extension is simply ignored for this torrent.
│ │ │ │ │ -If it is a valid pointer (to a class inheriting torrent_plugin), it will be
│ │ │ │ │ -associated with this torrent and callbacks will be made on torrent events.
│ │ │ │ │ -For more elaborate plugins which require _s_e_s_s_i_o_n wide state, you would
│ │ │ │ │ -implement plugin, construct an object (in a std::shared_ptr) and pass it in to
│ │ │ │ │ -session::add_extension().
│ │ │ │ │ -************ ccuussttoomm aalleerrttss ************
│ │ │ │ │ -Since plugins are running within internal libtorrent threads, one convenient
│ │ │ │ │ -way to communicate with the client is to post custom alerts.
│ │ │ │ │ -The expected interface of any _a_l_e_r_t, apart from deriving from the _a_l_e_r_t base
│ │ │ │ │ -class, looks like this:
│ │ │ │ │ -static const int alert_type = <<uunniiqquuee aalleerrtt IIDD>>;
│ │ │ │ │ -virtual int type() const { return alert_type; }
│ │ │ │ │ -
│ │ │ │ │ -virtual std::string message() const;
│ │ │ │ │ -
│ │ │ │ │ -static const alert_category_t static_category = <<bbiittmmaasskk ooff aalleerrtt::::ccaatteeggoorryy__tt
│ │ │ │ │ -ffllaaggss>>;
│ │ │ │ │ -virtual alert_category_t category() const { return static_category; }
│ │ │ │ │ -
│ │ │ │ │ -virtual char const* what() const { return <<ssttrriinngg lliitteerraall ooff tthhee nnaammee ooff tthhiiss
│ │ │ │ │ -aalleerrtt>>; }
│ │ │ │ │ -The alert_type is used for the type-checking in alert_cast. It must not collide
│ │ │ │ │ -with any other _a_l_e_r_t. The built-in alerts in libtorrent will not use _a_l_e_r_t type
│ │ │ │ │ -IDs greater than user_alert_id. When defining your own _a_l_e_r_t, make sure it's
│ │ │ │ │ -greater than this constant.
│ │ │ │ │ -type() is the run-time equivalence of the alert_type.
│ │ │ │ │ -The message() virtual function is expected to construct a useful string
│ │ │ │ │ -representation of the _a_l_e_r_t and the event or data it represents. Something
│ │ │ │ │ -convenient to put in a log file for instance.
│ │ │ │ │ -clone() is used internally to copy alerts. The suggested implementation of
│ │ │ │ │ -simply allocating a new instance as a copy of *this is all that's expected.
│ │ │ │ │ -The static category is required for checking whether or not the category for a
│ │ │ │ │ -specific _a_l_e_r_t is enabled or not, without instantiating the _a_l_e_r_t. The category
│ │ │ │ │ -virtual function is the run-time equivalence.
│ │ │ │ │ -The what() virtual function may simply be a string literal of the class name of
│ │ │ │ │ -your _a_l_e_r_t.
│ │ │ │ │ -For more information, see the _a_l_e_r_t_ _s_e_c_t_i_o_n.
│ │ │ │ │ +  queue_bytes
│ │ │ │ │ +      the number of bytes we have requested from this peer, but not yet
│ │ │ │ │ +      received.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e_._h_p_p"
│ │ │ │ │ -the _p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e class provides a handle to the internal peer
│ │ │ │ │ -connection object, to be used by plugins. This is a low level interface that
│ │ │ │ │ -may not be stable across libtorrent versions
│ │ │ │ │ -struct peer_connection_handle
│ │ │ │ │ -{
│ │ │ │ │ -   explicit ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee (std::weak_ptr<peer_connection> impl);
│ │ │ │ │ -   connection_type ttyyppee () const;
│ │ │ │ │ -   void aadddd__eexxtteennssiioonn (std::shared_ptr<peer_plugin>);
│ │ │ │ │ -   peer_plugin const* ffiinndd__pplluuggiinn (string_view type) const;
│ │ │ │ │ -   bool iiss__sseeeedd () const;
│ │ │ │ │ -   bool uuppllooaadd__oonnllyy () const;
│ │ │ │ │ -   bool hhaass__ppiieeccee (piece_index_t i) const;
│ │ │ │ │ -   peer_id const& ppiidd () const;
│ │ │ │ │ -   bool iiss__cchhookkeedd () const;
│ │ │ │ │ -   bool iiss__iinntteerreessttiinngg () const;
│ │ │ │ │ -   bool hhaass__ppeeeerr__cchhookkeedd () const;
│ │ │ │ │ -   bool iiss__ppeeeerr__iinntteerreesstteedd () const;
│ │ │ │ │ -   void mmaayybbee__uunncchhookkee__tthhiiss__ppeeeerr ();
│ │ │ │ │ -   void cchhookkee__tthhiiss__ppeeeerr ();
│ │ │ │ │ -   void ggeett__ppeeeerr__iinnffoo (peer_info& p) const;
│ │ │ │ │ -   torrent_handle aassssoocciiaatteedd__ttoorrrreenntt () const;
│ │ │ │ │ -   _t_c_p_:_:_e_n_d_p_o_i_n_t const& rreemmoottee () const;
│ │ │ │ │ -   _t_c_p_:_:_e_n_d_p_o_i_n_t llooccaall__eennddppooiinntt () const;
│ │ │ │ │ -   void ddiissccoonnnneecctt (error_code const& ec, operation_t op
│ │ │ │ │ -      , disconnect_severity_t = peer_connection_interface::normal);
│ │ │ │ │ -   bool iiss__oouuttggooiinngg () const;
│ │ │ │ │ -   bool iiss__ddiissccoonnnneeccttiinngg () const;
│ │ │ │ │ -   bool iiss__ccoonnnneeccttiinngg () const;
│ │ │ │ │ -   bool iiggnnoorree__uunncchhookkee__sslloottss () const;
│ │ │ │ │ -   bool oonn__llooccaall__nneettwwoorrkk () const;
│ │ │ │ │ -   bool ffaaiilleedd () const;
│ │ │ │ │ -   void ppeeeerr__lloogg (peer_log_alert::direction_t direction
│ │ │ │ │ -      , char const* event, char const* fmt = "", ...) const TORRENT_FORMAT
│ │ │ │ │ -(4,5);
│ │ │ │ │ -   bool sshhoouulldd__lloogg (peer_log_alert::direction_t direction) const;
│ │ │ │ │ -   bool ccaann__ddiissccoonnnneecctt (error_code const& ec) const;
│ │ │ │ │ -   bool hhaass__mmeettaaddaattaa () const;
│ │ │ │ │ -   bool iinn__hhaannddsshhaakkee () const;
│ │ │ │ │ -   void sseenndd__bbuuffffeerr (char const* begin, int size);
│ │ │ │ │ -   std::time_t llaasstt__sseeeenn__ccoommpplleettee () const;
│ │ │ │ │ -   time_point ttiimmee__ooff__llaasstt__uunncchhookkee () const;
│ │ │ │ │ -   bool ooppeerraattoorr<< (peer_connection_handle const& o) const;
│ │ │ │ │ -   bool ooppeerraattoorr!!== (peer_connection_handle const& o) const;
│ │ │ │ │ -   bool ooppeerraattoorr==== (peer_connection_handle const& o) const;
│ │ │ │ │ -   std::shared_ptr<peer_connection> nnaattiivvee__hhaannddllee () const;
│ │ │ │ │ -};
│ │ │ │ │ +  request_timeout
│ │ │ │ │ +      the number of seconds until the current front piece request will time
│ │ │ │ │ +      out. This timeout can be adjusted through settings_pack::request_timeout.
│ │ │ │ │ +      -1 means that there is not outstanding request.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ bbtt__ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e_._h_p_p"
│ │ │ │ │ -The _b_t___p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e provides a handle to the internal bittorrent peer
│ │ │ │ │ -connection object to plugins. It's low level and may not be a stable API across
│ │ │ │ │ -libtorrent versions.
│ │ │ │ │ -struct bt_peer_connection_handle : peer_connection_handle
│ │ │ │ │ -{
│ │ │ │ │ -   explicit bbtt__ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee (peer_connection_handle pc);
│ │ │ │ │ -   bool ppaacckkeett__ffiinniisshheedd () const;
│ │ │ │ │ -   bool ssuuppppoorrtt__eexxtteennssiioonnss () const;
│ │ │ │ │ -   bool ssuuppppoorrttss__eennccrryyppttiioonn () const;
│ │ │ │ │ -   void sswwiittcchh__sseenndd__ccrryyppttoo (std::shared_ptr<crypto_plugin> crypto);
│ │ │ │ │ -   void sswwiittcchh__rreeccvv__ccrryyppttoo (std::shared_ptr<crypto_plugin> crypto);
│ │ │ │ │ -   std::shared_ptr<bt_peer_connection> nnaattiivvee__hhaannddllee () const;
│ │ │ │ │ -};
│ │ │ │ │ +  send_buffer_size used_send_buffer
│ │ │ │ │ +      the number of bytes allocated and used for the peer's send buffer,
│ │ │ │ │ +      respectively.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ pplluuggiinn ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p"
│ │ │ │ │ -this is the base class for a _s_e_s_s_i_o_n _p_l_u_g_i_n. One primary feature is that it is
│ │ │ │ │ -notified of all torrents that are added to the _s_e_s_s_i_o_n, and can add its own
│ │ │ │ │ -torrent_plugins.
│ │ │ │ │ -struct plugin
│ │ │ │ │ +  receive_buffer_size used_receive_buffer receive_buffer_watermark
│ │ │ │ │ +      the number of bytes allocated and used as receive buffer, respectively.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  num_hashfails
│ │ │ │ │ +      the number of pieces this peer has participated in sending us that turned
│ │ │ │ │ +      out to fail the hash check.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  download_queue_length
│ │ │ │ │ +      this is the number of requests we have sent to this peer that we haven't
│ │ │ │ │ +      got a response for yet
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  timed_out_requests
│ │ │ │ │ +      the number of block requests that have timed out, and are still in the
│ │ │ │ │ +      download queue
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  busy_requests
│ │ │ │ │ +      the number of busy requests in the download queue. A busy request is a
│ │ │ │ │ +      request for a block we've also requested from a different peer
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  requests_in_buffer
│ │ │ │ │ +      the number of requests messages that are currently in the send buffer
│ │ │ │ │ +      waiting to be sent.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  target_dl_queue_length
│ │ │ │ │ +      the number of requests that is tried to be maintained (this is typically
│ │ │ │ │ +      a function of download speed)
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  upload_queue_length
│ │ │ │ │ +      the number of piece-requests we have received from this peer that we
│ │ │ │ │ +      haven't answered with a piece yet.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  failcount
│ │ │ │ │ +      the number of times this peer has "failed". i.e. failed to connect or
│ │ │ │ │ +      disconnected us. The failcount is decremented when we see this peer in a
│ │ │ │ │ +      tracker response or peer exchange message.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  downloading_piece_index downloading_block_index downloading_progress
│ │ │ │ │ +  downloading_total
│ │ │ │ │ +      You can know which piece, and which part of that piece, that is currently
│ │ │ │ │ +      being downloaded from a specific peer by looking at these four members.
│ │ │ │ │ +      downloading_piece_index is the index of the piece that is currently being
│ │ │ │ │ +      downloaded. This may be set to -1 if there's currently no piece
│ │ │ │ │ +      downloading from this peer. If it is >= 0, the other three members are
│ │ │ │ │ +      valid. downloading_block_index is the index of the block (or sub-piece)
│ │ │ │ │ +      that is being downloaded. downloading_progress is the number of bytes of
│ │ │ │ │ +      this block we have received from the peer, and downloading_total is the
│ │ │ │ │ +      total number of bytes in this block.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  standard_bittorrent
│ │ │ │ │ +      Regular bittorrent connection
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  web_seed
│ │ │ │ │ +      HTTP connection using the _B_E_P_ _1_9 protocol
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  http_seed
│ │ │ │ │ +      HTTP connection using the _B_E_P_ _1_7 protocol
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  connection_type
│ │ │ │ │ +      the kind of connection this peer uses. See connection_type_t.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  pending_disk_bytes
│ │ │ │ │ +      the number of bytes this peer has pending in the disk-io thread.
│ │ │ │ │ +      Downloaded and waiting to be written to disk. This is what is capped by
│ │ │ │ │ +      settings_pack::max_queued_disk_bytes.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  pending_disk_read_bytes
│ │ │ │ │ +      number of outstanding bytes to read from disk
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  send_quota receive_quota
│ │ │ │ │ +      the number of bytes this peer has been assigned to be allowed to send and
│ │ │ │ │ +      receive until it has to request more quota from the bandwidth manager.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  rtt
│ │ │ │ │ +      an estimated round trip time to this peer, in milliseconds. It is
│ │ │ │ │ +      estimated by timing the TCP connect(). It may be 0 for incoming
│ │ │ │ │ +      connections.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  num_pieces
│ │ │ │ │ +      the number of pieces this peer has.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  download_rate_peak upload_rate_peak
│ │ │ │ │ +      the highest download and upload rates seen on this connection. They are
│ │ │ │ │ +      given in bytes per second. This number is reset to 0 on reconnect.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  progress
│ │ │ │ │ +      the progress of the peer in the range [0, 1]. This is always 0 when
│ │ │ │ │ +      floating point operations are disabled, instead use progress_ppm.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  progress_ppm
│ │ │ │ │ +      indicates the download progress of the peer in the range [0, 1000000]
│ │ │ │ │ +      (parts per million).
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  ip
│ │ │ │ │ +      the IP-address to this peer. The type is an asio endpoint. For more info,
│ │ │ │ │ +      see the _a_s_i_o documentation. This field is not valid for i2p peers.
│ │ │ │ │ +      Instead use the _i_2_p___d_e_s_t_i_n_a_t_i_o_n_(_) function.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  local_endpoint
│ │ │ │ │ +      the IP and port pair the socket is bound to locally. i.e. the IP address
│ │ │ │ │ +      of the interface it's going out over. This may be useful for multi-homed
│ │ │ │ │ +      clients with multiple interfaces to the internet. This field is not valid
│ │ │ │ │ +      for i2p peers.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  bw_idle
│ │ │ │ │ +      The peer is not waiting for any external events to send or receive data.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  bw_limit
│ │ │ │ │ +      The peer is waiting for the rate limiter.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  bw_network
│ │ │ │ │ +      The peer has quota and is currently waiting for a network read or write
│ │ │ │ │ +      operation to complete. This is the state all peers are in if there are no
│ │ │ │ │ +      bandwidth limits.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  bw_disk
│ │ │ │ │ +      The peer is waiting for the disk I/O thread to catch up writing buffers
│ │ │ │ │ +      to disk before downloading more.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +  read_state write_state
│ │ │ │ │ +      bitmasks indicating what state this peer is in with regards to sending
│ │ │ │ │ +      and receiving data. The states are defined as independent flags of type
│ │ │ │ │ +      bandwidth_state_flags_t, in this class.
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ iinnffoo__hhaasshh__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_n_f_o___h_a_s_h_._h_p_p"
│ │ │ │ │ +class holding the info-hash of a torrent. It can hold a v1 info-hash (SHA-1) or
│ │ │ │ │ +a v2 info-hash (SHA-256) or both.
│ │ │ │ │ +Note
│ │ │ │ │ +If has_v2() is false then the v1 hash might actually be a truncated v2 hash
│ │ │ │ │ +struct info_hash_t
│ │ │ │ │  {
│ │ │ │ │ -   virtual feature_flags_t iimmpplleemmeenntteedd__ffeeaattuurreess ();
│ │ │ │ │ -   virtual std::shared_ptr<torrent_plugin> nneeww__ttoorrrreenntt (torrent_handle const&,
│ │ │ │ │ -client_data_t);
│ │ │ │ │ -   virtual void aaddddeedd (session_handle const&);
│ │ │ │ │ -   virtual void aabboorrtt ();
│ │ │ │ │ -   virtual bool oonn__ddhhtt__rreeqquueesstt (string_view //** qquueerryy **//
│ │ │ │ │ -      , udp::endpoint const& //** ssoouurrccee **//, bdecode_node const& //** mmeessssaaggee **//
│ │ │ │ │ -      , entry& //** rreessppoonnssee **//);
│ │ │ │ │ -   virtual void oonn__aalleerrtt (alert const*);
│ │ │ │ │ -   virtual bool oonn__uunnkknnoowwnn__ttoorrrreenntt (info_hash_t const& //** iinnffoo__hhaasshh **//
│ │ │ │ │ -      , peer_connection_handle const& //** ppcc **//, add_torrent_params& //** pp **//);
│ │ │ │ │ -   virtual void oonn__ttiicckk ();
│ │ │ │ │ -   virtual uint64_t ggeett__uunncchhookkee__pprriioorriittyy (peer_connection_handle const& //** ppeeeerr
│ │ │ │ │ -**//);
│ │ │ │ │ -   virtual std::map<std::string, std::string> ssaavvee__ssttaattee () const;
│ │ │ │ │ -   virtual void llooaadd__ssttaattee (std::map<std::string, std::string> const&);
│ │ │ │ │ +   iinnffoo__hhaasshh__tt () noexcept = default;
│ │ │ │ │ +   explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept;
│ │ │ │ │ +   explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept;
│ │ │ │ │ +   iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ │ +   bool hhaass__vv11 () const;
│ │ │ │ │ +   bool hhaass__vv22 () const;
│ │ │ │ │ +   bool hhaass (protocol_version v) const;
│ │ │ │ │ +   sha1_hash ggeett (protocol_version v) const;
│ │ │ │ │ +   sha1_hash ggeett__bbeesstt () const;
│ │ │ │ │ +   friend bool ooppeerraattoorr!!== (info_hash_t const& lhs, info_hash_t const& rhs);
│ │ │ │ │ +   friend bool ooppeerraattoorr==== (info_hash_t const& lhs, info_hash_t const& rhs)
│ │ │ │ │ +noexcept;
│ │ │ │ │ +   template <typename F> void ffoorr__eeaacchh (F f) const;
│ │ │ │ │ +   bool ooppeerraattoorr<< (info_hash_t const& o) const;
│ │ │ │ │ +   friend std::ostream& ooppeerraattoorr<<<< (std::ostream& os, info_hash_t const& ih);
│ │ │ │ │  
│ │ │ │ │ -   static constexpr feature_flags_t ooppttiimmiissttiicc__uunncchhookkee__ffeeaattuurree  = 1_bit;
│ │ │ │ │ -   static constexpr feature_flags_t ttiicckk__ffeeaattuurree  = 2_bit;
│ │ │ │ │ -   static constexpr feature_flags_t ddhhtt__rreeqquueesstt__ffeeaattuurree  = 3_bit;
│ │ │ │ │ -   static constexpr feature_flags_t aalleerrtt__ffeeaattuurree  = 4_bit;
│ │ │ │ │ -   static constexpr feature_flags_t uunnkknnoowwnn__ttoorrrreenntt__ffeeaattuurree  = 5_bit;
│ │ │ │ │ +   sha1_hash v1;
│ │ │ │ │ +   sha256_hash v2;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iimmpplleemmeenntteedd__ffeeaattuurreess(()) **********
│ │ │ │ │ -virtual feature_flags_t iimmpplleemmeenntteedd__ffeeaattuurreess ();
│ │ │ │ │ -This function is expected to return a bitmask indicating which features this
│ │ │ │ │ -_p_l_u_g_i_n implements. Some callbacks on this object may not be called unless the
│ │ │ │ │ -corresponding feature flag is returned here. Note that callbacks may still be
│ │ │ │ │ -called even if the corresponding feature is not specified in the return value
│ │ │ │ │ -here. See feature_flags_t for possible flags to return.
│ │ │ │ │ +********** iinnffoo__hhaasshh__tt(()) **********
│ │ │ │ │ +iinnffoo__hhaasshh__tt () noexcept = default;
│ │ │ │ │ +explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept;
│ │ │ │ │ +explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept;
│ │ │ │ │ +iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept;
│ │ │ │ │ +The default constructor creates an object that has neither a v1 or v2 hash.
│ │ │ │ │ +For backwards compatibility, make it possible to construct directly from a v1
│ │ │ │ │ +hash. This constructor allows iimmpplliicciitt conversion from a v1 hash, but the
│ │ │ │ │ +implicitness is deprecated.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nneeww__ttoorrrreenntt(()) **********
│ │ │ │ │ -virtual std::shared_ptr<torrent_plugin> nneeww__ttoorrrreenntt (torrent_handle const&,
│ │ │ │ │ -client_data_t);
│ │ │ │ │ -this is called by the _s_e_s_s_i_o_n every time a new torrent is added. The torrent*
│ │ │ │ │ -points to the internal torrent object created for the new torrent. The
│ │ │ │ │ -_c_l_i_e_n_t___d_a_t_a___t is the userdata pointer as passed in via _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s.
│ │ │ │ │ -If the _p_l_u_g_i_n returns a _t_o_r_r_e_n_t___p_l_u_g_i_n instance, it will be added to the new
│ │ │ │ │ -torrent. Otherwise, return an empty shared_ptr to a _t_o_r_r_e_n_t___p_l_u_g_i_n (the
│ │ │ │ │ -default).
│ │ │ │ │ +********** hhaass__vv22(()) hhaass__vv11(()) hhaass(()) **********
│ │ │ │ │ +bool hhaass__vv11 () const;
│ │ │ │ │ +bool hhaass__vv22 () const;
│ │ │ │ │ +bool hhaass (protocol_version v) const;
│ │ │ │ │ +returns true if the corresponding info hash is present in this object.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aaddddeedd(()) **********
│ │ │ │ │ -virtual void aaddddeedd (session_handle const&);
│ │ │ │ │ -called when _p_l_u_g_i_n is added to a _s_e_s_s_i_o_n
│ │ │ │ │ +********** ggeett(()) **********
│ │ │ │ │ +sha1_hash ggeett (protocol_version v) const;
│ │ │ │ │ +returns the has for the specified protocol version
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aabboorrtt(()) **********
│ │ │ │ │ -virtual void aabboorrtt ();
│ │ │ │ │ -called when the _s_e_s_s_i_o_n is aborted the _p_l_u_g_i_n should perform any cleanup
│ │ │ │ │ -necessary to allow the session's destruction (e.g. cancel outstanding async
│ │ │ │ │ -operations)
│ │ │ │ │ +********** ggeett__bbeesstt(()) **********
│ │ │ │ │ +sha1_hash ggeett__bbeesstt () const;
│ │ │ │ │ +returns the v2 (truncated) info-hash, if there is one, otherwise returns the v1
│ │ │ │ │ +info-hash
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ddhhtt__rreeqquueesstt(()) **********
│ │ │ │ │ -virtual bool oonn__ddhhtt__rreeqquueesstt (string_view //** qquueerryy **//
│ │ │ │ │ -      , udp::endpoint const& //** ssoouurrccee **//, bdecode_node const& //** mmeessssaaggee **//
│ │ │ │ │ -      , entry& //** rreessppoonnssee **//);
│ │ │ │ │ -called when a dht request is received. If your _p_l_u_g_i_n expects this to be
│ │ │ │ │ -called, make sure to include the flag dht_request_feature in the return value
│ │ │ │ │ -from _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_).
│ │ │ │ │ +********** ffoorr__eeaacchh(()) **********
│ │ │ │ │ +template <typename F> void ffoorr__eeaacchh (F f) const;
│ │ │ │ │ +calls the function object f for each hash that is available. starting with v1.
│ │ │ │ │ +The signature of F is:
│ │ │ │ │ +void(sha1_hash const&, protocol_version);
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__aalleerrtt(()) **********
│ │ │ │ │ -virtual void oonn__aalleerrtt (alert const*);
│ │ │ │ │ -called when an _a_l_e_r_t is posted alerts that are filtered are not posted. If your
│ │ │ │ │ -_p_l_u_g_i_n expects this to be called, make sure to include the flag alert_feature
│ │ │ │ │ -in the return value from _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_).
│ │ │ │ │ +************ llooaadd__ttoorrrreenntt__ppaarrsseedd(()) llooaadd__ttoorrrreenntt__ffiillee(()) llooaadd__ttoorrrreenntt__bbuuffffeerr(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_l_o_a_d___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__ffiillee (
│ │ │ │ │ +   std::string const& filename);
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr (
│ │ │ │ │ +   span<char const> buffer, load_torrent_limits const& cfg);
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__ffiillee (
│ │ │ │ │ +   std::string const& filename, load_torrent_limits const& cfg);
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__ppaarrsseedd (
│ │ │ │ │ +   bdecode_node const& torrent_file, load_torrent_limits const& cfg);
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__ppaarrsseedd (
│ │ │ │ │ +   bdecode_node const& torrent_file);
│ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr (
│ │ │ │ │ +   span<char const> buffer);
│ │ │ │ │ +These functions load the content of a .torrent file into an _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s
│ │ │ │ │ +object. The immutable part of a torrent file (the info-dictionary) is stored in
│ │ │ │ │ +the ti field in the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object (as a _t_o_r_r_e_n_t___i_n_f_o object). The
│ │ │ │ │ +returned object is suitable to be:
│ │ │ │ │ +         * added to a _s_e_s_s_i_o_n via _a_d_d___t_o_r_r_e_n_t_(_) or _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_)
│ │ │ │ │ +         * saved as a .torrent_file via _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)
│ │ │ │ │ +         * turned into a magnet link via _m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__uunnkknnoowwnn__ttoorrrreenntt(()) **********
│ │ │ │ │ -virtual bool oonn__uunnkknnoowwnn__ttoorrrreenntt (info_hash_t const& //** iinnffoo__hhaasshh **//
│ │ │ │ │ -      , peer_connection_handle const& //** ppcc **//, add_torrent_params& //** pp **//);
│ │ │ │ │ -return true if the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s should be added
│ │ │ │ │ +************ ttrruunnccaattee__ffiilleess(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_r_u_n_c_a_t_e_._h_p_p"
│ │ │ │ │ +void ttrruunnccaattee__ffiilleess (file_storage const& fs, std::string const& save_path,
│ │ │ │ │ +storage_error& ec);
│ │ │ │ │ +Truncates files larger than specified in the _f_i_l_e___s_t_o_r_a_g_e, saved under the
│ │ │ │ │ +specified save_path.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ttiicckk(()) **********
│ │ │ │ │ -virtual void oonn__ttiicckk ();
│ │ │ │ │ -called once per second. If your _p_l_u_g_i_n expects this to be called, make sure to
│ │ │ │ │ -include the flag tick_feature in the return value from _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_).
│ │ │ │ │ +************ mmaakkee__mmaaggnneett__uurrii(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_m_a_g_n_e_t___u_r_i_._h_p_p"
│ │ │ │ │ +std::string mmaakkee__mmaaggnneett__uurrii (add_torrent_params const& atp);
│ │ │ │ │ +std::string mmaakkee__mmaaggnneett__uurrii (torrent_info const& info);
│ │ │ │ │ +std::string mmaakkee__mmaaggnneett__uurrii (torrent_handle const& handle);
│ │ │ │ │ +Generates a magnet URI from the specified torrent.
│ │ │ │ │ +Several fields from the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s objects are recorded in the magnet
│ │ │ │ │ +link. In order to not include them, they have to be cleared before calling
│ │ │ │ │ +_m_a_k_e___m_a_g_n_e_t___u_r_i_(_). These fields are used:
│ │ │ │ │ +     ti, info_hashes, url_seeds, dht_nodes, file_priorities, trackers,
│ │ │ │ │ +     name, peers.
│ │ │ │ │ +Depending on what the use case for the resulting magnet link is, clearing peers
│ │ │ │ │ +and dht_nodes is probably a good idea if the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s came from a
│ │ │ │ │ +running torrent. Those lists may be long and be ephemeral.
│ │ │ │ │ +If none of the info_hashes or ti fields are set, there is not info-hash
│ │ │ │ │ +available, and a magnet link cannot be created. In this case _m_a_k_e___m_a_g_n_e_t___u_r_i_(_)
│ │ │ │ │ +returns an empty string.
│ │ │ │ │ +The recommended way to generate a magnet link from a _t_o_r_r_e_n_t___h_a_n_d_l_e is to call
│ │ │ │ │ +_s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_), which will post a _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t containing an
│ │ │ │ │ +_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object. This can then be passed to _m_a_k_e___m_a_g_n_e_t___u_r_i_(_).
│ │ │ │ │ +The overload that takes a _t_o_r_r_e_n_t___h_a_n_d_l_e will make blocking calls to query
│ │ │ │ │ +information about the torrent. If the torrent handle is invalid, an empty
│ │ │ │ │ +string is returned.
│ │ │ │ │ +For more information about magnet links, see _m_a_g_n_e_t_ _l_i_n_k_s.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett__uunncchhookkee__pprriioorriittyy(()) **********
│ │ │ │ │ -virtual uint64_t ggeett__uunncchhookkee__pprriioorriittyy (peer_connection_handle const& //** ppeeeerr **//
│ │ │ │ │ -);
│ │ │ │ │ -called when choosing peers to optimistically unchoke. The return value
│ │ │ │ │ -indicates the peer's priority for unchoking. Lower return values correspond to
│ │ │ │ │ -higher priority. Priorities above 2^63-1 are reserved. If your _p_l_u_g_i_n has no
│ │ │ │ │ -priority to assign a peer it should return 2^64-1. If your _p_l_u_g_i_n expects this
│ │ │ │ │ -to be called, make sure to include the flag optimistic_unchoke_feature in the
│ │ │ │ │ -return value from _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_). If multiple plugins implement this
│ │ │ │ │ -function the lowest return value (i.e. the highest priority) is used.
│ │ │ │ │ +************ ppaarrssee__mmaaggnneett__uurrii(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_m_a_g_n_e_t___u_r_i_._h_p_p"
│ │ │ │ │ +void ppaarrssee__mmaaggnneett__uurrii (string_view uri, add_torrent_params& p, error_code& ec);
│ │ │ │ │ +add_torrent_params ppaarrssee__mmaaggnneett__uurrii (string_view uri);
│ │ │ │ │ +add_torrent_params ppaarrssee__mmaaggnneett__uurrii (string_view uri, error_code& ec);
│ │ │ │ │ +This function parses out information from the magnet link and populates the
│ │ │ │ │ +_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object. The overload that does not take an error_code
│ │ │ │ │ +reference will throw a system_error on error The overload taking an
│ │ │ │ │ +add_torrent_params reference will fill in the fields specified in the magnet
│ │ │ │ │ +URI.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** llooaadd__ssttaattee(()) **********
│ │ │ │ │ -virtual void llooaadd__ssttaattee (std::map<std::string, std::string> const&);
│ │ │ │ │ -called on startup while loading settings state from the _s_e_s_s_i_o_n___p_a_r_a_m_s
│ │ │ │ │ +************ ttoorrrreenntt__ppeeeerr__eeqquuaall(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___p_e_e_r_._h_p_p"
│ │ │ │ │ +inline bool ttoorrrreenntt__ppeeeerr__eeqquuaall (torrent_peer const* lhs, torrent_peer const*
│ │ │ │ │ +rhs);
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ vveerrssiioonn(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ +char const* vveerrssiioonn ();
│ │ │ │ │ +returns the libtorrent version as string form in this format:
│ │ │ │ │ +"<major>.<minor>.<tiny>.<tag>"
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm eevveenntt__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_r_a_c_k_e_r___m_a_n_a_g_e_r_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_n_o_n_e_ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_c_o_m_p_l_e_t_e_d_|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_t_a_r_t_e_d_ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_t_o_p_p_e_d_ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_a_u_s_e_d_ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ppoorrttmmaapp__ttrraannssppoorrtt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_r_t_m_a_p_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_a_t_p_m_p_|_0_ _ _ _ _|_n_a_t_p_m_p_ _c_a_n_ _b_e_ _N_A_T_-_P_M_P_ _o_r_ _P_C_P|
│ │ │ │ │ +|_u_p_n_p_ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ppoorrttmmaapp__pprroottooccooll ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_o_r_t_m_a_p_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_n_o_n_e_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_t_c_p_ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_u_d_p_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm pprroottooccooll__vveerrssiioonn ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_n_f_o___h_a_s_h_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_V_1_ _ _|_0_ _ _ _ _|_T_h_e_ _o_r_i_g_i_n_a_l_ _B_i_t_T_o_r_r_e_n_t_ _v_e_r_s_i_o_n_,_ _u_s_i_n_g_ _S_H_A_-_1_ _h_a_s_h_e_s_ _ _ _ _ _ _ |
│ │ │ │ │ +|_V_2_ _ _|_1_ _ _ _ _|_V_e_r_s_i_o_n_ _2_ _o_f_ _t_h_e_ _B_i_t_T_o_r_r_e_n_t_ _p_r_o_t_o_c_o_l_,_ _u_s_i_n_g_ _S_H_A_-_2_5_6_ _h_a_s_h_e_s|
│ │ │ │ │ +|_N_U_M_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ssoocckkeett__ttyyppee__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_o_c_k_e_t___t_y_p_e_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_t_c_p_ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_o_c_k_s_5_ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_h_t_t_p_ _ _ _ _ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_u_t_p_ _ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_2_p_ _ _ _ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_t_c_p___s_s_l_ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_o_c_k_s_5___s_s_l_|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_h_t_t_p___s_s_l_ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_u_t_p___s_s_l_ _ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ccoonnnneeccttiioonn__ttyyppee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_b_i_t_t_o_r_r_e_n_t_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_u_r_l___s_e_e_d_ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_h_t_t_p___s_e_e_d_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ttoorrrreenntt__ffllaaggss__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___f_l_a_g_s_._h_p_p"
│ │ │ │ │ +  seed_mode
│ │ │ │ │ +      If seed_mode is set, libtorrent will assume that all files are present
│ │ │ │ │ +      for this torrent and that they all match the hashes in the torrent file.
│ │ │ │ │ +      Each time a peer requests to download a block, the piece is verified
│ │ │ │ │ +      against the hash, unless it has been verified already. If a hash fails,
│ │ │ │ │ +      the torrent will automatically leave the seed mode and recheck all the
│ │ │ │ │ +      files. The use case for this mode is if a torrent is created and seeded,
│ │ │ │ │ +      or if the user already know that the files are complete, this is a way to
│ │ │ │ │ +      avoid the initial file checks, and significantly reduce the startup time.
│ │ │ │ │ +      Setting seed_mode on a torrent without metadata (a .torrent file) is a
│ │ │ │ │ +      no-op and will be ignored.
│ │ │ │ │ +      It is not possible to sseett the seed_mode flag on a torrent after it has
│ │ │ │ │ +      been added to a _s_e_s_s_i_o_n. It is possible to cclleeaarr it though.
│ │ │ │ │ +  upload_mode
│ │ │ │ │ +      If upload_mode is set, the torrent will be initialized in upload-mode,
│ │ │ │ │ +      which means it will not make any piece requests. This state is typically
│ │ │ │ │ +      entered on disk I/O errors, and if the torrent is also auto managed, it
│ │ │ │ │ +      will be taken out of this state periodically (see settings_pack::
│ │ │ │ │ +      optimistic_disk_retry).
│ │ │ │ │ +      This mode can be used to avoid race conditions when adjusting priorities
│ │ │ │ │ +      of pieces before allowing the torrent to start downloading.
│ │ │ │ │ +      If the torrent is auto-managed (auto_managed), the torrent will
│ │ │ │ │ +      eventually be taken out of upload-mode, regardless of how it got there.
│ │ │ │ │ +      If it's important to manually control when the torrent leaves upload
│ │ │ │ │ +      mode, don't make it auto managed.
│ │ │ │ │ +  share_mode
│ │ │ │ │ +      determines if the torrent should be added in sshhaarree mmooddee or not. Share
│ │ │ │ │ +      mode indicates that we are not interested in downloading the torrent, but
│ │ │ │ │ +      merely want to improve our share ratio (i.e. increase it). A torrent
│ │ │ │ │ +      started in share mode will do its best to never download more than it
│ │ │ │ │ +      uploads to the swarm. If the swarm does not have enough demand for upload
│ │ │ │ │ +      capacity, the torrent will not download anything. This mode is intended
│ │ │ │ │ +      to be safe to add any number of torrents to, without manual screening,
│ │ │ │ │ +      without the risk of downloading more than is uploaded.
│ │ │ │ │ +      A torrent in share mode sets the priority to all pieces to 0, except for
│ │ │ │ │ +      the pieces that are downloaded, when pieces are decided to be downloaded.
│ │ │ │ │ +      This affects the progress bar, which might be set to "100% finished" most
│ │ │ │ │ +      of the time. Do not change file or piece priorities for torrents in share
│ │ │ │ │ +      mode, it will make it not work.
│ │ │ │ │ +      The share mode has one setting, the share ratio target, see
│ │ │ │ │ +      settings_pack::share_mode_target for more info.
│ │ │ │ │ +  apply_ip_filter
│ │ │ │ │ +      determines if the IP filter should apply to this torrent or not. By
│ │ │ │ │ +      default all torrents are subject to filtering by the IP filter (i.e. this
│ │ │ │ │ +      flag is set by default). This is useful if certain torrents needs to be
│ │ │ │ │ +      exempt for some reason, being an auto-update torrent for instance.
│ │ │ │ │ +  paused
│ │ │ │ │ +      specifies whether or not the torrent is paused. i.e. it won't connect to
│ │ │ │ │ +      the tracker or any of the peers until it's resumed. Note that a paused
│ │ │ │ │ +      torrent that also has the auto_managed flag set can be started at any
│ │ │ │ │ +      time by libtorrent's queuing logic. See _q_u_e_u_i_n_g.
│ │ │ │ │ +  auto_managed
│ │ │ │ │ +      If the torrent is auto-managed (auto_managed), the torrent may be resumed
│ │ │ │ │ +      at any point, regardless of how it paused. If it's important to manually
│ │ │ │ │ +      control when the torrent is paused and resumed, don't make it auto
│ │ │ │ │ +      managed.
│ │ │ │ │ +      If auto_managed is set, the torrent will be queued, started and seeded
│ │ │ │ │ +      automatically by libtorrent. When this is set, the torrent should also be
│ │ │ │ │ +      started as paused. The default queue order is the order the torrents were
│ │ │ │ │ +      added. They are all downloaded in that order. For more details, see
│ │ │ │ │ +      _q_u_e_u_i_n_g.
│ │ │ │ │ +  duplicate_is_error
│ │ │ │ │ +      used in _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s to indicate that it's an error to attempt to
│ │ │ │ │ +      add a torrent that's already in the _s_e_s_s_i_o_n. If it's not considered an
│ │ │ │ │ +      error, a handle to the existing torrent is returned. This flag is not
│ │ │ │ │ +      saved by _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_), since it is only meant for adding torrents.
│ │ │ │ │ +  update_subscribe
│ │ │ │ │ +      on by default and means that this torrent will be part of state updates
│ │ │ │ │ +      when calling _p_o_s_t___t_o_r_r_e_n_t___u_p_d_a_t_e_s_(_). This flag is not saved by
│ │ │ │ │ +      _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_).
│ │ │ │ │ +  super_seeding
│ │ │ │ │ +      sets the torrent into super seeding/initial seeding mode. If the torrent
│ │ │ │ │ +      is not a seed, this flag has no effect.
│ │ │ │ │ +  sequential_download
│ │ │ │ │ +      sets the sequential download state for the torrent. In this mode the
│ │ │ │ │ +      piece picker will pick pieces with low index numbers before pieces with
│ │ │ │ │ +      high indices. The actual pieces that are picked depend on other factors
│ │ │ │ │ +      still, such as which pieces a peer has and whether it is in parole mode
│ │ │ │ │ +      or "prefer whole pieces"-mode. Sequential mode is not ideal for streaming
│ │ │ │ │ +      media. For that, see _s_e_t___p_i_e_c_e___d_e_a_d_l_i_n_e_(_) instead.
│ │ │ │ │ +  stop_when_ready
│ │ │ │ │ +      When this flag is set, the torrent will ffoorrccee ssttoopp whenever it
│ │ │ │ │ +      transitions from a non-data-transferring state into a data-transferring
│ │ │ │ │ +      state (referred to as being ready to download or seed). This is useful
│ │ │ │ │ +      for torrents that should not start downloading or seeding yet, but want
│ │ │ │ │ +      to be made ready to do so. A torrent may need to have its files checked
│ │ │ │ │ +      for instance, so it needs to be started and possibly queued for checking
│ │ │ │ │ +      (auto-managed and started) but as soon as it's done, it should be
│ │ │ │ │ +      stopped.
│ │ │ │ │ +      FFoorrccee ssttooppppeedd means auto-managed is set to false and it's paused. As if
│ │ │ │ │ +      the auto_manages flag is cleared and the paused flag is set on the
│ │ │ │ │ +      torrent.
│ │ │ │ │ +      Note that the torrent may transition into a downloading state while
│ │ │ │ │ +      setting this flag, and since the logic is edge triggered you may miss the
│ │ │ │ │ +      edge. To avoid this race, if the torrent already is in a downloading
│ │ │ │ │ +      state when this call is made, it will trigger the stop-when-ready
│ │ │ │ │ +      immediately.
│ │ │ │ │ +      When the stop-when-ready logic fires, the flag is cleared. Any subsequent
│ │ │ │ │ +      transitions between downloading and non-downloading states will not be
│ │ │ │ │ +      affected, until this flag is set again.
│ │ │ │ │ +      The behavior is more robust when setting this flag as part of adding the
│ │ │ │ │ +      torrent. See _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s.
│ │ │ │ │ +      The stop-when-ready flag fixes the inherent race condition of waiting for
│ │ │ │ │ +      the _s_t_a_t_e___c_h_a_n_g_e_d___a_l_e_r_t and then call _p_a_u_s_e_(_). The download/seeding will
│ │ │ │ │ +      most likely start in between posting the _a_l_e_r_t and receiving the call to
│ │ │ │ │ +      pause.
│ │ │ │ │ +      A downloading state is one where peers are being connected. Which means
│ │ │ │ │ +      just downloading the metadata via the ut_metadata extension counts as a
│ │ │ │ │ +      downloading state. In order to stop a torrent once the metadata has been
│ │ │ │ │ +      downloaded, instead set all file priorities to dont_download
│ │ │ │ │ +  override_trackers
│ │ │ │ │ +      when this flag is set, the tracker list in the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object
│ │ │ │ │ +      override any trackers from the torrent file. If the flag is not set, the
│ │ │ │ │ +      trackers from the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object will be added to the list of
│ │ │ │ │ +      trackers used by the torrent. This flag is set by _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) if
│ │ │ │ │ +      there are trackers present in the resume data file. This effectively
│ │ │ │ │ +      makes the trackers saved in the resume data take precedence over the
│ │ │ │ │ +      original trackers. This includes if there's an empty list of trackers, to
│ │ │ │ │ +      support the case where they were explicitly removed in the previous
│ │ │ │ │ +      _s_e_s_s_i_o_n. This flag is not saved by _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ +  override_web_seeds
│ │ │ │ │ +      If this flag is set, the web seeds from the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object
│ │ │ │ │ +      will override any web seeds in the torrent file. If it's not set, web
│ │ │ │ │ +      seeds in the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object will be added to the list of web
│ │ │ │ │ +      seeds used by the torrent. This flag is set by _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) if
│ │ │ │ │ +      there are web seeds present in the resume data file. This effectively
│ │ │ │ │ +      makes the web seeds saved in the resume data take precedence over the
│ │ │ │ │ +      original ones. This includes if there's an empty list of web seeds, to
│ │ │ │ │ +      support the case where they were explicitly removed in the previous
│ │ │ │ │ +      _s_e_s_s_i_o_n. This flag is not saved by _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_)
│ │ │ │ │ +  need_save_resume
│ │ │ │ │ +      if this flag is set (which it is by default) the torrent will be
│ │ │ │ │ +      considered needing to save its resume data immediately, in the category
│ │ │ │ │ +      if_metadata_changed. See resume_data_flags_t and _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) for
│ │ │ │ │ +      details.
│ │ │ │ │ +      This flag is cleared by a successful call to _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) This flag
│ │ │ │ │ +      is not saved by _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_), since it represents an ephemeral
│ │ │ │ │ +      state of a running torrent.
│ │ │ │ │ +  disable_dht
│ │ │ │ │ +      set this flag to disable DHT for this torrent. This lets you have the DHT
│ │ │ │ │ +      enabled for the whole client, and still have specific torrents not
│ │ │ │ │ +      participating in it. i.e. not announcing to the DHT nor picking up peers
│ │ │ │ │ +      from it.
│ │ │ │ │ +  disable_lsd
│ │ │ │ │ +      set this flag to disable local service discovery for this torrent.
│ │ │ │ │ +  disable_pex
│ │ │ │ │ +      set this flag to disable peer exchange for this torrent.
│ │ │ │ │ +  no_verify_files
│ │ │ │ │ +      if this flag is set, the resume data will be assumed to be correct
│ │ │ │ │ +      without validating it against any files on disk. This may be used when
│ │ │ │ │ +      restoring a _s_e_s_s_i_o_n by loading resume data from disk. It will save time
│ │ │ │ │ +      and also delay any hard disk errors until files are actually needed. If
│ │ │ │ │ +      the resume data cannot be trusted, or if a torrent is added for the first
│ │ │ │ │ +      time to some save path that may already have some of the files, this flag
│ │ │ │ │ +      should not be set.
│ │ │ │ │ +  default_dont_download
│ │ │ │ │ +      default all file priorities to dont_download. This is useful for adding
│ │ │ │ │ +      magnet links where the number of files is unknown, but the
│ │ │ │ │ +      file_priorities is still set for some files. Any file not covered by the
│ │ │ │ │ +      file_priorities list will be set to normal download priority, unless this
│ │ │ │ │ +      flag is set, in which case they will be set to 0 (dont_download).
│ │ │ │ │ +  i2p_torrent
│ │ │ │ │ +      this flag makes the torrent be considered an "i2p torrent" for purposes
│ │ │ │ │ +      of the allow_i2p_mixed setting. When mixing regular peers and i2p peers
│ │ │ │ │ +      is disabled, i2p torrents won't add normal peers to its peer list. Note
│ │ │ │ │ +      that non i2p torrents may still allow i2p peers (on the off-chance that a
│ │ │ │ │ +      tracker return them and the _s_e_s_s_i_o_n is configured with a SAM connection).
│ │ │ │ │ +      This flag is set automatically when adding a torrent that has at least
│ │ │ │ │ +      one tracker whose hostname ends with .i2p. It's also set by
│ │ │ │ │ +      _p_a_r_s_e___m_a_g_n_e_t___u_r_i_(_) if the tracker list contains such URL.
│ │ │ │ │ +  all
│ │ │ │ │ +      all torrent flags combined. Can conveniently be used when creating masks
│ │ │ │ │ +      for flags
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  optimistic_unchoke_feature
│ │ │ │ │ -      include this bit if your _p_l_u_g_i_n needs to alter the order of the
│ │ │ │ │ -      optimistic unchoke of peers. i.e. have the on_optimistic_unchoke()
│ │ │ │ │ -      callback be called.
│ │ │ │ │ +************ iinntt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ +  version_major
│ │ │ │ │ +      the major, minor and tiny versions of libtorrent
│ │ │ │ │ +  version_minor
│ │ │ │ │ +      the major, minor and tiny versions of libtorrent
│ │ │ │ │ +  version_tiny
│ │ │ │ │ +      the major, minor and tiny versions of libtorrent
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  tick_feature
│ │ │ │ │ -      include this bit if your _p_l_u_g_i_n needs to have _o_n___t_i_c_k_(_) called
│ │ │ │ │ +************ ppeexx__ffllaaggss__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_x___f_l_a_g_s_._h_p_p"
│ │ │ │ │ +  pex_encryption
│ │ │ │ │ +      the peer supports protocol encryption
│ │ │ │ │ +  pex_seed
│ │ │ │ │ +      the peer is a seed
│ │ │ │ │ +  pex_utp
│ │ │ │ │ +      the peer supports the uTP, transport protocol over UDP.
│ │ │ │ │ +  pex_holepunch
│ │ │ │ │ +      the peer supports the holepunch extension If this flag is received from a
│ │ │ │ │ +      peer, it can be used as a rendezvous point in case direct connections to
│ │ │ │ │ +      the peer fail
│ │ │ │ │ +  pex_lt_v2
│ │ │ │ │ +      protocol v2 this is not a standard flag, it is only used internally
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  dht_request_feature
│ │ │ │ │ -      include this bit if your _p_l_u_g_i_n needs to have _o_n___d_h_t___r_e_q_u_e_s_t_(_) called
│ │ │ │ │ +************ cchhaarr ccoonnsstt** ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ +  version_str
│ │ │ │ │ +      the libtorrent version in string form
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  alert_feature
│ │ │ │ │ -      include this bit if your _p_l_u_g_i_n needs to have _o_n___a_l_e_r_t_(_) called
│ │ │ │ │ +************ ssttdd::::uuiinntt6644__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_v_e_r_s_i_o_n_._h_p_p"
│ │ │ │ │ +  version_revision
│ │ │ │ │ +      the git commit of this libtorrent version
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  unknown_torrent_feature
│ │ │ │ │ -      include this bit if your _p_l_u_g_i_n needs to have _o_n___u_n_k_n_o_w_n___t_o_r_r_e_n_t_(_) called
│ │ │ │ │ -      even if there is no active torrent in the _s_e_s_s_i_o_n
│ │ │ │ │ +************ ddoowwnnllooaadd__pprriioorriittyy__tt ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y_._h_p_p"
│ │ │ │ │ +  dont_download
│ │ │ │ │ +      Don't download the file or piece. Partial pieces may still be downloaded
│ │ │ │ │ +      when setting file priorities.
│ │ │ │ │ +  default_priority
│ │ │ │ │ +      The default priority for files and pieces.
│ │ │ │ │ +  low_priority
│ │ │ │ │ +      The lowest priority for files and pieces.
│ │ │ │ │ +  top_priority
│ │ │ │ │ +      The highest priority for files and pieces.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ttoorrrreenntt__pplluuggiinn ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p"
│ │ │ │ │ -Torrent plugins are associated with a single torrent and have a number of
│ │ │ │ │ -functions called at certain events. Many of its functions have the ability to
│ │ │ │ │ -change or override the default libtorrent behavior.
│ │ │ │ │ -struct torrent_plugin
│ │ │ │ │ +************ bbddeeccooddee__nnooddee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ +Sometimes it's important to get a non-owning reference to the root node ( to be
│ │ │ │ │ +able to copy it as a reference for instance). For that, use the _n_o_n___o_w_n_i_n_g_(_)
│ │ │ │ │ +member function.
│ │ │ │ │ +There are 5 different types of nodes, see _t_y_p_e___t.
│ │ │ │ │ +struct bdecode_node
│ │ │ │ │  {
│ │ │ │ │ -   virtual std::shared_ptr<peer_plugin> nneeww__ccoonnnneeccttiioonn (peer_connection_handle
│ │ │ │ │ -const&);
│ │ │ │ │ -   virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ -   virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │ -   virtual void ttiicckk ();
│ │ │ │ │ -   virtual bool oonn__rreessuummee ();
│ │ │ │ │ -   virtual bool oonn__ppaauussee ();
│ │ │ │ │ -   virtual void oonn__ffiilleess__cchheecckkeedd ();
│ │ │ │ │ -   virtual void oonn__ssttaattee (torrent_status::state_t);
│ │ │ │ │ -   virtual void oonn__aadddd__ppeeeerr (tcp::endpoint const&,
│ │ │ │ │ -      peer_source_flags_t, add_peer_flags_t);
│ │ │ │ │ +   bbddeeccooddee__nnooddee () = default;
│ │ │ │ │ +   bbddeeccooddee__nnooddee (bdecode_node&&) noexcept;
│ │ │ │ │ +   bdecode_node& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │ +   bdecode_node& ooppeerraattoorr== (bdecode_node&&) & = default;
│ │ │ │ │ +   bbddeeccooddee__nnooddee (bdecode_node const&);
│ │ │ │ │ +   type_t ttyyppee () const noexcept;
│ │ │ │ │ +   explicit operator bbooooll () const noexcept;
│ │ │ │ │ +   bdecode_node nnoonn__oowwnniinngg () const;
│ │ │ │ │ +   std::ptrdiff_t ddaattaa__ooffffsseett () const noexcept;
│ │ │ │ │ +   span<char const> ddaattaa__sseeccttiioonn () const noexcept;
│ │ │ │ │ +   bdecode_node lliisstt__aatt (int i) const;
│ │ │ │ │ +   string_view lliisstt__ssttrriinngg__vvaalluuee__aatt (int i
│ │ │ │ │ +      , string_view default_val = string_view()) const;
│ │ │ │ │ +   int lliisstt__ssiizzee () const;
│ │ │ │ │ +   std::int64_t lliisstt__iinntt__vvaalluuee__aatt (int i
│ │ │ │ │ +      , std::int64_t default_val = 0) const;
│ │ │ │ │ +   bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const;
│ │ │ │ │ +   string_view ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee (string_view key
│ │ │ │ │ +      , string_view default_value = string_view()) const;
│ │ │ │ │ +   int ddiicctt__ssiizzee () const;
│ │ │ │ │ +   bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const;
│ │ │ │ │ +   std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key
│ │ │ │ │ +      , std::int64_t default_val = 0) const;
│ │ │ │ │ +   bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const;
│ │ │ │ │ +   bdecode_node ddiicctt__ffiinndd (string_view key) const;
│ │ │ │ │ +   std::pair<bdecode_node, bdecode_node> ddiicctt__aatt__nnooddee (int i) const;
│ │ │ │ │ +   std::pair<string_view, bdecode_node> ddiicctt__aatt (int i) const;
│ │ │ │ │ +   bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const;
│ │ │ │ │ +   std::int64_t iinntt__vvaalluuee () const;
│ │ │ │ │ +   char const* ssttrriinngg__ppttrr () const;
│ │ │ │ │ +   std::ptrdiff_t ssttrriinngg__ooffffsseett () const;
│ │ │ │ │ +   string_view ssttrriinngg__vvaalluuee () const;
│ │ │ │ │ +   int ssttrriinngg__lleennggtthh () const;
│ │ │ │ │ +   void cclleeaarr ();
│ │ │ │ │ +   void sswwaapp (bdecode_node& n);
│ │ │ │ │ +   void rreesseerrvvee (int tokens);
│ │ │ │ │ +   void sswwiittcchh__uunnddeerrllyyiinngg__bbuuffffeerr (char const* buf) noexcept;
│ │ │ │ │ +   bool hhaass__ssoofftt__eerrrroorr (span<char> error) const;
│ │ │ │ │  
│ │ │ │ │ -   static constexpr add_peer_flags_t ffiirrsstt__ttiimmee  = 1_bit;
│ │ │ │ │ -   static constexpr add_peer_flags_t ffiilltteerreedd  = 2_bit;
│ │ │ │ │ +   enum type_t
│ │ │ │ │ +   {
│ │ │ │ │ +      none_t,
│ │ │ │ │ +      dict_t,
│ │ │ │ │ +      list_t,
│ │ │ │ │ +      string_t,
│ │ │ │ │ +      int_t,
│ │ │ │ │ +   };
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nneeww__ccoonnnneeccttiioonn(()) **********
│ │ │ │ │ -virtual std::shared_ptr<peer_plugin> nneeww__ccoonnnneeccttiioonn (peer_connection_handle
│ │ │ │ │ -const&);
│ │ │ │ │ -This function is called each time a new peer is connected to the torrent. You
│ │ │ │ │ -may choose to ignore this by just returning a default constructed shared_ptr
│ │ │ │ │ -(in which case you don't need to override this member function).
│ │ │ │ │ -If you need an extension to the peer connection (which most plugins do) you are
│ │ │ │ │ -supposed to return an instance of your _p_e_e_r___p_l_u_g_i_n class. Which in turn will
│ │ │ │ │ -have its hook functions called on event specific to that peer.
│ │ │ │ │ -The peer_connection_handle will be valid as long as the shared_ptr is being
│ │ │ │ │ -held by the torrent object. So, it is generally a good idea to not keep a
│ │ │ │ │ -shared_ptr to your own _p_e_e_r___p_l_u_g_i_n. If you want to keep references to it, use
│ │ │ │ │ -weak_ptr.
│ │ │ │ │ -If this function throws an exception, the connection will be closed.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ppiieeccee__ffaaiilleedd(()) oonn__ppiieeccee__ppaassss(()) **********
│ │ │ │ │ -virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ -virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │ -These hooks are called when a piece passes the hash check or fails the hash
│ │ │ │ │ -check, respectively. The index is the piece index that was downloaded. It is
│ │ │ │ │ -possible to access the list of peers that participated in sending the piece
│ │ │ │ │ -through the torrent and the piece_picker.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttiicckk(()) **********
│ │ │ │ │ -virtual void ttiicckk ();
│ │ │ │ │ -This hook is called approximately once per second. It is a way of making it
│ │ │ │ │ -easy for plugins to do timed events, for sending messages or whatever.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__rreessuummee(()) oonn__ppaauussee(()) **********
│ │ │ │ │ -virtual bool oonn__rreessuummee ();
│ │ │ │ │ -virtual bool oonn__ppaauussee ();
│ │ │ │ │ -These hooks are called when the torrent is paused and resumed respectively. The
│ │ │ │ │ -return value indicates if the event was handled. A return value of true
│ │ │ │ │ -indicates that it was handled, and no other _p_l_u_g_i_n after this one will have
│ │ │ │ │ -this hook function called, and the standard handler will also not be invoked.
│ │ │ │ │ -So, returning true effectively overrides the standard behavior of pause or
│ │ │ │ │ -resume.
│ │ │ │ │ -Note that if you call pause() or resume() on the torrent from your handler it
│ │ │ │ │ -will recurse back into your handler, so in order to invoke the standard
│ │ │ │ │ -handler, you have to keep your own state on whether you want standard behavior
│ │ │ │ │ -or overridden behavior.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ffiilleess__cchheecckkeedd(()) **********
│ │ │ │ │ -virtual void oonn__ffiilleess__cchheecckkeedd ();
│ │ │ │ │ -This function is called when the initial files of the torrent have been
│ │ │ │ │ -checked. If there are no files to check, this function is called immediately.
│ │ │ │ │ -i.e. This function is always called when the torrent is in a state where it can
│ │ │ │ │ -start downloading.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ssttaattee(()) **********
│ │ │ │ │ -virtual void oonn__ssttaattee (torrent_status::state_t);
│ │ │ │ │ -called when the torrent changes state the state is one of _t_o_r_r_e_n_t___s_t_a_t_u_s_:_:
│ │ │ │ │ -_s_t_a_t_e___t enum members
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__aadddd__ppeeeerr(()) **********
│ │ │ │ │ -virtual void oonn__aadddd__ppeeeerr (tcp::endpoint const&,
│ │ │ │ │ -      peer_source_flags_t, add_peer_flags_t);
│ │ │ │ │ -called every time a new peer is added to the peer list. This is before the peer
│ │ │ │ │ -is connected to. For flags, see torrent_plugin::flags_t. The source argument
│ │ │ │ │ -refers to the source where we learned about this peer from. It's a bitmask,
│ │ │ │ │ -because many sources may have told us about the same peer. For peer source
│ │ │ │ │ -flags, see peer_info::peer_source_flags.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  first_time
│ │ │ │ │ -      this is the first time we see this peer
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  filtered
│ │ │ │ │ -      this peer was not added because it was filtered by the IP filter
│ │ │ │ │ +********** bbddeeccooddee__nnooddee(()) **********
│ │ │ │ │ +bbddeeccooddee__nnooddee () = default;
│ │ │ │ │ +creates a default constructed node, it will have the type none_t.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppeeeerr__pplluuggiinn ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p"
│ │ │ │ │ -peer plugins are associated with a specific peer. A peer could be both a
│ │ │ │ │ -regular bittorrent peer (bt_peer_connection) or one of the web seed connections
│ │ │ │ │ -(web_peer_connection or http_seed_connection). In order to only attach to
│ │ │ │ │ -certain peers, make your torrent_plugin::new_connection only return a _p_l_u_g_i_n
│ │ │ │ │ -for certain peer connection types
│ │ │ │ │ -struct peer_plugin
│ │ │ │ │ -{
│ │ │ │ │ -   virtual string_view ttyyppee () const;
│ │ │ │ │ -   virtual void aadddd__hhaannddsshhaakkee (entry&);
│ │ │ │ │ -   virtual void oonn__ddiissccoonnnneecctt (error_code const&);
│ │ │ │ │ -   virtual void oonn__ccoonnnneecctteedd ();
│ │ │ │ │ -   virtual bool oonn__hhaannddsshhaakkee (span<char const>);
│ │ │ │ │ -   virtual bool oonn__eexxtteennssiioonn__hhaannddsshhaakkee (bdecode_node const&);
│ │ │ │ │ -   virtual bool oonn__nnoott__iinntteerreesstteedd ();
│ │ │ │ │ -   virtual bool oonn__hhaavvee (piece_index_t);
│ │ │ │ │ -   virtual bool oonn__cchhookkee ();
│ │ │ │ │ -   virtual bool oonn__iinntteerreesstteedd ();
│ │ │ │ │ -   virtual bool oonn__rreeqquueesstt (peer_request const&);
│ │ │ │ │ -   virtual bool oonn__hhaavvee__nnoonnee ();
│ │ │ │ │ -   virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t);
│ │ │ │ │ -   virtual bool oonn__uunncchhookkee ();
│ │ │ │ │ -   virtual bool oonn__ddoonntt__hhaavvee (piece_index_t);
│ │ │ │ │ -   virtual bool oonn__hhaavvee__aallll ();
│ │ │ │ │ -   virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//);
│ │ │ │ │ -   virtual bool oonn__ppiieeccee (peer_request const& //**ppiieeccee**//
│ │ │ │ │ -      , span<char const> //**bbuuff**//);
│ │ │ │ │ -   virtual bool oonn__ccaanncceell (peer_request const&);
│ │ │ │ │ -   virtual bool oonn__ssuuggggeesstt (piece_index_t);
│ │ │ │ │ -   virtual bool oonn__rreejjeecctt (peer_request const&);
│ │ │ │ │ -   virtual void sseenntt__ssuuggggeesstt (piece_index_t);
│ │ │ │ │ -   virtual void sseenntt__ccaanncceell (peer_request const&);
│ │ │ │ │ -   virtual void sseenntt__cchhookkee ();
│ │ │ │ │ -   virtual void sseenntt__rreeqquueesstt (peer_request const&);
│ │ │ │ │ -   virtual void sseenntt__aallllooww__ffaasstt (piece_index_t);
│ │ │ │ │ -   virtual void sseenntt__hhaavvee__nnoonnee ();
│ │ │ │ │ -   virtual void sseenntt__rreejjeecctt__rreeqquueesstt (peer_request const&);
│ │ │ │ │ -   virtual void sseenntt__hhaavvee__aallll ();
│ │ │ │ │ -   virtual void sseenntt__uunncchhookkee ();
│ │ │ │ │ -   virtual void sseenntt__iinntteerreesstteedd ();
│ │ │ │ │ -   virtual void sseenntt__ppiieeccee (peer_request const&);
│ │ │ │ │ -   virtual void sseenntt__hhaavvee (piece_index_t);
│ │ │ │ │ -   virtual void sseenntt__nnoott__iinntteerreesstteedd ();
│ │ │ │ │ -   virtual void sseenntt__ppaayyllooaadd (int //** bbyytteess **//);
│ │ │ │ │ -   virtual bool ccaann__ddiissccoonnnneecctt (error_code const& //**eecc**//);
│ │ │ │ │ -   virtual bool oonn__eexxtteennddeedd (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │ -      span<char const> //**bbooddyy**//);
│ │ │ │ │ -   virtual bool oonn__uunnkknnoowwnn__mmeessssaaggee (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │ -      span<char const> //**bbooddyy**//);
│ │ │ │ │ -   virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ -   virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │ -   virtual void ttiicckk ();
│ │ │ │ │ -   virtual bool wwrriittee__rreeqquueesstt (peer_request const&);
│ │ │ │ │ -};
│ │ │ │ │ +********** bbddeeccooddee__nnooddee(()) ooppeerraattoorr==(()) **********
│ │ │ │ │ +bbddeeccooddee__nnooddee (bdecode_node&&) noexcept;
│ │ │ │ │ +bdecode_node& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │ +bdecode_node& ooppeerraattoorr== (bdecode_node&&) & = default;
│ │ │ │ │ +bbddeeccooddee__nnooddee (bdecode_node const&);
│ │ │ │ │ +For owning nodes, the copy will create a copy of the tree, but the underlying
│ │ │ │ │ +buffer remains the same.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ttyyppee(()) **********
│ │ │ │ │ -virtual string_view ttyyppee () const;
│ │ │ │ │ -This function is expected to return the name of the _p_l_u_g_i_n.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__hhaannddsshhaakkee(()) **********
│ │ │ │ │ -virtual void aadddd__hhaannddsshhaakkee (entry&);
│ │ │ │ │ -can add entries to the extension handshake this is not called for web seeds
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ddiissccoonnnneecctt(()) **********
│ │ │ │ │ -virtual void oonn__ddiissccoonnnneecctt (error_code const&);
│ │ │ │ │ -called when the peer is being disconnected.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ccoonnnneecctteedd(()) **********
│ │ │ │ │ -virtual void oonn__ccoonnnneecctteedd ();
│ │ │ │ │ -called when the peer is successfully connected. Note that incoming connections
│ │ │ │ │ -will have been connected by the time the peer _p_l_u_g_i_n is attached to it, and
│ │ │ │ │ -won't have this hook called.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__hhaannddsshhaakkee(()) **********
│ │ │ │ │ -virtual bool oonn__hhaannddsshhaakkee (span<char const>);
│ │ │ │ │ -this is called when the initial bittorrent handshake is received. Returning
│ │ │ │ │ -false means that the other end doesn't support this extension and will remove
│ │ │ │ │ -it from the list of plugins. this is not called for web seeds
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__eexxtteennssiioonn__hhaannddsshhaakkee(()) **********
│ │ │ │ │ -virtual bool oonn__eexxtteennssiioonn__hhaannddsshhaakkee (bdecode_node const&);
│ │ │ │ │ -called when the extension handshake from the other end is received if this
│ │ │ │ │ -returns false, it means that this extension isn't supported by this peer. It
│ │ │ │ │ -will result in this _p_e_e_r___p_l_u_g_i_n being removed from the peer_connection and
│ │ │ │ │ -destructed. this is not called for web seeds
│ │ │ │ │ +type_t ttyyppee () const noexcept;
│ │ │ │ │ +the type of this node. See _t_y_p_e___t.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__cchhookkee(()) oonn__uunncchhookkee(()) oonn__hhaavvee__aallll(()) oonn__hhaavvee__nnoonnee(()) oonn__bbiittffiieelldd(())
│ │ │ │ │ -oonn__nnoott__iinntteerreesstteedd(()) oonn__rreeqquueesstt(()) oonn__hhaavvee(()) oonn__ddoonntt__hhaavvee(()) oonn__iinntteerreesstteedd(())
│ │ │ │ │ -oonn__aalllloowweedd__ffaasstt(()) **********
│ │ │ │ │ -virtual bool oonn__nnoott__iinntteerreesstteedd ();
│ │ │ │ │ -virtual bool oonn__hhaavvee (piece_index_t);
│ │ │ │ │ -virtual bool oonn__cchhookkee ();
│ │ │ │ │ -virtual bool oonn__iinntteerreesstteedd ();
│ │ │ │ │ -virtual bool oonn__rreeqquueesstt (peer_request const&);
│ │ │ │ │ -virtual bool oonn__hhaavvee__nnoonnee ();
│ │ │ │ │ -virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t);
│ │ │ │ │ -virtual bool oonn__uunncchhookkee ();
│ │ │ │ │ -virtual bool oonn__ddoonntt__hhaavvee (piece_index_t);
│ │ │ │ │ -virtual bool oonn__hhaavvee__aallll ();
│ │ │ │ │ -virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//);
│ │ │ │ │ -returning true from any of the message handlers indicates that the _p_l_u_g_i_n has
│ │ │ │ │ -handled the message. it will break the _p_l_u_g_i_n chain traversing and not let
│ │ │ │ │ -anyone else handle the message, including the default handler.
│ │ │ │ │ +********** bbooooll(()) **********
│ │ │ │ │ +explicit operator bbooooll () const noexcept;
│ │ │ │ │ +returns true if _t_y_p_e_(_) != none_t.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ppiieeccee(()) **********
│ │ │ │ │ -virtual bool oonn__ppiieeccee (peer_request const& //**ppiieeccee**//
│ │ │ │ │ -      , span<char const> //**bbuuff**//);
│ │ │ │ │ -This function is called when the peer connection is receiving a piece. buf
│ │ │ │ │ -points (non-owning pointer) to the data in an internal immutable disk buffer.
│ │ │ │ │ -The length of the data is specified in the length member of the piece
│ │ │ │ │ -parameter. returns true to indicate that the piece is handled and the rest of
│ │ │ │ │ -the logic should be ignored.
│ │ │ │ │ +********** nnoonn__oowwnniinngg(()) **********
│ │ │ │ │ +bdecode_node nnoonn__oowwnniinngg () const;
│ │ │ │ │ +return a non-owning reference to this node. This is useful to refer to the root
│ │ │ │ │ +node without copying it in assignments.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseenntt__iinntteerreesstteedd(()) sseenntt__hhaavvee(()) sseenntt__nnoott__iinntteerreesstteedd(()) sseenntt__ppiieeccee(())
│ │ │ │ │ -sseenntt__uunncchhookkee(()) **********
│ │ │ │ │ -virtual void sseenntt__uunncchhookkee ();
│ │ │ │ │ -virtual void sseenntt__iinntteerreesstteedd ();
│ │ │ │ │ -virtual void sseenntt__ppiieeccee (peer_request const&);
│ │ │ │ │ -virtual void sseenntt__hhaavvee (piece_index_t);
│ │ │ │ │ -virtual void sseenntt__nnoott__iinntteerreesstteedd ();
│ │ │ │ │ -called after a choke message has been sent to the peer
│ │ │ │ │ +********** ddaattaa__sseeccttiioonn(()) ddaattaa__ooffffsseett(()) **********
│ │ │ │ │ +std::ptrdiff_t ddaattaa__ooffffsseett () const noexcept;
│ │ │ │ │ +span<char const> ddaattaa__sseeccttiioonn () const noexcept;
│ │ │ │ │ +returns the buffer and length of the section in the original bencoded buffer
│ │ │ │ │ +where this node is defined. For a dictionary for instance, this starts with d
│ │ │ │ │ +and ends with e, and has all the content of the dictionary in between. the
│ │ │ │ │ +data_offset() function returns the byte-offset to this node in, starting from
│ │ │ │ │ +the beginning of the buffer that was parsed.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseenntt__ppaayyllooaadd(()) **********
│ │ │ │ │ -virtual void sseenntt__ppaayyllooaadd (int //** bbyytteess **//);
│ │ │ │ │ -called after piece data has been sent to the peer this can be used for stats
│ │ │ │ │ -book keeping
│ │ │ │ │ +********** lliisstt__ssiizzee(()) lliisstt__aatt(()) lliisstt__ssttrriinngg__vvaalluuee__aatt(()) lliisstt__iinntt__vvaalluuee__aatt(()) **********
│ │ │ │ │ +bdecode_node lliisstt__aatt (int i) const;
│ │ │ │ │ +string_view lliisstt__ssttrriinngg__vvaalluuee__aatt (int i
│ │ │ │ │ +      , string_view default_val = string_view()) const;
│ │ │ │ │ +int lliisstt__ssiizzee () const;
│ │ │ │ │ +std::int64_t lliisstt__iinntt__vvaalluuee__aatt (int i
│ │ │ │ │ +      , std::int64_t default_val = 0) const;
│ │ │ │ │ +functions with the list_ prefix operate on lists. These functions are only
│ │ │ │ │ +valid if type() == list_t. list_at() returns the item in the list at index i. i
│ │ │ │ │ +may not be greater than or equal to the size of the list. size() returns the
│ │ │ │ │ +size of the list.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccaann__ddiissccoonnnneecctt(()) **********
│ │ │ │ │ -virtual bool ccaann__ddiissccoonnnneecctt (error_code const& //**eecc**//);
│ │ │ │ │ -called when libtorrent think this peer should be disconnected. if the _p_l_u_g_i_n
│ │ │ │ │ -returns false, the peer will not be disconnected.
│ │ │ │ │ +********** ddiicctt__aatt__nnooddee(()) ddiicctt__ffiinndd__iinntt(()) ddiicctt__ffiinndd__iinntt__vvaalluuee(()) ddiicctt__ffiinndd__lliisstt(())
│ │ │ │ │ +ddiicctt__ffiinndd(()) ddiicctt__aatt(()) ddiicctt__ssiizzee(()) ddiicctt__ffiinndd__ssttrriinngg(()) ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee(())
│ │ │ │ │ +ddiicctt__ffiinndd__ddiicctt(()) **********
│ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const;
│ │ │ │ │ +string_view ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee (string_view key
│ │ │ │ │ +      , string_view default_value = string_view()) const;
│ │ │ │ │ +int ddiicctt__ssiizzee () const;
│ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const;
│ │ │ │ │ +std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key
│ │ │ │ │ +      , std::int64_t default_val = 0) const;
│ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const;
│ │ │ │ │ +bdecode_node ddiicctt__ffiinndd (string_view key) const;
│ │ │ │ │ +std::pair<bdecode_node, bdecode_node> ddiicctt__aatt__nnooddee (int i) const;
│ │ │ │ │ +std::pair<string_view, bdecode_node> ddiicctt__aatt (int i) const;
│ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const;
│ │ │ │ │ +Functions with the dict_ prefix operates on dictionaries. They are only valid
│ │ │ │ │ +if type() == dict_t. In case a key you're looking up contains a 0 byte, you
│ │ │ │ │ +cannot use the 0-terminated string overloads, but have to use string_view
│ │ │ │ │ +instead. dict_find_list will return a valid bdecode_node if the key is found
│ │ │ │ │ +_and_ it is a list. Otherwise it will return a default-constructed
│ │ │ │ │ +_b_d_e_c_o_d_e___n_o_d_e.
│ │ │ │ │ +Functions with the _value suffix return the value of the node directly, rather
│ │ │ │ │ +than the nodes. In case the node is not found, or it has a different type, a
│ │ │ │ │ +default value is returned (which can be specified).
│ │ │ │ │ +dict_at() returns the (key, value)-pair at the specified index in a dictionary.
│ │ │ │ │ +Keys are only allowed to be strings. dict_at_node() also returns the (key,
│ │ │ │ │ +value)-pair, but the key is returned as a bdecode_node (and it will always be a
│ │ │ │ │ +string).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__eexxtteennddeedd(()) **********
│ │ │ │ │ -virtual bool oonn__eexxtteennddeedd (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │ -      span<char const> //**bbooddyy**//);
│ │ │ │ │ -called when an extended message is received. If returning true, the message is
│ │ │ │ │ -not processed by any other _p_l_u_g_i_n and if false is returned the next _p_l_u_g_i_n in
│ │ │ │ │ -the chain will receive it to be able to handle it. This is not called for web
│ │ │ │ │ -seeds. thus function may be called more than once per incoming message, but
│ │ │ │ │ -only the last of the calls will the body size equal the length. i.e. Every time
│ │ │ │ │ -another fragment of the message is received, this function will be called,
│ │ │ │ │ -until finally the whole message has been received. The purpose of this is to
│ │ │ │ │ -allow early disconnects for invalid messages and for reporting progress of
│ │ │ │ │ -receiving large messages.
│ │ │ │ │ +********** iinntt__vvaalluuee(()) **********
│ │ │ │ │ +std::int64_t iinntt__vvaalluuee () const;
│ │ │ │ │ +this function is only valid if type() == int_t. It returns the value of the
│ │ │ │ │ +integer.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__uunnkknnoowwnn__mmeessssaaggee(()) **********
│ │ │ │ │ -virtual bool oonn__uunnkknnoowwnn__mmeessssaaggee (int //**lleennggtthh**//, int //**mmssgg**//,
│ │ │ │ │ -      span<char const> //**bbooddyy**//);
│ │ │ │ │ -this is not called for web seeds
│ │ │ │ │ +********** ssttrriinngg__ooffffsseett(()) ssttrriinngg__ppttrr(()) ssttrriinngg__vvaalluuee(()) ssttrriinngg__lleennggtthh(()) **********
│ │ │ │ │ +char const* ssttrriinngg__ppttrr () const;
│ │ │ │ │ +std::ptrdiff_t ssttrriinngg__ooffffsseett () const;
│ │ │ │ │ +string_view ssttrriinngg__vvaalluuee () const;
│ │ │ │ │ +int ssttrriinngg__lleennggtthh () const;
│ │ │ │ │ +these functions are only valid if type() == string_t. They return the string
│ │ │ │ │ +values. Note that string_ptr() is nnoott 0-terminated. string_length() returns the
│ │ │ │ │ +number of bytes in the string. string_offset() returns the byte offset from the
│ │ │ │ │ +start of the parsed bencoded buffer this string can be found.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ppiieeccee__ffaaiilleedd(()) oonn__ppiieeccee__ppaassss(()) **********
│ │ │ │ │ -virtual void oonn__ppiieeccee__ppaassss (piece_index_t);
│ │ │ │ │ -virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t);
│ │ │ │ │ -called when a piece that this peer participated in either fails or passes the
│ │ │ │ │ -hash_check
│ │ │ │ │ +********** cclleeaarr(()) **********
│ │ │ │ │ +void cclleeaarr ();
│ │ │ │ │ +resets the bdecoded_node to a default constructed state. If this is an owning
│ │ │ │ │ +node, the tree is freed and all child nodes are invalidated.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttiicckk(()) **********
│ │ │ │ │ -virtual void ttiicckk ();
│ │ │ │ │ -called approximately once every second
│ │ │ │ │ +********** sswwaapp(()) **********
│ │ │ │ │ +void sswwaapp (bdecode_node& n);
│ │ │ │ │ +Swap contents.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** wwrriittee__rreeqquueesstt(()) **********
│ │ │ │ │ -virtual bool wwrriittee__rreeqquueesstt (peer_request const&);
│ │ │ │ │ -called each time a request message is to be sent. If true is returned, the
│ │ │ │ │ -original request message won't be sent and no other _p_l_u_g_i_n will have this
│ │ │ │ │ -function called.
│ │ │ │ │ +********** rreesseerrvvee(()) **********
│ │ │ │ │ +void rreesseerrvvee (int tokens);
│ │ │ │ │ +preallocate memory for the specified numbers of tokens. This is useful if you
│ │ │ │ │ +know approximately how many tokens are in the file you are about to parse.
│ │ │ │ │ +Doing so will save realloc operations while parsing. You should only call this
│ │ │ │ │ +on the root node, before passing it in to _b_d_e_c_o_d_e_(_).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ccrryyppttoo__pplluuggiinn ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p"
│ │ │ │ │ -struct crypto_plugin
│ │ │ │ │ -{
│ │ │ │ │ -   virtual void sseett__oouuttggooiinngg__kkeeyy (span<char const> key) = 0;
│ │ │ │ │ -   virtual void sseett__iinnccoommiinngg__kkeeyy (span<char const> key) = 0;
│ │ │ │ │ -   eennccrryypptt (span<span<char>> //**sseenndd__vveecc**//) = 0;
│ │ │ │ │ -   virtual std::tuple<int, int, int> ddeeccrryypptt (span<span<char>> //**rreecceeiivvee__vveecc**//
│ │ │ │ │ -) = 0;
│ │ │ │ │ -};
│ │ │ │ │ +********** sswwiittcchh__uunnddeerrllyyiinngg__bbuuffffeerr(()) **********
│ │ │ │ │ +void sswwiittcchh__uunnddeerrllyyiinngg__bbuuffffeerr (char const* buf) noexcept;
│ │ │ │ │ +this buffer MMUUSSTT be identical to the one originally parsed. This operation is
│ │ │ │ │ +only defined on owning root nodes, i.e. the one passed in to decode().
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddeeccrryypptt(()) **********
│ │ │ │ │ -virtual std::tuple<int, int, int> ddeeccrryypptt (span<span<char>> //**rreecceeiivvee__vveecc**//) =
│ │ │ │ │ -0;
│ │ │ │ │ -decrypt the provided buffers. returns is a tuple representing the values
│ │ │ │ │ -(consume, produce, packet_size)
│ │ │ │ │ -consume is set to the number of bytes which should be trimmed from the head of
│ │ │ │ │ -the buffers, default is 0
│ │ │ │ │ -produce is set to the number of bytes of payload which are now ready to be sent
│ │ │ │ │ -to the upper layer. default is the number of bytes passed in receive_vec
│ │ │ │ │ -packet_size is set to the minimum number of bytes which must be read to advance
│ │ │ │ │ -the next step of decryption. default is 0
│ │ │ │ │ +********** hhaass__ssoofftt__eerrrroorr(()) **********
│ │ │ │ │ +bool hhaass__ssoofftt__eerrrroorr (span<char> error) const;
│ │ │ │ │ +returns true if there is a non-fatal error in the bencoding of this node or its
│ │ │ │ │ +children
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ccrreeaattee__ssmmaarrtt__bbaann__pplluuggiinn(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_/_s_m_a_r_t___b_a_n_._h_p_p"
│ │ │ │ │ -std::shared_ptr<torrent_plugin> ccrreeaattee__ssmmaarrtt__bbaann__pplluuggiinn (torrent_handle const&,
│ │ │ │ │ -client_data_t);
│ │ │ │ │ -constructor function for the smart ban extension. The extension keeps track of
│ │ │ │ │ -the data peers have sent us for failing pieces and once the piece completes and
│ │ │ │ │ -passes the hash check bans the peers that turned out to have sent corrupt data.
│ │ │ │ │ -This function can either be passed in the add_torrent_params::extensions field,
│ │ │ │ │ -or via _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_).
│ │ │ │ │ +********** eennuumm ttyyppee__tt **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|none_t  |0    |uninitialized or default constructed. This is also used to|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_d_i_c_a_t_e_ _t_h_a_t_ _a_ _n_o_d_e_ _w_a_s_ _n_o_t_ _f_o_u_n_d_ _i_n_ _s_o_m_e_ _c_a_s_e_s_._ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_i_c_t___t_ _ _|_1_ _ _ _ _|_a_ _d_i_c_t_i_o_n_a_r_y_ _n_o_d_e_._ _T_h_e_ _d_i_c_t___f_i_n_d___ _f_u_n_c_t_i_o_n_s_ _a_r_e_ _v_a_l_i_d_._ _ _ _ |
│ │ │ │ │ +|_l_i_s_t___t_ _ _|_2_ _ _ _ _|_a_ _l_i_s_t_ _n_o_d_e_._ _T_h_e_ _l_i_s_t___ _f_u_n_c_t_i_o_n_s_ _a_r_e_ _v_a_l_i_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_t_r_i_n_g___t_|_3_ _ _ _ _|_a_ _s_t_r_i_n_g_ _n_o_d_e_,_ _t_h_e_ _s_t_r_i_n_g___ _f_u_n_c_t_i_o_n_s_ _a_r_e_ _v_a_l_i_d_._ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_n_t___t_ _ _ _|_4_ _ _ _ _|_a_n_ _i_n_t_e_g_e_r_ _n_o_d_e_._ _T_h_e_ _i_n_t___ _f_u_n_c_t_i_o_n_s_ _a_r_e_ _v_a_l_i_d_._ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ccrreeaattee__uutt__ppeexx__pplluuggiinn(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_/_u_t___p_e_x_._h_p_p"
│ │ │ │ │ -std::shared_ptr<torrent_plugin> ccrreeaattee__uutt__ppeexx__pplluuggiinn (torrent_handle const&,
│ │ │ │ │ -client_data_t);
│ │ │ │ │ -constructor function for the ut_pex extension. The ut_pex extension allows
│ │ │ │ │ -peers to gossip about their connections, allowing the swarm stay well connected
│ │ │ │ │ -and peers aware of more peers in the swarm. This extension is enabled by
│ │ │ │ │ -default unless explicitly disabled in the _s_e_s_s_i_o_n constructor.
│ │ │ │ │ -This can either be passed in the add_torrent_params::extensions field, or via
│ │ │ │ │ -_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_).
│ │ │ │ │ +************ pprriinntt__eennttrryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ +std::string pprriinntt__eennttrryy (bdecode_node const& e
│ │ │ │ │ +   , bool single_line = false, int indent = 0);
│ │ │ │ │ +print the bencoded structure in a human-readable format to a string that's
│ │ │ │ │ +returned.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ccrreeaattee__uutt__mmeettaaddaattaa__pplluuggiinn(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_/_u_t___m_e_t_a_d_a_t_a_._h_p_p"
│ │ │ │ │ -std::shared_ptr<torrent_plugin> ccrreeaattee__uutt__mmeettaaddaattaa__pplluuggiinn (torrent_handle
│ │ │ │ │ -const&, client_data_t);
│ │ │ │ │ -constructor function for the ut_metadata extension. The ut_metadata extension
│ │ │ │ │ -allows peers to request the .torrent file (or more specifically the info-
│ │ │ │ │ -dictionary of the .torrent file) from each other. This is the main building
│ │ │ │ │ -block in making magnet links work. This extension is enabled by default unless
│ │ │ │ │ -explicitly disabled in the _s_e_s_s_i_o_n constructor.
│ │ │ │ │ -This can either be passed in the add_torrent_params::extensions field, or via
│ │ │ │ │ -_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_a_d_d___e_x_t_e_n_s_i_o_n_(_).
│ │ │ │ │ +************ bbddeeccooddee(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ +int bbddeeccooddee (char const* start, char const* end, bdecode_node& ret
│ │ │ │ │ +   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ │ +   , int token_limit = 2000000);
│ │ │ │ │ +bdecode_node bbddeeccooddee (span<char const> buffer
│ │ │ │ │ +   , int depth_limit = 100, int token_limit = 2000000);
│ │ │ │ │ +bdecode_node bbddeeccooddee (span<char const> buffer
│ │ │ │ │ +   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ │ +   , int token_limit = 2000000);
│ │ │ │ │ +This function decodes/parses bdecoded data (for example a .torrent file). The
│ │ │ │ │ +data structure is returned in the ret argument. the buffer to parse is
│ │ │ │ │ +specified by the start of the buffer as well as the end, i.e. one byte past the
│ │ │ │ │ +end. If the buffer fails to parse, the function returns a non-zero value and
│ │ │ │ │ +fills in ec with the error code. The optional argument error_pos, if set to
│ │ │ │ │ +non-nullptr, will be set to the byte offset into the buffer where the parse
│ │ │ │ │ +failure occurred.
│ │ │ │ │ +depth_limit specifies the max number of nested lists or dictionaries are
│ │ │ │ │ +allowed in the data structure. (This affects the stack usage of the function,
│ │ │ │ │ +be careful not to set it too high).
│ │ │ │ │ +token_limit is the max number of tokens allowed to be parsed from the buffer.
│ │ │ │ │ +This is simply a sanity check to not have unbounded memory usage.
│ │ │ │ │ +The resulting bdecode_node is an oowwnniinngg node. That means it will be holding the
│ │ │ │ │ +whole parsed tree. When iterating lists and dictionaries, those bdecode_node
│ │ │ │ │ +objects will simply have references to the root or owning bdecode_node. If the
│ │ │ │ │ +root node is destructed, all other nodes that refer to anything in that tree
│ │ │ │ │ +become invalid.
│ │ │ │ │ +However, the underlying buffer passed in to this function (start, end) must
│ │ │ │ │ +also remain valid while the bdecoded tree is used. The parsed tree produced by
│ │ │ │ │ +this function does not copy any data out of the buffer, but simply produces
│ │ │ │ │ +references back into it.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ttoorrrreenntt__ssttaattuuss ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_t_o_r_r_e_n_t___s_t_a_t_u_s_._h_p_p"
│ │ │ │ │  holds a snapshot of the status of a torrent, as queried by _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:
│ │ │ │ │  _s_t_a_t_u_s_(_).
│ │ │ │ │  struct torrent_status
│ │ │ │ │  {
│ │ │ │ │ @@ -8741,2367 +11879,399 @@
│ │ │ │ │        is always a subset of active time). seeding means all files/pieces were
│ │ │ │ │        downloaded and available to peers. Being available to peers does not
│ │ │ │ │        imply there are other peers asking for the payload.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    flags
│ │ │ │ │        reflects several of the torrent's flags. For more information, see
│ │ │ │ │        torrent_handle::flags().
│ │ │ │ │ +Bencoding is a common representation in bittorrent used for dictionary, list,
│ │ │ │ │ +_i_n_t and string hierarchies. It's used to encode .torrent files and some
│ │ │ │ │ +messages in the network protocol. libtorrent also uses it to store settings,
│ │ │ │ │ +resume data and other _s_e_s_s_i_o_n state.
│ │ │ │ │ +Strings in bencoded structures do not necessarily represent text. Strings are
│ │ │ │ │ +raw byte buffers of a certain length. If a string is meant to be interpreted as
│ │ │ │ │ +text, it is required to be UTF-8 encoded. See _B_E_P_ _3.
│ │ │ │ │ +The function for decoding bencoded data _b_d_e_c_o_d_e_(_), returning a _b_d_e_c_o_d_e___n_o_d_e.
│ │ │ │ │ +This function builds a tree that points back into the original buffer. The
│ │ │ │ │ +returned _b_d_e_c_o_d_e___n_o_d_e will not be valid once the buffer it was parsed out of is
│ │ │ │ │ +discarded.
│ │ │ │ │ +It's possible to construct an _e_n_t_r_y from a _b_d_e_c_o_d_e___n_o_d_e, if a structure needs
│ │ │ │ │ +to be altered and re-encoded.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppeeeerr__ccllaassss__iinnffoo ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_l_a_s_s_._h_p_p"
│ │ │ │ │ -holds settings for a peer class. Used in _s_e_t___p_e_e_r___c_l_a_s_s_(_) and _g_e_t___p_e_e_r___c_l_a_s_s_(_)
│ │ │ │ │ -calls.
│ │ │ │ │ -struct peer_class_info
│ │ │ │ │ -{
│ │ │ │ │ -   bool ignore_unchoke_slots;
│ │ │ │ │ -   int connection_limit_factor;
│ │ │ │ │ -   std::string label;
│ │ │ │ │ -   int upload_limit;
│ │ │ │ │ -   int download_limit;
│ │ │ │ │ -   int upload_priority;
│ │ │ │ │ -   int download_priority;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  ignore_unchoke_slots
│ │ │ │ │ -      ignore_unchoke_slots determines whether peers should always unchoke a
│ │ │ │ │ -      peer, regardless of the choking algorithm, or if it should honor the
│ │ │ │ │ -      unchoke slot limits. It's used for local peers by default. If aannyy of the
│ │ │ │ │ -      peer classes a peer belongs to has this set to true, that peer will be
│ │ │ │ │ -      unchoked at all times.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  connection_limit_factor
│ │ │ │ │ -      adjusts the connection limit (global and per torrent) that applies to
│ │ │ │ │ -      this peer class. By default, local peers are allowed to exceed the normal
│ │ │ │ │ -      connection limit for instance. This is specified as a percent factor. 100
│ │ │ │ │ -      makes the peer class apply normally to the limit. 200 means as long as
│ │ │ │ │ -      there are fewer connections than twice the limit, we accept this peer.
│ │ │ │ │ -      This factor applies both to the global connection limit and the per-
│ │ │ │ │ -      torrent limit. Note that if not used carefully one peer class can
│ │ │ │ │ -      potentially completely starve out all other over time.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  label
│ │ │ │ │ -      not used by libtorrent. It's intended as a potentially user-facing
│ │ │ │ │ -      identifier of this peer class.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  upload_limit download_limit
│ │ │ │ │ -      transfer rates limits for the whole peer class. They are specified in
│ │ │ │ │ -      bytes per second and apply to the sum of all peers that are members of
│ │ │ │ │ -      this class.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  upload_priority download_priority
│ │ │ │ │ -      relative priorities used by the bandwidth allocator in the rate limiter.
│ │ │ │ │ -      If no rate limits are in use, the priority is not used either. Priorities
│ │ │ │ │ -      start at 1 (0 is not a valid priority) and may not exceed 255.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ -peer_class_type_filter is a simple container for rules for adding and
│ │ │ │ │ -subtracting peer-classes from peers. It is applied aafftteerr the peer class filter
│ │ │ │ │ -is applied (which is based on the peer's IP address).
│ │ │ │ │ -struct peer_class_type_filter
│ │ │ │ │ +************ eennttrryy ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_n_t_r_y_._h_p_p"
│ │ │ │ │ +The entry class represents one node in a bencoded hierarchy. It works as a
│ │ │ │ │ +variant type, it can be either a list, a dictionary (std::map), an integer or a
│ │ │ │ │ +string.
│ │ │ │ │ +class entry
│ │ │ │ │  {
│ │ │ │ │ -   void aadddd (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ -   void rreemmoovvee (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ -   void aallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ -   void ddiissaallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ -   std::uint32_t aappppllyy (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ │ │ -   friend bool ooppeerraattoorr==== (peer_class_type_filter const& lhs
│ │ │ │ │ -      , peer_class_type_filter const& rhs);
│ │ │ │ │ +   data_type ttyyppee () const;
│ │ │ │ │ +   eennttrryy (dictionary_type);
│ │ │ │ │ +   eennttrryy (span<char const>);
│ │ │ │ │ +   eennttrryy (list_type);
│ │ │ │ │ +   eennttrryy (integer_type);
│ │ │ │ │ +   eennttrryy (preformatted_type);
│ │ │ │ │ +   eennttrryy (U v);
│ │ │ │ │ +   eennttrryy (data_type t);
│ │ │ │ │ +   eennttrryy (bdecode_node const& n);
│ │ │ │ │ +   entry& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │ +   entry& ooppeerraattoorr== (preformatted_type) &;
│ │ │ │ │ +   entry& ooppeerraattoorr== (entry&&) & noexcept;
│ │ │ │ │ +   entry& ooppeerraattoorr== (dictionary_type) &;
│ │ │ │ │ +   entry& ooppeerraattoorr== (entry const&) &;
│ │ │ │ │ +   entry& ooppeerraattoorr== (span<char const>) &;
│ │ │ │ │ +   entry& ooppeerraattoorr== (list_type) &;
│ │ │ │ │ +   entry& ooppeerraattoorr== (integer_type) &;
│ │ │ │ │ +   entry& ooppeerraattoorr== (U v) &;
│ │ │ │ │ +   dictionary_type const& ddiicctt () const;
│ │ │ │ │ +   string_type& ssttrriinngg ();
│ │ │ │ │ +   integer_type& iinntteeggeerr ();
│ │ │ │ │ +   list_type const& lliisstt () const;
│ │ │ │ │ +   dictionary_type& ddiicctt ();
│ │ │ │ │ +   list_type& lliisstt ();
│ │ │ │ │ +   integer_type const& iinntteeggeerr () const;
│ │ │ │ │ +   preformatted_type& pprreeffoorrmmaatttteedd ();
│ │ │ │ │ +   string_type const& ssttrriinngg () const;
│ │ │ │ │ +   preformatted_type const& pprreeffoorrmmaatttteedd () const;
│ │ │ │ │ +   void sswwaapp (entry& e);
│ │ │ │ │ +   entry& ooppeerraattoorr[[]] (string_view key);
│ │ │ │ │ +   entry const& ooppeerraattoorr[[]] (string_view key) const;
│ │ │ │ │ +   entry* ffiinndd__kkeeyy (string_view key);
│ │ │ │ │ +   entry const* ffiinndd__kkeeyy (string_view key) const;
│ │ │ │ │ +   std::string ttoo__ssttrriinngg (bool single_line = false) const;
│ │ │ │ │  
│ │ │ │ │ -   enum socket_type_t
│ │ │ │ │ +   enum data_type
│ │ │ │ │     {
│ │ │ │ │ -      tcp_socket,
│ │ │ │ │ -      utp_socket,
│ │ │ │ │ -      ssl_tcp_socket,
│ │ │ │ │ -      ssl_utp_socket,
│ │ │ │ │ -      i2p_socket,
│ │ │ │ │ -      num_socket_types,
│ │ │ │ │ +      int_t,
│ │ │ │ │ +      string_t,
│ │ │ │ │ +      list_t,
│ │ │ │ │ +      dictionary_t,
│ │ │ │ │ +      undefined_t,
│ │ │ │ │ +      preformatted_t,
│ │ │ │ │     };
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreemmoovvee(()) aadddd(()) **********
│ │ │ │ │ -void aadddd (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ -void rreemmoovvee (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ -add() and remove() adds and removes a peer class to be added to new peers based
│ │ │ │ │ -on socket type.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddiissaallllooww(()) aallllooww(()) **********
│ │ │ │ │ -void aallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ -void ddiissaallllooww (socket_type_t const st, peer_class_t const peer_class);
│ │ │ │ │ -disallow() and allow() adds and removes a peer class to be removed from new
│ │ │ │ │ -peers based on socket type.
│ │ │ │ │ -The peer_class argument cannot be greater than 31. The bitmasks representing
│ │ │ │ │ -peer classes in the peer_class_type_filter are 32 bits.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aappppllyy(()) **********
│ │ │ │ │ -std::uint32_t aappppllyy (socket_type_t const st, std::uint32_t peer_class_mask);
│ │ │ │ │ -takes a bitmask of peer classes and returns a new bitmask of peer classes after
│ │ │ │ │ -the rules have been applied, based on the socket type argument (st).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm ssoocckkeett__ttyyppee__tt **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|tcp_socket      |0    |these match the socket types from socket_type.hpp|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_h_i_f_t_e_d_ _o_n_e_ _d_o_w_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_u_t_p___s_o_c_k_e_t_ _ _ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_s_l___t_c_p___s_o_c_k_e_t_ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_s_l___u_t_p___s_o_c_k_e_t_ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_2_p___s_o_c_k_e_t_ _ _ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_u_m___s_o_c_k_e_t___t_y_p_e_s_|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -You have some control over _s_e_s_s_i_o_n configuration through the session::
│ │ │ │ │ -apply_settings() member function. To change one or more configuration options,
│ │ │ │ │ -create a _s_e_t_t_i_n_g_s___p_a_c_k object and fill it with the settings to be set and pass
│ │ │ │ │ -it in to session::apply_settings().
│ │ │ │ │ -The _s_e_t_t_i_n_g_s___p_a_c_k object is a collection of settings updates that are applied
│ │ │ │ │ -to the _s_e_s_s_i_o_n when passed to session::apply_settings(). It's empty when
│ │ │ │ │ -constructed.
│ │ │ │ │ -You have control over proxy and authorization settings and also the user-agent
│ │ │ │ │ -that will be sent to the tracker. The user-agent will also be used to identify
│ │ │ │ │ -the client with other peers.
│ │ │ │ │ -Each configuration option is named with an enum value inside the _s_e_t_t_i_n_g_s___p_a_c_k
│ │ │ │ │ -class. These are the available settings:
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddiisskk__oobbsseerrvveerr ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___o_b_s_e_r_v_e_r_._h_p_p"
│ │ │ │ │ -struct disk_observer
│ │ │ │ │ -{
│ │ │ │ │ -   virtual void oonn__ddiisskk () = 0;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** oonn__ddiisskk(()) **********
│ │ │ │ │ -virtual void oonn__ddiisskk () = 0;
│ │ │ │ │ -called when the disk cache size has dropped below the low watermark again and
│ │ │ │ │ -we can resume downloading from peers
│ │ │ │ │ +********** ttyyppee(()) **********
│ │ │ │ │ +data_type ttyyppee () const;
│ │ │ │ │ +returns the concrete type of the _e_n_t_r_y
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ooppeenn__ffiillee__ssttaattee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___i_n_t_e_r_f_a_c_e_._h_p_p"
│ │ │ │ │ -this contains information about a file that's currently open by the libtorrent
│ │ │ │ │ -disk I/O subsystem. It's associated with a single torrent.
│ │ │ │ │ -struct open_file_state
│ │ │ │ │ -{
│ │ │ │ │ -   file_index_t file_index;
│ │ │ │ │ -   file_open_mode_t open_mode;
│ │ │ │ │ -   time_point last_use;
│ │ │ │ │ -};
│ │ │ │ │ +********** eennttrryy(()) **********
│ │ │ │ │ +eennttrryy (dictionary_type);
│ │ │ │ │ +eennttrryy (span<char const>);
│ │ │ │ │ +eennttrryy (list_type);
│ │ │ │ │ +eennttrryy (integer_type);
│ │ │ │ │ +eennttrryy (preformatted_type);
│ │ │ │ │ +constructors directly from a specific type. The content of the argument is
│ │ │ │ │ +copied into the newly constructed _e_n_t_r_y
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  file_index
│ │ │ │ │ -      the index of the file this _e_n_t_r_y refers to into the file_storage file
│ │ │ │ │ -      list of this torrent. This starts indexing at 0.
│ │ │ │ │ +********** eennttrryy(()) **********
│ │ │ │ │ +eennttrryy (data_type t);
│ │ │ │ │ +construct an empty _e_n_t_r_y of the specified type. see _d_a_t_a___t_y_p_e enum.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  open_mode
│ │ │ │ │ -      open_mode is a bitmask of the file flags this file is currently opened
│ │ │ │ │ -      with. For possible flags, see _f_i_l_e___o_p_e_n___m_o_d_e___t.
│ │ │ │ │ -      Note that the read/write mode is not a bitmask. The two least significant
│ │ │ │ │ -      bits are used to represent the read/write mode. Those bits can be masked
│ │ │ │ │ -      out using the rw_mask constant.
│ │ │ │ │ +********** eennttrryy(()) **********
│ │ │ │ │ +eennttrryy (bdecode_node const& n);
│ │ │ │ │ +construct from _b_d_e_c_o_d_e___n_o_d_e parsed form (see _b_d_e_c_o_d_e_(_))
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  last_use
│ │ │ │ │ -      a (high precision) timestamp of when the file was last used.
│ │ │ │ │ +********** ooppeerraattoorr==(()) **********
│ │ │ │ │ +entry& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │ +entry& ooppeerraattoorr== (preformatted_type) &;
│ │ │ │ │ +entry& ooppeerraattoorr== (entry&&) & noexcept;
│ │ │ │ │ +entry& ooppeerraattoorr== (dictionary_type) &;
│ │ │ │ │ +entry& ooppeerraattoorr== (entry const&) &;
│ │ │ │ │ +entry& ooppeerraattoorr== (span<char const>) &;
│ │ │ │ │ +entry& ooppeerraattoorr== (list_type) &;
│ │ │ │ │ +entry& ooppeerraattoorr== (integer_type) &;
│ │ │ │ │ +copies the structure of the right hand side into this _e_n_t_r_y.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddiisskk__iinntteerrffaaccee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___i_n_t_e_r_f_a_c_e_._h_p_p"
│ │ │ │ │ -The _d_i_s_k___i_n_t_e_r_f_a_c_e is the customization point for disk I/O in libtorrent.
│ │ │ │ │ -implement this interface and provide a factory function to the _s_e_s_s_i_o_n
│ │ │ │ │ -constructor use custom disk I/O. All functions on the disk subsystem
│ │ │ │ │ -(implementing _d_i_s_k___i_n_t_e_r_f_a_c_e) are called from within libtorrent's network
│ │ │ │ │ -thread. For disk I/O to be performed in a separate thread, the disk subsystem
│ │ │ │ │ -has to manage that itself.
│ │ │ │ │ -Although the functions are called async_*, they do not technically hhaavvee to be
│ │ │ │ │ -asynchronous, but they support being asynchronous, by expecting the result
│ │ │ │ │ -passed back into a callback. The callbacks must be posted back onto the network
│ │ │ │ │ -thread via the io_context object passed into the constructor. The callbacks
│ │ │ │ │ -will be run in the network thread.
│ │ │ │ │ -struct disk_interface
│ │ │ │ │ -{
│ │ │ │ │ -   virtual storage_holder nneeww__ttoorrrreenntt (storage_params const& p
│ │ │ │ │ -      , std::shared_ptr<void> const& torrent) = 0;
│ │ │ │ │ -   virtual void rreemmoovvee__ttoorrrreenntt (storage_index_t) = 0;
│ │ │ │ │ -   virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r
│ │ │ │ │ -      , std::function<void(disk_buffer_holder, storage_error const&)> handler
│ │ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │ -   virtual bool aassyynncc__wwrriittee (storage_index_t storage, peer_request const& r
│ │ │ │ │ -      , char const* buf, std::shared_ptr<disk_observer> o
│ │ │ │ │ -      , std::function<void(storage_error const&)> handler
│ │ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │ -   virtual void aassyynncc__hhaasshh (storage_index_t storage, piece_index_t piece,
│ │ │ │ │ -span<sha256_hash> v2
│ │ │ │ │ -      , disk_job_flags_t flags
│ │ │ │ │ -      , std::function<void(piece_index_t, sha1_hash const&, storage_error
│ │ │ │ │ -const&)> handler) = 0;
│ │ │ │ │ -   virtual void aassyynncc__hhaasshh22 (storage_index_t storage, piece_index_t piece, int
│ │ │ │ │ -offset, disk_job_flags_t flags
│ │ │ │ │ -      , std::function<void(piece_index_t, sha256_hash const&, storage_error
│ │ │ │ │ -const&)> handler) = 0;
│ │ │ │ │ -   virtual void aassyynncc__mmoovvee__ssttoorraaggee (storage_index_t storage, std::string p,
│ │ │ │ │ -move_flags_t flags
│ │ │ │ │ -      , std::function<void(status_t, std::string const&, storage_error const&)>
│ │ │ │ │ -handler) = 0;
│ │ │ │ │ -   virtual void aassyynncc__rreelleeaassee__ffiilleess (storage_index_t storage
│ │ │ │ │ -      , std::function<void()> handler = std::function<void()>()) = 0;
│ │ │ │ │ -   virtual void aassyynncc__cchheecckk__ffiilleess (storage_index_t storage
│ │ │ │ │ -      , add_torrent_params const* resume_data
│ │ │ │ │ -      , aux::vector<std::string, file_index_t> links
│ │ │ │ │ -      , std::function<void(status_t, storage_error const&)> handler) = 0;
│ │ │ │ │ -   virtual void aassyynncc__ssttoopp__ttoorrrreenntt (storage_index_t storage
│ │ │ │ │ -      , std::function<void()> handler = std::function<void()>()) = 0;
│ │ │ │ │ -   virtual void aassyynncc__rreennaammee__ffiillee (storage_index_t storage
│ │ │ │ │ -      , file_index_t index, std::string name
│ │ │ │ │ -      , std::function<void(std::string const&, file_index_t, storage_error
│ │ │ │ │ -const&)> handler) = 0;
│ │ │ │ │ -   virtual void aassyynncc__ddeelleettee__ffiilleess (storage_index_t storage, remove_flags_t
│ │ │ │ │ -options
│ │ │ │ │ -      , std::function<void(storage_error const&)> handler) = 0;
│ │ │ │ │ -   virtual void aassyynncc__sseett__ffiillee__pprriioorriittyy (storage_index_t storage
│ │ │ │ │ -      , aux::vector<download_priority_t, file_index_t> prio
│ │ │ │ │ -      , std::function<void(storage_error const&
│ │ │ │ │ -      , aux::vector<download_priority_t, file_index_t>)> handler) = 0;
│ │ │ │ │ -   virtual void aassyynncc__cclleeaarr__ppiieeccee (storage_index_t storage, piece_index_t index
│ │ │ │ │ -      , std::function<void(piece_index_t)> handler) = 0;
│ │ │ │ │ -   virtual void uuppddaattee__ssttaattss__ccoouunntteerrss (counters& c) const = 0;
│ │ │ │ │ -   virtual std::vector<open_file_state> ggeett__ssttaattuuss (storage_index_t) const = 0;
│ │ │ │ │ -   virtual void aabboorrtt (bool wait) = 0;
│ │ │ │ │ -   virtual void ssuubbmmiitt__jjoobbss () = 0;
│ │ │ │ │ -   virtual void sseettttiinnggss__uuppddaatteedd () = 0;
│ │ │ │ │ +********** ssttrriinngg(()) pprreeffoorrmmaatttteedd(()) lliisstt(()) iinntteeggeerr(()) ddiicctt(()) **********
│ │ │ │ │ +dictionary_type const& ddiicctt () const;
│ │ │ │ │ +string_type& ssttrriinngg ();
│ │ │ │ │ +integer_type& iinntteeggeerr ();
│ │ │ │ │ +list_type const& lliisstt () const;
│ │ │ │ │ +dictionary_type& ddiicctt ();
│ │ │ │ │ +list_type& lliisstt ();
│ │ │ │ │ +integer_type const& iinntteeggeerr () const;
│ │ │ │ │ +preformatted_type& pprreeffoorrmmaatttteedd ();
│ │ │ │ │ +string_type const& ssttrriinngg () const;
│ │ │ │ │ +preformatted_type const& pprreeffoorrmmaatttteedd () const;
│ │ │ │ │ +The integer(), string(), list() and dict() functions are accessors that return
│ │ │ │ │ +the respective type. If the entry object isn't of the type you request, the
│ │ │ │ │ +accessor will throw system_error. You can ask an entry for its type through the
│ │ │ │ │ +type() function.
│ │ │ │ │ +If you want to create an entry you give it the type you want it to have in its
│ │ │ │ │ +constructor, and then use one of the non-const accessors to get a reference
│ │ │ │ │ +which you then can assign the value you want it to have.
│ │ │ │ │ +The typical code to get info from a torrent file will then look like this:
│ │ │ │ │ +entry torrent_file;
│ │ │ │ │ +// ...
│ │ │ │ │  
│ │ │ │ │ -   static constexpr disk_job_flags_t ffoorrccee__ccooppyy  = 0_bit;
│ │ │ │ │ -   static constexpr disk_job_flags_t sseeqquueennttiiaall__aacccceessss  = 3_bit;
│ │ │ │ │ -   static constexpr disk_job_flags_t vvoollaattiillee__rreeaadd  = 4_bit;
│ │ │ │ │ -   static constexpr disk_job_flags_t vv11__hhaasshh  = 5_bit;
│ │ │ │ │ -   static constexpr disk_job_flags_t fflluusshh__ppiieeccee  = 7_bit;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nneeww__ttoorrrreenntt(()) **********
│ │ │ │ │ -virtual storage_holder nneeww__ttoorrrreenntt (storage_params const& p
│ │ │ │ │ -      , std::shared_ptr<void> const& torrent) = 0;
│ │ │ │ │ -this is called when a new torrent is added. The shared_ptr can be used to hold
│ │ │ │ │ -the internal torrent object alive as long as there are outstanding disk
│ │ │ │ │ -operations on the storage. The returned _s_t_o_r_a_g_e___h_o_l_d_e_r is an owning reference
│ │ │ │ │ -to the underlying storage that was just created. It is fundamentally a
│ │ │ │ │ -storage_index_t
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreemmoovvee__ttoorrrreenntt(()) **********
│ │ │ │ │ -virtual void rreemmoovvee__ttoorrrreenntt (storage_index_t) = 0;
│ │ │ │ │ -remove the storage with the specified index. This is not expected to delete any
│ │ │ │ │ -files from disk, just to clean up any resources associated with the specified
│ │ │ │ │ -storage.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__rreeaadd(()) aassyynncc__wwrriittee(()) **********
│ │ │ │ │ -virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r
│ │ │ │ │ -      , std::function<void(disk_buffer_holder, storage_error const&)> handler
│ │ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │ -virtual bool aassyynncc__wwrriittee (storage_index_t storage, peer_request const& r
│ │ │ │ │ -      , char const* buf, std::shared_ptr<disk_observer> o
│ │ │ │ │ -      , std::function<void(storage_error const&)> handler
│ │ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
│ │ │ │ │ -perform a read or write operation from/to the specified storage index and the
│ │ │ │ │ -specified request. When the operation completes, call handler possibly with a
│ │ │ │ │ -_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r, holding the buffer with the result. Flags may be set to
│ │ │ │ │ -affect the read operation. See disk_job_flags_t.
│ │ │ │ │ -The _d_i_s_k___o_b_s_e_r_v_e_r is a callback to indicate that the store buffer/disk write
│ │ │ │ │ -queue is below the watermark to let peers start writing buffers to disk again.
│ │ │ │ │ -When async_write() returns true, indicating the write queue is full, the peer
│ │ │ │ │ -will stop further writes and wait for the passed-in disk_observer to be
│ │ │ │ │ -notified before resuming.
│ │ │ │ │ -Note that for async_read, the _p_e_e_r___r_e_q_u_e_s_t (r) is not necessarily aligned to
│ │ │ │ │ -blocks (but it is most of the time). However, all writes (passed to
│ │ │ │ │ -async_write) are guaranteed to be block aligned.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__hhaasshh(()) **********
│ │ │ │ │ -virtual void aassyynncc__hhaasshh (storage_index_t storage, piece_index_t piece,
│ │ │ │ │ -span<sha256_hash> v2
│ │ │ │ │ -      , disk_job_flags_t flags
│ │ │ │ │ -      , std::function<void(piece_index_t, sha1_hash const&, storage_error
│ │ │ │ │ -const&)> handler) = 0;
│ │ │ │ │ -Compute hash(es) for the specified piece. Unless the v1_hash flag is set (in
│ │ │ │ │ -flags), the SHA-1 hash of the whole piece does not need to be computed.
│ │ │ │ │ -Thev2span is optional and can be empty, which means v2 hashes should not be
│ │ │ │ │ -computed. If v2 is non-empty it must be at least large enough to hold all v2
│ │ │ │ │ -blocks in the piece, and this function will fill in the span with the SHA-256
│ │ │ │ │ -block hashes of the piece.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__hhaasshh22(()) **********
│ │ │ │ │ -virtual void aassyynncc__hhaasshh22 (storage_index_t storage, piece_index_t piece, int
│ │ │ │ │ -offset, disk_job_flags_t flags
│ │ │ │ │ -      , std::function<void(piece_index_t, sha256_hash const&, storage_error
│ │ │ │ │ -const&)> handler) = 0;
│ │ │ │ │ -computes the v2 hash (SHA-256) of a single block. The block at offset in piece
│ │ │ │ │ -piece.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__mmoovvee__ssttoorraaggee(()) **********
│ │ │ │ │ -virtual void aassyynncc__mmoovvee__ssttoorraaggee (storage_index_t storage, std::string p,
│ │ │ │ │ -move_flags_t flags
│ │ │ │ │ -      , std::function<void(status_t, std::string const&, storage_error const&)>
│ │ │ │ │ -handler) = 0;
│ │ │ │ │ -called to request the files for the specified storage/torrent be moved to a new
│ │ │ │ │ -location. It is the disk I/O object's responsibility to synchronize this with
│ │ │ │ │ -any currently outstanding disk operations to the storage. Whether files are
│ │ │ │ │ -replaced at the destination path or not is controlled by flags (see
│ │ │ │ │ -_m_o_v_e___f_l_a_g_s___t).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__rreelleeaassee__ffiilleess(()) **********
│ │ │ │ │ -virtual void aassyynncc__rreelleeaassee__ffiilleess (storage_index_t storage
│ │ │ │ │ -      , std::function<void()> handler = std::function<void()>()) = 0;
│ │ │ │ │ -This is called on disk I/O objects to request they close all open files for the
│ │ │ │ │ -specified storage/torrent. If file handles are not pooled/cached, it can be a
│ │ │ │ │ -no-op. For truly asynchronous disk I/O, this should provide at least one point
│ │ │ │ │ -in time when all files are closed. It is possible that later asynchronous
│ │ │ │ │ -operations will re-open some of the files, by the time this completion handler
│ │ │ │ │ -is called, that's fine.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__cchheecckk__ffiilleess(()) **********
│ │ │ │ │ -virtual void aassyynncc__cchheecckk__ffiilleess (storage_index_t storage
│ │ │ │ │ -      , add_torrent_params const* resume_data
│ │ │ │ │ -      , aux::vector<std::string, file_index_t> links
│ │ │ │ │ -      , std::function<void(status_t, storage_error const&)> handler) = 0;
│ │ │ │ │ -this is called when torrents are added to validate their resume data against
│ │ │ │ │ -the files on disk. This function is expected to do a few things:
│ │ │ │ │ -if links is non-empty, it contains a string for each file in the torrent. The
│ │ │ │ │ -string being a path to an existing identical file. The default behavior is to
│ │ │ │ │ -create hard links of those files into the storage of the new torrent (specified
│ │ │ │ │ -by storage). An empty string indicates that there is no known identical file.
│ │ │ │ │ -This is part of the "mutable torrent" feature, where files can be reused from
│ │ │ │ │ -other torrents.
│ │ │ │ │ -The resume_data points the resume data passed in by the client.
│ │ │ │ │ -If the resume_data->flags field has the seed_mode flag set, all files/pieces
│ │ │ │ │ -are expected to be on disk already. This should be verified. Not just the
│ │ │ │ │ -existence of the file, but also that it has the correct size.
│ │ │ │ │ -Any file with a piece set in the resume_data->have_pieces bitmask should exist
│ │ │ │ │ -on disk, this should be verified. Pad files and files with zero priority may be
│ │ │ │ │ -skipped.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__ssttoopp__ttoorrrreenntt(()) **********
│ │ │ │ │ -virtual void aassyynncc__ssttoopp__ttoorrrreenntt (storage_index_t storage
│ │ │ │ │ -      , std::function<void()> handler = std::function<void()>()) = 0;
│ │ │ │ │ -This is called when a torrent is stopped. It gives the disk I/O object an
│ │ │ │ │ -opportunity to flush any data to disk that's currently kept cached. This
│ │ │ │ │ -function should at least do the same thing as _a_s_y_n_c___r_e_l_e_a_s_e___f_i_l_e_s_(_).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__rreennaammee__ffiillee(()) **********
│ │ │ │ │ -virtual void aassyynncc__rreennaammee__ffiillee (storage_index_t storage
│ │ │ │ │ -      , file_index_t index, std::string name
│ │ │ │ │ -      , std::function<void(std::string const&, file_index_t, storage_error
│ │ │ │ │ -const&)> handler) = 0;
│ │ │ │ │ -This function is called when the name of a file in the specified storage has
│ │ │ │ │ -been requested to be renamed. The disk I/O object is responsible for renaming
│ │ │ │ │ -the file without racing with other potentially outstanding operations against
│ │ │ │ │ -the file (such as read, write, move, etc.).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__ddeelleettee__ffiilleess(()) **********
│ │ │ │ │ -virtual void aassyynncc__ddeelleettee__ffiilleess (storage_index_t storage, remove_flags_t
│ │ │ │ │ -options
│ │ │ │ │ -      , std::function<void(storage_error const&)> handler) = 0;
│ │ │ │ │ -This function is called when some file(s) on disk have been requested to be
│ │ │ │ │ -removed by the client. storage indicates which torrent is referred to. See
│ │ │ │ │ -_s_e_s_s_i_o_n___h_a_n_d_l_e for remove_flags_t flags indicating which files are to be
│ │ │ │ │ -removed. e.g. _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_d_e_l_e_t_e___f_i_l_e_s - delete all files _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:
│ │ │ │ │ -_d_e_l_e_t_e___p_a_r_t_f_i_l_e - only delete part file.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__sseett__ffiillee__pprriioorriittyy(()) **********
│ │ │ │ │ -virtual void aassyynncc__sseett__ffiillee__pprriioorriittyy (storage_index_t storage
│ │ │ │ │ -      , aux::vector<download_priority_t, file_index_t> prio
│ │ │ │ │ -      , std::function<void(storage_error const&
│ │ │ │ │ -      , aux::vector<download_priority_t, file_index_t>)> handler) = 0;
│ │ │ │ │ -This is called to set the priority of some or all files. Changing the priority
│ │ │ │ │ -from or to 0 may involve moving data to and from the partfile. The disk I/
│ │ │ │ │ -O object is responsible for correctly synchronizing this work to not race with
│ │ │ │ │ -any potentially outstanding asynchronous operations affecting these files.
│ │ │ │ │ -prio is a vector of the file priority for all files. If it's shorter than the
│ │ │ │ │ -total number of files in the torrent, they are assumed to be set to the default
│ │ │ │ │ -priority.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aassyynncc__cclleeaarr__ppiieeccee(()) **********
│ │ │ │ │ -virtual void aassyynncc__cclleeaarr__ppiieeccee (storage_index_t storage, piece_index_t index
│ │ │ │ │ -      , std::function<void(piece_index_t)> handler) = 0;
│ │ │ │ │ -This is called when a piece fails the hash check, to ensure there are no
│ │ │ │ │ -outstanding disk operations to the piece before blocks are re-requested from
│ │ │ │ │ -peers to overwrite the existing blocks. The disk I/O object does not need to
│ │ │ │ │ -perform any action other than synchronize with all outstanding disk operations
│ │ │ │ │ -to the specified piece before posting the result back.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** uuppddaattee__ssttaattss__ccoouunntteerrss(()) **********
│ │ │ │ │ -virtual void uuppddaattee__ssttaattss__ccoouunntteerrss (counters& c) const = 0;
│ │ │ │ │ -_u_p_d_a_t_e___s_t_a_t_s___c_o_u_n_t_e_r_s_(_) is called to give the disk storage an opportunity to
│ │ │ │ │ -update gauges in the c stats _c_o_u_n_t_e_r_s, that aren't updated continuously as
│ │ │ │ │ -operations are performed. This is called before a snapshot of the _c_o_u_n_t_e_r_s are
│ │ │ │ │ -passed to the client.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett__ssttaattuuss(()) **********
│ │ │ │ │ -virtual std::vector<open_file_state> ggeett__ssttaattuuss (storage_index_t) const = 0;
│ │ │ │ │ -Return a list of all the files that are currently open for the specified
│ │ │ │ │ -storage/torrent. This is is just used for the client to query the currently
│ │ │ │ │ -open files, and which modes those files are open in.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aabboorrtt(()) **********
│ │ │ │ │ -virtual void aabboorrtt (bool wait) = 0;
│ │ │ │ │ -this is called when the _s_e_s_s_i_o_n is starting to shut down. The disk I/O object
│ │ │ │ │ -is expected to flush any outstanding write jobs, cancel hash jobs and initiate
│ │ │ │ │ -tearing down of any internal threads. If wait is true, this should be
│ │ │ │ │ -asynchronous. i.e. this call should not return until all threads have stopped
│ │ │ │ │ -and all jobs have either been aborted or completed and the disk I/O object is
│ │ │ │ │ -ready to be destructed.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ssuubbmmiitt__jjoobbss(()) **********
│ │ │ │ │ -virtual void ssuubbmmiitt__jjoobbss () = 0;
│ │ │ │ │ -This will be called after a batch of disk jobs has been issues (via the async_*
│ │ │ │ │ -). It gives the disk I/O object an opportunity to notify any potential
│ │ │ │ │ -condition variables to wake up the disk thread(s). The async_* calls can of
│ │ │ │ │ -course also notify condition variables, but doing it in this call allows for
│ │ │ │ │ -batching jobs, by issuing the notification once for a collection of jobs.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseettttiinnggss__uuppddaatteedd(()) **********
│ │ │ │ │ -virtual void sseettttiinnggss__uuppddaatteedd () = 0;
│ │ │ │ │ -This is called to notify the disk I/O object that the settings have been
│ │ │ │ │ -updated. In the disk io constructor, a _s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e reference is passed
│ │ │ │ │ -in. Whenever these settings are updated, this function is called to allow the
│ │ │ │ │ -disk I/O object to react to any changed settings relevant to its operations.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  force_copy
│ │ │ │ │ -      force making a copy of the cached block, rather than getting a reference
│ │ │ │ │ -      to a block already in the cache. This is used the block is expected to be
│ │ │ │ │ -      overwritten very soon, by async_write()`, and we need access to the
│ │ │ │ │ -      previous content.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  sequential_access
│ │ │ │ │ -      hint that there may be more disk operations with sequential access to the
│ │ │ │ │ -      file
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  volatile_read
│ │ │ │ │ -      don't keep the read block in cache. This is a hint that this block is
│ │ │ │ │ -      unlikely to be read again anytime soon, and caching it would be wasteful.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  v1_hash
│ │ │ │ │ -      compute a v1 piece hash. This is only used by the _a_s_y_n_c___h_a_s_h_(_) call. If
│ │ │ │ │ -      this flag is not set in the _a_s_y_n_c___h_a_s_h_(_) call, the SHA-1 piece hash does
│ │ │ │ │ -      not need to be computed.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  flush_piece
│ │ │ │ │ -      this flag instructs a hash job that we just completed this piece, and it
│ │ │ │ │ -      should be flushed to disk
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ssttoorraaggee__hhoollddeerr ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___i_n_t_e_r_f_a_c_e_._h_p_p"
│ │ │ │ │ -a unique, owning, reference to the storage of a torrent in a disk io subsystem
│ │ │ │ │ -(class that implements _d_i_s_k___i_n_t_e_r_f_a_c_e). This is held by the internal libtorrent
│ │ │ │ │ -torrent object to tie the storage object allocated for a torrent to the
│ │ │ │ │ -lifetime of the internal torrent object. When a torrent is removed from the
│ │ │ │ │ -_s_e_s_s_i_o_n, this holder is destructed and will inform the disk object.
│ │ │ │ │ -struct storage_holder
│ │ │ │ │ -{
│ │ │ │ │ -   ~~ssttoorraaggee__hhoollddeerr ();
│ │ │ │ │ -   ssttoorraaggee__hhoollddeerr () = default;
│ │ │ │ │ -   ssttoorraaggee__hhoollddeerr (storage_index_t idx, disk_interface& disk_io);
│ │ │ │ │ -   explicit operator bbooooll () const;
│ │ │ │ │ -   operator ssttoorraaggee__iinnddeexx__tt () const;
│ │ │ │ │ -   void rreesseett ();
│ │ │ │ │ -   storage_holder& ooppeerraattoorr== (storage_holder const&) = delete;
│ │ │ │ │ -   ssttoorraaggee__hhoollddeerr (storage_holder const&) = delete;
│ │ │ │ │ -   ssttoorraaggee__hhoollddeerr (storage_holder&& rhs) noexcept;
│ │ │ │ │ -   storage_holder& ooppeerraattoorr== (storage_holder&& rhs) noexcept;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ sseettttiinnggss__iinntteerrffaaccee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ -the common interface to _s_e_t_t_i_n_g_s___p_a_c_k and the internal representation of
│ │ │ │ │ -settings.
│ │ │ │ │ -struct settings_interface
│ │ │ │ │ -{
│ │ │ │ │ -   virtual void sseett__ssttrr (int name, std::string val) = 0;
│ │ │ │ │ -   virtual void sseett__iinntt (int name, int val) = 0;
│ │ │ │ │ -   virtual void sseett__bbooooll (int name, bool val) = 0;
│ │ │ │ │ -   virtual bool hhaass__vvaall (int name) const = 0;
│ │ │ │ │ -   virtual bool ggeett__bbooooll (int name) const = 0;
│ │ │ │ │ -   virtual std::string const& ggeett__ssttrr (int name) const = 0;
│ │ │ │ │ -   virtual int ggeett__iinntt (int name) const = 0;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ bbuuffffeerr__aallllooccaattoorr__iinntteerrffaaccee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_._h_p_p"
│ │ │ │ │ -the interface for freeing disk buffers, used by the _d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r. when
│ │ │ │ │ -implementing _d_i_s_k___i_n_t_e_r_f_a_c_e, this must also be implemented in order to return
│ │ │ │ │ -disk buffers back to libtorrent
│ │ │ │ │ -struct buffer_allocator_interface
│ │ │ │ │ +// throws if this is not a dictionary
│ │ │ │ │ +entry::dictionary_type const& dict = torrent_file.dict();
│ │ │ │ │ +entry::dictionary_type::const_iterator i;
│ │ │ │ │ +i = dict.find("announce");
│ │ │ │ │ +if (i != dict.end())
│ │ │ │ │  {
│ │ │ │ │ -   virtual void ffrreeee__ddiisskk__bbuuffffeerr (char* b) = 0;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddiisskk__bbuuffffeerr__hhoollddeerr ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___b_u_f_f_e_r___h_o_l_d_e_r_._h_p_p"
│ │ │ │ │ -The disk buffer holder acts like a unique_ptr that frees a disk buffer when
│ │ │ │ │ -it's destructed
│ │ │ │ │ -If this buffer holder is moved-from, default constructed or reset, data() will
│ │ │ │ │ -return nullptr.
│ │ │ │ │ -struct disk_buffer_holder
│ │ │ │ │ +        std::string tracker_url = i->second.string();
│ │ │ │ │ +        std::cout << tracker_url << "\n";
│ │ │ │ │ +}
│ │ │ │ │ +The following code is equivalent, but a little bit shorter:
│ │ │ │ │ +entry torrent_file;
│ │ │ │ │ +// ...
│ │ │ │ │ +
│ │ │ │ │ +// throws if this is not a dictionary
│ │ │ │ │ +if (entry* i = torrent_file.find_key("announce"))
│ │ │ │ │  {
│ │ │ │ │ -   disk_buffer_holder& ooppeerraattoorr== (disk_buffer_holder&&) & noexcept;
│ │ │ │ │ -   ddiisskk__bbuuffffeerr__hhoollddeerr (disk_buffer_holder&&) noexcept;
│ │ │ │ │ -   disk_buffer_holder& ooppeerraattoorr== (disk_buffer_holder const&) = delete;
│ │ │ │ │ -   ddiisskk__bbuuffffeerr__hhoollddeerr (disk_buffer_holder const&) = delete;
│ │ │ │ │ -   ddiisskk__bbuuffffeerr__hhoollddeerr (buffer_allocator_interface& alloc
│ │ │ │ │ -      , char* buf, int sz) noexcept;
│ │ │ │ │ -   ddiisskk__bbuuffffeerr__hhoollddeerr () noexcept = default;
│ │ │ │ │ -   ~~ddiisskk__bbuuffffeerr__hhoollddeerr ();
│ │ │ │ │ -   char* ddaattaa () const noexcept;
│ │ │ │ │ -   void rreesseett ();
│ │ │ │ │ -   void sswwaapp (disk_buffer_holder& h) noexcept;
│ │ │ │ │ -   bool iiss__mmuuttaabbllee () const noexcept;
│ │ │ │ │ -   explicit operator bbooooll () const noexcept;
│ │ │ │ │ -   std::ptrdiff_t ssiizzee () const;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ -ddiisskk__bbuuffffeerr__hhoollddeerr (buffer_allocator_interface& alloc
│ │ │ │ │ -      , char* buf, int sz) noexcept;
│ │ │ │ │ -construct a buffer holder that will free the held buffer using a disk buffer
│ │ │ │ │ -pool directly (there's only one disk_buffer_pool per _s_e_s_s_i_o_n)
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ -ddiisskk__bbuuffffeerr__hhoollddeerr () noexcept = default;
│ │ │ │ │ -default construct a holder that does not own any buffer
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ~~ddiisskk__bbuuffffeerr__hhoollddeerr(()) **********
│ │ │ │ │ -~~ddiisskk__bbuuffffeerr__hhoollddeerr ();
│ │ │ │ │ -frees disk buffer held by this object
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddaattaa(()) **********
│ │ │ │ │ -char* ddaattaa () const noexcept;
│ │ │ │ │ -return a pointer to the held buffer, if any. Otherwise returns nullptr.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreesseett(()) **********
│ │ │ │ │ -void rreesseett ();
│ │ │ │ │ -free the held disk buffer, if any, and clear the holder. This sets the holder
│ │ │ │ │ -object to a default-constructed state
│ │ │ │ │ +        std::string tracker_url = i->string();
│ │ │ │ │ +        std::cout << tracker_url << "\n";
│ │ │ │ │ +}
│ │ │ │ │ +To make it easier to extract information from a torrent file, the class
│ │ │ │ │ +_t_o_r_r_e_n_t___i_n_f_o exists.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** sswwaapp(()) **********
│ │ │ │ │ -void sswwaapp (disk_buffer_holder& h) noexcept;
│ │ │ │ │ -swap pointers of two disk buffer holders.
│ │ │ │ │ +void sswwaapp (entry& e);
│ │ │ │ │ +swaps the content of tthhiiss with e.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iiss__mmuuttaabbllee(()) **********
│ │ │ │ │ -bool iiss__mmuuttaabbllee () const noexcept;
│ │ │ │ │ -if this returns true, the buffer may not be modified in place
│ │ │ │ │ +********** ooppeerraattoorr[[]](()) **********
│ │ │ │ │ +entry& ooppeerraattoorr[[]] (string_view key);
│ │ │ │ │ +entry const& ooppeerraattoorr[[]] (string_view key) const;
│ │ │ │ │ +All of these functions requires the _e_n_t_r_y to be a dictionary, if it isn't they
│ │ │ │ │ +will throw system_error.
│ │ │ │ │ +The non-const versions of the operator[] will return a reference to either the
│ │ │ │ │ +existing element at the given key or, if there is no element with the given
│ │ │ │ │ +key, a reference to a newly inserted element at that key.
│ │ │ │ │ +The const version of operator[] will only return a reference to an existing
│ │ │ │ │ +element at the given key. If the key is not found, it will throw system_error.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** bbooooll(()) **********
│ │ │ │ │ -explicit operator bbooooll () const noexcept;
│ │ │ │ │ -implicitly convertible to true if the object is currently holding a buffer
│ │ │ │ │ +********** ffiinndd__kkeeyy(()) **********
│ │ │ │ │ +entry* ffiinndd__kkeeyy (string_view key);
│ │ │ │ │ +entry const* ffiinndd__kkeeyy (string_view key) const;
│ │ │ │ │ +These functions requires the _e_n_t_r_y to be a dictionary, if it isn't they will
│ │ │ │ │ +throw system_error.
│ │ │ │ │ +They will look for an element at the given key in the dictionary, if the
│ │ │ │ │ +element cannot be found, they will return nullptr. If an element with the given
│ │ │ │ │ +key is found, the return a pointer to it.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ffiillee__ooppeenn__mmooddee__tt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_d_i_s_k___i_n_t_e_r_f_a_c_e_._h_p_p"
│ │ │ │ │ -  read_only
│ │ │ │ │ -      open the file for reading only
│ │ │ │ │ -  write_only
│ │ │ │ │ -      open the file for writing only
│ │ │ │ │ -  read_write
│ │ │ │ │ -      open the file for reading and writing
│ │ │ │ │ -  rw_mask
│ │ │ │ │ -      the mask for the bits determining read or write mode
│ │ │ │ │ -  sparse
│ │ │ │ │ -      open the file in sparse mode (if supported by the filesystem).
│ │ │ │ │ -  no_atime
│ │ │ │ │ -      don't update the access timestamps on the file (if supported by the
│ │ │ │ │ -      operating system and filesystem). this generally improves disk
│ │ │ │ │ -      performance.
│ │ │ │ │ -  random_access
│ │ │ │ │ -      When this is not set, the kernel is hinted that access to this file will
│ │ │ │ │ -      be made sequentially.
│ │ │ │ │ -  mmapped
│ │ │ │ │ -      the file is memory mapped
│ │ │ │ │ -You have some control over _s_e_s_s_i_o_n configuration through the session::
│ │ │ │ │ -apply_settings() member function. To change one or more configuration options,
│ │ │ │ │ -create a _s_e_t_t_i_n_g_s___p_a_c_k object and fill it with the settings to be set and pass
│ │ │ │ │ -it in to session::apply_settings().
│ │ │ │ │ -The _s_e_t_t_i_n_g_s___p_a_c_k object is a collection of settings updates that are applied
│ │ │ │ │ -to the _s_e_s_s_i_o_n when passed to session::apply_settings(). It's empty when
│ │ │ │ │ -constructed.
│ │ │ │ │ -You have control over proxy and authorization settings and also the user-agent
│ │ │ │ │ -that will be sent to the tracker. The user-agent will also be used to identify
│ │ │ │ │ -the client with other peers.
│ │ │ │ │ -Each configuration option is named with an enum value inside the _s_e_t_t_i_n_g_s___p_a_c_k
│ │ │ │ │ -class. These are the available settings:
│ │ │ │ │ +********** ttoo__ssttrriinngg(()) **********
│ │ │ │ │ +std::string ttoo__ssttrriinngg (bool single_line = false) const;
│ │ │ │ │ +returns a pretty-printed string representation of the bencoded structure, with
│ │ │ │ │ +JSON-style syntax
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ sseettttiinnggss__ppaacckk ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ -The settings_pack struct, contains the names of all settings as enum values.
│ │ │ │ │ -These values are passed in to the set_str(), set_int(), set_bool() functions,
│ │ │ │ │ -to specify the setting to change.
│ │ │ │ │ -The settings_pack only stores values for settings that have been explicitly set
│ │ │ │ │ -on this object. However, it can still be queried for settings that have not
│ │ │ │ │ -been set and returns the default value for those settings.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ |
│ │ │ │ │ -|_u_s_e_r___a_g_e_n_t_|_s_t_r_i_n_g_|_l_i_b_t_o_r_r_e_n_t_/|
│ │ │ │ │ -this is the client identification to the tracker. The recommended format of
│ │ │ │ │ -this string is: "client-name/client-version libtorrent/libtorrent-version".
│ │ │ │ │ -This name will not only be used when making HTTP requests, but also when
│ │ │ │ │ -sending extended headers to peers that support that extension. It may not
│ │ │ │ │ -contain r or n
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_n_n_o_u_n_c_e___i_p_|_s_t_r_i_n_g_|_n_u_l_l_p_t_r|
│ │ │ │ │ -announce_ip is the ip address passed along to trackers as the &ip= parameter.
│ │ │ │ │ -If left as the default, that parameter is omitted.
│ │ │ │ │ -Note
│ │ │ │ │ -This setting is only meant for very special cases where a seed is running on
│ │ │ │ │ -the same host as the tracker, and the tracker accepts the IP parameter (which
│ │ │ │ │ -normal trackers don't). Do not set this option unless you also control the
│ │ │ │ │ -tracker.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_h_a_n_d_s_h_a_k_e___c_l_i_e_n_t___v_e_r_s_i_o_n_|_s_t_r_i_n_g_|_n_u_l_l_p_t_r|
│ │ │ │ │ -this is the client name and version identifier sent to peers in the handshake
│ │ │ │ │ -message. If this is an empty string, the user_agent is used instead. This
│ │ │ │ │ -string must be a UTF-8 encoded unicode string.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_o_u_t_g_o_i_n_g___i_n_t_e_r_f_a_c_e_s_|_s_t_r_i_n_g_|_ _ _ _ _ _ _ |
│ │ │ │ │ -This controls which IP address outgoing TCP peer connections are bound to, in
│ │ │ │ │ -addition to controlling whether such connections are also bound to a specific
│ │ │ │ │ -network interface/adapter (bbiinndd--ttoo--ddeevviiccee).
│ │ │ │ │ -This string is a comma-separated list of IP addresses and interface names. An
│ │ │ │ │ -empty string will not bind TCP sockets to a device, and let the network stack
│ │ │ │ │ -assign the local address.
│ │ │ │ │ -A list of names will be used to bind outgoing TCP sockets in a round-robin
│ │ │ │ │ -fashion. An IP address will simply be used tobind()the socket. An interface
│ │ │ │ │ -name will attempt to bind the socket to that interface. If that fails, or is
│ │ │ │ │ -unsupported, one of the IP addresses configured for that interface is used
│ │ │ │ │ -tobind()the socket to. If the interface or adapter doesn't exist, the outgoing
│ │ │ │ │ -peer connection will fail with an error message suggesting the device cannot be
│ │ │ │ │ -found. Adapter names on Unix systems are of the form "eth0", "eth1", "tun0",
│ │ │ │ │ -etc. This may be useful for clients that are multi-homed. Binding an outgoing
│ │ │ │ │ -connection to a local IP does not necessarily make the connection via the
│ │ │ │ │ -associated NIC/Adapter.
│ │ │ │ │ -When outgoing interfaces are specified, incoming connections or packets sent to
│ │ │ │ │ -a local interface or IP that's nnoott in this list will be rejected with a
│ │ │ │ │ -_p_e_e_r___b_l_o_c_k_e_d___a_l_e_r_t with invalid_local_interface as the reason.
│ │ │ │ │ -Note that these are just interface/adapter names or IP addresses. There are no
│ │ │ │ │ -ports specified in this list. IPv6 addresses without port should be specified
│ │ │ │ │ -without enclosing [, ].
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_l_i_s_t_e_n___i_n_t_e_r_f_a_c_e_s_|_s_t_r_i_n_g_|_0_._0_._0_._0_:_6_8_8_1_,_[_:_:_]_:_6_8_8_1|
│ │ │ │ │ -a comma-separated list of (IP or device name, port) pairs. These are the listen
│ │ │ │ │ -ports that will be opened for accepting incoming uTP and TCP peer connections.
│ │ │ │ │ -These are also used for oouuttggooiinngg uTP and UDP tracker connections and DHT nodes.
│ │ │ │ │ -It is possible to listen on multiple interfaces and multiple ports. Binding to
│ │ │ │ │ -port 0 will make the operating system pick the port.
│ │ │ │ │ -Note
│ │ │ │ │ -There are reasons to stick to the same port across sessions, which would mean
│ │ │ │ │ -only using port 0 on the first start, and recording the port that was picked
│ │ │ │ │ -for subsequent startups. Trackers, the DHT and other peers will remember the
│ │ │ │ │ -port they see you use and hand that port out to other peers trying to connect
│ │ │ │ │ -to you, as well as trying to connect to you themselves.
│ │ │ │ │ -A port that has an "s" suffix will accept SSL peer connections. (note that SSL
│ │ │ │ │ -sockets are only available in builds with SSL support)
│ │ │ │ │ -A port that has an "l" suffix will be considered a local network. i.e. it's
│ │ │ │ │ -assumed to only be able to reach hosts in the same local network as the IP
│ │ │ │ │ -address (based on the netmask associated with the IP, queried from the
│ │ │ │ │ -operating system).
│ │ │ │ │ -if binding fails, the _l_i_s_t_e_n___f_a_i_l_e_d___a_l_e_r_t is posted. Once a socket binding
│ │ │ │ │ -succeeds (if it does), the _l_i_s_t_e_n___s_u_c_c_e_e_d_e_d___a_l_e_r_t is posted. There may be
│ │ │ │ │ -multiple failures before a success.
│ │ │ │ │ -If a device name that does not exist is configured, no listen socket will be
│ │ │ │ │ -opened for that interface. If this is the only interface configured, it will be
│ │ │ │ │ -as if no listen ports are configured.
│ │ │ │ │ -If no listen ports are configured (e.g. listen_interfaces is an empty string),
│ │ │ │ │ -networking will be disabled. No DHT will start, no outgoing uTP or tracker
│ │ │ │ │ -connections will be made. No incoming TCP or uTP connections will be accepted.
│ │ │ │ │ -(outgoing TCP connections will still be possible, depending on _s_e_t_t_i_n_g_s___p_a_c_k_:_:
│ │ │ │ │ -_o_u_t_g_o_i_n_g___i_n_t_e_r_f_a_c_e_s).
│ │ │ │ │ -For example: [::1]:8888 - will only accept connections on the IPv6 loopback
│ │ │ │ │ -address on port 8888.
│ │ │ │ │ -eth0:4444,eth1:4444 - will accept connections on port 4444 on any IP address
│ │ │ │ │ -bound to device eth0 or eth1.
│ │ │ │ │ -[::]:0s - will accept SSL connections on a port chosen by the OS. And not
│ │ │ │ │ -accept non-SSL connections at all.
│ │ │ │ │ -0.0.0.0:6881,[::]:6881 - binds to all interfaces on port 6881.
│ │ │ │ │ -10.0.1.13:6881l - binds to the local IP address, port 6881, but only allow
│ │ │ │ │ -talking to peers on the same local network. The netmask is queried from the
│ │ │ │ │ -operating system. Interfaces marked l are not announced to trackers, unless the
│ │ │ │ │ -tracker is also on the same local network.
│ │ │ │ │ -Windows OS network adapter device name must be specified with GUID. It can be
│ │ │ │ │ -obtained from "netsh lan show interfaces" command output. GUID must be
│ │ │ │ │ -uppercased string embraced in curly brackets. {E4F0B674-0DFC-48BB-98A5-
│ │ │ │ │ -2AA730BDB6D6}:7777 - will accept connections on port 7777 on adapter with this
│ │ │ │ │ -GUID.
│ │ │ │ │ -For more information, see the _M_u_l_t_i_-_h_o_m_e_d_ _h_o_s_t_s section.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_r_o_x_y___h_o_s_t_n_a_m_e_|_s_t_r_i_n_g_|_ _ _ _ _ _ _ |
│ │ │ │ │ -when using a proxy, this is the hostname where the proxy is running see
│ │ │ │ │ -proxy_type. Note that when using a proxy, the _s_e_t_t_i_n_g_s___p_a_c_k_:_:_l_i_s_t_e_n___i_n_t_e_r_f_a_c_e_s
│ │ │ │ │ -setting is overridden and only a single interface is created, just to contact
│ │ │ │ │ -the proxy. This means a proxy cannot be combined with SSL torrents or multiple
│ │ │ │ │ -listen interfaces. This proxy listen interface will not accept incoming TCP
│ │ │ │ │ -connections, will not map ports with any gateway and will not enable local
│ │ │ │ │ -service discovery. All traffic is supposed to be channeled through the proxy.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_r_o_x_y___u_s_e_r_n_a_m_e_|_s_t_r_i_n_g_|_ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_r_o_x_y___p_a_s_s_w_o_r_d_|_s_t_r_i_n_g_|_ _ _ _ _ _ _ |
│ │ │ │ │ -when using a proxy, these are the credentials (if any) to use when connecting
│ │ │ │ │ -to it. see proxy_type
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_i_2_p___h_o_s_t_n_a_m_e_|_s_t_r_i_n_g_|_ _ _ _ _ _ _ |
│ │ │ │ │ -sets the _i_2_p SAM bridge to connect to. set the port with the i2p_port setting.
│ │ │ │ │ -Unless this is set, i2p torrents are not supported. This setting is separate
│ │ │ │ │ -from the other proxy settings since i2p torrents and their peers are
│ │ │ │ │ -orthogonal. You can have i2p peers as well as regular peers via a proxy.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt_ |
│ │ │ │ │ -|_p_e_e_r___f_i_n_g_e_r_p_r_i_n_t_|_s_t_r_i_n_g_|_-_L_T_2_0_B_0_-|
│ │ │ │ │ -this is the fingerprint for the client. It will be used as the prefix to the
│ │ │ │ │ -peer_id. If this is 20 bytes (or longer) it will be truncated to 20 bytes and
│ │ │ │ │ -used as the entire peer-id
│ │ │ │ │ -There is a utility function, _g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_t_(_) that can be used to
│ │ │ │ │ -generate a standard client peer ID fingerprint prefix.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_ _ _|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_h_t___b_o_o_t_s_t_r_a_p___n_o_d_e_s_|_s_t_r_i_n_g_|_d_h_t_._l_i_b_t_o_r_r_e_n_t_._o_r_g_:_2_5_4_0_1|
│ │ │ │ │ -This is a comma-separated list of IP port-pairs. They will be added to the DHT
│ │ │ │ │ -node (if it's enabled) as back-up nodes in case we don't know of any.
│ │ │ │ │ -Changing these after the DHT has been started may not have any effect until the
│ │ │ │ │ -DHT is restarted. Here are some other bootstrap nodes that may work:
│ │ │ │ │ -router.bittorrent.com:6881, dht.transmissionbt.com:6881 router.bt.ouinet.work:
│ │ │ │ │ -6881,
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_l_l_o_w___m_u_l_t_i_p_l_e___c_o_n_n_e_c_t_i_o_n_s___p_e_r___i_p_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -determines if connections from the same IP address as existing connections
│ │ │ │ │ -should be rejected or not. Rejecting multiple connections from the same IP
│ │ │ │ │ -address will prevent abusive behavior by peers. The logic for determining
│ │ │ │ │ -whether connections are to the same peer is more complicated with this enabled,
│ │ │ │ │ -and more likely to fail in some edge cases. It is not recommended to enable
│ │ │ │ │ -this feature.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_e_n_d___r_e_d_u_n_d_a_n_t___h_a_v_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -send_redundant_have controls if have messages will be sent to peers that
│ │ │ │ │ -already have the piece. This is typically not necessary, but it might be
│ │ │ │ │ -necessary for collecting statistics in some cases.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_s_e___d_h_t___a_s___f_a_l_l_b_a_c_k_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -use_dht_as_fallback determines how the DHT is used. If this is true, the DHT
│ │ │ │ │ -will only be used for torrents where all trackers in its tracker list has
│ │ │ │ │ -failed. Either by an explicit error message or a time out. If this is false,
│ │ │ │ │ -the DHT is used regardless of if the trackers fail or not.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_p_n_p___i_g_n_o_r_e___n_o_n_r_o_u_t_e_r_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -upnp_ignore_nonrouters indicates whether or not the UPnP implementation should
│ │ │ │ │ -ignore any broadcast response from a device whose address is not on our subnet.
│ │ │ │ │ -i.e. it's a way to not talk to other people's routers by mistake.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_s_e___p_a_r_o_l_e___m_o_d_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -use_parole_mode specifies if parole mode should be used. Parole mode means that
│ │ │ │ │ -peers that participate in pieces that fail the hash check are put in a mode
│ │ │ │ │ -where they are only allowed to download whole pieces. If the whole piece a peer
│ │ │ │ │ -in parole mode fails the hash check, it is banned. If a peer participates in a
│ │ │ │ │ -piece that passes the hash check, it is taken out of parole mode.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_u_t_o___m_a_n_a_g_e___p_r_e_f_e_r___s_e_e_d_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -if true, prefer seeding torrents when determining which torrents to give active
│ │ │ │ │ -slots to. If false, give preference to downloading torrents
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_o_n_t___c_o_u_n_t___s_l_o_w___t_o_r_r_e_n_t_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -if dont_count_slow_torrents is true, torrents without any payload transfers are
│ │ │ │ │ -not subject to the active_seeds and active_downloads limits. This is intended
│ │ │ │ │ -to make it more likely to utilize all available bandwidth, and avoid having
│ │ │ │ │ -torrents that don't transfer anything block the active slots.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_c_l_o_s_e___r_e_d_u_n_d_a_n_t___c_o_n_n_e_c_t_i_o_n_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -close_redundant_connections specifies whether libtorrent should close
│ │ │ │ │ -connections where both ends have no utility in keeping the connection open. For
│ │ │ │ │ -instance if both ends have completed their downloads, there's no point in
│ │ │ │ │ -keeping it open.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_r_i_o_r_i_t_i_z_e___p_a_r_t_i_a_l___p_i_e_c_e_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -If prioritize_partial_pieces is true, partial pieces are picked before pieces
│ │ │ │ │ -that are more rare. If false, rare pieces are always prioritized, unless the
│ │ │ │ │ -number of partial pieces is growing out of proportion.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_r_a_t_e___l_i_m_i_t___i_p___o_v_e_r_h_e_a_d_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -if set to true, the estimated TCP/IP overhead is drained from the rate
│ │ │ │ │ -limiters, to avoid exceeding the limits with the total traffic
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_n_n_o_u_n_c_e___t_o___a_l_l___t_i_e_r_s_ _ _ _|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -|_a_n_n_o_u_n_c_e___t_o___a_l_l___t_r_a_c_k_e_r_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -announce_to_all_trackers controls how multi tracker torrents are treated. If
│ │ │ │ │ -this is set to true, all trackers in the same tier are announced to in
│ │ │ │ │ -parallel. If all trackers in tier 0 fails, all trackers in tier 1 are announced
│ │ │ │ │ -as well. If it's set to false, the behavior is as defined by the multi tracker
│ │ │ │ │ -specification.
│ │ │ │ │ -announce_to_all_tiers also controls how multi tracker torrents are treated.
│ │ │ │ │ -When this is set to true, one tracker from each tier is announced to. This is
│ │ │ │ │ -the uTorrent behavior. To be compliant with the Multi-tracker specification,
│ │ │ │ │ -set it to false.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_r_e_f_e_r___u_d_p___t_r_a_c_k_e_r_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -prefer_udp_trackers: true means that trackers may be rearranged in a way that
│ │ │ │ │ -udp trackers are always tried before http trackers for the same hostname.
│ │ │ │ │ -Setting this to false means that the tracker's tier is respected and there's no
│ │ │ │ │ -preference of one protocol over another.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_i_s_a_b_l_e___h_a_s_h___c_h_e_c_k_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -when set to true, all data downloaded from peers will be assumed to be correct,
│ │ │ │ │ -and not tested to match the hashes in the torrent this is only useful for
│ │ │ │ │ -simulation and testing purposes (typically combined with disabled_storage)
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_l_l_o_w___i_2_p___m_i_x_e_d_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -if this is true, i2p torrents are allowed to also get peers from other sources
│ │ │ │ │ -than the tracker, and connect to regular IPs, not providing any anonymization.
│ │ │ │ │ -This may be useful if the user is not interested in the anonymization of i2p,
│ │ │ │ │ -but still wants to be able to connect to i2p peers.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_n_o___a_t_i_m_e___s_t_o_r_a_g_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -no_atime_storage this is a Linux-only option and passes in the O_NOATIME to
│ │ │ │ │ -open() when opening files. This may lead to some disk performance improvements.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_i_n_c_o_m_i_n_g___s_t_a_r_t_s___q_u_e_u_e_d___t_o_r_r_e_n_t_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -incoming_starts_queued_torrents. If a torrent has been paused by the auto
│ │ │ │ │ -managed feature in libtorrent, i.e. the torrent is paused and auto managed,
│ │ │ │ │ -this feature affects whether or not it is automatically started on an incoming
│ │ │ │ │ -connection. The main reason to queue torrents, is not to make them unavailable,
│ │ │ │ │ -but to save on the overhead of announcing to the trackers, the DHT and to avoid
│ │ │ │ │ -spreading one's unchoke slots too thin. If a peer managed to find us, even
│ │ │ │ │ -though we're no in the torrent anymore, this setting can make us start the
│ │ │ │ │ -torrent and serve it.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_r_e_p_o_r_t___t_r_u_e___d_o_w_n_l_o_a_d_e_d_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -when set to true, the downloaded counter sent to trackers will include the
│ │ │ │ │ -actual number of payload bytes downloaded including redundant bytes. If set to
│ │ │ │ │ -false, it will not include any redundancy bytes
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_t_r_i_c_t___e_n_d___g_a_m_e___m_o_d_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -strict_end_game_mode controls when a block may be requested twice. If this is
│ │ │ │ │ -true, a block may only be requested twice when there's at least one request to
│ │ │ │ │ -every piece that's left to download in the torrent. This may slow down progress
│ │ │ │ │ -on some pieces sometimes, but it may also avoid downloading a lot of redundant
│ │ │ │ │ -bytes. If this is false, libtorrent attempts to use each peer connection to its
│ │ │ │ │ -max, by always requesting something, even if it means requesting something that
│ │ │ │ │ -has been requested from another peer already.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_e_n_a_b_l_e___o_u_t_g_o_i_n_g___u_t_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -|_e_n_a_b_l_e___i_n_c_o_m_i_n_g___u_t_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -|_e_n_a_b_l_e___o_u_t_g_o_i_n_g___t_c_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -|_e_n_a_b_l_e___i_n_c_o_m_i_n_g___t_c_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -Enables incoming and outgoing, TCP and uTP peer connections. false is disabled
│ │ │ │ │ -and true is enabled. When outgoing connections are disabled, libtorrent will
│ │ │ │ │ -simply not make outgoing peer connections with the specific transport protocol.
│ │ │ │ │ -Disabled incoming peer connections will simply be rejected. These options only
│ │ │ │ │ -apply to peer connections, not tracker- or any other kinds of connections.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_n_o___r_e_c_h_e_c_k___i_n_c_o_m_p_l_e_t_e___r_e_s_u_m_e_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -no_recheck_incomplete_resume determines if the storage should check the whole
│ │ │ │ │ -files when resume data is incomplete or missing or whether it should simply
│ │ │ │ │ -assume we don't have any of the data. If false, any existing files will be
│ │ │ │ │ -checked. By setting this setting to true, the files won't be checked, but will
│ │ │ │ │ -go straight to download mode.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_n_o_n_y_m_o_u_s___m_o_d_e_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -anonymous_mode: When set to true, the client tries to hide its identity to a
│ │ │ │ │ -certain degree.
│ │ │ │ │ -    * A generic user-agent will be used for trackers (except for private
│ │ │ │ │ -      torrents).
│ │ │ │ │ -    * Your local IPv4 and IPv6 address won't be sent as query string parameters
│ │ │ │ │ -      to private trackers.
│ │ │ │ │ -    * If announce_ip is configured, it will not be sent to trackers
│ │ │ │ │ -    * The client version will not be sent to peers in the extension handshake.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_r_e_p_o_r_t___w_e_b___s_e_e_d___d_o_w_n_l_o_a_d_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -specifies whether downloads from web seeds is reported to the tracker or not.
│ │ │ │ │ -Turning it off also excludes web seed traffic from other stats and download
│ │ │ │ │ -rate reporting via the libtorrent API.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_e_e_d_i_n_g___o_u_t_g_o_i_n_g___c_o_n_n_e_c_t_i_o_n_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -seeding_outgoing_connections determines if seeding (and finished) torrents
│ │ │ │ │ -should attempt to make outgoing connections or not. It may be set to false in
│ │ │ │ │ -very specific applications where the cost of making outgoing connections is
│ │ │ │ │ -high, and there are no or small benefits of doing so. For instance, if no nodes
│ │ │ │ │ -are behind a firewall or a NAT, seeds don't need to make outgoing connections.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_n_o___c_o_n_n_e_c_t___p_r_i_v_i_l_e_g_e_d___p_o_r_t_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -when this is true, libtorrent will not attempt to make outgoing connections to
│ │ │ │ │ -peers whose port is < 1024. This is a safety precaution to avoid being part of
│ │ │ │ │ -a DDoS attack
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_m_o_o_t_h___c_o_n_n_e_c_t_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -smooth_connects means the number of connection attempts per second may be
│ │ │ │ │ -limited to below the connection_speed, in case we're close to bump up against
│ │ │ │ │ -the limit of number of connections. The intention of this setting is to more
│ │ │ │ │ -evenly distribute our connection attempts over time, instead of attempting to
│ │ │ │ │ -connect in batches, and timing them out in batches.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_l_w_a_y_s___s_e_n_d___u_s_e_r___a_g_e_n_t_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -always send user-agent in every web seed request. If false, only the first
│ │ │ │ │ -request per http connection will include the user agent
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_p_p_l_y___i_p___f_i_l_t_e_r___t_o___t_r_a_c_k_e_r_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -apply_ip_filter_to_trackers determines whether the IP filter applies to
│ │ │ │ │ -trackers as well as peers. If this is set to false, trackers are exempt from
│ │ │ │ │ -the IP filter (if there is one). If no IP filter is set, this setting is
│ │ │ │ │ -irrelevant.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_b_a_n___w_e_b___s_e_e_d_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -when true, web seeds sending bad data will be banned
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_u_p_p_o_r_t___s_h_a_r_e___m_o_d_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -if false, prevents libtorrent to advertise share-mode support
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_r_e_p_o_r_t___r_e_d_u_n_d_a_n_t___b_y_t_e_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -if this is true, the number of redundant bytes is sent to the tracker
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_l_i_s_t_e_n___s_y_s_t_e_m___p_o_r_t___f_a_l_l_b_a_c_k_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -if this is true, libtorrent will fall back to listening on a port chosen by the
│ │ │ │ │ -operating system (i.e. binding to port 0). If a failure is preferred, set this
│ │ │ │ │ -to false.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_n_n_o_u_n_c_e___c_r_y_p_t_o___s_u_p_p_o_r_t_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -when this is true, and incoming encrypted connections are enabled,
│ │ │ │ │ -&supportcrypt=1 is included in http tracker announces
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_e_n_a_b_l_e___u_p_n_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -Starts and stops the UPnP service. When started, the listen port and the DHT
│ │ │ │ │ -port are attempted to be forwarded on local UPnP router devices.
│ │ │ │ │ -The upnp object returned by start_upnp() can be used to add and remove
│ │ │ │ │ -arbitrary port mappings. Mapping status is returned through the _p_o_r_t_m_a_p___a_l_e_r_t
│ │ │ │ │ -and the _p_o_r_t_m_a_p___e_r_r_o_r___a_l_e_r_t. The object will be valid until stop_upnp() is
│ │ │ │ │ -called. See _u_p_n_p_ _a_n_d_ _n_a_t_ _p_m_p.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_e_n_a_b_l_e___n_a_t_p_m_p_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -Starts and stops the NAT-PMP service. When started, the listen port and the DHT
│ │ │ │ │ -port are attempted to be forwarded on the router through NAT-PMP.
│ │ │ │ │ -The natpmp object returned by start_natpmp() can be used to add and remove
│ │ │ │ │ -arbitrary port mappings. Mapping status is returned through the _p_o_r_t_m_a_p___a_l_e_r_t
│ │ │ │ │ -and the _p_o_r_t_m_a_p___e_r_r_o_r___a_l_e_r_t. The object will be valid until stop_natpmp() is
│ │ │ │ │ -called. See _u_p_n_p_ _a_n_d_ _n_a_t_ _p_m_p.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_e_n_a_b_l_e___l_s_d_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -Starts and stops Local Service Discovery. This service will broadcast the info-
│ │ │ │ │ -hashes of all the non-private torrents on the local network to look for peers
│ │ │ │ │ -on the same swarm within multicast reach.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_e_n_a_b_l_e___d_h_t_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -starts the dht node and makes the trackerless service available to torrents.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_r_e_f_e_r___r_c_4_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -if the allowed encryption level is both, setting this to true will prefer RC4
│ │ │ │ │ -if both methods are offered, plain text otherwise
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_r_o_x_y___h_o_s_t_n_a_m_e_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -if true, hostname lookups are done via the configured proxy (if any). This is
│ │ │ │ │ -only supported by SOCKS5 and HTTP.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_r_o_x_y___p_e_e_r___c_o_n_n_e_c_t_i_o_n_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -if true, peer connections are made (and accepted) over the configured proxy, if
│ │ │ │ │ -any. Web seeds as well as regular bittorrent peer connections are considered
│ │ │ │ │ -"peer connections". Anything transporting actual torrent payload (trackers and
│ │ │ │ │ -DHT traffic are not considered peer connections).
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_u_t_o___s_e_q_u_e_n_t_i_a_l_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -if this setting is true, torrents with a very high availability of pieces (and
│ │ │ │ │ -seeds) are downloaded sequentially. This is more efficient for the disk I/O.
│ │ │ │ │ -With many seeds, the download order is unlikely to matter anyway
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_r_o_x_y___t_r_a_c_k_e_r___c_o_n_n_e_c_t_i_o_n_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -if true, tracker connections are made over the configured proxy, if any.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_e_n_a_b_l_e___i_p___n_o_t_i_f_i_e_r_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -Starts and stops the internal IP table route changes notifier.
│ │ │ │ │ -The current implementation supports multiple platforms, and it is recommended
│ │ │ │ │ -to have it enable, but you may want to disable it if it's supported but
│ │ │ │ │ -unreliable, or if you have a better way to detect the changes. In the later
│ │ │ │ │ -case, you should manually call session_handle::reopen_network_sockets to ensure
│ │ │ │ │ -network changes are taken in consideration.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___p_r_e_f_e_r___v_e_r_i_f_i_e_d___n_o_d_e___i_d_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -when this is true, nodes whose IDs are derived from their source IP according
│ │ │ │ │ -to _B_E_P_ _4_2 are preferred in the routing table.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___r_e_s_t_r_i_c_t___r_o_u_t_i_n_g___i_p_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -determines if the routing table entries should restrict entries to one per IP.
│ │ │ │ │ -This defaults to true, which helps mitigate some attacks on the DHT. It
│ │ │ │ │ -prevents adding multiple nodes with IPs with a very close CIDR distance.
│ │ │ │ │ -when set, nodes whose IP address that's in the same /24 (or /64 for IPv6) range
│ │ │ │ │ -in the same routing table bucket. This is an attempt to mitigate node ID
│ │ │ │ │ -spoofing attacks also restrict any IP to only have a single _e_n_t_r_y in the whole
│ │ │ │ │ -routing table
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___r_e_s_t_r_i_c_t___s_e_a_r_c_h___i_p_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -determines if DHT searches should prevent adding nodes with IPs with very close
│ │ │ │ │ -CIDR distance. This also defaults to true and helps mitigate certain attacks on
│ │ │ │ │ -the DHT.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___e_x_t_e_n_d_e_d___r_o_u_t_i_n_g___t_a_b_l_e_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -makes the first buckets in the DHT routing table fit 128, 64, 32 and 16 nodes
│ │ │ │ │ -respectively, as opposed to the standard size of 8. All other buckets have size
│ │ │ │ │ -8 still.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___a_g_g_r_e_s_s_i_v_e___l_o_o_k_u_p_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -slightly changes the lookup behavior in terms of how many outstanding requests
│ │ │ │ │ -we keep. Instead of having branch factor be a hard limit, we always keep bbrraanncchh
│ │ │ │ │ -ffaaccttoorr outstanding requests to the closest nodes. i.e. every time we get
│ │ │ │ │ -results back with closer nodes, we query them right away. It lowers the lookup
│ │ │ │ │ -times at the cost of more outstanding queries.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___p_r_i_v_a_c_y___l_o_o_k_u_p_s_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -when set, perform lookups in a way that is slightly more expensive, but which
│ │ │ │ │ -minimizes the amount of information leaked about you.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___e_n_f_o_r_c_e___n_o_d_e___i_d_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -when set, node's whose IDs that are not correctly generated based on its
│ │ │ │ │ -external IP are ignored. When a query arrives from such node, an error message
│ │ │ │ │ -is returned with a message saying "invalid node ID".
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___i_g_n_o_r_e___d_a_r_k___i_n_t_e_r_n_e_t_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -ignore DHT messages from parts of the internet we wouldn't expect to see any
│ │ │ │ │ -traffic from
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___r_e_a_d___o_n_l_y_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -when set, the other nodes won't keep this node in their routing tables, it's
│ │ │ │ │ -meant for low-power and/or ephemeral devices that cannot support the DHT, it is
│ │ │ │ │ -also useful for mobile devices which are sensitive to network traffic and
│ │ │ │ │ -battery life. this node no longer responds to 'query' messages, and will place
│ │ │ │ │ -a 'ro' key (value = 1) in the top-level message dictionary of outgoing query
│ │ │ │ │ -messages.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_i_e_c_e___e_x_t_e_n_t___a_f_f_i_n_i_t_y_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -when this is true, create an affinity for downloading 4 MiB extents of adjacent
│ │ │ │ │ -pieces. This is an attempt to achieve better disk I/O throughput by downloading
│ │ │ │ │ -larger extents of bytes, for torrents with small piece sizes
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_v_a_l_i_d_a_t_e___h_t_t_p_s___t_r_a_c_k_e_r_s_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -when set to true, the certificate of HTTPS trackers and HTTPS web seeds will be
│ │ │ │ │ -validated against the system's certificate store (as defined by OpenSSL). If
│ │ │ │ │ -the system does not have a certificate store, this option may have to be
│ │ │ │ │ -disabled in order to get trackers and web seeds to work).
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_s_r_f___m_i_t_i_g_a_t_i_o_n_|_b_o_o_l_|_t_r_u_e_ _ _ |
│ │ │ │ │ -when enabled, tracker and web seed requests are subject to certain
│ │ │ │ │ -restrictions.
│ │ │ │ │ -An HTTP(s) tracker requests to localhost (loopback) must have the request path
│ │ │ │ │ -start with "/announce". This is the conventional bittorrent tracker request.
│ │ │ │ │ -Any other HTTP(S) tracker request to loopback will be rejected. This applies to
│ │ │ │ │ -trackers that redirect to loopback as well.
│ │ │ │ │ -Web seeds that end up on the client's local network (i.e. in a private IP
│ │ │ │ │ -address range) may not include query string arguments. This applies to web
│ │ │ │ │ -seeds redirecting to the local network as well.
│ │ │ │ │ -Web seeds on global IPs (i.e. not local network) may not redirect to a local
│ │ │ │ │ -network address
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_l_l_o_w___i_d_n_a_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -when disabled, any tracker or web seed with an IDNA hostname (internationalized
│ │ │ │ │ -domain name) is ignored. This is a security precaution to avoid various unicode
│ │ │ │ │ -encoding attacks that might happen at the application level.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_e_n_a_b_l_e___s_e_t___f_i_l_e___v_a_l_i_d___d_a_t_a_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -when set to true, enables the attempt to use SetFileValidData() to pre-allocate
│ │ │ │ │ -disk space. This system call will only work when running with Administrator
│ │ │ │ │ -privileges on Windows, and so this setting is only relevant in that scenario.
│ │ │ │ │ -Using SetFileValidData() poses a security risk, as it may reveal previously
│ │ │ │ │ -deleted information from the disk.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_o_c_k_s_5___u_d_p___s_e_n_d___l_o_c_a_l___e_p_|_b_o_o_l_|_f_a_l_s_e_ _ |
│ │ │ │ │ -When using a SOCKS5 proxy, UDP traffic is routed through the proxy by sending a
│ │ │ │ │ -UDP ASSOCIATE command. If this option is true, the UDP ASSOCIATE command will
│ │ │ │ │ -include the IP address and listen port to the local UDP socket. This indicates
│ │ │ │ │ -to the proxy which source endpoint to expect our packets from. The benefit is
│ │ │ │ │ -that incoming packets can be forwarded correctly, before any outgoing packets
│ │ │ │ │ -are sent. The risk is that if there's a NAT between the client and the proxy,
│ │ │ │ │ -the IP address specified in the protocol may not be valid from the proxy's
│ │ │ │ │ -point of view.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_t_r_a_c_k_e_r___c_o_m_p_l_e_t_i_o_n___t_i_m_e_o_u_t_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ -tracker_completion_timeout is the number of seconds the tracker connection will
│ │ │ │ │ -wait from when it sent the request until it considers the tracker to have
│ │ │ │ │ -timed-out.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_t_r_a_c_k_e_r___r_e_c_e_i_v_e___t_i_m_e_o_u_t_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ -tracker_receive_timeout is the number of seconds to wait to receive any data
│ │ │ │ │ -from the tracker. If no data is received for this number of seconds, the
│ │ │ │ │ -tracker will be considered as having timed out. If a tracker is down, this is
│ │ │ │ │ -the kind of timeout that will occur.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_t_o_p___t_r_a_c_k_e_r___t_i_m_e_o_u_t_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ -stop_tracker_timeout is the number of seconds to wait when sending a stopped
│ │ │ │ │ -message before considering a tracker to have timed out. This is usually
│ │ │ │ │ -shorter, to make the client quit faster. If the value is set to 0, the
│ │ │ │ │ -connections to trackers with the stopped event are suppressed.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ |
│ │ │ │ │ -|_t_r_a_c_k_e_r___m_a_x_i_m_u_m___r_e_s_p_o_n_s_e___l_e_n_g_t_h_|_i_n_t_ _|_1_0_2_4_*_1_0_2_4|
│ │ │ │ │ -this is the maximum number of bytes in a tracker response. If a response size
│ │ │ │ │ -passes this number of bytes it will be rejected and the connection will be
│ │ │ │ │ -closed. On gzipped responses this size is measured on the uncompressed data.
│ │ │ │ │ -So, if you get 20 bytes of gzip response that'll expand to 2 megabytes, it will
│ │ │ │ │ -be interrupted before the entire response has been uncompressed (assuming the
│ │ │ │ │ -limit is lower than 2 MiB).
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_i_e_c_e___t_i_m_e_o_u_t_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ -the number of seconds from a request is sent until it times out if no piece
│ │ │ │ │ -response is returned.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_r_e_q_u_e_s_t___t_i_m_e_o_u_t_|_i_n_t_ _|_6_0_ _ _ _ _ |
│ │ │ │ │ -the number of seconds one block (16 kiB) is expected to be received within. If
│ │ │ │ │ -it's not, the block is requested from a different peer
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_r_e_q_u_e_s_t___q_u_e_u_e___t_i_m_e_|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ -the length of the request queue given in the number of seconds it should take
│ │ │ │ │ -for the other end to send all the pieces. i.e. the actual number of requests
│ │ │ │ │ -depends on the download rate and this number.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_a_x___a_l_l_o_w_e_d___i_n___r_e_q_u_e_s_t___q_u_e_u_e_|_i_n_t_ _|_2_0_0_0_ _ _ |
│ │ │ │ │ -the number of outstanding block requests a peer is allowed to queue up in the
│ │ │ │ │ -client. If a peer sends more requests than this (before the first one has been
│ │ │ │ │ -sent) the last request will be dropped. the higher this is, the faster upload
│ │ │ │ │ -speeds the client can get to a single peer.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_a_x___o_u_t___r_e_q_u_e_s_t___q_u_e_u_e_|_i_n_t_ _|_5_0_0_ _ _ _ |
│ │ │ │ │ -max_out_request_queue is the maximum number of outstanding requests to send to
│ │ │ │ │ -a peer. This limit takes precedence over request_queue_time. i.e. no matter the
│ │ │ │ │ -download speed, the number of outstanding requests will never exceed this
│ │ │ │ │ -limit.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_w_h_o_l_e___p_i_e_c_e_s___t_h_r_e_s_h_o_l_d_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ -if a whole piece can be downloaded in this number of seconds, or less, the
│ │ │ │ │ -peer_connection will prefer to request whole pieces at a time from this peer.
│ │ │ │ │ -The benefit of this is to better utilize disk caches by doing localized
│ │ │ │ │ -accesses and also to make it easier to identify bad peers if a piece fails the
│ │ │ │ │ -hash check.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_e_e_r___t_i_m_e_o_u_t_|_i_n_t_ _|_1_2_0_ _ _ _ |
│ │ │ │ │ -peer_timeout is the number of seconds the peer connection should wait (for any
│ │ │ │ │ -activity on the peer connection) before closing it due to time out. 120 seconds
│ │ │ │ │ -is specified in the protocol specification. After half the time out, a keep
│ │ │ │ │ -alive message is sent.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_r_l_s_e_e_d___t_i_m_e_o_u_t_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ -same as peer_timeout, but only applies to url-seeds. this is usually set lower,
│ │ │ │ │ -because web servers are expected to be more reliable.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_r_l_s_e_e_d___p_i_p_e_l_i_n_e___s_i_z_e_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ -controls the pipelining size of url and http seeds. i.e. the number of HTTP
│ │ │ │ │ -request to keep outstanding before waiting for the first one to complete. It's
│ │ │ │ │ -common for web servers to limit this to a relatively low number, like 5
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_r_l_s_e_e_d___w_a_i_t___r_e_t_r_y_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ -number of seconds until a new retry of a url-seed takes place. Default retry
│ │ │ │ │ -value for http-seeds that don't provide a valid retry-after header.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_f_i_l_e___p_o_o_l___s_i_z_e_|_i_n_t_ _|_4_0_ _ _ _ _ |
│ │ │ │ │ -sets the upper limit on the total number of files this _s_e_s_s_i_o_n will keep open.
│ │ │ │ │ -The reason why files are left open at all is that some anti virus software
│ │ │ │ │ -hooks on every file close, and scans the file for viruses. deferring the
│ │ │ │ │ -closing of the files will be the difference between a usable system and a
│ │ │ │ │ -completely hogged down system. Most operating systems also has a limit on the
│ │ │ │ │ -total number of file descriptors a process may have open.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_a_x___f_a_i_l_c_o_u_n_t_|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ -max_failcount is the maximum times we try to connect to a peer before stop
│ │ │ │ │ -connecting again. If a peer succeeds, the failure counter is reset. If a peer
│ │ │ │ │ -is retrieved from a peer source (other than DHT) the failcount is decremented
│ │ │ │ │ -by one, allowing another try.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_i_n___r_e_c_o_n_n_e_c_t___t_i_m_e_|_i_n_t_ _|_6_0_ _ _ _ _ |
│ │ │ │ │ -the number of seconds to wait to reconnect to a peer. this time is multiplied
│ │ │ │ │ -with the failcount.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_e_e_r___c_o_n_n_e_c_t___t_i_m_e_o_u_t_|_i_n_t_ _|_1_5_ _ _ _ _ |
│ │ │ │ │ -peer_connect_timeout the number of seconds to wait after a connection attempt
│ │ │ │ │ -is initiated to a peer until it is considered as having timed out. This setting
│ │ │ │ │ -is especially important in case the number of half-open connections are
│ │ │ │ │ -limited, since stale half-open connection may delay the connection of other
│ │ │ │ │ -peers considerably.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_c_o_n_n_e_c_t_i_o_n___s_p_e_e_d_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ -connection_speed is the number of connection attempts that are made per second.
│ │ │ │ │ -If a number < 0 is specified, it will default to 200 connections per second. If
│ │ │ │ │ -0 is specified, it means don't make outgoing connections at all.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_i_n_a_c_t_i_v_i_t_y___t_i_m_e_o_u_t_|_i_n_t_ _|_6_0_0_ _ _ _ |
│ │ │ │ │ -if a peer is uninteresting and uninterested for longer than this number of
│ │ │ │ │ -seconds, it will be disconnected.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_n_c_h_o_k_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_1_5_ _ _ _ _ |
│ │ │ │ │ -unchoke_interval is the number of seconds between chokes/unchokes. On this
│ │ │ │ │ -interval, peers are re-evaluated for being choked/unchoked. This is defined as
│ │ │ │ │ -30 seconds in the protocol, and it should be significantly longer than what it
│ │ │ │ │ -takes for TCP to ramp up to it's max rate.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_o_p_t_i_m_i_s_t_i_c___u_n_c_h_o_k_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ -optimistic_unchoke_interval is the number of seconds between each ooppttiimmiissttiicc
│ │ │ │ │ -unchoke. On this timer, the currently optimistically unchoked peer will change.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_n_u_m___w_a_n_t_|_i_n_t_ _|_2_0_0_ _ _ _ |
│ │ │ │ │ -num_want is the number of peers we want from each tracker request. It defines
│ │ │ │ │ -what is sent as the &num_want= parameter to the tracker.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_i_n_i_t_i_a_l___p_i_c_k_e_r___t_h_r_e_s_h_o_l_d_|_i_n_t_ _|_4_ _ _ _ _ _ |
│ │ │ │ │ -initial_picker_threshold specifies the number of pieces we need before we
│ │ │ │ │ -switch to rarest first picking. The first initial_picker_threshold pieces in
│ │ │ │ │ -any torrent are picked at random , the following pieces are picked in rarest
│ │ │ │ │ -first order.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_l_l_o_w_e_d___f_a_s_t___s_e_t___s_i_z_e_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ -the number of allowed pieces to send to peers that supports the fast extensions
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_u_g_g_e_s_t___m_o_d_e_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_n_o___p_i_e_c_e___s_u_g_g_e_s_t_i_o_n_s|
│ │ │ │ │ -suggest_mode controls whether or not libtorrent will send out suggest messages
│ │ │ │ │ -to create a bias of its peers to request certain pieces. The modes are:
│ │ │ │ │ -    * no_piece_suggestions which will not send out suggest messages.
│ │ │ │ │ -    * suggest_read_cache which will send out suggest messages for the most
│ │ │ │ │ -      recent pieces that are in the read cache.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ |
│ │ │ │ │ -|_m_a_x___q_u_e_u_e_d___d_i_s_k___b_y_t_e_s_|_i_n_t_ _|_1_0_2_4_ _*_ _1_0_2_4|
│ │ │ │ │ -max_queued_disk_bytes is the maximum number of bytes, to be written to disk,
│ │ │ │ │ -that can wait in the disk I/O thread queue. This queue is only for waiting for
│ │ │ │ │ -the disk I/O thread to receive the job and either write it to disk or insert it
│ │ │ │ │ -in the write cache. When this limit is reached, the peer connections will stop
│ │ │ │ │ -reading data from their sockets, until the disk thread catches up. Setting this
│ │ │ │ │ -too low will severely limit your download rate.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_h_a_n_d_s_h_a_k_e___t_i_m_e_o_u_t_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ -the number of seconds to wait for a handshake response from a peer. If no
│ │ │ │ │ -response is received within this time, the peer is disconnected.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ |
│ │ │ │ │ -|_s_e_n_d___b_u_f_f_e_r___l_o_w___w_a_t_e_r_m_a_r_k_ _ _ _|_i_n_t_ _|_1_0_ _*_ _1_0_2_4_ |
│ │ │ │ │ -|_s_e_n_d___b_u_f_f_e_r___w_a_t_e_r_m_a_r_k_ _ _ _ _ _ _ _|_i_n_t_ _|_5_0_0_ _*_ _1_0_2_4|
│ │ │ │ │ -|_s_e_n_d___b_u_f_f_e_r___w_a_t_e_r_m_a_r_k___f_a_c_t_o_r_|_i_n_t_ _|_5_0_ _ _ _ _ _ _ _ |
│ │ │ │ │ -send_buffer_low_watermark the minimum send buffer target size (send buffer
│ │ │ │ │ -includes bytes pending being read from disk). For good and snappy seeding
│ │ │ │ │ -performance, set this fairly high, to at least fit a few blocks. This is
│ │ │ │ │ -essentially the initial window size which will determine how fast we can ramp
│ │ │ │ │ -up the send rate
│ │ │ │ │ -if the send buffer has fewer bytes than send_buffer_watermark, we'll read
│ │ │ │ │ -another 16 kiB block onto it. If set too small, upload rate capacity will
│ │ │ │ │ -suffer. If set too high, memory will be wasted. The actual watermark may be
│ │ │ │ │ -lower than this in case the upload rate is low, this is the upper limit.
│ │ │ │ │ -the current upload rate to a peer is multiplied by this factor to get the send
│ │ │ │ │ -buffer watermark. The factor is specified as a percentage. i.e. 50 -> 0.5 This
│ │ │ │ │ -product is clamped to the send_buffer_watermark setting to not exceed the max.
│ │ │ │ │ -For high speed upload, this should be set to a greater value than 100. For high
│ │ │ │ │ -capacity connections, setting this higher can improve upload performance and
│ │ │ │ │ -disk throughput. Setting it too high may waste RAM and create a bias towards
│ │ │ │ │ -read jobs over write jobs.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m_ _ _ _ _ _|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_f_i_x_e_d___s_l_o_t_s___c_h_o_k_e_r|
│ │ │ │ │ -|_s_e_e_d___c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_r_o_u_n_d___r_o_b_i_n_ _ _ _ _ _ _ |
│ │ │ │ │ -choking_algorithm specifies which algorithm to use to determine how many peers
│ │ │ │ │ -to unchoke. The unchoking algorithm for downloading torrents is always "tit-
│ │ │ │ │ -for-tat", i.e. the peers we download the fastest from are unchoked.
│ │ │ │ │ -The options for choking algorithms are defined in the _c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m___t enum.
│ │ │ │ │ -seed_choking_algorithm controls the seeding unchoke behavior. i.e. How we
│ │ │ │ │ -select which peers to unchoke for seeding torrents. Since a seeding torrent
│ │ │ │ │ -isn't downloading anything, the tit-for-tat mechanism cannot be used. The
│ │ │ │ │ -available options are defined in the _s_e_e_d___c_h_o_k_i_n_g___a_l_g_o_r_i_t_h_m___t enum.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_i_s_k___i_o___w_r_i_t_e___m_o_d_e_|_i_n_t_ _|_D_I_S_K___W_R_I_T_E___M_O_D_E_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_i_s_k___i_o___r_e_a_d___m_o_d_e_ _|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_e_n_a_b_l_e___o_s___c_a_c_h_e|
│ │ │ │ │ -determines how files are opened when they're in read only mode versus read and
│ │ │ │ │ -write mode. The options are:
│ │ │ │ │ -  enable_os_cache
│ │ │ │ │ -      Files are opened normally, with the OS caching reads and writes.
│ │ │ │ │ -  disable_os_cache
│ │ │ │ │ -      This opens all files in no-cache mode. This corresponds to the OS not
│ │ │ │ │ -      letting blocks for the files linger in the cache. This makes sense in
│ │ │ │ │ -      order to avoid the bittorrent client to potentially evict all other
│ │ │ │ │ -      processes' cache by simply handling high throughput and large files. If
│ │ │ │ │ -      libtorrent's read cache is disabled, enabling this may reduce
│ │ │ │ │ -      performance.
│ │ │ │ │ -  write_through
│ │ │ │ │ -      flush pieces to disk as they complete validation.
│ │ │ │ │ -One reason to disable caching is that it may help the operating system from
│ │ │ │ │ -growing its file cache indefinitely.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_o_u_t_g_o_i_n_g___p_o_r_t_ _ _ _ _ _|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -|_n_u_m___o_u_t_g_o_i_n_g___p_o_r_t_s_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -this is the first port to use for binding outgoing connections to. This is
│ │ │ │ │ -useful for users that have routers that allow QoS settings based on local port.
│ │ │ │ │ -when binding outgoing connections to specific ports, num_outgoing_ports is the
│ │ │ │ │ -size of the range. It should be more than a few
│ │ │ │ │ -Warning
│ │ │ │ │ -setting outgoing ports will limit the ability to keep multiple connections to
│ │ │ │ │ -the same client, even for different torrents. It is not recommended to change
│ │ │ │ │ -this setting. Its main purpose is to use as an escape hatch for cheap routers
│ │ │ │ │ -with QoS capability but can only classify flows based on port numbers.
│ │ │ │ │ -It is a range instead of a single port because of the problems with failing to
│ │ │ │ │ -reconnect to peers if a previous socket to that peer and port is in TIME_WAIT
│ │ │ │ │ -state.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_e_e_r___d_s_c_p_|_i_n_t_ _|_0_x_0_4_ _ _ |
│ │ │ │ │ -peer_dscp determines the DSCP field in the IP header of every packet sent to
│ │ │ │ │ -peers (including web seeds). 0x0 means no marking, 0x04 represents Lower
│ │ │ │ │ -Effort. For more details see _R_F_C_ _8_6_2_2.
│ │ │ │ │ -peer_tos is the backwards compatible name for this setting.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_c_t_i_v_e___d_o_w_n_l_o_a_d_s_ _ _ _ _|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ -|_a_c_t_i_v_e___s_e_e_d_s_ _ _ _ _ _ _ _ _|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ -|_a_c_t_i_v_e___c_h_e_c_k_i_n_g_ _ _ _ _ _|_i_n_t_ _|_1_ _ _ _ _ _ |
│ │ │ │ │ -|_a_c_t_i_v_e___d_h_t___l_i_m_i_t_ _ _ _ _|_i_n_t_ _|_8_8_ _ _ _ _ |
│ │ │ │ │ -|_a_c_t_i_v_e___t_r_a_c_k_e_r___l_i_m_i_t_|_i_n_t_ _|_1_6_0_0_ _ _ |
│ │ │ │ │ -|_a_c_t_i_v_e___l_s_d___l_i_m_i_t_ _ _ _ _|_i_n_t_ _|_6_0_ _ _ _ _ |
│ │ │ │ │ -|_a_c_t_i_v_e___l_i_m_i_t_ _ _ _ _ _ _ _ _|_i_n_t_ _|_5_0_0_ _ _ _ |
│ │ │ │ │ -for auto managed torrents, these are the limits they are subject to. If there
│ │ │ │ │ -are too many torrents some of the auto managed ones will be paused until some
│ │ │ │ │ -slots free up. active_downloads and active_seeds controls how many active
│ │ │ │ │ -seeding and downloading torrents the queuing mechanism allows. The target
│ │ │ │ │ -number of active torrents is min(active_downloads + active_seeds,
│ │ │ │ │ -active_limit). active_downloads and active_seeds are upper limits on the number
│ │ │ │ │ -of downloading torrents and seeding torrents respectively. Setting the value to
│ │ │ │ │ --1 means unlimited.
│ │ │ │ │ -For example if there are 10 seeding torrents and 10 downloading torrents, and
│ │ │ │ │ -active_downloads is 4 and active_seeds is 4, there will be 4 seeds active and 4
│ │ │ │ │ -downloading torrents. If the settings are active_downloads = 2 and active_seeds
│ │ │ │ │ -= 4, then there will be 2 downloading torrents and 4 seeding torrents active.
│ │ │ │ │ -Torrents that are not auto managed are not counted against these limits.
│ │ │ │ │ -active_checking is the limit of number of simultaneous checking torrents.
│ │ │ │ │ -active_limit is a hard limit on the number of active (auto managed) torrents.
│ │ │ │ │ -This limit also applies to slow torrents.
│ │ │ │ │ -active_dht_limit is the max number of torrents to announce to the DHT.
│ │ │ │ │ -active_tracker_limit is the max number of torrents to announce to their
│ │ │ │ │ -trackers.
│ │ │ │ │ -active_lsd_limit is the max number of torrents to announce to the local network
│ │ │ │ │ -over the local service discovery protocol.
│ │ │ │ │ -You can have more torrents aaccttiivvee, even though they are not announced to the
│ │ │ │ │ -DHT, lsd or their tracker. If some peer knows about you for any reason and
│ │ │ │ │ -tries to connect, it will still be accepted, unless the torrent is paused,
│ │ │ │ │ -which means it won't accept any connections.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_u_t_o___m_a_n_a_g_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ -auto_manage_interval is the number of seconds between the torrent queue is
│ │ │ │ │ -updated, and rotated.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ |
│ │ │ │ │ -|_s_e_e_d___t_i_m_e___l_i_m_i_t_|_i_n_t_ _|_2_4_ _*_ _6_0_ _*_ _6_0|
│ │ │ │ │ -this is the limit on the time a torrent has been an active seed (specified in
│ │ │ │ │ -seconds) before it is considered having met the seed limit criteria. See
│ │ │ │ │ -_q_u_e_u_i_n_g.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_u_t_o___s_c_r_a_p_e___i_n_t_e_r_v_a_l_ _ _ _ _|_i_n_t_ _|_1_8_0_0_ _ _ |
│ │ │ │ │ -|_a_u_t_o___s_c_r_a_p_e___m_i_n___i_n_t_e_r_v_a_l_|_i_n_t_ _|_3_0_0_ _ _ _ |
│ │ │ │ │ -auto_scrape_interval is the number of seconds between scrapes of queued
│ │ │ │ │ -torrents (auto managed and paused torrents). Auto managed torrents that are
│ │ │ │ │ -paused, are scraped regularly in order to keep track of their downloader/seed
│ │ │ │ │ -ratio. This ratio is used to determine which torrents to seed and which to
│ │ │ │ │ -pause.
│ │ │ │ │ -auto_scrape_min_interval is the minimum number of seconds between any automatic
│ │ │ │ │ -scrape (regardless of torrent). In case there are a large number of paused auto
│ │ │ │ │ -managed torrents, this puts a limit on how often a scrape request is sent.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_a_x___p_e_e_r_l_i_s_t___s_i_z_e_ _ _ _ _ _ _ _|_i_n_t_ _|_3_0_0_0_ _ _ |
│ │ │ │ │ -|_m_a_x___p_a_u_s_e_d___p_e_e_r_l_i_s_t___s_i_z_e_|_i_n_t_ _|_1_0_0_0_ _ _ |
│ │ │ │ │ -max_peerlist_size is the maximum number of peers in the list of known peers.
│ │ │ │ │ -These peers are not necessarily connected, so this number should be much
│ │ │ │ │ -greater than the maximum number of connected peers. Peers are evicted from the
│ │ │ │ │ -cache when the list grows passed 90% of this limit, and once the size hits the
│ │ │ │ │ -limit, peers are no longer added to the list. If this limit is set to 0, there
│ │ │ │ │ -is no limit on how many peers we'll keep in the peer list.
│ │ │ │ │ -max_paused_peerlist_size is the max peer list size used for torrents that are
│ │ │ │ │ -paused. This can be used to save memory for paused torrents, since it's not as
│ │ │ │ │ -important for them to keep a large peer list.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_i_n___a_n_n_o_u_n_c_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_5_ _*_ _6_0_ |
│ │ │ │ │ -this is the minimum allowed announce interval for a tracker. This is specified
│ │ │ │ │ -in seconds and is used as a sanity check on what is returned from a tracker. It
│ │ │ │ │ -mitigates hammering mis-configured trackers.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_u_t_o___m_a_n_a_g_e___s_t_a_r_t_u_p_|_i_n_t_ _|_6_0_ _ _ _ _ |
│ │ │ │ │ -this is the number of seconds a torrent is considered active after it was
│ │ │ │ │ -started, regardless of upload and download speed. This is so that newly started
│ │ │ │ │ -torrents are not considered inactive until they have a fair chance to start
│ │ │ │ │ -downloading.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_e_e_d_i_n_g___p_i_e_c_e___q_u_o_t_a_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ -seeding_piece_quota is the number of pieces to send to a peer, when seeding,
│ │ │ │ │ -before rotating in another peer to the unchoke set.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_a_x___r_e_j_e_c_t_s_|_i_n_t_ _|_5_0_ _ _ _ _ |
│ │ │ │ │ -max_rejects is the number of piece requests we will reject in a row while a
│ │ │ │ │ -peer is choked before the peer is considered abusive and is disconnected.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_r_e_c_v___s_o_c_k_e_t___b_u_f_f_e_r___s_i_z_e_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -|_s_e_n_d___s_o_c_k_e_t___b_u_f_f_e_r___s_i_z_e_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -specifies the buffer sizes set on peer sockets. 0 means the OS default (i.e.
│ │ │ │ │ -don't change the buffer sizes). The socket buffer sizes are changed using
│ │ │ │ │ -setsockopt() with SOL_SOCKET/SO_RCVBUF and SO_SNDBUFFER.
│ │ │ │ │ -Note that uTP peers share a single UDP socket buffer for each of the
│ │ │ │ │ -listen_interfaces, along with DHT and UDP tracker traffic. If the buffer size
│ │ │ │ │ -is too small for the combined traffic through the socket, packets may be
│ │ │ │ │ -dropped.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_m_a_x___p_e_e_r___r_e_c_v___b_u_f_f_e_r___s_i_z_e_|_i_n_t_ _|_2_ _*_ _1_0_2_4_ _*_ _1_0_2_4|
│ │ │ │ │ -the max number of bytes a single peer connection's receive buffer is allowed to
│ │ │ │ │ -grow to.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_o_p_t_i_m_i_s_t_i_c___d_i_s_k___r_e_t_r_y_|_i_n_t_ _|_1_0_ _*_ _6_0|
│ │ │ │ │ -optimistic_disk_retry is the number of seconds from a disk write errors occur
│ │ │ │ │ -on a torrent until libtorrent will take it out of the upload mode, to test if
│ │ │ │ │ -the error condition has been fixed.
│ │ │ │ │ -libtorrent will only do this automatically for auto managed torrents.
│ │ │ │ │ -You can explicitly take a torrent out of upload only mode using set_upload_mode
│ │ │ │ │ -().
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_a_x___s_u_g_g_e_s_t___p_i_e_c_e_s_|_i_n_t_ _|_1_6_ _ _ _ _ |
│ │ │ │ │ -max_suggest_pieces is the max number of suggested piece indices received from a
│ │ │ │ │ -peer that's remembered. If a peer floods suggest messages, this limit prevents
│ │ │ │ │ -libtorrent from using too much RAM.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_l_o_c_a_l___s_e_r_v_i_c_e___a_n_n_o_u_n_c_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_5_ _*_ _6_0_ |
│ │ │ │ │ -local_service_announce_interval is the time between local network announces for
│ │ │ │ │ -a torrent. This interval is specified in seconds.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___a_n_n_o_u_n_c_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_1_5_ _*_ _6_0|
│ │ │ │ │ -dht_announce_interval is the number of seconds between announcing torrents to
│ │ │ │ │ -the distributed hash table (DHT).
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_d_p___t_r_a_c_k_e_r___t_o_k_e_n___e_x_p_i_r_y_|_i_n_t_ _|_6_0_ _ _ _ _ |
│ │ │ │ │ -udp_tracker_token_expiry is the number of seconds libtorrent will keep UDP
│ │ │ │ │ -tracker connection tokens around for. This is specified to be 60 seconds. The
│ │ │ │ │ -higher this value is, the fewer packets have to be sent to the UDP tracker. In
│ │ │ │ │ -order for higher values to work, the tracker needs to be configured to match
│ │ │ │ │ -the expiration time for tokens.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_n_u_m___o_p_t_i_m_i_s_t_i_c___u_n_c_h_o_k_e___s_l_o_t_s_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -num_optimistic_unchoke_slots is the number of optimistic unchoke slots to use.
│ │ │ │ │ -Having a higher number of optimistic unchoke slots mean you will find the good
│ │ │ │ │ -peers faster but with the trade-off to use up more bandwidth. 0 means
│ │ │ │ │ -automatic, where libtorrent opens up 20% of your allowed upload slots as
│ │ │ │ │ -optimistic unchoke slots.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_a_x___p_e_x___p_e_e_r_s_|_i_n_t_ _|_5_0_ _ _ _ _ |
│ │ │ │ │ -the max number of peers we accept from pex messages from a single peer. this
│ │ │ │ │ -limits the number of concurrent peers any of our peers claims to be connected
│ │ │ │ │ -to. If they claim to be connected to more than this, we'll ignore any peer that
│ │ │ │ │ -exceeds this limit
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_t_i_c_k___i_n_t_e_r_v_a_l_|_i_n_t_ _|_5_0_0_ _ _ _ |
│ │ │ │ │ -tick_interval specifies the number of milliseconds between internal ticks. This
│ │ │ │ │ -is the frequency with which bandwidth quota is distributed to peers. It should
│ │ │ │ │ -not be more than one second (i.e. 1000 ms). Setting this to a low value (around
│ │ │ │ │ -100) means higher resolution bandwidth quota distribution, setting it to a
│ │ │ │ │ -higher value saves CPU cycles.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_h_a_r_e___m_o_d_e___t_a_r_g_e_t_|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ -share_mode_target specifies the target share ratio for share mode torrents. If
│ │ │ │ │ -set to 3, we'll try to upload 3 times as much as we download. Setting this very
│ │ │ │ │ -high, will make it very conservative and you might end up not downloading
│ │ │ │ │ -anything ever (and not affecting your share ratio). It does not make any sense
│ │ │ │ │ -to set this any lower than 2. For instance, if only 3 peers need to download
│ │ │ │ │ -the rarest piece, it's impossible to download a single piece and upload it more
│ │ │ │ │ -than 3 times. If the share_mode_target is set to more than 3, nothing is
│ │ │ │ │ -downloaded.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_p_l_o_a_d___r_a_t_e___l_i_m_i_t_ _ _|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -|_d_o_w_n_l_o_a_d___r_a_t_e___l_i_m_i_t_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -upload_rate_limit and download_rate_limit sets the session-global limits of
│ │ │ │ │ -upload and download rate limits, in bytes per second. By default peers on the
│ │ │ │ │ -local network are not rate limited.
│ │ │ │ │ -A value of 0 means unlimited.
│ │ │ │ │ -For fine grained control over rate limits, including making them apply to local
│ │ │ │ │ -peers, see _p_e_e_r_ _c_l_a_s_s_e_s.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___u_p_l_o_a_d___r_a_t_e___l_i_m_i_t_|_i_n_t_ _|_8_0_0_0_ _ _ |
│ │ │ │ │ -the number of bytes per second (on average) the DHT is allowed to send. If the
│ │ │ │ │ -incoming requests causes to many bytes to be sent in responses, incoming
│ │ │ │ │ -requests will be dropped until the quota has been replenished.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_n_c_h_o_k_e___s_l_o_t_s___l_i_m_i_t_|_i_n_t_ _|_8_ _ _ _ _ _ |
│ │ │ │ │ -unchoke_slots_limit is the max number of unchoked peers in the _s_e_s_s_i_o_n. The
│ │ │ │ │ -number of unchoke slots may be ignored depending on what choking_algorithm is
│ │ │ │ │ -set to. Setting this limit to -1 means unlimited, i.e. all peers will always be
│ │ │ │ │ -unchoked.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_c_o_n_n_e_c_t_i_o_n_s___l_i_m_i_t_|_i_n_t_ _|_2_0_0_ _ _ _ |
│ │ │ │ │ -connections_limit sets a global limit on the number of connections opened. The
│ │ │ │ │ -number of connections is set to a hard minimum of at least two per torrent, so
│ │ │ │ │ -if you set a too low connections limit, and open too many torrents, the limit
│ │ │ │ │ -will not be met.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_c_o_n_n_e_c_t_i_o_n_s___s_l_a_c_k_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ -connections_slack is the number of incoming connections exceeding the
│ │ │ │ │ -connection limit to accept in order to potentially replace existing ones.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_t_p___t_a_r_g_e_t___d_e_l_a_y_ _ _ _|_i_n_t_ _|_1_0_0_ _ _ _ |
│ │ │ │ │ -|_u_t_p___g_a_i_n___f_a_c_t_o_r_ _ _ _ _|_i_n_t_ _|_3_0_0_0_ _ _ |
│ │ │ │ │ -|_u_t_p___m_i_n___t_i_m_e_o_u_t_ _ _ _ _|_i_n_t_ _|_5_0_0_ _ _ _ |
│ │ │ │ │ -|_u_t_p___s_y_n___r_e_s_e_n_d_s_ _ _ _ _|_i_n_t_ _|_2_ _ _ _ _ _ |
│ │ │ │ │ -|_u_t_p___f_i_n___r_e_s_e_n_d_s_ _ _ _ _|_i_n_t_ _|_2_ _ _ _ _ _ |
│ │ │ │ │ -|_u_t_p___n_u_m___r_e_s_e_n_d_s_ _ _ _ _|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ -|_u_t_p___c_o_n_n_e_c_t___t_i_m_e_o_u_t_|_i_n_t_ _|_3_0_0_0_ _ _ |
│ │ │ │ │ -|_u_t_p___l_o_s_s___m_u_l_t_i_p_l_i_e_r_|_i_n_t_ _|_5_0_ _ _ _ _ |
│ │ │ │ │ -utp_target_delay is the target delay for uTP sockets in milliseconds. A high
│ │ │ │ │ -value will make uTP connections more aggressive and cause longer queues in the
│ │ │ │ │ -upload bottleneck. It cannot be too low, since the noise in the measurements
│ │ │ │ │ -would cause it to send too slow. utp_gain_factor is the number of bytes the uTP
│ │ │ │ │ -congestion window can increase at the most in one RTT. If this is set too high,
│ │ │ │ │ -the congestion controller reacts too hard to noise and will not be stable, if
│ │ │ │ │ -it's set too low, it will react slow to congestion and not back off as fast.
│ │ │ │ │ -utp_min_timeout is the shortest allowed uTP socket timeout, specified in
│ │ │ │ │ -milliseconds. The timeout depends on the RTT of the connection, but is never
│ │ │ │ │ -smaller than this value. A connection times out when every packet in a window
│ │ │ │ │ -is lost, or when a packet is lost twice in a row (i.e. the resent packet is
│ │ │ │ │ -lost as well).
│ │ │ │ │ -The shorter the timeout is, the faster the connection will recover from this
│ │ │ │ │ -situation, assuming the RTT is low enough. utp_syn_resends is the number of SYN
│ │ │ │ │ -packets that are sent (and timed out) before giving up and closing the socket.
│ │ │ │ │ -utp_num_resends is the number of times a packet is sent (and lost or timed out)
│ │ │ │ │ -before giving up and closing the connection. utp_connect_timeout is the number
│ │ │ │ │ -of milliseconds of timeout for the initial SYN packet for uTP connections. For
│ │ │ │ │ -each timed out packet (in a row), the timeout is doubled. utp_loss_multiplier
│ │ │ │ │ -controls how the congestion window is changed when a packet loss is
│ │ │ │ │ -experienced. It's specified as a percentage multiplier for cwnd. Do not change
│ │ │ │ │ -this value unless you know what you're doing. Never set it higher than 100.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_m_i_x_e_d___m_o_d_e___a_l_g_o_r_i_t_h_m_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_p_e_e_r___p_r_o_p_o_r_t_i_o_n_a_l|
│ │ │ │ │ -The mixed_mode_algorithm determines how to treat TCP connections when there are
│ │ │ │ │ -uTP connections. Since uTP is designed to yield to TCP, there's an inherent
│ │ │ │ │ -problem when using swarms that have both TCP and uTP connections. If nothing is
│ │ │ │ │ -done, uTP connections would often be starved out for bandwidth by the TCP
│ │ │ │ │ -connections. This mode is prefer_tcp. The peer_proportional mode simply looks
│ │ │ │ │ -at the current throughput and rate limits all TCP connections to their
│ │ │ │ │ -proportional share based on how many of the connections are TCP. This works
│ │ │ │ │ -best if uTP connections are not rate limited by the global rate limiter (which
│ │ │ │ │ -they aren't by default).
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_l_i_s_t_e_n___q_u_e_u_e___s_i_z_e_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ -listen_queue_size is the value passed in to listen() for the listen socket. It
│ │ │ │ │ -is the number of outstanding incoming connections to queue up while we're not
│ │ │ │ │ -actively waiting for a connection to be accepted. 5 should be sufficient for
│ │ │ │ │ -any normal client. If this is a high performance server which expects to
│ │ │ │ │ -receive a lot of connections, or used in a simulator or test, it might make
│ │ │ │ │ -sense to raise this number. It will not take affect until the listen_interfaces
│ │ │ │ │ -settings is updated.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_t_o_r_r_e_n_t___c_o_n_n_e_c_t___b_o_o_s_t_|_i_n_t_ _|_3_0_ _ _ _ _ |
│ │ │ │ │ -torrent_connect_boost is the number of peers to try to connect to immediately
│ │ │ │ │ -when the first tracker response is received for a torrent. This is a boost to
│ │ │ │ │ -given to new torrents to accelerate them starting up. The normal connect
│ │ │ │ │ -scheduler is run once every second, this allows peers to be connected
│ │ │ │ │ -immediately instead of waiting for the _s_e_s_s_i_o_n tick to trigger connections.
│ │ │ │ │ -This may not be set higher than 255.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_l_e_r_t___q_u_e_u_e___s_i_z_e_|_i_n_t_ _|_2_0_0_0_ _ _ |
│ │ │ │ │ -alert_queue_size is the maximum number of alerts queued up internally. If
│ │ │ │ │ -alerts are not popped, the queue will eventually fill up to this level. Once
│ │ │ │ │ -the _a_l_e_r_t queue is full, additional alerts will be dropped, and not delivered
│ │ │ │ │ -to the client. Once the client drains the queue, new alerts may be delivered
│ │ │ │ │ -again. In order to know that alerts have been dropped, see session_handle::
│ │ │ │ │ -dropped_alerts().
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_m_a_x___m_e_t_a_d_a_t_a___s_i_z_e_|_i_n_t_ _|_3_ _*_ _1_0_2_4_ _*_ _1_0_2_4_0|
│ │ │ │ │ -max_metadata_size is the maximum allowed size (in bytes) to be received by the
│ │ │ │ │ -metadata extension, i.e. magnet links.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_h_a_s_h_i_n_g___t_h_r_e_a_d_s_|_i_n_t_ _|_1_ _ _ _ _ _ |
│ │ │ │ │ -hashing_threads is the number of disk I/O threads to use for piece hash
│ │ │ │ │ -verification. These threads are iinn aaddddiittiioonn to the regular disk I/O threads
│ │ │ │ │ -specified by _s_e_t_t_i_n_g_s___p_a_c_k_:_:_a_i_o___t_h_r_e_a_d_s. These threads are only used for full
│ │ │ │ │ -checking of torrents. The hash checking done while downloading are done by the
│ │ │ │ │ -regular disk I/O threads. The _h_a_s_h_e_r threads do not only compute hashes, but
│ │ │ │ │ -also perform the read from disk. On storage optimal for sequential access, such
│ │ │ │ │ -as hard drives, this setting should be set to 1, which is also the default.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_c_h_e_c_k_i_n_g___m_e_m___u_s_a_g_e_|_i_n_t_ _|_2_5_6_ _ _ _ |
│ │ │ │ │ -the number of blocks to keep outstanding at any given time when checking
│ │ │ │ │ -torrents. Higher numbers give faster re-checks but uses more memory. Specified
│ │ │ │ │ -in number of 16 kiB blocks
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_r_e_d_i_c_t_i_v_e___p_i_e_c_e___a_n_n_o_u_n_c_e_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -if set to > 0, pieces will be announced to other peers before they are fully
│ │ │ │ │ -downloaded (and before they are hash checked). The intention is to gain 1.5
│ │ │ │ │ -potential round trip times per downloaded piece. When non-zero, this indicates
│ │ │ │ │ -how many milliseconds in advance pieces should be announced, before they are
│ │ │ │ │ -expected to be completed.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_i_o___t_h_r_e_a_d_s_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ -for some aio back-ends, aio_threads specifies the number of io-threads to use.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_t_r_a_c_k_e_r___b_a_c_k_o_f_f_|_i_n_t_ _|_2_5_0_ _ _ _ |
│ │ │ │ │ -tracker_backoff determines how aggressively to back off from retrying failing
│ │ │ │ │ -trackers. This value determines xx in the following formula, determining the
│ │ │ │ │ -number of seconds to wait until the next retry:
│ │ │ │ │ -     delay = 5 + 5 * x / 100 * fails^2
│ │ │ │ │ -This setting may be useful to make libtorrent more or less aggressive in
│ │ │ │ │ -hitting trackers.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_h_a_r_e___r_a_t_i_o___l_i_m_i_t_ _ _ _ _|_i_n_t_ _|_2_0_0_ _ _ _ |
│ │ │ │ │ -|_s_e_e_d___t_i_m_e___r_a_t_i_o___l_i_m_i_t_|_i_n_t_ _|_7_0_0_ _ _ _ |
│ │ │ │ │ -when a seeding torrent reaches either the share ratio (bytes up / bytes down)
│ │ │ │ │ -or the seed time ratio (seconds as seed / seconds as downloader) or the seed
│ │ │ │ │ -time limit (seconds as seed) it is considered done, and it will leave room for
│ │ │ │ │ -other torrents. These are specified as percentages. Torrents that are
│ │ │ │ │ -considered done will still be allowed to be seeded, they just won't have
│ │ │ │ │ -priority anymore. For more, see _q_u_e_u_i_n_g.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_e_e_r___t_u_r_n_o_v_e_r_ _ _ _ _ _ _ _ _ _|_i_n_t_ _|_4_ _ _ _ _ _ |
│ │ │ │ │ -|_p_e_e_r___t_u_r_n_o_v_e_r___c_u_t_o_f_f_ _ _|_i_n_t_ _|_9_0_ _ _ _ _ |
│ │ │ │ │ -|_p_e_e_r___t_u_r_n_o_v_e_r___i_n_t_e_r_v_a_l_|_i_n_t_ _|_3_0_0_ _ _ _ |
│ │ │ │ │ -peer_turnover is the percentage of peers to disconnect every turnover
│ │ │ │ │ -peer_turnover_interval (if we're at the peer limit), this is specified in
│ │ │ │ │ -percent when we are connected to more than limit * peer_turnover_cutoff peers
│ │ │ │ │ -disconnect peer_turnover fraction of the peers. It is specified in percent
│ │ │ │ │ -peer_turnover_interval is the interval (in seconds) between optimistic
│ │ │ │ │ -disconnects if the disconnects happen and how many peers are disconnected is
│ │ │ │ │ -controlled by peer_turnover and peer_turnover_cutoff
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_c_o_n_n_e_c_t___s_e_e_d___e_v_e_r_y___n___d_o_w_n_l_o_a_d_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ -this setting controls the priority of downloading torrents over seeding or
│ │ │ │ │ -finished torrents when it comes to making peer connections. Peer connections
│ │ │ │ │ -are throttled by the connection_speed and the half-open connection limit. This
│ │ │ │ │ -makes peer connections a limited resource. Torrents that still have pieces to
│ │ │ │ │ -download are prioritized by default, to avoid having many seeding torrents use
│ │ │ │ │ -most of the connection attempts and only give one peer every now and then to
│ │ │ │ │ -the downloading torrent. libtorrent will loop over the downloading torrents to
│ │ │ │ │ -connect a peer each, and every n:th connection attempt, a finished torrent is
│ │ │ │ │ -picked to be allowed to connect to a peer. This setting controls n.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ |
│ │ │ │ │ -|_m_a_x___h_t_t_p___r_e_c_v___b_u_f_f_e_r___s_i_z_e_|_i_n_t_ _|_4_*_1_0_2_4_*_2_0_4|
│ │ │ │ │ -the max number of bytes to allow an HTTP response to be when announcing to
│ │ │ │ │ -trackers or downloading .torrent files via the url provided in
│ │ │ │ │ -add_torrent_params.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_a_x___r_e_t_r_y___p_o_r_t___b_i_n_d_|_i_n_t_ _|_1_0_ _ _ _ _ |
│ │ │ │ │ -if binding to a specific port fails, should the port be incremented by one and
│ │ │ │ │ -tried again? This setting specifies how many times to retry a failed port bind
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_l_e_r_t___m_a_s_k_|_i_n_t_ _|_i_n_t_ _ _ _ |
│ │ │ │ │ -a bitmask combining flags from _a_l_e_r_t___c_a_t_e_g_o_r_y___t defining which kinds of alerts
│ │ │ │ │ -to receive
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_o_u_t___e_n_c___p_o_l_i_c_y_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_p_e___e_n_a_b_l_e_d|
│ │ │ │ │ -|_i_n___e_n_c___p_o_l_i_c_y_ _|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_p_e___e_n_a_b_l_e_d|
│ │ │ │ │ -control the settings for incoming and outgoing connections respectively. see
│ │ │ │ │ -_e_n_c___p_o_l_i_c_y enum for the available options. Keep in mind that protocol
│ │ │ │ │ -encryption degrades performance in several respects:
│ │ │ │ │ -   1. It prevents "zero copy" disk buffers being sent to peers, since each peer
│ │ │ │ │ -      needs to mutate the data (i.e. encrypt it) the data must be copied per
│ │ │ │ │ -      peer connection rather than sending the same buffer to multiple peers.
│ │ │ │ │ -   2. The encryption itself requires more CPU than plain bittorrent protocol.
│ │ │ │ │ -      The highest cost is the Diffie Hellman exchange on connection setup.
│ │ │ │ │ -   3. The encryption handshake adds several round-trips to the connection
│ │ │ │ │ -      setup, and delays transferring data.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_a_l_l_o_w_e_d___e_n_c___l_e_v_e_l_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_p_e___b_o_t_h|
│ │ │ │ │ -determines the encryption level of the connections. This setting will adjust
│ │ │ │ │ -which encryption scheme is offered to the other peer, as well as which
│ │ │ │ │ -encryption scheme is selected by the client. See _e_n_c___l_e_v_e_l enum for options.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_i_n_a_c_t_i_v_e___d_o_w_n___r_a_t_e_|_i_n_t_ _|_2_0_4_8_ _ _ |
│ │ │ │ │ -|_i_n_a_c_t_i_v_e___u_p___r_a_t_e_ _ _|_i_n_t_ _|_2_0_4_8_ _ _ |
│ │ │ │ │ -the download and upload rate limits for a torrent to be considered active by
│ │ │ │ │ -the queuing mechanism. A torrent whose download rate is less than
│ │ │ │ │ -inactive_down_rate and whose upload rate is less than inactive_up_rate for
│ │ │ │ │ -auto_manage_startup seconds, is considered inactive, and another queued torrent
│ │ │ │ │ -may be started. This logic is disabled if dont_count_slow_torrents is false.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_r_o_x_y___t_y_p_e_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_n_o_n_e|
│ │ │ │ │ -proxy to use. see _p_r_o_x_y___t_y_p_e___t.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_p_r_o_x_y___p_o_r_t_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -the port of the proxy server
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_i_2_p___p_o_r_t_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -sets the _i_2_p SAM bridge port to connect to. set the hostname with the
│ │ │ │ │ -i2p_hostname setting.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_u_r_l_s_e_e_d___m_a_x___r_e_q_u_e_s_t___b_y_t_e_s_|_i_n_t_ _|_1_6_ _*_ _1_0_2_4_ _*_ _1_0_2_4|
│ │ │ │ │ -The maximum request range of an url seed in bytes. This value defines the
│ │ │ │ │ -largest possible sequential web seed request. Lower values are possible but
│ │ │ │ │ -will be ignored if they are lower then piece size. This value should be related
│ │ │ │ │ -to your download speed to prevent libtorrent from creating too many expensive
│ │ │ │ │ -http requests per second. You can select a value as high as you want but keep
│ │ │ │ │ -in mind that libtorrent can't create parallel requests if the first request did
│ │ │ │ │ -already select the whole file. If you combine bittorrent seeds with web seeds
│ │ │ │ │ -and pick strategies like rarest first you may find your web seed requests split
│ │ │ │ │ -into smaller parts because we don't download already picked pieces twice.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_w_e_b___s_e_e_d___n_a_m_e___l_o_o_k_u_p___r_e_t_r_y_|_i_n_t_ _|_1_8_0_0_ _ _ |
│ │ │ │ │ -time to wait until a new retry of a web seed name lookup
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_c_l_o_s_e___f_i_l_e___i_n_t_e_r_v_a_l_|_i_n_t_ _|_C_L_O_S_E___F_I_L_E___I_N_T_E_R_V_A_L|
│ │ │ │ │ -the number of seconds between closing the file opened the longest ago. 0 means
│ │ │ │ │ -to disable the feature. The purpose of this is to periodically close files to
│ │ │ │ │ -trigger the operating system flushing disk cache. Specifically it has been
│ │ │ │ │ -observed to be required on windows to not have the disk cache grow
│ │ │ │ │ -indefinitely. This defaults to 240 seconds on windows, and disabled on other
│ │ │ │ │ -systems.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_t_p___c_w_n_d___r_e_d_u_c_e___t_i_m_e_r_|_i_n_t_ _|_1_0_0_ _ _ _ |
│ │ │ │ │ -When uTP experiences packet loss, it will reduce the congestion window, and not
│ │ │ │ │ -reduce it again for this many milliseconds, even if experiencing another lost
│ │ │ │ │ -packet.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_a_x___w_e_b___s_e_e_d___c_o_n_n_e_c_t_i_o_n_s_|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ -the max number of web seeds to have connected per torrent at any given time.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_r_e_s_o_l_v_e_r___c_a_c_h_e___t_i_m_e_o_u_t_|_i_n_t_ _|_1_2_0_0_ _ _ |
│ │ │ │ │ -the number of seconds before the internal host name resolver considers a cache
│ │ │ │ │ -value timed out, negative values are interpreted as zero.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_s_e_n_d___n_o_t___s_e_n_t___l_o_w___w_a_t_e_r_m_a_r_k_|_i_n_t_ _|_1_6_3_8_4_ _ |
│ │ │ │ │ -specify the not-sent low watermark for socket send buffers. This corresponds to
│ │ │ │ │ -the, Linux-specific, TCP_NOTSENT_LOWAT TCP socket option.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_r_a_t_e___c_h_o_k_e_r___i_n_i_t_i_a_l___t_h_r_e_s_h_o_l_d_|_i_n_t_ _|_1_0_2_4_ _ _ |
│ │ │ │ │ -the rate based choker compares the upload rate to peers against a threshold
│ │ │ │ │ -that increases proportionally by its size for every peer it visits, visiting
│ │ │ │ │ -peers in decreasing upload rate. The number of upload slots is determined by
│ │ │ │ │ -the number of peers whose upload rate exceeds the threshold. This option sets
│ │ │ │ │ -the start value for this threshold. A higher value leads to fewer unchoke
│ │ │ │ │ -slots, a lower value leads to more.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_u_p_n_p___l_e_a_s_e___d_u_r_a_t_i_o_n_|_i_n_t_ _|_3_6_0_0_ _ _ |
│ │ │ │ │ -The expiration time of UPnP port-mappings, specified in seconds. 0 means
│ │ │ │ │ -permanent lease. Some routers do not support expiration times on port-maps (nor
│ │ │ │ │ -correctly returning an error indicating lack of support). In those cases, set
│ │ │ │ │ -this to 0. Otherwise, don't set it any lower than 5 minutes.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_a_x___c_o_n_c_u_r_r_e_n_t___h_t_t_p___a_n_n_o_u_n_c_e_s_|_i_n_t_ _|_5_0_ _ _ _ _ |
│ │ │ │ │ -limits the number of concurrent HTTP tracker announces. Once the limit is hit,
│ │ │ │ │ -tracker requests are queued and issued when an outstanding announce completes.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___m_a_x___p_e_e_r_s___r_e_p_l_y_|_i_n_t_ _|_1_0_0_ _ _ _ |
│ │ │ │ │ -the maximum number of peers to send in a reply to get_peers
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___s_e_a_r_c_h___b_r_a_n_c_h_i_n_g_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ -the number of concurrent search request the node will send when announcing and
│ │ │ │ │ -refreshing the routing table. This parameter is called alpha in the kademlia
│ │ │ │ │ -paper
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___m_a_x___f_a_i_l___c_o_u_n_t_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ -the maximum number of failed tries to contact a node before it is removed from
│ │ │ │ │ -the routing table. If there are known working nodes that are ready to replace a
│ │ │ │ │ -failing node, it will be replaced immediately, this limit is only used to clear
│ │ │ │ │ -out nodes that don't have any node that can replace them.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___m_a_x___t_o_r_r_e_n_t_s_|_i_n_t_ _|_2_0_0_0_ _ _ |
│ │ │ │ │ -the total number of torrents to track from the DHT. This is simply an upper
│ │ │ │ │ -limit to make sure malicious DHT nodes cannot make us allocate an unbounded
│ │ │ │ │ -amount of memory.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___m_a_x___d_h_t___i_t_e_m_s_|_i_n_t_ _|_7_0_0_ _ _ _ |
│ │ │ │ │ -max number of items the DHT will store
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___m_a_x___p_e_e_r_s_|_i_n_t_ _|_5_0_0_ _ _ _ |
│ │ │ │ │ -the max number of peers to store per torrent (for the DHT)
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___m_a_x___t_o_r_r_e_n_t___s_e_a_r_c_h___r_e_p_l_y_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ -the max number of torrents to return in a torrent search query to the DHT
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___b_l_o_c_k___t_i_m_e_o_u_t_|_i_n_t_ _|_5_ _*_ _6_0_ |
│ │ │ │ │ -the number of seconds a DHT node is banned if it exceeds the rate limit. The
│ │ │ │ │ -rate limit is averaged over 10 seconds to allow for bursts above the limit.
│ │ │ │ │ +********** eennuumm ddaattaa__ttyyppee **********
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_n_t_r_y_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___b_l_o_c_k___r_a_t_e_l_i_m_i_t_|_i_n_t_ _|_5_ _ _ _ _ _ |
│ │ │ │ │ -the max number of packets per second a DHT node is allowed to send without
│ │ │ │ │ -getting banned.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___i_t_e_m___l_i_f_e_t_i_m_e_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -the number of seconds a immutable/mutable item will be expired. default is 0,
│ │ │ │ │ -means never expires.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___s_a_m_p_l_e___i_n_f_o_h_a_s_h_e_s___i_n_t_e_r_v_a_l_|_i_n_t_ _|_2_1_6_0_0_ _ |
│ │ │ │ │ -the info-hashes sample recomputation interval (in seconds). The node will
│ │ │ │ │ -precompute a subset of the tracked info-hashes and return that instead of
│ │ │ │ │ -calculating it upon each request. The permissible range is between 0 and 21600
│ │ │ │ │ -seconds (inclusive).
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_d_h_t___m_a_x___i_n_f_o_h_a_s_h_e_s___s_a_m_p_l_e___c_o_u_n_t_|_i_n_t_ _|_2_0_ _ _ _ _ |
│ │ │ │ │ -the maximum number of elements in the sampled subset of info-hashes. If this
│ │ │ │ │ -number is too big, expect the DHT storage implementations to clamp it in order
│ │ │ │ │ -to allow UDP packets go through
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ |
│ │ │ │ │ -|_m_a_x___p_i_e_c_e___c_o_u_n_t_|_i_n_t_ _|_0_x_2_0_0_0_0_0|
│ │ │ │ │ -max_piece_count is the maximum allowed number of pieces in metadata received
│ │ │ │ │ -via magnet links. Loading large torrents (with more pieces than the default
│ │ │ │ │ -limit) may also require passing in a higher limit to _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) and
│ │ │ │ │ -_t_o_r_r_e_n_t___i_n_f_o_:_:_p_a_r_s_e___i_n_f_o___s_e_c_t_i_o_n_(_), if those are used.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_e_t_a_d_a_t_a___t_o_k_e_n___l_i_m_i_t_|_i_n_t_ _|_2_5_0_0_0_0_0|
│ │ │ │ │ -when receiving metadata (torrent file) from peers, this is the max number of
│ │ │ │ │ -bencoded tokens we're willing to parse. This limit is meant to prevent DoS
│ │ │ │ │ -attacks on peers. For very large torrents, this limit may have to be raised.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_i_s_k___w_r_i_t_e___m_o_d_e_|_i_n_t_ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_m_m_a_p___w_r_i_t_e___m_o_d_e___t_:_:_a_u_t_o___m_m_a_p___w_r_i_t_e|
│ │ │ │ │ -controls whether disk writes will be made through a memory mapped file or via
│ │ │ │ │ -normal write calls. This only affects the mmap_disk_io. When saving to a non-
│ │ │ │ │ -local drive (network share, NFS or NAS) using memory mapped files is most
│ │ │ │ │ -likely inferior. When writing to a local SSD (especially in DAX mode) using
│ │ │ │ │ -memory mapped files likely gives the best performance. The values for this
│ │ │ │ │ -setting are specified as _m_m_a_p___w_r_i_t_e___m_o_d_e___t.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_m_m_a_p___f_i_l_e___s_i_z_e___c_u_t_o_f_f_|_i_n_t_ _|_4_0_ _ _ _ _ |
│ │ │ │ │ -when using mmap_disk_io, files smaller than this number of blocks will not be
│ │ │ │ │ -memory mapped, but will use normal pread/pwrite operations. This file size
│ │ │ │ │ -limit is specified in 16 kiB blocks.
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_i_2_p___i_n_b_o_u_n_d___q_u_a_n_t_i_t_y_ _|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ -|_i_2_p___o_u_t_b_o_u_n_d___q_u_a_n_t_i_t_y_|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ -|_i_2_p___i_n_b_o_u_n_d___l_e_n_g_t_h_ _ _ _|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ -|_i_2_p___o_u_t_b_o_u_n_d___l_e_n_g_t_h_ _ _|_i_n_t_ _|_3_ _ _ _ _ _ |
│ │ │ │ │ -Configures the SAM _s_e_s_s_i_o_n quantity of I2P inbound and outbound tunnels
│ │ │ │ │ -[1..16]. number of hops for I2P inbound and outbound tunnels [0..7] Changing
│ │ │ │ │ -these will not trigger a reconnect to the SAM bridge, they will take effect the
│ │ │ │ │ -next time the SAM connection is re-established (by restarting or changing
│ │ │ │ │ -i2p_hostname or i2p_port).
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _|_tt_yy_pp_ee_|_dd_ee_ff_aa_uu_ll_tt|
│ │ │ │ │ -|_a_n_n_o_u_n_c_e___p_o_r_t_|_i_n_t_ _|_0_ _ _ _ _ _ |
│ │ │ │ │ -announce_port is the port passed along as the port parameter to remote trackers
│ │ │ │ │ -such as HTTP or DHT. This setting does not affect the effective listening port
│ │ │ │ │ -nor local service discovery announcements. If left as zero (default), the
│ │ │ │ │ -listening port value is used.
│ │ │ │ │ -Note
│ │ │ │ │ -This setting is only meant for very special cases where a seed's listening port
│ │ │ │ │ -differs from the external port. As an example, if a local proxy is used and
│ │ │ │ │ -that the proxy supports reverse tunnels through NAT-PMP, the tracker must
│ │ │ │ │ -connect to the external NAT-PMP port (configured using announce_port) instead
│ │ │ │ │ -of the actual local listening port.
│ │ │ │ │ -struct settings_pack final : settings_interface
│ │ │ │ │ -{
│ │ │ │ │ -   friend  void aappppllyy__ppaacckk__iimmppll (settings_pack const*
│ │ │ │ │ -      , aux::session_settings_single_thread&
│ │ │ │ │ -      , std::vector<void(aux::session_impl::*)()>*);
│ │ │ │ │ -   void sseett__iinntt (int name, flags::bitfield_flag<Type, Tag> const val);
│ │ │ │ │ -   void sseett__iinntt (int name, int val) override;
│ │ │ │ │ -   void sseett__bbooooll (int name, bool val) override;
│ │ │ │ │ -   void sseett__ssttrr (int name, std::string val) override;
│ │ │ │ │ -   bool hhaass__vvaall (int name) const override;
│ │ │ │ │ -   void cclleeaarr ();
│ │ │ │ │ -   void cclleeaarr (int name);
│ │ │ │ │ -   int ggeett__iinntt (int name) const override;
│ │ │ │ │ -   bool ggeett__bbooooll (int name) const override;
│ │ │ │ │ -   std::string const& ggeett__ssttrr (int name) const override;
│ │ │ │ │ -   void ffoorr__eeaacchh (Fun&& f) const;
│ │ │ │ │ -
│ │ │ │ │ -   enum type_bases
│ │ │ │ │ -   {
│ │ │ │ │ -      string_type_base,
│ │ │ │ │ -      int_type_base,
│ │ │ │ │ -      bool_type_base,
│ │ │ │ │ -      type_mask,
│ │ │ │ │ -      index_mask,
│ │ │ │ │ -   };
│ │ │ │ │ -
│ │ │ │ │ -   enum mmap_write_mode_t
│ │ │ │ │ -   {
│ │ │ │ │ -      always_pwrite,
│ │ │ │ │ -      always_mmap_write,
│ │ │ │ │ -      auto_mmap_write,
│ │ │ │ │ -   };
│ │ │ │ │ -
│ │ │ │ │ -   enum suggest_mode_t
│ │ │ │ │ -   {
│ │ │ │ │ -      no_piece_suggestions,
│ │ │ │ │ -      suggest_read_cache,
│ │ │ │ │ -   };
│ │ │ │ │ -
│ │ │ │ │ -   enum choking_algorithm_t
│ │ │ │ │ -   {
│ │ │ │ │ -      fixed_slots_choker,
│ │ │ │ │ -      rate_based_choker,
│ │ │ │ │ -      deprecated_bittyrant_choker,
│ │ │ │ │ -   };
│ │ │ │ │ -
│ │ │ │ │ -   enum seed_choking_algorithm_t
│ │ │ │ │ -   {
│ │ │ │ │ -      round_robin,
│ │ │ │ │ -      fastest_upload,
│ │ │ │ │ -      anti_leech,
│ │ │ │ │ -   };
│ │ │ │ │ -
│ │ │ │ │ -   enum io_buffer_mode_t
│ │ │ │ │ -   {
│ │ │ │ │ -      enable_os_cache,
│ │ │ │ │ -      deprecated_disable_os_cache_for_aligned_files,
│ │ │ │ │ -      disable_os_cache,
│ │ │ │ │ -      write_through,
│ │ │ │ │ -   };
│ │ │ │ │ -
│ │ │ │ │ -   enum bandwidth_mixed_algo_t
│ │ │ │ │ -   {
│ │ │ │ │ -      prefer_tcp,
│ │ │ │ │ -      peer_proportional,
│ │ │ │ │ -   };
│ │ │ │ │ -
│ │ │ │ │ -   enum enc_policy
│ │ │ │ │ -   {
│ │ │ │ │ -      pe_forced,
│ │ │ │ │ -      pe_enabled,
│ │ │ │ │ -      pe_disabled,
│ │ │ │ │ -   };
│ │ │ │ │ -
│ │ │ │ │ -   enum enc_level
│ │ │ │ │ -   {
│ │ │ │ │ -      pe_plaintext,
│ │ │ │ │ -      pe_rc4,
│ │ │ │ │ -      pe_both,
│ │ │ │ │ -   };
│ │ │ │ │ -
│ │ │ │ │ -   enum proxy_type_t
│ │ │ │ │ -   {
│ │ │ │ │ -      none,
│ │ │ │ │ -      socks4,
│ │ │ │ │ -      socks5,
│ │ │ │ │ -      socks5_pw,
│ │ │ │ │ -      http,
│ │ │ │ │ -      http_pw,
│ │ │ │ │ -   };
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__bbooooll(()) sseett__iinntt(()) sseett__ssttrr(()) **********
│ │ │ │ │ -void sseett__iinntt (int name, flags::bitfield_flag<Type, Tag> const val);
│ │ │ │ │ -void sseett__iinntt (int name, int val) override;
│ │ │ │ │ -void sseett__bbooooll (int name, bool val) override;
│ │ │ │ │ -void sseett__ssttrr (int name, std::string val) override;
│ │ │ │ │ -set a configuration option in the _s_e_t_t_i_n_g_s___p_a_c_k. name is one of the enum values
│ │ │ │ │ -from string_types, int_types or bool_types. They must match the respective type
│ │ │ │ │ -of the set_* function.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** hhaass__vvaall(()) **********
│ │ │ │ │ -bool hhaass__vvaall (int name) const override;
│ │ │ │ │ -queries whether the specified configuration option has a value set in this
│ │ │ │ │ -pack. name can be any enumeration value from string_types, int_types or
│ │ │ │ │ -bool_types.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** cclleeaarr(()) **********
│ │ │ │ │ -void cclleeaarr ();
│ │ │ │ │ -clear the settings pack from all settings
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** cclleeaarr(()) **********
│ │ │ │ │ -void cclleeaarr (int name);
│ │ │ │ │ -clear a specific setting from the pack
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeett__ssttrr(()) ggeett__bbooooll(()) ggeett__iinntt(()) **********
│ │ │ │ │ -int ggeett__iinntt (int name) const override;
│ │ │ │ │ -bool ggeett__bbooooll (int name) const override;
│ │ │ │ │ -std::string const& ggeett__ssttrr (int name) const override;
│ │ │ │ │ -queries the current configuration option from the _s_e_t_t_i_n_g_s___p_a_c_k. name is one of
│ │ │ │ │ -the enumeration values from string_types, int_types or bool_types. The enum
│ │ │ │ │ -value must match the type of the get_* function. If the specified setting field
│ │ │ │ │ -has not been set, the default value is returned.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm ttyyppee__bbaasseess **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_s_t_r_i_n_g___t_y_p_e___b_a_s_e_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_n_t___t_y_p_e___b_a_s_e_ _ _ _|_1_6_3_8_4_|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_b_o_o_l___t_y_p_e___b_a_s_e_ _ _|_3_2_7_6_8_|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_t_y_p_e___m_a_s_k_ _ _ _ _ _ _ _|_4_9_1_5_2_|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_n_d_e_x___m_a_s_k_ _ _ _ _ _ _|_1_6_3_8_3_|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm mmmmaapp__wwrriittee__mmooddee__tt **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|always_pwrite    |0    |disable writing to disk via mmap, always use normal |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_r_i_t_e_ _c_a_l_l_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|always_mmap_write|1    |prefer using memory mapped files for disk writes (at|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_l_e_a_s_t_ _f_o_r_ _l_a_r_g_e_ _f_i_l_e_s_ _w_h_e_r_e_ _i_t_ _m_i_g_h_t_ _m_a_k_e_ _s_e_n_s_e_)_ _ _ _ |
│ │ │ │ │ -|                 |     |determine whether to use pwrite or memory mapped    |
│ │ │ │ │ -|auto_mmap_write  |2    |files for disk writes depending on the kind of      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_t_o_r_a_g_e_ _b_e_h_i_n_d_ _t_h_e_ _s_a_v_e_ _p_a_t_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm ssuuggggeesstt__mmooddee__tt **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_n_o___p_i_e_c_e___s_u_g_g_e_s_t_i_o_n_s_|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_u_g_g_e_s_t___r_e_a_d___c_a_c_h_e_ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm cchhookkiinngg__aallggoorriitthhmm__tt **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                           |     |This is the traditional choker with a fixed|
│ │ │ │ │ -|fixed_slots_choker         |0    |number of unchoke slots (as specified by   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_e_t_t_i_n_g_s___p_a_c_k_:_:_u_n_c_h_o_k_e___s_l_o_t_s___l_i_m_i_t_)_._ _ _ _ _ _ _ |
│ │ │ │ │ -|                           |     |This opens up unchoke slots based on the   |
│ │ │ │ │ -|                           |     |upload rate achieved to peers. The more    |
│ │ │ │ │ -|                           |     |slots that are opened, the marginal upload |
│ │ │ │ │ -|                           |     |rate required to open up another slot      |
│ │ │ │ │ -|rate_based_choker          |2    |increases. Configure the initial threshold |
│ │ │ │ │ -|                           |     |with _s_e_t_t_i_n_g_s___p_a_c_k_:_:                       |
│ │ │ │ │ -|                           |     |_r_a_t_e___c_h_o_k_e_r___i_n_i_t_i_a_l___t_h_r_e_s_h_o_l_d.             |
│ │ │ │ │ -|                           |     |For more information, see _r_a_t_e_ _b_a_s_e_d       |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_h_o_k_i_n_g_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_e_p_r_e_c_a_t_e_d___b_i_t_t_y_r_a_n_t___c_h_o_k_e_r_|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm sseeeedd__cchhookkiinngg__aallggoorriitthhmm__tt **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|              |     |which round-robins the peers that are unchoked when     |
│ │ │ │ │ -|round_robin   |0    |seeding. This distributes the upload bandwidth uniformly|
│ │ │ │ │ -|              |     |and fairly. It minimizes the ability for a peer to      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_o_w_n_l_o_a_d_ _e_v_e_r_y_t_h_i_n_g_ _w_i_t_h_o_u_t_ _r_e_d_i_s_t_r_i_b_u_t_i_n_g_ _i_t_._ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|              |     |unchokes the peers we can send to the fastest. This     |
│ │ │ │ │ -|fastest_upload|1    |might be a bit more reliable in utilizing all available |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_a_p_a_c_i_t_y_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|              |     |prioritizes peers who have just started or are just     |
│ │ │ │ │ -|              |     |about to finish the download. The intention is to force |
│ │ │ │ │ -|anti_leech    |2    |peers in the middle of the download to trade with each  |
│ │ │ │ │ -|              |     |other. This does not just take into account the pieces a|
│ │ │ │ │ -|              |     |peer is reporting having downloaded, but also the pieces|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_e_ _h_a_v_e_ _s_e_n_t_ _t_o_ _i_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm iioo__bbuuffffeerr__mmooddee__tt **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_e_n_a_b_l_e___o_s___c_a_c_h_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_e_p_r_e_c_a_t_e_d___d_i_s_a_b_l_e___o_s___c_a_c_h_e___f_o_r___a_l_i_g_n_e_d___f_i_l_e_s_|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_i_s_a_b_l_e___o_s___c_a_c_h_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_w_r_i_t_e___t_h_r_o_u_g_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm bbaannddwwiiddtthh__mmiixxeedd__aallggoo__tt **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_r_e_f_e_r___t_c_p_ _ _ _ _ _ _ _|_0_ _ _ _ _|_d_i_s_a_b_l_e_s_ _t_h_e_ _m_i_x_e_d_ _m_o_d_e_ _b_a_n_d_w_i_d_t_h_ _b_a_l_a_n_c_i_n_g_ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|peer_proportional|1    |does not throttle uTP, throttles TCP to the same     |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_r_o_p_o_r_t_i_o_n_ _o_f_ _t_h_r_o_u_g_h_p_u_t_ _a_s_ _t_h_e_r_e_ _a_r_e_ _T_C_P_ _c_o_n_n_e_c_t_i_o_n_s|
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm eenncc__ppoolliiccyy **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|           |     |Only encrypted connections are allowed. Incoming          |
│ │ │ │ │ -|pe_forced  |0    |connections that are not encrypted are closed and if the  |
│ │ │ │ │ -|           |     |encrypted outgoing connection fails, a non-encrypted retry|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_i_l_l_ _n_o_t_ _b_e_ _m_a_d_e_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|           |     |encrypted connections are enabled, but non-encrypted      |
│ │ │ │ │ -|           |     |connections are allowed. An incoming non-encrypted        |
│ │ │ │ │ -|pe_enabled |1    |connection will be accepted, and if an outgoing encrypted |
│ │ │ │ │ -|           |     |connection fails, a non- encrypted connection will be     |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_r_i_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_e___d_i_s_a_b_l_e_d_|_2_ _ _ _ _|_o_n_l_y_ _n_o_n_-_e_n_c_r_y_p_t_e_d_ _c_o_n_n_e_c_t_i_o_n_s_ _a_r_e_ _a_l_l_o_w_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm eenncc__lleevveell **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_e___p_l_a_i_n_t_e_x_t_|_1_ _ _ _ _|_u_s_e_ _o_n_l_y_ _p_l_a_i_n_ _t_e_x_t_ _e_n_c_r_y_p_t_i_o_n|
│ │ │ │ │ -|_p_e___r_c_4_ _ _ _ _ _ _|_2_ _ _ _ _|_u_s_e_ _o_n_l_y_ _R_C_4_ _e_n_c_r_y_p_t_i_o_n_ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_e___b_o_t_h_ _ _ _ _ _|_3_ _ _ _ _|_a_l_l_o_w_ _b_o_t_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm pprrooxxyy__ttyyppee__tt **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_o_n_e_ _ _ _ _ _|_0_ _ _ _ _|_N_o_ _p_r_o_x_y_ _s_e_r_v_e_r_ _i_s_ _u_s_e_d_ _a_n_d_ _a_l_l_ _o_t_h_e_r_ _f_i_e_l_d_s_ _a_r_e_ _i_g_n_o_r_e_d_._ _ _ _ |
│ │ │ │ │ -|socks4   |1    |The server is assumed to be a _S_O_C_K_S_4_ _s_e_r_v_e_r that requires a  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_u_s_e_r_n_a_m_e_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|         |     |The server is assumed to be a SOCKS5 server (_R_F_C_ _1_9_2_8) that  |
│ │ │ │ │ -|socks5   |2    |does not require any authentication. The username and        |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_a_s_s_w_o_r_d_ _a_r_e_ _i_g_n_o_r_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|         |     |The server is assumed to be a SOCKS5 server that supports    |
│ │ │ │ │ -|socks5_pw|3    |plain text username and password authentication (_R_F_C_ _1_9_2_9).  |
│ │ │ │ │ -|         |     |The username and password specified may be sent to the proxy |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_f_ _i_t_ _r_e_q_u_i_r_e_s_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|         |     |The server is assumed to be an HTTP proxy. If the transport  |
│ │ │ │ │ -|         |     |used for the connection is non-HTTP, the server is assumed to|
│ │ │ │ │ -|http     |4    |support the _C_O_N_N_E_C_T method. i.e. for web seeds and HTTP      |
│ │ │ │ │ -|         |     |trackers, a plain proxy will suffice. The proxy is assumed to|
│ │ │ │ │ -|         |     |not require authorization. The username and password will not|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_e_ _u_s_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|         |     |The server is assumed to be an HTTP proxy that requires user |
│ │ │ │ │ -|http_pw  |5    |authorization. The username and password will be sent to the |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_r_o_x_y_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ mmiinn__mmeemmoorryy__uussaaggee(()) hhiigghh__ppeerrffoorrmmaannccee__sseeeedd(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n_._h_p_p"
│ │ │ │ │ -settings_pack mmiinn__mmeemmoorryy__uussaaggee ();
│ │ │ │ │ -settings_pack hhiigghh__ppeerrffoorrmmaannccee__sseeeedd ();
│ │ │ │ │ -The default values of the _s_e_s_s_i_o_n settings are set for a regular bittorrent
│ │ │ │ │ -client running on a desktop system. There are functions that can set the
│ │ │ │ │ -_s_e_s_s_i_o_n settings to pre set settings for other environments. These can be used
│ │ │ │ │ -for the basis, and should be tweaked to fit your needs better.
│ │ │ │ │ -min_memory_usage 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.
│ │ │ │ │ -This configuration is intended to be the starting point for embedded devices.
│ │ │ │ │ -It will significantly reduce memory usage.
│ │ │ │ │ -high_performance_seed 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.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ggeenneerraattee__ffiinnggeerrpprriinntt(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_f_i_n_g_e_r_p_r_i_n_t_._h_p_p"
│ │ │ │ │ -std::string ggeenneerraattee__ffiinnggeerrpprriinntt (std::string name
│ │ │ │ │ -   , int major, int minor = 0, int revision = 0, int tag = 0);
│ │ │ │ │ -This is a utility function to produce a client ID fingerprint formatted to the
│ │ │ │ │ -most common convention. The fingerprint can be set via the peer_fingerprint
│ │ │ │ │ -setting, in _s_e_t_t_i_n_g_s___p_a_c_k.
│ │ │ │ │ -The name string should contain exactly two characters. These are the characters
│ │ │ │ │ -unique to your client, used to identify it. Make sure not to clash with anybody
│ │ │ │ │ -else. Here are some taken id's:
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_ii_dd_ _cc_hh_aa_rr_ss_|_cc_ll_ii_ee_nn_tt_ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_L_T_ _ _ _ _ _ _|_l_i_b_t_o_r_r_e_n_t_ _(_d_e_f_a_u_l_t_)|
│ │ │ │ │ -|_U_T_ _ _ _ _ _ _|_u_T_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_U_M_ _ _ _ _ _ _|_u_T_o_r_r_e_n_t_ _M_a_c_ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_q_B_ _ _ _ _ _ _|_q_B_i_t_t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_B_P_ _ _ _ _ _ _|_B_i_t_T_o_r_r_e_n_t_ _P_r_o_ _ _ _ _ _ |
│ │ │ │ │ -|_B_T_ _ _ _ _ _ _|_B_i_t_T_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_D_E_ _ _ _ _ _ _|_D_e_l_u_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_A_Z_ _ _ _ _ _ _|_A_z_u_r_e_u_s_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_T_L_ _ _ _ _ _ _|_T_r_i_b_l_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -There's an informal directory of client id's _h_e_r_e.
│ │ │ │ │ -The major, minor, revision and tag parameters are used to identify the version
│ │ │ │ │ -of your client.
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_i_n_t___t_ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_s_t_r_i_n_g___t_ _ _ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_l_i_s_t___t_ _ _ _ _ _ _ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_i_c_t_i_o_n_a_r_y___t_ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_u_n_d_e_f_i_n_e_d___t_ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_r_e_f_o_r_m_a_t_t_e_d___t_|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ nnaammee__ffoorr__sseettttiinngg(()) sseettttiinngg__bbyy__nnaammee(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ -char const* nnaammee__ffoorr__sseettttiinngg (int s);
│ │ │ │ │ -int sseettttiinngg__bbyy__nnaammee (string_view name);
│ │ │ │ │ -converts a setting integer (from the enums string_types, int_types or
│ │ │ │ │ -bool_types) to a string, and vice versa.
│ │ │ │ │ +************ bbeennccooddee(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_e_n_c_o_d_e_._h_p_p"
│ │ │ │ │ +template<class OutIt> int bbeennccooddee (OutIt out, const entry& e);
│ │ │ │ │ +This function will encode data to bencoded form.
│ │ │ │ │ +The _e_n_t_r_y class is the internal representation of the bencoded data and it can
│ │ │ │ │ +be used to retrieve information, an _e_n_t_r_y can also be build by the program and
│ │ │ │ │ +given to bencode() to encode it into the OutIt iterator.
│ │ │ │ │ +OutIt is an _O_u_t_p_u_t_I_t_e_r_a_t_o_r. It's a template and usually instantiated as
│ │ │ │ │ +_o_s_t_r_e_a_m___i_t_e_r_a_t_o_r or _b_a_c_k___i_n_s_e_r_t___i_t_e_r_a_t_o_r. This function assumes the value_type
│ │ │ │ │ +of the iterator is a char. In order to encode _e_n_t_r_y e into a buffer, do:
│ │ │ │ │ +std::vector<char> buf;
│ │ │ │ │ +bencode(std::back_inserter(buf), e);
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddeeffaauulltt__sseettttiinnggss(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p"
│ │ │ │ │ -settings_pack ddeeffaauulltt__sseettttiinnggss ();
│ │ │ │ │ -returns a _s_e_t_t_i_n_g_s___p_a_c_k with every setting set to its default value
│ │ │ │ │ +************ ooppeerraattoorr<<<<(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_n_t_r_y_._h_p_p"
│ │ │ │ │ +inline std::ostream& ooppeerraattoorr<<<< (std::ostream& os, const entry& e);
│ │ │ │ │ +prints the bencoded structure to the ostream as a JSON-style structure.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ssttoorraaggee__eerrrroorr ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_r_r_o_r___c_o_d_e_._h_p_p"
│ │ │ │ │  used by storage to return errors also includes which underlying file the error
│ │ │ │ │  happened on
│ │ │ │ │  struct storage_error
│ │ │ │ │  {
│ │ │ │ │     explicit operator bbooooll () const;
│ │ │ │ │ -   file_index_t ffiillee () const;
│ │ │ │ │     void ffiillee (file_index_t f);
│ │ │ │ │ +   file_index_t ffiillee () const;
│ │ │ │ │  
│ │ │ │ │     error_code ec;
│ │ │ │ │     operation_t operation;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** bbooooll(()) **********
│ │ │ │ │  explicit operator bbooooll () const;
│ │ │ │ │  explicitly converts to true if this object represents an error, and false if it
│ │ │ │ │  does not.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ffiillee(()) **********
│ │ │ │ │ -file_index_t ffiillee () const;
│ │ │ │ │  void ffiillee (file_index_t f);
│ │ │ │ │ +file_index_t ffiillee () const;
│ │ │ │ │  set and query the index (in the torrent) of the file this error occurred on.
│ │ │ │ │  This may also have special values defined in _t_o_r_r_e_n_t___s_t_a_t_u_s.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    ec
│ │ │ │ │        the error that occurred
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │    operation
│ │ │ │ │        A code from _o_p_e_r_a_t_i_o_n___t enum, indicating what kind of operation failed.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ggzziipp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_g_z_i_p_._h_p_p"
│ │ │ │ │ +boost::system::error_category& ggzziipp__ccaatteeggoorryy ();
│ │ │ │ │ +get the error_category for zip errors
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ uuppnnpp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_u_p_n_p_._h_p_p"
│ │ │ │ │ +boost::system::error_category& uuppnnpp__ccaatteeggoorryy ();
│ │ │ │ │ +the boost.system error category for UPnP errors
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ bbddeeccooddee__ccaatteeggoorryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ +boost::system::error_category& bbddeeccooddee__ccaatteeggoorryy ();
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ppccpp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_n_a_t_p_m_p_._h_p_p"
│ │ │ │ │ +boost::system::error_category& ppccpp__ccaatteeggoorryy ();
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ ii22pp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_2_p___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │ +boost::system::error_category& ii22pp__ccaatteeggoorryy ();
│ │ │ │ │ +returns the error category for I2P errors
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ lliibbttoorrrreenntt__ccaatteeggoorryy(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_r_r_o_r___c_o_d_e_._h_p_p"
│ │ │ │ │  boost::system::error_category& lliibbttoorrrreenntt__ccaatteeggoorryy ();
│ │ │ │ │  return the instance of the libtorrent_error_category which maps libtorrent
│ │ │ │ │  error codes to human readable error messages.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ hhttttpp__ccaatteeggoorryy(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_r_r_o_r___c_o_d_e_._h_p_p"
│ │ │ │ │  boost::system::error_category& hhttttpp__ccaatteeggoorryy ();
│ │ │ │ │  returns the error_category for HTTP errors
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ii22pp__ccaatteeggoorryy(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_2_p___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │ -boost::system::error_category& ii22pp__ccaatteeggoorryy ();
│ │ │ │ │ -returns the error category for I2P errors
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ bbddeeccooddee__ccaatteeggoorryy(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ -boost::system::error_category& bbddeeccooddee__ccaatteeggoorryy ();
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ppccpp__ccaatteeggoorryy(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_n_a_t_p_m_p_._h_p_p"
│ │ │ │ │ -boost::system::error_category& ppccpp__ccaatteeggoorryy ();
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ssoocckkss__ccaatteeggoorryy(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_o_c_k_s_5___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │  boost::system::error_category& ssoocckkss__ccaatteeggoorryy ();
│ │ │ │ │  returns the error_category for SOCKS5 errors
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ggzziipp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_g_z_i_p_._h_p_p"
│ │ │ │ │ -boost::system::error_category& ggzziipp__ccaatteeggoorryy ();
│ │ │ │ │ -get the error_category for zip errors
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_t_ _a_n_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|invalid_gzip_header                |1    |the supplied gzip buffer has       |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _h_e_a_d_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                                   |     |the gzip buffer would inflate to   |
│ │ │ │ │ +|inflated_data_too_large            |2    |more bytes than the specified      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_x_i_m_u_m_ _s_i_z_e_,_ _a_n_d_ _w_a_s_ _r_e_j_e_c_t_e_d_._ _ _ _ |
│ │ │ │ │ +|data_did_not_terminate             |3    |available inflate data did not     |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_e_r_m_i_n_a_t_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|space_exhausted                    |4    |output space exhausted before      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_m_p_l_e_t_i_n_g_ _i_n_f_l_a_t_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_n_v_a_l_i_d___b_l_o_c_k___t_y_p_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_5_ _ _ _ _|_i_n_v_a_l_i_d_ _b_l_o_c_k_ _t_y_p_e_ _(_t_y_p_e_ _=_=_ _3_)_ _ _ _ _ |
│ │ │ │ │ +|invalid_stored_block_length        |6    |stored block length did not match  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_n_e_'_s_ _c_o_m_p_l_e_m_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|too_many_length_or_distance_codes  |7    |dynamic block code description: too|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_n_y_ _l_e_n_g_t_h_ _o_r_ _d_i_s_t_a_n_c_e_ _c_o_d_e_s_ _ _ _ _ _ |
│ │ │ │ │ +|code_lengths_codes_incomplete      |8    |dynamic block code description:    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_d_e_ _l_e_n_g_t_h_s_ _c_o_d_e_s_ _i_n_c_o_m_p_l_e_t_e_ _ _ _ _ _ |
│ │ │ │ │ +|repeat_lengths_with_no_first_length|9    |dynamic block code description:    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_p_e_a_t_ _l_e_n_g_t_h_s_ _w_i_t_h_ _n_o_ _f_i_r_s_t_ _l_e_n_g_t_h|
│ │ │ │ │ +|repeat_more_than_specified_lengths |10   |dynamic block code description:    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_p_e_a_t_ _m_o_r_e_ _t_h_a_n_ _s_p_e_c_i_f_i_e_d_ _l_e_n_g_t_h_s_ |
│ │ │ │ │ +|invalid_literal_length_code_lengths|11   |dynamic block code description:    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _l_i_t_e_r_a_l_/_l_e_n_g_t_h_ _c_o_d_e_ _l_e_n_g_t_h_s|
│ │ │ │ │ +|invalid_distance_code_lengths      |12   |dynamic block code description:    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _d_i_s_t_a_n_c_e_ _c_o_d_e_ _l_e_n_g_t_h_s_ _ _ _ _ _ |
│ │ │ │ │ +|invalid_literal_code_in_block      |13   |invalid literal/length or distance |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_d_e_ _i_n_ _f_i_x_e_d_ _o_r_ _d_y_n_a_m_i_c_ _b_l_o_c_k_ _ _ _ _ |
│ │ │ │ │ +|distance_too_far_back_in_block     |14   |distance is too far back in fixed  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_r_ _d_y_n_a_m_i_c_ _b_l_o_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|unknown_gzip_error                 |15   |an unknown error occurred during   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_g_z_i_p_ _i_n_f_l_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_e_r_r_o_r___c_o_d_e___m_a_x_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_6_ _ _ _|_t_h_e_ _n_u_m_b_e_r_ _o_f_ _e_r_r_o_r_ _c_o_d_e_s_ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ uuppnnpp__ccaatteeggoorryy(()) ************
│ │ │ │ │ +************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_u_p_n_p_._h_p_p"
│ │ │ │ │ -boost::system::error_category& uuppnnpp__ccaatteeggoorryy ();
│ │ │ │ │ -the boost.system error category for UPnP errors
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|invalid_argument                  |402  |One of the arguments in the request |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_s_ _i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_a_c_t_i_o_n___f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_5_0_1_ _ _|_T_h_e_ _r_e_q_u_e_s_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|value_not_in_array                |714  |The specified value does not exist  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_ _t_h_e_ _a_r_r_a_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                                  |     |The source IP address cannot be     |
│ │ │ │ │ +|source_ip_cannot_be_wildcarded    |715  |wild-carded, but must be fully      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_p_e_c_i_f_i_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|external_port_cannot_be_wildcarded|716  |The external port cannot be a       |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_i_l_d_c_a_r_d_,_ _b_u_t_ _m_u_s_t_ _b_e_ _s_p_e_c_i_f_i_e_d_ _ _ _ _ |
│ │ │ │ │ +|                                  |     |The port mapping _e_n_t_r_y specified    |
│ │ │ │ │ +|port_mapping_conflict             |718  |conflicts with a mapping assigned   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_r_e_v_i_o_u_s_l_y_ _t_o_ _a_n_o_t_h_e_r_ _c_l_i_e_n_t_ _ _ _ _ _ _ _ |
│ │ │ │ │ +|internal_port_must_match_external |724  |Internal and external port value    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_u_s_t_ _b_e_ _t_h_e_ _s_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                                  |     |The NAT implementation only supports|
│ │ │ │ │ +|only_permanent_leases_supported   |725  |permanent lease times on port       |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_p_p_i_n_g_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|                                  |     |RemoteHost must be a wildcard and   |
│ │ │ │ │ +|remote_host_must_be_wildcard      |726  |cannot be a specific IP address or  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_D_N_S_ _n_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|external_port_must_be_wildcard    |727  |ExternalPort must be a wildcard and |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_a_n_n_o_t_ _b_e_ _a_ _s_p_e_c_i_f_i_c_ _p_o_r_t_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_o___e_r_r_o_r_ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_t_ _a_n_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_e_x_p_e_c_t_e_d___d_i_g_i_t_|_1_ _ _ _ _|_e_x_p_e_c_t_e_d_ _d_i_g_i_t_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_e_x_p_e_c_t_e_d___c_o_l_o_n_|_2_ _ _ _ _|_e_x_p_e_c_t_e_d_ _c_o_l_o_n_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_u_n_e_x_p_e_c_t_e_d___e_o_f_|_3_ _ _ _ _|_u_n_e_x_p_e_c_t_e_d_ _e_n_d_ _o_f_ _f_i_l_e_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|expected_value|4    |expected value (list, dict, _i_n_t or string) in bencoded|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_e_p_t_h___e_x_c_e_e_d_e_d_|_5_ _ _ _ _|_b_e_n_c_o_d_e_d_ _r_e_c_u_r_s_i_o_n_ _d_e_p_t_h_ _l_i_m_i_t_ _e_x_c_e_e_d_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_l_i_m_i_t___e_x_c_e_e_d_e_d_|_6_ _ _ _ _|_b_e_n_c_o_d_e_d_ _i_t_e_m_ _c_o_u_n_t_ _l_i_m_i_t_ _e_x_c_e_e_d_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_o_v_e_r_f_l_o_w_ _ _ _ _ _ _|_7_ _ _ _ _|_i_n_t_e_g_e_r_ _o_v_e_r_f_l_o_w_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_e_r_r_o_r___c_o_d_e___m_a_x_|_8_ _ _ _ _|_t_h_e_ _n_u_m_b_e_r_ _o_f_ _e_r_r_o_r_ _c_o_d_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ppccpp__eerrrroorrss ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_n_a_t_p_m_p_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_p_c_p___s_u_c_c_e_s_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___u_n_s_u_p_p___v_e_r_s_i_o_n_ _ _ _ _ _ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___n_o_t___a_u_t_h_o_r_i_z_e_d_ _ _ _ _ _ _ _ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___m_a_l_f_o_r_m_e_d___r_e_q_u_e_s_t_ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___u_n_s_u_p_p___o_p_c_o_d_e_ _ _ _ _ _ _ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___u_n_s_u_p_p___o_p_t_i_o_n_ _ _ _ _ _ _ _ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___m_a_l_f_o_r_m_e_d___o_p_t_i_o_n_ _ _ _ _ _ _ _|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___n_e_t_w_o_r_k___f_a_i_l_u_r_e_ _ _ _ _ _ _ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___n_o___r_e_s_o_u_r_c_e_s_ _ _ _ _ _ _ _ _ _ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___u_n_s_u_p_p___p_r_o_t_o_c_o_l_ _ _ _ _ _ _ _ _|_9_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___u_s_e_r___e_x___q_u_o_t_a_ _ _ _ _ _ _ _ _ _ _|_1_0_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___c_a_n_n_o_t___p_r_o_v_i_d_e___e_x_t_e_r_n_a_l_|_1_1_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___a_d_d_r_e_s_s___m_i_s_m_a_t_c_h_ _ _ _ _ _ _ _|_1_2_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_c_p___e_x_c_e_s_s_i_v_e___r_e_m_o_t_e___p_e_e_r_s_ _|_1_3_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ +************ eennuumm ii22pp__eerrrroorr__ccooddee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_2_p___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ +|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_p_a_r_s_e___f_a_i_l_e_d_ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_c_a_n_t___r_e_a_c_h___p_e_e_r_|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_2_p___e_r_r_o_r_ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_n_v_a_l_i_d___k_e_y_ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_i_n_v_a_l_i_d___i_d_ _ _ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_t_i_m_e_o_u_t_ _ _ _ _ _ _ _ _|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_k_e_y___n_o_t___f_o_u_n_d_ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_d_u_p_l_i_c_a_t_e_d___i_d_ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_n_u_m___e_r_r_o_r_s_ _ _ _ _ _|_9_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_r_r_o_r___c_o_d_e_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_t_ _a_n_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |file_collision                      |1    |Two torrents has files which end  |
│ │ │ │ │ @@ -11498,63 +12668,14 @@
│ │ │ │ │  |_f_o_r_b_i_d_d_e_n_ _ _ _ _ _ _ _ _ _ _ _ _|_4_0_3_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_n_o_t___f_o_u_n_d_ _ _ _ _ _ _ _ _ _ _ _ _|_4_0_4_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_i_n_t_e_r_n_a_l___s_e_r_v_e_r___e_r_r_o_r_|_5_0_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_n_o_t___i_m_p_l_e_m_e_n_t_e_d_ _ _ _ _ _ _|_5_0_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_b_a_d___g_a_t_e_w_a_y_ _ _ _ _ _ _ _ _ _ _|_5_0_2_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_s_e_r_v_i_c_e___u_n_a_v_a_i_l_a_b_l_e_ _ _|_5_0_3_ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ii22pp__eerrrroorr__ccooddee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_i_2_p___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_a_r_s_e___f_a_i_l_e_d_ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_c_a_n_t___r_e_a_c_h___p_e_e_r_|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_2_p___e_r_r_o_r_ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_n_v_a_l_i_d___k_e_y_ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_n_v_a_l_i_d___i_d_ _ _ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_t_i_m_e_o_u_t_ _ _ _ _ _ _ _ _|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_k_e_y___n_o_t___f_o_u_n_d_ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_u_p_l_i_c_a_t_e_d___i_d_ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_u_m___e_r_r_o_r_s_ _ _ _ _ _|_9_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_o___e_r_r_o_r_ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_t_ _a_n_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_e_x_p_e_c_t_e_d___d_i_g_i_t_|_1_ _ _ _ _|_e_x_p_e_c_t_e_d_ _d_i_g_i_t_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_e_x_p_e_c_t_e_d___c_o_l_o_n_|_2_ _ _ _ _|_e_x_p_e_c_t_e_d_ _c_o_l_o_n_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_u_n_e_x_p_e_c_t_e_d___e_o_f_|_3_ _ _ _ _|_u_n_e_x_p_e_c_t_e_d_ _e_n_d_ _o_f_ _f_i_l_e_ _i_n_ _b_e_n_c_o_d_e_d_ _s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|expected_value|4    |expected value (list, dict, _i_n_t or string) in bencoded|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_t_r_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_e_p_t_h___e_x_c_e_e_d_e_d_|_5_ _ _ _ _|_b_e_n_c_o_d_e_d_ _r_e_c_u_r_s_i_o_n_ _d_e_p_t_h_ _l_i_m_i_t_ _e_x_c_e_e_d_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_l_i_m_i_t___e_x_c_e_e_d_e_d_|_6_ _ _ _ _|_b_e_n_c_o_d_e_d_ _i_t_e_m_ _c_o_u_n_t_ _l_i_m_i_t_ _e_x_c_e_e_d_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_o_v_e_r_f_l_o_w_ _ _ _ _ _ _|_7_ _ _ _ _|_i_n_t_e_g_e_r_ _o_v_e_r_f_l_o_w_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_e_r_r_o_r___c_o_d_e___m_a_x_|_8_ _ _ _ _|_t_h_e_ _n_u_m_b_e_r_ _o_f_ _e_r_r_o_r_ _c_o_d_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm ppccpp__eerrrroorrss ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_n_a_t_p_m_p_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_p_c_p___s_u_c_c_e_s_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___u_n_s_u_p_p___v_e_r_s_i_o_n_ _ _ _ _ _ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___n_o_t___a_u_t_h_o_r_i_z_e_d_ _ _ _ _ _ _ _ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___m_a_l_f_o_r_m_e_d___r_e_q_u_e_s_t_ _ _ _ _ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___u_n_s_u_p_p___o_p_c_o_d_e_ _ _ _ _ _ _ _ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___u_n_s_u_p_p___o_p_t_i_o_n_ _ _ _ _ _ _ _ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___m_a_l_f_o_r_m_e_d___o_p_t_i_o_n_ _ _ _ _ _ _ _|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___n_e_t_w_o_r_k___f_a_i_l_u_r_e_ _ _ _ _ _ _ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___n_o___r_e_s_o_u_r_c_e_s_ _ _ _ _ _ _ _ _ _ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___u_n_s_u_p_p___p_r_o_t_o_c_o_l_ _ _ _ _ _ _ _ _|_9_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___u_s_e_r___e_x___q_u_o_t_a_ _ _ _ _ _ _ _ _ _ _|_1_0_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___c_a_n_n_o_t___p_r_o_v_i_d_e___e_x_t_e_r_n_a_l_|_1_1_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___a_d_d_r_e_s_s___m_i_s_m_a_t_c_h_ _ _ _ _ _ _ _|_1_2_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_c_p___e_x_c_e_s_s_i_v_e___r_e_m_o_t_e___p_e_e_r_s_ _|_1_3_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ eennuumm ssoocckkss__eerrrroorr__ccooddee ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_o_c_k_s_5___s_t_r_e_a_m_._h_p_p"
│ │ │ │ │   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │  |_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │  |_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_u_n_s_u_p_p_o_r_t_e_d___v_e_r_s_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_u_n_s_u_p_p_o_r_t_e_d___a_u_t_h_e_n_t_i_c_a_t_i_o_n___m_e_t_h_o_d_ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ @@ -11563,854 +12684,32 @@
│ │ │ │ │  |_u_s_e_r_n_a_m_e___r_e_q_u_i_r_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_g_e_n_e_r_a_l___f_a_i_l_u_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_c_o_m_m_a_n_d___n_o_t___s_u_p_p_o_r_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _|_7_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_n_o___i_d_e_n_t_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_8_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_i_d_e_n_t_d___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_n_u_m___e_r_r_o_r_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_0_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_g_z_i_p_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_t_ _a_n_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|invalid_gzip_header                |1    |the supplied gzip buffer has       |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _h_e_a_d_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                                   |     |the gzip buffer would inflate to   |
│ │ │ │ │ -|inflated_data_too_large            |2    |more bytes than the specified      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_x_i_m_u_m_ _s_i_z_e_,_ _a_n_d_ _w_a_s_ _r_e_j_e_c_t_e_d_._ _ _ _ |
│ │ │ │ │ -|data_did_not_terminate             |3    |available inflate data did not     |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_e_r_m_i_n_a_t_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|space_exhausted                    |4    |output space exhausted before      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_m_p_l_e_t_i_n_g_ _i_n_f_l_a_t_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_n_v_a_l_i_d___b_l_o_c_k___t_y_p_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_5_ _ _ _ _|_i_n_v_a_l_i_d_ _b_l_o_c_k_ _t_y_p_e_ _(_t_y_p_e_ _=_=_ _3_)_ _ _ _ _ |
│ │ │ │ │ -|invalid_stored_block_length        |6    |stored block length did not match  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_n_e_'_s_ _c_o_m_p_l_e_m_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|too_many_length_or_distance_codes  |7    |dynamic block code description: too|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_n_y_ _l_e_n_g_t_h_ _o_r_ _d_i_s_t_a_n_c_e_ _c_o_d_e_s_ _ _ _ _ _ |
│ │ │ │ │ -|code_lengths_codes_incomplete      |8    |dynamic block code description:    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_d_e_ _l_e_n_g_t_h_s_ _c_o_d_e_s_ _i_n_c_o_m_p_l_e_t_e_ _ _ _ _ _ |
│ │ │ │ │ -|repeat_lengths_with_no_first_length|9    |dynamic block code description:    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_p_e_a_t_ _l_e_n_g_t_h_s_ _w_i_t_h_ _n_o_ _f_i_r_s_t_ _l_e_n_g_t_h|
│ │ │ │ │ -|repeat_more_than_specified_lengths |10   |dynamic block code description:    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_p_e_a_t_ _m_o_r_e_ _t_h_a_n_ _s_p_e_c_i_f_i_e_d_ _l_e_n_g_t_h_s_ |
│ │ │ │ │ -|invalid_literal_length_code_lengths|11   |dynamic block code description:    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _l_i_t_e_r_a_l_/_l_e_n_g_t_h_ _c_o_d_e_ _l_e_n_g_t_h_s|
│ │ │ │ │ -|invalid_distance_code_lengths      |12   |dynamic block code description:    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _d_i_s_t_a_n_c_e_ _c_o_d_e_ _l_e_n_g_t_h_s_ _ _ _ _ _ |
│ │ │ │ │ -|invalid_literal_code_in_block      |13   |invalid literal/length or distance |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_d_e_ _i_n_ _f_i_x_e_d_ _o_r_ _d_y_n_a_m_i_c_ _b_l_o_c_k_ _ _ _ _ |
│ │ │ │ │ -|distance_too_far_back_in_block     |14   |distance is too far back in fixed  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_r_ _d_y_n_a_m_i_c_ _b_l_o_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|unknown_gzip_error                 |15   |an unknown error occurred during   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_g_z_i_p_ _i_n_f_l_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_e_r_r_o_r___c_o_d_e___m_a_x_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_6_ _ _ _|_t_h_e_ _n_u_m_b_e_r_ _o_f_ _e_r_r_o_r_ _c_o_d_e_s_ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennuumm eerrrroorr__ccooddee__eennuumm ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_u_p_n_p_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_n_o___e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_N_o_ _e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|invalid_argument                  |402  |One of the arguments in the request |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_s_ _i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_a_c_t_i_o_n___f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_5_0_1_ _ _|_T_h_e_ _r_e_q_u_e_s_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|value_not_in_array                |714  |The specified value does not exist  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_ _t_h_e_ _a_r_r_a_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                                  |     |The source IP address cannot be     |
│ │ │ │ │ -|source_ip_cannot_be_wildcarded    |715  |wild-carded, but must be fully      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_p_e_c_i_f_i_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|external_port_cannot_be_wildcarded|716  |The external port cannot be a       |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_i_l_d_c_a_r_d_,_ _b_u_t_ _m_u_s_t_ _b_e_ _s_p_e_c_i_f_i_e_d_ _ _ _ _ |
│ │ │ │ │ -|                                  |     |The port mapping _e_n_t_r_y specified    |
│ │ │ │ │ -|port_mapping_conflict             |718  |conflicts with a mapping assigned   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_r_e_v_i_o_u_s_l_y_ _t_o_ _a_n_o_t_h_e_r_ _c_l_i_e_n_t_ _ _ _ _ _ _ _ |
│ │ │ │ │ -|internal_port_must_match_external |724  |Internal and external port value    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_u_s_t_ _b_e_ _t_h_e_ _s_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                                  |     |The NAT implementation only supports|
│ │ │ │ │ -|only_permanent_leases_supported   |725  |permanent lease times on port       |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_a_p_p_i_n_g_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|                                  |     |RemoteHost must be a wildcard and   |
│ │ │ │ │ -|remote_host_must_be_wildcard      |726  |cannot be a specific IP address or  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_D_N_S_ _n_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|external_port_must_be_wildcard    |727  |ExternalPort must be a wildcard and |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_a_n_n_o_t_ _b_e_ _a_ _s_p_e_c_i_f_i_c_ _p_o_r_t_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ bbddeeccooddee__nnooddee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ -Sometimes it's important to get a non-owning reference to the root node ( to be
│ │ │ │ │ -able to copy it as a reference for instance). For that, use the _n_o_n___o_w_n_i_n_g_(_)
│ │ │ │ │ -member function.
│ │ │ │ │ -There are 5 different types of nodes, see _t_y_p_e___t.
│ │ │ │ │ -struct bdecode_node
│ │ │ │ │ +************ ddhhtt__ssttaattee ************
│ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_d_h_t___s_t_a_t_e_._h_p_p"
│ │ │ │ │ +This structure helps to store and load the state of the dht_tracker. At this
│ │ │ │ │ +moment the library is only a dual stack implementation of the DHT. See _B_E_P_ _3_2
│ │ │ │ │ +struct dht_state
│ │ │ │ │  {
│ │ │ │ │ -   bbddeeccooddee__nnooddee () = default;
│ │ │ │ │ -   bdecode_node& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │ -   bdecode_node& ooppeerraattoorr== (bdecode_node&&) & = default;
│ │ │ │ │ -   bbddeeccooddee__nnooddee (bdecode_node const&);
│ │ │ │ │ -   bbddeeccooddee__nnooddee (bdecode_node&&) noexcept;
│ │ │ │ │ -   type_t ttyyppee () const noexcept;
│ │ │ │ │ -   explicit operator bbooooll () const noexcept;
│ │ │ │ │ -   bdecode_node nnoonn__oowwnniinngg () const;
│ │ │ │ │ -   std::ptrdiff_t ddaattaa__ooffffsseett () const noexcept;
│ │ │ │ │ -   span<char const> ddaattaa__sseeccttiioonn () const noexcept;
│ │ │ │ │ -   std::int64_t lliisstt__iinntt__vvaalluuee__aatt (int i
│ │ │ │ │ -      , std::int64_t default_val = 0) const;
│ │ │ │ │ -   int lliisstt__ssiizzee () const;
│ │ │ │ │ -   bdecode_node lliisstt__aatt (int i) const;
│ │ │ │ │ -   string_view lliisstt__ssttrriinngg__vvaalluuee__aatt (int i
│ │ │ │ │ -      , string_view default_val = string_view()) const;
│ │ │ │ │ -   std::pair<bdecode_node, bdecode_node> ddiicctt__aatt__nnooddee (int i) const;
│ │ │ │ │ -   bdecode_node ddiicctt__ffiinndd (string_view key) const;
│ │ │ │ │ -   std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key
│ │ │ │ │ -      , std::int64_t default_val = 0) const;
│ │ │ │ │ -   std::pair<string_view, bdecode_node> ddiicctt__aatt (int i) const;
│ │ │ │ │ -   bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const;
│ │ │ │ │ -   bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const;
│ │ │ │ │ -   string_view ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee (string_view key
│ │ │ │ │ -      , string_view default_value = string_view()) const;
│ │ │ │ │ -   bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const;
│ │ │ │ │ -   int ddiicctt__ssiizzee () const;
│ │ │ │ │ -   bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const;
│ │ │ │ │ -   std::int64_t iinntt__vvaalluuee () const;
│ │ │ │ │ -   int ssttrriinngg__lleennggtthh () const;
│ │ │ │ │ -   string_view ssttrriinngg__vvaalluuee () const;
│ │ │ │ │ -   char const* ssttrriinngg__ppttrr () const;
│ │ │ │ │ -   std::ptrdiff_t ssttrriinngg__ooffffsseett () const;
│ │ │ │ │     void cclleeaarr ();
│ │ │ │ │ -   void sswwaapp (bdecode_node& n);
│ │ │ │ │ -   void rreesseerrvvee (int tokens);
│ │ │ │ │ -   void sswwiittcchh__uunnddeerrllyyiinngg__bbuuffffeerr (char const* buf) noexcept;
│ │ │ │ │ -   bool hhaass__ssoofftt__eerrrroorr (span<char> error) const;
│ │ │ │ │ -
│ │ │ │ │ -   enum type_t
│ │ │ │ │ -   {
│ │ │ │ │ -      none_t,
│ │ │ │ │ -      dict_t,
│ │ │ │ │ -      list_t,
│ │ │ │ │ -      string_t,
│ │ │ │ │ -      int_t,
│ │ │ │ │ -   };
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** bbddeeccooddee__nnooddee(()) **********
│ │ │ │ │ -bbddeeccooddee__nnooddee () = default;
│ │ │ │ │ -creates a default constructed node, it will have the type none_t.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr==(()) bbddeeccooddee__nnooddee(()) **********
│ │ │ │ │ -bdecode_node& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │ -bdecode_node& ooppeerraattoorr== (bdecode_node&&) & = default;
│ │ │ │ │ -bbddeeccooddee__nnooddee (bdecode_node const&);
│ │ │ │ │ -bbddeeccooddee__nnooddee (bdecode_node&&) noexcept;
│ │ │ │ │ -For owning nodes, the copy will create a copy of the tree, but the underlying
│ │ │ │ │ -buffer remains the same.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttyyppee(()) **********
│ │ │ │ │ -type_t ttyyppee () const noexcept;
│ │ │ │ │ -the type of this node. See _t_y_p_e___t.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** bbooooll(()) **********
│ │ │ │ │ -explicit operator bbooooll () const noexcept;
│ │ │ │ │ -returns true if _t_y_p_e_(_) != none_t.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnoonn__oowwnniinngg(()) **********
│ │ │ │ │ -bdecode_node nnoonn__oowwnniinngg () const;
│ │ │ │ │ -return a non-owning reference to this node. This is useful to refer to the root
│ │ │ │ │ -node without copying it in assignments.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddaattaa__sseeccttiioonn(()) ddaattaa__ooffffsseett(()) **********
│ │ │ │ │ -std::ptrdiff_t ddaattaa__ooffffsseett () const noexcept;
│ │ │ │ │ -span<char const> ddaattaa__sseeccttiioonn () const noexcept;
│ │ │ │ │ -returns the buffer and length of the section in the original bencoded buffer
│ │ │ │ │ -where this node is defined. For a dictionary for instance, this starts with d
│ │ │ │ │ -and ends with e, and has all the content of the dictionary in between. the
│ │ │ │ │ -data_offset() function returns the byte-offset to this node in, starting from
│ │ │ │ │ -the beginning of the buffer that was parsed.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** lliisstt__ssttrriinngg__vvaalluuee__aatt(()) lliisstt__iinntt__vvaalluuee__aatt(()) lliisstt__ssiizzee(()) lliisstt__aatt(()) **********
│ │ │ │ │ -std::int64_t lliisstt__iinntt__vvaalluuee__aatt (int i
│ │ │ │ │ -      , std::int64_t default_val = 0) const;
│ │ │ │ │ -int lliisstt__ssiizzee () const;
│ │ │ │ │ -bdecode_node lliisstt__aatt (int i) const;
│ │ │ │ │ -string_view lliisstt__ssttrriinngg__vvaalluuee__aatt (int i
│ │ │ │ │ -      , string_view default_val = string_view()) const;
│ │ │ │ │ -functions with the list_ prefix operate on lists. These functions are only
│ │ │ │ │ -valid if type() == list_t. list_at() returns the item in the list at index i. i
│ │ │ │ │ -may not be greater than or equal to the size of the list. size() returns the
│ │ │ │ │ -size of the list.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ddiicctt__ffiinndd__iinntt(()) ddiicctt__ssiizzee(()) ddiicctt__aatt__nnooddee(()) ddiicctt__aatt(()) ddiicctt__ffiinndd__ssttrriinngg(())
│ │ │ │ │ -ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee(()) ddiicctt__ffiinndd(()) ddiicctt__ffiinndd__iinntt__vvaalluuee(()) ddiicctt__ffiinndd__lliisstt(())
│ │ │ │ │ -ddiicctt__ffiinndd__ddiicctt(()) **********
│ │ │ │ │ -std::pair<bdecode_node, bdecode_node> ddiicctt__aatt__nnooddee (int i) const;
│ │ │ │ │ -bdecode_node ddiicctt__ffiinndd (string_view key) const;
│ │ │ │ │ -std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key
│ │ │ │ │ -      , std::int64_t default_val = 0) const;
│ │ │ │ │ -std::pair<string_view, bdecode_node> ddiicctt__aatt (int i) const;
│ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const;
│ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const;
│ │ │ │ │ -string_view ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee (string_view key
│ │ │ │ │ -      , string_view default_value = string_view()) const;
│ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const;
│ │ │ │ │ -int ddiicctt__ssiizzee () const;
│ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const;
│ │ │ │ │ -Functions with the dict_ prefix operates on dictionaries. They are only valid
│ │ │ │ │ -if type() == dict_t. In case a key you're looking up contains a 0 byte, you
│ │ │ │ │ -cannot use the 0-terminated string overloads, but have to use string_view
│ │ │ │ │ -instead. dict_find_list will return a valid bdecode_node if the key is found
│ │ │ │ │ -_and_ it is a list. Otherwise it will return a default-constructed
│ │ │ │ │ -_b_d_e_c_o_d_e___n_o_d_e.
│ │ │ │ │ -Functions with the _value suffix return the value of the node directly, rather
│ │ │ │ │ -than the nodes. In case the node is not found, or it has a different type, a
│ │ │ │ │ -default value is returned (which can be specified).
│ │ │ │ │ -dict_at() returns the (key, value)-pair at the specified index in a dictionary.
│ │ │ │ │ -Keys are only allowed to be strings. dict_at_node() also returns the (key,
│ │ │ │ │ -value)-pair, but the key is returned as a bdecode_node (and it will always be a
│ │ │ │ │ -string).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** iinntt__vvaalluuee(()) **********
│ │ │ │ │ -std::int64_t iinntt__vvaalluuee () const;
│ │ │ │ │ -this function is only valid if type() == int_t. It returns the value of the
│ │ │ │ │ -integer.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ssttrriinngg__vvaalluuee(()) ssttrriinngg__ooffffsseett(()) ssttrriinngg__lleennggtthh(()) ssttrriinngg__ppttrr(()) **********
│ │ │ │ │ -int ssttrriinngg__lleennggtthh () const;
│ │ │ │ │ -string_view ssttrriinngg__vvaalluuee () const;
│ │ │ │ │ -char const* ssttrriinngg__ppttrr () const;
│ │ │ │ │ -std::ptrdiff_t ssttrriinngg__ooffffsseett () const;
│ │ │ │ │ -these functions are only valid if type() == string_t. They return the string
│ │ │ │ │ -values. Note that string_ptr() is nnoott 0-terminated. string_length() returns the
│ │ │ │ │ -number of bytes in the string. string_offset() returns the byte offset from the
│ │ │ │ │ -start of the parsed bencoded buffer this string can be found.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** cclleeaarr(()) **********
│ │ │ │ │ -void cclleeaarr ();
│ │ │ │ │ -resets the bdecoded_node to a default constructed state. If this is an owning
│ │ │ │ │ -node, the tree is freed and all child nodes are invalidated.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sswwaapp(()) **********
│ │ │ │ │ -void sswwaapp (bdecode_node& n);
│ │ │ │ │ -Swap contents.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** rreesseerrvvee(()) **********
│ │ │ │ │ -void rreesseerrvvee (int tokens);
│ │ │ │ │ -preallocate memory for the specified numbers of tokens. This is useful if you
│ │ │ │ │ -know approximately how many tokens are in the file you are about to parse.
│ │ │ │ │ -Doing so will save realloc operations while parsing. You should only call this
│ │ │ │ │ -on the root node, before passing it in to _b_d_e_c_o_d_e_(_).
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sswwiittcchh__uunnddeerrllyyiinngg__bbuuffffeerr(()) **********
│ │ │ │ │ -void sswwiittcchh__uunnddeerrllyyiinngg__bbuuffffeerr (char const* buf) noexcept;
│ │ │ │ │ -this buffer MMUUSSTT be identical to the one originally parsed. This operation is
│ │ │ │ │ -only defined on owning root nodes, i.e. the one passed in to decode().
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** hhaass__ssoofftt__eerrrroorr(()) **********
│ │ │ │ │ -bool hhaass__ssoofftt__eerrrroorr (span<char> error) const;
│ │ │ │ │ -returns true if there is a non-fatal error in the bencoding of this node or its
│ │ │ │ │ -children
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm ttyyppee__tt **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|none_t  |0    |uninitialized or default constructed. This is also used to|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_d_i_c_a_t_e_ _t_h_a_t_ _a_ _n_o_d_e_ _w_a_s_ _n_o_t_ _f_o_u_n_d_ _i_n_ _s_o_m_e_ _c_a_s_e_s_._ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_i_c_t___t_ _ _|_1_ _ _ _ _|_a_ _d_i_c_t_i_o_n_a_r_y_ _n_o_d_e_._ _T_h_e_ _d_i_c_t___f_i_n_d___ _f_u_n_c_t_i_o_n_s_ _a_r_e_ _v_a_l_i_d_._ _ _ _ |
│ │ │ │ │ -|_l_i_s_t___t_ _ _|_2_ _ _ _ _|_a_ _l_i_s_t_ _n_o_d_e_._ _T_h_e_ _l_i_s_t___ _f_u_n_c_t_i_o_n_s_ _a_r_e_ _v_a_l_i_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_t_r_i_n_g___t_|_3_ _ _ _ _|_a_ _s_t_r_i_n_g_ _n_o_d_e_,_ _t_h_e_ _s_t_r_i_n_g___ _f_u_n_c_t_i_o_n_s_ _a_r_e_ _v_a_l_i_d_._ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_i_n_t___t_ _ _ _|_4_ _ _ _ _|_a_n_ _i_n_t_e_g_e_r_ _n_o_d_e_._ _T_h_e_ _i_n_t___ _f_u_n_c_t_i_o_n_s_ _a_r_e_ _v_a_l_i_d_._ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ pprriinntt__eennttrryy(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ -std::string pprriinntt__eennttrryy (bdecode_node const& e
│ │ │ │ │ -   , bool single_line = false, int indent = 0);
│ │ │ │ │ -print the bencoded structure in a human-readable format to a string that's
│ │ │ │ │ -returned.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ bbddeeccooddee(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_d_e_c_o_d_e_._h_p_p"
│ │ │ │ │ -bdecode_node bbddeeccooddee (span<char const> buffer
│ │ │ │ │ -   , int depth_limit = 100, int token_limit = 2000000);
│ │ │ │ │ -int bbddeeccooddee (char const* start, char const* end, bdecode_node& ret
│ │ │ │ │ -   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ │ -   , int token_limit = 2000000);
│ │ │ │ │ -bdecode_node bbddeeccooddee (span<char const> buffer
│ │ │ │ │ -   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100
│ │ │ │ │ -   , int token_limit = 2000000);
│ │ │ │ │ -This function decodes/parses bdecoded data (for example a .torrent file). The
│ │ │ │ │ -data structure is returned in the ret argument. the buffer to parse is
│ │ │ │ │ -specified by the start of the buffer as well as the end, i.e. one byte past the
│ │ │ │ │ -end. If the buffer fails to parse, the function returns a non-zero value and
│ │ │ │ │ -fills in ec with the error code. The optional argument error_pos, if set to
│ │ │ │ │ -non-nullptr, will be set to the byte offset into the buffer where the parse
│ │ │ │ │ -failure occurred.
│ │ │ │ │ -depth_limit specifies the max number of nested lists or dictionaries are
│ │ │ │ │ -allowed in the data structure. (This affects the stack usage of the function,
│ │ │ │ │ -be careful not to set it too high).
│ │ │ │ │ -token_limit is the max number of tokens allowed to be parsed from the buffer.
│ │ │ │ │ -This is simply a sanity check to not have unbounded memory usage.
│ │ │ │ │ -The resulting bdecode_node is an oowwnniinngg node. That means it will be holding the
│ │ │ │ │ -whole parsed tree. When iterating lists and dictionaries, those bdecode_node
│ │ │ │ │ -objects will simply have references to the root or owning bdecode_node. If the
│ │ │ │ │ -root node is destructed, all other nodes that refer to anything in that tree
│ │ │ │ │ -become invalid.
│ │ │ │ │ -However, the underlying buffer passed in to this function (start, end) must
│ │ │ │ │ -also remain valid while the bdecoded tree is used. The parsed tree produced by
│ │ │ │ │ -this function does not copy any data out of the buffer, but simply produces
│ │ │ │ │ -references back into it.
│ │ │ │ │ -Bencoding is a common representation in bittorrent used for dictionary, list,
│ │ │ │ │ -_i_n_t and string hierarchies. It's used to encode .torrent files and some
│ │ │ │ │ -messages in the network protocol. libtorrent also uses it to store settings,
│ │ │ │ │ -resume data and other _s_e_s_s_i_o_n state.
│ │ │ │ │ -Strings in bencoded structures do not necessarily represent text. Strings are
│ │ │ │ │ -raw byte buffers of a certain length. If a string is meant to be interpreted as
│ │ │ │ │ -text, it is required to be UTF-8 encoded. See _B_E_P_ _3.
│ │ │ │ │ -The function for decoding bencoded data _b_d_e_c_o_d_e_(_), returning a _b_d_e_c_o_d_e___n_o_d_e.
│ │ │ │ │ -This function builds a tree that points back into the original buffer. The
│ │ │ │ │ -returned _b_d_e_c_o_d_e___n_o_d_e will not be valid once the buffer it was parsed out of is
│ │ │ │ │ -discarded.
│ │ │ │ │ -It's possible to construct an _e_n_t_r_y from a _b_d_e_c_o_d_e___n_o_d_e, if a structure needs
│ │ │ │ │ -to be altered and re-encoded.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ eennttrryy ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_n_t_r_y_._h_p_p"
│ │ │ │ │ -The entry class represents one node in a bencoded hierarchy. It works as a
│ │ │ │ │ -variant type, it can be either a list, a dictionary (std::map), an integer or a
│ │ │ │ │ -string.
│ │ │ │ │ -class entry
│ │ │ │ │ -{
│ │ │ │ │ -   data_type ttyyppee () const;
│ │ │ │ │ -   eennttrryy (dictionary_type);
│ │ │ │ │ -   eennttrryy (span<char const>);
│ │ │ │ │ -   eennttrryy (integer_type);
│ │ │ │ │ -   eennttrryy (preformatted_type);
│ │ │ │ │ -   eennttrryy (list_type);
│ │ │ │ │ -   eennttrryy (U v);
│ │ │ │ │ -   eennttrryy (data_type t);
│ │ │ │ │ -   eennttrryy (bdecode_node const& n);
│ │ │ │ │ -   entry& ooppeerraattoorr== (dictionary_type) &;
│ │ │ │ │ -   entry& ooppeerraattoorr== (list_type) &;
│ │ │ │ │ -   entry& ooppeerraattoorr== (entry&&) & noexcept;
│ │ │ │ │ -   entry& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │ -   entry& ooppeerraattoorr== (entry const&) &;
│ │ │ │ │ -   entry& ooppeerraattoorr== (preformatted_type) &;
│ │ │ │ │ -   entry& ooppeerraattoorr== (integer_type) &;
│ │ │ │ │ -   entry& ooppeerraattoorr== (span<char const>) &;
│ │ │ │ │ -   entry& ooppeerraattoorr== (U v) &;
│ │ │ │ │ -   dictionary_type& ddiicctt ();
│ │ │ │ │ -   preformatted_type& pprreeffoorrmmaatttteedd ();
│ │ │ │ │ -   preformatted_type const& pprreeffoorrmmaatttteedd () const;
│ │ │ │ │ -   dictionary_type const& ddiicctt () const;
│ │ │ │ │ -   integer_type& iinntteeggeerr ();
│ │ │ │ │ -   string_type const& ssttrriinngg () const;
│ │ │ │ │ -   string_type& ssttrriinngg ();
│ │ │ │ │ -   list_type& lliisstt ();
│ │ │ │ │ -   list_type const& lliisstt () const;
│ │ │ │ │ -   integer_type const& iinntteeggeerr () const;
│ │ │ │ │ -   void sswwaapp (entry& e);
│ │ │ │ │ -   entry const& ooppeerraattoorr[[]] (string_view key) const;
│ │ │ │ │ -   entry& ooppeerraattoorr[[]] (string_view key);
│ │ │ │ │ -   entry* ffiinndd__kkeeyy (string_view key);
│ │ │ │ │ -   entry const* ffiinndd__kkeeyy (string_view key) const;
│ │ │ │ │ -   std::string ttoo__ssttrriinngg (bool single_line = false) const;
│ │ │ │ │ -
│ │ │ │ │ -   enum data_type
│ │ │ │ │ -   {
│ │ │ │ │ -      int_t,
│ │ │ │ │ -      string_t,
│ │ │ │ │ -      list_t,
│ │ │ │ │ -      dictionary_t,
│ │ │ │ │ -      undefined_t,
│ │ │ │ │ -      preformatted_t,
│ │ │ │ │ -   };
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttyyppee(()) **********
│ │ │ │ │ -data_type ttyyppee () const;
│ │ │ │ │ -returns the concrete type of the _e_n_t_r_y
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennttrryy(()) **********
│ │ │ │ │ -eennttrryy (dictionary_type);
│ │ │ │ │ -eennttrryy (span<char const>);
│ │ │ │ │ -eennttrryy (integer_type);
│ │ │ │ │ -eennttrryy (preformatted_type);
│ │ │ │ │ -eennttrryy (list_type);
│ │ │ │ │ -constructors directly from a specific type. The content of the argument is
│ │ │ │ │ -copied into the newly constructed _e_n_t_r_y
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennttrryy(()) **********
│ │ │ │ │ -eennttrryy (data_type t);
│ │ │ │ │ -construct an empty _e_n_t_r_y of the specified type. see _d_a_t_a___t_y_p_e enum.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennttrryy(()) **********
│ │ │ │ │ -eennttrryy (bdecode_node const& n);
│ │ │ │ │ -construct from _b_d_e_c_o_d_e___n_o_d_e parsed form (see _b_d_e_c_o_d_e_(_))
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr==(()) **********
│ │ │ │ │ -entry& ooppeerraattoorr== (dictionary_type) &;
│ │ │ │ │ -entry& ooppeerraattoorr== (list_type) &;
│ │ │ │ │ -entry& ooppeerraattoorr== (entry&&) & noexcept;
│ │ │ │ │ -entry& ooppeerraattoorr== (bdecode_node const&) &;
│ │ │ │ │ -entry& ooppeerraattoorr== (entry const&) &;
│ │ │ │ │ -entry& ooppeerraattoorr== (preformatted_type) &;
│ │ │ │ │ -entry& ooppeerraattoorr== (integer_type) &;
│ │ │ │ │ -entry& ooppeerraattoorr== (span<char const>) &;
│ │ │ │ │ -copies the structure of the right hand side into this _e_n_t_r_y.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** pprreeffoorrmmaatttteedd(()) ddiicctt(()) lliisstt(()) ssttrriinngg(()) iinntteeggeerr(()) **********
│ │ │ │ │ -dictionary_type& ddiicctt ();
│ │ │ │ │ -preformatted_type& pprreeffoorrmmaatttteedd ();
│ │ │ │ │ -preformatted_type const& pprreeffoorrmmaatttteedd () const;
│ │ │ │ │ -dictionary_type const& ddiicctt () const;
│ │ │ │ │ -integer_type& iinntteeggeerr ();
│ │ │ │ │ -string_type const& ssttrriinngg () const;
│ │ │ │ │ -string_type& ssttrriinngg ();
│ │ │ │ │ -list_type& lliisstt ();
│ │ │ │ │ -list_type const& lliisstt () const;
│ │ │ │ │ -integer_type const& iinntteeggeerr () const;
│ │ │ │ │ -The integer(), string(), list() and dict() functions are accessors that return
│ │ │ │ │ -the respective type. If the entry object isn't of the type you request, the
│ │ │ │ │ -accessor will throw system_error. You can ask an entry for its type through the
│ │ │ │ │ -type() function.
│ │ │ │ │ -If you want to create an entry you give it the type you want it to have in its
│ │ │ │ │ -constructor, and then use one of the non-const accessors to get a reference
│ │ │ │ │ -which you then can assign the value you want it to have.
│ │ │ │ │ -The typical code to get info from a torrent file will then look like this:
│ │ │ │ │ -entry torrent_file;
│ │ │ │ │ -// ...
│ │ │ │ │ -
│ │ │ │ │ -// throws if this is not a dictionary
│ │ │ │ │ -entry::dictionary_type const& dict = torrent_file.dict();
│ │ │ │ │ -entry::dictionary_type::const_iterator i;
│ │ │ │ │ -i = dict.find("announce");
│ │ │ │ │ -if (i != dict.end())
│ │ │ │ │ -{
│ │ │ │ │ -        std::string tracker_url = i->second.string();
│ │ │ │ │ -        std::cout << tracker_url << "\n";
│ │ │ │ │ -}
│ │ │ │ │ -The following code is equivalent, but a little bit shorter:
│ │ │ │ │ -entry torrent_file;
│ │ │ │ │ -// ...
│ │ │ │ │ -
│ │ │ │ │ -// throws if this is not a dictionary
│ │ │ │ │ -if (entry* i = torrent_file.find_key("announce"))
│ │ │ │ │ -{
│ │ │ │ │ -        std::string tracker_url = i->string();
│ │ │ │ │ -        std::cout << tracker_url << "\n";
│ │ │ │ │ -}
│ │ │ │ │ -To make it easier to extract information from a torrent file, the class
│ │ │ │ │ -_t_o_r_r_e_n_t___i_n_f_o exists.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sswwaapp(()) **********
│ │ │ │ │ -void sswwaapp (entry& e);
│ │ │ │ │ -swaps the content of tthhiiss with e.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ooppeerraattoorr[[]](()) **********
│ │ │ │ │ -entry const& ooppeerraattoorr[[]] (string_view key) const;
│ │ │ │ │ -entry& ooppeerraattoorr[[]] (string_view key);
│ │ │ │ │ -All of these functions requires the _e_n_t_r_y to be a dictionary, if it isn't they
│ │ │ │ │ -will throw system_error.
│ │ │ │ │ -The non-const versions of the operator[] will return a reference to either the
│ │ │ │ │ -existing element at the given key or, if there is no element with the given
│ │ │ │ │ -key, a reference to a newly inserted element at that key.
│ │ │ │ │ -The const version of operator[] will only return a reference to an existing
│ │ │ │ │ -element at the given key. If the key is not found, it will throw system_error.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiinndd__kkeeyy(()) **********
│ │ │ │ │ -entry* ffiinndd__kkeeyy (string_view key);
│ │ │ │ │ -entry const* ffiinndd__kkeeyy (string_view key) const;
│ │ │ │ │ -These functions requires the _e_n_t_r_y to be a dictionary, if it isn't they will
│ │ │ │ │ -throw system_error.
│ │ │ │ │ -They will look for an element at the given key in the dictionary, if the
│ │ │ │ │ -element cannot be found, they will return nullptr. If an element with the given
│ │ │ │ │ -key is found, the return a pointer to it.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttoo__ssttrriinngg(()) **********
│ │ │ │ │ -std::string ttoo__ssttrriinngg (bool single_line = false) const;
│ │ │ │ │ -returns a pretty-printed string representation of the bencoded structure, with
│ │ │ │ │ -JSON-style syntax
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** eennuumm ddaattaa__ttyyppee **********
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_n_t_r_y_._h_p_p"
│ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
│ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn|
│ │ │ │ │ -|_i_n_t___t_ _ _ _ _ _ _ _ _ _|_0_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_s_t_r_i_n_g___t_ _ _ _ _ _ _|_1_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_l_i_s_t___t_ _ _ _ _ _ _ _ _|_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_d_i_c_t_i_o_n_a_r_y___t_ _ _|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_u_n_d_e_f_i_n_e_d___t_ _ _ _|_4_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_p_r_e_f_o_r_m_a_t_t_e_d___t_|_5_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ bbeennccooddee(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_e_n_c_o_d_e_._h_p_p"
│ │ │ │ │ -template<class OutIt> int bbeennccooddee (OutIt out, const entry& e);
│ │ │ │ │ -This function will encode data to bencoded form.
│ │ │ │ │ -The _e_n_t_r_y class is the internal representation of the bencoded data and it can
│ │ │ │ │ -be used to retrieve information, an _e_n_t_r_y can also be build by the program and
│ │ │ │ │ -given to bencode() to encode it into the OutIt iterator.
│ │ │ │ │ -OutIt is an _O_u_t_p_u_t_I_t_e_r_a_t_o_r. It's a template and usually instantiated as
│ │ │ │ │ -_o_s_t_r_e_a_m___i_t_e_r_a_t_o_r or _b_a_c_k___i_n_s_e_r_t___i_t_e_r_a_t_o_r. This function assumes the value_type
│ │ │ │ │ -of the iterator is a char. In order to encode _e_n_t_r_y e into a buffer, do:
│ │ │ │ │ -std::vector<char> buf;
│ │ │ │ │ -bencode(std::back_inserter(buf), e);
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ooppeerraattoorr<<<<(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_n_t_r_y_._h_p_p"
│ │ │ │ │ -inline std::ostream& ooppeerraattoorr<<<< (std::ostream& os, const entry& e);
│ │ │ │ │ -prints the bencoded structure to the ostream as a JSON-style structure.
│ │ │ │ │ -This section describes the functions and classes that are used to create
│ │ │ │ │ -torrent files. It is a layered API with low level classes and higher level
│ │ │ │ │ -convenience functions. A torrent is created in 4 steps:
│ │ │ │ │ -   1. first the files that will be part of the torrent are determined.
│ │ │ │ │ -   2. the torrent properties are set, such as tracker url, web seeds, DHT nodes
│ │ │ │ │ -      etc.
│ │ │ │ │ -   3. Read through all the files in the torrent, SHA-1 all the data and set the
│ │ │ │ │ -      piece hashes.
│ │ │ │ │ -   4. The torrent is bencoded into a file or buffer.
│ │ │ │ │ -If there are a lot of files and or deep directory hierarchies to traverse, step
│ │ │ │ │ -one can be time consuming.
│ │ │ │ │ -Typically step 3 is by far the most time consuming step, since it requires to
│ │ │ │ │ -read all the bytes from all the files in the torrent.
│ │ │ │ │ -All of these classes and functions are declared by including libtorrent/
│ │ │ │ │ -create_torrent.hpp.
│ │ │ │ │ -example:
│ │ │ │ │ -file_storage fs;
│ │ │ │ │ -
│ │ │ │ │ -// recursively adds files in directories
│ │ │ │ │ -add_files(fs, "./my_torrent");
│ │ │ │ │ -
│ │ │ │ │ -create_torrent t(fs);
│ │ │ │ │ -t.add_tracker("http://my.tracker.com/announce");
│ │ │ │ │ -t.set_creator("libtorrent example");
│ │ │ │ │ -
│ │ │ │ │ -// reads the files and calculates the hashes
│ │ │ │ │ -set_piece_hashes(t, ".");
│ │ │ │ │ -
│ │ │ │ │ -ofstream out("my_torrent.torrent", std::ios_base::binary);
│ │ │ │ │ -std::vector<char> buf = t.generate_buf();
│ │ │ │ │ -out.write(buf.data(), buf.size());
│ │ │ │ │ -
│ │ │ │ │ -// alternatively, generate an entry and encode it directly to an ostream
│ │ │ │ │ -// iterator
│ │ │ │ │ -bencode(std::ostream_iterator<char>(out), t.generate());
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ccrreeaattee__ttoorrrreenntt ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_r_e_a_t_e___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │ -This class holds state for creating a torrent. After having added all
│ │ │ │ │ -information to it, call _c_r_e_a_t_e___t_o_r_r_e_n_t_:_:_g_e_n_e_r_a_t_e_(_) to generate the torrent. The
│ │ │ │ │ -_e_n_t_r_y that's returned can then be bencoded into a .torrent file using _b_e_n_c_o_d_e
│ │ │ │ │ -_(_).
│ │ │ │ │ -struct create_torrent
│ │ │ │ │ -{
│ │ │ │ │ -   explicit ccrreeaattee__ttoorrrreenntt (file_storage& fs, int piece_size = 0
│ │ │ │ │ -      , create_flags_t flags = {});
│ │ │ │ │ -   explicit ccrreeaattee__ttoorrrreenntt (torrent_info const& ti);
│ │ │ │ │ -   entry ggeenneerraattee () const;
│ │ │ │ │ -   std::vector<char> ggeenneerraattee__bbuuff () const;
│ │ │ │ │ -   file_storage const& ffiilleess () const;
│ │ │ │ │ -   void sseett__ccoommmmeenntt (char const* str);
│ │ │ │ │ -   void sseett__ccrreeaattoorr (char const* str);
│ │ │ │ │ -   void sseett__ccrreeaattiioonn__ddaattee (std::time_t timestamp);
│ │ │ │ │ -   void sseett__hhaasshh (piece_index_t index, sha1_hash const& h);
│ │ │ │ │ -   void sseett__hhaasshh22 (file_index_t file, piece_index_t::diff_type piece,
│ │ │ │ │ -sha256_hash const& h);
│ │ │ │ │ -   void aadddd__uurrll__sseeeedd (string_view url);
│ │ │ │ │ -   void aadddd__hhttttpp__sseeeedd (string_view url);
│ │ │ │ │ -   void aadddd__nnooddee (std::pair<std::string, int> node);
│ │ │ │ │ -   void aadddd__ttrraacckkeerr (string_view url, int tier = 0);
│ │ │ │ │ -   void sseett__rroooott__cceerrtt (string_view cert);
│ │ │ │ │ -   void sseett__pprriivv (bool p);
│ │ │ │ │ -   bool pprriivv () const;
│ │ │ │ │ -   bool iiss__vv11__oonnllyy () const;
│ │ │ │ │ -   bool iiss__vv22__oonnllyy () const;
│ │ │ │ │ -   int nnuumm__ppiieecceess () const;
│ │ │ │ │ -   piece_index_t eenndd__ppiieeccee () const;
│ │ │ │ │ -   index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │ -   file_index_t eenndd__ffiillee () const;
│ │ │ │ │ -   index_range<file_index_t> ffiillee__rraannggee () const noexcept;
│ │ │ │ │ -   index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t f);
│ │ │ │ │ -   std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ -   int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ -   int ppiieeccee__ssiizzee (piece_index_t i) const;
│ │ │ │ │ -   void aadddd__ssiimmiillaarr__ttoorrrreenntt (sha1_hash ih);
│ │ │ │ │ -   void aadddd__ccoolllleeccttiioonn (string_view c);
│ │ │ │ │  
│ │ │ │ │ -   static constexpr create_flags_t mmooddiiffiiccaattiioonn__ttiimmee  = 2_bit;
│ │ │ │ │ -   static constexpr create_flags_t ssyymmlliinnkkss  = 3_bit;
│ │ │ │ │ -   static constexpr create_flags_t vv22__oonnllyy  = 5_bit;
│ │ │ │ │ -   static constexpr create_flags_t vv11__oonnllyy  = 6_bit;
│ │ │ │ │ -   static constexpr create_flags_t ccaannoonniiccaall__ffiilleess  = 7_bit;
│ │ │ │ │ -   static constexpr create_flags_t nnoo__aattttrriibbuutteess  = 8_bit;
│ │ │ │ │ -   static constexpr create_flags_t ccaannoonniiccaall__ffiilleess__nnoo__ttaaiill__ppaaddddiinngg  = 9_bit;
│ │ │ │ │ +   node_ids_t nids;
│ │ │ │ │ +   std::vector<udp::endpoint> nodes;
│ │ │ │ │ +   std::vector<udp::endpoint> nodes6;
│ │ │ │ │  };
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ccrreeaattee__ttoorrrreenntt(()) **********
│ │ │ │ │ -explicit ccrreeaattee__ttoorrrreenntt (file_storage& fs, int piece_size = 0
│ │ │ │ │ -      , create_flags_t flags = {});
│ │ │ │ │ -explicit ccrreeaattee__ttoorrrreenntt (torrent_info const& ti);
│ │ │ │ │ -The piece_size is the size of each piece in bytes. It must be a power of 2 and
│ │ │ │ │ -a minimum of 16 kiB. If a piece size of 0 is specified, a piece_size will be
│ │ │ │ │ -set automatically. Piece sizes greater than 128 MiB are considered unreasonable
│ │ │ │ │ -and will be rejected (with an lt::system_error exception).
│ │ │ │ │ -The flags arguments specifies options for the torrent creation. It can be any
│ │ │ │ │ -combination of the flags defined by create_flags_t.
│ │ │ │ │ -The _f_i_l_e___s_t_o_r_a_g_e (fs) parameter defines the files, sizes and their properties
│ │ │ │ │ -for the torrent to be created. Set this up first, before passing it to the
│ │ │ │ │ -_c_r_e_a_t_e___t_o_r_r_e_n_t constructor.
│ │ │ │ │ -The overload that takes a torrent_info object will make a verbatim copy of its
│ │ │ │ │ -info dictionary (to preserve the info-hash). The copy of the info dictionary
│ │ │ │ │ -will be used by _c_r_e_a_t_e___t_o_r_r_e_n_t_:_:_g_e_n_e_r_a_t_e_(_). This means that none of the member
│ │ │ │ │ -functions of _c_r_e_a_t_e___t_o_r_r_e_n_t that affects the content of the info dictionary
│ │ │ │ │ -(such as _s_e_t___h_a_s_h_(_)), will have any affect. Instead of using this overload,
│ │ │ │ │ -consider using _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_) instead.
│ │ │ │ │ -Warning
│ │ │ │ │ -The _f_i_l_e___s_t_o_r_a_g_e and _t_o_r_r_e_n_t___i_n_f_o objects must stay alive for the entire
│ │ │ │ │ -duration of the _c_r_e_a_t_e___t_o_r_r_e_n_t object.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ggeenneerraattee(()) ggeenneerraattee__bbuuff(()) **********
│ │ │ │ │ -entry ggeenneerraattee () const;
│ │ │ │ │ -std::vector<char> ggeenneerraattee__bbuuff () const;
│ │ │ │ │ -This function will generate the .torrent file as a bencode tree, or a bencoded
│ │ │ │ │ -into a buffer. In order to encode the _e_n_t_r_y into a flat file, use the _b_e_n_c_o_d_e_(_)
│ │ │ │ │ -function.
│ │ │ │ │ -The function returning an _e_n_t_r_y may be useful to add custom entries to the
│ │ │ │ │ -torrent file before bencoding it and saving it to disk.
│ │ │ │ │ -Whether the resulting torrent object is v1, v2 or hybrid depends on whether any
│ │ │ │ │ -of the v1_only or v2_only flags were set on the constructor. If neither were
│ │ │ │ │ -set, the resulting torrent depends on which hashes were set. If both v1 and v2
│ │ │ │ │ -hashes were set, a hybrid torrent is created.
│ │ │ │ │ -Any failure will cause this function to throw system_error, with an appropriate
│ │ │ │ │ -error message. These are the reasons this call may throw:
│ │ │ │ │ -    * the file storage has 0 files
│ │ │ │ │ -    * the total size of the file storage is 0 bytes (i.e. it only has empty
│ │ │ │ │ -      files)
│ │ │ │ │ -    * not all v1 hashes (_s_e_t___h_a_s_h_(_)) and not all v2 hashes (_s_e_t___h_a_s_h_2_(_)) were
│ │ │ │ │ -      set
│ │ │ │ │ -    * for v2 torrents, you may not have a directory with the same name as a
│ │ │ │ │ -      file. If that's encountered in the file storage, _g_e_n_e_r_a_t_e_(_) fails.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiilleess(()) **********
│ │ │ │ │ -file_storage const& ffiilleess () const;
│ │ │ │ │ -returns an immutable reference to the _f_i_l_e___s_t_o_r_a_g_e used to create the torrent
│ │ │ │ │ -from.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__ccoommmmeenntt(()) **********
│ │ │ │ │ -void sseett__ccoommmmeenntt (char const* str);
│ │ │ │ │ -Sets the comment for the torrent. The string str should be utf-8 encoded. The
│ │ │ │ │ -comment in a torrent file is optional.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__ccrreeaattoorr(()) **********
│ │ │ │ │ -void sseett__ccrreeaattoorr (char const* str);
│ │ │ │ │ -Sets the creator of the torrent. The string str should be utf-8 encoded. This
│ │ │ │ │ -is optional.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__ccrreeaattiioonn__ddaattee(()) **********
│ │ │ │ │ -void sseett__ccrreeaattiioonn__ddaattee (std::time_t timestamp);
│ │ │ │ │ -sets the "creation time" field. Defaults to the system clock at the time of
│ │ │ │ │ -construction of the _c_r_e_a_t_e___t_o_r_r_e_n_t object. The timestamp is specified in
│ │ │ │ │ -seconds, posix time. If the creation date is set to 0, the "creation date"
│ │ │ │ │ -field will be omitted from the generated torrent.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__hhaasshh(()) **********
│ │ │ │ │ -void sseett__hhaasshh (piece_index_t index, sha1_hash const& h);
│ │ │ │ │ -This sets the SHA-1 hash for the specified piece (index). You are required to
│ │ │ │ │ -set the hash for every piece in the torrent before generating it. If you have
│ │ │ │ │ -the files on disk, you can use the high level convenience function to do this.
│ │ │ │ │ -See _s_e_t___p_i_e_c_e___h_a_s_h_e_s_(_). A SHA-1 hash of all zeros is internally used to
│ │ │ │ │ -indicate a hash that has not been set. Setting such hash will not be considered
│ │ │ │ │ -set when calling _g_e_n_e_r_a_t_e_(_). This function will throw std::system_error if it
│ │ │ │ │ -is called on an object constructed with the v2_only flag.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__hhaasshh22(()) **********
│ │ │ │ │ -void sseett__hhaasshh22 (file_index_t file, piece_index_t::diff_type piece, sha256_hash
│ │ │ │ │ -const& h);
│ │ │ │ │ -sets the bittorrent v2 hash for filefileof the piecepiece.pieceis relative to
│ │ │ │ │ -the first piece of the file, starting at 0. The first piece in the file can be
│ │ │ │ │ -computed with _f_i_l_e___s_t_o_r_a_g_e_:_:_f_i_l_e___i_n_d_e_x___a_t___p_i_e_c_e_(_). The hash,h, is the root of
│ │ │ │ │ -the merkle tree formed by the piece's 16 kiB blocks. Note that piece sizes must
│ │ │ │ │ -be powers-of-2, so all per-piece merkle trees are complete. A SHA-256 hash of
│ │ │ │ │ -all zeros is internally used to indicate a hash that has not been set. Setting
│ │ │ │ │ -such hash will not be considered set when calling _g_e_n_e_r_a_t_e_(_). This function
│ │ │ │ │ -will throw std::system_error if it is called on an object constructed with the
│ │ │ │ │ -v1_only flag.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__hhttttpp__sseeeedd(()) aadddd__uurrll__sseeeedd(()) **********
│ │ │ │ │ -void aadddd__uurrll__sseeeedd (string_view url);
│ │ │ │ │ -void aadddd__hhttttpp__sseeeedd (string_view url);
│ │ │ │ │ -This adds a url seed to the torrent. You can have any number of url seeds. For
│ │ │ │ │ -a single file torrent, this should be an HTTP url, pointing to a file with
│ │ │ │ │ -identical content as the file of the torrent. For a multi-file torrent, it
│ │ │ │ │ -should point to a directory containing a directory with the same name as this
│ │ │ │ │ -torrent, and all the files of the torrent in it.
│ │ │ │ │ -The second function, add_http_seed() adds an HTTP seed instead.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__nnooddee(()) **********
│ │ │ │ │ -void aadddd__nnooddee (std::pair<std::string, int> node);
│ │ │ │ │ -This adds a DHT node to the torrent. This especially useful if you're creating
│ │ │ │ │ -a tracker less torrent. It can be used by clients to bootstrap their DHT node
│ │ │ │ │ -from. The node is a hostname and a port number where there is a DHT node
│ │ │ │ │ -running. You can have any number of DHT nodes in a torrent.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__ttrraacckkeerr(()) **********
│ │ │ │ │ -void aadddd__ttrraacckkeerr (string_view url, int tier = 0);
│ │ │ │ │ -Adds a tracker to the torrent. This is not strictly required, but most torrents
│ │ │ │ │ -use a tracker as their main source of peers. The url should be an _h_t_t_p_:_/_/ or
│ │ │ │ │ -udp:// url to a machine running a bittorrent tracker that accepts announces for
│ │ │ │ │ -this torrent's info-hash. The tier is the fallback priority of the tracker. All
│ │ │ │ │ -trackers with tier 0 are tried first (in any order). If all fail, trackers with
│ │ │ │ │ -tier 1 are tried. If all of those fail, trackers with tier 2 are tried, and so
│ │ │ │ │ -on.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__rroooott__cceerrtt(()) **********
│ │ │ │ │ -void sseett__rroooott__cceerrtt (string_view cert);
│ │ │ │ │ -This function sets an X.509 certificate in PEM format to the torrent. This
│ │ │ │ │ -makes the torrent an SSSSLL ttoorrrreenntt. An SSL torrent requires that each peer has a
│ │ │ │ │ -valid certificate signed by this root certificate. For SSL torrents, all peers
│ │ │ │ │ -are connecting over SSL connections. For more information, see the section on
│ │ │ │ │ -_s_s_l_ _t_o_r_r_e_n_t_s.
│ │ │ │ │ -The string is not the path to the cert, it's the actual content of the
│ │ │ │ │ -certificate.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** sseett__pprriivv(()) pprriivv(()) **********
│ │ │ │ │ -void sseett__pprriivv (bool p);
│ │ │ │ │ -bool pprriivv () const;
│ │ │ │ │ -Sets and queries the private flag of the torrent. Torrents with the private
│ │ │ │ │ -flag set ask the client to not use any other sources than the tracker for
│ │ │ │ │ -peers, and to not use DHT to advertise itself publicly, only the tracker.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** nnuumm__ppiieecceess(()) **********
│ │ │ │ │ -int nnuumm__ppiieecceess () const;
│ │ │ │ │ -returns the number of pieces in the associated _f_i_l_e___s_t_o_r_a_g_e object.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__rraannggee(()) **********
│ │ │ │ │ -index_range<piece_index_t> ppiieeccee__rraannggee () const noexcept;
│ │ │ │ │ -all piece indices in the torrent to be created
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__rraannggee(()) **********
│ │ │ │ │ -index_range<file_index_t> ffiillee__rraannggee () const noexcept;
│ │ │ │ │ -all file indices in the torrent to be created
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ffiillee__ppiieeccee__rraannggee(()) **********
│ │ │ │ │ -index_range<piece_index_t::diff_type> ffiillee__ppiieeccee__rraannggee (file_index_t f);
│ │ │ │ │ -for v2 and hybrid torrents only, the pieces in the specified file, specified as
│ │ │ │ │ -delta from the first piece in the file. i.e. the first index is 0.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ttoottaall__ssiizzee(()) **********
│ │ │ │ │ -std::int64_t ttoottaall__ssiizzee () const;
│ │ │ │ │ -the total number of bytes of all files and pad files
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** ppiieeccee__lleennggtthh(()) ppiieeccee__ssiizzee(()) **********
│ │ │ │ │ -int ppiieeccee__lleennggtthh () const;
│ │ │ │ │ -int ppiieeccee__ssiizzee (piece_index_t i) const;
│ │ │ │ │ -piece_length() returns the piece size of all pieces but the last one.
│ │ │ │ │ -piece_size() returns the size of the specified piece. these functions are just
│ │ │ │ │ -forwarding to the associated _f_i_l_e___s_t_o_r_a_g_e.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -********** aadddd__ssiimmiillaarr__ttoorrrreenntt(()) aadddd__ccoolllleeccttiioonn(()) **********
│ │ │ │ │ -void aadddd__ssiimmiillaarr__ttoorrrreenntt (sha1_hash ih);
│ │ │ │ │ -void aadddd__ccoolllleeccttiioonn (string_view c);
│ │ │ │ │ -Add similar torrents (by info-hash) or collections of similar torrents. Similar
│ │ │ │ │ -torrents are expected to share some files with this torrent. Torrents sharing a
│ │ │ │ │ -collection name with this torrent are also expected to share files with this
│ │ │ │ │ -torrent. A torrent may have more than one collection and more than one similar
│ │ │ │ │ -torrents. For more information, see _B_E_P_ _3_8.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  modification_time
│ │ │ │ │ -      This will include the file modification time as part of the torrent. This
│ │ │ │ │ -      is not enabled by default, as it might cause problems when you create a
│ │ │ │ │ -      torrent from separate files with the same content, hoping to yield the
│ │ │ │ │ -      same info-hash. If the files have different modification times, with this
│ │ │ │ │ -      option enabled, you would get different info-hashes for the files.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  symlinks
│ │ │ │ │ -      If this flag is set, files that are symlinks get a symlink attribute set
│ │ │ │ │ -      on them and their data will not be included in the torrent. This is
│ │ │ │ │ -      useful if you need to reconstruct a file hierarchy which contains
│ │ │ │ │ -      symlinks.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  v2_only
│ │ │ │ │ -      Do not generate v1 metadata. The resulting torrent will only be usable by
│ │ │ │ │ -      clients which support v2. This requires setting all v2 hashes, with
│ │ │ │ │ -      _s_e_t___h_a_s_h_2_(_) before calling _g_e_n_e_r_a_t_e_(_). Setting v1 hashes (with _s_e_t___h_a_s_h
│ │ │ │ │ -      _(_)) is an error with this flag set.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  v1_only
│ │ │ │ │ -      do not generate v2 metadata or enforce v2 alignment and padding rules
│ │ │ │ │ -      this is mainly for tests, not recommended for production use. This
│ │ │ │ │ -      requires setting all v1 hashes, with _s_e_t___h_a_s_h_(_), before calling _g_e_n_e_r_a_t_e
│ │ │ │ │ -      _(_). Setting v2 hashes (with _s_e_t___h_a_s_h_2_(_)) is an error with this flag set.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  canonical_files
│ │ │ │ │ -      This flag only affects v1-only torrents, and is only relevant together
│ │ │ │ │ -      with the v1_only_flag. This flag will force the same file order and
│ │ │ │ │ -      padding as a v2 (or hybrid) torrent would have. It has the effect of
│ │ │ │ │ -      ordering files and inserting pad files to align them with piece
│ │ │ │ │ -      boundaries.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  no_attributes
│ │ │ │ │ -      passing this flag to _a_d_d___f_i_l_e_s_(_) will ignore file attributes (such as
│ │ │ │ │ -      executable or hidden) when adding the files to the file storage. Since
│ │ │ │ │ -      not all filesystems and operating systems support all file attributes the
│ │ │ │ │ -      resulting torrent may differ depending on where it's created. If it's
│ │ │ │ │ -      important for torrents to be created consistently across systems, this
│ │ │ │ │ -      flag should be set.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  canonical_files_no_tail_padding
│ │ │ │ │ -      this flag enforces the file layout to be canonical according to the
│ │ │ │ │ -      bittorrent v2 specification (just like the canonical_files flag) with the
│ │ │ │ │ -      one exception that tail padding is not added to the last file. This
│ │ │ │ │ -      behavior deviates from the specification but was the way libtorrent
│ │ │ │ │ -      created torrents in version up to and including 2.0.7. This flag is here
│ │ │ │ │ -      for backwards compatibility.
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ aadddd__ffiilleess(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_r_e_a_t_e___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │ -void aadddd__ffiilleess (file_storage& fs, std::string const& file
│ │ │ │ │ -   , std::function<bool(std::string)> p, create_flags_t flags = {});
│ │ │ │ │ -void aadddd__ffiilleess (file_storage& fs, std::string const& file
│ │ │ │ │ -   , create_flags_t flags = {});
│ │ │ │ │ -Adds the file specified by path to the _f_i_l_e___s_t_o_r_a_g_e object. In case path refers
│ │ │ │ │ -to a directory, files will be added recursively from the directory.
│ │ │ │ │ -If specified, the predicate p is called once for every file and directory that
│ │ │ │ │ -is encountered. Files for which p returns true are added, and directories for
│ │ │ │ │ -which p returns true are traversed. p must have the following signature:
│ │ │ │ │ -bool Pred(std::string const& p);
│ │ │ │ │ -The path that is passed in to the predicate is the full path of the file or
│ │ │ │ │ -directory. If no predicate is specified, all files are added, and all
│ │ │ │ │ -directories are traversed.
│ │ │ │ │ -The ".." directory is never traversed.
│ │ │ │ │ -The flags argument should be the same as the flags passed to the _c_r_e_a_t_e___t_o_r_r_e_n_t
│ │ │ │ │ -constructor.
│ │ │ │ │ +  nodes
│ │ │ │ │ +      the bootstrap nodes saved from the buckets node
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ sseett__ppiieeccee__hhaasshheess(()) ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_c_r_e_a_t_e___t_o_r_r_e_n_t_._h_p_p"
│ │ │ │ │ -inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p,
│ │ │ │ │ -error_code& ec);
│ │ │ │ │ -inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ -   , settings_interface const& settings
│ │ │ │ │ -   , std::function<void(piece_index_t)> const& f);
│ │ │ │ │ -void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ -   , settings_interface const& settings, disk_io_constructor_type disk_io
│ │ │ │ │ -   , std::function<void(piece_index_t)> const& f, error_code& ec);
│ │ │ │ │ -inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ -   , std::function<void(piece_index_t)> const& f);
│ │ │ │ │ -void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ -   , settings_interface const& settings
│ │ │ │ │ -   , std::function<void(piece_index_t)> const& f, error_code& ec);
│ │ │ │ │ -inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p);
│ │ │ │ │ -void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
│ │ │ │ │ -   , std::function<void(piece_index_t)> const& f, error_code& ec);
│ │ │ │ │ -This function will assume that the files added to the torrent file exists at
│ │ │ │ │ -path p, read those files and hash the content and set the hashes in the
│ │ │ │ │ -create_torrent object. The optional function f is called in between every hash
│ │ │ │ │ -that is set. f must have the following signature:
│ │ │ │ │ -void Fun(piece_index_t);
│ │ │ │ │ -The overloads taking a _s_e_t_t_i_n_g_s___p_a_c_k may be used to configure the underlying
│ │ │ │ │ -disk access. Such as settings_pack::aio_threads.
│ │ │ │ │ -The overloads that don't take an error_code& may throw an exception in case of
│ │ │ │ │ -a file error, the other overloads sets the error code to reflect the error, if
│ │ │ │ │ -any.
│ │ │ │ │ +  nodes6
│ │ │ │ │ +      the bootstrap nodes saved from the IPv6 buckets node
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ddhhtt__ssttoorraaggee__ccoouunntteerrss ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_d_h_t___s_t_o_r_a_g_e_._h_p_p"
│ │ │ │ │  This structure hold the relevant _c_o_u_n_t_e_r_s for the storage
│ │ │ │ │  struct dht_storage_counters
│ │ │ │ │  {
│ │ │ │ │     void rreesseett ();
│ │ │ │ │ @@ -12577,33 +12876,14 @@
│ │ │ │ │  For implementers: Use this functions for expire peers or items or any other
│ │ │ │ │  storage cleanup.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ********** ccoouunntteerrss(()) **********
│ │ │ │ │  virtual dht_storage_counters ccoouunntteerrss () const = 0;
│ │ │ │ │  return stats _c_o_u_n_t_e_r_s for the store
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ ddhhtt__ssttaattee ************
│ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_d_h_t___s_t_a_t_e_._h_p_p"
│ │ │ │ │ -This structure helps to store and load the state of the dht_tracker. At this
│ │ │ │ │ -moment the library is only a dual stack implementation of the DHT. See _B_E_P_ _3_2
│ │ │ │ │ -struct dht_state
│ │ │ │ │ -{
│ │ │ │ │ -   void cclleeaarr ();
│ │ │ │ │ -
│ │ │ │ │ -   node_ids_t nids;
│ │ │ │ │ -   std::vector<udp::endpoint> nodes;
│ │ │ │ │ -   std::vector<udp::endpoint> nodes6;
│ │ │ │ │ -};
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  nodes
│ │ │ │ │ -      the bootstrap nodes saved from the buckets node
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -  nodes6
│ │ │ │ │ -      the bootstrap nodes saved from the IPv6 buckets node
│ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ ddhhtt__ddeeffaauulltt__ssttoorraaggee__ccoonnssttrruuccttoorr(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_d_h_t___s_t_o_r_a_g_e_._h_p_p"
│ │ │ │ │  std::unique_ptr<dht_storage_interface> ddhhtt__ddeeffaauulltt__ssttoorraaggee__ccoonnssttrruuccttoorr (
│ │ │ │ │     settings_interface const& settings);
│ │ │ │ │  constructor for the default DHT storage. The DHT storage is responsible for
│ │ │ │ │  maintaining peers and mutable and immutable items announced and stored/put to
│ │ │ │ │  the DHT node.
│ │ │ │ │ @@ -12632,22 +12912,22 @@
│ │ │ │ │        specified in the message. This may improve the chances of traversing NATs
│ │ │ │ │        when using uTP.
│ │ │ │ │    ssl_torrent
│ │ │ │ │        Specify the port number for the SSL listen socket in the DHT announce.
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ rreeaadd__rreessuummee__ddaattaa(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_r_e_a_d___r_e_s_u_m_e___d_a_t_a_._h_p_p"
│ │ │ │ │ -add_torrent_params rreeaadd__rreessuummee__ddaattaa (span<char const> buffer
│ │ │ │ │ -   , load_torrent_limits const& cfg = {});
│ │ │ │ │  add_torrent_params rreeaadd__rreessuummee__ddaattaa (bdecode_node const& rd
│ │ │ │ │     , int piece_limit = 0x200000);
│ │ │ │ │ -add_torrent_params rreeaadd__rreessuummee__ddaattaa (bdecode_node const& rd
│ │ │ │ │ -   , error_code& ec, int piece_limit = 0x200000);
│ │ │ │ │ +add_torrent_params rreeaadd__rreessuummee__ddaattaa (span<char const> buffer
│ │ │ │ │ +   , load_torrent_limits const& cfg = {});
│ │ │ │ │  add_torrent_params rreeaadd__rreessuummee__ddaattaa (span<char const> buffer
│ │ │ │ │     , error_code& ec, load_torrent_limits const& cfg = {});
│ │ │ │ │ +add_torrent_params rreeaadd__rreessuummee__ddaattaa (bdecode_node const& rd
│ │ │ │ │ +   , error_code& ec, int piece_limit = 0x200000);
│ │ │ │ │  these functions are used to parse resume data and populate the appropriate
│ │ │ │ │  fields in an _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object. This object can then be used to add the
│ │ │ │ │  actual _t_o_r_r_e_n_t___i_n_f_o object to and pass to session::add_torrent() or session::
│ │ │ │ │  async_add_torrent().
│ │ │ │ │  If the client wants to override any field that was loaded from the resume data,
│ │ │ │ │  e.g. save_path, those fields must be changed after loading resume data but
│ │ │ │ │  before adding the torrent.
│ │ │ │ │ @@ -12655,18 +12935,18 @@
│ │ │ │ │  the torrent that may be loaded as part of the resume data, if it contains an
│ │ │ │ │  info field. The overloads that take a flat buffer are instead configured with
│ │ │ │ │  limits on torrent sizes via load_torrent limits.
│ │ │ │ │  In order to support large torrents, it may also be necessary to raise the
│ │ │ │ │  _s_e_t_t_i_n_g_s___p_a_c_k_:_:_m_a_x___p_i_e_c_e___c_o_u_n_t setting and pass a higher limit to calls to
│ │ │ │ │  _t_o_r_r_e_n_t___i_n_f_o_:_:_p_a_r_s_e___i_n_f_o___s_e_c_t_i_o_n_(_).
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │ -************ wwrriittee__rreessuummee__ddaattaa__bbuuff(()) wwrriittee__rreessuummee__ddaattaa(()) ************
│ │ │ │ │ +************ wwrriittee__rreessuummee__ddaattaa(()) wwrriittee__rreessuummee__ddaattaa__bbuuff(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_._h_p_p"
│ │ │ │ │ -entry wwrriittee__rreessuummee__ddaattaa (add_torrent_params const& atp);
│ │ │ │ │  std::vector<char> wwrriittee__rreessuummee__ddaattaa__bbuuff (add_torrent_params const& atp);
│ │ │ │ │ +entry wwrriittee__rreessuummee__ddaattaa (add_torrent_params const& atp);
│ │ │ │ │  this function turns the resume data in an add_torrent_params object into a
│ │ │ │ │  bencoded structure
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ wwrriittee__ttoorrrreenntt__ffiillee__bbuuff(()) wwrriittee__ttoorrrreenntt__ffiillee(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_._h_p_p"
│ │ │ │ │  entry wwrriittee__ttoorrrreenntt__ffiillee (add_torrent_params const& atp, write_torrent_flags_t
│ │ │ │ │  flags);
│ │ │ │ │ @@ -12723,18 +13003,18 @@
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_e_d_2_5_5_1_9_._h_p_p"
│ │ │ │ │  bool eedd2255551199__vveerriiffyy (signature const& sig
│ │ │ │ │     , span<char const> msg, public_key const& pk);
│ │ │ │ │  Verifies the signature on the given message using pk
│ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
│ │ │ │ │  ************ eedd2255551199__aadddd__ssccaallaarr(()) ************
│ │ │ │ │  Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_e_d_2_5_5_1_9_._h_p_p"
│ │ │ │ │ -public_key eedd2255551199__aadddd__ssccaallaarr (public_key const& pk
│ │ │ │ │ -   , std::array<char, 32> const& scalar);
│ │ │ │ │  secret_key eedd2255551199__aadddd__ssccaallaarr (secret_key const& sk
│ │ │ │ │     , std::array<char, 32> const& scalar);
│ │ │ │ │ +public_key eedd2255551199__aadddd__ssccaallaarr (public_key const& pk
│ │ │ │ │ +   , std::array<char, 32> const& scalar);
│ │ │ │ │  Adds a scalar to the given key pair where scalar is a 32 byte buffer (possibly
│ │ │ │ │  generated withed25519_create_seed), generating a new key pair.
│ │ │ │ │  You can calculate the public key sum without knowing the private key and vice
│ │ │ │ │  versa by passing in null for the key you don't know. This is useful when a
│ │ │ │ │  third party (an authoritative server for example) needs to enforce randomness
│ │ │ │ │  on a key pair while only knowing the public key of the other side.
│ │ │ │ │  Warning: the last bit of the scalar is ignored - if comparing scalars make sure
│ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/todo.html
│ │ │ │ @@ -459,67 +459,338 @@
│ │ │ │  	auto o = rpc.allocate_observer&lt;null_observer&gt;(std::move(algo), source, node_id());
│ │ │ │  #if TORRENT_USE_ASSERTS
│ │ │ │  	o-&gt;m_in_constructor = false;
│ │ │ │  #endif
│ │ │ │  	o-&gt;flags |= observer::flag_queried;
│ │ │ │  	rpc.invoke(req, source, o);
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(9)">../src/session_handle.cpp:691</a></td><td>expose the sequence_number, public_key, secret_key and signature types to the client</td></tr><tr id="9" style="display: none;" colspan="3"><td colspan="3"><h2>expose the sequence_number, public_key, secret_key and signature
│ │ │ │ -types to the client</h2><h4>../src/session_handle.cpp:691</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	void session_handle::dht_get_item(sha1_hash const&amp; target)
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(9)">../src/ut_metadata.cpp:268</a></td><td>use the aux::write_* functions and the span here instead, it will fit better with send_buffer()</td></tr><tr id="9" style="display: none;" colspan="3"><td colspan="3"><h2>use the aux::write_* functions and the span here instead, it
│ │ │ │ +will fit better with send_buffer()</h2><h4>../src/ut_metadata.cpp:268</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			int metadata_piece_size = 0;
│ │ │ │ +
│ │ │ │ +			if (m_torrent.valid_metadata())
│ │ │ │ +				e["total_size"] = m_tp.metadata().size();
│ │ │ │ +
│ │ │ │ +			if (type == msg_t::piece)
│ │ │ │ +			{
│ │ │ │ +				TORRENT_ASSERT(piece &gt;= 0 &amp;&amp; piece &lt; (m_tp.metadata().size() + 16 * 1024 - 1) / (16 * 1024));
│ │ │ │ +				TORRENT_ASSERT(m_pc.associated_torrent().lock()-&gt;valid_metadata());
│ │ │ │ +				TORRENT_ASSERT(m_torrent.valid_metadata());
│ │ │ │ +
│ │ │ │ +				int const offset = piece * 16 * 1024;
│ │ │ │ +				metadata = m_tp.metadata().data() + offset;
│ │ │ │ +				metadata_piece_size = std::min(
│ │ │ │ +					int(m_tp.metadata().size()) - offset, 16 * 1024);
│ │ │ │ +				TORRENT_ASSERT(metadata_piece_size &gt; 0);
│ │ │ │ +				TORRENT_ASSERT(offset &gt;= 0);
│ │ │ │ +				TORRENT_ASSERT(offset + metadata_piece_size &lt;= m_tp.metadata().size());
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">			char msg[200];
│ │ │ │ +</div>			char* header = msg;
│ │ │ │ +			char* p = &amp;msg[6];
│ │ │ │ +			int const len = bencode(p, e);
│ │ │ │ +			int const total_size = 2 + len + metadata_piece_size;
│ │ │ │ +			namespace io = aux;
│ │ │ │ +			io::write_uint32(total_size, header);
│ │ │ │ +			io::write_uint8(bt_peer_connection::msg_extended, header);
│ │ │ │ +			io::write_uint8(m_message_index, header);
│ │ │ │ +
│ │ │ │ +			m_pc.send_buffer({msg, len + 6});
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(10)">../src/torrent.cpp:419</a></td><td>we could probably get away with just saving a few fields here</td></tr><tr id="10" style="display: none;" colspan="3"><td colspan="3"><h2>we could probably get away with just saving a few fields here</h2><h4>../src/torrent.cpp:419</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// --- V2 HASHES ---
│ │ │ │ +
│ │ │ │ +		if (m_torrent_file-&gt;is_valid() &amp;&amp; m_torrent_file-&gt;info_hashes().has_v2())
│ │ │ │ +		{
│ │ │ │ +			if (!p.merkle_trees.empty())
│ │ │ │ +				load_merkle_trees(
│ │ │ │ +					std::move(p.merkle_trees)
│ │ │ │ +					, std::move(p.merkle_tree_mask)
│ │ │ │ +					, std::move(p.verified_leaf_hashes));
│ │ │ │ +
│ │ │ │ +			// we really don't want to store extra copies of the trees
│ │ │ │ +			TORRENT_ASSERT(p.merkle_trees.empty());
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		if (valid_metadata())
│ │ │ │ +		{
│ │ │ │ +			inc_stats_counter(counters::num_total_pieces_added
│ │ │ │ +				, m_torrent_file-&gt;num_pieces());
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		m_add_torrent_params = std::make_unique&lt;add_torrent_params&gt;(std::move(p));
│ │ │ │ +</div>	}
│ │ │ │ +
│ │ │ │ +	void torrent::load_merkle_trees(
│ │ │ │ +		aux::vector&lt;std::vector&lt;sha256_hash&gt;, file_index_t&gt; trees_import
│ │ │ │ +		, aux::vector&lt;std::vector&lt;bool&gt;, file_index_t&gt; mask
│ │ │ │ +		, aux::vector&lt;std::vector&lt;bool&gt;, file_index_t&gt; verified)
│ │ │ │  	{
│ │ │ │ -#ifndef TORRENT_DISABLE_DHT
│ │ │ │ -		async_call(&amp;session_impl::dht_get_immutable_item, target);
│ │ │ │ -#else
│ │ │ │ -		TORRENT_UNUSED(target);
│ │ │ │ -#endif
│ │ │ │ +		auto const&amp; fs = m_torrent_file-&gt;orig_files();
│ │ │ │ +
│ │ │ │ +		std::vector&lt;bool&gt; const empty_verified;
│ │ │ │ +		for (file_index_t i{0}; i &lt; fs.end_file(); ++i)
│ │ │ │ +		{
│ │ │ │ +			if (fs.pad_file_at(i) || fs.file_size(i) == 0)
│ │ │ │ +				continue;
│ │ │ │ +
│ │ │ │ +			if (i &gt;= trees_import.end_index()) break;
│ │ │ │ +			std::vector&lt;bool&gt; const&amp; verified_bitmask = (i &gt;= verified.end_index()) ? empty_verified : verified[i];
│ │ │ │ +			if (i &lt; mask.end_index() &amp;&amp; !mask[i].empty())
│ │ │ │ +			{
│ │ │ │ +				mask[i].resize(m_merkle_trees[i].size(), false);
│ │ │ │ +				m_merkle_trees[i].load_sparse_tree(trees_import[i], mask[i], verified_bitmask);
│ │ │ │ +			}
│ │ │ │ +			else
│ │ │ │ +			{
│ │ │ │ +				m_merkle_trees[i].load_tree(trees_import[i], verified_bitmask);
│ │ │ │ +			}
│ │ │ │ +		}
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	void session_handle::dht_get_item(std::array&lt;char, 32&gt; key
│ │ │ │ -		, std::string salt)
│ │ │ │ +	void torrent::inc_stats_counter(int c, int value)
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(11)">../src/torrent.cpp:715</a></td><td>assert there are no outstanding async operations on this torrent</td></tr><tr id="11" style="display: none;" colspan="3"><td colspan="3"><h2>assert there are no outstanding async operations on this
│ │ │ │ +torrent</h2><h4>../src/torrent.cpp:715</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#endif
│ │ │ │ +
│ │ │ │ +		if (!m_ses.dht()) return false;
│ │ │ │ +		if (m_torrent_file-&gt;is_valid() &amp;&amp; !m_files_checked) return false;
│ │ │ │ +		if (!m_announce_to_dht) return false;
│ │ │ │ +		if (m_paused) return false;
│ │ │ │ +
│ │ │ │ +		// don't announce private torrents
│ │ │ │ +		if (m_torrent_file-&gt;is_valid() &amp;&amp; m_torrent_file-&gt;priv()) return false;
│ │ │ │ +		if (m_trackers.empty()) return true;
│ │ │ │ +		if (!settings().get_bool(settings_pack::use_dht_as_fallback)) return true;
│ │ │ │ +
│ │ │ │ +		return std::none_of(m_trackers.begin(), m_trackers.end()
│ │ │ │ +			, [](aux::announce_entry const&amp; tr) { return bool(tr.verified); });
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	torrent::~torrent()
│ │ │ │  	{
│ │ │ │ -#ifndef TORRENT_DISABLE_DHT
│ │ │ │ -		async_call(&amp;session_impl::dht_get_mutable_item, key, salt);
│ │ │ │ -#else
│ │ │ │ -		TORRENT_UNUSED(key);
│ │ │ │ -		TORRENT_UNUSED(salt);
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>#if TORRENT_USE_ASSERTS
│ │ │ │ +		for (torrent_list_index_t i{}; i != m_links.end_index(); ++i)
│ │ │ │ +		{
│ │ │ │ +			if (!m_links[i].in_list()) continue;
│ │ │ │ +			m_links[i].unlink(m_ses.torrent_list(i), i);
│ │ │ │ +		}
│ │ │ │  #endif
│ │ │ │ +
│ │ │ │ +		// The invariant can't be maintained here, since the torrent
│ │ │ │ +		// is being destructed, all weak references to it have been
│ │ │ │ +		// reset, which means that all its peers already have an
│ │ │ │ +		// invalidated torrent pointer (so it cannot be verified to be correct)
│ │ │ │ +
│ │ │ │ +		// i.e. the invariant can only be maintained if all connections have
│ │ │ │ +		// been closed by the time the torrent is destructed. And they are
│ │ │ │ +		// supposed to be closed. So we can still do the invariant check.
│ │ │ │ +
│ │ │ │ +		// however, the torrent object may be destructed from the main
│ │ │ │ +		// thread when shutting down, if the disk cache has references to it.
│ │ │ │ +		// this means that the invariant check that this is called from the
│ │ │ │ +		// network thread cannot be maintained
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(m_peer_class == peer_class_t{0});
│ │ │ │ +		TORRENT_ASSERT(m_connections.empty());
│ │ │ │ +		// just in case, make sure the session accounting is kept right
│ │ │ │ +		for (auto p : m_connections)
│ │ │ │ +			m_ses.close_connection(p);
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">	sha1_hash session_handle::dht_put_item(entry data)
│ │ │ │ -</div>	{
│ │ │ │ -		std::vector&lt;char&gt; buf;
│ │ │ │ -		bencode(std::back_inserter(buf), data);
│ │ │ │ -		sha1_hash const ret = hasher(buf).final();
│ │ │ │ +	void torrent::read_piece(piece_index_t const piece)
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(12)">../src/torrent.cpp:1331</a></td><td>there's some duplication between this function and peer_connection::incoming_piece(). is there a way to merge something?</td></tr><tr id="12" style="display: none;" colspan="3"><td colspan="3"><h2>there's some duplication between this function and
│ │ │ │ +peer_connection::incoming_piece(). is there a way to merge something?</h2><h4>../src/torrent.cpp:1331</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		piece_index_t m_piece;
│ │ │ │ +		bool m_armed = true;
│ │ │ │ +	};
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DISABLE_DHT
│ │ │ │ -		async_call(&amp;session_impl::dht_put_immutable_item, data, ret);
│ │ │ │ -#endif
│ │ │ │ -		return ret;
│ │ │ │ +	void torrent::add_piece_async(piece_index_t const piece
│ │ │ │ +		, std::vector&lt;char&gt; data, add_piece_flags_t const flags)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +
│ │ │ │ +		// make sure the piece index is correct
│ │ │ │ +		if (piece &gt;= torrent_file().end_piece())
│ │ │ │ +			return;
│ │ │ │ +
│ │ │ │ +		// make sure the piece size is correct
│ │ │ │ +		if (data.size() != std::size_t(m_torrent_file-&gt;piece_size(piece)))
│ │ │ │ +			return;
│ │ │ │ +
│ │ │ │ +		add_piece(piece, data.data(), flags);
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	void session_handle::dht_put_item(std::array&lt;char, 32&gt; key
│ │ │ │ -		, std::function&lt;void(entry&amp;, std::array&lt;char,64&gt;&amp;
│ │ │ │ -			, std::int64_t&amp;, std::string const&amp;)&gt; cb
│ │ │ │ -		, std::string salt)
│ │ │ │ +<div style="background: #ffff00" width="100%">	void torrent::add_piece(piece_index_t const piece, char const* data
│ │ │ │ +</div>		, add_piece_flags_t const flags)
│ │ │ │  	{
│ │ │ │ -#ifndef TORRENT_DISABLE_DHT
│ │ │ │ -		async_call(&amp;session_impl::dht_put_mutable_item, key, cb, salt);
│ │ │ │ -#else
│ │ │ │ -		TORRENT_UNUSED(key);
│ │ │ │ -		TORRENT_UNUSED(cb);
│ │ │ │ -		TORRENT_UNUSED(salt);
│ │ │ │ -#endif
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +
│ │ │ │ +		// make sure the piece index is correct
│ │ │ │ +		if (piece &gt;= torrent_file().end_piece())
│ │ │ │ +			return;
│ │ │ │ +
│ │ │ │ +		int const piece_size = m_torrent_file-&gt;piece_size(piece);
│ │ │ │ +		int const blocks_in_piece = (piece_size + block_size() - 1) / block_size();
│ │ │ │ +
│ │ │ │ +		if (m_deleted) return;
│ │ │ │ +
│ │ │ │ +		// avoid crash trying to access the picker when there is none
│ │ │ │ +		if (m_have_all &amp;&amp; !has_picker()) return;
│ │ │ │ +
│ │ │ │ +		// we don't support clobbering the piece picker while checking the
│ │ │ │ +		// files. We may end up having the same piece multiple times
│ │ │ │ +		TORRENT_ASSERT_PRECOND(state() != torrent_status::checking_files
│ │ │ │ +			&amp;&amp; state() != torrent_status::checking_resume_data);
│ │ │ │ +		if (state() == torrent_status::checking_files
│ │ │ │ +			|| state() == torrent_status::checking_resume_data)
│ │ │ │ +			return;
│ │ │ │ +
│ │ │ │ +		need_picker();
│ │ │ │ +
│ │ │ │ +		if (picker().have_piece(piece)
│ │ │ │ +			&amp;&amp; !(flags &amp; torrent_handle::overwrite_existing))
│ │ │ │ +			return;
│ │ │ │ +
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(13)">../src/torrent.cpp:3966</a></td><td>this could probably be pulled out into a free function</td></tr><tr id="13" style="display: none;" colspan="3"><td colspan="3"><h2>this could probably be pulled out into a free function</h2><h4>../src/torrent.cpp:3966</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	std::int64_t calc_bytes(file_storage const&amp; fs, piece_count const&amp; pc)
│ │ │ │ +	{
│ │ │ │ +		// it's an impossible combination to have 0 pieces, but still have one of them be the last piece
│ │ │ │ +		TORRENT_ASSERT(!(pc.num_pieces == 0 &amp;&amp; pc.last_piece == true));
│ │ │ │ +
│ │ │ │ +		// if we have 0 pieces, we can't have any pad blocks either
│ │ │ │ +		TORRENT_ASSERT(!(pc.num_pieces == 0 &amp;&amp; pc.pad_bytes &gt; 0));
│ │ │ │ +
│ │ │ │ +		// if we have all pieces, we must also have the last one
│ │ │ │ +		TORRENT_ASSERT(!(pc.num_pieces == fs.num_pieces() &amp;&amp; pc.last_piece == false));
│ │ │ │ +
│ │ │ │ +		// every block should not be a pad block
│ │ │ │ +		TORRENT_ASSERT(pc.pad_bytes &lt;= std::int64_t(pc.num_pieces) * fs.piece_length());
│ │ │ │ +
│ │ │ │ +		return std::int64_t(pc.num_pieces) * fs.piece_length()
│ │ │ │ +			- (pc.last_piece ? fs.piece_length() - fs.piece_size(fs.last_piece()) : 0)
│ │ │ │ +			- std::int64_t(pc.pad_bytes);
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	void session_handle::dht_get_peers(sha1_hash const&amp; info_hash)
│ │ │ │ +	// fills in total_wanted, total_wanted_done and total_done
│ │ │ │ +<div style="background: #ffff00" width="100%">	void torrent::bytes_done(torrent_status&amp; st, status_flags_t const flags) const
│ │ │ │ +</div>	{
│ │ │ │ +		INVARIANT_CHECK;
│ │ │ │ +
│ │ │ │ +		st.total_done = 0;
│ │ │ │ +		st.total_wanted_done = 0;
│ │ │ │ +		st.total_wanted = m_size_on_disk;
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(st.total_wanted &lt;= m_torrent_file-&gt;total_size());
│ │ │ │ +		TORRENT_ASSERT(st.total_wanted &gt;= 0);
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(!valid_metadata() || m_torrent_file-&gt;num_pieces() &gt; 0);
│ │ │ │ +		if (!valid_metadata()) return;
│ │ │ │ +
│ │ │ │ +		if (m_seed_mode || is_seed())
│ │ │ │ +		{
│ │ │ │ +			// once we're a seed and remove the piece picker, we stop tracking
│ │ │ │ +			// piece- and file priority. We consider everything as being
│ │ │ │ +			// "wanted"
│ │ │ │ +			st.total_done = m_torrent_file-&gt;total_size() - m_padding_bytes;
│ │ │ │ +			st.total_wanted_done = m_size_on_disk;
│ │ │ │ +			st.total_wanted = m_size_on_disk;
│ │ │ │ +			TORRENT_ASSERT(st.total_wanted &lt;= st.total_done);
│ │ │ │ +			TORRENT_ASSERT(st.total_wanted_done &lt;= st.total_wanted);
│ │ │ │ +			TORRENT_ASSERT(st.total_done &lt;= m_torrent_file-&gt;total_size());
│ │ │ │ +			return;
│ │ │ │ +		}
│ │ │ │ +		else if (!has_picker())
│ │ │ │ +		{
│ │ │ │ +			st.total_done = 0;
│ │ │ │ +			st.total_wanted_done = 0;
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(14)">../src/torrent.cpp:4905</a></td><td>should this alert have an error code in it?</td></tr><tr id="14" style="display: none;" colspan="3"><td colspan="3"><h2>should this alert have an error code in it?</h2><h4>../src/torrent.cpp:4905</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		on_remove_peers();
│ │ │ │ +		TORRENT_ASSERT(m_connections.empty());
│ │ │ │ +
│ │ │ │ +		// post a message to the main thread to destruct
│ │ │ │ +		// the torrent object from there
│ │ │ │ +		if (m_storage)
│ │ │ │ +		{
│ │ │ │ +			try {
│ │ │ │ +				m_ses.disk_thread().async_stop_torrent(m_storage
│ │ │ │ +					, std::bind(&amp;torrent::on_torrent_aborted, shared_from_this()));
│ │ │ │ +			}
│ │ │ │ +			catch (std::exception const&amp; e)
│ │ │ │ +			{
│ │ │ │ +				TORRENT_UNUSED(e);
│ │ │ │ +				m_storage.reset();
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +				debug_log("Failed to flush disk cache: %s", e.what());
│ │ │ │ +#endif
│ │ │ │ +				// clients may rely on this alert to be posted, so it's probably a
│ │ │ │ +				// good idea to post it here, even though we failed
│ │ │ │ +<div style="background: #ffff00" width="100%">				if (alerts().should_post&lt;cache_flushed_alert&gt;())
│ │ │ │ +</div>					alerts().emplace_alert&lt;cache_flushed_alert&gt;(get_handle());
│ │ │ │ +			}
│ │ │ │ +			m_ses.deferred_submit_jobs();
│ │ │ │ +		}
│ │ │ │ +		else
│ │ │ │ +		{
│ │ │ │ +			if (alerts().should_post&lt;cache_flushed_alert&gt;())
│ │ │ │ +				alerts().emplace_alert&lt;cache_flushed_alert&gt;(get_handle());
│ │ │ │ +			alerts().emplace_alert&lt;torrent_removed_alert&gt;(get_handle()
│ │ │ │ +				, info_hash(), get_userdata());
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(15)">../src/torrent.cpp:4975</a></td><td>this should return optional<>. piece index -1 should not be allowed</td></tr><tr id="15" style="display: none;" colspan="3"><td colspan="3"><h2>this should return optional<>. piece index -1 should not be
│ │ │ │ +allowed</h2><h4>../src/torrent.cpp:4975</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_SUPERSEEDING
│ │ │ │ +	void torrent::set_super_seeding(bool const on)
│ │ │ │  	{
│ │ │ │ -#ifndef TORRENT_DISABLE_DHT
│ │ │ │ -		async_call(&amp;session_impl::dht_get_peers, info_hash);
│ │ │ │ -#else
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(10)">../src/web_peer_connection.cpp:199</a></td><td>this should be an optional<piece_index_t>, piece index -1 should not be allowed</td></tr><tr id="10" style="display: none;" colspan="3"><td colspan="3"><h2>this should be an optional<piece_index_t>, piece index -1 should
│ │ │ │ +		if (on == m_super_seeding) return;
│ │ │ │ +
│ │ │ │ +		m_super_seeding = on;
│ │ │ │ +		set_need_save_resume(torrent_handle::if_state_changed);
│ │ │ │ +		state_updated();
│ │ │ │ +
│ │ │ │ +		if (m_super_seeding) return;
│ │ │ │ +
│ │ │ │ +		// disable super seeding for all peers
│ │ │ │ +		for (auto pc : *this)
│ │ │ │ +		{
│ │ │ │ +			pc-&gt;superseed_piece(piece_index_t(-1), piece_index_t(-1));
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	piece_index_t torrent::get_piece_to_super_seed(typed_bitfield&lt;piece_index_t&gt; const&amp; bits)
│ │ │ │ +</div>	{
│ │ │ │ +		// return a piece with low availability that is not in
│ │ │ │ +		// the bitfield and that is not currently being super
│ │ │ │ +		// seeded by any peer
│ │ │ │ +		TORRENT_ASSERT(m_super_seeding);
│ │ │ │ +
│ │ │ │ +		// do a linear search from the first piece
│ │ │ │ +		int min_availability = 9999;
│ │ │ │ +		std::vector&lt;piece_index_t&gt; avail_vec;
│ │ │ │ +		for (auto const i : m_torrent_file-&gt;piece_range())
│ │ │ │ +		{
│ │ │ │ +			if (bits[i]) continue;
│ │ │ │ +
│ │ │ │ +			int availability = 0;
│ │ │ │ +			for (auto pc : *this)
│ │ │ │ +			{
│ │ │ │ +				if (pc-&gt;super_seeded_piece(i))
│ │ │ │ +				{
│ │ │ │ +					// avoid super-seeding the same piece to more than one
│ │ │ │ +					// peer if we can avoid it. Do this by artificially
│ │ │ │ +					// increase the availability
│ │ │ │ +					availability = 999;
│ │ │ │ +					break;
│ │ │ │ +				}
│ │ │ │ +				if (pc-&gt;has_piece(i)) ++availability;
│ │ │ │ +			}
│ │ │ │ +			if (availability &gt; min_availability) continue;
│ │ │ │ +			if (availability == min_availability)
│ │ │ │ +			{
│ │ │ │ +				avail_vec.push_back(i);
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(16)">../src/web_peer_connection.cpp:199</a></td><td>this should be an optional<piece_index_t>, piece index -1 should not be allowed</td></tr><tr id="16" style="display: none;" colspan="3"><td colspan="3"><h2>this should be an optional<piece_index_t>, piece index -1 should
│ │ │ │  not be allowed</h2><h4>../src/web_peer_connection.cpp:199</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  			auto const range = aux::file_piece_range_inclusive(fs, i);
│ │ │ │  			for (piece_index_t k = std::get&lt;0&gt;(range); k &lt; std::get&lt;1&gt;(range); ++k)
│ │ │ │  				have.clear_bit(k);
│ │ │ │  		}
│ │ │ │  		t-&gt;set_seed(peer_info_struct(), false);
│ │ │ │  		if (have.none_set())
│ │ │ │ @@ -563,15 +834,15 @@
│ │ │ │  #endif
│ │ │ │  
│ │ │ │  		// prevent the peer from trying to send anything more
│ │ │ │  		m_send_buffer.clear();
│ │ │ │  
│ │ │ │  		// when the web server closed our write-end of the socket (i.e. its
│ │ │ │  		// read-end), if it's an HTTP 1.0 server. we will stop sending more
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(11)">../src/web_peer_connection.cpp:419</a></td><td>do we really need a special case here? wouldn't the multi-file case handle single file torrents correctly too?</td></tr><tr id="11" style="display: none;" colspan="3"><td colspan="3"><h2>do we really need a special case here? wouldn't the multi-file
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(17)">../src/web_peer_connection.cpp:419</a></td><td>do we really need a special case here? wouldn't the multi-file case handle single file torrents correctly too?</td></tr><tr id="17" style="display: none;" colspan="3"><td colspan="3"><h2>do we really need a special case here? wouldn't the multi-file
│ │ │ │  case handle single file torrents correctly too?</h2><h4>../src/web_peer_connection.cpp:419</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		size -= pr.length;
│ │ │ │  	}
│ │ │ │  
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  	peer_log(peer_log_alert::outgoing_message, "REQUESTING", "(piece: %d start: %d) - (piece: %d end: %d)"
│ │ │ │  		, static_cast&lt;int&gt;(r.piece), r.start
│ │ │ │  		, static_cast&lt;int&gt;(pr.piece), pr.start + pr.length);
│ │ │ │ @@ -615,15 +886,15 @@
│ │ │ │  	{
│ │ │ │  		std::vector&lt;file_slice&gt; files = info.orig_files().map_block(req.piece, req.start
│ │ │ │  			, req.length);
│ │ │ │  
│ │ │ │  		for (auto const &amp;f : files)
│ │ │ │  		{
│ │ │ │  			file_request_t file_req;
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(12)">../src/web_peer_connection.cpp:504</a></td><td>file_index_t should not allow negative values</td></tr><tr id="12" style="display: none;" colspan="3"><td colspan="3"><h2>file_index_t should not allow negative values</h2><h4>../src/web_peer_connection.cpp:504</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">					// with the correct slashes. Don't encode it again
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(18)">../src/web_peer_connection.cpp:504</a></td><td>file_index_t should not allow negative values</td></tr><tr id="18" style="display: none;" colspan="3"><td colspan="3"><h2>file_index_t should not allow negative values</h2><h4>../src/web_peer_connection.cpp:504</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">					// with the correct slashes. Don't encode it again
│ │ │ │  					request += m_path;
│ │ │ │  				}
│ │ │ │  
│ │ │ │  				request += escape_file_path(info.orig_files(), f.file_index);
│ │ │ │  			}
│ │ │ │  			request += " HTTP/1.1\r\n";
│ │ │ │  			add_headers(request, m_settings, using_proxy);
│ │ │ │ @@ -666,15 +937,15 @@
│ │ │ │  	{
│ │ │ │  		std::string const&amp; server_version = p.header("server");
│ │ │ │  		if (!server_version.empty())
│ │ │ │  			return server_version;
│ │ │ │  		return host;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(13)">../src/web_peer_connection.cpp:695</a></td><td>this could be made more efficient for the case when we use an HTTP proxy. Then we wouldn't need to add new web seeds to the torrent, we could just make the redirect table contain full URLs.</td></tr><tr id="13" style="display: none;" colspan="3"><td colspan="3"><h2>this could be made more efficient for the case when we use an
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(19)">../src/web_peer_connection.cpp:695</a></td><td>this could be made more efficient for the case when we use an HTTP proxy. Then we wouldn't need to add new web seeds to the torrent, we could just make the redirect table contain full URLs.</td></tr><tr id="19" style="display: none;" colspan="3"><td colspan="3"><h2>this could be made more efficient for the case when we use an
│ │ │ │  HTTP proxy. Then we wouldn't need to add new web seeds to the torrent,
│ │ │ │  we could just make the redirect table contain full URLs.</h2><h4>../src/web_peer_connection.cpp:695</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	bool const single_file_request = !m_path.empty()
│ │ │ │  		&amp;&amp; m_path[m_path.size() - 1] != '/';
│ │ │ │  
│ │ │ │  	// when SSRF mitigation is enabled, a web seed on the internet (is_global())
│ │ │ │  	// is not allowed to redirect to a server on the local network, so we set
│ │ │ │  	// the no_local_ips flag
│ │ │ │ @@ -719,47 +990,226 @@
│ │ │ │  		web-&gt;have_files.resize(t-&gt;torrent_file().num_files(), false);
│ │ │ │  
│ │ │ │  		// the new web seed we're adding only has this file for now
│ │ │ │  		// we may add more files later
│ │ │ │  		web-&gt;redirects[file_index] = redirect_path;
│ │ │ │  		if (web-&gt;have_files.get_bit(file_index) == false)
│ │ │ │  		{
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(14)">../src/ut_metadata.cpp:268</a></td><td>use the aux::write_* functions and the span here instead, it will fit better with send_buffer()</td></tr><tr id="14" style="display: none;" colspan="3"><td colspan="3"><h2>use the aux::write_* functions and the span here instead, it
│ │ │ │ -will fit better with send_buffer()</h2><h4>../src/ut_metadata.cpp:268</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			int metadata_piece_size = 0;
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(20)">../src/peer_connection.cpp:3133</a></td><td>instead of having to ask the torrent whether it's in graceful pause mode or not, the peers should keep that state (and the torrent should update them when it enters graceful pause). When a peer enters graceful pause mode, it should cancel all outstanding requests and clear its request queue.</td></tr><tr id="20" style="display: none;" colspan="3"><td colspan="3"><h2>instead of having to ask the torrent whether it's in graceful
│ │ │ │ +pause mode or not, the peers should keep that state (and the torrent
│ │ │ │ +should update them when it enters graceful pause). When a peer enters
│ │ │ │ +graceful pause mode, it should cancel all outstanding requests and
│ │ │ │ +clear its request queue.</h2><h4>../src/peer_connection.cpp:3133</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// to disk or are in the disk write cache
│ │ │ │ +		if (picker.is_piece_finished(p.piece) &amp;&amp; !was_finished)
│ │ │ │ +		{
│ │ │ │ +#if TORRENT_USE_INVARIANT_CHECKS
│ │ │ │ +			check_postcondition post_checker2_(t, false);
│ │ │ │ +#endif
│ │ │ │ +			t-&gt;verify_piece(p.piece);
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -			if (m_torrent.valid_metadata())
│ │ │ │ -				e["total_size"] = m_tp.metadata().size();
│ │ │ │ +		check_graceful_pause();
│ │ │ │  
│ │ │ │ -			if (type == msg_t::piece)
│ │ │ │ +		if (is_disconnecting()) return;
│ │ │ │ +
│ │ │ │ +		if (request_a_block(*t, *this))
│ │ │ │ +			m_counters.inc_stats_counter(counters::incoming_piece_picks);
│ │ │ │ +		send_block_requests();
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void peer_connection::check_graceful_pause()
│ │ │ │ +	{
│ │ │ │ +<div style="background: #ffff00" width="100%">		std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ +</div>		if (!t || !t-&gt;graceful_pause()) return;
│ │ │ │ +
│ │ │ │ +		if (m_outstanding_bytes &gt; 0) return;
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		peer_log(peer_log_alert::info, "GRACEFUL_PAUSE", "NO MORE DOWNLOAD");
│ │ │ │ +#endif
│ │ │ │ +		disconnect(errors::torrent_paused, operation_t::bittorrent);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void peer_connection::on_disk_write_complete(storage_error const&amp; error
│ │ │ │ +		, peer_request const&amp; p, std::shared_ptr&lt;torrent&gt; t)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		if (should_log(peer_log_alert::info))
│ │ │ │ +		{
│ │ │ │ +			peer_log(peer_log_alert::info, "FILE_ASYNC_WRITE_COMPLETE", "piece: %d s: %x l: %x e: %s"
│ │ │ │ +				, static_cast&lt;int&gt;(p.piece), p.start, p.length, error.ec.message().c_str());
│ │ │ │ +		}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		m_counters.inc_stats_counter(counters::queued_write_bytes, -p.length);
│ │ │ │ +		m_outstanding_writing_bytes -= p.length;
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(m_outstanding_writing_bytes &gt;= 0);
│ │ │ │ +
│ │ │ │ +		// every peer is entitled to allocate a disk buffer if it has no writes outstanding
│ │ │ │ +		// see the comment in incoming_piece
│ │ │ │ +		if (m_outstanding_writing_bytes == 0
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(21)">../src/peer_connection.cpp:4044</a></td><td>once peers are properly put in graceful pause mode, they can cancel all outstanding requests and this test can be removed.</td></tr><tr id="21" style="display: none;" colspan="3"><td colspan="3"><h2>once peers are properly put in graceful pause mode, they can
│ │ │ │ +cancel all outstanding requests and this test can be removed.</h2><h4>../src/peer_connection.cpp:4044</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +			if (!p-&gt;m_deferred_send_block_requests)
│ │ │ │ +				return;
│ │ │ │ +
│ │ │ │ +			p-&gt;m_deferred_send_block_requests = false;
│ │ │ │ +			p-&gt;send_block_requests_impl();
│ │ │ │ +		});
│ │ │ │ +		m_deferred_send_block_requests = true;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void peer_connection::send_block_requests_impl()
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +		INVARIANT_CHECK;
│ │ │ │ +
│ │ │ │ +		std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ +		if (!t) return;
│ │ │ │ +
│ │ │ │ +		if (m_disconnecting) return;
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		if (t-&gt;graceful_pause()) return;
│ │ │ │ +</div>
│ │ │ │ +		// we can't download pieces in these states
│ │ │ │ +		if (t-&gt;state() == torrent_status::checking_files
│ │ │ │ +			|| t-&gt;state() == torrent_status::checking_resume_data
│ │ │ │ +			|| t-&gt;state() == torrent_status::downloading_metadata)
│ │ │ │ +			return;
│ │ │ │ +
│ │ │ │ +		if (int(m_download_queue.size()) &gt;= m_desired_queue_size
│ │ │ │ +			|| t-&gt;upload_mode()) return;
│ │ │ │ +
│ │ │ │ +		bool const empty_download_queue = m_download_queue.empty();
│ │ │ │ +
│ │ │ │ +		while (!m_request_queue.empty()
│ │ │ │ +			&amp;&amp; (int(m_download_queue.size()) &lt; m_desired_queue_size
│ │ │ │ +				|| m_queued_time_critical &gt; 0))
│ │ │ │ +		{
│ │ │ │ +			pending_block block = m_request_queue.front();
│ │ │ │ +
│ │ │ │ +			m_request_queue.erase(m_request_queue.begin());
│ │ │ │ +			if (m_queued_time_critical) --m_queued_time_critical;
│ │ │ │ +
│ │ │ │ +			// if we're a seed, we don't have a piece picker
│ │ │ │ +			// so we don't have to worry about invariants getting
│ │ │ │ +			// out of sync with it
│ │ │ │ +			if (!t-&gt;has_picker()) continue;
│ │ │ │ +
│ │ │ │ +			// this can happen if a block times out, is re-requested and
│ │ │ │ +			// then arrives "unexpectedly"
│ │ │ │ +			if (t-&gt;picker().is_downloaded(block.block))
│ │ │ │  			{
│ │ │ │ -				TORRENT_ASSERT(piece &gt;= 0 &amp;&amp; piece &lt; (m_tp.metadata().size() + 16 * 1024 - 1) / (16 * 1024));
│ │ │ │ -				TORRENT_ASSERT(m_pc.associated_torrent().lock()-&gt;valid_metadata());
│ │ │ │ -				TORRENT_ASSERT(m_torrent.valid_metadata());
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(22)">../src/peer_connection.cpp:4730</a></td><td>new_piece should be an optional<piece_index_t>. piece index -1 should not be allowed</td></tr><tr id="22" style="display: none;" colspan="3"><td colspan="3"><h2>new_piece should be an optional<piece_index_t>. piece index -1
│ │ │ │ +should not be allowed</h2><h4>../src/peer_connection.cpp:4730</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +		// pieces may be empty if we don't have metadata yet
│ │ │ │ +		if (p.pieces.empty())
│ │ │ │ +		{
│ │ │ │ +			p.progress = 0.f;
│ │ │ │ +			p.progress_ppm = 0;
│ │ │ │ +		}
│ │ │ │ +		else
│ │ │ │ +		{
│ │ │ │ +#if TORRENT_NO_FPU
│ │ │ │ +			p.progress = 0.f;
│ │ │ │ +#else
│ │ │ │ +			p.progress = float(p.pieces.count()) / float(p.pieces.size());
│ │ │ │ +#endif
│ │ │ │ +			p.progress_ppm = int(std::int64_t(p.pieces.count()) * 1000000 / p.pieces.size());
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -				int const offset = piece * 16 * 1024;
│ │ │ │ -				metadata = m_tp.metadata().data() + offset;
│ │ │ │ -				metadata_piece_size = std::min(
│ │ │ │ -					int(m_tp.metadata().size()) - offset, 16 * 1024);
│ │ │ │ -				TORRENT_ASSERT(metadata_piece_size &gt; 0);
│ │ │ │ -				TORRENT_ASSERT(offset &gt;= 0);
│ │ │ │ -				TORRENT_ASSERT(offset + metadata_piece_size &lt;= m_tp.metadata().size());
│ │ │ │ -			}
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">			char msg[200];
│ │ │ │ -</div>			char* header = msg;
│ │ │ │ -			char* p = &amp;msg[6];
│ │ │ │ -			int const len = bencode(p, e);
│ │ │ │ -			int const total_size = 2 + len + metadata_piece_size;
│ │ │ │ -			namespace io = aux;
│ │ │ │ -			io::write_uint32(total_size, header);
│ │ │ │ -			io::write_uint8(bt_peer_connection::msg_extended, header);
│ │ │ │ -			io::write_uint8(m_message_index, header);
│ │ │ │ +#ifndef TORRENT_DISABLE_SUPERSEEDING
│ │ │ │ +<div style="background: #ffff00" width="100%">	void peer_connection::superseed_piece(piece_index_t const replace_piece
│ │ │ │ +</div>		, piece_index_t const new_piece)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │  
│ │ │ │ -			m_pc.send_buffer({msg, len + 6});
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(15)">../src/session_impl.cpp:1142</a></td><td>closing the udp sockets here means that the uTP connections cannot be closed gracefully</td></tr><tr id="15" style="display: none;" colspan="3"><td colspan="3"><h2>closing the udp sockets here means that
│ │ │ │ +		if (is_connecting()) return;
│ │ │ │ +		if (in_handshake()) return;
│ │ │ │ +
│ │ │ │ +		if (new_piece == piece_index_t(-1))
│ │ │ │ +		{
│ │ │ │ +			if (m_superseed_piece[0] == piece_index_t(-1)) return;
│ │ │ │ +			m_superseed_piece[0] = piece_index_t(-1);
│ │ │ │ +			m_superseed_piece[1] = piece_index_t(-1);
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +			peer_log(peer_log_alert::info, "SUPER_SEEDING", "ending");
│ │ │ │ +#endif
│ │ │ │ +			std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ +			TORRENT_ASSERT(t);
│ │ │ │ +
│ │ │ │ +			// this will either send a full bitfield or
│ │ │ │ +			// a have-all message, effectively terminating
│ │ │ │ +			// super-seeding, since the peer may pick any piece
│ │ │ │ +			write_bitfield();
│ │ │ │ +
│ │ │ │ +			return;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(!has_piece(new_piece));
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(23)">../src/session_handle.cpp:691</a></td><td>expose the sequence_number, public_key, secret_key and signature types to the client</td></tr><tr id="23" style="display: none;" colspan="3"><td colspan="3"><h2>expose the sequence_number, public_key, secret_key and signature
│ │ │ │ +types to the client</h2><h4>../src/session_handle.cpp:691</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	void session_handle::dht_get_item(sha1_hash const&amp; target)
│ │ │ │ +	{
│ │ │ │ +#ifndef TORRENT_DISABLE_DHT
│ │ │ │ +		async_call(&amp;session_impl::dht_get_immutable_item, target);
│ │ │ │ +#else
│ │ │ │ +		TORRENT_UNUSED(target);
│ │ │ │ +#endif
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void session_handle::dht_get_item(std::array&lt;char, 32&gt; key
│ │ │ │ +		, std::string salt)
│ │ │ │ +	{
│ │ │ │ +#ifndef TORRENT_DISABLE_DHT
│ │ │ │ +		async_call(&amp;session_impl::dht_get_mutable_item, key, salt);
│ │ │ │ +#else
│ │ │ │ +		TORRENT_UNUSED(key);
│ │ │ │ +		TORRENT_UNUSED(salt);
│ │ │ │ +#endif
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	sha1_hash session_handle::dht_put_item(entry data)
│ │ │ │ +</div>	{
│ │ │ │ +		std::vector&lt;char&gt; buf;
│ │ │ │ +		bencode(std::back_inserter(buf), data);
│ │ │ │ +		sha1_hash const ret = hasher(buf).final();
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_DHT
│ │ │ │ +		async_call(&amp;session_impl::dht_put_immutable_item, data, ret);
│ │ │ │ +#endif
│ │ │ │ +		return ret;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void session_handle::dht_put_item(std::array&lt;char, 32&gt; key
│ │ │ │ +		, std::function&lt;void(entry&amp;, std::array&lt;char,64&gt;&amp;
│ │ │ │ +			, std::int64_t&amp;, std::string const&amp;)&gt; cb
│ │ │ │ +		, std::string salt)
│ │ │ │ +	{
│ │ │ │ +#ifndef TORRENT_DISABLE_DHT
│ │ │ │ +		async_call(&amp;session_impl::dht_put_mutable_item, key, cb, salt);
│ │ │ │ +#else
│ │ │ │ +		TORRENT_UNUSED(key);
│ │ │ │ +		TORRENT_UNUSED(cb);
│ │ │ │ +		TORRENT_UNUSED(salt);
│ │ │ │ +#endif
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void session_handle::dht_get_peers(sha1_hash const&amp; info_hash)
│ │ │ │ +	{
│ │ │ │ +#ifndef TORRENT_DISABLE_DHT
│ │ │ │ +		async_call(&amp;session_impl::dht_get_peers, info_hash);
│ │ │ │ +#else
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(24)">../src/session_impl.cpp:1142</a></td><td>closing the udp sockets here means that the uTP connections cannot be closed gracefully</td></tr><tr id="24" style="display: none;" colspan="3"><td colspan="3"><h2>closing the udp sockets here means that
│ │ │ │  the uTP connections cannot be closed gracefully</h2><h4>../src/session_impl.cpp:1142</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  		session_log(" aborting all connections (%d)", int(m_connections.size()));
│ │ │ │  #endif
│ │ │ │  		// abort all connections
│ │ │ │  		for (auto i = m_connections.begin(); i != m_connections.end();)
│ │ │ │  		{
│ │ │ │  			peer_connection* p = (*i).get();
│ │ │ │ @@ -803,15 +1253,15 @@
│ │ │ │  
│ │ │ │  		// it's OK to detach the threads here. The disk_io_thread
│ │ │ │  		// has an internal counter and won't release the network
│ │ │ │  		// thread until they're all dead (via m_work).
│ │ │ │  		m_disk_thread-&gt;abort(false);
│ │ │ │  
│ │ │ │  		// now it's OK for the network thread to exit
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(16)">../src/session_impl.cpp:1638</a></td><td>the logic in this if-block should be factored out into a separate function. At least most of it</td></tr><tr id="16" style="display: none;" colspan="3"><td colspan="3"><h2>the logic in this if-block should be factored out into a
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(25)">../src/session_impl.cpp:1638</a></td><td>the logic in this if-block should be factored out into a separate function. At least most of it</td></tr><tr id="25" style="display: none;" colspan="3"><td colspan="3"><h2>the logic in this if-block should be factored out into a
│ │ │ │  separate function. At least most of it</h2><h4>../src/session_impl.cpp:1638</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				, (lep.flags &amp; listen_socket_t::local_network) ? "local-network " : ""
│ │ │ │  				, (lep.flags &amp; listen_socket_t::accept_incoming) ? "accept-incoming " : "no-incoming "
│ │ │ │  				, (lep.flags &amp; listen_socket_t::was_expanded) ? "expanded-ip " : ""
│ │ │ │  				, (lep.flags &amp; listen_socket_t::proxy) ? "proxy " : "");
│ │ │ │  		}
│ │ │ │  #endif
│ │ │ │  
│ │ │ │ @@ -855,15 +1305,15 @@
│ │ │ │  				error_code err;
│ │ │ │  				ret-&gt;sock-&gt;set_option(exclusive_address_use(true), err);
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  				if (err &amp;&amp; should_log())
│ │ │ │  				{
│ │ │ │  					session_log("failed enable exclusive address use on listen socket: %s"
│ │ │ │  						, err.message().c_str());
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(17)">../src/session_impl.cpp:2606</a></td><td>it would be neat if the utp socket manager would handle ICMP errors too</td></tr><tr id="17" style="display: none;" colspan="3"><td colspan="3"><h2>it would be neat if the utp socket manager would
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(26)">../src/session_impl.cpp:2606</a></td><td>it would be neat if the utp socket manager would handle ICMP errors too</td></tr><tr id="26" style="display: none;" colspan="3"><td colspan="3"><h2>it would be neat if the utp socket manager would
│ │ │ │  handle ICMP errors too</h2><h4>../src/session_impl.cpp:2606</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  		std::shared_ptr&lt;session_udp_socket&gt; s = socket.lock();
│ │ │ │  		if (!s) return;
│ │ │ │  
│ │ │ │  		struct utp_socket_manager&amp; mgr =
│ │ │ │  #ifdef TORRENT_SSL_PEERS
│ │ │ │  			ssl == transport::ssl ? m_ssl_utp_socket_manager :
│ │ │ │ @@ -907,15 +1357,15 @@
│ │ │ │  					// if it wasn't a uTP packet, try the other users of the UDP
│ │ │ │  					// socket
│ │ │ │  					bool handled = false;
│ │ │ │  #ifndef TORRENT_DISABLE_DHT
│ │ │ │  					auto listen_socket = ls.lock();
│ │ │ │  					if (m_dht &amp;&amp; buf.size() &gt; 20
│ │ │ │  						&amp;&amp; buf.front() == 'd'
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(18)">../src/session_impl.cpp:4155</a></td><td>it would probably make sense to have a separate list of peers that are eligible for optimistic unchoke, similar to the torrents perhaps this could even iterate over the pool allocators of torrent_peer objects. It could probably be done in a single pass and collect the n best candidates. maybe just a queue of peers would make even more sense, just pick the next peer in the queue for unchoking. It would be O(1).</td></tr><tr id="18" style="display: none;" colspan="3"><td colspan="3"><h2>it would probably make sense to have a separate list of peers
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(27)">../src/session_impl.cpp:4155</a></td><td>it would probably make sense to have a separate list of peers that are eligible for optimistic unchoke, similar to the torrents perhaps this could even iterate over the pool allocators of torrent_peer objects. It could probably be done in a single pass and collect the n best candidates. maybe just a queue of peers would make even more sense, just pick the next peer in the queue for unchoking. It would be O(1).</td></tr><tr id="27" style="display: none;" colspan="3"><td colspan="3"><h2>it would probably make sense to have a separate list of peers
│ │ │ │  that are eligible for optimistic unchoke, similar to the torrents
│ │ │ │  perhaps this could even iterate over the pool allocators of
│ │ │ │  torrent_peer objects. It could probably be done in a single pass and
│ │ │ │  collect the n best candidates. maybe just a queue of peers would make
│ │ │ │  even more sense, just pick the next peer in the queue for unchoking. It
│ │ │ │  would be O(1).</h2><h4>../src/session_impl.cpp:4155</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │  
│ │ │ │ @@ -949,15 +1399,15 @@
│ │ │ │  			{
│ │ │ │  				prev_opt_unchoke.push_back(pi);
│ │ │ │  			}
│ │ │ │  
│ │ │ │  			torrent const* t = p-&gt;associated_torrent().lock().get();
│ │ │ │  			if (!t) continue;
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(19)">../src/session_impl.cpp:4178</a></td><td>peers should know whether their torrent is paused or not, instead of having to ask it over and over again</td></tr><tr id="19" style="display: none;" colspan="3"><td colspan="3"><h2>peers should know whether their torrent is paused or not,
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(28)">../src/session_impl.cpp:4178</a></td><td>peers should know whether their torrent is paused or not, instead of having to ask it over and over again</td></tr><tr id="28" style="display: none;" colspan="3"><td colspan="3"><h2>peers should know whether their torrent is paused or not,
│ │ │ │  instead of having to ask it over and over again</h2><h4>../src/session_impl.cpp:4178</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// collect the currently optimistically unchoked peers here, so we can
│ │ │ │  		// choke them when we've found new optimistic unchoke candidates.
│ │ │ │  		std::vector&lt;torrent_peer*&gt; prev_opt_unchoke;
│ │ │ │  
│ │ │ │  		for (auto&amp; i : m_connections)
│ │ │ │  		{
│ │ │ │  			peer_connection* const p = i.get();
│ │ │ │ @@ -1001,15 +1451,15 @@
│ │ │ │  		std::partial_sort(opt_unchoke.begin()
│ │ │ │  			, opt_unchoke.begin() + num_opt_unchoke
│ │ │ │  			, opt_unchoke.end()
│ │ │ │  #ifndef TORRENT_DISABLE_EXTENSIONS
│ │ │ │  			, last_optimistic_unchoke_cmp(m_ses_extensions[plugins_optimistic_unchoke_idx])
│ │ │ │  #else
│ │ │ │  			, last_optimistic_unchoke_cmp()
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(20)">../src/session_impl.cpp:4424</a></td><td>there should be a pre-calculated list of all peers eligible for unchoking</td></tr><tr id="20" style="display: none;" colspan="3"><td colspan="3"><h2>there should be a pre-calculated list of all peers eligible for
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(29)">../src/session_impl.cpp:4424</a></td><td>there should be a pre-calculated list of all peers eligible for unchoking</td></tr><tr id="29" style="display: none;" colspan="3"><td colspan="3"><h2>there should be a pre-calculated list of all peers eligible for
│ │ │ │  unchoking</h2><h4>../src/session_impl.cpp:4424</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │  
│ │ │ │  	void session_impl::recalculate_unchoke_slots()
│ │ │ │  	{
│ │ │ │  		TORRENT_ASSERT(is_single_thread());
│ │ │ │  
│ │ │ │  		time_point const now = aux::time_now();
│ │ │ │ @@ -1053,15 +1503,15 @@
│ │ │ │  					p-&gt;reset_choke_counters();
│ │ │ │  					continue;
│ │ │ │  				}
│ │ │ │  				if (pi &amp;&amp; pi-&gt;optimistically_unchoked)
│ │ │ │  				{
│ │ │ │  					m_stats_counters.inc_stats_counter(counters::num_peers_up_unchoked_optimistic, -1);
│ │ │ │  					pi-&gt;optimistically_unchoked = false;
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(21)">../src/session_impl.cpp:6136</a></td><td>use public_key here instead of std::array</td></tr><tr id="21" style="display: none;" colspan="3"><td colspan="3"><h2>use public_key here instead of std::array</h2><h4>../src/session_impl.cpp:6136</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(30)">../src/session_impl.cpp:6136</a></td><td>use public_key here instead of std::array</td></tr><tr id="30" style="display: none;" colspan="3"><td colspan="3"><h2>use public_key here instead of std::array</h2><h4>../src/session_impl.cpp:6136</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  	void session_impl::dht_get_immutable_item(sha1_hash const&amp; target)
│ │ │ │  	{
│ │ │ │  		if (!m_dht) return;
│ │ │ │  		m_dht-&gt;get_item(target, std::bind(&amp;session_impl::get_immutable_callback
│ │ │ │  			, this, target, _1));
│ │ │ │  	}
│ │ │ │  
│ │ │ │ @@ -1104,464 +1554,14 @@
│ │ │ │  				alerts.emplace_alert&lt;dht_put_alert&gt;(pk.bytes, sig.bytes
│ │ │ │  					, std::move(salt), seq.value, num);
│ │ │ │  			}
│ │ │ │  		}
│ │ │ │  
│ │ │ │  		void put_mutable_callback(dht::item&amp; i
│ │ │ │  			, std::function&lt;void(entry&amp;, std::array&lt;char, 64&gt;&amp;
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(22)">../src/peer_connection.cpp:3133</a></td><td>instead of having to ask the torrent whether it's in graceful pause mode or not, the peers should keep that state (and the torrent should update them when it enters graceful pause). When a peer enters graceful pause mode, it should cancel all outstanding requests and clear its request queue.</td></tr><tr id="22" style="display: none;" colspan="3"><td colspan="3"><h2>instead of having to ask the torrent whether it's in graceful
│ │ │ │ -pause mode or not, the peers should keep that state (and the torrent
│ │ │ │ -should update them when it enters graceful pause). When a peer enters
│ │ │ │ -graceful pause mode, it should cancel all outstanding requests and
│ │ │ │ -clear its request queue.</h2><h4>../src/peer_connection.cpp:3133</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// to disk or are in the disk write cache
│ │ │ │ -		if (picker.is_piece_finished(p.piece) &amp;&amp; !was_finished)
│ │ │ │ -		{
│ │ │ │ -#if TORRENT_USE_INVARIANT_CHECKS
│ │ │ │ -			check_postcondition post_checker2_(t, false);
│ │ │ │ -#endif
│ │ │ │ -			t-&gt;verify_piece(p.piece);
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		check_graceful_pause();
│ │ │ │ -
│ │ │ │ -		if (is_disconnecting()) return;
│ │ │ │ -
│ │ │ │ -		if (request_a_block(*t, *this))
│ │ │ │ -			m_counters.inc_stats_counter(counters::incoming_piece_picks);
│ │ │ │ -		send_block_requests();
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void peer_connection::check_graceful_pause()
│ │ │ │ -	{
│ │ │ │ -<div style="background: #ffff00" width="100%">		std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ -</div>		if (!t || !t-&gt;graceful_pause()) return;
│ │ │ │ -
│ │ │ │ -		if (m_outstanding_bytes &gt; 0) return;
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		peer_log(peer_log_alert::info, "GRACEFUL_PAUSE", "NO MORE DOWNLOAD");
│ │ │ │ -#endif
│ │ │ │ -		disconnect(errors::torrent_paused, operation_t::bittorrent);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void peer_connection::on_disk_write_complete(storage_error const&amp; error
│ │ │ │ -		, peer_request const&amp; p, std::shared_ptr&lt;torrent&gt; t)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		if (should_log(peer_log_alert::info))
│ │ │ │ -		{
│ │ │ │ -			peer_log(peer_log_alert::info, "FILE_ASYNC_WRITE_COMPLETE", "piece: %d s: %x l: %x e: %s"
│ │ │ │ -				, static_cast&lt;int&gt;(p.piece), p.start, p.length, error.ec.message().c_str());
│ │ │ │ -		}
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		m_counters.inc_stats_counter(counters::queued_write_bytes, -p.length);
│ │ │ │ -		m_outstanding_writing_bytes -= p.length;
│ │ │ │ -
│ │ │ │ -		TORRENT_ASSERT(m_outstanding_writing_bytes &gt;= 0);
│ │ │ │ -
│ │ │ │ -		// every peer is entitled to allocate a disk buffer if it has no writes outstanding
│ │ │ │ -		// see the comment in incoming_piece
│ │ │ │ -		if (m_outstanding_writing_bytes == 0
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(23)">../src/peer_connection.cpp:4044</a></td><td>once peers are properly put in graceful pause mode, they can cancel all outstanding requests and this test can be removed.</td></tr><tr id="23" style="display: none;" colspan="3"><td colspan="3"><h2>once peers are properly put in graceful pause mode, they can
│ │ │ │ -cancel all outstanding requests and this test can be removed.</h2><h4>../src/peer_connection.cpp:4044</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -			if (!p-&gt;m_deferred_send_block_requests)
│ │ │ │ -				return;
│ │ │ │ -
│ │ │ │ -			p-&gt;m_deferred_send_block_requests = false;
│ │ │ │ -			p-&gt;send_block_requests_impl();
│ │ │ │ -		});
│ │ │ │ -		m_deferred_send_block_requests = true;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void peer_connection::send_block_requests_impl()
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -		INVARIANT_CHECK;
│ │ │ │ -
│ │ │ │ -		std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ -		if (!t) return;
│ │ │ │ -
│ │ │ │ -		if (m_disconnecting) return;
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		if (t-&gt;graceful_pause()) return;
│ │ │ │ -</div>
│ │ │ │ -		// we can't download pieces in these states
│ │ │ │ -		if (t-&gt;state() == torrent_status::checking_files
│ │ │ │ -			|| t-&gt;state() == torrent_status::checking_resume_data
│ │ │ │ -			|| t-&gt;state() == torrent_status::downloading_metadata)
│ │ │ │ -			return;
│ │ │ │ -
│ │ │ │ -		if (int(m_download_queue.size()) &gt;= m_desired_queue_size
│ │ │ │ -			|| t-&gt;upload_mode()) return;
│ │ │ │ -
│ │ │ │ -		bool const empty_download_queue = m_download_queue.empty();
│ │ │ │ -
│ │ │ │ -		while (!m_request_queue.empty()
│ │ │ │ -			&amp;&amp; (int(m_download_queue.size()) &lt; m_desired_queue_size
│ │ │ │ -				|| m_queued_time_critical &gt; 0))
│ │ │ │ -		{
│ │ │ │ -			pending_block block = m_request_queue.front();
│ │ │ │ -
│ │ │ │ -			m_request_queue.erase(m_request_queue.begin());
│ │ │ │ -			if (m_queued_time_critical) --m_queued_time_critical;
│ │ │ │ -
│ │ │ │ -			// if we're a seed, we don't have a piece picker
│ │ │ │ -			// so we don't have to worry about invariants getting
│ │ │ │ -			// out of sync with it
│ │ │ │ -			if (!t-&gt;has_picker()) continue;
│ │ │ │ -
│ │ │ │ -			// this can happen if a block times out, is re-requested and
│ │ │ │ -			// then arrives "unexpectedly"
│ │ │ │ -			if (t-&gt;picker().is_downloaded(block.block))
│ │ │ │ -			{
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(24)">../src/peer_connection.cpp:4730</a></td><td>new_piece should be an optional<piece_index_t>. piece index -1 should not be allowed</td></tr><tr id="24" style="display: none;" colspan="3"><td colspan="3"><h2>new_piece should be an optional<piece_index_t>. piece index -1
│ │ │ │ -should not be allowed</h2><h4>../src/peer_connection.cpp:4730</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -		// pieces may be empty if we don't have metadata yet
│ │ │ │ -		if (p.pieces.empty())
│ │ │ │ -		{
│ │ │ │ -			p.progress = 0.f;
│ │ │ │ -			p.progress_ppm = 0;
│ │ │ │ -		}
│ │ │ │ -		else
│ │ │ │ -		{
│ │ │ │ -#if TORRENT_NO_FPU
│ │ │ │ -			p.progress = 0.f;
│ │ │ │ -#else
│ │ │ │ -			p.progress = float(p.pieces.count()) / float(p.pieces.size());
│ │ │ │ -#endif
│ │ │ │ -			p.progress_ppm = int(std::int64_t(p.pieces.count()) * 1000000 / p.pieces.size());
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_SUPERSEEDING
│ │ │ │ -<div style="background: #ffff00" width="100%">	void peer_connection::superseed_piece(piece_index_t const replace_piece
│ │ │ │ -</div>		, piece_index_t const new_piece)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -
│ │ │ │ -		if (is_connecting()) return;
│ │ │ │ -		if (in_handshake()) return;
│ │ │ │ -
│ │ │ │ -		if (new_piece == piece_index_t(-1))
│ │ │ │ -		{
│ │ │ │ -			if (m_superseed_piece[0] == piece_index_t(-1)) return;
│ │ │ │ -			m_superseed_piece[0] = piece_index_t(-1);
│ │ │ │ -			m_superseed_piece[1] = piece_index_t(-1);
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -			peer_log(peer_log_alert::info, "SUPER_SEEDING", "ending");
│ │ │ │ -#endif
│ │ │ │ -			std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ -			TORRENT_ASSERT(t);
│ │ │ │ -
│ │ │ │ -			// this will either send a full bitfield or
│ │ │ │ -			// a have-all message, effectively terminating
│ │ │ │ -			// super-seeding, since the peer may pick any piece
│ │ │ │ -			write_bitfield();
│ │ │ │ -
│ │ │ │ -			return;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		TORRENT_ASSERT(!has_piece(new_piece));
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(25)">../src/torrent.cpp:419</a></td><td>we could probably get away with just saving a few fields here</td></tr><tr id="25" style="display: none;" colspan="3"><td colspan="3"><h2>we could probably get away with just saving a few fields here</h2><h4>../src/torrent.cpp:419</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// --- V2 HASHES ---
│ │ │ │ -
│ │ │ │ -		if (m_torrent_file-&gt;is_valid() &amp;&amp; m_torrent_file-&gt;info_hashes().has_v2())
│ │ │ │ -		{
│ │ │ │ -			if (!p.merkle_trees.empty())
│ │ │ │ -				load_merkle_trees(
│ │ │ │ -					std::move(p.merkle_trees)
│ │ │ │ -					, std::move(p.merkle_tree_mask)
│ │ │ │ -					, std::move(p.verified_leaf_hashes));
│ │ │ │ -
│ │ │ │ -			// we really don't want to store extra copies of the trees
│ │ │ │ -			TORRENT_ASSERT(p.merkle_trees.empty());
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		if (valid_metadata())
│ │ │ │ -		{
│ │ │ │ -			inc_stats_counter(counters::num_total_pieces_added
│ │ │ │ -				, m_torrent_file-&gt;num_pieces());
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		m_add_torrent_params = std::make_unique&lt;add_torrent_params&gt;(std::move(p));
│ │ │ │ -</div>	}
│ │ │ │ -
│ │ │ │ -	void torrent::load_merkle_trees(
│ │ │ │ -		aux::vector&lt;std::vector&lt;sha256_hash&gt;, file_index_t&gt; trees_import
│ │ │ │ -		, aux::vector&lt;std::vector&lt;bool&gt;, file_index_t&gt; mask
│ │ │ │ -		, aux::vector&lt;std::vector&lt;bool&gt;, file_index_t&gt; verified)
│ │ │ │ -	{
│ │ │ │ -		auto const&amp; fs = m_torrent_file-&gt;orig_files();
│ │ │ │ -
│ │ │ │ -		std::vector&lt;bool&gt; const empty_verified;
│ │ │ │ -		for (file_index_t i{0}; i &lt; fs.end_file(); ++i)
│ │ │ │ -		{
│ │ │ │ -			if (fs.pad_file_at(i) || fs.file_size(i) == 0)
│ │ │ │ -				continue;
│ │ │ │ -
│ │ │ │ -			if (i &gt;= trees_import.end_index()) break;
│ │ │ │ -			std::vector&lt;bool&gt; const&amp; verified_bitmask = (i &gt;= verified.end_index()) ? empty_verified : verified[i];
│ │ │ │ -			if (i &lt; mask.end_index() &amp;&amp; !mask[i].empty())
│ │ │ │ -			{
│ │ │ │ -				mask[i].resize(m_merkle_trees[i].size(), false);
│ │ │ │ -				m_merkle_trees[i].load_sparse_tree(trees_import[i], mask[i], verified_bitmask);
│ │ │ │ -			}
│ │ │ │ -			else
│ │ │ │ -			{
│ │ │ │ -				m_merkle_trees[i].load_tree(trees_import[i], verified_bitmask);
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void torrent::inc_stats_counter(int c, int value)
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(26)">../src/torrent.cpp:715</a></td><td>assert there are no outstanding async operations on this torrent</td></tr><tr id="26" style="display: none;" colspan="3"><td colspan="3"><h2>assert there are no outstanding async operations on this
│ │ │ │ -torrent</h2><h4>../src/torrent.cpp:715</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#endif
│ │ │ │ -
│ │ │ │ -		if (!m_ses.dht()) return false;
│ │ │ │ -		if (m_torrent_file-&gt;is_valid() &amp;&amp; !m_files_checked) return false;
│ │ │ │ -		if (!m_announce_to_dht) return false;
│ │ │ │ -		if (m_paused) return false;
│ │ │ │ -
│ │ │ │ -		// don't announce private torrents
│ │ │ │ -		if (m_torrent_file-&gt;is_valid() &amp;&amp; m_torrent_file-&gt;priv()) return false;
│ │ │ │ -		if (m_trackers.empty()) return true;
│ │ │ │ -		if (!settings().get_bool(settings_pack::use_dht_as_fallback)) return true;
│ │ │ │ -
│ │ │ │ -		return std::none_of(m_trackers.begin(), m_trackers.end()
│ │ │ │ -			, [](aux::announce_entry const&amp; tr) { return bool(tr.verified); });
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -	torrent::~torrent()
│ │ │ │ -	{
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>#if TORRENT_USE_ASSERTS
│ │ │ │ -		for (torrent_list_index_t i{}; i != m_links.end_index(); ++i)
│ │ │ │ -		{
│ │ │ │ -			if (!m_links[i].in_list()) continue;
│ │ │ │ -			m_links[i].unlink(m_ses.torrent_list(i), i);
│ │ │ │ -		}
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		// The invariant can't be maintained here, since the torrent
│ │ │ │ -		// is being destructed, all weak references to it have been
│ │ │ │ -		// reset, which means that all its peers already have an
│ │ │ │ -		// invalidated torrent pointer (so it cannot be verified to be correct)
│ │ │ │ -
│ │ │ │ -		// i.e. the invariant can only be maintained if all connections have
│ │ │ │ -		// been closed by the time the torrent is destructed. And they are
│ │ │ │ -		// supposed to be closed. So we can still do the invariant check.
│ │ │ │ -
│ │ │ │ -		// however, the torrent object may be destructed from the main
│ │ │ │ -		// thread when shutting down, if the disk cache has references to it.
│ │ │ │ -		// this means that the invariant check that this is called from the
│ │ │ │ -		// network thread cannot be maintained
│ │ │ │ -
│ │ │ │ -		TORRENT_ASSERT(m_peer_class == peer_class_t{0});
│ │ │ │ -		TORRENT_ASSERT(m_connections.empty());
│ │ │ │ -		// just in case, make sure the session accounting is kept right
│ │ │ │ -		for (auto p : m_connections)
│ │ │ │ -			m_ses.close_connection(p);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void torrent::read_piece(piece_index_t const piece)
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(27)">../src/torrent.cpp:1331</a></td><td>there's some duplication between this function and peer_connection::incoming_piece(). is there a way to merge something?</td></tr><tr id="27" style="display: none;" colspan="3"><td colspan="3"><h2>there's some duplication between this function and
│ │ │ │ -peer_connection::incoming_piece(). is there a way to merge something?</h2><h4>../src/torrent.cpp:1331</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		piece_index_t m_piece;
│ │ │ │ -		bool m_armed = true;
│ │ │ │ -	};
│ │ │ │ -
│ │ │ │ -	void torrent::add_piece_async(piece_index_t const piece
│ │ │ │ -		, std::vector&lt;char&gt; data, add_piece_flags_t const flags)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -
│ │ │ │ -		// make sure the piece index is correct
│ │ │ │ -		if (piece &gt;= torrent_file().end_piece())
│ │ │ │ -			return;
│ │ │ │ -
│ │ │ │ -		// make sure the piece size is correct
│ │ │ │ -		if (data.size() != std::size_t(m_torrent_file-&gt;piece_size(piece)))
│ │ │ │ -			return;
│ │ │ │ -
│ │ │ │ -		add_piece(piece, data.data(), flags);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	void torrent::add_piece(piece_index_t const piece, char const* data
│ │ │ │ -</div>		, add_piece_flags_t const flags)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -
│ │ │ │ -		// make sure the piece index is correct
│ │ │ │ -		if (piece &gt;= torrent_file().end_piece())
│ │ │ │ -			return;
│ │ │ │ -
│ │ │ │ -		int const piece_size = m_torrent_file-&gt;piece_size(piece);
│ │ │ │ -		int const blocks_in_piece = (piece_size + block_size() - 1) / block_size();
│ │ │ │ -
│ │ │ │ -		if (m_deleted) return;
│ │ │ │ -
│ │ │ │ -		// avoid crash trying to access the picker when there is none
│ │ │ │ -		if (m_have_all &amp;&amp; !has_picker()) return;
│ │ │ │ -
│ │ │ │ -		// we don't support clobbering the piece picker while checking the
│ │ │ │ -		// files. We may end up having the same piece multiple times
│ │ │ │ -		TORRENT_ASSERT_PRECOND(state() != torrent_status::checking_files
│ │ │ │ -			&amp;&amp; state() != torrent_status::checking_resume_data);
│ │ │ │ -		if (state() == torrent_status::checking_files
│ │ │ │ -			|| state() == torrent_status::checking_resume_data)
│ │ │ │ -			return;
│ │ │ │ -
│ │ │ │ -		need_picker();
│ │ │ │ -
│ │ │ │ -		if (picker().have_piece(piece)
│ │ │ │ -			&amp;&amp; !(flags &amp; torrent_handle::overwrite_existing))
│ │ │ │ -			return;
│ │ │ │ -
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(28)">../src/torrent.cpp:3966</a></td><td>this could probably be pulled out into a free function</td></tr><tr id="28" style="display: none;" colspan="3"><td colspan="3"><h2>this could probably be pulled out into a free function</h2><h4>../src/torrent.cpp:3966</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	std::int64_t calc_bytes(file_storage const&amp; fs, piece_count const&amp; pc)
│ │ │ │ -	{
│ │ │ │ -		// it's an impossible combination to have 0 pieces, but still have one of them be the last piece
│ │ │ │ -		TORRENT_ASSERT(!(pc.num_pieces == 0 &amp;&amp; pc.last_piece == true));
│ │ │ │ -
│ │ │ │ -		// if we have 0 pieces, we can't have any pad blocks either
│ │ │ │ -		TORRENT_ASSERT(!(pc.num_pieces == 0 &amp;&amp; pc.pad_bytes &gt; 0));
│ │ │ │ -
│ │ │ │ -		// if we have all pieces, we must also have the last one
│ │ │ │ -		TORRENT_ASSERT(!(pc.num_pieces == fs.num_pieces() &amp;&amp; pc.last_piece == false));
│ │ │ │ -
│ │ │ │ -		// every block should not be a pad block
│ │ │ │ -		TORRENT_ASSERT(pc.pad_bytes &lt;= std::int64_t(pc.num_pieces) * fs.piece_length());
│ │ │ │ -
│ │ │ │ -		return std::int64_t(pc.num_pieces) * fs.piece_length()
│ │ │ │ -			- (pc.last_piece ? fs.piece_length() - fs.piece_size(fs.last_piece()) : 0)
│ │ │ │ -			- std::int64_t(pc.pad_bytes);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	// fills in total_wanted, total_wanted_done and total_done
│ │ │ │ -<div style="background: #ffff00" width="100%">	void torrent::bytes_done(torrent_status&amp; st, status_flags_t const flags) const
│ │ │ │ -</div>	{
│ │ │ │ -		INVARIANT_CHECK;
│ │ │ │ -
│ │ │ │ -		st.total_done = 0;
│ │ │ │ -		st.total_wanted_done = 0;
│ │ │ │ -		st.total_wanted = m_size_on_disk;
│ │ │ │ -
│ │ │ │ -		TORRENT_ASSERT(st.total_wanted &lt;= m_torrent_file-&gt;total_size());
│ │ │ │ -		TORRENT_ASSERT(st.total_wanted &gt;= 0);
│ │ │ │ -
│ │ │ │ -		TORRENT_ASSERT(!valid_metadata() || m_torrent_file-&gt;num_pieces() &gt; 0);
│ │ │ │ -		if (!valid_metadata()) return;
│ │ │ │ -
│ │ │ │ -		if (m_seed_mode || is_seed())
│ │ │ │ -		{
│ │ │ │ -			// once we're a seed and remove the piece picker, we stop tracking
│ │ │ │ -			// piece- and file priority. We consider everything as being
│ │ │ │ -			// "wanted"
│ │ │ │ -			st.total_done = m_torrent_file-&gt;total_size() - m_padding_bytes;
│ │ │ │ -			st.total_wanted_done = m_size_on_disk;
│ │ │ │ -			st.total_wanted = m_size_on_disk;
│ │ │ │ -			TORRENT_ASSERT(st.total_wanted &lt;= st.total_done);
│ │ │ │ -			TORRENT_ASSERT(st.total_wanted_done &lt;= st.total_wanted);
│ │ │ │ -			TORRENT_ASSERT(st.total_done &lt;= m_torrent_file-&gt;total_size());
│ │ │ │ -			return;
│ │ │ │ -		}
│ │ │ │ -		else if (!has_picker())
│ │ │ │ -		{
│ │ │ │ -			st.total_done = 0;
│ │ │ │ -			st.total_wanted_done = 0;
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(29)">../src/torrent.cpp:4905</a></td><td>should this alert have an error code in it?</td></tr><tr id="29" style="display: none;" colspan="3"><td colspan="3"><h2>should this alert have an error code in it?</h2><h4>../src/torrent.cpp:4905</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		on_remove_peers();
│ │ │ │ -		TORRENT_ASSERT(m_connections.empty());
│ │ │ │ -
│ │ │ │ -		// post a message to the main thread to destruct
│ │ │ │ -		// the torrent object from there
│ │ │ │ -		if (m_storage)
│ │ │ │ -		{
│ │ │ │ -			try {
│ │ │ │ -				m_ses.disk_thread().async_stop_torrent(m_storage
│ │ │ │ -					, std::bind(&amp;torrent::on_torrent_aborted, shared_from_this()));
│ │ │ │ -			}
│ │ │ │ -			catch (std::exception const&amp; e)
│ │ │ │ -			{
│ │ │ │ -				TORRENT_UNUSED(e);
│ │ │ │ -				m_storage.reset();
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -				debug_log("Failed to flush disk cache: %s", e.what());
│ │ │ │ -#endif
│ │ │ │ -				// clients may rely on this alert to be posted, so it's probably a
│ │ │ │ -				// good idea to post it here, even though we failed
│ │ │ │ -<div style="background: #ffff00" width="100%">				if (alerts().should_post&lt;cache_flushed_alert&gt;())
│ │ │ │ -</div>					alerts().emplace_alert&lt;cache_flushed_alert&gt;(get_handle());
│ │ │ │ -			}
│ │ │ │ -			m_ses.deferred_submit_jobs();
│ │ │ │ -		}
│ │ │ │ -		else
│ │ │ │ -		{
│ │ │ │ -			if (alerts().should_post&lt;cache_flushed_alert&gt;())
│ │ │ │ -				alerts().emplace_alert&lt;cache_flushed_alert&gt;(get_handle());
│ │ │ │ -			alerts().emplace_alert&lt;torrent_removed_alert&gt;(get_handle()
│ │ │ │ -				, info_hash(), get_userdata());
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(30)">../src/torrent.cpp:4975</a></td><td>this should return optional<>. piece index -1 should not be allowed</td></tr><tr id="30" style="display: none;" colspan="3"><td colspan="3"><h2>this should return optional<>. piece index -1 should not be
│ │ │ │ -allowed</h2><h4>../src/torrent.cpp:4975</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_SUPERSEEDING
│ │ │ │ -	void torrent::set_super_seeding(bool const on)
│ │ │ │ -	{
│ │ │ │ -		if (on == m_super_seeding) return;
│ │ │ │ -
│ │ │ │ -		m_super_seeding = on;
│ │ │ │ -		set_need_save_resume(torrent_handle::if_state_changed);
│ │ │ │ -		state_updated();
│ │ │ │ -
│ │ │ │ -		if (m_super_seeding) return;
│ │ │ │ -
│ │ │ │ -		// disable super seeding for all peers
│ │ │ │ -		for (auto pc : *this)
│ │ │ │ -		{
│ │ │ │ -			pc-&gt;superseed_piece(piece_index_t(-1), piece_index_t(-1));
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	piece_index_t torrent::get_piece_to_super_seed(typed_bitfield&lt;piece_index_t&gt; const&amp; bits)
│ │ │ │ -</div>	{
│ │ │ │ -		// return a piece with low availability that is not in
│ │ │ │ -		// the bitfield and that is not currently being super
│ │ │ │ -		// seeded by any peer
│ │ │ │ -		TORRENT_ASSERT(m_super_seeding);
│ │ │ │ -
│ │ │ │ -		// do a linear search from the first piece
│ │ │ │ -		int min_availability = 9999;
│ │ │ │ -		std::vector&lt;piece_index_t&gt; avail_vec;
│ │ │ │ -		for (auto const i : m_torrent_file-&gt;piece_range())
│ │ │ │ -		{
│ │ │ │ -			if (bits[i]) continue;
│ │ │ │ -
│ │ │ │ -			int availability = 0;
│ │ │ │ -			for (auto pc : *this)
│ │ │ │ -			{
│ │ │ │ -				if (pc-&gt;super_seeded_piece(i))
│ │ │ │ -				{
│ │ │ │ -					// avoid super-seeding the same piece to more than one
│ │ │ │ -					// peer if we can avoid it. Do this by artificially
│ │ │ │ -					// increase the availability
│ │ │ │ -					availability = 999;
│ │ │ │ -					break;
│ │ │ │ -				}
│ │ │ │ -				if (pc-&gt;has_piece(i)) ++availability;
│ │ │ │ -			}
│ │ │ │ -			if (availability &gt; min_availability) continue;
│ │ │ │ -			if (availability == min_availability)
│ │ │ │ -			{
│ │ │ │ -				avail_vec.push_back(i);
│ │ │ │  </pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(31)">../src/kademlia/rpc_manager.cpp:71</a></td><td>move this into it's own .cpp file</td></tr><tr id="31" style="display: none;" colspan="3"><td colspan="3"><h2>move this into it's own .cpp file</h2><h4>../src/kademlia/rpc_manager.cpp:71</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include &lt;libtorrent/kademlia/get_item.hpp&gt;
│ │ │ │  #include &lt;libtorrent/kademlia/sample_infohashes.hpp&gt;
│ │ │ │  #include &lt;libtorrent/aux_/session_settings.hpp&gt;
│ │ │ │  
│ │ │ │  #include &lt;libtorrent/socket_io.hpp&gt; // for print_endpoint
│ │ │ │  #include &lt;libtorrent/aux_/time.hpp&gt; // for aux::time_now
│ │ │ │  #include &lt;libtorrent/aux_/aligned_union.hpp&gt;
│ │ │ │ @@ -1605,118 +1605,15 @@
│ │ │ │  	}
│ │ │ │  	else
│ │ │ │  	{
│ │ │ │  		flags &amp;= ~flag_ipv6_address;
│ │ │ │  		m_addr.v4 = ep.address().to_v4().to_bytes();
│ │ │ │  	}
│ │ │ │  }
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(32)">../include/libtorrent/torrent_handle.hpp:535</a></td><td>unify url_seed and http_seed with just web_seed, using the web_seed_entry.</td></tr><tr id="32" style="display: none;" colspan="3"><td colspan="3"><h2>unify url_seed and http_seed with just web_seed, using the
│ │ │ │ -web_seed_entry.</h2><h4>../include/libtorrent/torrent_handle.hpp:535</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// one returned from ``trackers()`` and will replace it. If you want an
│ │ │ │ -		// immediate effect, you have to call force_reannounce(). See
│ │ │ │ -		// announce_entry.
│ │ │ │ -		//
│ │ │ │ -		// ``post_trackers()`` is the asynchronous version of ``trackers()``. It
│ │ │ │ -		// will trigger a tracker_list_alert to be posted.
│ │ │ │ -		//
│ │ │ │ -		// ``add_tracker()`` will look if the specified tracker is already in the
│ │ │ │ -		// set. If it is, it doesn't do anything. If it's not in the current set
│ │ │ │ -		// of trackers, it will insert it in the tier specified in the
│ │ │ │ -		// announce_entry.
│ │ │ │ -		//
│ │ │ │ -		// The updated set of trackers will be saved in the resume data, and when
│ │ │ │ -		// a torrent is started with resume data, the trackers from the resume
│ │ │ │ -		// data will replace the original ones.
│ │ │ │ -		std::vector&lt;announce_entry&gt; trackers() const;
│ │ │ │ -		void replace_trackers(std::vector&lt;announce_entry&gt; const&amp;) const;
│ │ │ │ -		void add_tracker(announce_entry const&amp;) const;
│ │ │ │ -		void post_trackers() const;
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>		// ``add_url_seed()`` adds another url to the torrent's list of url
│ │ │ │ -		// seeds. If the given url already exists in that list, the call has no
│ │ │ │ -		// effect. The torrent will connect to the server and try to download
│ │ │ │ -		// pieces from it, unless it's paused, queued, checking or seeding.
│ │ │ │ -		// ``remove_url_seed()`` removes the given url if it exists already.
│ │ │ │ -		// ``url_seeds()`` return a set of the url seeds currently in this
│ │ │ │ -		// torrent. Note that URLs that fails may be removed automatically from
│ │ │ │ -		// the list.
│ │ │ │ -		//
│ │ │ │ -		// See http-seeding_ for more information.
│ │ │ │ -		void add_url_seed(std::string const&amp; url) const;
│ │ │ │ -		void remove_url_seed(std::string const&amp; url) const;
│ │ │ │ -		std::set&lt;std::string&gt; url_seeds() const;
│ │ │ │ -
│ │ │ │ -		// These functions are identical as the ``*_url_seed()`` variants, but
│ │ │ │ -		// they operate on `BEP 17`_ web seeds instead of `BEP 19`_.
│ │ │ │ -		//
│ │ │ │ -		// See http-seeding_ for more information.
│ │ │ │ -		void add_http_seed(std::string const&amp; url) const;
│ │ │ │ -		void remove_http_seed(std::string const&amp; url) const;
│ │ │ │ -		std::set&lt;std::string&gt; http_seeds() const;
│ │ │ │ -
│ │ │ │ -		// add the specified extension to this torrent. The ``ext`` argument is
│ │ │ │ -		// a function that will be called from within libtorrent's context
│ │ │ │ -		// passing in the internal torrent object and the specified userdata
│ │ │ │ -		// pointer. The function is expected to return a shared pointer to
│ │ │ │ -		// a torrent_plugin instance.
│ │ │ │ -		void add_extension(
│ │ │ │ -			std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(torrent_handle const&amp;, client_data_t)&gt; const&amp; ext
│ │ │ │ -			, client_data_t userdata = client_data_t{});
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(33)">../include/libtorrent/pe_crypto.hpp:72</a></td><td>dh_key_exchange should probably move into its own file</td></tr><tr id="33" style="display: none;" colspan="3"><td colspan="3"><h2>dh_key_exchange should probably move into its own file</h2><h4>../include/libtorrent/pe_crypto.hpp:72</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -#include &lt;list&gt;
│ │ │ │ -#include &lt;array&gt;
│ │ │ │ -#include &lt;cstdint&gt;
│ │ │ │ -
│ │ │ │ -namespace libtorrent {
│ │ │ │ -
│ │ │ │ -	namespace mp = boost::multiprecision;
│ │ │ │ -
│ │ │ │ -	using key_t = mp::number&lt;mp::cpp_int_backend&lt;768, 768, mp::unsigned_magnitude, mp::unchecked, void&gt;&gt;;
│ │ │ │ -
│ │ │ │ -	TORRENT_EXTRA_EXPORT std::array&lt;char, 96&gt; export_key(key_t const&amp; k);
│ │ │ │ -
│ │ │ │ -	// RC4 state from libtomcrypt
│ │ │ │ -	struct rc4 {
│ │ │ │ -		int x;
│ │ │ │ -		int y;
│ │ │ │ -		aux::array&lt;std::uint8_t, 256&gt; buf;
│ │ │ │ -	};
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	class TORRENT_EXTRA_EXPORT dh_key_exchange
│ │ │ │ -</div>	{
│ │ │ │ -	public:
│ │ │ │ -		dh_key_exchange();
│ │ │ │ -
│ │ │ │ -		// Get local public key
│ │ │ │ -		key_t const&amp; get_local_key() const { return m_dh_local_key; }
│ │ │ │ -
│ │ │ │ -		// read remote_pubkey, generate and store shared secret in
│ │ │ │ -		// m_dh_shared_secret.
│ │ │ │ -		void compute_secret(std::uint8_t const* remote_pubkey);
│ │ │ │ -		void compute_secret(key_t const&amp; remote_pubkey);
│ │ │ │ -
│ │ │ │ -		key_t const&amp; get_secret() const { return m_dh_shared_secret; }
│ │ │ │ -
│ │ │ │ -		sha1_hash const&amp; get_hash_xor_mask() const { return m_xor_mask; }
│ │ │ │ -
│ │ │ │ -	private:
│ │ │ │ -
│ │ │ │ -		key_t m_dh_local_key;
│ │ │ │ -		key_t m_dh_local_secret;
│ │ │ │ -		key_t m_dh_shared_secret;
│ │ │ │ -		sha1_hash m_xor_mask;
│ │ │ │ -	};
│ │ │ │ -
│ │ │ │ -	struct TORRENT_EXTRA_EXPORT encryption_handler
│ │ │ │ -	{
│ │ │ │ -		std::tuple&lt;int, span&lt;span&lt;char const&gt;&gt;&gt;
│ │ │ │ -		encrypt(span&lt;span&lt;char&gt;&gt; iovec);
│ │ │ │ -
│ │ │ │ -		int decrypt(aux::crypto_receive_buffer&amp; recv_buffer
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(34)">../include/libtorrent/torrent.hpp:1423</a></td><td>factor out predictive pieces and all operations on it into a separate class (to use as member here instead)</td></tr><tr id="34" style="display: none;" colspan="3"><td colspan="3"><h2>factor out predictive pieces and all operations on it into a
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(32)">../include/libtorrent/torrent.hpp:1423</a></td><td>factor out predictive pieces and all operations on it into a separate class (to use as member here instead)</td></tr><tr id="32" style="display: none;" colspan="3"><td colspan="3"><h2>factor out predictive pieces and all operations on it into a
│ │ │ │  separate class (to use as member here instead)</h2><h4>../include/libtorrent/torrent.hpp:1423</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#endif
│ │ │ │  
│ │ │ │  		std::string m_trackerid;
│ │ │ │  #if TORRENT_ABI_VERSION == 1
│ │ │ │  		// deprecated in 1.1
│ │ │ │  		std::string m_username;
│ │ │ │  		std::string m_password;
│ │ │ │ @@ -1760,15 +1657,15 @@
│ │ │ │  		// cycle, and not in the constructor. So we need to save if away here
│ │ │ │  		std::unique_ptr&lt;add_torrent_params&gt; m_add_torrent_params;
│ │ │ │  
│ │ │ │  		// if the torrent is started without metadata, it may
│ │ │ │  		// still be given a name until the metadata is received
│ │ │ │  		// once the metadata is received this field will no
│ │ │ │  		// longer be used and will be reset
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(35)">../include/libtorrent/torrent.hpp:1483</a></td><td>factor out the links (as well as update_list() to a separate class that torrent can inherit)</td></tr><tr id="35" style="display: none;" colspan="3"><td colspan="3"><h2>factor out the links (as well as update_list() to a separate
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(33)">../include/libtorrent/torrent.hpp:1483</a></td><td>factor out the links (as well as update_list() to a separate class that torrent can inherit)</td></tr><tr id="33" style="display: none;" colspan="3"><td colspan="3"><h2>factor out the links (as well as update_list() to a separate
│ │ │ │  class that torrent can inherit)</h2><h4>../include/libtorrent/torrent.hpp:1483</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  		// this was the last time _we_ saw a seed in this swarm
│ │ │ │  		std::time_t m_last_seen_complete = 0;
│ │ │ │  
│ │ │ │  		// this is the time last any of our peers saw a seed
│ │ │ │  		// in this swarm
│ │ │ │  		std::time_t m_swarm_last_seen_complete = 0;
│ │ │ │ @@ -1812,65 +1709,118 @@
│ │ │ │  
│ │ │ │  		// the number of pieces we completed the check of
│ │ │ │  		piece_index_t m_num_checked_pieces{0};
│ │ │ │  
│ │ │ │  		// if the error occurred on a file, this is the index of that file
│ │ │ │  		// there are a few special cases, when this is negative. See
│ │ │ │  		// set_error()
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(36)">../include/libtorrent/stat.hpp:257</a></td><td>everything but payload counters and rates could probably be removed from here</td></tr><tr id="36" style="display: none;" colspan="3"><td colspan="3"><h2>everything but payload counters and rates could probably be
│ │ │ │ -removed from here</h2><h4>../include/libtorrent/stat.hpp:257</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// peer_connection is opened and have some previous
│ │ │ │ -		// transfers from earlier connections.
│ │ │ │ -		void add_stat(std::int64_t downloaded, std::int64_t uploaded)
│ │ │ │ -		{
│ │ │ │ -			m_stat[download_payload].offset(downloaded);
│ │ │ │ -			m_stat[upload_payload].offset(uploaded);
│ │ │ │ -		}
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(34)">../include/libtorrent/enum_net.hpp:164</a></td><td>use string_view for device_name</td></tr><tr id="34" style="display: none;" colspan="3"><td colspan="3"><h2>use string_view for device_name</h2><h4>../include/libtorrent/enum_net.hpp:164</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	// return nullopt.
│ │ │ │ +	TORRENT_EXTRA_EXPORT boost::optional&lt;address&gt; get_gateway(
│ │ │ │ +		ip_interface const&amp; iface, span&lt;ip_route const&gt; routes);
│ │ │ │  
│ │ │ │ -		int last_payload_downloaded() const
│ │ │ │ -		{ return m_stat[download_payload].counter(); }
│ │ │ │ -		int last_payload_uploaded() const
│ │ │ │ -		{ return m_stat[upload_payload].counter(); }
│ │ │ │ -		int last_protocol_downloaded() const
│ │ │ │ -		{ return m_stat[download_protocol].counter(); }
│ │ │ │ -		int last_protocol_uploaded() const
│ │ │ │ -		{ return m_stat[upload_protocol].counter(); }
│ │ │ │ +	// returns whether there is a route to the specified device for for any global
│ │ │ │ +	// internet address of the specified address family.
│ │ │ │ +	TORRENT_EXTRA_EXPORT bool has_internet_route(string_view device, int family
│ │ │ │ +		, span&lt;ip_route const&gt; routes);
│ │ │ │  
│ │ │ │ -		// these are the channels we keep stats for
│ │ │ │ -		enum
│ │ │ │ -		{
│ │ │ │ -<div style="background: #ffff00" width="100%">			upload_payload,
│ │ │ │ -</div>			upload_protocol,
│ │ │ │ -			download_payload,
│ │ │ │ -			download_protocol,
│ │ │ │ -			upload_ip_protocol,
│ │ │ │ -			download_ip_protocol,
│ │ │ │ -			num_channels
│ │ │ │ -		};
│ │ │ │ +	// returns whether there are *any* routes to the internet in the routing
│ │ │ │ +	// table. This can be used to determine if the routing table is fully
│ │ │ │ +	// populated or not.
│ │ │ │ +	TORRENT_EXTRA_EXPORT bool has_any_internet_route(span&lt;ip_route const&gt; routes);
│ │ │ │  
│ │ │ │ -		void clear()
│ │ │ │ -		{
│ │ │ │ -			for (int i = 0; i &lt; num_channels; ++i)
│ │ │ │ -				m_stat[i].clear();
│ │ │ │ -		}
│ │ │ │ +	// attempt to bind socket to the device with the specified name. For systems
│ │ │ │ +	// that don't support SO_BINDTODEVICE the socket will be bound to one of the
│ │ │ │ +	// IP addresses of the specified device. In this case it is necessary to
│ │ │ │ +	// verify the local endpoint of the socket once the connection is established.
│ │ │ │ +	// the returned address is the ip the socket was bound to (or address_v4::any()
│ │ │ │ +	// in case SO_BINDTODEVICE succeeded and we don't need to verify it).
│ │ │ │ +<div style="background: #ffff00" width="100%">	template &lt;class Socket&gt;
│ │ │ │ +</div>	address bind_socket_to_device(io_context&amp; ios, Socket&amp; sock
│ │ │ │ +		, tcp const&amp; protocol
│ │ │ │ +		, char const* device_name, int port, error_code&amp; ec)
│ │ │ │ +	{
│ │ │ │ +		tcp::endpoint bind_ep(address_v4::any(), std::uint16_t(port));
│ │ │ │  
│ │ │ │ -		stat_channel const&amp; operator[](int i) const
│ │ │ │ +		address ip = make_address(device_name, ec);
│ │ │ │ +		if (!ec)
│ │ │ │  		{
│ │ │ │ -			TORRENT_ASSERT(i &gt;= 0 &amp;&amp; i &lt; num_channels);
│ │ │ │ -			return m_stat[i];
│ │ │ │ +			// this is to cover the case where "0.0.0.0" is considered any IPv4 or
│ │ │ │ +			// IPv6 address. If we're asking to be bound to an IPv6 address and
│ │ │ │ +			// providing 0.0.0.0 as the device, turn it into "::"
│ │ │ │ +			if (ip == address_v4::any() &amp;&amp; protocol == boost::asio::ip::tcp::v6())
│ │ │ │ +				ip = address_v6::any();
│ │ │ │ +			bind_ep.address(ip);
│ │ │ │ +			// it appears to be an IP. Just bind to that address
│ │ │ │ +			sock.bind(bind_ep, ec);
│ │ │ │ +			return bind_ep.address();
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -	private:
│ │ │ │ +		ec.clear();
│ │ │ │  
│ │ │ │ -		stat_channel m_stat[num_channels];
│ │ │ │ -	};
│ │ │ │ +#if TORRENT_HAS_BINDTODEVICE
│ │ │ │ +		// try to use SO_BINDTODEVICE here, if that exists. If it fails,
│ │ │ │ +		// fall back to the mechanism we have below
│ │ │ │ +		aux::bind_device(sock, device_name, ec);
│ │ │ │ +		if (ec)
│ │ │ │ +#endif
│ │ │ │ +		{
│ │ │ │ +			ec.clear();
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(35)">../include/libtorrent/torrent_handle.hpp:535</a></td><td>unify url_seed and http_seed with just web_seed, using the web_seed_entry.</td></tr><tr id="35" style="display: none;" colspan="3"><td colspan="3"><h2>unify url_seed and http_seed with just web_seed, using the
│ │ │ │ +web_seed_entry.</h2><h4>../include/libtorrent/torrent_handle.hpp:535</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// one returned from ``trackers()`` and will replace it. If you want an
│ │ │ │ +		// immediate effect, you have to call force_reannounce(). See
│ │ │ │ +		// announce_entry.
│ │ │ │ +		//
│ │ │ │ +		// ``post_trackers()`` is the asynchronous version of ``trackers()``. It
│ │ │ │ +		// will trigger a tracker_list_alert to be posted.
│ │ │ │ +		//
│ │ │ │ +		// ``add_tracker()`` will look if the specified tracker is already in the
│ │ │ │ +		// set. If it is, it doesn't do anything. If it's not in the current set
│ │ │ │ +		// of trackers, it will insert it in the tier specified in the
│ │ │ │ +		// announce_entry.
│ │ │ │ +		//
│ │ │ │ +		// The updated set of trackers will be saved in the resume data, and when
│ │ │ │ +		// a torrent is started with resume data, the trackers from the resume
│ │ │ │ +		// data will replace the original ones.
│ │ │ │ +		std::vector&lt;announce_entry&gt; trackers() const;
│ │ │ │ +		void replace_trackers(std::vector&lt;announce_entry&gt; const&amp;) const;
│ │ │ │ +		void add_tracker(announce_entry const&amp;) const;
│ │ │ │ +		void post_trackers() const;
│ │ │ │  
│ │ │ │ -}
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>		// ``add_url_seed()`` adds another url to the torrent's list of url
│ │ │ │ +		// seeds. If the given url already exists in that list, the call has no
│ │ │ │ +		// effect. The torrent will connect to the server and try to download
│ │ │ │ +		// pieces from it, unless it's paused, queued, checking or seeding.
│ │ │ │ +		// ``remove_url_seed()`` removes the given url if it exists already.
│ │ │ │ +		// ``url_seeds()`` return a set of the url seeds currently in this
│ │ │ │ +		// torrent. Note that URLs that fails may be removed automatically from
│ │ │ │ +		// the list.
│ │ │ │ +		//
│ │ │ │ +		// See http-seeding_ for more information.
│ │ │ │ +		void add_url_seed(std::string const&amp; url) const;
│ │ │ │ +		void remove_url_seed(std::string const&amp; url) const;
│ │ │ │ +		std::set&lt;std::string&gt; url_seeds() const;
│ │ │ │  
│ │ │ │ -#endif // TORRENT_STAT_HPP_INCLUDED
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(37)">../include/libtorrent/web_peer_connection.hpp:119</a></td><td>if we make this be a disk_buffer_holder instead we would save a copy use allocate_disk_receive_buffer and release_disk_receive_buffer</td></tr><tr id="37" style="display: none;" colspan="3"><td colspan="3"><h2>if we make this be a disk_buffer_holder instead
│ │ │ │ +		// These functions are identical as the ``*_url_seed()`` variants, but
│ │ │ │ +		// they operate on `BEP 17`_ web seeds instead of `BEP 19`_.
│ │ │ │ +		//
│ │ │ │ +		// See http-seeding_ for more information.
│ │ │ │ +		void add_http_seed(std::string const&amp; url) const;
│ │ │ │ +		void remove_http_seed(std::string const&amp; url) const;
│ │ │ │ +		std::set&lt;std::string&gt; http_seeds() const;
│ │ │ │ +
│ │ │ │ +		// add the specified extension to this torrent. The ``ext`` argument is
│ │ │ │ +		// a function that will be called from within libtorrent's context
│ │ │ │ +		// passing in the internal torrent object and the specified userdata
│ │ │ │ +		// pointer. The function is expected to return a shared pointer to
│ │ │ │ +		// a torrent_plugin instance.
│ │ │ │ +		void add_extension(
│ │ │ │ +			std::function&lt;std::shared_ptr&lt;torrent_plugin&gt;(torrent_handle const&amp;, client_data_t)&gt; const&amp; ext
│ │ │ │ +			, client_data_t userdata = client_data_t{});
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(36)">../include/libtorrent/web_peer_connection.hpp:119</a></td><td>if we make this be a disk_buffer_holder instead we would save a copy use allocate_disk_receive_buffer and release_disk_receive_buffer</td></tr><tr id="36" style="display: none;" colspan="3"><td colspan="3"><h2>if we make this be a disk_buffer_holder instead
│ │ │ │  we would save a copy
│ │ │ │  use allocate_disk_receive_buffer and release_disk_receive_buffer</h2><h4>../include/libtorrent/web_peer_connection.hpp:119</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		piece_block_progress downloading_piece_progress() const override;
│ │ │ │  
│ │ │ │  		void handle_padfile();
│ │ │ │  
│ │ │ │  		// this has one entry per http-request
│ │ │ │  		// (might be more than the bt requests)
│ │ │ │ @@ -1910,65 +1860,115 @@
│ │ │ │  		// the number of responses we've received so far on
│ │ │ │  		// this connection
│ │ │ │  		int m_num_responses;
│ │ │ │  	};
│ │ │ │  }
│ │ │ │  
│ │ │ │  #endif // TORRENT_WEB_PEER_CONNECTION_HPP_INCLUDED
│ │ │ │ -</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(38)">../include/libtorrent/enum_net.hpp:164</a></td><td>use string_view for device_name</td></tr><tr id="38" style="display: none;" colspan="3"><td colspan="3"><h2>use string_view for device_name</h2><h4>../include/libtorrent/enum_net.hpp:164</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	// return nullopt.
│ │ │ │ -	TORRENT_EXTRA_EXPORT boost::optional&lt;address&gt; get_gateway(
│ │ │ │ -		ip_interface const&amp; iface, span&lt;ip_route const&gt; routes);
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(37)">../include/libtorrent/pe_crypto.hpp:72</a></td><td>dh_key_exchange should probably move into its own file</td></tr><tr id="37" style="display: none;" colspan="3"><td colspan="3"><h2>dh_key_exchange should probably move into its own file</h2><h4>../include/libtorrent/pe_crypto.hpp:72</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +#include &lt;list&gt;
│ │ │ │ +#include &lt;array&gt;
│ │ │ │ +#include &lt;cstdint&gt;
│ │ │ │  
│ │ │ │ -	// returns whether there is a route to the specified device for for any global
│ │ │ │ -	// internet address of the specified address family.
│ │ │ │ -	TORRENT_EXTRA_EXPORT bool has_internet_route(string_view device, int family
│ │ │ │ -		, span&lt;ip_route const&gt; routes);
│ │ │ │ +namespace libtorrent {
│ │ │ │  
│ │ │ │ -	// returns whether there are *any* routes to the internet in the routing
│ │ │ │ -	// table. This can be used to determine if the routing table is fully
│ │ │ │ -	// populated or not.
│ │ │ │ -	TORRENT_EXTRA_EXPORT bool has_any_internet_route(span&lt;ip_route const&gt; routes);
│ │ │ │ +	namespace mp = boost::multiprecision;
│ │ │ │  
│ │ │ │ -	// attempt to bind socket to the device with the specified name. For systems
│ │ │ │ -	// that don't support SO_BINDTODEVICE the socket will be bound to one of the
│ │ │ │ -	// IP addresses of the specified device. In this case it is necessary to
│ │ │ │ -	// verify the local endpoint of the socket once the connection is established.
│ │ │ │ -	// the returned address is the ip the socket was bound to (or address_v4::any()
│ │ │ │ -	// in case SO_BINDTODEVICE succeeded and we don't need to verify it).
│ │ │ │ -<div style="background: #ffff00" width="100%">	template &lt;class Socket&gt;
│ │ │ │ -</div>	address bind_socket_to_device(io_context&amp; ios, Socket&amp; sock
│ │ │ │ -		, tcp const&amp; protocol
│ │ │ │ -		, char const* device_name, int port, error_code&amp; ec)
│ │ │ │ +	using key_t = mp::number&lt;mp::cpp_int_backend&lt;768, 768, mp::unsigned_magnitude, mp::unchecked, void&gt;&gt;;
│ │ │ │ +
│ │ │ │ +	TORRENT_EXTRA_EXPORT std::array&lt;char, 96&gt; export_key(key_t const&amp; k);
│ │ │ │ +
│ │ │ │ +	// RC4 state from libtomcrypt
│ │ │ │ +	struct rc4 {
│ │ │ │ +		int x;
│ │ │ │ +		int y;
│ │ │ │ +		aux::array&lt;std::uint8_t, 256&gt; buf;
│ │ │ │ +	};
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	class TORRENT_EXTRA_EXPORT dh_key_exchange
│ │ │ │ +</div>	{
│ │ │ │ +	public:
│ │ │ │ +		dh_key_exchange();
│ │ │ │ +
│ │ │ │ +		// Get local public key
│ │ │ │ +		key_t const&amp; get_local_key() const { return m_dh_local_key; }
│ │ │ │ +
│ │ │ │ +		// read remote_pubkey, generate and store shared secret in
│ │ │ │ +		// m_dh_shared_secret.
│ │ │ │ +		void compute_secret(std::uint8_t const* remote_pubkey);
│ │ │ │ +		void compute_secret(key_t const&amp; remote_pubkey);
│ │ │ │ +
│ │ │ │ +		key_t const&amp; get_secret() const { return m_dh_shared_secret; }
│ │ │ │ +
│ │ │ │ +		sha1_hash const&amp; get_hash_xor_mask() const { return m_xor_mask; }
│ │ │ │ +
│ │ │ │ +	private:
│ │ │ │ +
│ │ │ │ +		key_t m_dh_local_key;
│ │ │ │ +		key_t m_dh_local_secret;
│ │ │ │ +		key_t m_dh_shared_secret;
│ │ │ │ +		sha1_hash m_xor_mask;
│ │ │ │ +	};
│ │ │ │ +
│ │ │ │ +	struct TORRENT_EXTRA_EXPORT encryption_handler
│ │ │ │  	{
│ │ │ │ -		tcp::endpoint bind_ep(address_v4::any(), std::uint16_t(port));
│ │ │ │ +		std::tuple&lt;int, span&lt;span&lt;char const&gt;&gt;&gt;
│ │ │ │ +		encrypt(span&lt;span&lt;char&gt;&gt; iovec);
│ │ │ │  
│ │ │ │ -		address ip = make_address(device_name, ec);
│ │ │ │ -		if (!ec)
│ │ │ │ +		int decrypt(aux::crypto_receive_buffer&amp; recv_buffer
│ │ │ │ +</pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(38)">../include/libtorrent/stat.hpp:257</a></td><td>everything but payload counters and rates could probably be removed from here</td></tr><tr id="38" style="display: none;" colspan="3"><td colspan="3"><h2>everything but payload counters and rates could probably be
│ │ │ │ +removed from here</h2><h4>../include/libtorrent/stat.hpp:257</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// peer_connection is opened and have some previous
│ │ │ │ +		// transfers from earlier connections.
│ │ │ │ +		void add_stat(std::int64_t downloaded, std::int64_t uploaded)
│ │ │ │  		{
│ │ │ │ -			// this is to cover the case where "0.0.0.0" is considered any IPv4 or
│ │ │ │ -			// IPv6 address. If we're asking to be bound to an IPv6 address and
│ │ │ │ -			// providing 0.0.0.0 as the device, turn it into "::"
│ │ │ │ -			if (ip == address_v4::any() &amp;&amp; protocol == boost::asio::ip::tcp::v6())
│ │ │ │ -				ip = address_v6::any();
│ │ │ │ -			bind_ep.address(ip);
│ │ │ │ -			// it appears to be an IP. Just bind to that address
│ │ │ │ -			sock.bind(bind_ep, ec);
│ │ │ │ -			return bind_ep.address();
│ │ │ │ +			m_stat[download_payload].offset(downloaded);
│ │ │ │ +			m_stat[upload_payload].offset(uploaded);
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -		ec.clear();
│ │ │ │ +		int last_payload_downloaded() const
│ │ │ │ +		{ return m_stat[download_payload].counter(); }
│ │ │ │ +		int last_payload_uploaded() const
│ │ │ │ +		{ return m_stat[upload_payload].counter(); }
│ │ │ │ +		int last_protocol_downloaded() const
│ │ │ │ +		{ return m_stat[download_protocol].counter(); }
│ │ │ │ +		int last_protocol_uploaded() const
│ │ │ │ +		{ return m_stat[upload_protocol].counter(); }
│ │ │ │  
│ │ │ │ -#if TORRENT_HAS_BINDTODEVICE
│ │ │ │ -		// try to use SO_BINDTODEVICE here, if that exists. If it fails,
│ │ │ │ -		// fall back to the mechanism we have below
│ │ │ │ -		aux::bind_device(sock, device_name, ec);
│ │ │ │ -		if (ec)
│ │ │ │ -#endif
│ │ │ │ +		// these are the channels we keep stats for
│ │ │ │ +		enum
│ │ │ │  		{
│ │ │ │ -			ec.clear();
│ │ │ │ +<div style="background: #ffff00" width="100%">			upload_payload,
│ │ │ │ +</div>			upload_protocol,
│ │ │ │ +			download_payload,
│ │ │ │ +			download_protocol,
│ │ │ │ +			upload_ip_protocol,
│ │ │ │ +			download_ip_protocol,
│ │ │ │ +			num_channels
│ │ │ │ +		};
│ │ │ │ +
│ │ │ │ +		void clear()
│ │ │ │ +		{
│ │ │ │ +			for (int i = 0; i &lt; num_channels; ++i)
│ │ │ │ +				m_stat[i].clear();
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		stat_channel const&amp; operator[](int i) const
│ │ │ │ +		{
│ │ │ │ +			TORRENT_ASSERT(i &gt;= 0 &amp;&amp; i &lt; num_channels);
│ │ │ │ +			return m_stat[i];
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +	private:
│ │ │ │ +
│ │ │ │ +		stat_channel m_stat[num_channels];
│ │ │ │ +	};
│ │ │ │ +
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +#endif // TORRENT_STAT_HPP_INCLUDED
│ │ │ │  </pre></td></tr><tr style="background: #fcc"><td>relevance&nbsp;3</td><td><a href="javascript:expand(39)">../include/libtorrent/kademlia/routing_table.hpp:153</a></td><td>to improve memory locality and scanning performance, turn the routing table into a single vector with boundaries for the nodes instead. Perhaps replacement nodes should be in a separate vector.</td></tr><tr id="39" style="display: none;" colspan="3"><td colspan="3"><h2>to improve memory locality and scanning performance, turn the
│ │ │ │  routing table into a single vector with boundaries for the nodes instead.
│ │ │ │  Perhaps replacement nodes should be in a separate vector.</h2><h4>../include/libtorrent/kademlia/routing_table.hpp:153</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">// * Nodes are not marked as being stale, they keep a counter
│ │ │ │  // 	that tells how many times in a row they have failed. When
│ │ │ │  // 	a new node is to be inserted, the node that has failed
│ │ │ │  // 	the most times is replaced. If none of the nodes in the
│ │ │ │  // 	bucket has failed, then it is put in the replacement
│ │ │ │ @@ -2066,15 +2066,16 @@
│ │ │ │  
│ │ │ │  	// deletes the files on fs from save_path according to options. Options may
│ │ │ │  	// opt to only delete the partfile
│ │ │ │  	TORRENT_EXTRA_EXPORT void
│ │ │ │  	delete_files(file_storage const&amp; fs, std::string const&amp; save_path
│ │ │ │  		, std::string const&amp; part_file_name, remove_flags_t options, storage_error&amp; ec);
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(41)">../test/test_storage.cpp:769</a></td><td>split this test up into smaller parts</td></tr><tr id="41" style="display: none;" colspan="3"><td colspan="3"><h2>split this test up into smaller parts</h2><h4>../test/test_storage.cpp:769</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	io-&gt;submit_jobs();
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(41)">../test/test_piece_picker.cpp:2870</a></td><td>test picking with partial pieces and other peers present so that both backup_pieces and backup_pieces2 are used</td></tr><tr id="41" style="display: none;" colspan="3"><td colspan="3"><h2>test picking with partial pieces and other peers present so that both
│ │ │ │ +backup_pieces and backup_pieces2 are used</h2><h4>../test/test_piece_picker.cpp:2870</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(42)">../test/test_storage.cpp:769</a></td><td>split this test up into smaller parts</td></tr><tr id="42" style="display: none;" colspan="3"><td colspan="3"><h2>split this test up into smaller parts</h2><h4>../test/test_storage.cpp:769</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	io-&gt;submit_jobs();
│ │ │ │  	ios.restart();
│ │ │ │  	run_until(ios, done);
│ │ │ │  
│ │ │ │  	TEST_EQUAL(oversized, bool(flags &amp; test_oversized));
│ │ │ │  
│ │ │ │  	for (auto const i : info-&gt;piece_range())
│ │ │ │  	{
│ │ │ │ @@ -2117,15 +2118,15 @@
│ │ │ │  
│ │ │ │  	// File layout
│ │ │ │  	// +-+--+++-------+-------+----------------------------------------------------------------------------------------+
│ │ │ │  	// |1| 2||| file5 | file6 | file7                                                                                  |
│ │ │ │  	// +-+--+++-------+-------+----------------------------------------------------------------------------------------+
│ │ │ │  	// |                           |                           |                           |                           |
│ │ │ │  	// | piece 0                   | piece 1                   | piece 2                   | piece 3                   |
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(42)">../test/test_dht.cpp:1642</a></td><td>test num_global_nodes</td></tr><tr id="42" style="display: none;" colspan="3"><td colspan="3"><h2>test num_global_nodes</h2><h4>../test/test_dht.cpp:1642</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(43)">../test/test_dht.cpp:1643</a></td><td>test need_refresh</td></tr><tr id="43" style="display: none;" colspan="3"><td colspan="3"><h2>test need_refresh</h2><h4>../test/test_dht.cpp:1643</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(43)">../test/test_dht.cpp:1642</a></td><td>test num_global_nodes</td></tr><tr id="43" style="display: none;" colspan="3"><td colspan="3"><h2>test num_global_nodes</h2><h4>../test/test_dht.cpp:1642</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(44)">../test/test_dht.cpp:1643</a></td><td>test need_refresh</td></tr><tr id="44" style="display: none;" colspan="3"><td colspan="3"><h2>test need_refresh</h2><h4>../test/test_dht.cpp:1643</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  	s.set_bool(settings_pack::dht_restrict_routing_ips, false);
│ │ │ │  
│ │ │ │  	{
│ │ │ │  		auto const ep = rand_udp_ep(rand_addr);
│ │ │ │  		auto const id = generate_id_impl(ep.address(), 2);
│ │ │ │  		table.node_seen(id, ep, 10);
│ │ │ │  	}
│ │ │ │ @@ -2168,15 +2169,15 @@
│ │ │ │  		std::vector&lt;node_entry&gt; temp = table.find_node(id, {}, bucket_size * 2);
│ │ │ │  		TEST_EQUAL(int(temp.size()), std::min(bucket_size * 2, int(nodes.size())));
│ │ │ │  
│ │ │ │  		std::sort(nodes.begin(), nodes.end(), std::bind(&amp;compare_ref
│ │ │ │  				, std::bind(&amp;node_entry::id, _1)
│ │ │ │  				, std::bind(&amp;node_entry::id, _2), id));
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(44)">../test/test_dht.cpp:2828</a></td><td>split this up into smaller test cases</td></tr><tr id="44" style="display: none;" colspan="3"><td colspan="3"><h2>split this up into smaller test cases</h2><h4>../test/test_dht.cpp:2828</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(45)">../test/test_dht.cpp:2828</a></td><td>split this up into smaller test cases</td></tr><tr id="45" style="display: none;" colspan="3"><td colspan="3"><h2>split this up into smaller test cases</h2><h4>../test/test_dht.cpp:2828</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  	TEST_EQUAL(aux::to_hex(sig.bytes)
│ │ │ │  		, "6834284b6b24c3204eb2fea824d82f88883a3d95e8b4a21b8c0ded553d17d17d"
│ │ │ │  		"df9a8a7104b1258f30bed3787e6cb896fca78c58f8e03b5f18f14951a87d9a08");
│ │ │ │  
│ │ │ │  	sha1_hash target_id = item_target_id(test_salt, pk);
│ │ │ │  	TEST_EQUAL(aux::to_hex(target_id), "411eba73b6f087ca51a3795d9c8c938d365e32c1");
│ │ │ │  }
│ │ │ │ @@ -2219,831 +2220,694 @@
│ │ │ │  	bool ret = verify_message(ent, msg_desc, msg_keys, error_string);
│ │ │ │  	TEST_CHECK(ret);
│ │ │ │  	TEST_CHECK(msg_keys[0]);
│ │ │ │  	if (msg_keys[0]) TEST_EQUAL(msg_keys[0].string_value(), "test");
│ │ │ │  	TEST_CHECK(msg_keys[1]);
│ │ │ │  	TEST_CHECK(msg_keys[2]);
│ │ │ │  	if (msg_keys[2]) TEST_EQUAL(msg_keys[2].string_value(), "test2");
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(45)">../test/test_piece_picker.cpp:2870</a></td><td>test picking with partial pieces and other peers present so that both backup_pieces and backup_pieces2 are used</td></tr><tr id="45" style="display: none;" colspan="3"><td colspan="3"><h2>test picking with partial pieces and other peers present so that both
│ │ │ │ -backup_pieces and backup_pieces2 are used</h2><h4>../test/test_piece_picker.cpp:2870</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(46)">../src/upnp.cpp:106</a></td><td>use boost::asio::ip::network instead of netmask</td></tr><tr id="46" style="display: none;" colspan="3"><td colspan="3"><h2>use boost::asio::ip::network instead of netmask</h2><h4>../src/upnp.cpp:106</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -static error_code ignore_error;
│ │ │ │ -
│ │ │ │ -upnp::rootdevice::rootdevice() = default;
│ │ │ │ -
│ │ │ │ -#if TORRENT_USE_ASSERTS
│ │ │ │ -upnp::rootdevice::~rootdevice()
│ │ │ │ -{
│ │ │ │ -	TORRENT_ASSERT(magic == 1337);
│ │ │ │ -	magic = 0;
│ │ │ │ -}
│ │ │ │ -#else
│ │ │ │ -upnp::rootdevice::~rootdevice() = default;
│ │ │ │ -#endif
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(46)">../src/storage_utils.cpp:294</a></td><td>technically, this is where the transaction of moving the files is completed. This is where the new save_path should be committed. If there is an error in the code below, that should not prevent the new save path to be set. Maybe it would make sense to make the save_path an in-out parameter</td></tr><tr id="46" style="display: none;" colspan="3"><td colspan="3"><h2>technically, this is where the transaction of moving the files
│ │ │ │ +is completed. This is where the new save_path should be committed. If
│ │ │ │ +there is an error in the code below, that should not prevent the new
│ │ │ │ +save path to be set. Maybe it would make sense to make the save_path
│ │ │ │ +an in-out parameter</h2><h4>../src/storage_utils.cpp:294</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			while (--file_index &gt;= file_index_t(0))
│ │ │ │ +			{
│ │ │ │ +				// files moved out to absolute paths are not moved
│ │ │ │ +				if (f.file_absolute_path(file_index)) continue;
│ │ │ │  
│ │ │ │ -upnp::rootdevice::rootdevice(rootdevice const&amp;) = default;
│ │ │ │ -upnp::rootdevice&amp; upnp::rootdevice::operator=(rootdevice const&amp;) &amp; = default;
│ │ │ │ -upnp::rootdevice::rootdevice(rootdevice&amp;&amp;) noexcept = default;
│ │ │ │ -upnp::rootdevice&amp; upnp::rootdevice::operator=(rootdevice&amp;&amp;) &amp; = default;
│ │ │ │ +				// if we ended up copying the file, don't do anything during
│ │ │ │ +				// roll-back
│ │ │ │ +				if (copied_files[file_index]) continue;
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">upnp::upnp(io_context&amp; ios
│ │ │ │ -</div>	, aux::session_settings const&amp; settings
│ │ │ │ -	, aux::portmap_callback&amp; cb
│ │ │ │ -	, address_v4 const listen_address
│ │ │ │ -	, address_v4 const netmask
│ │ │ │ -	, std::string listen_device
│ │ │ │ -	, listen_socket_handle ls)
│ │ │ │ -	: m_settings(settings)
│ │ │ │ -	, m_callback(cb)
│ │ │ │ -	, m_io_service(ios)
│ │ │ │ -	, m_resolver(ios)
│ │ │ │ -	, m_multicast(ios)
│ │ │ │ -	, m_unicast(ios)
│ │ │ │ -	, m_broadcast_timer(ios)
│ │ │ │ -	, m_refresh_timer(ios)
│ │ │ │ -	, m_map_timer(ios)
│ │ │ │ -	, m_listen_address(listen_address)
│ │ │ │ -	, m_netmask(netmask)
│ │ │ │ -	, m_device(std::move(listen_device))
│ │ │ │ -#if TORRENT_USE_SSL
│ │ │ │ -	, m_ssl_ctx(ssl::context::sslv23_client)
│ │ │ │ -#endif
│ │ │ │ -	, m_listen_handle(std::move(ls))
│ │ │ │ -{
│ │ │ │ -#if TORRENT_USE_SSL
│ │ │ │ -	m_ssl_ctx.set_verify_mode(ssl::context::verify_none);
│ │ │ │ -#endif
│ │ │ │ -}
│ │ │ │ +				std::string const old_path = combine_path(save_path, f.file_path(file_index));
│ │ │ │ +				std::string const new_path = combine_path(new_save_path, f.file_path(file_index));
│ │ │ │  
│ │ │ │ -void upnp::start()
│ │ │ │ -{
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(47)">../src/bdecode.cpp:826</a></td><td>attempt to simplify this implementation by embracing the span</td></tr><tr id="47" style="display: none;" colspan="3"><td colspan="3"><h2>attempt to simplify this implementation by embracing the span</h2><h4>../src/bdecode.cpp:826</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │ +				// ignore errors when rolling back
│ │ │ │ +				storage_error ignore;
│ │ │ │ +				move_file(new_path, old_path, ignore);
│ │ │ │ +			}
│ │ │ │  
│ │ │ │ -	bdecode_node bdecode(span&lt;char const&gt; buffer
│ │ │ │ -		, error_code&amp; ec, int* error_pos, int depth_limit, int token_limit)
│ │ │ │ -	{
│ │ │ │ -		bdecode_node ret;
│ │ │ │ -		ec.clear();
│ │ │ │ +			return { status_t::fatal_disk_error, save_path };
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -		if (buffer.size() &gt; bdecode_token::max_offset)
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>		std::set&lt;std::string&gt; subdirs;
│ │ │ │ +		for (auto const i : f.file_range())
│ │ │ │  		{
│ │ │ │ -			if (error_pos) *error_pos = 0;
│ │ │ │ -			ec = bdecode_errors::limit_exceeded;
│ │ │ │ -			return ret;
│ │ │ │ -		}
│ │ │ │ +			// files moved out to absolute paths are not moved
│ │ │ │ +			if (f.file_absolute_path(i)) continue;
│ │ │ │  
│ │ │ │ -		// this is the stack of bdecode_token indices, into m_tokens.
│ │ │ │ -		// sp is the stack pointer, as index into the array, stack
│ │ │ │ -		int sp = 0;
│ │ │ │ -		TORRENT_ALLOCA(stack, stack_frame, depth_limit);
│ │ │ │ +			if (has_parent_path(f.file_path(i)))
│ │ │ │ +				subdirs.insert(parent_path(f.file_path(i)));
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">		char const* start = buffer.data();
│ │ │ │ -</div>		char const* end = start + buffer.size();
│ │ │ │ -		char const* const orig_start = start;
│ │ │ │ +			// if we ended up renaming the file instead of moving it, there's no
│ │ │ │ +			// need to delete the source.
│ │ │ │ +			if (copied_files[i] == false) continue;
│ │ │ │  
│ │ │ │ -		if (start == end)
│ │ │ │ -			TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
│ │ │ │ +			std::string const old_path = combine_path(save_path, f.file_path(i));
│ │ │ │  
│ │ │ │ -		while (start &lt;= end)
│ │ │ │ +			// we may still have some files in old save_path
│ │ │ │ +			// eg. if (flags == dont_replace &amp;&amp; exists(new_path))
│ │ │ │ +			// ignore errors when removing
│ │ │ │ +			error_code ignore;
│ │ │ │ +			remove(old_path, ignore);
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		for (std::string const&amp; s : subdirs)
│ │ │ │  		{
│ │ │ │ -			if (start &gt;= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
│ │ │ │ +			error_code err;
│ │ │ │ +			std::string subdir = combine_path(save_path, s);
│ │ │ │  
│ │ │ │ -			if (sp &gt;= depth_limit)
│ │ │ │ -				TORRENT_FAIL_BDECODE(bdecode_errors::depth_exceeded);
│ │ │ │ +			while (!path_equal(subdir, save_path) &amp;&amp; !err)
│ │ │ │ +			{
│ │ │ │ +				remove(subdir, err);
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(47)">../src/storage_utils.cpp:486</a></td><td>is this risky? The upper layer will assume we have the whole file. Perhaps we should verify that at least the size of the file is correct</td></tr><tr id="47" style="display: none;" colspan="3"><td colspan="3"><h2>is this risky? The upper layer will assume we have the
│ │ │ │ +whole file. Perhaps we should verify that at least the size
│ │ │ │ +of the file is correct</h2><h4>../src/storage_utils.cpp:486</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				{
│ │ │ │ +					// we create directories lazily, so it's possible it hasn't
│ │ │ │ +					// been created yet. Create the directories now and try
│ │ │ │ +					// again
│ │ │ │ +					create_directories(parent_path(file_path), err);
│ │ │ │  
│ │ │ │ -			--token_limit;
│ │ │ │ -			if (token_limit &lt; 0)
│ │ │ │ -				TORRENT_FAIL_BDECODE(bdecode_errors::limit_exceeded);
│ │ │ │ +					if (err)
│ │ │ │ +					{
│ │ │ │ +						ec.file(idx);
│ │ │ │ +						ec.operation = operation_t::mkdir;
│ │ │ │ +						return false;
│ │ │ │ +					}
│ │ │ │  
│ │ │ │ -			// look for a new token
│ │ │ │ -			char const t = *start;
│ │ │ │ +					hard_link(s, file_path, err);
│ │ │ │ +				}
│ │ │ │  
│ │ │ │ -			int const current_frame = sp;
│ │ │ │ +				// if the file already exists, that's not an error
│ │ │ │ +				if (err == boost::system::errc::file_exists)
│ │ │ │ +					continue;
│ │ │ │  
│ │ │ │ -			// if we're currently parsing a dictionary, assert that
│ │ │ │ -			// every other node is a string.
│ │ │ │ -			if (current_frame &gt; 0
│ │ │ │ -				&amp;&amp; ret.m_tokens[stack[current_frame - 1].token].type == bdecode_token::dict)
│ │ │ │ -			{
│ │ │ │ -				if (stack[current_frame - 1].state == 0)
│ │ │ │ -				{
│ │ │ │ -					// the current parent is a dict and we are parsing a key.
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(48)">../src/web_peer_connection.cpp:626</a></td><td>just make this peer not have the pieces associated with the file we just requested. Only when it doesn't have any of the file do the following pad files will make it complicated</td></tr><tr id="48" style="display: none;" colspan="3"><td colspan="3"><h2>just make this peer not have the pieces
│ │ │ │ -associated with the file we just requested. Only
│ │ │ │ -when it doesn't have any of the file do the following
│ │ │ │ -pad files will make it complicated</h2><h4>../src/web_peer_connection.cpp:626</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -	peer_connection::received_invalid_data(index, single_peer);
│ │ │ │ +<div style="background: #ffff00" width="100%">				if (err)
│ │ │ │ +</div>				{
│ │ │ │ +					ec.ec = err;
│ │ │ │ +					ec.file(idx);
│ │ │ │ +					ec.operation = operation_t::file_hard_link;
│ │ │ │ +					return false;
│ │ │ │ +				}
│ │ │ │ +				added_files = true;
│ │ │ │ +				stat.set_dirty(idx);
│ │ │ │ +			}
│ │ │ │ +		}
│ │ │ │ +#endif // TORRENT_DISABLE_MUTABLE_TORRENTS
│ │ │ │  
│ │ │ │ -	// if we don't think we have any of the files, allow banning the web seed
│ │ │ │ -	if (num_have_pieces() == 0) return true;
│ │ │ │ +		bool const seed = (rd.have_pieces.size() &gt;= fs.num_pieces()
│ │ │ │ +			&amp;&amp; rd.have_pieces.all_set())
│ │ │ │ +			|| (rd.flags &amp; torrent_flags::seed_mode);
│ │ │ │  
│ │ │ │ -	// don't disconnect, we won't request anything from this file again
│ │ │ │ -	return false;
│ │ │ │ -}
│ │ │ │ +		if (seed)
│ │ │ │ +		{
│ │ │ │ +			for (file_index_t const file_index : fs.file_range())
│ │ │ │ +			{
│ │ │ │ +				if (fs.pad_file_at(file_index)) continue;
│ │ │ │  
│ │ │ │ -void web_peer_connection::on_receive_padfile()
│ │ │ │ -{
│ │ │ │ -	handle_padfile();
│ │ │ │ -}
│ │ │ │ +				// files with priority zero may not have been saved to disk at their
│ │ │ │ +				// expected location, but is likely to be in a partfile. Just exempt it
│ │ │ │ +				// from checking
│ │ │ │ +				if (file_index &lt; file_priority.end_index()
│ │ │ │ +					&amp;&amp; file_priority[file_index] == dont_download
│ │ │ │ +					&amp;&amp; !(rd.flags &amp; torrent_flags::seed_mode))
│ │ │ │ +					continue;
│ │ │ │  
│ │ │ │ -void web_peer_connection::handle_error(int const bytes_left)
│ │ │ │ -{
│ │ │ │ -	std::shared_ptr&lt;torrent&gt; t = associated_torrent().lock();
│ │ │ │ -	TORRENT_ASSERT(t);
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(48)">../src/alert.cpp:2021</a></td><td>the salt here is allocated on the heap. It would be nice to allocate in the stack_allocator</td></tr><tr id="48" style="display: none;" colspan="3"><td colspan="3"><h2>the salt here is allocated on the heap. It would be nice to
│ │ │ │ +allocate in the stack_allocator</h2><h4>../src/alert.cpp:2021</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>	// temporarily unavailable, retry later
│ │ │ │ -	t-&gt;retry_web_seed(this, m_parser.header_duration("retry-after"));
│ │ │ │ -	if (t-&gt;alerts().should_post&lt;url_seed_alert&gt;())
│ │ │ │ -	{
│ │ │ │ -		std::string const error_msg = to_string(m_parser.status_code()).data()
│ │ │ │ -			+ (" " + m_parser.message());
│ │ │ │ -		t-&gt;alerts().emplace_alert&lt;url_seed_alert&gt;(t-&gt;get_handle(), m_url
│ │ │ │ -			, error_msg);
│ │ │ │ -	}
│ │ │ │ -	received_bytes(0, bytes_left);
│ │ │ │ -	disconnect(error_code(m_parser.status_code(), http_category()), operation_t::bittorrent, failure);
│ │ │ │ -}
│ │ │ │ +	dht_immutable_item_alert::dht_immutable_item_alert(aux::stack_allocator&amp;
│ │ │ │ +		, sha1_hash const&amp; t, entry i)
│ │ │ │ +		: target(t), item(std::move(i))
│ │ │ │ +	{}
│ │ │ │  
│ │ │ │ -void web_peer_connection::disable(error_code const&amp; ec)
│ │ │ │ -{
│ │ │ │ -	// we should not try this server again.
│ │ │ │ -	m_web-&gt;disabled = true;
│ │ │ │ -	disconnect(ec, operation_t::bittorrent, peer_error);
│ │ │ │ -	if (m_web-&gt;ephemeral)
│ │ │ │ +	std::string dht_immutable_item_alert::message() const
│ │ │ │  	{
│ │ │ │ -		std::shared_ptr&lt;torrent&gt; t = associated_torrent().lock();
│ │ │ │ -		TORRENT_ASSERT(t);
│ │ │ │ -		t-&gt;remove_web_seed_conn(this);
│ │ │ │ -	}
│ │ │ │ -	m_web = nullptr;
│ │ │ │ -	TORRENT_ASSERT(is_disconnecting());
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -void web_peer_connection::handle_redirect(int const bytes_left)
│ │ │ │ -{
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(49)">../src/session_impl.cpp:599</a></td><td>is there a reason not to move all of this into init()? and just post it to the io_context?</td></tr><tr id="49" style="display: none;" colspan="3"><td colspan="3"><h2>is there a reason not to move all of this into init()? and just
│ │ │ │ -post it to the io_context?</h2><h4>../src/session_impl.cpp:599</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	try
│ │ │ │ +#ifdef TORRENT_DISABLE_ALERT_MSG
│ │ │ │ +		return {};
│ │ │ │ +#else
│ │ │ │ +		char msg[1050];
│ │ │ │ +		std::snprintf(msg, sizeof(msg), "DHT immutable item %s [ %s ]"
│ │ │ │ +			, aux::to_hex(target).c_str()
│ │ │ │ +			, item.to_string().c_str());
│ │ │ │ +		return msg;
│ │ │ │  #endif
│ │ │ │ -	{
│ │ │ │ -		(this-&gt;*f)(std::forward&lt;Args&gt;(a)...);
│ │ │ │ -	}
│ │ │ │ -#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ -	catch (system_error const&amp; e) {
│ │ │ │ -		alerts().emplace_alert&lt;session_error_alert&gt;(e.code(), e.what());
│ │ │ │ -		pause();
│ │ │ │ -	} catch (std::exception const&amp; e) {
│ │ │ │ -		alerts().emplace_alert&lt;session_error_alert&gt;(error_code(), e.what());
│ │ │ │ -		pause();
│ │ │ │ -	} catch (...) {
│ │ │ │ -		alerts().emplace_alert&lt;session_error_alert&gt;(error_code(), "unknown error");
│ │ │ │ -		pause();
│ │ │ │  	}
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -	// This function is called by the creating thread, not in the message loop's
│ │ │ │ -	// io_context thread.
│ │ │ │ -<div style="background: #ffff00" width="100%">	void session_impl::start_session()
│ │ │ │ -</div>	{
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		session_log("start session");
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -#if TORRENT_USE_SSL
│ │ │ │ -		error_code ec;
│ │ │ │ -		m_ssl_ctx.set_default_verify_paths(ec);
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		if (ec) session_log("SSL set_default verify_paths failed: %s", ec.message().c_str());
│ │ │ │ -		ec.clear();
│ │ │ │ -#endif
│ │ │ │ -#if defined TORRENT_WINDOWS &amp;&amp; defined TORRENT_USE_OPENSSL &amp;&amp; !defined TORRENT_WINRT
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(50)">../src/session_impl.cpp:761</a></td><td>the ip filter should probably be saved here too</td></tr><tr id="50" style="display: none;" colspan="3"><td colspan="3"><h2>the ip filter should probably be saved here too</h2><h4>../src/session_impl.cpp:761</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		m_lsd_announce_timer.async_wait([this](error_code const&amp; e) {
│ │ │ │ -			wrap(&amp;session_impl::on_lsd_announce, e); } );
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		session_log(" done starting session");
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		// this applies unchoke settings from m_settings
│ │ │ │ -		recalculate_unchoke_slots();
│ │ │ │  
│ │ │ │ -		// apply all m_settings to this session
│ │ │ │ -		run_all_updates(*this);
│ │ │ │ -		reopen_listen_sockets(false);
│ │ │ │ +<div style="background: #ffff00" width="100%">	dht_mutable_item_alert::dht_mutable_item_alert(aux::stack_allocator&amp;
│ │ │ │ +</div>		, std::array&lt;char, 32&gt; const&amp; k
│ │ │ │ +		, std::array&lt;char, 64&gt; const&amp; sig
│ │ │ │ +		, std::int64_t sequence
│ │ │ │ +		, string_view s
│ │ │ │ +		, entry i
│ │ │ │ +		, bool a)
│ │ │ │ +		: key(k), signature(sig), seq(sequence), salt(s), item(std::move(i)), authoritative(a)
│ │ │ │ +	{}
│ │ │ │  
│ │ │ │ -#if TORRENT_USE_INVARIANT_CHECKS
│ │ │ │ -		check_invariant();
│ │ │ │ +	std::string dht_mutable_item_alert::message() const
│ │ │ │ +	{
│ │ │ │ +#ifdef TORRENT_DISABLE_ALERT_MSG
│ │ │ │ +		return {};
│ │ │ │ +#else
│ │ │ │ +		char msg[1050];
│ │ │ │ +		std::snprintf(msg, sizeof(msg), "DHT mutable item (key=%s salt=%s seq=%" PRId64 " %s) [ %s ]"
│ │ │ │ +			, aux::to_hex(key).c_str()
│ │ │ │ +			, salt.c_str()
│ │ │ │ +			, seq
│ │ │ │ +			, authoritative ? "auth" : "non-auth"
│ │ │ │ +			, item.to_string().c_str());
│ │ │ │ +		return msg;
│ │ │ │  #endif
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -#if TORRENT_ABI_VERSION &lt;= 2
│ │ │ │ -<div style="background: #ffff00" width="100%">	void session_impl::save_state(entry* eptr, save_state_flags_t const flags) const
│ │ │ │ -</div>	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +	dht_put_alert::dht_put_alert(aux::stack_allocator&amp;, sha1_hash const&amp; t, int n)
│ │ │ │ +		: target(t)
│ │ │ │ +		, public_key()
│ │ │ │ +		, signature()
│ │ │ │ +		, salt()
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(49)">../src/instantiate_connection.cpp:44</a></td><td>peer_connection and tracker_connection should probably be flags</td></tr><tr id="49" style="display: none;" colspan="3"><td colspan="3"><h2>peer_connection and tracker_connection should probably be flags</h2><h4>../src/instantiate_connection.cpp:44</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
│ │ │ │ +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
│ │ │ │ +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
│ │ │ │ +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
│ │ │ │ +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
│ │ │ │ +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
│ │ │ │ +POSSIBILITY OF SUCH DAMAGE.
│ │ │ │  
│ │ │ │ -		entry&amp; e = *eptr;
│ │ │ │ -		// make it a dict
│ │ │ │ -		e.dict();
│ │ │ │ +*/
│ │ │ │  
│ │ │ │ -		if (flags &amp; session::save_settings)
│ │ │ │ -		{
│ │ │ │ -			entry::dictionary_type&amp; sett = e["settings"].dict();
│ │ │ │ -			save_settings_to_dict(non_default_settings(m_settings), sett);
│ │ │ │ -		}
│ │ │ │ +#include "libtorrent/socket.hpp"
│ │ │ │ +#include "libtorrent/aux_/socket_type.hpp"
│ │ │ │ +#include "libtorrent/aux_/utp_socket_manager.hpp"
│ │ │ │ +#include "libtorrent/aux_/instantiate_connection.hpp"
│ │ │ │ +#include "libtorrent/aux_/utp_stream.hpp"
│ │ │ │ +#include "libtorrent/ssl_stream.hpp"
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DISABLE_DHT
│ │ │ │ -		if (flags &amp; session::save_dht_settings)
│ │ │ │ -		{
│ │ │ │ -			e["dht"] = dht::save_dht_settings(get_dht_settings());
│ │ │ │ -		}
│ │ │ │ +namespace libtorrent { namespace aux {
│ │ │ │  
│ │ │ │ -		if (m_dht &amp;&amp; (flags &amp; session::save_dht_state))
│ │ │ │ -		{
│ │ │ │ -			e["dht state"] = dht::save_dht_state(m_dht-&gt;state());
│ │ │ │ -		}
│ │ │ │ +<div style="background: #ffff00" width="100%">	aux::socket_type instantiate_connection(io_context&amp; ios
│ │ │ │ +</div>		, aux::proxy_settings const&amp; ps
│ │ │ │ +		, void* ssl_context
│ │ │ │ +		, utp_socket_manager* sm
│ │ │ │ +		, bool peer_connection
│ │ │ │ +		, bool tracker_connection)
│ │ │ │ +	{
│ │ │ │ +#if !TORRENT_USE_SSL
│ │ │ │ +		TORRENT_UNUSED(ssl_context);
│ │ │ │  #endif
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DISABLE_EXTENSIONS
│ │ │ │ -		for (auto const&amp; ext : m_ses_extensions[plugins_all_idx])
│ │ │ │ -		{
│ │ │ │ -			ext-&gt;save_state(*eptr);
│ │ │ │ -		}
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(51)">../src/session_impl.cpp:3882</a></td><td>make a list for torrents that want to be announced on the DHT so we don't have to loop over all torrents, just to find the ones that want to announce</td></tr><tr id="51" style="display: none;" colspan="3"><td colspan="3"><h2>make a list for torrents that want to be announced on the DHT so we
│ │ │ │ -don't have to loop over all torrents, just to find the ones that want to announce</h2><h4>../src/session_impl.cpp:3882</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		if (!m_dht_torrents.empty())
│ │ │ │ +		if (sm)
│ │ │ │  		{
│ │ │ │ -			std::shared_ptr&lt;torrent&gt; t;
│ │ │ │ -			do
│ │ │ │ +#if TORRENT_USE_SSL
│ │ │ │ +			if (ssl_context)
│ │ │ │  			{
│ │ │ │ -				t = m_dht_torrents.front().lock();
│ │ │ │ -				m_dht_torrents.pop_front();
│ │ │ │ -			} while (!t &amp;&amp; !m_dht_torrents.empty());
│ │ │ │ -
│ │ │ │ -			if (t)
│ │ │ │ +				ssl_stream&lt;utp_stream&gt; s(ios, *static_cast&lt;ssl::context*&gt;(ssl_context));
│ │ │ │ +				s.next_layer().set_impl(sm-&gt;new_utp_socket(&amp;s.next_layer()));
│ │ │ │ +				return socket_type(std::move(s));
│ │ │ │ +			}
│ │ │ │ +			else
│ │ │ │ +#endif
│ │ │ │  			{
│ │ │ │ -				t-&gt;dht_announce();
│ │ │ │ -				return;
│ │ │ │ +				utp_stream s(ios);
│ │ │ │ +				s.set_impl(sm-&gt;new_utp_socket(&amp;s));
│ │ │ │ +				return socket_type(std::move(s));
│ │ │ │  			}
│ │ │ │  		}
│ │ │ │ -		if (m_torrents.empty()) return;
│ │ │ │ +#if TORRENT_USE_I2P
│ │ │ │ +		else if (ps.type == settings_pack::i2p_proxy)
│ │ │ │ +		{
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(50)">../src/torrent.cpp:504</a></td><td>post alert</td></tr><tr id="50" style="display: none;" colspan="3"><td colspan="3"><h2>post alert</h2><h4>../src/torrent.cpp:504</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		if (m_current_gauge_state != no_gauge_state)
│ │ │ │ +			inc_stats_counter(m_current_gauge_state + counters::num_checking_torrents, -1);
│ │ │ │ +		if (new_gauge_state != no_gauge_state)
│ │ │ │ +			inc_stats_counter(new_gauge_state + counters::num_checking_torrents, 1);
│ │ │ │  
│ │ │ │ -		if (m_next_dht_torrent &gt;= m_torrents.size())
│ │ │ │ -			m_next_dht_torrent = 0;
│ │ │ │ -		m_torrents[m_next_dht_torrent]-&gt;dht_announce();
│ │ │ │ -<div style="background: #ffff00" width="100%">		++m_next_dht_torrent;
│ │ │ │ -</div>		if (m_next_dht_torrent &gt;= m_torrents.size())
│ │ │ │ -			m_next_dht_torrent = 0;
│ │ │ │ +		TORRENT_ASSERT(new_gauge_state &gt;= 0);
│ │ │ │ +		TORRENT_ASSERT(new_gauge_state &lt;= no_gauge_state);
│ │ │ │ +		m_current_gauge_state = static_cast&lt;std::uint32_t&gt;(new_gauge_state);
│ │ │ │  	}
│ │ │ │ -#endif
│ │ │ │  
│ │ │ │ -	void session_impl::on_lsd_announce(error_code const&amp; e)
│ │ │ │ +	void torrent::leave_seed_mode(seed_mode_t const checking)
│ │ │ │  	{
│ │ │ │ -		COMPLETE_ASYNC("session_impl::on_lsd_announce");
│ │ │ │ -		m_stats_counters.inc_stats_counter(counters::on_lsd_counter);
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -		if (e) return;
│ │ │ │ -
│ │ │ │ -		if (m_abort) return;
│ │ │ │ -
│ │ │ │ -		ADD_OUTSTANDING_ASYNC("session_impl::on_lsd_announce");
│ │ │ │ -		// announce on local network every 5 minutes
│ │ │ │ -		int const delay = std::max(m_settings.get_int(settings_pack::local_service_announce_interval)
│ │ │ │ -			/ std::max(int(m_torrents.size()), 1), 1);
│ │ │ │ -		m_lsd_announce_timer.expires_after(seconds(delay));
│ │ │ │ -		m_lsd_announce_timer.async_wait([this](error_code const&amp; err) {
│ │ │ │ -			wrap(&amp;session_impl::on_lsd_announce, err); });
│ │ │ │ -
│ │ │ │ -		if (m_torrents.empty()) return;
│ │ │ │ +		if (!m_seed_mode) return;
│ │ │ │  
│ │ │ │ -		if (m_next_lsd_torrent &gt;= m_torrents.size())
│ │ │ │ -			m_next_lsd_torrent = 0;
│ │ │ │ -		m_torrents[m_next_lsd_torrent]-&gt;lsd_announce();
│ │ │ │ -		++m_next_lsd_torrent;
│ │ │ │ -		if (m_next_lsd_torrent &gt;= m_torrents.size())
│ │ │ │ -			m_next_lsd_torrent = 0;
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(52)">../src/session_impl.cpp:5515</a></td><td>this function should be removed and users need to deal with the more generic case of having multiple listen ports</td></tr><tr id="52" style="display: none;" colspan="3"><td colspan="3"><h2>this function should be removed and users need to deal with the
│ │ │ │ -more generic case of having multiple listen ports</h2><h4>../src/session_impl.cpp:5515</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		if (!node_list.empty() &amp;&amp; nodes.empty())
│ │ │ │ +		if (checking == seed_mode_t::check_files)
│ │ │ │  		{
│ │ │ │ -			session_log("ERROR: failed to parse DHT bootstrap list: %s", node_list.c_str());
│ │ │ │ -		}
│ │ │ │ -#endif
│ │ │ │ -		for (auto const&amp; n : nodes)
│ │ │ │ -			add_dht_router(n);
│ │ │ │ +			// this means the user promised we had all the
│ │ │ │ +			// files, but it turned out we didn't. This is
│ │ │ │ +			// an error.
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +			debug_log("*** FAILED SEED MODE, rechecking");
│ │ │ │  #endif
│ │ │ │ -	}
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -	void session_impl::update_count_slow()
│ │ │ │ -	{
│ │ │ │ -		error_code ec;
│ │ │ │ -		for (auto const&amp; tp : m_torrents)
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		debug_log("*** LEAVING SEED MODE (%s)"
│ │ │ │ +			, checking == seed_mode_t::skip_checking ? "as seed" : "as non-seed");
│ │ │ │ +#endif
│ │ │ │ +		m_seed_mode = false;
│ │ │ │ +		// seed is false if we turned out not
│ │ │ │ +		// to be a seed after all
│ │ │ │ +		if (checking == seed_mode_t::check_files
│ │ │ │ +			&amp;&amp; state() != torrent_status::checking_resume_data)
│ │ │ │  		{
│ │ │ │ -			tp-&gt;on_inactivity_tick(ec);
│ │ │ │ +			m_have_all = false;
│ │ │ │ +			set_state(torrent_status::downloading);
│ │ │ │ +			force_recheck();
│ │ │ │  		}
│ │ │ │ -	}
│ │ │ │ +		m_num_verified = 0;
│ │ │ │ +		m_verified.clear();
│ │ │ │ +		m_verifying.clear();
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">	std::uint16_t session_impl::listen_port() const
│ │ │ │ -</div>	{
│ │ │ │ -		return listen_port(nullptr);
│ │ │ │ +		set_need_save_resume(torrent_handle::if_state_changed);
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	std::uint16_t session_impl::listen_port(listen_socket_t* sock) const
│ │ │ │ +	void torrent::verified(piece_index_t const piece)
│ │ │ │  	{
│ │ │ │ -		if (m_listen_sockets.empty()) return 0;
│ │ │ │ -		if (sock)
│ │ │ │ -		{
│ │ │ │ -			// if we're using a proxy, we won't be able to accept any TCP
│ │ │ │ -			// connections. Not even uTP connections via the port we know about.
│ │ │ │ -			// The DHT may use the implied port to make it work, but the port we
│ │ │ │ -			// announce here has no relevance for that.
│ │ │ │ -			if (sock-&gt;flags &amp; listen_socket_t::proxy)
│ │ │ │ -				return 0;
│ │ │ │ -
│ │ │ │ -			if (!(sock-&gt;flags &amp; listen_socket_t::accept_incoming))
│ │ │ │ -				return 0;
│ │ │ │ -
│ │ │ │ -			return std::uint16_t(sock-&gt;tcp_external_port());
│ │ │ │ +		TORRENT_ASSERT(!m_verified.get_bit(piece));
│ │ │ │ +		++m_num_verified;
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(51)">../src/torrent.cpp:1852</a></td><td>add a unit test where we don't have metadata, connect to a peer that sends a bitfield that's too large, then we get the metadata</td></tr><tr id="51" style="display: none;" colspan="3"><td colspan="3"><h2>add a unit test where we don't have metadata, connect to a peer
│ │ │ │ +that sends a bitfield that's too large, then we get the metadata</h2><h4>../src/torrent.cpp:1852</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			for (auto const&amp; f : m_add_torrent_params-&gt;renamed_files)
│ │ │ │ +			{
│ │ │ │ +				if (f.first &lt; file_index_t(0) || f.first &gt;= fs.end_file()) continue;
│ │ │ │ +				m_torrent_file-&gt;rename_file(file_index_t(f.first), f.second);
│ │ │ │ +			}
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -#ifdef TORRENT_SSL_PEERS
│ │ │ │ -		for (auto const&amp; s : m_listen_sockets)
│ │ │ │ +		construct_storage();
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_SHARE_MODE
│ │ │ │ +		if (m_share_mode &amp;&amp; valid_metadata())
│ │ │ │  		{
│ │ │ │ -			if (!(s-&gt;flags &amp; listen_socket_t::accept_incoming)) continue;
│ │ │ │ -			if (s-&gt;ssl == transport::plaintext)
│ │ │ │ -				return std::uint16_t(s-&gt;tcp_external_port());
│ │ │ │ +			// in share mode, all pieces have their priorities initialized to 0
│ │ │ │ +			m_file_priority.clear();
│ │ │ │ +			m_file_priority.resize(m_torrent_file-&gt;num_files(), dont_download);
│ │ │ │  		}
│ │ │ │ -		return 0;
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(53)">../src/session_impl.cpp:5555</a></td><td>this function should be removed and users need to deal with the more generic case of having multiple ssl ports</td></tr><tr id="53" style="display: none;" colspan="3"><td colspan="3"><h2>this function should be removed and users need to deal with the
│ │ │ │ -more generic case of having multiple ssl ports</h2><h4>../src/session_impl.cpp:5555</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				return 0;
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -			return std::uint16_t(sock-&gt;tcp_external_port());
│ │ │ │ +		// it's important to initialize the peers early, because this is what will
│ │ │ │ +		// fix up their have-bitmasks to have the correct size
│ │ │ │ +<div style="background: #ffff00" width="100%">		if (!m_connections_initialized)
│ │ │ │ +</div>		{
│ │ │ │ +			m_connections_initialized = true;
│ │ │ │ +			// all peer connections have to initialize themselves now that the metadata
│ │ │ │ +			// is available
│ │ │ │ +			// copy the peer list since peers may disconnect and invalidate
│ │ │ │ +			// m_connections as we initialize them
│ │ │ │ +			for (auto c : m_connections)
│ │ │ │ +			{
│ │ │ │ +				auto pc = c-&gt;self();
│ │ │ │ +				if (pc-&gt;is_disconnecting()) continue;
│ │ │ │ +				pc-&gt;on_metadata_impl();
│ │ │ │ +				if (pc-&gt;is_disconnecting()) continue;
│ │ │ │ +				pc-&gt;init();
│ │ │ │ +			}
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -#ifdef TORRENT_SSL_PEERS
│ │ │ │ -		for (auto const&amp; s : m_listen_sockets)
│ │ │ │ +		// in case file priorities were passed in via the add_torrent_params
│ │ │ │ +		// and also in the case of share mode, we need to update the priorities
│ │ │ │ +		// this has to be applied before piece priority
│ │ │ │ +		if (!m_file_priority.empty())
│ │ │ │  		{
│ │ │ │ -			if (!(s-&gt;flags &amp; listen_socket_t::accept_incoming)) continue;
│ │ │ │ -			if (s-&gt;ssl == transport::plaintext)
│ │ │ │ -				return std::uint16_t(s-&gt;tcp_external_port());
│ │ │ │ +			// m_file_priority was loaded from the resume data, this doesn't
│ │ │ │ +			// alter any state that needs to be saved in the resume data
│ │ │ │ +			auto const ns = m_need_save_resume_data;
│ │ │ │ +			update_piece_priorities(m_file_priority);
│ │ │ │ +			m_need_save_resume_data = ns;
│ │ │ │  		}
│ │ │ │ -		return 0;
│ │ │ │ -#else
│ │ │ │ -		sock = m_listen_sockets.front().get();
│ │ │ │ -		if (!(sock-&gt;flags &amp; listen_socket_t::accept_incoming)) return 0;
│ │ │ │ -		return std::uint16_t(sock-&gt;tcp_external_port());
│ │ │ │ +
│ │ │ │ +		if (m_add_torrent_params)
│ │ │ │ +		{
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(52)">../src/torrent.cpp:4492</a></td><td>use chrono type for time duration</td></tr><tr id="52" style="display: none;" colspan="3"><td colspan="3"><h2>use chrono type for time duration</h2><h4>../src/torrent.cpp:4492</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		}
│ │ │ │ +
│ │ │ │ +		m_picker-&gt;piece_passed(index);
│ │ │ │ +		update_gauge();
│ │ │ │ +		we_have(index);
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		if (should_log())
│ │ │ │ +			debug_log("we_have(%d) (num_have: %d)", int(index), num_have());
│ │ │ │ +#endif
│ │ │ │ +#ifndef TORRENT_DISABLE_STREAMING
│ │ │ │ +		remove_time_critical_piece(index, true);
│ │ │ │  #endif
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">	std::uint16_t session_impl::ssl_listen_port() const
│ │ │ │ +#ifndef TORRENT_DISABLE_PREDICTIVE_PIECES
│ │ │ │ +	// we believe we will complete this piece very soon
│ │ │ │ +	// announce it to peers ahead of time to eliminate the
│ │ │ │ +	// round-trip times involved in announcing it, requesting it
│ │ │ │ +	// and sending it
│ │ │ │ +<div style="background: #ffff00" width="100%">	void torrent::predicted_have_piece(piece_index_t const index, int const milliseconds)
│ │ │ │  </div>	{
│ │ │ │ -		return ssl_listen_port(nullptr);
│ │ │ │ -	}
│ │ │ │ +		auto const i = std::lower_bound(m_predictive_pieces.begin()
│ │ │ │ +			, m_predictive_pieces.end(), index);
│ │ │ │ +		if (i != m_predictive_pieces.end() &amp;&amp; *i == index) return;
│ │ │ │  
│ │ │ │ -	std::uint16_t session_impl::ssl_listen_port(listen_socket_t* sock) const
│ │ │ │ -	{
│ │ │ │ -#ifdef TORRENT_SSL_PEERS
│ │ │ │ -		if (sock)
│ │ │ │ +		for (auto p : m_connections)
│ │ │ │  		{
│ │ │ │ -			if (!(sock-&gt;flags &amp; listen_socket_t::accept_incoming)) return 0;
│ │ │ │ -			return std::uint16_t(sock-&gt;tcp_external_port());
│ │ │ │ +			TORRENT_INCREMENT(m_iterating_connections);
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +			p-&gt;peer_log(peer_log_alert::outgoing, "PREDICTIVE_HAVE", "piece: %d expected in %d ms"
│ │ │ │ +				, static_cast&lt;int&gt;(index), milliseconds);
│ │ │ │ +#else
│ │ │ │ +			TORRENT_UNUSED(milliseconds);
│ │ │ │ +#endif
│ │ │ │ +			p-&gt;announce_piece(index);
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -		if (m_settings.get_int(settings_pack::proxy_type) != settings_pack::none
│ │ │ │ -			&amp;&amp; m_settings.get_bool(settings_pack::proxy_peer_connections))
│ │ │ │ -			return 0;
│ │ │ │ +		m_predictive_pieces.insert(i, index);
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -		for (auto const&amp; s : m_listen_sockets)
│ │ │ │ +	// blocks may contain the block indices of the blocks that failed (if this is
│ │ │ │ +	// a v2 torrent).
│ │ │ │ +	void torrent::piece_failed(piece_index_t const index, std::vector&lt;int&gt; blocks)
│ │ │ │ +	{
│ │ │ │ +		// if the last piece fails the peer connection will still
│ │ │ │ +		// think that it has received all of it until this function
│ │ │ │ +		// resets the download queue. So, we cannot do the
│ │ │ │ +		// invariant check here since it assumes:
│ │ │ │ +		// (total_done == m_torrent_file-&gt;total_size()) =&gt; is_seed()
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(53)">../src/torrent.cpp:4919</a></td><td>abort lookups this torrent has made via the session host resolver interface</td></tr><tr id="53" style="display: none;" colspan="3"><td colspan="3"><h2>abort lookups this torrent has made via the
│ │ │ │ +session host resolver interface</h2><h4>../src/torrent.cpp:4919</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				TORRENT_UNUSED(e);
│ │ │ │ +				m_storage.reset();
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +				debug_log("Failed to flush disk cache: %s", e.what());
│ │ │ │ +#endif
│ │ │ │ +				// clients may rely on this alert to be posted, so it's probably a
│ │ │ │ +				// good idea to post it here, even though we failed
│ │ │ │ +				if (alerts().should_post&lt;cache_flushed_alert&gt;())
│ │ │ │ +					alerts().emplace_alert&lt;cache_flushed_alert&gt;(get_handle());
│ │ │ │ +			}
│ │ │ │ +			m_ses.deferred_submit_jobs();
│ │ │ │ +		}
│ │ │ │ +		else
│ │ │ │  		{
│ │ │ │ -			if (!(s-&gt;flags &amp; listen_socket_t::accept_incoming)) continue;
│ │ │ │ -			if (s-&gt;ssl == transport::ssl)
│ │ │ │ -				return std::uint16_t(s-&gt;tcp_external_port());
│ │ │ │ +			if (alerts().should_post&lt;cache_flushed_alert&gt;())
│ │ │ │ +				alerts().emplace_alert&lt;cache_flushed_alert&gt;(get_handle());
│ │ │ │ +			alerts().emplace_alert&lt;torrent_removed_alert&gt;(get_handle()
│ │ │ │ +				, info_hash(), get_userdata());
│ │ │ │  		}
│ │ │ │ -#else
│ │ │ │ -		TORRENT_UNUSED(sock);
│ │ │ │ -#endif
│ │ │ │ -		return 0;
│ │ │ │ -	}
│ │ │ │  
│ │ │ │ -	int session_impl::get_listen_port(transport const ssl, aux::listen_socket_handle const&amp; s)
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(54)">../src/session_impl.cpp:6390</a></td><td>this should be factored into the udp socket, so we only have the code once</td></tr><tr id="54" style="display: none;" colspan="3"><td colspan="3"><h2>this should be factored into the udp socket, so we only have the
│ │ │ │ -code once</h2><h4>../src/session_impl.cpp:6390</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		return upload_rate_limit(m_local_peer_class);
│ │ │ │ -	}
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>		if (!m_apply_ip_filter)
│ │ │ │ +		{
│ │ │ │ +			inc_stats_counter(counters::non_filter_torrents, -1);
│ │ │ │ +			m_apply_ip_filter = true;
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -	int session_impl::local_download_rate_limit() const
│ │ │ │ -	{
│ │ │ │ -		return download_rate_limit(m_local_peer_class);
│ │ │ │ +		m_paused = false;
│ │ │ │ +		m_auto_managed = false;
│ │ │ │ +		update_state_list();
│ │ │ │ +		for (torrent_list_index_t i{}; i != m_links.end_index(); ++i)
│ │ │ │ +		{
│ │ │ │ +			if (!m_links[i].in_list()) continue;
│ │ │ │ +			m_links[i].unlink(m_ses.torrent_list(i), i);
│ │ │ │ +		}
│ │ │ │ +		// don't re-add this torrent to the state-update list
│ │ │ │ +		m_state_subscription = false;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	int session_impl::upload_rate_limit_depr() const
│ │ │ │ +	// this is called when we're destructing non-gracefully. i.e. we're _just_
│ │ │ │ +	// destructing everything.
│ │ │ │ +	void torrent::panic()
│ │ │ │  	{
│ │ │ │ -		return upload_rate_limit(m_global_class);
│ │ │ │ -	}
│ │ │ │ +		m_storage.reset();
│ │ │ │ +		// if there are any other peers allocated still, we need to clear them
│ │ │ │ +		// now. They can't be cleared later because the allocator will already
│ │ │ │ +		// have been destructed
│ │ │ │ +		if (m_peer_list) m_peer_list-&gt;clear();
│ │ │ │ +		m_connections.clear();
│ │ │ │ +		m_outgoing_pids.clear();
│ │ │ │ +		m_peers_to_disconnect.clear();
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(54)">../src/torrent.cpp:8032</a></td><td>if peer is a really good peer, maybe we shouldn't disconnect it perhaps this logic should be disabled if we have too many idle peers (with some definition of idle)</td></tr><tr id="54" style="display: none;" colspan="3"><td colspan="3"><h2>if peer is a really good peer, maybe we shouldn't disconnect it
│ │ │ │ +perhaps this logic should be disabled if we have too many idle peers
│ │ │ │ +(with some definition of idle)</h2><h4>../src/torrent.cpp:8032</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +		m_peers_to_disconnect.reserve(m_connections.size() + 1);
│ │ │ │ +		m_connections.reserve(m_connections.size() + 1);
│ │ │ │  
│ │ │ │ -	int session_impl::download_rate_limit_depr() const
│ │ │ │ -	{
│ │ │ │ -		return download_rate_limit(m_global_class);
│ │ │ │ -	}
│ │ │ │ -#endif // DEPRECATE
│ │ │ │ +#if TORRENT_USE_ASSERTS
│ │ │ │ +		error_code ec;
│ │ │ │ +		TORRENT_ASSERT(p-&gt;remote() == p-&gt;get_socket().remote_endpoint(ec) || ec);
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ +		TORRENT_ASSERT(p-&gt;peer_info_struct() != nullptr);
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">	void session_impl::update_peer_dscp()
│ │ │ │ -</div>	{
│ │ │ │ -		int const value = m_settings.get_int(settings_pack::peer_dscp);
│ │ │ │ -		for (auto const&amp; l : m_listen_sockets)
│ │ │ │ +		// we need to do this after we've added the peer to the peer_list
│ │ │ │ +		// since that's when the peer is assigned its peer_info object,
│ │ │ │ +		// which holds the rank
│ │ │ │ +		if (maybe_replace_peer)
│ │ │ │  		{
│ │ │ │ -			if (l-&gt;sock)
│ │ │ │ -			{
│ │ │ │ -				error_code ec;
│ │ │ │ -				set_traffic_class(*l-&gt;sock, value, ec);
│ │ │ │ +			// now, find the lowest rank peer and disconnect that
│ │ │ │ +			// if it's lower rank than the incoming connection
│ │ │ │ +			peer_connection* peer = find_lowest_ranking_peer();
│ │ │ │  
│ │ │ │ +<div style="background: #ffff00" width="100%">			if (peer != nullptr &amp;&amp; peer-&gt;peer_rank() &lt; p-&gt;peer_rank())
│ │ │ │ +</div>			{
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  				if (should_log())
│ │ │ │  				{
│ │ │ │ -					session_log("&gt;&gt;&gt; SET_DSCP [ tcp (%s %d) value: %x e: %s ]"
│ │ │ │ -						, l-&gt;sock-&gt;local_endpoint().address().to_string().c_str()
│ │ │ │ -						, l-&gt;sock-&gt;local_endpoint().port(), value, ec.message().c_str());
│ │ │ │ +					debug_log("CLOSING CONNECTION \"%s\" peer list full (low peer rank) "
│ │ │ │ +						"connections: %d limit: %d"
│ │ │ │ +						, print_endpoint(peer-&gt;remote()).c_str()
│ │ │ │ +						, num_peers()
│ │ │ │ +						, m_max_connections);
│ │ │ │  				}
│ │ │ │  #endif
│ │ │ │ +				peer-&gt;disconnect(errors::too_many_connections, operation_t::bittorrent);
│ │ │ │ +				p-&gt;peer_disconnected_other();
│ │ │ │  			}
│ │ │ │ -
│ │ │ │ -			if (l-&gt;udp_sock)
│ │ │ │ +			else
│ │ │ │  			{
│ │ │ │ -				error_code ec;
│ │ │ │ -				set_traffic_class(l-&gt;udp_sock-&gt;sock, value, ec);
│ │ │ │ -
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  				if (should_log())
│ │ │ │  				{
│ │ │ │ -					session_log("&gt;&gt;&gt; SET_DSCP [ udp (%s %d) value: %x e: %s ]"
│ │ │ │ -						, l-&gt;udp_sock-&gt;sock.local_endpoint().address().to_string().c_str()
│ │ │ │ -						, l-&gt;udp_sock-&gt;sock.local_port()
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(55)">../src/udp_tracker_connection.cpp:81</a></td><td>support authentication here. tracker_req().auth</td></tr><tr id="55" style="display: none;" colspan="3"><td colspan="3"><h2>support authentication here. tracker_req().auth</h2><h4>../src/udp_tracker_connection.cpp:81</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		udp_tracker_connection::m_connection_cache;
│ │ │ │ -
│ │ │ │ -	std::mutex udp_tracker_connection::m_cache_mutex;
│ │ │ │ -
│ │ │ │ -	udp_tracker_connection::udp_tracker_connection(
│ │ │ │ -		io_context&amp; ios
│ │ │ │ -		, tracker_manager&amp; man
│ │ │ │ -		, tracker_request const&amp; req
│ │ │ │ -		, std::weak_ptr&lt;request_callback&gt; c)
│ │ │ │ -		: tracker_connection(man, req, ios, std::move(c))
│ │ │ │ -		, m_transaction_id(0)
│ │ │ │ -		, m_attempts(0)
│ │ │ │ -		, m_state(action_t::error)
│ │ │ │ -		, m_abort(false)
│ │ │ │ -	{
│ │ │ │ -		update_transaction_id();
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void udp_tracker_connection::start()
│ │ │ │ -	{
│ │ │ │ -<div style="background: #ffff00" width="100%">		std::string hostname;
│ │ │ │ -</div>		std::string protocol;
│ │ │ │ -		int port;
│ │ │ │ -		error_code ec;
│ │ │ │ -
│ │ │ │ -		std::tie(protocol, std::ignore, hostname, port, std::ignore)
│ │ │ │ -			= parse_url_components(tracker_req().url, ec);
│ │ │ │ -		if (port == -1) port = protocol == "http" ? 80 : 443;
│ │ │ │ -
│ │ │ │ -		if (ec)
│ │ │ │ -		{
│ │ │ │ -			tracker_connection::fail(ec, operation_t::parse_address);
│ │ │ │ -			return;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		aux::session_settings const&amp; settings = m_man.settings();
│ │ │ │ -
│ │ │ │ -		int const proxy_type = settings.get_int(settings_pack::proxy_type);
│ │ │ │ -
│ │ │ │ -		if (settings.get_bool(settings_pack::proxy_hostnames)
│ │ │ │ -			&amp;&amp; (proxy_type == settings_pack::socks5
│ │ │ │ -				|| proxy_type == settings_pack::socks5_pw))
│ │ │ │ -		{
│ │ │ │ -			m_hostname = hostname;
│ │ │ │ -			m_target.port(std::uint16_t(port));
│ │ │ │ -			start_announce();
│ │ │ │ -		}
│ │ │ │ -		else
│ │ │ │ -		{
│ │ │ │ -			using namespace std::placeholders;
│ │ │ │ -			ADD_OUTSTANDING_ASYNC("udp_tracker_connection::name_lookup");
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(56)">../src/alert_manager.cpp:80</a></td><td>keep a count of the number of threads waiting. Only if it's > 0 notify them</td></tr><tr id="56" style="display: none;" colspan="3"><td colspan="3"><h2>keep a count of the number of threads waiting. Only if it's
│ │ │ │ -> 0 notify them</h2><h4>../src/alert_manager.cpp:80</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			return m_alerts[m_generation].front();
│ │ │ │ -
│ │ │ │ -		// this call can be interrupted prematurely by other signals
│ │ │ │ -		m_condition.wait_for(lock, max_wait);
│ │ │ │ -		if (!m_alerts[m_generation].empty())
│ │ │ │ -			return m_alerts[m_generation].front();
│ │ │ │ +					debug_log("CLOSING CONNECTION \"%s\" peer list full (low peer rank) "
│ │ │ │ +						"connections: %d limit: %d"
│ │ │ │ +						, print_endpoint(p-&gt;remote()).c_str()
│ │ │ │ +						, num_peers()
│ │ │ │ +						, m_max_connections);
│ │ │ │ +				}
│ │ │ │ +#endif
│ │ │ │ +				p-&gt;disconnect(errors::too_many_connections, operation_t::bittorrent);
│ │ │ │ +				// we have to do this here because from the peer's point of view
│ │ │ │ +				// it wasn't really attached to the torrent, but we do need
│ │ │ │ +				// to let peer_list know we're removing it
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(55)">../src/web_peer_connection.cpp:626</a></td><td>just make this peer not have the pieces associated with the file we just requested. Only when it doesn't have any of the file do the following pad files will make it complicated</td></tr><tr id="55" style="display: none;" colspan="3"><td colspan="3"><h2>just make this peer not have the pieces
│ │ │ │ +associated with the file we just requested. Only
│ │ │ │ +when it doesn't have any of the file do the following
│ │ │ │ +pad files will make it complicated</h2><h4>../src/web_peer_connection.cpp:626</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +	peer_connection::received_invalid_data(index, single_peer);
│ │ │ │  
│ │ │ │ -		return nullptr;
│ │ │ │ -	}
│ │ │ │ +	// if we don't think we have any of the files, allow banning the web seed
│ │ │ │ +	if (num_have_pieces() == 0) return true;
│ │ │ │  
│ │ │ │ -	void alert_manager::maybe_notify(alert* a)
│ │ │ │ -	{
│ │ │ │ -		if (m_alerts[m_generation].size() == 1)
│ │ │ │ -		{
│ │ │ │ -			// we just posted to an empty queue. If anyone is waiting for
│ │ │ │ -			// alerts, we need to notify them. Also (potentially) call the
│ │ │ │ -			// user supplied m_notify callback to let the client wake up its
│ │ │ │ -			// message loop to poll for alerts.
│ │ │ │ -			if (m_notify) m_notify();
│ │ │ │ +	// don't disconnect, we won't request anything from this file again
│ │ │ │ +	return false;
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">			m_condition.notify_all();
│ │ │ │ -</div>		}
│ │ │ │ +void web_peer_connection::on_receive_padfile()
│ │ │ │ +{
│ │ │ │ +	handle_padfile();
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DISABLE_EXTENSIONS
│ │ │ │ -		for (auto&amp; e : m_ses_extensions)
│ │ │ │ -			e-&gt;on_alert(a);
│ │ │ │ -#else
│ │ │ │ -		TORRENT_UNUSED(a);
│ │ │ │ -#endif
│ │ │ │ -	}
│ │ │ │ +void web_peer_connection::handle_error(int const bytes_left)
│ │ │ │ +{
│ │ │ │ +	std::shared_ptr&lt;torrent&gt; t = associated_torrent().lock();
│ │ │ │ +	TORRENT_ASSERT(t);
│ │ │ │  
│ │ │ │ -	void alert_manager::set_notify_function(std::function&lt;void()&gt; const&amp; fun)
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>	// temporarily unavailable, retry later
│ │ │ │ +	t-&gt;retry_web_seed(this, m_parser.header_duration("retry-after"));
│ │ │ │ +	if (t-&gt;alerts().should_post&lt;url_seed_alert&gt;())
│ │ │ │  	{
│ │ │ │ -		std::unique_lock&lt;std::recursive_mutex&gt; lock(m_mutex);
│ │ │ │ -		m_notify = fun;
│ │ │ │ -		if (!m_alerts[m_generation].empty())
│ │ │ │ -		{
│ │ │ │ -			if (m_notify) m_notify();
│ │ │ │ -		}
│ │ │ │ +		std::string const error_msg = to_string(m_parser.status_code()).data()
│ │ │ │ +			+ (" " + m_parser.message());
│ │ │ │ +		t-&gt;alerts().emplace_alert&lt;url_seed_alert&gt;(t-&gt;get_handle(), m_url
│ │ │ │ +			, error_msg);
│ │ │ │  	}
│ │ │ │ +	received_bytes(0, bytes_left);
│ │ │ │ +	disconnect(error_code(m_parser.status_code(), http_category()), operation_t::bittorrent, failure);
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DISABLE_EXTENSIONS
│ │ │ │ -	void alert_manager::add_extension(std::shared_ptr&lt;plugin&gt; ext)
│ │ │ │ +void web_peer_connection::disable(error_code const&amp; ec)
│ │ │ │ +{
│ │ │ │ +	// we should not try this server again.
│ │ │ │ +	m_web-&gt;disabled = true;
│ │ │ │ +	disconnect(ec, operation_t::bittorrent, peer_error);
│ │ │ │ +	if (m_web-&gt;ephemeral)
│ │ │ │  	{
│ │ │ │ -		m_ses_extensions.push_back(std::move(ext));
│ │ │ │ +		std::shared_ptr&lt;torrent&gt; t = associated_torrent().lock();
│ │ │ │ +		TORRENT_ASSERT(t);
│ │ │ │ +		t-&gt;remove_web_seed_conn(this);
│ │ │ │  	}
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -	void alert_manager::get_all(std::vector&lt;alert*&gt;&amp; alerts)
│ │ │ │ -	{
│ │ │ │ -		std::lock_guard&lt;std::recursive_mutex&gt; lock(m_mutex);
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(57)">../src/instantiate_connection.cpp:44</a></td><td>peer_connection and tracker_connection should probably be flags</td></tr><tr id="57" style="display: none;" colspan="3"><td colspan="3"><h2>peer_connection and tracker_connection should probably be flags</h2><h4>../src/instantiate_connection.cpp:44</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
│ │ │ │ -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
│ │ │ │ -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
│ │ │ │ -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
│ │ │ │ -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
│ │ │ │ -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
│ │ │ │ -POSSIBILITY OF SUCH DAMAGE.
│ │ │ │ -
│ │ │ │ -*/
│ │ │ │ -
│ │ │ │ -#include "libtorrent/socket.hpp"
│ │ │ │ -#include "libtorrent/aux_/socket_type.hpp"
│ │ │ │ -#include "libtorrent/aux_/utp_socket_manager.hpp"
│ │ │ │ -#include "libtorrent/aux_/instantiate_connection.hpp"
│ │ │ │ -#include "libtorrent/aux_/utp_stream.hpp"
│ │ │ │ -#include "libtorrent/ssl_stream.hpp"
│ │ │ │ -
│ │ │ │ -namespace libtorrent { namespace aux {
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	aux::socket_type instantiate_connection(io_context&amp; ios
│ │ │ │ -</div>		, aux::proxy_settings const&amp; ps
│ │ │ │ -		, void* ssl_context
│ │ │ │ -		, utp_socket_manager* sm
│ │ │ │ -		, bool peer_connection
│ │ │ │ -		, bool tracker_connection)
│ │ │ │ -	{
│ │ │ │ -#if !TORRENT_USE_SSL
│ │ │ │ -		TORRENT_UNUSED(ssl_context);
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		if (sm)
│ │ │ │ -		{
│ │ │ │ -#if TORRENT_USE_SSL
│ │ │ │ -			if (ssl_context)
│ │ │ │ -			{
│ │ │ │ -				ssl_stream&lt;utp_stream&gt; s(ios, *static_cast&lt;ssl::context*&gt;(ssl_context));
│ │ │ │ -				s.next_layer().set_impl(sm-&gt;new_utp_socket(&amp;s.next_layer()));
│ │ │ │ -				return socket_type(std::move(s));
│ │ │ │ -			}
│ │ │ │ -			else
│ │ │ │ -#endif
│ │ │ │ -			{
│ │ │ │ -				utp_stream s(ios);
│ │ │ │ -				s.set_impl(sm-&gt;new_utp_socket(&amp;s));
│ │ │ │ -				return socket_type(std::move(s));
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ -#if TORRENT_USE_I2P
│ │ │ │ -		else if (ps.type == settings_pack::i2p_proxy)
│ │ │ │ -		{
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(58)">../src/alert.cpp:2021</a></td><td>the salt here is allocated on the heap. It would be nice to allocate in the stack_allocator</td></tr><tr id="58" style="display: none;" colspan="3"><td colspan="3"><h2>the salt here is allocated on the heap. It would be nice to
│ │ │ │ -allocate in the stack_allocator</h2><h4>../src/alert.cpp:2021</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │ -
│ │ │ │ -	dht_immutable_item_alert::dht_immutable_item_alert(aux::stack_allocator&amp;
│ │ │ │ -		, sha1_hash const&amp; t, entry i)
│ │ │ │ -		: target(t), item(std::move(i))
│ │ │ │ -	{}
│ │ │ │ +	m_web = nullptr;
│ │ │ │ +	TORRENT_ASSERT(is_disconnecting());
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -	std::string dht_immutable_item_alert::message() const
│ │ │ │ +void web_peer_connection::handle_redirect(int const bytes_left)
│ │ │ │ +{
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(56)">../src/peer_list.cpp:539</a></td><td>it would be nice if there was a way to iterate over these torrent_peer objects in the order they are allocated in the pool instead. It would probably be more efficient</td></tr><tr id="56" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice if there was a way to iterate over these
│ │ │ │ +torrent_peer objects in the order they are allocated in the pool
│ │ │ │ +instead. It would probably be more efficient</h2><h4>../src/peer_list.cpp:539</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		, int session_time, torrent_state* state)
│ │ │ │  	{
│ │ │ │ -#ifdef TORRENT_DISABLE_ALERT_MSG
│ │ │ │ -		return {};
│ │ │ │ -#else
│ │ │ │ -		char msg[1050];
│ │ │ │ -		std::snprintf(msg, sizeof(msg), "DHT immutable item %s [ %s ]"
│ │ │ │ -			, aux::to_hex(target).c_str()
│ │ │ │ -			, item.to_string().c_str());
│ │ │ │ -		return msg;
│ │ │ │ -#endif
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	dht_mutable_item_alert::dht_mutable_item_alert(aux::stack_allocator&amp;
│ │ │ │ -</div>		, std::array&lt;char, 32&gt; const&amp; k
│ │ │ │ -		, std::array&lt;char, 64&gt; const&amp; sig
│ │ │ │ -		, std::int64_t sequence
│ │ │ │ -		, string_view s
│ │ │ │ -		, entry i
│ │ │ │ -		, bool a)
│ │ │ │ -		: key(k), signature(sig), seq(sequence), salt(s), item(std::move(i)), authoritative(a)
│ │ │ │ -	{}
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +		INVARIANT_CHECK;
│ │ │ │  
│ │ │ │ -	std::string dht_mutable_item_alert::message() const
│ │ │ │ -	{
│ │ │ │ -#ifdef TORRENT_DISABLE_ALERT_MSG
│ │ │ │ -		return {};
│ │ │ │ -#else
│ │ │ │ -		char msg[1050];
│ │ │ │ -		std::snprintf(msg, sizeof(msg), "DHT mutable item (key=%s salt=%s seq=%" PRId64 " %s) [ %s ]"
│ │ │ │ -			, aux::to_hex(key).c_str()
│ │ │ │ -			, salt.c_str()
│ │ │ │ -			, seq
│ │ │ │ -			, authoritative ? "auth" : "non-auth"
│ │ │ │ -			, item.to_string().c_str());
│ │ │ │ -		return msg;
│ │ │ │ -#endif
│ │ │ │ -	}
│ │ │ │ +		const int candidate_count = 10;
│ │ │ │ +		peers.reserve(candidate_count);
│ │ │ │  
│ │ │ │ -	dht_put_alert::dht_put_alert(aux::stack_allocator&amp;, sha1_hash const&amp; t, int n)
│ │ │ │ -		: target(t)
│ │ │ │ -		, public_key()
│ │ │ │ -		, signature()
│ │ │ │ -		, salt()
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(59)">../src/storage_utils.cpp:294</a></td><td>technically, this is where the transaction of moving the files is completed. This is where the new save_path should be committed. If there is an error in the code below, that should not prevent the new save path to be set. Maybe it would make sense to make the save_path an in-out parameter</td></tr><tr id="59" style="display: none;" colspan="3"><td colspan="3"><h2>technically, this is where the transaction of moving the files
│ │ │ │ -is completed. This is where the new save_path should be committed. If
│ │ │ │ -there is an error in the code below, that should not prevent the new
│ │ │ │ -save path to be set. Maybe it would make sense to make the save_path
│ │ │ │ -an in-out parameter</h2><h4>../src/storage_utils.cpp:294</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			while (--file_index &gt;= file_index_t(0))
│ │ │ │ -			{
│ │ │ │ -				// files moved out to absolute paths are not moved
│ │ │ │ -				if (f.file_absolute_path(file_index)) continue;
│ │ │ │ +		int erase_candidate = -1;
│ │ │ │  
│ │ │ │ -				// if we ended up copying the file, don't do anything during
│ │ │ │ -				// roll-back
│ │ │ │ -				if (copied_files[file_index]) continue;
│ │ │ │ +		if (bool(m_finished) != state-&gt;is_finished)
│ │ │ │ +			recalculate_connect_candidates(state);
│ │ │ │  
│ │ │ │ -				std::string const old_path = combine_path(save_path, f.file_path(file_index));
│ │ │ │ -				std::string const new_path = combine_path(new_save_path, f.file_path(file_index));
│ │ │ │ +		external_ip const&amp; external = state-&gt;ip;
│ │ │ │ +		int external_port = state-&gt;port;
│ │ │ │  
│ │ │ │ -				// ignore errors when rolling back
│ │ │ │ -				storage_error ignore;
│ │ │ │ -				move_file(new_path, old_path, ignore);
│ │ │ │ -			}
│ │ │ │ +		if (m_round_robin &gt;= int(m_peers.size())) m_round_robin = 0;
│ │ │ │  
│ │ │ │ -			return { status_t::fatal_disk_error, save_path };
│ │ │ │ -		}
│ │ │ │ +		int max_peerlist_size = state-&gt;max_peerlist_size;
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>		std::set&lt;std::string&gt; subdirs;
│ │ │ │ -		for (auto const i : f.file_range())
│ │ │ │ +<div style="background: #ffff00" width="100%">		for (int iterations = std::min(int(m_peers.size()), 300);
│ │ │ │ +</div>			iterations &gt; 0; --iterations)
│ │ │ │  		{
│ │ │ │ -			// files moved out to absolute paths are not moved
│ │ │ │ -			if (f.file_absolute_path(i)) continue;
│ │ │ │ -
│ │ │ │ -			if (has_parent_path(f.file_path(i)))
│ │ │ │ -				subdirs.insert(parent_path(f.file_path(i)));
│ │ │ │ -
│ │ │ │ -			// if we ended up renaming the file instead of moving it, there's no
│ │ │ │ -			// need to delete the source.
│ │ │ │ -			if (copied_files[i] == false) continue;
│ │ │ │ +			++state-&gt;loop_counter;
│ │ │ │  
│ │ │ │ -			std::string const old_path = combine_path(save_path, f.file_path(i));
│ │ │ │ +			if (m_round_robin &gt;= int(m_peers.size())) m_round_robin = 0;
│ │ │ │  
│ │ │ │ -			// we may still have some files in old save_path
│ │ │ │ -			// eg. if (flags == dont_replace &amp;&amp; exists(new_path))
│ │ │ │ -			// ignore errors when removing
│ │ │ │ -			error_code ignore;
│ │ │ │ -			remove(old_path, ignore);
│ │ │ │ -		}
│ │ │ │ +			torrent_peer&amp; pe = *m_peers[m_round_robin];
│ │ │ │ +			TORRENT_ASSERT(pe.in_use);
│ │ │ │ +			int current = m_round_robin;
│ │ │ │  
│ │ │ │ -		for (std::string const&amp; s : subdirs)
│ │ │ │ -		{
│ │ │ │ -			error_code err;
│ │ │ │ -			std::string subdir = combine_path(save_path, s);
│ │ │ │ +			// if the number of peers is growing large
│ │ │ │ +			// we need to start weeding.
│ │ │ │  
│ │ │ │ -			while (!path_equal(subdir, save_path) &amp;&amp; !err)
│ │ │ │ +			if (int(m_peers.size()) &gt;= max_peerlist_size * 0.95
│ │ │ │ +				&amp;&amp; max_peerlist_size &gt; 0)
│ │ │ │  			{
│ │ │ │ -				remove(subdir, err);
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(60)">../src/storage_utils.cpp:486</a></td><td>is this risky? The upper layer will assume we have the whole file. Perhaps we should verify that at least the size of the file is correct</td></tr><tr id="60" style="display: none;" colspan="3"><td colspan="3"><h2>is this risky? The upper layer will assume we have the
│ │ │ │ -whole file. Perhaps we should verify that at least the size
│ │ │ │ -of the file is correct</h2><h4>../src/storage_utils.cpp:486</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				{
│ │ │ │ -					// we create directories lazily, so it's possible it hasn't
│ │ │ │ -					// been created yet. Create the directories now and try
│ │ │ │ -					// again
│ │ │ │ -					create_directories(parent_path(file_path), err);
│ │ │ │ -
│ │ │ │ -					if (err)
│ │ │ │ +				if (is_erase_candidate(pe)
│ │ │ │ +					&amp;&amp; (erase_candidate == -1
│ │ │ │ +						|| !compare_peer_erase(*m_peers[erase_candidate], pe)))
│ │ │ │ +				{
│ │ │ │ +					if (should_erase_immediately(pe))
│ │ │ │  					{
│ │ │ │ -						ec.file(idx);
│ │ │ │ -						ec.operation = operation_t::mkdir;
│ │ │ │ -						return false;
│ │ │ │ +						if (erase_candidate &gt; current) --erase_candidate;
│ │ │ │ +						erase_peer(m_peers.begin() + current, state);
│ │ │ │ +						continue;
│ │ │ │ +					}
│ │ │ │ +					else
│ │ │ │ +					{
│ │ │ │ +						erase_candidate = current;
│ │ │ │  					}
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(57)">../src/upnp.cpp:106</a></td><td>use boost::asio::ip::network instead of netmask</td></tr><tr id="57" style="display: none;" colspan="3"><td colspan="3"><h2>use boost::asio::ip::network instead of netmask</h2><h4>../src/upnp.cpp:106</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +static error_code ignore_error;
│ │ │ │  
│ │ │ │ -					hard_link(s, file_path, err);
│ │ │ │ -				}
│ │ │ │ +upnp::rootdevice::rootdevice() = default;
│ │ │ │  
│ │ │ │ -				// if the file already exists, that's not an error
│ │ │ │ -				if (err == boost::system::errc::file_exists)
│ │ │ │ -					continue;
│ │ │ │ +#if TORRENT_USE_ASSERTS
│ │ │ │ +upnp::rootdevice::~rootdevice()
│ │ │ │ +{
│ │ │ │ +	TORRENT_ASSERT(magic == 1337);
│ │ │ │ +	magic = 0;
│ │ │ │ +}
│ │ │ │ +#else
│ │ │ │ +upnp::rootdevice::~rootdevice() = default;
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">				if (err)
│ │ │ │ -</div>				{
│ │ │ │ -					ec.ec = err;
│ │ │ │ -					ec.file(idx);
│ │ │ │ -					ec.operation = operation_t::file_hard_link;
│ │ │ │ -					return false;
│ │ │ │ -				}
│ │ │ │ -				added_files = true;
│ │ │ │ -				stat.set_dirty(idx);
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ -#endif // TORRENT_DISABLE_MUTABLE_TORRENTS
│ │ │ │ +upnp::rootdevice::rootdevice(rootdevice const&amp;) = default;
│ │ │ │ +upnp::rootdevice&amp; upnp::rootdevice::operator=(rootdevice const&amp;) &amp; = default;
│ │ │ │ +upnp::rootdevice::rootdevice(rootdevice&amp;&amp;) noexcept = default;
│ │ │ │ +upnp::rootdevice&amp; upnp::rootdevice::operator=(rootdevice&amp;&amp;) &amp; = default;
│ │ │ │  
│ │ │ │ -		bool const seed = (rd.have_pieces.size() &gt;= fs.num_pieces()
│ │ │ │ -			&amp;&amp; rd.have_pieces.all_set())
│ │ │ │ -			|| (rd.flags &amp; torrent_flags::seed_mode);
│ │ │ │ +<div style="background: #ffff00" width="100%">upnp::upnp(io_context&amp; ios
│ │ │ │ +</div>	, aux::session_settings const&amp; settings
│ │ │ │ +	, aux::portmap_callback&amp; cb
│ │ │ │ +	, address_v4 const listen_address
│ │ │ │ +	, address_v4 const netmask
│ │ │ │ +	, std::string listen_device
│ │ │ │ +	, listen_socket_handle ls)
│ │ │ │ +	: m_settings(settings)
│ │ │ │ +	, m_callback(cb)
│ │ │ │ +	, m_io_service(ios)
│ │ │ │ +	, m_resolver(ios)
│ │ │ │ +	, m_multicast(ios)
│ │ │ │ +	, m_unicast(ios)
│ │ │ │ +	, m_broadcast_timer(ios)
│ │ │ │ +	, m_refresh_timer(ios)
│ │ │ │ +	, m_map_timer(ios)
│ │ │ │ +	, m_listen_address(listen_address)
│ │ │ │ +	, m_netmask(netmask)
│ │ │ │ +	, m_device(std::move(listen_device))
│ │ │ │ +#if TORRENT_USE_SSL
│ │ │ │ +	, m_ssl_ctx(ssl::context::sslv23_client)
│ │ │ │ +#endif
│ │ │ │ +	, m_listen_handle(std::move(ls))
│ │ │ │ +{
│ │ │ │ +#if TORRENT_USE_SSL
│ │ │ │ +	m_ssl_ctx.set_verify_mode(ssl::context::verify_none);
│ │ │ │ +#endif
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -		if (seed)
│ │ │ │ -		{
│ │ │ │ -			for (file_index_t const file_index : fs.file_range())
│ │ │ │ -			{
│ │ │ │ -				if (fs.pad_file_at(file_index)) continue;
│ │ │ │ +void upnp::start()
│ │ │ │ +{
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(58)">../src/path.cpp:429</a></td><td>test this on a FAT volume to see what error we get!</td></tr><tr id="58" style="display: none;" colspan="3"><td colspan="3"><h2>test this on a FAT volume to see what error we get!</h2><h4>../src/path.cpp:429</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			// it's possible CreateHardLink will copy the file internally too,
│ │ │ │ +			// if the filesystem does not support it.
│ │ │ │ +			ec.assign(GetLastError(), system_category());
│ │ │ │ +			return;
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -				// files with priority zero may not have been saved to disk at their
│ │ │ │ -				// expected location, but is likely to be in a partfile. Just exempt it
│ │ │ │ -				// from checking
│ │ │ │ -				if (file_index &lt; file_priority.end_index()
│ │ │ │ -					&amp;&amp; file_priority[file_index] == dont_download
│ │ │ │ -					&amp;&amp; !(rd.flags &amp; torrent_flags::seed_mode))
│ │ │ │ -					continue;
│ │ │ │ +		// fall back to making a copy
│ │ │ │ +#endif
│ │ │ │ +#else
│ │ │ │ +		// assume posix's link() function exists
│ │ │ │ +		int ret = ::link(n_exist.c_str(), n_link.c_str());
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(61)">../src/escape_string.cpp:194</a></td><td>this should probably be moved into string_util.cpp</td></tr><tr id="61" style="display: none;" colspan="3"><td colspan="3"><h2>this should probably be moved into string_util.cpp</h2><h4>../src/escape_string.cpp:194</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{
│ │ │ │ -		return escape_string_impl(str.data(), int(str.size()), 10);
│ │ │ │ -	}
│ │ │ │ +		if (ret == 0)
│ │ │ │ +		{
│ │ │ │ +			ec.clear();
│ │ │ │ +			return;
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -	bool need_encoding(char const* str, int const len)
│ │ │ │ -	{
│ │ │ │ -		for (int i = 0; i &lt; len; ++i)
│ │ │ │ +		// most errors are passed through, except for the ones that indicate that
│ │ │ │ +		// hard links are not supported and require a copy.
│ │ │ │ +<div style="background: #ffff00" width="100%">		if (errno != EMLINK
│ │ │ │ +</div>			&amp;&amp; errno != EXDEV
│ │ │ │ +#ifdef TORRENT_BEOS
│ │ │ │ +			// haiku returns EPERM when the filesystem doesn't support hard link
│ │ │ │ +			&amp;&amp; errno != EPERM
│ │ │ │ +#endif
│ │ │ │ +			)
│ │ │ │  		{
│ │ │ │ -			if (std::strchr(unreserved_chars, *str) == nullptr || *str == 0)
│ │ │ │ -				return true;
│ │ │ │ -			++str;
│ │ │ │ +			// some error happened, report up to the caller
│ │ │ │ +			ec.assign(errno, system_category());
│ │ │ │ +			return;
│ │ │ │  		}
│ │ │ │ -		return false;
│ │ │ │ -	}
│ │ │ │  
│ │ │ │ -	void convert_path_to_posix(std::string&amp; path)
│ │ │ │ -	{
│ │ │ │ -		std::replace(path.begin(), path.end(), '\\', '/');
│ │ │ │ -	}
│ │ │ │ +		// fall back to making a copy
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">	std::string read_until(char const*&amp; str, char const delim, char const* end)
│ │ │ │ -</div>	{
│ │ │ │ -		TORRENT_ASSERT(str &lt;= end);
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -		std::string ret;
│ │ │ │ -		while (str != end &amp;&amp; *str != delim)
│ │ │ │ -		{
│ │ │ │ -			ret += *str;
│ │ │ │ -			++str;
│ │ │ │ -		}
│ │ │ │ -		// skip the delimiter as well
│ │ │ │ -		while (str != end &amp;&amp; *str == delim) ++str;
│ │ │ │ -		return ret;
│ │ │ │ +		// if we get here, we should copy the file
│ │ │ │ +		storage_error se;
│ │ │ │ +		aux::copy_file(file, link, se);
│ │ │ │ +		ec = se.ec;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	std::string maybe_url_encode(std::string const&amp; url)
│ │ │ │ +	bool is_directory(std::string const&amp; f, error_code&amp; ec)
│ │ │ │  	{
│ │ │ │ -		std::string protocol, host, auth, path;
│ │ │ │ -		int port;
│ │ │ │ -		error_code ec;
│ │ │ │ -		std::tie(protocol, auth, host, port, path) = parse_url_components(url, ec);
│ │ │ │ -		if (ec) return url;
│ │ │ │ -
│ │ │ │ -		// first figure out if this url contains unencoded characters
│ │ │ │ -		if (!need_encoding(path.c_str(), int(path.size())))
│ │ │ │ -			return url;
│ │ │ │ -
│ │ │ │ -		std::string msg;
│ │ │ │ -		std::string escaped_path { escape_path(path) };
│ │ │ │ -		// reserve enough space so further append will
│ │ │ │ -		// only copy values to existing location
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(62)">../src/peer_connection.cpp:2562</a></td><td>this should probably be based on time instead of number of request messages. For a very high throughput connection, 300 may be a legitimate number of requests to have in flight when getting choked</td></tr><tr id="62" style="display: none;" colspan="3"><td colspan="3"><h2>this should probably be based on time instead of number
│ │ │ │ +		ec.clear();
│ │ │ │ +		error_code e;
│ │ │ │ +		file_status s;
│ │ │ │ +		stat_file(f, &amp;s, e);
│ │ │ │ +		if (!e &amp;&amp; s.mode &amp; file_status::directory) return true;
│ │ │ │ +		ec = e;
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(59)">../src/peer_connection.cpp:2562</a></td><td>this should probably be based on time instead of number of request messages. For a very high throughput connection, 300 may be a legitimate number of requests to have in flight when getting choked</td></tr><tr id="59" style="display: none;" colspan="3"><td colspan="3"><h2>this should probably be based on time instead of number
│ │ │ │  of request messages. For a very high throughput connection, 300
│ │ │ │  may be a legitimate number of requests to have in flight when
│ │ │ │  getting choked</h2><h4>../src/peer_connection.cpp:2562</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			}
│ │ │ │  #endif
│ │ │ │  
│ │ │ │  			write_reject_request(r);
│ │ │ │  			if (m_num_invalid_requests &lt; std::numeric_limits&lt;decltype(m_num_invalid_requests)&gt;::max())
│ │ │ │ @@ -3089,15 +2953,15 @@
│ │ │ │  		{
│ │ │ │  			disconnect(errors::too_many_requests_when_choked, operation_t::bittorrent, peer_error);
│ │ │ │  			return;
│ │ │ │  		}
│ │ │ │  
│ │ │ │  		if (m_choked &amp;&amp; fast_idx == -1)
│ │ │ │  		{
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(63)">../src/peer_connection.cpp:3309</a></td><td>since we throw away the queue entry once we issue the disk job, this may happen. Instead, we should keep the queue entry around, mark it as having been requested from disk and once the disk job comes back, discard it if it has been cancelled. Maybe even be able to cancel disk jobs?</td></tr><tr id="63" style="display: none;" colspan="3"><td colspan="3"><h2>since we throw away the queue entry once we issue
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(60)">../src/peer_connection.cpp:3309</a></td><td>since we throw away the queue entry once we issue the disk job, this may happen. Instead, we should keep the queue entry around, mark it as having been requested from disk and once the disk job comes back, discard it if it has been cancelled. Maybe even be able to cancel disk jobs?</td></tr><tr id="60" style="display: none;" colspan="3"><td colspan="3"><h2>since we throw away the queue entry once we issue
│ │ │ │  the disk job, this may happen. Instead, we should keep the
│ │ │ │  queue entry around, mark it as having been requested from
│ │ │ │  disk and once the disk job comes back, discard it if it has
│ │ │ │  been cancelled. Maybe even be able to cancel disk jobs?</h2><h4>../src/peer_connection.cpp:3309</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  		peer_log(peer_log_alert::incoming_message, "CANCEL"
│ │ │ │  			, "piece: %d s: %x l: %x", static_cast&lt;int&gt;(r.piece), r.start, r.length);
│ │ │ │ @@ -3144,15 +3008,15 @@
│ │ │ │  
│ │ │ │  	// -----------------------------
│ │ │ │  	// --------- HAVE ALL ----------
│ │ │ │  	// -----------------------------
│ │ │ │  
│ │ │ │  	void peer_connection::incoming_have_all()
│ │ │ │  	{
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(64)">../src/peer_connection.cpp:4975</a></td><td>use a deadline_timer for timeouts. Don't rely on second_tick()! Hook this up to connect timeout as well. This would improve performance because of less work in second_tick(), and might let use remove ticking entirely eventually</td></tr><tr id="64" style="display: none;" colspan="3"><td colspan="3"><h2>use a deadline_timer for timeouts. Don't rely on second_tick()!
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(61)">../src/peer_connection.cpp:4975</a></td><td>use a deadline_timer for timeouts. Don't rely on second_tick()! Hook this up to connect timeout as well. This would improve performance because of less work in second_tick(), and might let use remove ticking entirely eventually</td></tr><tr id="61" style="display: none;" colspan="3"><td colspan="3"><h2>use a deadline_timer for timeouts. Don't rely on second_tick()!
│ │ │ │  Hook this up to connect timeout as well. This would improve performance
│ │ │ │  because of less work in second_tick(), and might let use remove ticking
│ │ │ │  entirely eventually</h2><h4>../src/peer_connection.cpp:4975</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			if (d &gt; seconds(connect_timeout)
│ │ │ │  				&amp;&amp; can_disconnect(errors::timed_out))
│ │ │ │  			{
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  				peer_log(peer_log_alert::info, "CONNECT_FAILED", "waited %d seconds"
│ │ │ │ @@ -3198,14 +3062,168 @@
│ │ │ │  #endif
│ │ │ │  			disconnect(errors::timed_out_no_handshake, operation_t::bittorrent);
│ │ │ │  			return;
│ │ │ │  		}
│ │ │ │  
│ │ │ │  		// disconnect peers that we unchoked, but they didn't send a request in
│ │ │ │  		// the last 60 seconds, and we haven't been working on servicing a request
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(62)">../src/bdecode.cpp:826</a></td><td>attempt to simplify this implementation by embracing the span</td></tr><tr id="62" style="display: none;" colspan="3"><td colspan="3"><h2>attempt to simplify this implementation by embracing the span</h2><h4>../src/bdecode.cpp:826</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │ +
│ │ │ │ +	bdecode_node bdecode(span&lt;char const&gt; buffer
│ │ │ │ +		, error_code&amp; ec, int* error_pos, int depth_limit, int token_limit)
│ │ │ │ +	{
│ │ │ │ +		bdecode_node ret;
│ │ │ │ +		ec.clear();
│ │ │ │ +
│ │ │ │ +		if (buffer.size() &gt; bdecode_token::max_offset)
│ │ │ │ +		{
│ │ │ │ +			if (error_pos) *error_pos = 0;
│ │ │ │ +			ec = bdecode_errors::limit_exceeded;
│ │ │ │ +			return ret;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		// this is the stack of bdecode_token indices, into m_tokens.
│ │ │ │ +		// sp is the stack pointer, as index into the array, stack
│ │ │ │ +		int sp = 0;
│ │ │ │ +		TORRENT_ALLOCA(stack, stack_frame, depth_limit);
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		char const* start = buffer.data();
│ │ │ │ +</div>		char const* end = start + buffer.size();
│ │ │ │ +		char const* const orig_start = start;
│ │ │ │ +
│ │ │ │ +		if (start == end)
│ │ │ │ +			TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
│ │ │ │ +
│ │ │ │ +		while (start &lt;= end)
│ │ │ │ +		{
│ │ │ │ +			if (start &gt;= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
│ │ │ │ +
│ │ │ │ +			if (sp &gt;= depth_limit)
│ │ │ │ +				TORRENT_FAIL_BDECODE(bdecode_errors::depth_exceeded);
│ │ │ │ +
│ │ │ │ +			--token_limit;
│ │ │ │ +			if (token_limit &lt; 0)
│ │ │ │ +				TORRENT_FAIL_BDECODE(bdecode_errors::limit_exceeded);
│ │ │ │ +
│ │ │ │ +			// look for a new token
│ │ │ │ +			char const t = *start;
│ │ │ │ +
│ │ │ │ +			int const current_frame = sp;
│ │ │ │ +
│ │ │ │ +			// if we're currently parsing a dictionary, assert that
│ │ │ │ +			// every other node is a string.
│ │ │ │ +			if (current_frame &gt; 0
│ │ │ │ +				&amp;&amp; ret.m_tokens[stack[current_frame - 1].token].type == bdecode_token::dict)
│ │ │ │ +			{
│ │ │ │ +				if (stack[current_frame - 1].state == 0)
│ │ │ │ +				{
│ │ │ │ +					// the current parent is a dict and we are parsing a key.
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(63)">../src/udp_tracker_connection.cpp:81</a></td><td>support authentication here. tracker_req().auth</td></tr><tr id="63" style="display: none;" colspan="3"><td colspan="3"><h2>support authentication here. tracker_req().auth</h2><h4>../src/udp_tracker_connection.cpp:81</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		udp_tracker_connection::m_connection_cache;
│ │ │ │ +
│ │ │ │ +	std::mutex udp_tracker_connection::m_cache_mutex;
│ │ │ │ +
│ │ │ │ +	udp_tracker_connection::udp_tracker_connection(
│ │ │ │ +		io_context&amp; ios
│ │ │ │ +		, tracker_manager&amp; man
│ │ │ │ +		, tracker_request const&amp; req
│ │ │ │ +		, std::weak_ptr&lt;request_callback&gt; c)
│ │ │ │ +		: tracker_connection(man, req, ios, std::move(c))
│ │ │ │ +		, m_transaction_id(0)
│ │ │ │ +		, m_attempts(0)
│ │ │ │ +		, m_state(action_t::error)
│ │ │ │ +		, m_abort(false)
│ │ │ │ +	{
│ │ │ │ +		update_transaction_id();
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void udp_tracker_connection::start()
│ │ │ │ +	{
│ │ │ │ +<div style="background: #ffff00" width="100%">		std::string hostname;
│ │ │ │ +</div>		std::string protocol;
│ │ │ │ +		int port;
│ │ │ │ +		error_code ec;
│ │ │ │ +
│ │ │ │ +		std::tie(protocol, std::ignore, hostname, port, std::ignore)
│ │ │ │ +			= parse_url_components(tracker_req().url, ec);
│ │ │ │ +		if (port == -1) port = protocol == "http" ? 80 : 443;
│ │ │ │ +
│ │ │ │ +		if (ec)
│ │ │ │ +		{
│ │ │ │ +			tracker_connection::fail(ec, operation_t::parse_address);
│ │ │ │ +			return;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		aux::session_settings const&amp; settings = m_man.settings();
│ │ │ │ +
│ │ │ │ +		int const proxy_type = settings.get_int(settings_pack::proxy_type);
│ │ │ │ +
│ │ │ │ +		if (settings.get_bool(settings_pack::proxy_hostnames)
│ │ │ │ +			&amp;&amp; (proxy_type == settings_pack::socks5
│ │ │ │ +				|| proxy_type == settings_pack::socks5_pw))
│ │ │ │ +		{
│ │ │ │ +			m_hostname = hostname;
│ │ │ │ +			m_target.port(std::uint16_t(port));
│ │ │ │ +			start_announce();
│ │ │ │ +		}
│ │ │ │ +		else
│ │ │ │ +		{
│ │ │ │ +			using namespace std::placeholders;
│ │ │ │ +			ADD_OUTSTANDING_ASYNC("udp_tracker_connection::name_lookup");
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(64)">../src/alert_manager.cpp:80</a></td><td>keep a count of the number of threads waiting. Only if it's > 0 notify them</td></tr><tr id="64" style="display: none;" colspan="3"><td colspan="3"><h2>keep a count of the number of threads waiting. Only if it's
│ │ │ │ +> 0 notify them</h2><h4>../src/alert_manager.cpp:80</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			return m_alerts[m_generation].front();
│ │ │ │ +
│ │ │ │ +		// this call can be interrupted prematurely by other signals
│ │ │ │ +		m_condition.wait_for(lock, max_wait);
│ │ │ │ +		if (!m_alerts[m_generation].empty())
│ │ │ │ +			return m_alerts[m_generation].front();
│ │ │ │ +
│ │ │ │ +		return nullptr;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void alert_manager::maybe_notify(alert* a)
│ │ │ │ +	{
│ │ │ │ +		if (m_alerts[m_generation].size() == 1)
│ │ │ │ +		{
│ │ │ │ +			// we just posted to an empty queue. If anyone is waiting for
│ │ │ │ +			// alerts, we need to notify them. Also (potentially) call the
│ │ │ │ +			// user supplied m_notify callback to let the client wake up its
│ │ │ │ +			// message loop to poll for alerts.
│ │ │ │ +			if (m_notify) m_notify();
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">			m_condition.notify_all();
│ │ │ │ +</div>		}
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_EXTENSIONS
│ │ │ │ +		for (auto&amp; e : m_ses_extensions)
│ │ │ │ +			e-&gt;on_alert(a);
│ │ │ │ +#else
│ │ │ │ +		TORRENT_UNUSED(a);
│ │ │ │ +#endif
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void alert_manager::set_notify_function(std::function&lt;void()&gt; const&amp; fun)
│ │ │ │ +	{
│ │ │ │ +		std::unique_lock&lt;std::recursive_mutex&gt; lock(m_mutex);
│ │ │ │ +		m_notify = fun;
│ │ │ │ +		if (!m_alerts[m_generation].empty())
│ │ │ │ +		{
│ │ │ │ +			if (m_notify) m_notify();
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_EXTENSIONS
│ │ │ │ +	void alert_manager::add_extension(std::shared_ptr&lt;plugin&gt; ext)
│ │ │ │ +	{
│ │ │ │ +		m_ses_extensions.push_back(std::move(ext));
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	void alert_manager::get_all(std::vector&lt;alert*&gt;&amp; alerts)
│ │ │ │ +	{
│ │ │ │ +		std::lock_guard&lt;std::recursive_mutex&gt; lock(m_mutex);
│ │ │ │  </pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(65)">../src/tracker_manager.cpp:369</a></td><td>implement</td></tr><tr id="65" style="display: none;" colspan="3"><td colspan="3"><h2>implement</h2><h4>../src/tracker_manager.cpp:369</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  			if (m_ses.should_log())
│ │ │ │  			{
│ │ │ │  				m_ses.session_log("incoming UDP tracker packet from %s has invalid "
│ │ │ │  					"transaction ID (%x)", print_endpoint(ep).c_str()
│ │ │ │  					, transaction);
│ │ │ │  			}
│ │ │ │ @@ -3407,274 +3425,66 @@
│ │ │ │  
│ │ │ │  		TORRENT_ASSERT(i-&gt;writing &gt; 0);
│ │ │ │  		TORRENT_ASSERT(info.state == block_info::state_writing);
│ │ │ │  
│ │ │ │  		if (info.state == block_info::state_finished) return;
│ │ │ │  		if (info.state == block_info::state_writing) --i-&gt;writing;
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(69)">../src/torrent.cpp:504</a></td><td>post alert</td></tr><tr id="69" style="display: none;" colspan="3"><td colspan="3"><h2>post alert</h2><h4>../src/torrent.cpp:504</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		if (m_current_gauge_state != no_gauge_state)
│ │ │ │ -			inc_stats_counter(m_current_gauge_state + counters::num_checking_torrents, -1);
│ │ │ │ -		if (new_gauge_state != no_gauge_state)
│ │ │ │ -			inc_stats_counter(new_gauge_state + counters::num_checking_torrents, 1);
│ │ │ │ -
│ │ │ │ -		TORRENT_ASSERT(new_gauge_state &gt;= 0);
│ │ │ │ -		TORRENT_ASSERT(new_gauge_state &lt;= no_gauge_state);
│ │ │ │ -		m_current_gauge_state = static_cast&lt;std::uint32_t&gt;(new_gauge_state);
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(69)">../src/escape_string.cpp:194</a></td><td>this should probably be moved into string_util.cpp</td></tr><tr id="69" style="display: none;" colspan="3"><td colspan="3"><h2>this should probably be moved into string_util.cpp</h2><h4>../src/escape_string.cpp:194</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{
│ │ │ │ +		return escape_string_impl(str.data(), int(str.size()), 10);
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	void torrent::leave_seed_mode(seed_mode_t const checking)
│ │ │ │ +	bool need_encoding(char const* str, int const len)
│ │ │ │  	{
│ │ │ │ -		if (!m_seed_mode) return;
│ │ │ │ -
│ │ │ │ -		if (checking == seed_mode_t::check_files)
│ │ │ │ -		{
│ │ │ │ -			// this means the user promised we had all the
│ │ │ │ -			// files, but it turned out we didn't. This is
│ │ │ │ -			// an error.
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -			debug_log("*** FAILED SEED MODE, rechecking");
│ │ │ │ -#endif
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		debug_log("*** LEAVING SEED MODE (%s)"
│ │ │ │ -			, checking == seed_mode_t::skip_checking ? "as seed" : "as non-seed");
│ │ │ │ -#endif
│ │ │ │ -		m_seed_mode = false;
│ │ │ │ -		// seed is false if we turned out not
│ │ │ │ -		// to be a seed after all
│ │ │ │ -		if (checking == seed_mode_t::check_files
│ │ │ │ -			&amp;&amp; state() != torrent_status::checking_resume_data)
│ │ │ │ +		for (int i = 0; i &lt; len; ++i)
│ │ │ │  		{
│ │ │ │ -			m_have_all = false;
│ │ │ │ -			set_state(torrent_status::downloading);
│ │ │ │ -			force_recheck();
│ │ │ │ +			if (std::strchr(unreserved_chars, *str) == nullptr || *str == 0)
│ │ │ │ +				return true;
│ │ │ │ +			++str;
│ │ │ │  		}
│ │ │ │ -		m_num_verified = 0;
│ │ │ │ -		m_verified.clear();
│ │ │ │ -		m_verifying.clear();
│ │ │ │ -
│ │ │ │ -		set_need_save_resume(torrent_handle::if_state_changed);
│ │ │ │ +		return false;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	void torrent::verified(piece_index_t const piece)
│ │ │ │ +	void convert_path_to_posix(std::string&amp; path)
│ │ │ │  	{
│ │ │ │ -		TORRENT_ASSERT(!m_verified.get_bit(piece));
│ │ │ │ -		++m_num_verified;
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(70)">../src/torrent.cpp:1852</a></td><td>add a unit test where we don't have metadata, connect to a peer that sends a bitfield that's too large, then we get the metadata</td></tr><tr id="70" style="display: none;" colspan="3"><td colspan="3"><h2>add a unit test where we don't have metadata, connect to a peer
│ │ │ │ -that sends a bitfield that's too large, then we get the metadata</h2><h4>../src/torrent.cpp:1852</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			for (auto const&amp; f : m_add_torrent_params-&gt;renamed_files)
│ │ │ │ -			{
│ │ │ │ -				if (f.first &lt; file_index_t(0) || f.first &gt;= fs.end_file()) continue;
│ │ │ │ -				m_torrent_file-&gt;rename_file(file_index_t(f.first), f.second);
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		construct_storage();
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_SHARE_MODE
│ │ │ │ -		if (m_share_mode &amp;&amp; valid_metadata())
│ │ │ │ -		{
│ │ │ │ -			// in share mode, all pieces have their priorities initialized to 0
│ │ │ │ -			m_file_priority.clear();
│ │ │ │ -			m_file_priority.resize(m_torrent_file-&gt;num_files(), dont_download);
│ │ │ │ -		}
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		// it's important to initialize the peers early, because this is what will
│ │ │ │ -		// fix up their have-bitmasks to have the correct size
│ │ │ │ -<div style="background: #ffff00" width="100%">		if (!m_connections_initialized)
│ │ │ │ -</div>		{
│ │ │ │ -			m_connections_initialized = true;
│ │ │ │ -			// all peer connections have to initialize themselves now that the metadata
│ │ │ │ -			// is available
│ │ │ │ -			// copy the peer list since peers may disconnect and invalidate
│ │ │ │ -			// m_connections as we initialize them
│ │ │ │ -			for (auto c : m_connections)
│ │ │ │ -			{
│ │ │ │ -				auto pc = c-&gt;self();
│ │ │ │ -				if (pc-&gt;is_disconnecting()) continue;
│ │ │ │ -				pc-&gt;on_metadata_impl();
│ │ │ │ -				if (pc-&gt;is_disconnecting()) continue;
│ │ │ │ -				pc-&gt;init();
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		// in case file priorities were passed in via the add_torrent_params
│ │ │ │ -		// and also in the case of share mode, we need to update the priorities
│ │ │ │ -		// this has to be applied before piece priority
│ │ │ │ -		if (!m_file_priority.empty())
│ │ │ │ -		{
│ │ │ │ -			// m_file_priority was loaded from the resume data, this doesn't
│ │ │ │ -			// alter any state that needs to be saved in the resume data
│ │ │ │ -			auto const ns = m_need_save_resume_data;
│ │ │ │ -			update_piece_priorities(m_file_priority);
│ │ │ │ -			m_need_save_resume_data = ns;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		if (m_add_torrent_params)
│ │ │ │ -		{
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(71)">../src/torrent.cpp:4492</a></td><td>use chrono type for time duration</td></tr><tr id="71" style="display: none;" colspan="3"><td colspan="3"><h2>use chrono type for time duration</h2><h4>../src/torrent.cpp:4492</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		}
│ │ │ │ -
│ │ │ │ -		m_picker-&gt;piece_passed(index);
│ │ │ │ -		update_gauge();
│ │ │ │ -		we_have(index);
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		if (should_log())
│ │ │ │ -			debug_log("we_have(%d) (num_have: %d)", int(index), num_have());
│ │ │ │ -#endif
│ │ │ │ -#ifndef TORRENT_DISABLE_STREAMING
│ │ │ │ -		remove_time_critical_piece(index, true);
│ │ │ │ -#endif
│ │ │ │ +		std::replace(path.begin(), path.end(), '\\', '/');
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DISABLE_PREDICTIVE_PIECES
│ │ │ │ -	// we believe we will complete this piece very soon
│ │ │ │ -	// announce it to peers ahead of time to eliminate the
│ │ │ │ -	// round-trip times involved in announcing it, requesting it
│ │ │ │ -	// and sending it
│ │ │ │ -<div style="background: #ffff00" width="100%">	void torrent::predicted_have_piece(piece_index_t const index, int const milliseconds)
│ │ │ │ +<div style="background: #ffff00" width="100%">	std::string read_until(char const*&amp; str, char const delim, char const* end)
│ │ │ │  </div>	{
│ │ │ │ -		auto const i = std::lower_bound(m_predictive_pieces.begin()
│ │ │ │ -			, m_predictive_pieces.end(), index);
│ │ │ │ -		if (i != m_predictive_pieces.end() &amp;&amp; *i == index) return;
│ │ │ │ -
│ │ │ │ -		for (auto p : m_connections)
│ │ │ │ -		{
│ │ │ │ -			TORRENT_INCREMENT(m_iterating_connections);
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -			p-&gt;peer_log(peer_log_alert::outgoing, "PREDICTIVE_HAVE", "piece: %d expected in %d ms"
│ │ │ │ -				, static_cast&lt;int&gt;(index), milliseconds);
│ │ │ │ -#else
│ │ │ │ -			TORRENT_UNUSED(milliseconds);
│ │ │ │ -#endif
│ │ │ │ -			p-&gt;announce_piece(index);
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		m_predictive_pieces.insert(i, index);
│ │ │ │ -	}
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -	// blocks may contain the block indices of the blocks that failed (if this is
│ │ │ │ -	// a v2 torrent).
│ │ │ │ -	void torrent::piece_failed(piece_index_t const index, std::vector&lt;int&gt; blocks)
│ │ │ │ -	{
│ │ │ │ -		// if the last piece fails the peer connection will still
│ │ │ │ -		// think that it has received all of it until this function
│ │ │ │ -		// resets the download queue. So, we cannot do the
│ │ │ │ -		// invariant check here since it assumes:
│ │ │ │ -		// (total_done == m_torrent_file-&gt;total_size()) =&gt; is_seed()
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(72)">../src/torrent.cpp:4919</a></td><td>abort lookups this torrent has made via the session host resolver interface</td></tr><tr id="72" style="display: none;" colspan="3"><td colspan="3"><h2>abort lookups this torrent has made via the
│ │ │ │ -session host resolver interface</h2><h4>../src/torrent.cpp:4919</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				TORRENT_UNUSED(e);
│ │ │ │ -				m_storage.reset();
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -				debug_log("Failed to flush disk cache: %s", e.what());
│ │ │ │ -#endif
│ │ │ │ -				// clients may rely on this alert to be posted, so it's probably a
│ │ │ │ -				// good idea to post it here, even though we failed
│ │ │ │ -				if (alerts().should_post&lt;cache_flushed_alert&gt;())
│ │ │ │ -					alerts().emplace_alert&lt;cache_flushed_alert&gt;(get_handle());
│ │ │ │ -			}
│ │ │ │ -			m_ses.deferred_submit_jobs();
│ │ │ │ -		}
│ │ │ │ -		else
│ │ │ │ -		{
│ │ │ │ -			if (alerts().should_post&lt;cache_flushed_alert&gt;())
│ │ │ │ -				alerts().emplace_alert&lt;cache_flushed_alert&gt;(get_handle());
│ │ │ │ -			alerts().emplace_alert&lt;torrent_removed_alert&gt;(get_handle()
│ │ │ │ -				, info_hash(), get_userdata());
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>		if (!m_apply_ip_filter)
│ │ │ │ -		{
│ │ │ │ -			inc_stats_counter(counters::non_filter_torrents, -1);
│ │ │ │ -			m_apply_ip_filter = true;
│ │ │ │ -		}
│ │ │ │ +		TORRENT_ASSERT(str &lt;= end);
│ │ │ │  
│ │ │ │ -		m_paused = false;
│ │ │ │ -		m_auto_managed = false;
│ │ │ │ -		update_state_list();
│ │ │ │ -		for (torrent_list_index_t i{}; i != m_links.end_index(); ++i)
│ │ │ │ +		std::string ret;
│ │ │ │ +		while (str != end &amp;&amp; *str != delim)
│ │ │ │  		{
│ │ │ │ -			if (!m_links[i].in_list()) continue;
│ │ │ │ -			m_links[i].unlink(m_ses.torrent_list(i), i);
│ │ │ │ +			ret += *str;
│ │ │ │ +			++str;
│ │ │ │  		}
│ │ │ │ -		// don't re-add this torrent to the state-update list
│ │ │ │ -		m_state_subscription = false;
│ │ │ │ +		// skip the delimiter as well
│ │ │ │ +		while (str != end &amp;&amp; *str == delim) ++str;
│ │ │ │ +		return ret;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	// this is called when we're destructing non-gracefully. i.e. we're _just_
│ │ │ │ -	// destructing everything.
│ │ │ │ -	void torrent::panic()
│ │ │ │ +	std::string maybe_url_encode(std::string const&amp; url)
│ │ │ │  	{
│ │ │ │ -		m_storage.reset();
│ │ │ │ -		// if there are any other peers allocated still, we need to clear them
│ │ │ │ -		// now. They can't be cleared later because the allocator will already
│ │ │ │ -		// have been destructed
│ │ │ │ -		if (m_peer_list) m_peer_list-&gt;clear();
│ │ │ │ -		m_connections.clear();
│ │ │ │ -		m_outgoing_pids.clear();
│ │ │ │ -		m_peers_to_disconnect.clear();
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(73)">../src/torrent.cpp:8032</a></td><td>if peer is a really good peer, maybe we shouldn't disconnect it perhaps this logic should be disabled if we have too many idle peers (with some definition of idle)</td></tr><tr id="73" style="display: none;" colspan="3"><td colspan="3"><h2>if peer is a really good peer, maybe we shouldn't disconnect it
│ │ │ │ -perhaps this logic should be disabled if we have too many idle peers
│ │ │ │ -(with some definition of idle)</h2><h4>../src/torrent.cpp:8032</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -		m_peers_to_disconnect.reserve(m_connections.size() + 1);
│ │ │ │ -		m_connections.reserve(m_connections.size() + 1);
│ │ │ │ -
│ │ │ │ -#if TORRENT_USE_ASSERTS
│ │ │ │ +		std::string protocol, host, auth, path;
│ │ │ │ +		int port;
│ │ │ │  		error_code ec;
│ │ │ │ -		TORRENT_ASSERT(p-&gt;remote() == p-&gt;get_socket().remote_endpoint(ec) || ec);
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		TORRENT_ASSERT(p-&gt;peer_info_struct() != nullptr);
│ │ │ │ +		std::tie(protocol, auth, host, port, path) = parse_url_components(url, ec);
│ │ │ │ +		if (ec) return url;
│ │ │ │  
│ │ │ │ -		// we need to do this after we've added the peer to the peer_list
│ │ │ │ -		// since that's when the peer is assigned its peer_info object,
│ │ │ │ -		// which holds the rank
│ │ │ │ -		if (maybe_replace_peer)
│ │ │ │ -		{
│ │ │ │ -			// now, find the lowest rank peer and disconnect that
│ │ │ │ -			// if it's lower rank than the incoming connection
│ │ │ │ -			peer_connection* peer = find_lowest_ranking_peer();
│ │ │ │ +		// first figure out if this url contains unencoded characters
│ │ │ │ +		if (!need_encoding(path.c_str(), int(path.size())))
│ │ │ │ +			return url;
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">			if (peer != nullptr &amp;&amp; peer-&gt;peer_rank() &lt; p-&gt;peer_rank())
│ │ │ │ -</div>			{
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -				if (should_log())
│ │ │ │ -				{
│ │ │ │ -					debug_log("CLOSING CONNECTION \"%s\" peer list full (low peer rank) "
│ │ │ │ -						"connections: %d limit: %d"
│ │ │ │ -						, print_endpoint(peer-&gt;remote()).c_str()
│ │ │ │ -						, num_peers()
│ │ │ │ -						, m_max_connections);
│ │ │ │ -				}
│ │ │ │ -#endif
│ │ │ │ -				peer-&gt;disconnect(errors::too_many_connections, operation_t::bittorrent);
│ │ │ │ -				p-&gt;peer_disconnected_other();
│ │ │ │ -			}
│ │ │ │ -			else
│ │ │ │ -			{
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -				if (should_log())
│ │ │ │ -				{
│ │ │ │ -					debug_log("CLOSING CONNECTION \"%s\" peer list full (low peer rank) "
│ │ │ │ -						"connections: %d limit: %d"
│ │ │ │ -						, print_endpoint(p-&gt;remote()).c_str()
│ │ │ │ -						, num_peers()
│ │ │ │ -						, m_max_connections);
│ │ │ │ -				}
│ │ │ │ -#endif
│ │ │ │ -				p-&gt;disconnect(errors::too_many_connections, operation_t::bittorrent);
│ │ │ │ -				// we have to do this here because from the peer's point of view
│ │ │ │ -				// it wasn't really attached to the torrent, but we do need
│ │ │ │ -				// to let peer_list know we're removing it
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(74)">../src/http_tracker_connection.cpp:479</a></td><td>returning a bool here is redundant. Instead this function should return the peer_entry</td></tr><tr id="74" style="display: none;" colspan="3"><td colspan="3"><h2>returning a bool here is redundant. Instead this function should
│ │ │ │ +		std::string msg;
│ │ │ │ +		std::string escaped_path { escape_path(path) };
│ │ │ │ +		// reserve enough space so further append will
│ │ │ │ +		// only copy values to existing location
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(70)">../src/http_tracker_connection.cpp:479</a></td><td>returning a bool here is redundant. Instead this function should return the peer_entry</td></tr><tr id="70" style="display: none;" colspan="3"><td colspan="3"><h2>returning a bool here is redundant. Instead this function should
│ │ │ │  return the peer_entry</h2><h4>../src/http_tracker_connection.cpp:479</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		{
│ │ │ │  			cb-&gt;tracker_scrape_response(tracker_req(), resp.complete
│ │ │ │  				, resp.incomplete, resp.downloaded, resp.downloaders);
│ │ │ │  		}
│ │ │ │  		else
│ │ │ │  		{
│ │ │ │  			std::list&lt;address&gt; ip_list;
│ │ │ │ @@ -3718,118 +3528,308 @@
│ │ │ │  			return false;
│ │ │ │  		}
│ │ │ │  		ret.hostname = i.string_value().to_string();
│ │ │ │  
│ │ │ │  		// extract port
│ │ │ │  		i = info.dict_find_int("port");
│ │ │ │  		if (!i)
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(75)">../src/path.cpp:429</a></td><td>test this on a FAT volume to see what error we get!</td></tr><tr id="75" style="display: none;" colspan="3"><td colspan="3"><h2>test this on a FAT volume to see what error we get!</h2><h4>../src/path.cpp:429</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			// it's possible CreateHardLink will copy the file internally too,
│ │ │ │ -			// if the filesystem does not support it.
│ │ │ │ -			ec.assign(GetLastError(), system_category());
│ │ │ │ -			return;
│ │ │ │ -		}
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(71)">../src/session_impl.cpp:599</a></td><td>is there a reason not to move all of this into init()? and just post it to the io_context?</td></tr><tr id="71" style="display: none;" colspan="3"><td colspan="3"><h2>is there a reason not to move all of this into init()? and just
│ │ │ │ +post it to the io_context?</h2><h4>../src/session_impl.cpp:599</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	try
│ │ │ │ +#endif
│ │ │ │ +	{
│ │ │ │ +		(this-&gt;*f)(std::forward&lt;Args&gt;(a)...);
│ │ │ │ +	}
│ │ │ │ +#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ +	catch (system_error const&amp; e) {
│ │ │ │ +		alerts().emplace_alert&lt;session_error_alert&gt;(e.code(), e.what());
│ │ │ │ +		pause();
│ │ │ │ +	} catch (std::exception const&amp; e) {
│ │ │ │ +		alerts().emplace_alert&lt;session_error_alert&gt;(error_code(), e.what());
│ │ │ │ +		pause();
│ │ │ │ +	} catch (...) {
│ │ │ │ +		alerts().emplace_alert&lt;session_error_alert&gt;(error_code(), "unknown error");
│ │ │ │ +		pause();
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -		// fall back to making a copy
│ │ │ │ +	// This function is called by the creating thread, not in the message loop's
│ │ │ │ +	// io_context thread.
│ │ │ │ +<div style="background: #ffff00" width="100%">	void session_impl::start_session()
│ │ │ │ +</div>	{
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		session_log("start session");
│ │ │ │  #endif
│ │ │ │ -#else
│ │ │ │ -		// assume posix's link() function exists
│ │ │ │ -		int ret = ::link(n_exist.c_str(), n_link.c_str());
│ │ │ │  
│ │ │ │ -		if (ret == 0)
│ │ │ │ +#if TORRENT_USE_SSL
│ │ │ │ +		error_code ec;
│ │ │ │ +		m_ssl_ctx.set_default_verify_paths(ec);
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		if (ec) session_log("SSL set_default verify_paths failed: %s", ec.message().c_str());
│ │ │ │ +		ec.clear();
│ │ │ │ +#endif
│ │ │ │ +#if defined TORRENT_WINDOWS &amp;&amp; defined TORRENT_USE_OPENSSL &amp;&amp; !defined TORRENT_WINRT
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(72)">../src/session_impl.cpp:761</a></td><td>the ip filter should probably be saved here too</td></tr><tr id="72" style="display: none;" colspan="3"><td colspan="3"><h2>the ip filter should probably be saved here too</h2><h4>../src/session_impl.cpp:761</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		m_lsd_announce_timer.async_wait([this](error_code const&amp; e) {
│ │ │ │ +			wrap(&amp;session_impl::on_lsd_announce, e); } );
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		session_log(" done starting session");
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		// this applies unchoke settings from m_settings
│ │ │ │ +		recalculate_unchoke_slots();
│ │ │ │ +
│ │ │ │ +		// apply all m_settings to this session
│ │ │ │ +		run_all_updates(*this);
│ │ │ │ +		reopen_listen_sockets(false);
│ │ │ │ +
│ │ │ │ +#if TORRENT_USE_INVARIANT_CHECKS
│ │ │ │ +		check_invariant();
│ │ │ │ +#endif
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION &lt;= 2
│ │ │ │ +<div style="background: #ffff00" width="100%">	void session_impl::save_state(entry* eptr, save_state_flags_t const flags) const
│ │ │ │ +</div>	{
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +
│ │ │ │ +		entry&amp; e = *eptr;
│ │ │ │ +		// make it a dict
│ │ │ │ +		e.dict();
│ │ │ │ +
│ │ │ │ +		if (flags &amp; session::save_settings)
│ │ │ │  		{
│ │ │ │ -			ec.clear();
│ │ │ │ -			return;
│ │ │ │ +			entry::dictionary_type&amp; sett = e["settings"].dict();
│ │ │ │ +			save_settings_to_dict(non_default_settings(m_settings), sett);
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -		// most errors are passed through, except for the ones that indicate that
│ │ │ │ -		// hard links are not supported and require a copy.
│ │ │ │ -<div style="background: #ffff00" width="100%">		if (errno != EMLINK
│ │ │ │ -</div>			&amp;&amp; errno != EXDEV
│ │ │ │ -#ifdef TORRENT_BEOS
│ │ │ │ -			// haiku returns EPERM when the filesystem doesn't support hard link
│ │ │ │ -			&amp;&amp; errno != EPERM
│ │ │ │ +#ifndef TORRENT_DISABLE_DHT
│ │ │ │ +		if (flags &amp; session::save_dht_settings)
│ │ │ │ +		{
│ │ │ │ +			e["dht"] = dht::save_dht_settings(get_dht_settings());
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		if (m_dht &amp;&amp; (flags &amp; session::save_dht_state))
│ │ │ │ +		{
│ │ │ │ +			e["dht state"] = dht::save_dht_state(m_dht-&gt;state());
│ │ │ │ +		}
│ │ │ │  #endif
│ │ │ │ -			)
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_EXTENSIONS
│ │ │ │ +		for (auto const&amp; ext : m_ses_extensions[plugins_all_idx])
│ │ │ │  		{
│ │ │ │ -			// some error happened, report up to the caller
│ │ │ │ -			ec.assign(errno, system_category());
│ │ │ │ -			return;
│ │ │ │ +			ext-&gt;save_state(*eptr);
│ │ │ │  		}
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(73)">../src/session_impl.cpp:3882</a></td><td>make a list for torrents that want to be announced on the DHT so we don't have to loop over all torrents, just to find the ones that want to announce</td></tr><tr id="73" style="display: none;" colspan="3"><td colspan="3"><h2>make a list for torrents that want to be announced on the DHT so we
│ │ │ │ +don't have to loop over all torrents, just to find the ones that want to announce</h2><h4>../src/session_impl.cpp:3882</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		if (!m_dht_torrents.empty())
│ │ │ │ +		{
│ │ │ │ +			std::shared_ptr&lt;torrent&gt; t;
│ │ │ │ +			do
│ │ │ │ +			{
│ │ │ │ +				t = m_dht_torrents.front().lock();
│ │ │ │ +				m_dht_torrents.pop_front();
│ │ │ │ +			} while (!t &amp;&amp; !m_dht_torrents.empty());
│ │ │ │  
│ │ │ │ -		// fall back to making a copy
│ │ │ │ +			if (t)
│ │ │ │ +			{
│ │ │ │ +				t-&gt;dht_announce();
│ │ │ │ +				return;
│ │ │ │ +			}
│ │ │ │ +		}
│ │ │ │ +		if (m_torrents.empty()) return;
│ │ │ │  
│ │ │ │ +		if (m_next_dht_torrent &gt;= m_torrents.size())
│ │ │ │ +			m_next_dht_torrent = 0;
│ │ │ │ +		m_torrents[m_next_dht_torrent]-&gt;dht_announce();
│ │ │ │ +<div style="background: #ffff00" width="100%">		++m_next_dht_torrent;
│ │ │ │ +</div>		if (m_next_dht_torrent &gt;= m_torrents.size())
│ │ │ │ +			m_next_dht_torrent = 0;
│ │ │ │ +	}
│ │ │ │  #endif
│ │ │ │  
│ │ │ │ -		// if we get here, we should copy the file
│ │ │ │ -		storage_error se;
│ │ │ │ -		aux::copy_file(file, link, se);
│ │ │ │ -		ec = se.ec;
│ │ │ │ +	void session_impl::on_lsd_announce(error_code const&amp; e)
│ │ │ │ +	{
│ │ │ │ +		COMPLETE_ASYNC("session_impl::on_lsd_announce");
│ │ │ │ +		m_stats_counters.inc_stats_counter(counters::on_lsd_counter);
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +		if (e) return;
│ │ │ │ +
│ │ │ │ +		if (m_abort) return;
│ │ │ │ +
│ │ │ │ +		ADD_OUTSTANDING_ASYNC("session_impl::on_lsd_announce");
│ │ │ │ +		// announce on local network every 5 minutes
│ │ │ │ +		int const delay = std::max(m_settings.get_int(settings_pack::local_service_announce_interval)
│ │ │ │ +			/ std::max(int(m_torrents.size()), 1), 1);
│ │ │ │ +		m_lsd_announce_timer.expires_after(seconds(delay));
│ │ │ │ +		m_lsd_announce_timer.async_wait([this](error_code const&amp; err) {
│ │ │ │ +			wrap(&amp;session_impl::on_lsd_announce, err); });
│ │ │ │ +
│ │ │ │ +		if (m_torrents.empty()) return;
│ │ │ │ +
│ │ │ │ +		if (m_next_lsd_torrent &gt;= m_torrents.size())
│ │ │ │ +			m_next_lsd_torrent = 0;
│ │ │ │ +		m_torrents[m_next_lsd_torrent]-&gt;lsd_announce();
│ │ │ │ +		++m_next_lsd_torrent;
│ │ │ │ +		if (m_next_lsd_torrent &gt;= m_torrents.size())
│ │ │ │ +			m_next_lsd_torrent = 0;
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(74)">../src/session_impl.cpp:5515</a></td><td>this function should be removed and users need to deal with the more generic case of having multiple listen ports</td></tr><tr id="74" style="display: none;" colspan="3"><td colspan="3"><h2>this function should be removed and users need to deal with the
│ │ │ │ +more generic case of having multiple listen ports</h2><h4>../src/session_impl.cpp:5515</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		if (!node_list.empty() &amp;&amp; nodes.empty())
│ │ │ │ +		{
│ │ │ │ +			session_log("ERROR: failed to parse DHT bootstrap list: %s", node_list.c_str());
│ │ │ │ +		}
│ │ │ │ +#endif
│ │ │ │ +		for (auto const&amp; n : nodes)
│ │ │ │ +			add_dht_router(n);
│ │ │ │ +#endif
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	bool is_directory(std::string const&amp; f, error_code&amp; ec)
│ │ │ │ +	void session_impl::update_count_slow()
│ │ │ │  	{
│ │ │ │ -		ec.clear();
│ │ │ │ -		error_code e;
│ │ │ │ -		file_status s;
│ │ │ │ -		stat_file(f, &amp;s, e);
│ │ │ │ -		if (!e &amp;&amp; s.mode &amp; file_status::directory) return true;
│ │ │ │ -		ec = e;
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(76)">../src/peer_list.cpp:539</a></td><td>it would be nice if there was a way to iterate over these torrent_peer objects in the order they are allocated in the pool instead. It would probably be more efficient</td></tr><tr id="76" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice if there was a way to iterate over these
│ │ │ │ -torrent_peer objects in the order they are allocated in the pool
│ │ │ │ -instead. It would probably be more efficient</h2><h4>../src/peer_list.cpp:539</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		, int session_time, torrent_state* state)
│ │ │ │ +		error_code ec;
│ │ │ │ +		for (auto const&amp; tp : m_torrents)
│ │ │ │ +		{
│ │ │ │ +			tp-&gt;on_inactivity_tick(ec);
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	std::uint16_t session_impl::listen_port() const
│ │ │ │ +</div>	{
│ │ │ │ +		return listen_port(nullptr);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	std::uint16_t session_impl::listen_port(listen_socket_t* sock) const
│ │ │ │  	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -		INVARIANT_CHECK;
│ │ │ │ +		if (m_listen_sockets.empty()) return 0;
│ │ │ │ +		if (sock)
│ │ │ │ +		{
│ │ │ │ +			// if we're using a proxy, we won't be able to accept any TCP
│ │ │ │ +			// connections. Not even uTP connections via the port we know about.
│ │ │ │ +			// The DHT may use the implied port to make it work, but the port we
│ │ │ │ +			// announce here has no relevance for that.
│ │ │ │ +			if (sock-&gt;flags &amp; listen_socket_t::proxy)
│ │ │ │ +				return 0;
│ │ │ │  
│ │ │ │ -		const int candidate_count = 10;
│ │ │ │ -		peers.reserve(candidate_count);
│ │ │ │ +			if (!(sock-&gt;flags &amp; listen_socket_t::accept_incoming))
│ │ │ │ +				return 0;
│ │ │ │  
│ │ │ │ -		int erase_candidate = -1;
│ │ │ │ +			return std::uint16_t(sock-&gt;tcp_external_port());
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -		if (bool(m_finished) != state-&gt;is_finished)
│ │ │ │ -			recalculate_connect_candidates(state);
│ │ │ │ +#ifdef TORRENT_SSL_PEERS
│ │ │ │ +		for (auto const&amp; s : m_listen_sockets)
│ │ │ │ +		{
│ │ │ │ +			if (!(s-&gt;flags &amp; listen_socket_t::accept_incoming)) continue;
│ │ │ │ +			if (s-&gt;ssl == transport::plaintext)
│ │ │ │ +				return std::uint16_t(s-&gt;tcp_external_port());
│ │ │ │ +		}
│ │ │ │ +		return 0;
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(75)">../src/session_impl.cpp:5555</a></td><td>this function should be removed and users need to deal with the more generic case of having multiple ssl ports</td></tr><tr id="75" style="display: none;" colspan="3"><td colspan="3"><h2>this function should be removed and users need to deal with the
│ │ │ │ +more generic case of having multiple ssl ports</h2><h4>../src/session_impl.cpp:5555</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				return 0;
│ │ │ │  
│ │ │ │ -		external_ip const&amp; external = state-&gt;ip;
│ │ │ │ -		int external_port = state-&gt;port;
│ │ │ │ +			return std::uint16_t(sock-&gt;tcp_external_port());
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -		if (m_round_robin &gt;= int(m_peers.size())) m_round_robin = 0;
│ │ │ │ +#ifdef TORRENT_SSL_PEERS
│ │ │ │ +		for (auto const&amp; s : m_listen_sockets)
│ │ │ │ +		{
│ │ │ │ +			if (!(s-&gt;flags &amp; listen_socket_t::accept_incoming)) continue;
│ │ │ │ +			if (s-&gt;ssl == transport::plaintext)
│ │ │ │ +				return std::uint16_t(s-&gt;tcp_external_port());
│ │ │ │ +		}
│ │ │ │ +		return 0;
│ │ │ │ +#else
│ │ │ │ +		sock = m_listen_sockets.front().get();
│ │ │ │ +		if (!(sock-&gt;flags &amp; listen_socket_t::accept_incoming)) return 0;
│ │ │ │ +		return std::uint16_t(sock-&gt;tcp_external_port());
│ │ │ │ +#endif
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -		int max_peerlist_size = state-&gt;max_peerlist_size;
│ │ │ │ +<div style="background: #ffff00" width="100%">	std::uint16_t session_impl::ssl_listen_port() const
│ │ │ │ +</div>	{
│ │ │ │ +		return ssl_listen_port(nullptr);
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">		for (int iterations = std::min(int(m_peers.size()), 300);
│ │ │ │ -</div>			iterations &gt; 0; --iterations)
│ │ │ │ +	std::uint16_t session_impl::ssl_listen_port(listen_socket_t* sock) const
│ │ │ │ +	{
│ │ │ │ +#ifdef TORRENT_SSL_PEERS
│ │ │ │ +		if (sock)
│ │ │ │  		{
│ │ │ │ -			++state-&gt;loop_counter;
│ │ │ │ +			if (!(sock-&gt;flags &amp; listen_socket_t::accept_incoming)) return 0;
│ │ │ │ +			return std::uint16_t(sock-&gt;tcp_external_port());
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -			if (m_round_robin &gt;= int(m_peers.size())) m_round_robin = 0;
│ │ │ │ +		if (m_settings.get_int(settings_pack::proxy_type) != settings_pack::none
│ │ │ │ +			&amp;&amp; m_settings.get_bool(settings_pack::proxy_peer_connections))
│ │ │ │ +			return 0;
│ │ │ │  
│ │ │ │ -			torrent_peer&amp; pe = *m_peers[m_round_robin];
│ │ │ │ -			TORRENT_ASSERT(pe.in_use);
│ │ │ │ -			int current = m_round_robin;
│ │ │ │ +		for (auto const&amp; s : m_listen_sockets)
│ │ │ │ +		{
│ │ │ │ +			if (!(s-&gt;flags &amp; listen_socket_t::accept_incoming)) continue;
│ │ │ │ +			if (s-&gt;ssl == transport::ssl)
│ │ │ │ +				return std::uint16_t(s-&gt;tcp_external_port());
│ │ │ │ +		}
│ │ │ │ +#else
│ │ │ │ +		TORRENT_UNUSED(sock);
│ │ │ │ +#endif
│ │ │ │ +		return 0;
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -			// if the number of peers is growing large
│ │ │ │ -			// we need to start weeding.
│ │ │ │ +	int session_impl::get_listen_port(transport const ssl, aux::listen_socket_handle const&amp; s)
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(76)">../src/session_impl.cpp:6390</a></td><td>this should be factored into the udp socket, so we only have the code once</td></tr><tr id="76" style="display: none;" colspan="3"><td colspan="3"><h2>this should be factored into the udp socket, so we only have the
│ │ │ │ +code once</h2><h4>../src/session_impl.cpp:6390</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		return upload_rate_limit(m_local_peer_class);
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -			if (int(m_peers.size()) &gt;= max_peerlist_size * 0.95
│ │ │ │ -				&amp;&amp; max_peerlist_size &gt; 0)
│ │ │ │ +	int session_impl::local_download_rate_limit() const
│ │ │ │ +	{
│ │ │ │ +		return download_rate_limit(m_local_peer_class);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	int session_impl::upload_rate_limit_depr() const
│ │ │ │ +	{
│ │ │ │ +		return upload_rate_limit(m_global_class);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	int session_impl::download_rate_limit_depr() const
│ │ │ │ +	{
│ │ │ │ +		return download_rate_limit(m_global_class);
│ │ │ │ +	}
│ │ │ │ +#endif // DEPRECATE
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	void session_impl::update_peer_dscp()
│ │ │ │ +</div>	{
│ │ │ │ +		int const value = m_settings.get_int(settings_pack::peer_dscp);
│ │ │ │ +		for (auto const&amp; l : m_listen_sockets)
│ │ │ │ +		{
│ │ │ │ +			if (l-&gt;sock)
│ │ │ │  			{
│ │ │ │ -				if (is_erase_candidate(pe)
│ │ │ │ -					&amp;&amp; (erase_candidate == -1
│ │ │ │ -						|| !compare_peer_erase(*m_peers[erase_candidate], pe)))
│ │ │ │ +				error_code ec;
│ │ │ │ +				set_traffic_class(*l-&gt;sock, value, ec);
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +				if (should_log())
│ │ │ │  				{
│ │ │ │ -					if (should_erase_immediately(pe))
│ │ │ │ -					{
│ │ │ │ -						if (erase_candidate &gt; current) --erase_candidate;
│ │ │ │ -						erase_peer(m_peers.begin() + current, state);
│ │ │ │ -						continue;
│ │ │ │ -					}
│ │ │ │ -					else
│ │ │ │ -					{
│ │ │ │ -						erase_candidate = current;
│ │ │ │ -					}
│ │ │ │ +					session_log("&gt;&gt;&gt; SET_DSCP [ tcp (%s %d) value: %x e: %s ]"
│ │ │ │ +						, l-&gt;sock-&gt;local_endpoint().address().to_string().c_str()
│ │ │ │ +						, l-&gt;sock-&gt;local_endpoint().port(), value, ec.message().c_str());
│ │ │ │ +				}
│ │ │ │ +#endif
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +			if (l-&gt;udp_sock)
│ │ │ │ +			{
│ │ │ │ +				error_code ec;
│ │ │ │ +				set_traffic_class(l-&gt;udp_sock-&gt;sock, value, ec);
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +				if (should_log())
│ │ │ │ +				{
│ │ │ │ +					session_log("&gt;&gt;&gt; SET_DSCP [ udp (%s %d) value: %x e: %s ]"
│ │ │ │ +						, l-&gt;udp_sock-&gt;sock.local_endpoint().address().to_string().c_str()
│ │ │ │ +						, l-&gt;udp_sock-&gt;sock.local_port()
│ │ │ │  </pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(77)">../src/kademlia/node.cpp:684</a></td><td>it would be nice to have a bias towards node-id prefixes that are missing in the bucket</td></tr><tr id="77" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to have a bias towards node-id prefixes that
│ │ │ │  are missing in the bucket</h2><h4>../src/kademlia/node.cpp:684</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	node_entry const* ne = m_table.next_refresh();
│ │ │ │  	if (ne == nullptr) return;
│ │ │ │  
│ │ │ │  	// this shouldn't happen
│ │ │ │  	TORRENT_ASSERT(m_id != ne-&gt;id);
│ │ │ │  	if (ne-&gt;id == m_id) return;
│ │ │ │ @@ -3925,66 +3925,15 @@
│ │ │ │  entry write_nodes_entry(std::vector&lt;node_entry&gt; const&amp; nodes)
│ │ │ │  {
│ │ │ │  	entry r;
│ │ │ │  	std::back_insert_iterator&lt;std::string&gt; out(r.string());
│ │ │ │  	for (auto const&amp; n : nodes)
│ │ │ │  	{
│ │ │ │  		std::copy(n.id.begin(), n.id.end(), out);
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(79)">../src/kademlia/dht_storage.cpp:87</a></td><td>make this configurable in dht_settings</td></tr><tr id="79" style="display: none;" colspan="3"><td colspan="3"><h2>make this configurable in dht_settings</h2><h4>../src/kademlia/dht_storage.cpp:87</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		tcp::endpoint addr;
│ │ │ │ -		bool seed = 0;
│ │ │ │ -	};
│ │ │ │ -
│ │ │ │ -	// internal
│ │ │ │ -	bool operator&lt;(peer_entry const&amp; lhs, peer_entry const&amp; rhs)
│ │ │ │ -	{
│ │ │ │ -		return lhs.addr.address() == rhs.addr.address()
│ │ │ │ -			? lhs.addr.port() &lt; rhs.addr.port()
│ │ │ │ -			: lhs.addr.address() &lt; rhs.addr.address();
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	// this is a group. It contains a set of group members
│ │ │ │ -	struct torrent_entry
│ │ │ │ -	{
│ │ │ │ -		std::string name;
│ │ │ │ -		std::vector&lt;peer_entry&gt; peers4;
│ │ │ │ -		std::vector&lt;peer_entry&gt; peers6;
│ │ │ │ -	};
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	constexpr time_duration announce_interval = minutes(30);
│ │ │ │ -</div>
│ │ │ │ -	struct dht_immutable_item
│ │ │ │ -	{
│ │ │ │ -		// the actual value
│ │ │ │ -		std::unique_ptr&lt;char[]&gt; value;
│ │ │ │ -		// this counts the number of IPs we have seen
│ │ │ │ -		// announcing this item, this is used to determine
│ │ │ │ -		// popularity if we reach the limit of items to store
│ │ │ │ -		bloom_filter&lt;128&gt; ips;
│ │ │ │ -		// the last time we heard about this item
│ │ │ │ -		// the correct interpretation of this field
│ │ │ │ -		// requires a time reference
│ │ │ │ -		time_point last_seen;
│ │ │ │ -		// number of IPs in the bloom filter
│ │ │ │ -		int num_announcers = 0;
│ │ │ │ -		// size of malloced space pointed to by value
│ │ │ │ -		int size = 0;
│ │ │ │ -	};
│ │ │ │ -
│ │ │ │ -	struct dht_mutable_item : dht_immutable_item
│ │ │ │ -	{
│ │ │ │ -		signature sig{};
│ │ │ │ -		sequence_number seq{};
│ │ │ │ -		public_key key{};
│ │ │ │ -		std::string salt;
│ │ │ │ -	};
│ │ │ │ -
│ │ │ │ -	void set_value(dht_immutable_item&amp; item, span&lt;char const&gt; buf)
│ │ │ │ -	{
│ │ │ │ -		int const size = int(buf.size());
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(80)">../src/kademlia/routing_table.cpp:305</a></td><td>use the non deprecated function instead of this one</td></tr><tr id="80" style="display: none;" colspan="3"><td colspan="3"><h2>use the non deprecated function instead of this one</h2><h4>../src/kademlia/routing_table.cpp:305</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	static const aux::array&lt;int, 4&gt; size_exceptions{{{16, 8, 4, 2}}};
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(79)">../src/kademlia/routing_table.cpp:305</a></td><td>use the non deprecated function instead of this one</td></tr><tr id="79" style="display: none;" colspan="3"><td colspan="3"><h2>use the non deprecated function instead of this one</h2><h4>../src/kademlia/routing_table.cpp:305</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	static const aux::array&lt;int, 4&gt; size_exceptions{{{16, 8, 4, 2}}};
│ │ │ │  	if (bucket &lt; size_exceptions.end_index())
│ │ │ │  		return m_bucket_size * size_exceptions[bucket];
│ │ │ │  	return m_bucket_size;
│ │ │ │  }
│ │ │ │  
│ │ │ │  void routing_table::status(std::vector&lt;dht_routing_bucket&gt;&amp; s) const
│ │ │ │  {
│ │ │ │ @@ -4004,15 +3953,15 @@
│ │ │ │  </div>{
│ │ │ │  	int dht_nodes;
│ │ │ │  	int dht_node_cache;
│ │ │ │  	int ignore;
│ │ │ │  	std::tie(dht_nodes, dht_node_cache, ignore) = size();
│ │ │ │  	s.dht_nodes += dht_nodes;
│ │ │ │  	s.dht_node_cache += dht_node_cache;
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(81)">../src/kademlia/routing_table.cpp:940</a></td><td>move the lowest priority nodes to the replacement bucket</td></tr><tr id="81" style="display: none;" colspan="3"><td colspan="3"><h2>move the lowest priority nodes to the replacement bucket</h2><h4>../src/kademlia/routing_table.cpp:940</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	bucket_t&amp; rb = m_buckets[bucket_index].replacements;
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(80)">../src/kademlia/routing_table.cpp:940</a></td><td>move the lowest priority nodes to the replacement bucket</td></tr><tr id="80" style="display: none;" colspan="3"><td colspan="3"><h2>move the lowest priority nodes to the replacement bucket</h2><h4>../src/kademlia/routing_table.cpp:940</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	bucket_t&amp; rb = m_buckets[bucket_index].replacements;
│ │ │ │  
│ │ │ │  	// move any node whose (160 - distance_exp(m_id, id)) &gt;= (i - m_buckets.begin())
│ │ │ │  	// to the new bucket
│ │ │ │  	int const new_bucket_size = bucket_limit(bucket_index + 1);
│ │ │ │  	for (auto j = b.begin(); j != b.end();)
│ │ │ │  	{
│ │ │ │  		int const d = distance_exp(m_id, j-&gt;id);
│ │ │ │ @@ -4055,14 +4004,65 @@
│ │ │ │  		{
│ │ │ │  			// this entry belongs in the new bucket
│ │ │ │  			if (j-&gt;pinged() &amp;&amp; int(new_bucket.size()) &lt; new_bucket_size)
│ │ │ │  				new_bucket.push_back(*j);
│ │ │ │  			else
│ │ │ │  				new_replacement_bucket.push_back(*j);
│ │ │ │  		}
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(81)">../src/kademlia/dht_storage.cpp:87</a></td><td>make this configurable in dht_settings</td></tr><tr id="81" style="display: none;" colspan="3"><td colspan="3"><h2>make this configurable in dht_settings</h2><h4>../src/kademlia/dht_storage.cpp:87</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		tcp::endpoint addr;
│ │ │ │ +		bool seed = 0;
│ │ │ │ +	};
│ │ │ │ +
│ │ │ │ +	// internal
│ │ │ │ +	bool operator&lt;(peer_entry const&amp; lhs, peer_entry const&amp; rhs)
│ │ │ │ +	{
│ │ │ │ +		return lhs.addr.address() == rhs.addr.address()
│ │ │ │ +			? lhs.addr.port() &lt; rhs.addr.port()
│ │ │ │ +			: lhs.addr.address() &lt; rhs.addr.address();
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	// this is a group. It contains a set of group members
│ │ │ │ +	struct torrent_entry
│ │ │ │ +	{
│ │ │ │ +		std::string name;
│ │ │ │ +		std::vector&lt;peer_entry&gt; peers4;
│ │ │ │ +		std::vector&lt;peer_entry&gt; peers6;
│ │ │ │ +	};
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	constexpr time_duration announce_interval = minutes(30);
│ │ │ │ +</div>
│ │ │ │ +	struct dht_immutable_item
│ │ │ │ +	{
│ │ │ │ +		// the actual value
│ │ │ │ +		std::unique_ptr&lt;char[]&gt; value;
│ │ │ │ +		// this counts the number of IPs we have seen
│ │ │ │ +		// announcing this item, this is used to determine
│ │ │ │ +		// popularity if we reach the limit of items to store
│ │ │ │ +		bloom_filter&lt;128&gt; ips;
│ │ │ │ +		// the last time we heard about this item
│ │ │ │ +		// the correct interpretation of this field
│ │ │ │ +		// requires a time reference
│ │ │ │ +		time_point last_seen;
│ │ │ │ +		// number of IPs in the bloom filter
│ │ │ │ +		int num_announcers = 0;
│ │ │ │ +		// size of malloced space pointed to by value
│ │ │ │ +		int size = 0;
│ │ │ │ +	};
│ │ │ │ +
│ │ │ │ +	struct dht_mutable_item : dht_immutable_item
│ │ │ │ +	{
│ │ │ │ +		signature sig{};
│ │ │ │ +		sequence_number seq{};
│ │ │ │ +		public_key key{};
│ │ │ │ +		std::string salt;
│ │ │ │ +	};
│ │ │ │ +
│ │ │ │ +	void set_value(dht_immutable_item&amp; item, span&lt;char const&gt; buf)
│ │ │ │ +	{
│ │ │ │ +		int const size = int(buf.size());
│ │ │ │  </pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(82)">../include/libtorrent/piece_picker.hpp:668</a></td><td>having 8 priority levels is probably excessive. It should probably be changed to 3 levels + dont-download</td></tr><tr id="82" style="display: none;" colspan="3"><td colspan="3"><h2>having 8 priority levels is probably excessive. It should
│ │ │ │  probably be changed to 3 levels + dont-download</h2><h4>../include/libtorrent/piece_picker.hpp:668</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				else if (state() == piece_full)
│ │ │ │  						state(piece_full_reverse);
│ │ │ │  			}
│ │ │ │  
│ │ │ │  			// the number of peers that has this piece
│ │ │ │  			// (availability)
│ │ │ │ @@ -4210,15 +4210,66 @@
│ │ │ │  	using allocator_type = typename boost::asio::associated_allocator&lt;UnderlyingHandler&gt;::type;
│ │ │ │  	using executor_type = typename boost::asio::associated_executor&lt;UnderlyingHandler&gt;::type;
│ │ │ │  
│ │ │ │  	allocator_type get_allocator() const noexcept
│ │ │ │  	{ return boost::asio::get_associated_allocator(m_underlying_handler); }
│ │ │ │  
│ │ │ │  	executor_type get_executor() const noexcept
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(85)">../include/libtorrent/peer_connection.hpp:996</a></td><td>this should really be a circular buffer</td></tr><tr id="85" style="display: none;" colspan="3"><td colspan="3"><h2>this should really be a circular buffer</h2><h4>../include/libtorrent/peer_connection.hpp:996</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// it just serves as a queue to remember what we've sent, to avoid
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(85)">../include/libtorrent/socks5_stream.hpp:153</a></td><td>add async_connect() that takes a hostname and port as well</td></tr><tr id="85" style="display: none;" colspan="3"><td colspan="3"><h2>add async_connect() that takes a hostname and port as well</h2><h4>../include/libtorrent/socks5_stream.hpp:153</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		TORRENT_ASSERT(!aux::is_ip_address(host));
│ │ │ │ +		m_dst_name = host;
│ │ │ │ +		if (m_dst_name.size() &gt; 255)
│ │ │ │ +			m_dst_name.resize(255);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void close(error_code&amp; ec)
│ │ │ │ +	{
│ │ │ │ +		m_dst_name.clear();
│ │ │ │ +		proxy_base::close(ec);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ +	void close()
│ │ │ │ +	{
│ │ │ │ +		m_dst_name.clear();
│ │ │ │ +		proxy_base::close();
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	template &lt;class Handler&gt;
│ │ │ │ +</div>	void async_connect(endpoint_type const&amp; endpoint, Handler handler)
│ │ │ │ +	{
│ │ │ │ +		// make sure we don't try to connect to INADDR_ANY. binding is fine,
│ │ │ │ +		// and using a hostname is fine on SOCKS version 5.
│ │ │ │ +		TORRENT_ASSERT(endpoint.address() != address()
│ │ │ │ +			|| (!m_dst_name.empty() &amp;&amp; m_version == 5));
│ │ │ │ +
│ │ │ │ +		m_remote_endpoint = endpoint;
│ │ │ │ +
│ │ │ │ +		// the connect is split up in the following steps:
│ │ │ │ +		// 1. resolve name of proxy server
│ │ │ │ +		// 2. connect to proxy server
│ │ │ │ +		// 3. if version == 5:
│ │ │ │ +		//   3.1 send SOCKS5 authentication method message
│ │ │ │ +		//   3.2 read SOCKS5 authentication response
│ │ │ │ +		//   3.3 send username+password
│ │ │ │ +		// 4. send SOCKS command message
│ │ │ │ +
│ │ │ │ +		ADD_OUTSTANDING_ASYNC("socks5_stream::name_lookup");
│ │ │ │ +		m_resolver.async_resolve(m_hostname, to_string(m_port).data(), wrap_allocator(
│ │ │ │ +			[this](error_code const&amp; ec, tcp::resolver::results_type ips, Handler hn) {
│ │ │ │ +				name_lookup(ec, std::move(ips), std::move(hn));
│ │ │ │ +			}, std::move(handler)));
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +private:
│ │ │ │ +
│ │ │ │ +	template &lt;typename Handler&gt;
│ │ │ │ +	void name_lookup(error_code const&amp; e, tcp::resolver::results_type ips
│ │ │ │ +		, Handler h)
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(86)">../include/libtorrent/peer_connection.hpp:996</a></td><td>this should really be a circular buffer</td></tr><tr id="86" style="display: none;" colspan="3"><td colspan="3"><h2>this should really be a circular buffer</h2><h4>../include/libtorrent/peer_connection.hpp:996</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// it just serves as a queue to remember what we've sent, to avoid
│ │ │ │  		// re-sending suggests for the same piece
│ │ │ │  		// i.e. outgoing suggest pieces
│ │ │ │  		aux::vector&lt;piece_index_t&gt; m_suggest_pieces;
│ │ │ │  
│ │ │ │  		// the pieces we will send to the peer
│ │ │ │  		// if requested (regardless of choke state)
│ │ │ │  		std::vector&lt;piece_index_t&gt; m_accept_fast;
│ │ │ │ @@ -4259,15 +4310,15 @@
│ │ │ │  
│ │ │ │  		template &lt;typename Fun, typename... Args&gt;
│ │ │ │  		void wrap(Fun f, Args&amp;&amp;... a);
│ │ │ │  
│ │ │ │  		// statistics about upload and download speeds
│ │ │ │  		// and total amount of uploads and downloads for
│ │ │ │  		// this peer
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(86)">../include/libtorrent/peer_connection.hpp:1086</a></td><td>rename this target queue size</td></tr><tr id="86" style="display: none;" colspan="3"><td colspan="3"><h2>rename this target queue size</h2><h4>../include/libtorrent/peer_connection.hpp:1086</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// this is the piece that is available to this peer. Only
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(87)">../include/libtorrent/peer_connection.hpp:1086</a></td><td>rename this target queue size</td></tr><tr id="87" style="display: none;" colspan="3"><td colspan="3"><h2>rename this target queue size</h2><h4>../include/libtorrent/peer_connection.hpp:1086</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// this is the piece that is available to this peer. Only
│ │ │ │  		// these two pieces can be downloaded from us by this peer.
│ │ │ │  		// This will remain the current piece for this peer until
│ │ │ │  		// another peer sends us a have message for this piece
│ │ │ │  		std::array&lt;piece_index_t, 2&gt; m_superseed_piece = {{piece_index_t(-1), piece_index_t(-1)}};
│ │ │ │  #endif
│ │ │ │  
│ │ │ │  		// the number of bytes send to the disk-io
│ │ │ │ @@ -4310,66 +4361,66 @@
│ │ │ │  		// could be considered: true = local, false = remote
│ │ │ │  		bool m_outgoing:1;
│ │ │ │  
│ │ │ │  		// is true if we learn the incoming connections listening
│ │ │ │  		// during the extended handshake
│ │ │ │  		bool m_received_listen_port:1;
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(87)">../include/libtorrent/socks5_stream.hpp:153</a></td><td>add async_connect() that takes a hostname and port as well</td></tr><tr id="87" style="display: none;" colspan="3"><td colspan="3"><h2>add async_connect() that takes a hostname and port as well</h2><h4>../include/libtorrent/socks5_stream.hpp:153</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		TORRENT_ASSERT(!aux::is_ip_address(host));
│ │ │ │ -		m_dst_name = host;
│ │ │ │ -		if (m_dst_name.size() &gt; 255)
│ │ │ │ -			m_dst_name.resize(255);
│ │ │ │ -	}
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(88)">../include/libtorrent/aux_/chained_buffer.hpp:59</a></td><td>this type should probably be renamed to send_buffer</td></tr><tr id="88" style="display: none;" colspan="3"><td colspan="3"><h2>this type should probably be renamed to send_buffer</h2><h4>../include/libtorrent/aux_/chained_buffer.hpp:59</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include "libtorrent/aux_/buffer.hpp"
│ │ │ │  
│ │ │ │ -	void close(error_code&amp; ec)
│ │ │ │ -	{
│ │ │ │ -		m_dst_name.clear();
│ │ │ │ -		proxy_base::close(ec);
│ │ │ │ -	}
│ │ │ │ +#include &lt;deque&gt;
│ │ │ │ +#include &lt;vector&gt;
│ │ │ │  
│ │ │ │ -#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ -	void close()
│ │ │ │ -	{
│ │ │ │ -		m_dst_name.clear();
│ │ │ │ -		proxy_base::close();
│ │ │ │ -	}
│ │ │ │ -#endif
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_push.hpp"
│ │ │ │ +#include &lt;boost/asio/buffer.hpp&gt;
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">	template &lt;class Handler&gt;
│ │ │ │ -</div>	void async_connect(endpoint_type const&amp; endpoint, Handler handler)
│ │ │ │ -	{
│ │ │ │ -		// make sure we don't try to connect to INADDR_ANY. binding is fine,
│ │ │ │ -		// and using a hostname is fine on SOCKS version 5.
│ │ │ │ -		TORRENT_ASSERT(endpoint.address() != address()
│ │ │ │ -			|| (!m_dst_name.empty() &amp;&amp; m_version == 5));
│ │ │ │ +#ifdef _MSC_VER
│ │ │ │ +// visual studio requires the value in a deque to be copyable. C++11
│ │ │ │ +// has looser requirements depending on which functions are actually used.
│ │ │ │ +#define TORRENT_CPP98_DEQUE 1
│ │ │ │ +#else
│ │ │ │ +#define TORRENT_CPP98_DEQUE 0
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -		m_remote_endpoint = endpoint;
│ │ │ │ +namespace libtorrent {
│ │ │ │ +namespace aux {
│ │ │ │  
│ │ │ │ -		// the connect is split up in the following steps:
│ │ │ │ -		// 1. resolve name of proxy server
│ │ │ │ -		// 2. connect to proxy server
│ │ │ │ -		// 3. if version == 5:
│ │ │ │ -		//   3.1 send SOCKS5 authentication method message
│ │ │ │ -		//   3.2 read SOCKS5 authentication response
│ │ │ │ -		//   3.3 send username+password
│ │ │ │ -		// 4. send SOCKS command message
│ │ │ │ +<div style="background: #ffff00" width="100%">	struct TORRENT_EXTRA_EXPORT chained_buffer : private single_threaded
│ │ │ │ +</div>	{
│ │ │ │ +		chained_buffer(): m_bytes(0), m_capacity(0)
│ │ │ │ +		{
│ │ │ │ +			thread_started();
│ │ │ │ +#if TORRENT_USE_ASSERTS
│ │ │ │ +			m_destructed = false;
│ │ │ │ +#endif
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -		ADD_OUTSTANDING_ASYNC("socks5_stream::name_lookup");
│ │ │ │ -		m_resolver.async_resolve(m_hostname, to_string(m_port).data(), wrap_allocator(
│ │ │ │ -			[this](error_code const&amp; ec, tcp::resolver::results_type ips, Handler hn) {
│ │ │ │ -				name_lookup(ec, std::move(ips), std::move(hn));
│ │ │ │ -			}, std::move(handler)));
│ │ │ │ -	}
│ │ │ │ +	private:
│ │ │ │  
│ │ │ │ -private:
│ │ │ │ +		// destructs/frees the holder object
│ │ │ │ +		using destruct_holder_fun = void (*)(void*);
│ │ │ │ +		using move_construct_holder_fun = void (*)(void*, void*);
│ │ │ │  
│ │ │ │ -	template &lt;typename Handler&gt;
│ │ │ │ -	void name_lookup(error_code const&amp; e, tcp::resolver::results_type ips
│ │ │ │ -		, Handler h)
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(88)">../include/libtorrent/aux_/session_interface.hpp:127</a></td><td>make this interface a lot smaller. It could be split up into several smaller interfaces. Each subsystem could then limit the size of the mock object to test it.</td></tr><tr id="88" style="display: none;" colspan="3"><td colspan="3"><h2>make this interface a lot smaller. It could be split up into
│ │ │ │ +		struct buffer_t
│ │ │ │ +		{
│ │ │ │ +			buffer_t() {}
│ │ │ │ +#if TORRENT_CPP98_DEQUE
│ │ │ │ +			buffer_t(buffer_t&amp;&amp; rhs) noexcept
│ │ │ │ +			{
│ │ │ │ +				destruct_holder = rhs.destruct_holder;
│ │ │ │ +				move_holder = rhs.move_holder;
│ │ │ │ +				buf = rhs.buf;
│ │ │ │ +				size = rhs.size;
│ │ │ │ +				used_size = rhs.used_size;
│ │ │ │ +				move_holder(&amp;holder, &amp;rhs.holder);
│ │ │ │ +			}
│ │ │ │ +			buffer_t&amp; operator=(buffer_t&amp;&amp; rhs) &amp; noexcept
│ │ │ │ +			{
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(89)">../include/libtorrent/aux_/session_interface.hpp:127</a></td><td>make this interface a lot smaller. It could be split up into several smaller interfaces. Each subsystem could then limit the size of the mock object to test it.</td></tr><tr id="89" style="display: none;" colspan="3"><td colspan="3"><h2>make this interface a lot smaller. It could be split up into
│ │ │ │  several smaller interfaces. Each subsystem could then limit the size
│ │ │ │  of the mock object to test it.</h2><h4>../include/libtorrent/aux_/session_interface.hpp:127</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	// a release build with logging disabled (which is the default) will
│ │ │ │  	// not have this class at all
│ │ │ │  	struct TORRENT_EXTRA_EXPORT session_logger
│ │ │ │  	{
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  		virtual bool should_log() const = 0;
│ │ │ │ @@ -4389,15 +4440,15 @@
│ │ │ │  
│ │ │ │  <div style="background: #ffff00" width="100%">	struct TORRENT_EXTRA_EXPORT session_interface
│ │ │ │  </div>#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
│ │ │ │  		: session_logger
│ │ │ │  #endif
│ │ │ │  	{
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(89)">../include/libtorrent/aux_/session_interface.hpp:136</a></td><td>the IP voting mechanism should be factored out to its own class, not part of the session and these constants should move too</td></tr><tr id="89" style="display: none;" colspan="3"><td colspan="3"><h2>the IP voting mechanism should be factored out
│ │ │ │ +</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(90)">../include/libtorrent/aux_/session_interface.hpp:136</a></td><td>the IP voting mechanism should be factored out to its own class, not part of the session and these constants should move too</td></tr><tr id="90" style="display: none;" colspan="3"><td colspan="3"><h2>the IP voting mechanism should be factored out
│ │ │ │  to its own class, not part of the session
│ │ │ │  and these constants should move too</h2><h4>../include/libtorrent/aux_/session_interface.hpp:136</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		virtual void session_log(char const* fmt, ...) const TORRENT_FORMAT(2,3) = 0;
│ │ │ │  #endif
│ │ │ │  
│ │ │ │  #if TORRENT_USE_ASSERTS
│ │ │ │  		virtual bool is_single_thread() const = 0;
│ │ │ │  		virtual bool has_peer(peer_connection const* p) const = 0;
│ │ │ │ @@ -4442,118 +4493,15 @@
│ │ │ │  		virtual void remove_torrent(torrent_handle const&amp; h, remove_flags_t options = {}) = 0;
│ │ │ │  		virtual void remove_torrent_impl(std::shared_ptr&lt;torrent&gt; tptr, remove_flags_t options) = 0;
│ │ │ │  
│ │ │ │  		// port filter
│ │ │ │  		virtual port_filter const&amp; get_port_filter() const = 0;
│ │ │ │  		virtual void ban_ip(address addr) = 0;
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #cfc"><td>relevance&nbsp;2</td><td><a href="javascript:expand(90)">../include/libtorrent/aux_/chained_buffer.hpp:59</a></td><td>this type should probably be renamed to send_buffer</td></tr><tr id="90" style="display: none;" colspan="3"><td colspan="3"><h2>this type should probably be renamed to send_buffer</h2><h4>../include/libtorrent/aux_/chained_buffer.hpp:59</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include "libtorrent/aux_/buffer.hpp"
│ │ │ │ -
│ │ │ │ -#include &lt;deque&gt;
│ │ │ │ -#include &lt;vector&gt;
│ │ │ │ -
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_push.hpp"
│ │ │ │ -#include &lt;boost/asio/buffer.hpp&gt;
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │ -
│ │ │ │ -#ifdef _MSC_VER
│ │ │ │ -// visual studio requires the value in a deque to be copyable. C++11
│ │ │ │ -// has looser requirements depending on which functions are actually used.
│ │ │ │ -#define TORRENT_CPP98_DEQUE 1
│ │ │ │ -#else
│ │ │ │ -#define TORRENT_CPP98_DEQUE 0
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -namespace libtorrent {
│ │ │ │ -namespace aux {
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	struct TORRENT_EXTRA_EXPORT chained_buffer : private single_threaded
│ │ │ │ -</div>	{
│ │ │ │ -		chained_buffer(): m_bytes(0), m_capacity(0)
│ │ │ │ -		{
│ │ │ │ -			thread_started();
│ │ │ │ -#if TORRENT_USE_ASSERTS
│ │ │ │ -			m_destructed = false;
│ │ │ │ -#endif
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -	private:
│ │ │ │ -
│ │ │ │ -		// destructs/frees the holder object
│ │ │ │ -		using destruct_holder_fun = void (*)(void*);
│ │ │ │ -		using move_construct_holder_fun = void (*)(void*, void*);
│ │ │ │ -
│ │ │ │ -		struct buffer_t
│ │ │ │ -		{
│ │ │ │ -			buffer_t() {}
│ │ │ │ -#if TORRENT_CPP98_DEQUE
│ │ │ │ -			buffer_t(buffer_t&amp;&amp; rhs) noexcept
│ │ │ │ -			{
│ │ │ │ -				destruct_holder = rhs.destruct_holder;
│ │ │ │ -				move_holder = rhs.move_holder;
│ │ │ │ -				buf = rhs.buf;
│ │ │ │ -				size = rhs.size;
│ │ │ │ -				used_size = rhs.used_size;
│ │ │ │ -				move_holder(&amp;holder, &amp;rhs.holder);
│ │ │ │ -			}
│ │ │ │ -			buffer_t&amp; operator=(buffer_t&amp;&amp; rhs) &amp; noexcept
│ │ │ │ -			{
│ │ │ │ -</pre></td></tr><tr style="background: #ccf"><td>relevance&nbsp;1</td><td><a href="javascript:expand(91)">../src/session_impl.cpp:5707</a></td><td>report the proper address of the router as the source IP of this vote of our external address, instead of the empty address</td></tr><tr id="91" style="display: none;" colspan="3"><td colspan="3"><h2>report the proper address of the router as the source IP of
│ │ │ │ -this vote of our external address, instead of the empty address</h2><h4>../src/session_impl.cpp:5707</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		, listen_socket_handle const&amp; ls)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -
│ │ │ │ -		listen_socket_t* listen_socket = ls.get();
│ │ │ │ -
│ │ │ │ -		// NOTE: don't assume that if ec != 0, the rest of the logic
│ │ │ │ -		// is not necessary, the ports still need to be set, in other
│ │ │ │ -		// words, don't early return without careful review of the
│ │ │ │ -		// remaining logic
│ │ │ │ -		if (ec &amp;&amp; m_alerts.should_post&lt;portmap_error_alert&gt;())
│ │ │ │ -		{
│ │ │ │ -			m_alerts.emplace_alert&lt;portmap_error_alert&gt;(mapping
│ │ │ │ -				, transport, ec, listen_socket ? listen_socket-&gt;local_endpoint.address() : address());
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		if (!listen_socket) return;
│ │ │ │ -
│ │ │ │ -		if (!ec &amp;&amp; !external_ip.is_unspecified())
│ │ │ │ -		{
│ │ │ │ -<div style="background: #ffff00" width="100%">			listen_socket-&gt;external_address.cast_vote(external_ip, source_router, address());
│ │ │ │ -</div>		}
│ │ │ │ -
│ │ │ │ -		// need to check whether this mapping is for one of session ports (it could also be a user mapping)
│ │ │ │ -		if ((proto == portmap_protocol::tcp) &amp;&amp; (listen_socket-&gt;tcp_port_mapping[transport].mapping == mapping))
│ │ │ │ -			listen_socket-&gt;tcp_port_mapping[transport].port = port;
│ │ │ │ -		else if ((proto == portmap_protocol::udp) &amp;&amp; (listen_socket-&gt;udp_port_mapping[transport].mapping == mapping))
│ │ │ │ -			listen_socket-&gt;udp_port_mapping[transport].port = port;
│ │ │ │ -
│ │ │ │ -		if (!ec &amp;&amp; m_alerts.should_post&lt;portmap_alert&gt;())
│ │ │ │ -		{
│ │ │ │ -			m_alerts.emplace_alert&lt;portmap_alert&gt;(mapping, port
│ │ │ │ -				, transport, proto, listen_socket-&gt;local_endpoint.address());
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ -	session_status session_impl::status() const
│ │ │ │ -	{
│ │ │ │ -//		INVARIANT_CHECK;
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -
│ │ │ │ -		session_status s;
│ │ │ │ -
│ │ │ │ -		s.optimistic_unchoke_counter = m_optimistic_unchoke_time_scaler;
│ │ │ │ -		s.unchoke_counter = m_unchoke_time_scaler;
│ │ │ │ -		s.num_dead_peers = int(m_undead_peers.size());
│ │ │ │ -
│ │ │ │ -		s.num_peers = int(m_stats_counters[counters::num_peers_connected]);
│ │ │ │ -		s.num_unchoked = int(m_stats_counters[counters::num_peers_up_unchoked_all]);
│ │ │ │ -		s.allowed_upload_slots = int(m_stats_counters[counters::num_unchoke_slots]);
│ │ │ │ -</pre></td></tr><tr style="background: #ccf"><td>relevance&nbsp;1</td><td><a href="javascript:expand(92)">../src/torrent.cpp:1126</a></td><td>make this depend on the error and on the filesystem the files are being downloaded to. If the error is no_space_left_on_device and the filesystem doesn't support sparse files, only zero the priorities of the pieces that are at the tails of all files, leaving everything up to the highest written piece in each file</td></tr><tr id="92" style="display: none;" colspan="3"><td colspan="3"><h2>make this depend on the error and on the filesystem the
│ │ │ │ +</pre></td></tr><tr style="background: #ccf"><td>relevance&nbsp;1</td><td><a href="javascript:expand(91)">../src/torrent.cpp:1126</a></td><td>make this depend on the error and on the filesystem the files are being downloaded to. If the error is no_space_left_on_device and the filesystem doesn't support sparse files, only zero the priorities of the pieces that are at the tails of all files, leaving everything up to the highest written piece in each file</td></tr><tr id="91" style="display: none;" colspan="3"><td colspan="3"><h2>make this depend on the error and on the filesystem the
│ │ │ │  files are being downloaded to. If the error is no_space_left_on_device
│ │ │ │  and the filesystem doesn't support sparse files, only zero the priorities
│ │ │ │  of the pieces that are at the tails of all files, leaving everything
│ │ │ │  up to the highest written piece in each file</h2><h4>../src/torrent.cpp:1126</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  		// notify the user of the error
│ │ │ │  		if (alerts().should_post&lt;file_error_alert&gt;())
│ │ │ │  			alerts().emplace_alert&lt;file_error_alert&gt;(error.ec
│ │ │ │ @@ -4600,15 +4548,15 @@
│ │ │ │  		pause();
│ │ │ │  	}
│ │ │ │  
│ │ │ │  	void torrent::on_piece_fail_sync(piece_index_t const piece, piece_block) try
│ │ │ │  	{
│ │ │ │  		if (m_abort) return;
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccf"><td>relevance&nbsp;1</td><td><a href="javascript:expand(93)">../src/torrent.cpp:8398</a></td><td>should disconnect all peers that have the pieces we have not just seeds. It would be pretty expensive to check all pieces for all peers though</td></tr><tr id="93" style="display: none;" colspan="3"><td colspan="3"><h2>should disconnect all peers that have the pieces we have
│ │ │ │ +</pre></td></tr><tr style="background: #ccf"><td>relevance&nbsp;1</td><td><a href="javascript:expand(92)">../src/torrent.cpp:8398</a></td><td>should disconnect all peers that have the pieces we have not just seeds. It would be pretty expensive to check all pieces for all peers though</td></tr><tr id="92" style="display: none;" colspan="3"><td colspan="3"><h2>should disconnect all peers that have the pieces we have
│ │ │ │  not just seeds. It would be pretty expensive to check all pieces
│ │ │ │  for all peers though</h2><h4>../src/torrent.cpp:8398</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  		set_state(torrent_status::finished);
│ │ │ │  		set_queue_position(no_pos);
│ │ │ │  
│ │ │ │  		m_became_finished = aux::time_now32();
│ │ │ │  
│ │ │ │ @@ -4653,14 +4601,66 @@
│ │ │ │  			// we need to keep the object alive during this operation
│ │ │ │  			m_ses.disk_thread().async_release_files(m_storage
│ │ │ │  				, std::bind(&amp;torrent::on_cache_flushed, shared_from_this(), false));
│ │ │ │  			m_ses.deferred_submit_jobs();
│ │ │ │  		}
│ │ │ │  
│ │ │ │  		// this torrent just completed downloads, which means it will fall
│ │ │ │ +</pre></td></tr><tr style="background: #ccf"><td>relevance&nbsp;1</td><td><a href="javascript:expand(93)">../src/session_impl.cpp:5707</a></td><td>report the proper address of the router as the source IP of this vote of our external address, instead of the empty address</td></tr><tr id="93" style="display: none;" colspan="3"><td colspan="3"><h2>report the proper address of the router as the source IP of
│ │ │ │ +this vote of our external address, instead of the empty address</h2><h4>../src/session_impl.cpp:5707</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		, listen_socket_handle const&amp; ls)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +
│ │ │ │ +		listen_socket_t* listen_socket = ls.get();
│ │ │ │ +
│ │ │ │ +		// NOTE: don't assume that if ec != 0, the rest of the logic
│ │ │ │ +		// is not necessary, the ports still need to be set, in other
│ │ │ │ +		// words, don't early return without careful review of the
│ │ │ │ +		// remaining logic
│ │ │ │ +		if (ec &amp;&amp; m_alerts.should_post&lt;portmap_error_alert&gt;())
│ │ │ │ +		{
│ │ │ │ +			m_alerts.emplace_alert&lt;portmap_error_alert&gt;(mapping
│ │ │ │ +				, transport, ec, listen_socket ? listen_socket-&gt;local_endpoint.address() : address());
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		if (!listen_socket) return;
│ │ │ │ +
│ │ │ │ +		if (!ec &amp;&amp; !external_ip.is_unspecified())
│ │ │ │ +		{
│ │ │ │ +<div style="background: #ffff00" width="100%">			listen_socket-&gt;external_address.cast_vote(external_ip, source_router, address());
│ │ │ │ +</div>		}
│ │ │ │ +
│ │ │ │ +		// need to check whether this mapping is for one of session ports (it could also be a user mapping)
│ │ │ │ +		if ((proto == portmap_protocol::tcp) &amp;&amp; (listen_socket-&gt;tcp_port_mapping[transport].mapping == mapping))
│ │ │ │ +			listen_socket-&gt;tcp_port_mapping[transport].port = port;
│ │ │ │ +		else if ((proto == portmap_protocol::udp) &amp;&amp; (listen_socket-&gt;udp_port_mapping[transport].mapping == mapping))
│ │ │ │ +			listen_socket-&gt;udp_port_mapping[transport].port = port;
│ │ │ │ +
│ │ │ │ +		if (!ec &amp;&amp; m_alerts.should_post&lt;portmap_alert&gt;())
│ │ │ │ +		{
│ │ │ │ +			m_alerts.emplace_alert&lt;portmap_alert&gt;(mapping, port
│ │ │ │ +				, transport, proto, listen_socket-&gt;local_endpoint.address());
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │ +	session_status session_impl::status() const
│ │ │ │ +	{
│ │ │ │ +//		INVARIANT_CHECK;
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +
│ │ │ │ +		session_status s;
│ │ │ │ +
│ │ │ │ +		s.optimistic_unchoke_counter = m_optimistic_unchoke_time_scaler;
│ │ │ │ +		s.unchoke_counter = m_unchoke_time_scaler;
│ │ │ │ +		s.num_dead_peers = int(m_undead_peers.size());
│ │ │ │ +
│ │ │ │ +		s.num_peers = int(m_stats_counters[counters::num_peers_connected]);
│ │ │ │ +		s.num_unchoked = int(m_stats_counters[counters::num_peers_up_unchoked_all]);
│ │ │ │ +		s.allowed_upload_slots = int(m_stats_counters[counters::num_unchoke_slots]);
│ │ │ │  </pre></td></tr><tr style="background: #ccf"><td>relevance&nbsp;1</td><td><a href="javascript:expand(94)">../include/libtorrent/ip_voter.hpp:130</a></td><td>have one instance per possible subnet, 192.168.x.x, 10.x.x.x, etc.</td></tr><tr id="94" style="display: none;" colspan="3"><td colspan="3"><h2>have one instance per possible subnet, 192.168.x.x, 10.x.x.x, etc.</h2><h4>../include/libtorrent/ip_voter.hpp:130</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	// stores one address for each combination of local/global and ipv4/ipv6
│ │ │ │  	// use of this class should be avoided, get the IP from the appropriate
│ │ │ │  	// listen interface wherever possible
│ │ │ │  	struct TORRENT_EXTRA_EXPORT external_ip
│ │ │ │  	{
│ │ │ │  		external_ip()
│ │ │ │  			: m_addresses{{address_v4(), address_v6()}, {address_v4(), address_v6()}}
│ │ │ │ @@ -4679,169 +4679,15 @@
│ │ │ │  		// [n][0] = IPv4 [n][1] = IPv6
│ │ │ │  <div style="background: #ffff00" width="100%">		address m_addresses[2][2];
│ │ │ │  </div>	};
│ │ │ │  
│ │ │ │  }
│ │ │ │  
│ │ │ │  #endif
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(95)">../test/test_ssl.cpp:407</a></td><td>test using a signed certificate with the wrong info-hash in DN</td></tr><tr id="95" style="display: none;" colspan="3"><td colspan="3"><h2>test using a signed certificate with the wrong info-hash in DN</h2><h4>../test/test_ssl.cpp:407</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	// in verifying peers
│ │ │ │ -	ctx.set_verify_mode(context::verify_none, ec);
│ │ │ │ -	if (ec)
│ │ │ │ -	{
│ │ │ │ -		std::printf("Failed to set SSL verify mode: %s\n"
│ │ │ │ -			, ec.message().c_str());
│ │ │ │ -		TEST_CHECK(!ec);
│ │ │ │ -		return false;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	std::string certificate = combine_path("..", combine_path("ssl", "peer_certificate.pem"));
│ │ │ │ -	std::string private_key = combine_path("..", combine_path("ssl", "peer_private_key.pem"));
│ │ │ │ -	std::string dh_params = combine_path("..", combine_path("ssl", "dhparams.pem"));
│ │ │ │ -
│ │ │ │ -	if (flags &amp; invalid_certificate)
│ │ │ │ -	{
│ │ │ │ -		certificate = combine_path("..", combine_path("ssl", "invalid_peer_certificate.pem"));
│ │ │ │ -		private_key = combine_path("..", combine_path("ssl", "invalid_peer_private_key.pem"));
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>	if (flags &amp; (valid_certificate | invalid_certificate))
│ │ │ │ -	{
│ │ │ │ -		std::printf("set_password_callback\n");
│ │ │ │ -		ctx.set_password_callback(
│ │ │ │ -			[](std::size_t, context::password_purpose) { return "test"; }
│ │ │ │ -			, ec);
│ │ │ │ -		if (ec)
│ │ │ │ -		{
│ │ │ │ -			std::printf("Failed to set certificate passphrase: %s\n"
│ │ │ │ -				, ec.message().c_str());
│ │ │ │ -			TEST_CHECK(!ec);
│ │ │ │ -			return false;
│ │ │ │ -		}
│ │ │ │ -		std::printf("use_certificate_file \"%s\"\n", certificate.c_str());
│ │ │ │ -		ctx.use_certificate_file(certificate, context::pem, ec);
│ │ │ │ -		if (ec)
│ │ │ │ -		{
│ │ │ │ -			std::printf("Failed to set certificate file: %s\n"
│ │ │ │ -				, ec.message().c_str());
│ │ │ │ -			TEST_CHECK(!ec);
│ │ │ │ -			return false;
│ │ │ │ -		}
│ │ │ │ -		std::printf("use_private_key_file \"%s\"\n", private_key.c_str());
│ │ │ │ -		ctx.use_private_key_file(private_key, context::pem, ec);
│ │ │ │ -		if (ec)
│ │ │ │ -		{
│ │ │ │ -			std::printf("Failed to set private key: %s\n"
│ │ │ │ -				, ec.message().c_str());
│ │ │ │ -			TEST_CHECK(!ec);
│ │ │ │ -			return false;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(96)">../test/test_ssl.cpp:509</a></td><td>also test using a hash that refers to a valid torrent but that differs from the SNI hash</td></tr><tr id="96" style="display: none;" colspan="3"><td colspan="3"><h2>also test using a hash that refers to a valid torrent
│ │ │ │ -but that differs from the SNI hash</h2><h4>../test/test_ssl.cpp:509</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	print_alerts(ses1, "ses1", true, true, &amp;on_alert);
│ │ │ │ -	if (ec)
│ │ │ │ -	{
│ │ │ │ -		std::printf("Failed SSL handshake: %s\n"
│ │ │ │ -			, ec.message().c_str());
│ │ │ │ -		return false;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	char handshake[] = "\x13" "BitTorrent protocol\0\0\0\0\0\0\0\x04"
│ │ │ │ -		"                    " // space for info-hash
│ │ │ │ -		"aaaaaaaaaaaaaaaaaaaa" // peer-id
│ │ │ │ -		"\0\0\0\x01\x02"; // interested
│ │ │ │ -
│ │ │ │ -	// fill in the info-hash
│ │ │ │ -	if (flags &amp; valid_bittorrent_hash)
│ │ │ │ -	{
│ │ │ │ -		std::memcpy(handshake + 28, &amp;t-&gt;info_hashes().v1[0], 20);
│ │ │ │ -	}
│ │ │ │ -	else
│ │ │ │ -	{
│ │ │ │ -<div style="background: #ffff00" width="100%">		std::generate(handshake + 28, handshake + 48, &amp;rand);
│ │ │ │ -</div>	}
│ │ │ │ -
│ │ │ │ -	// fill in the peer-id
│ │ │ │ -	std::generate(handshake + 48, handshake + 68, &amp;rand);
│ │ │ │ -
│ │ │ │ -	std::printf("bittorrent handshake\n");
│ │ │ │ -	boost::asio::write(ssl_sock, boost::asio::buffer(handshake, (sizeof(handshake) - 1)), ec);
│ │ │ │ -	print_alerts(ses1, "ses1", true, true, &amp;on_alert);
│ │ │ │ -	if (ec)
│ │ │ │ -	{
│ │ │ │ -		std::printf("failed to write bittorrent handshake: %s\n"
│ │ │ │ -			, ec.message().c_str());
│ │ │ │ -		return false;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	char buf[68];
│ │ │ │ -	std::printf("read bittorrent handshake\n");
│ │ │ │ -	boost::asio::read(ssl_sock, boost::asio::buffer(buf, sizeof(buf)), ec);
│ │ │ │ -	print_alerts(ses1, "ses1", true, true, &amp;on_alert);
│ │ │ │ -	if (ec)
│ │ │ │ -	{
│ │ │ │ -		std::printf("failed to read bittorrent handshake: %s\n"
│ │ │ │ -			, ec.message().c_str());
│ │ │ │ -		return false;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	if (memcmp(buf, "\x13" "BitTorrent protocol", 20) != 0)
│ │ │ │ -	{
│ │ │ │ -		std::printf("invalid bittorrent handshake\n");
│ │ │ │ -		return false;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(97)">../test/test_upnp.cpp:156</a></td><td>store the log and verify that some key messages are there</td></tr><tr id="97" style="display: none;" colspan="3"><td colspan="3"><h2>store the log and verify that some key messages are there</h2><h4>../test/test_upnp.cpp:156</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			, portmap_protocol const protocol, error_code const&amp; err
│ │ │ │ -			, portmap_transport, aux::listen_socket_handle const&amp;) override
│ │ │ │ -		{
│ │ │ │ -			callback_info info = {mapping, port, err};
│ │ │ │ -			callbacks.push_back(info);
│ │ │ │ -			std::cout &lt;&lt; "mapping: " &lt;&lt; static_cast&lt;int&gt;(mapping)
│ │ │ │ -				&lt;&lt; ", port: " &lt;&lt; port &lt;&lt; ", IP: " &lt;&lt; ip
│ │ │ │ -				&lt;&lt; ", proto: " &lt;&lt; static_cast&lt;int&gt;(protocol)
│ │ │ │ -				&lt;&lt; ", error: \"" &lt;&lt; err.message() &lt;&lt; "\"\n";
│ │ │ │ -		}
│ │ │ │ -	#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		bool should_log_portmap(portmap_transport) const override
│ │ │ │ -		{
│ │ │ │ -			return true;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		void log_portmap(portmap_transport, char const* msg
│ │ │ │ -			, aux::listen_socket_handle const&amp;) const override
│ │ │ │ -		{
│ │ │ │ -			std::cout &lt;&lt; "UPnP: " &lt;&lt; msg &lt;&lt; std::endl;
│ │ │ │ -<div style="background: #ffff00" width="100%">		}
│ │ │ │ -</div>	#endif
│ │ │ │ -	};
│ │ │ │ -
│ │ │ │ -ip_interface pick_upnp_interface()
│ │ │ │ -{
│ │ │ │ -	lt::io_context ios;
│ │ │ │ -	error_code ec;
│ │ │ │ -	std::vector&lt;ip_route&gt; const routes = enum_routes(ios, ec);
│ │ │ │ -	if (ec)
│ │ │ │ -	{
│ │ │ │ -		std::cerr &lt;&lt; "failed to enumerate routes: " &lt;&lt; ec.message() &lt;&lt; '\n';
│ │ │ │ -		TEST_CHECK(false);
│ │ │ │ -		return {};
│ │ │ │ -	}
│ │ │ │ -	std::vector&lt;ip_interface&gt; const ifs = enum_net_interfaces(ios, ec);
│ │ │ │ -	if (ec)
│ │ │ │ -	{
│ │ │ │ -		std::cerr &lt;&lt; "failed to enumerate network interfaces: " &lt;&lt; ec.message() &lt;&lt; '\n';
│ │ │ │ -		TEST_CHECK(false);
│ │ │ │ -		return {};
│ │ │ │ -	}
│ │ │ │ -	int idx = 0;
│ │ │ │ -	for (auto const&amp; face : ifs)
│ │ │ │ -	{
│ │ │ │ -		if (!face.interface_address.is_v4()) continue;
│ │ │ │ -		std::cout &lt;&lt; " - " &lt;&lt; idx
│ │ │ │ -			&lt;&lt; ' ' &lt;&lt; face.interface_address.to_string()
│ │ │ │ -			&lt;&lt; ' ' &lt;&lt; int(static_cast&lt;std::uint8_t&gt;(face.state))
│ │ │ │ -			&lt;&lt; ' ' &lt;&lt; static_cast&lt;std::uint32_t&gt;(face.flags)
│ │ │ │ -			&lt;&lt; ' ' &lt;&lt; face.name &lt;&lt; '\n';
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(98)">../test/test_bloom_filter.cpp:135</a></td><td>test size()</td></tr><tr id="98" style="display: none;" colspan="3"><td colspan="3"><h2>test size()</h2><h4>../test/test_bloom_filter.cpp:135</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(99)">../test/test_bloom_filter.cpp:136</a></td><td>test clear()</td></tr><tr id="99" style="display: none;" colspan="3"><td colspan="3"><h2>test clear()</h2><h4>../test/test_bloom_filter.cpp:136</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	sha1_hash k("\x01\x00\x02\x00                ");
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(95)">../test/test_bloom_filter.cpp:135</a></td><td>test size()</td></tr><tr id="95" style="display: none;" colspan="3"><td colspan="3"><h2>test size()</h2><h4>../test/test_bloom_filter.cpp:135</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(96)">../test/test_bloom_filter.cpp:136</a></td><td>test clear()</td></tr><tr id="96" style="display: none;" colspan="3"><td colspan="3"><h2>test clear()</h2><h4>../test/test_bloom_filter.cpp:136</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	sha1_hash k("\x01\x00\x02\x00                ");
│ │ │ │  	TEST_CHECK(!filter.find(k));
│ │ │ │  	filter.set(k);
│ │ │ │  	TEST_CHECK(filter.find(k));
│ │ │ │  
│ │ │ │  	std::uint8_t compare[4] = { 0x16, 0xff, 0x55, 0xaa};
│ │ │ │  
│ │ │ │  	bits_out = filter.to_string();
│ │ │ │ @@ -4854,15 +4700,15 @@
│ │ │ │  {
│ │ │ │  	test_set_and_get();
│ │ │ │  	test_set_bits();
│ │ │ │  	test_count_zeroes();
│ │ │ │  	test_to_from_string();
│ │ │ │  
│ │ │ │  <div style="background: #ffff00" width="100%">}
│ │ │ │ -</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(100)">../test/test_merkle_tree.cpp:233</a></td><td>use structured bindings in C++17</td></tr><tr id="100" style="display: none;" colspan="3"><td colspan="3"><h2>use structured bindings in C++17</h2><h4>../test/test_merkle_tree.cpp:233</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			mask[std::size_t(i)] = true;
│ │ │ │ +</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(97)">../test/test_merkle_tree.cpp:233</a></td><td>use structured bindings in C++17</td></tr><tr id="97" style="display: none;" colspan="3"><td colspan="3"><h2>use structured bindings in C++17</h2><h4>../test/test_merkle_tree.cpp:233</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			mask[std::size_t(i)] = true;
│ │ │ │  		t.load_sparse_tree(span&lt;sha256_hash const&gt;(f).subspan(first_piece, num_pieces), mask, empty_verified);
│ │ │ │  		int const end_piece_layer = first_piece + merkle_num_leafs(num_pieces);
│ │ │ │  		for (int i = 0; i &lt; end_piece_layer; ++i)
│ │ │ │  		{
│ │ │ │  			TEST_CHECK(t.has_node(i));
│ │ │ │  			TEST_CHECK(t.compare_node(i, f[i]));
│ │ │ │  		}
│ │ │ │ @@ -4905,15 +4751,15 @@
│ │ │ │  TORRENT_TEST(roundtrip_empty_tree)
│ │ │ │  {
│ │ │ │  	aux::merkle_tree t(num_blocks, 1, f[0].data());
│ │ │ │  	test_roundtrip(t, num_blocks, 1);
│ │ │ │  }
│ │ │ │  
│ │ │ │  TORRENT_TEST(roundtrip_full_tree)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(101)">../test/test_merkle_tree.cpp:938</a></td><td>add test for load_piece_layer()</td></tr><tr id="101" style="display: none;" colspan="3"><td colspan="3"><h2>add test for load_piece_layer()</h2><h4>../test/test_merkle_tree.cpp:938</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(102)">../test/test_merkle_tree.cpp:939</a></td><td>add test for add_hashes() with an odd number of blocks</td></tr><tr id="102" style="display: none;" colspan="3"><td colspan="3"><h2>add test for add_hashes() with an odd number of blocks</h2><h4>../test/test_merkle_tree.cpp:939</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(103)">../test/test_merkle_tree.cpp:940</a></td><td>add test for set_block() (setting the last block) with an odd number of blocks</td></tr><tr id="103" style="display: none;" colspan="3"><td colspan="3"><h2>add test for set_block() (setting the last block) with an odd number of blocks</h2><h4>../test/test_merkle_tree.cpp:940</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(98)">../test/test_merkle_tree.cpp:938</a></td><td>add test for load_piece_layer()</td></tr><tr id="98" style="display: none;" colspan="3"><td colspan="3"><h2>add test for load_piece_layer()</h2><h4>../test/test_merkle_tree.cpp:938</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(99)">../test/test_merkle_tree.cpp:939</a></td><td>add test for add_hashes() with an odd number of blocks</td></tr><tr id="99" style="display: none;" colspan="3"><td colspan="3"><h2>add test for add_hashes() with an odd number of blocks</h2><h4>../test/test_merkle_tree.cpp:939</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(100)">../test/test_merkle_tree.cpp:940</a></td><td>add test for set_block() (setting the last block) with an odd number of blocks</td></tr><tr id="100" style="display: none;" colspan="3"><td colspan="3"><h2>add test for set_block() (setting the last block) with an odd number of blocks</h2><h4>../test/test_merkle_tree.cpp:940</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  		for (int i = 0; i &lt; 7; ++i)
│ │ │ │  			TEST_EQUAL(t[i], f[i]);
│ │ │ │  	}
│ │ │ │  
│ │ │ │  	// use a proof that ties the first piece node 3 (since we don't need it all
│ │ │ │  	// the way to the root).
│ │ │ │  	auto const result = t.add_hashes(127, pdiff(1), range(f, 127, 4), build_proof(f, 31, 3));
│ │ │ │ @@ -4926,17 +4772,119 @@
│ │ │ │  	for (int i = 127; i &lt; 127 + 4; ++i)
│ │ │ │  		TEST_CHECK(t[i] == f[i]);
│ │ │ │  
│ │ │ │  	TEST_CHECK(t.verified_leafs() == none_set(num_blocks));
│ │ │ │  }
│ │ │ │  
│ │ │ │  <div style="background: #ffff00" width="100%">
│ │ │ │ -</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(104)">../test/test_file_storage.cpp:1208</a></td><td>test file attributes</td></tr><tr id="104" style="display: none;" colspan="3"><td colspan="3"><h2>test file attributes</h2><h4>../test/test_file_storage.cpp:1208</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(105)">../test/test_file_storage.cpp:1209</a></td><td>test symlinks</td></tr><tr id="105" style="display: none;" colspan="3"><td colspan="3"><h2>test symlinks</h2><h4>../test/test_file_storage.cpp:1209</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(106)">../test/test_torrent_info.cpp:459</a></td><td>test remap_files</td></tr><tr id="106" style="display: none;" colspan="3"><td colspan="3"><h2>test remap_files</h2><h4>../test/test_torrent_info.cpp:459</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(107)">../test/test_torrent_info.cpp:460</a></td><td>torrent with 'p' (padfile) attribute</td></tr><tr id="107" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with 'p' (padfile) attribute</h2><h4>../test/test_torrent_info.cpp:460</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(108)">../test/test_torrent_info.cpp:461</a></td><td>torrent with 'h' (hidden) attribute</td></tr><tr id="108" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with 'h' (hidden) attribute</h2><h4>../test/test_torrent_info.cpp:461</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(109)">../test/test_torrent_info.cpp:462</a></td><td>torrent with 'x' (executable) attribute</td></tr><tr id="109" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with 'x' (executable) attribute</h2><h4>../test/test_torrent_info.cpp:462</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(110)">../test/test_torrent_info.cpp:463</a></td><td>torrent with 'l' (symlink) attribute</td></tr><tr id="110" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with 'l' (symlink) attribute</h2><h4>../test/test_torrent_info.cpp:463</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(111)">../test/test_torrent_info.cpp:464</a></td><td>torrent with multiple trackers in multiple tiers, making sure we shuffle them (how do you test shuffling?, load it multiple times and make sure it's in different order at least once)</td></tr><tr id="111" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with multiple trackers in multiple tiers, making sure we
│ │ │ │ +</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(101)">../test/test_flags.cpp:163</a></td><td>change to a different test setup. currently always paused. test_set_after_add(torrent_flags::paused); test_unset_after_add(torrent_flags::paused);</td></tr><tr id="101" style="display: none;" colspan="3"><td colspan="3"><h2>change to a different test setup. currently always paused.
│ │ │ │ +test_set_after_add(torrent_flags::paused);
│ │ │ │ +test_unset_after_add(torrent_flags::paused);</h2><h4>../test/test_flags.cpp:163</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">{
│ │ │ │ +	// share-mode
│ │ │ │ +	test_add_and_get_flags(torrent_flags::share_mode);
│ │ │ │ +	test_set_after_add(torrent_flags::share_mode);
│ │ │ │ +	test_unset_after_add(torrent_flags::share_mode);
│ │ │ │ +}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +TORRENT_TEST(flag_apply_ip_filter)
│ │ │ │ +{
│ │ │ │ +	// apply-ip-filter
│ │ │ │ +	test_add_and_get_flags(torrent_flags::apply_ip_filter);
│ │ │ │ +	test_set_after_add(torrent_flags::apply_ip_filter);
│ │ │ │ +	test_unset_after_add(torrent_flags::apply_ip_filter);
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +TORRENT_TEST(flag_paused)
│ │ │ │ +{
│ │ │ │ +	// paused
│ │ │ │ +	test_add_and_get_flags(torrent_flags::paused);
│ │ │ │ +<div style="background: #ffff00" width="100%">}
│ │ │ │ +</div>
│ │ │ │ +TORRENT_TEST(flag_auto_managed)
│ │ │ │ +{
│ │ │ │ +	// auto-managed
│ │ │ │ +	test_add_and_get_flags(torrent_flags::auto_managed);
│ │ │ │ +	test_set_after_add(torrent_flags::auto_managed);
│ │ │ │ +	test_unset_after_add(torrent_flags::auto_managed);
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +// super seeding mode is automatically turned off if we're not a seed
│ │ │ │ +// since the posix_disk_io is not threaded, this will happen immediately
│ │ │ │ +#if TORRENT_HAVE_MMAP
│ │ │ │ +#ifndef TORRENT_DISABLE_SUPERSEEDING
│ │ │ │ +TORRENT_TEST(flag_super_seeding)
│ │ │ │ +{
│ │ │ │ +	// super-seeding
│ │ │ │ +	test_add_and_get_flags(torrent_flags::super_seeding);
│ │ │ │ +	test_unset_after_add(torrent_flags::super_seeding);
│ │ │ │ +	test_set_after_add(torrent_flags::super_seeding);
│ │ │ │ +}
│ │ │ │ +#endif
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +TORRENT_TEST(flag_sequential_download)
│ │ │ │ +{
│ │ │ │ +	// sequential-download
│ │ │ │ +	test_add_and_get_flags(torrent_flags::sequential_download);
│ │ │ │ +	test_set_after_add(torrent_flags::sequential_download);
│ │ │ │ +	test_unset_after_add(torrent_flags::sequential_download);
│ │ │ │ +}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(102)">../test/test_flags.cpp:205</a></td><td>this test is flaky, since the torrent will become ready before asking for the flags, and by then stop_when_ready will have been cleared test_add_and_get_flags(torrent_flags::stop_when_ready); setting stop-when-ready when already stopped has no effect.</td></tr><tr id="102" style="display: none;" colspan="3"><td colspan="3"><h2>this test is flaky, since the torrent will become ready before
│ │ │ │ +asking for the flags, and by then stop_when_ready will have been cleared
│ │ │ │ +test_add_and_get_flags(torrent_flags::stop_when_ready);
│ │ │ │ +setting stop-when-ready when already stopped has no effect.</h2><h4>../test/test_flags.cpp:205</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(103)">../test/test_flags.cpp:209</a></td><td>change to a different test setup. currently always paused. test_set_after_add(torrent_flags::stop_when_ready);</td></tr><tr id="103" style="display: none;" colspan="3"><td colspan="3"><h2>change to a different test setup. currently always paused.
│ │ │ │ +test_set_after_add(torrent_flags::stop_when_ready);</h2><h4>../test/test_flags.cpp:209</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	test_set_after_add(torrent_flags::super_seeding);
│ │ │ │ +}
│ │ │ │ +#endif
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +TORRENT_TEST(flag_sequential_download)
│ │ │ │ +{
│ │ │ │ +	// sequential-download
│ │ │ │ +	test_add_and_get_flags(torrent_flags::sequential_download);
│ │ │ │ +	test_set_after_add(torrent_flags::sequential_download);
│ │ │ │ +	test_unset_after_add(torrent_flags::sequential_download);
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +// the stop when ready flag will be cleared when the torrent is ready to start
│ │ │ │ +// downloading.
│ │ │ │ +// since the posix_disk_io is not threaded, this will happen immediately
│ │ │ │ +#if TORRENT_HAVE_MMAP
│ │ │ │ +TORRENT_TEST(flag_stop_when_ready)
│ │ │ │ +{
│ │ │ │ +	// stop-when-ready
│ │ │ │ +<div style="background: #ffff00" width="100%">	test_unset_after_add(torrent_flags::stop_when_ready);
│ │ │ │ +</div>}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +TORRENT_TEST(flag_disable_dht)
│ │ │ │ +{
│ │ │ │ +	test_add_and_get_flags(torrent_flags::disable_dht);
│ │ │ │ +	test_set_after_add(torrent_flags::disable_dht);
│ │ │ │ +	test_unset_after_add(torrent_flags::disable_dht);
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +TORRENT_TEST(flag_disable_lsd)
│ │ │ │ +{
│ │ │ │ +	test_add_and_get_flags(torrent_flags::disable_lsd);
│ │ │ │ +	test_set_after_add(torrent_flags::disable_lsd);
│ │ │ │ +	test_unset_after_add(torrent_flags::disable_lsd);
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +TORRENT_TEST(flag_disable_pex)
│ │ │ │ +{
│ │ │ │ +	test_add_and_get_flags(torrent_flags::disable_pex);
│ │ │ │ +	test_set_after_add(torrent_flags::disable_pex);
│ │ │ │ +	test_unset_after_add(torrent_flags::disable_pex);
│ │ │ │ +}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(104)">../test/test_torrent_info.cpp:459</a></td><td>test remap_files</td></tr><tr id="104" style="display: none;" colspan="3"><td colspan="3"><h2>test remap_files</h2><h4>../test/test_torrent_info.cpp:459</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(105)">../test/test_torrent_info.cpp:460</a></td><td>torrent with 'p' (padfile) attribute</td></tr><tr id="105" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with 'p' (padfile) attribute</h2><h4>../test/test_torrent_info.cpp:460</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(106)">../test/test_torrent_info.cpp:461</a></td><td>torrent with 'h' (hidden) attribute</td></tr><tr id="106" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with 'h' (hidden) attribute</h2><h4>../test/test_torrent_info.cpp:461</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(107)">../test/test_torrent_info.cpp:462</a></td><td>torrent with 'x' (executable) attribute</td></tr><tr id="107" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with 'x' (executable) attribute</h2><h4>../test/test_torrent_info.cpp:462</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(108)">../test/test_torrent_info.cpp:463</a></td><td>torrent with 'l' (symlink) attribute</td></tr><tr id="108" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with 'l' (symlink) attribute</h2><h4>../test/test_torrent_info.cpp:463</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(109)">../test/test_torrent_info.cpp:464</a></td><td>torrent with multiple trackers in multiple tiers, making sure we shuffle them (how do you test shuffling?, load it multiple times and make sure it's in different order at least once)</td></tr><tr id="109" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with multiple trackers in multiple tiers, making sure we
│ │ │ │  shuffle them (how do you test shuffling?, load it multiple times and make
│ │ │ │ -sure it's in different order at least once)</h2><h4>../test/test_torrent_info.cpp:464</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(112)">../test/test_torrent_info.cpp:467</a></td><td>torrents with a zero-length name</td></tr><tr id="112" style="display: none;" colspan="3"><td colspan="3"><h2>torrents with a zero-length name</h2><h4>../test/test_torrent_info.cpp:467</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(113)">../test/test_torrent_info.cpp:468</a></td><td>torrent with a non-dictionary info-section</td></tr><tr id="113" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with a non-dictionary info-section</h2><h4>../test/test_torrent_info.cpp:468</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(114)">../test/test_torrent_info.cpp:469</a></td><td>torrents with DHT nodes</td></tr><tr id="114" style="display: none;" colspan="3"><td colspan="3"><h2>torrents with DHT nodes</h2><h4>../test/test_torrent_info.cpp:469</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(115)">../test/test_torrent_info.cpp:470</a></td><td>torrent with url-list as a single string</td></tr><tr id="115" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with url-list as a single string</h2><h4>../test/test_torrent_info.cpp:470</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(116)">../test/test_torrent_info.cpp:471</a></td><td>torrent with http seed as a single string</td></tr><tr id="116" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with http seed as a single string</h2><h4>../test/test_torrent_info.cpp:471</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(117)">../test/test_torrent_info.cpp:472</a></td><td>torrent with a comment</td></tr><tr id="117" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with a comment</h2><h4>../test/test_torrent_info.cpp:472</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(118)">../test/test_torrent_info.cpp:473</a></td><td>torrent with an SSL cert</td></tr><tr id="118" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with an SSL cert</h2><h4>../test/test_torrent_info.cpp:473</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(119)">../test/test_torrent_info.cpp:474</a></td><td>torrent with attributes (executable and hidden)</td></tr><tr id="119" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with attributes (executable and hidden)</h2><h4>../test/test_torrent_info.cpp:474</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(120)">../test/test_torrent_info.cpp:475</a></td><td>torrent_info constructor that takes an invalid bencoded buffer</td></tr><tr id="120" style="display: none;" colspan="3"><td colspan="3"><h2>torrent_info constructor that takes an invalid bencoded buffer</h2><h4>../test/test_torrent_info.cpp:475</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(121)">../test/test_torrent_info.cpp:476</a></td><td>verify_encoding with a string that triggers character replacement</td></tr><tr id="121" style="display: none;" colspan="3"><td colspan="3"><h2>verify_encoding with a string that triggers character replacement</h2><h4>../test/test_torrent_info.cpp:476</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{ "v2_non_multiple_piece_layer.torrent", errors::torrent_invalid_piece_layer},
│ │ │ │ +sure it's in different order at least once)</h2><h4>../test/test_torrent_info.cpp:464</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(110)">../test/test_torrent_info.cpp:467</a></td><td>torrents with a zero-length name</td></tr><tr id="110" style="display: none;" colspan="3"><td colspan="3"><h2>torrents with a zero-length name</h2><h4>../test/test_torrent_info.cpp:467</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(111)">../test/test_torrent_info.cpp:468</a></td><td>torrent with a non-dictionary info-section</td></tr><tr id="111" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with a non-dictionary info-section</h2><h4>../test/test_torrent_info.cpp:468</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(112)">../test/test_torrent_info.cpp:469</a></td><td>torrents with DHT nodes</td></tr><tr id="112" style="display: none;" colspan="3"><td colspan="3"><h2>torrents with DHT nodes</h2><h4>../test/test_torrent_info.cpp:469</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(113)">../test/test_torrent_info.cpp:470</a></td><td>torrent with url-list as a single string</td></tr><tr id="113" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with url-list as a single string</h2><h4>../test/test_torrent_info.cpp:470</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(114)">../test/test_torrent_info.cpp:471</a></td><td>torrent with http seed as a single string</td></tr><tr id="114" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with http seed as a single string</h2><h4>../test/test_torrent_info.cpp:471</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(115)">../test/test_torrent_info.cpp:472</a></td><td>torrent with a comment</td></tr><tr id="115" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with a comment</h2><h4>../test/test_torrent_info.cpp:472</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(116)">../test/test_torrent_info.cpp:473</a></td><td>torrent with an SSL cert</td></tr><tr id="116" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with an SSL cert</h2><h4>../test/test_torrent_info.cpp:473</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(117)">../test/test_torrent_info.cpp:474</a></td><td>torrent with attributes (executable and hidden)</td></tr><tr id="117" style="display: none;" colspan="3"><td colspan="3"><h2>torrent with attributes (executable and hidden)</h2><h4>../test/test_torrent_info.cpp:474</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(118)">../test/test_torrent_info.cpp:475</a></td><td>torrent_info constructor that takes an invalid bencoded buffer</td></tr><tr id="118" style="display: none;" colspan="3"><td colspan="3"><h2>torrent_info constructor that takes an invalid bencoded buffer</h2><h4>../test/test_torrent_info.cpp:475</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(119)">../test/test_torrent_info.cpp:476</a></td><td>verify_encoding with a string that triggers character replacement</td></tr><tr id="119" style="display: none;" colspan="3"><td colspan="3"><h2>verify_encoding with a string that triggers character replacement</h2><h4>../test/test_torrent_info.cpp:476</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{ "v2_non_multiple_piece_layer.torrent", errors::torrent_invalid_piece_layer},
│ │ │ │  	{ "v2_piece_layer_invalid_file_hash.torrent", errors::torrent_invalid_piece_layer},
│ │ │ │  	{ "v2_invalid_piece_layer.torrent", errors::torrent_invalid_piece_layer},
│ │ │ │  	{ "v2_invalid_piece_layer_root.torrent", errors::torrent_invalid_piece_layer},
│ │ │ │  	{ "v2_unknown_piece_layer_entry.torrent", errors::torrent_invalid_piece_layer},
│ │ │ │  	{ "v2_invalid_piece_layer_size.torrent", errors::torrent_invalid_piece_layer},
│ │ │ │  	{ "v2_bad_file_alignment.torrent", errors::torrent_inconsistent_files},
│ │ │ │  	{ "v2_unordered_files.torrent", errors::invalid_bencoding},
│ │ │ │ @@ -4979,373 +4927,145 @@
│ │ │ │  	entry::list_type l;
│ │ │ │  	l.push_back(entry("http://foo.com/bar1"));
│ │ │ │  	l.push_back(entry("http://foo.com/bar1"));
│ │ │ │  	l.push_back(entry("http://foo.com/bar2"));
│ │ │ │  	entry const e(l);
│ │ │ │  	entry torrent;
│ │ │ │  	torrent["url-list"] = e;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(122)">../test/test_transfer.cpp:173</a></td><td>these settings_pack tests belong in their own test</td></tr><tr id="122" style="display: none;" colspan="3"><td colspan="3"><h2>these settings_pack tests belong in their own test</h2><h4>../test/test_transfer.cpp:173</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	// to the time it will take to complete the test
│ │ │ │ -	pack.set_int(settings_pack::min_reconnect_time, 0);
│ │ │ │ -	pack.set_int(settings_pack::stop_tracker_timeout, 1);
│ │ │ │ -	pack.set_bool(settings_pack::announce_to_all_trackers, true);
│ │ │ │ -	pack.set_bool(settings_pack::announce_to_all_tiers, true);
│ │ │ │ -
│ │ │ │ -	// make sure we announce to both http and udp trackers
│ │ │ │ -	pack.set_bool(settings_pack::prefer_udp_trackers, false);
│ │ │ │ -	pack.set_bool(settings_pack::enable_outgoing_utp, false);
│ │ │ │ -	pack.set_bool(settings_pack::enable_incoming_utp, false);
│ │ │ │ -	pack.set_bool(settings_pack::enable_lsd, false);
│ │ │ │ -	pack.set_bool(settings_pack::enable_natpmp, false);
│ │ │ │ -	pack.set_bool(settings_pack::enable_upnp, false);
│ │ │ │ -	pack.set_bool(settings_pack::enable_dht, false);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(120)">../test/test_ssl.cpp:407</a></td><td>test using a signed certificate with the wrong info-hash in DN</td></tr><tr id="120" style="display: none;" colspan="3"><td colspan="3"><h2>test using a signed certificate with the wrong info-hash in DN</h2><h4>../test/test_ssl.cpp:407</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	// in verifying peers
│ │ │ │ +	ctx.set_verify_mode(context::verify_none, ec);
│ │ │ │ +	if (ec)
│ │ │ │ +	{
│ │ │ │ +		std::printf("Failed to set SSL verify mode: %s\n"
│ │ │ │ +			, ec.message().c_str());
│ │ │ │ +		TEST_CHECK(!ec);
│ │ │ │ +		return false;
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -	pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);
│ │ │ │ -	pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_disabled);
│ │ │ │ +	std::string certificate = combine_path("..", combine_path("ssl", "peer_certificate.pem"));
│ │ │ │ +	std::string private_key = combine_path("..", combine_path("ssl", "peer_private_key.pem"));
│ │ │ │ +	std::string dh_params = combine_path("..", combine_path("ssl", "dhparams.pem"));
│ │ │ │  
│ │ │ │ -	pack.set_bool(settings_pack::allow_multiple_connections_per_ip, false);
│ │ │ │ +	if (flags &amp; invalid_certificate)
│ │ │ │ +	{
│ │ │ │ +		certificate = combine_path("..", combine_path("ssl", "invalid_peer_certificate.pem"));
│ │ │ │ +		private_key = combine_path("..", combine_path("ssl", "invalid_peer_private_key.pem"));
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">	pack.set_int(settings_pack::unchoke_slots_limit, 0);
│ │ │ │ -</div>	ses1.apply_settings(pack);
│ │ │ │ -	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == 0);
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>	if (flags &amp; (valid_certificate | invalid_certificate))
│ │ │ │ +	{
│ │ │ │ +		std::printf("set_password_callback\n");
│ │ │ │ +		ctx.set_password_callback(
│ │ │ │ +			[](std::size_t, context::password_purpose) { return "test"; }
│ │ │ │ +			, ec);
│ │ │ │ +		if (ec)
│ │ │ │ +		{
│ │ │ │ +			std::printf("Failed to set certificate passphrase: %s\n"
│ │ │ │ +				, ec.message().c_str());
│ │ │ │ +			TEST_CHECK(!ec);
│ │ │ │ +			return false;
│ │ │ │ +		}
│ │ │ │ +		std::printf("use_certificate_file \"%s\"\n", certificate.c_str());
│ │ │ │ +		ctx.use_certificate_file(certificate, context::pem, ec);
│ │ │ │ +		if (ec)
│ │ │ │ +		{
│ │ │ │ +			std::printf("Failed to set certificate file: %s\n"
│ │ │ │ +				, ec.message().c_str());
│ │ │ │ +			TEST_CHECK(!ec);
│ │ │ │ +			return false;
│ │ │ │ +		}
│ │ │ │ +		std::printf("use_private_key_file \"%s\"\n", private_key.c_str());
│ │ │ │ +		ctx.use_private_key_file(private_key, context::pem, ec);
│ │ │ │ +		if (ec)
│ │ │ │ +		{
│ │ │ │ +			std::printf("Failed to set private key: %s\n"
│ │ │ │ +				, ec.message().c_str());
│ │ │ │ +			TEST_CHECK(!ec);
│ │ │ │ +			return false;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(121)">../test/test_ssl.cpp:509</a></td><td>also test using a hash that refers to a valid torrent but that differs from the SNI hash</td></tr><tr id="121" style="display: none;" colspan="3"><td colspan="3"><h2>also test using a hash that refers to a valid torrent
│ │ │ │ +but that differs from the SNI hash</h2><h4>../test/test_ssl.cpp:509</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	print_alerts(ses1, "ses1", true, true, &amp;on_alert);
│ │ │ │ +	if (ec)
│ │ │ │ +	{
│ │ │ │ +		std::printf("Failed SSL handshake: %s\n"
│ │ │ │ +			, ec.message().c_str());
│ │ │ │ +		return false;
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -	pack.set_int(settings_pack::unchoke_slots_limit, -1);
│ │ │ │ -	ses1.apply_settings(pack);
│ │ │ │ -	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == -1);
│ │ │ │ +	char handshake[] = "\x13" "BitTorrent protocol\0\0\0\0\0\0\0\x04"
│ │ │ │ +		"                    " // space for info-hash
│ │ │ │ +		"aaaaaaaaaaaaaaaaaaaa" // peer-id
│ │ │ │ +		"\0\0\0\x01\x02"; // interested
│ │ │ │  
│ │ │ │ -	pack.set_int(settings_pack::unchoke_slots_limit, 8);
│ │ │ │ -	ses1.apply_settings(pack);
│ │ │ │ -	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == 8);
│ │ │ │ +	// fill in the info-hash
│ │ │ │ +	if (flags &amp; valid_bittorrent_hash)
│ │ │ │ +	{
│ │ │ │ +		std::memcpy(handshake + 28, &amp;t-&gt;info_hashes().v1[0], 20);
│ │ │ │ +	}
│ │ │ │ +	else
│ │ │ │ +	{
│ │ │ │ +<div style="background: #ffff00" width="100%">		std::generate(handshake + 28, handshake + 48, &amp;rand);
│ │ │ │ +</div>	}
│ │ │ │  
│ │ │ │ -	ses2.apply_settings(pack);
│ │ │ │ +	// fill in the peer-id
│ │ │ │ +	std::generate(handshake + 48, handshake + 68, &amp;rand);
│ │ │ │  
│ │ │ │ -	torrent_handle tor1;
│ │ │ │ -	torrent_handle tor2;
│ │ │ │ +	std::printf("bittorrent handshake\n");
│ │ │ │ +	boost::asio::write(ssl_sock, boost::asio::buffer(handshake, (sizeof(handshake) - 1)), ec);
│ │ │ │ +	print_alerts(ses1, "ses1", true, true, &amp;on_alert);
│ │ │ │ +	if (ec)
│ │ │ │ +	{
│ │ │ │ +		std::printf("failed to write bittorrent handshake: %s\n"
│ │ │ │ +			, ec.message().c_str());
│ │ │ │ +		return false;
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -	create_directory("tmp1_transfer", ec);
│ │ │ │ -	std::ofstream file("tmp1_transfer/temporary");
│ │ │ │ -	std::shared_ptr&lt;torrent_info&gt; t = ::create_torrent(&amp;file, "temporary", 32 * 1024, 13, false);
│ │ │ │ -	file.close();
│ │ │ │ +	char buf[68];
│ │ │ │ +	std::printf("read bittorrent handshake\n");
│ │ │ │ +	boost::asio::read(ssl_sock, boost::asio::buffer(buf, sizeof(buf)), ec);
│ │ │ │ +	print_alerts(ses1, "ses1", true, true, &amp;on_alert);
│ │ │ │ +	if (ec)
│ │ │ │ +	{
│ │ │ │ +		std::printf("failed to read bittorrent handshake: %s\n"
│ │ │ │ +			, ec.message().c_str());
│ │ │ │ +		return false;
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -	TEST_CHECK(exists(combine_path("tmp1_transfer", "temporary")));
│ │ │ │ +	if (memcmp(buf, "\x13" "BitTorrent protocol", 20) != 0)
│ │ │ │ +	{
│ │ │ │ +		std::printf("invalid bittorrent handshake\n");
│ │ │ │ +		return false;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(122)">../test/test_fast_extension.cpp:1135</a></td><td>test sending invalid requests (out of bound piece index, offsets and sizes)</td></tr><tr id="122" style="display: none;" colspan="3"><td colspan="3"><h2>test sending invalid requests (out of bound piece index, offsets and
│ │ │ │ +sizes)</h2><h4>../test/test_fast_extension.cpp:1135</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(123)">../test/test_peer_list.cpp:1241</a></td><td>test erasing peers</td></tr><tr id="123" style="display: none;" colspan="3"><td colspan="3"><h2>test erasing peers</h2><h4>../test/test_peer_list.cpp:1241</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(124)">../test/test_peer_list.cpp:1242</a></td><td>test update_peer_port with allow_multiple_connections_per_ip and without</td></tr><tr id="124" style="display: none;" colspan="3"><td colspan="3"><h2>test update_peer_port with allow_multiple_connections_per_ip and without</h2><h4>../test/test_peer_list.cpp:1242</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(125)">../test/test_peer_list.cpp:1243</a></td><td>test add i2p peers</td></tr><tr id="125" style="display: none;" colspan="3"><td colspan="3"><h2>test add i2p peers</h2><h4>../test/test_peer_list.cpp:1243</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(126)">../test/test_peer_list.cpp:1244</a></td><td>test allow_i2p_mixed</td></tr><tr id="126" style="display: none;" colspan="3"><td colspan="3"><h2>test allow_i2p_mixed</h2><h4>../test/test_peer_list.cpp:1244</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(127)">../test/test_peer_list.cpp:1245</a></td><td>test insert_peer failing with all error conditions</td></tr><tr id="127" style="display: none;" colspan="3"><td colspan="3"><h2>test insert_peer failing with all error conditions</h2><h4>../test/test_peer_list.cpp:1245</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(128)">../test/test_peer_list.cpp:1246</a></td><td>test IPv6</td></tr><tr id="128" style="display: none;" colspan="3"><td colspan="3"><h2>test IPv6</h2><h4>../test/test_peer_list.cpp:1246</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(129)">../test/test_peer_list.cpp:1247</a></td><td>test connect_to_peer() failing</td></tr><tr id="129" style="display: none;" colspan="3"><td colspan="3"><h2>test connect_to_peer() failing</h2><h4>../test/test_peer_list.cpp:1247</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(130)">../test/test_peer_list.cpp:1248</a></td><td>test connection_closed</td></tr><tr id="130" style="display: none;" colspan="3"><td colspan="3"><h2>test connection_closed</h2><h4>../test/test_peer_list.cpp:1248</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(131)">../test/test_peer_list.cpp:1249</a></td><td>connect candidates recalculation when incrementing failcount</td></tr><tr id="131" style="display: none;" colspan="3"><td colspan="3"><h2>connect candidates recalculation when incrementing failcount</h2><h4>../test/test_peer_list.cpp:1249</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(132)">../test/test_resume.cpp:582</a></td><td>test what happens when loading a resume file with both piece priorities and file priorities (file prio should take precedence)</td></tr><tr id="132" style="display: none;" colspan="3"><td colspan="3"><h2>test what happens when loading a resume file with both piece priorities
│ │ │ │ +and file priorities (file prio should take precedence)</h2><h4>../test/test_resume.cpp:582</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		{
│ │ │ │ +			TEST_EQUAL(pieces[i], true);
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -	add_torrent_params params;
│ │ │ │ -	params.storage_mode = storage_mode;
│ │ │ │ -	params.flags &amp;= ~torrent_flags::paused;
│ │ │ │ -	params.flags &amp;= ~torrent_flags::auto_managed;
│ │ │ │ +} // anonymous namespace
│ │ │ │  
│ │ │ │ -	wait_for_listen(ses1, "ses1");
│ │ │ │ -	wait_for_listen(ses2, "ses2");
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(123)">../test/test_timestamp_history.cpp:54</a></td><td>test the case where we have > 120 samples (and have the base delay actually be updated)</td></tr><tr id="123" style="display: none;" colspan="3"><td colspan="3"><h2>test the case where we have > 120 samples (and have the base delay actually be updated)</h2><h4>../test/test_timestamp_history.cpp:54</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(124)">../test/test_timestamp_history.cpp:55</a></td><td>test the case where a sample is lower than the history entry but not lower than the base</td></tr><tr id="124" style="display: none;" colspan="3"><td colspan="3"><h2>test the case where a sample is lower than the history entry but not lower than the base</h2><h4>../test/test_timestamp_history.cpp:55</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include "libtorrent/aux_/timestamp_history.hpp"
│ │ │ │ +TORRENT_TEST(piece_slots_seed)
│ │ │ │ +{
│ │ │ │ +	test_piece_slots_seed(settings());
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -TORRENT_TEST(timestamp_history)
│ │ │ │ +TORRENT_TEST(piece_slots_seed_suggest_cache)
│ │ │ │  {
│ │ │ │ -	using namespace lt;
│ │ │ │ +	settings_pack sett = settings();
│ │ │ │ +	sett.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);
│ │ │ │ +	test_piece_slots_seed(sett);
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -	aux::timestamp_history h;
│ │ │ │ -	TEST_EQUAL(h.add_sample(0x32, false), 0);
│ │ │ │ -	TEST_EQUAL(h.base(), 0x32);
│ │ │ │ -	TEST_EQUAL(h.add_sample(0x33, false), 0x1);
│ │ │ │ -	TEST_EQUAL(h.base(), 0x32);
│ │ │ │ -	TEST_EQUAL(h.add_sample(0x3433, false), 0x3401);
│ │ │ │ -	TEST_EQUAL(h.base(), 0x32);
│ │ │ │ -	TEST_EQUAL(h.add_sample(0x30, false), 0);
│ │ │ │ -	TEST_EQUAL(h.base(), 0x30);
│ │ │ │ -
│ │ │ │ -	// test that wrapping of the timestamp is properly handled
│ │ │ │ -	h.add_sample(0xfffffff3, false);
│ │ │ │ -	TEST_EQUAL(h.base(), 0xfffffff3);
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">}
│ │ │ │ -</div>
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(125)">../test/test_tracker.cpp:60</a></td><td>test scrape requests</td></tr><tr id="125" style="display: none;" colspan="3"><td colspan="3"><h2>test scrape requests</h2><h4>../test/test_tracker.cpp:60</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(126)">../test/test_tracker.cpp:61</a></td><td>test parse peers6</td></tr><tr id="126" style="display: none;" colspan="3"><td colspan="3"><h2>test parse peers6</h2><h4>../test/test_tracker.cpp:61</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(127)">../test/test_tracker.cpp:62</a></td><td>test parse tracker-id</td></tr><tr id="127" style="display: none;" colspan="3"><td colspan="3"><h2>test parse tracker-id</h2><h4>../test/test_tracker.cpp:62</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(128)">../test/test_tracker.cpp:63</a></td><td>test parse failure-reason</td></tr><tr id="128" style="display: none;" colspan="3"><td colspan="3"><h2>test parse failure-reason</h2><h4>../test/test_tracker.cpp:63</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(129)">../test/test_tracker.cpp:64</a></td><td>test all failure paths, including invalid bencoding not a dictionary no files entry in scrape response no info-hash entry in scrape response malformed peers in peer list of dictionaries uneven number of bytes in peers and peers6 string responses</td></tr><tr id="129" style="display: none;" colspan="3"><td colspan="3"><h2>test all failure paths, including
│ │ │ │ -invalid bencoding
│ │ │ │ -not a dictionary
│ │ │ │ -no files entry in scrape response
│ │ │ │ -no info-hash entry in scrape response
│ │ │ │ -malformed peers in peer list of dictionaries
│ │ │ │ -uneven number of bytes in peers and peers6 string responses</h2><h4>../test/test_tracker.cpp:64</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include "test_utils.hpp"
│ │ │ │ -#include "udp_tracker.hpp"
│ │ │ │ -#include "settings.hpp"
│ │ │ │ -#include "test_utils.hpp"
│ │ │ │ -#include "libtorrent/alert.hpp"
│ │ │ │ -#include "libtorrent/peer_info.hpp" // for peer_list_entry
│ │ │ │ -#include "libtorrent/alert_types.hpp"
│ │ │ │ -#include "libtorrent/session.hpp"
│ │ │ │ -#include "libtorrent/session_params.hpp"
│ │ │ │ -#include "libtorrent/error_code.hpp"
│ │ │ │ -#include "libtorrent/tracker_manager.hpp"
│ │ │ │ -#include "libtorrent/http_tracker_connection.hpp" // for parse_tracker_response
│ │ │ │ -#include "libtorrent/torrent_info.hpp"
│ │ │ │ -#include "libtorrent/announce_entry.hpp"
│ │ │ │ -#include "libtorrent/torrent.hpp"
│ │ │ │ -#include "libtorrent/aux_/path.hpp"
│ │ │ │ -#include "libtorrent/socket_io.hpp"
│ │ │ │ -
│ │ │ │ -using namespace lt;
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>TORRENT_TEST(parse_hostname_peers)
│ │ │ │ -{
│ │ │ │ -	char const response[] = "d5:peersld7:peer id20:aaaaaaaaaaaaaaaaaaaa"
│ │ │ │ -		"2:ip13:test_hostname4:porti1000eed"
│ │ │ │ -		"7:peer id20:bbbbabaababababababa2:ip12:another_host4:porti1001eeee";
│ │ │ │ -	error_code ec;
│ │ │ │ -	tracker_response resp = parse_tracker_response(response
│ │ │ │ -		, ec, {}, sha1_hash());
│ │ │ │ -
│ │ │ │ -	TEST_EQUAL(ec, error_code());
│ │ │ │ -	TEST_EQUAL(resp.peers.size(), 2);
│ │ │ │ -	if (resp.peers.size() == 2)
│ │ │ │ -	{
│ │ │ │ -		peer_entry const&amp; e0 = resp.peers[0];
│ │ │ │ -		peer_entry const&amp; e1 = resp.peers[1];
│ │ │ │ -		TEST_EQUAL(e0.hostname, "test_hostname");
│ │ │ │ -		TEST_EQUAL(e0.port, 1000);
│ │ │ │ -		TEST_EQUAL(e0.pid, peer_id("aaaaaaaaaaaaaaaaaaaa"));
│ │ │ │ -
│ │ │ │ -		TEST_EQUAL(e1.hostname, "another_host");
│ │ │ │ -		TEST_EQUAL(e1.port, 1001);
│ │ │ │ -		TEST_EQUAL(e1.pid, peer_id("bbbbabaababababababa"));
│ │ │ │ -	}
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -TORRENT_TEST(parse_peers4)
│ │ │ │ -{
│ │ │ │ -	char const response[] = "d5:peers12:\x01\x02\x03\x04\x30\x10"
│ │ │ │ -		"\x09\x08\x07\x06\x20\x10" "e";
│ │ │ │ -	error_code ec;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(130)">../test/test_peer_list.cpp:1241</a></td><td>test erasing peers</td></tr><tr id="130" style="display: none;" colspan="3"><td colspan="3"><h2>test erasing peers</h2><h4>../test/test_peer_list.cpp:1241</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(131)">../test/test_peer_list.cpp:1242</a></td><td>test update_peer_port with allow_multiple_connections_per_ip and without</td></tr><tr id="131" style="display: none;" colspan="3"><td colspan="3"><h2>test update_peer_port with allow_multiple_connections_per_ip and without</h2><h4>../test/test_peer_list.cpp:1242</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(132)">../test/test_peer_list.cpp:1243</a></td><td>test add i2p peers</td></tr><tr id="132" style="display: none;" colspan="3"><td colspan="3"><h2>test add i2p peers</h2><h4>../test/test_peer_list.cpp:1243</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(133)">../test/test_peer_list.cpp:1244</a></td><td>test allow_i2p_mixed</td></tr><tr id="133" style="display: none;" colspan="3"><td colspan="3"><h2>test allow_i2p_mixed</h2><h4>../test/test_peer_list.cpp:1244</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(134)">../test/test_peer_list.cpp:1245</a></td><td>test insert_peer failing with all error conditions</td></tr><tr id="134" style="display: none;" colspan="3"><td colspan="3"><h2>test insert_peer failing with all error conditions</h2><h4>../test/test_peer_list.cpp:1245</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(135)">../test/test_peer_list.cpp:1246</a></td><td>test IPv6</td></tr><tr id="135" style="display: none;" colspan="3"><td colspan="3"><h2>test IPv6</h2><h4>../test/test_peer_list.cpp:1246</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(136)">../test/test_peer_list.cpp:1247</a></td><td>test connect_to_peer() failing</td></tr><tr id="136" style="display: none;" colspan="3"><td colspan="3"><h2>test connect_to_peer() failing</h2><h4>../test/test_peer_list.cpp:1247</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(137)">../test/test_peer_list.cpp:1248</a></td><td>test connection_closed</td></tr><tr id="137" style="display: none;" colspan="3"><td colspan="3"><h2>test connection_closed</h2><h4>../test/test_peer_list.cpp:1248</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(138)">../test/test_peer_list.cpp:1249</a></td><td>connect candidates recalculation when incrementing failcount</td></tr><tr id="138" style="display: none;" colspan="3"><td colspan="3"><h2>connect candidates recalculation when incrementing failcount</h2><h4>../test/test_peer_list.cpp:1249</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(139)">../test/test_dht.cpp:472</a></td><td>check to make sure the "best" items are stored</td></tr><tr id="139" style="display: none;" colspan="3"><td colspan="3"><h2>check to make sure the "best" items are stored</h2><h4>../test/test_dht.cpp:472</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			, msg_args().target(items[j].target));
│ │ │ │ -
│ │ │ │ -		key_desc_t const desc[] =
│ │ │ │ -		{
│ │ │ │ -			{ "r", bdecode_node::dict_t, 0, key_desc_t::parse_children },
│ │ │ │ -				{ "v", bdecode_node::dict_t, 0, 0},
│ │ │ │ -				{ "id", bdecode_node::string_t, 20, key_desc_t::last_child},
│ │ │ │ -			{ "y", bdecode_node::string_t, 1, 0},
│ │ │ │ -		};
│ │ │ │ -
│ │ │ │ -		bdecode_node parsed[4];
│ │ │ │ -		char error_string[200];
│ │ │ │ -
│ │ │ │ -		int ret = verify_message(response, desc, parsed, error_string);
│ │ │ │ -		if (ret)
│ │ │ │ -		{
│ │ │ │ -			items_num.insert(items_num.begin(), j);
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	TEST_EQUAL(items_num.size(), 4);
│ │ │ │ -</div>}
│ │ │ │ -
│ │ │ │ -int sum_distance_exp(int s, node_entry const&amp; e, node_id const&amp; ref)
│ │ │ │ -{
│ │ │ │ -	return s + distance_exp(e.id, ref);
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -std::vector&lt;tcp::endpoint&gt; g_got_peers;
│ │ │ │ -
│ │ │ │ -void get_peers_cb(std::vector&lt;tcp::endpoint&gt; const&amp; peers)
│ │ │ │ -{
│ │ │ │ -	g_got_peers.insert(g_got_peers.end(), peers.begin(), peers.end());
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -std::vector&lt;dht::item&gt; g_got_items;
│ │ │ │ -dht::item g_put_item;
│ │ │ │ -int g_put_count;
│ │ │ │ -
│ │ │ │ -void get_mutable_item_cb(dht::item const&amp; i, bool a)
│ │ │ │ -{
│ │ │ │ -	if (!a) return;
│ │ │ │ -	if (!i.empty())
│ │ │ │ -		g_got_items.push_back(i);
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -void put_mutable_item_data_cb(dht::item&amp; i)
│ │ │ │ -{
│ │ │ │ -	if (!i.empty())
│ │ │ │ -		g_got_items.push_back(i);
│ │ │ │ -
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(140)">../test/test_dht.cpp:3223</a></td><td>this won't work because the second node isn't pinged so it wont be added to the routing table</td></tr><tr id="140" style="display: none;" colspan="3"><td colspan="3"><h2>this won't work because the second node isn't pinged so it wont
│ │ │ │ -be added to the routing table</h2><h4>../test/test_dht.cpp:3223</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	bool ret = verify_message(request, get_item_desc_ro, parsed, error_string);
│ │ │ │ -
│ │ │ │ -	TEST_CHECK(ret);
│ │ │ │ -	TEST_EQUAL(parsed[3].int_value(), 1);
│ │ │ │ -
│ │ │ │ -	// should have one node now, which is 4.4.4.4:1234
│ │ │ │ -	TEST_EQUAL(std::get&lt;0&gt;(node.size()), 1);
│ │ │ │ -	// and no replacement nodes
│ │ │ │ -	TEST_EQUAL(std::get&lt;1&gt;(node.size()), 0);
│ │ │ │ -
│ │ │ │ -	// now, disable read_only, try again.
│ │ │ │ -	g_sent_packets.clear();
│ │ │ │ -	sett.set_bool(settings_pack::dht_read_only, false);
│ │ │ │ -
│ │ │ │ -	send_dht_request(node, "get", source, &amp;response);
│ │ │ │ -	// sender should be added to replacement bucket
│ │ │ │ -	TEST_EQUAL(std::get&lt;1&gt;(node.size()), 1);
│ │ │ │ -
│ │ │ │ -	g_sent_packets.clear();
│ │ │ │ -#if 0
│ │ │ │ -<div style="background: #ffff00" width="100%">	target = generate_next();
│ │ │ │ -</div>	node.get_item(target, get_immutable_item_cb);
│ │ │ │ -
│ │ │ │ -	// since we have 2 nodes, we should have two packets.
│ │ │ │ -	TEST_EQUAL(g_sent_packets.size(), 2);
│ │ │ │ -
│ │ │ │ -	// both of them shouldn't have a 'ro' key.
│ │ │ │ -	node_from_entry(g_sent_packets.front().second, request);
│ │ │ │ -	ret = verify_message(request, get_item_desc_ro, parsed, error_string);
│ │ │ │ -
│ │ │ │ -	TEST_CHECK(ret);
│ │ │ │ -	TEST_CHECK(!parsed[3]);
│ │ │ │ -
│ │ │ │ -	node_from_entry(g_sent_packets.back().second, request);
│ │ │ │ -	ret = verify_message(request, get_item_desc_ro, parsed, error_string);
│ │ │ │ -
│ │ │ │ -	TEST_CHECK(ret);
│ │ │ │ -	TEST_CHECK(!parsed[3]);
│ │ │ │ -#endif
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -// these tests rely on logging being enabled
│ │ │ │ -
│ │ │ │ -TORRENT_TEST(invalid_error_msg)
│ │ │ │ -{
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(141)">../test/test_dht.cpp:4081</a></td><td>test obfuscated_get_peers</td></tr><tr id="141" style="display: none;" colspan="3"><td colspan="3"><h2>test obfuscated_get_peers</h2><h4>../test/test_dht.cpp:4081</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		TEST_CHECK(sm.has_quota());
│ │ │ │ -	});
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -TORRENT_TEST(rate_limit_accrue_limit)
│ │ │ │ -{
│ │ │ │ -	aux::session_settings sett;
│ │ │ │ -	sett.set_int(settings_pack::dht_upload_rate_limit, std::numeric_limits&lt;int&gt;::max());
│ │ │ │ -
│ │ │ │ -	test_rate_limit(sett, [](lt::dht::socket_manager&amp; sm) {
│ │ │ │ -		TEST_CHECK(sm.has_quota());
│ │ │ │ -		for (int i = 0; i &lt; 10; ++i)
│ │ │ │ -		{
│ │ │ │ -			std::this_thread::sleep_for(milliseconds(500));
│ │ │ │ -			TEST_CHECK(sm.has_quota());
│ │ │ │ -		}
│ │ │ │ -	});
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>#else
│ │ │ │ -TORRENT_TEST(dht)
│ │ │ │ -{
│ │ │ │ -	// dummy dht test
│ │ │ │ -	TEST_CHECK(true);
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -#endif
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(142)">../test/test_fast_extension.cpp:1135</a></td><td>test sending invalid requests (out of bound piece index, offsets and sizes)</td></tr><tr id="142" style="display: none;" colspan="3"><td colspan="3"><h2>test sending invalid requests (out of bound piece index, offsets and
│ │ │ │ -sizes)</h2><h4>../test/test_fast_extension.cpp:1135</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(143)">../test/test_resolve_links.cpp:95</a></td><td>test files with different piece size (negative test)</td></tr><tr id="143" style="display: none;" colspan="3"><td colspan="3"><h2>test files with different piece size (negative test)</h2><h4>../test/test_resolve_links.cpp:95</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{ "test2", "test1_pad_files", 0},
│ │ │ │ -	{ "test3", "test1_pad_files", 0},
│ │ │ │ -	{ "test2", "test1_single", 0},
│ │ │ │ -
│ │ │ │ -	// these are all padded. The first small file will accidentally also
│ │ │ │ -	// match, even though it's not tail padded, the following file is identical
│ │ │ │ -	{ "test2_pad_files", "test1_pad_files", 2},
│ │ │ │ -	{ "test3_pad_files", "test1_pad_files", 2},
│ │ │ │ -	{ "test3_pad_files", "test2_pad_files", 2},
│ │ │ │ -	{ "test1_pad_files", "test2_pad_files", 2},
│ │ │ │ -	{ "test1_pad_files", "test3_pad_files", 2},
│ │ │ │ -	{ "test2_pad_files", "test3_pad_files", 2},
│ │ │ │ -
│ │ │ │ -	// one might expect this to work, but since the tail of the single file
│ │ │ │ -	// torrent is not padded, the last piece hash won't match
│ │ │ │ -	{ "test1_pad_files", "test1_single", 0},
│ │ │ │ -
│ │ │ │ -	// if it's padded on the other hand, it will work
│ │ │ │ -	{ "test1_pad_files", "test1_single_padded", 1},
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">};
│ │ │ │ -</div>
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(144)">../test/test_resolve_links.cpp:98</a></td><td>it would be nice to test resolving of more than just 2 files as well. like 3 single file torrents merged into one, resolving all 3 files.</td></tr><tr id="144" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to test resolving of more than just 2 files as well.
│ │ │ │ -like 3 single file torrents merged into one, resolving all 3 files.</h2><h4>../test/test_resolve_links.cpp:98</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{ "test2", "test1_single", 0},
│ │ │ │ -
│ │ │ │ -	// these are all padded. The first small file will accidentally also
│ │ │ │ -	// match, even though it's not tail padded, the following file is identical
│ │ │ │ -	{ "test2_pad_files", "test1_pad_files", 2},
│ │ │ │ -	{ "test3_pad_files", "test1_pad_files", 2},
│ │ │ │ -	{ "test3_pad_files", "test2_pad_files", 2},
│ │ │ │ -	{ "test1_pad_files", "test2_pad_files", 2},
│ │ │ │ -	{ "test1_pad_files", "test3_pad_files", 2},
│ │ │ │ -	{ "test2_pad_files", "test3_pad_files", 2},
│ │ │ │ -
│ │ │ │ -	// one might expect this to work, but since the tail of the single file
│ │ │ │ -	// torrent is not padded, the last piece hash won't match
│ │ │ │ -	{ "test1_pad_files", "test1_single", 0},
│ │ │ │ -
│ │ │ │ -	// if it's padded on the other hand, it will work
│ │ │ │ -	{ "test1_pad_files", "test1_single_padded", 1},
│ │ │ │ -
│ │ │ │ -};
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>TORRENT_TEST(resolve_links)
│ │ │ │ -{
│ │ │ │ -	std::string path = combine_path(parent_path(current_working_directory())
│ │ │ │ -		, "mutable_test_torrents");
│ │ │ │ -
│ │ │ │ -	for (int i = 0; i &lt; int(sizeof(test_torrents)/sizeof(test_torrents[0])); ++i)
│ │ │ │ -	{
│ │ │ │ -		test_torrent_t const&amp; e = test_torrents[i];
│ │ │ │ -
│ │ │ │ -		std::string p = combine_path(path, e.filename1) + ".torrent";
│ │ │ │ -		std::printf("loading %s\n", p.c_str());
│ │ │ │ -		std::shared_ptr&lt;torrent_info&gt; ti1 = std::make_shared&lt;torrent_info&gt;(p);
│ │ │ │ -
│ │ │ │ -		p = combine_path(path, e.filename2) + ".torrent";
│ │ │ │ -		std::printf("loading %s\n", p.c_str());
│ │ │ │ -		std::shared_ptr&lt;torrent_info&gt; ti2 = std::make_shared&lt;torrent_info&gt;(p);
│ │ │ │ -
│ │ │ │ -		std::printf("resolving\n");
│ │ │ │ -		resolve_links l(ti1);
│ │ │ │ -		l.match(ti2, ".");
│ │ │ │ -
│ │ │ │ -		aux::vector&lt;resolve_links::link_t, file_index_t&gt; const&amp; links = l.get_links();
│ │ │ │ -
│ │ │ │ -		auto const num_matches = std::size_t(std::count_if(links.begin(), links.end()
│ │ │ │ -			, std::bind(&amp;resolve_links::link_t::ti, _1)));
│ │ │ │ -
│ │ │ │ -		// some debug output in case the test fails
│ │ │ │ -		if (num_matches &gt; e.expected_matches)
│ │ │ │ -		{
│ │ │ │ -			file_storage const&amp; fs = ti1-&gt;files();
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(145)">../test/test_resume.cpp:582</a></td><td>test what happens when loading a resume file with both piece priorities and file priorities (file prio should take precedence)</td></tr><tr id="145" style="display: none;" colspan="3"><td colspan="3"><h2>test what happens when loading a resume file with both piece priorities
│ │ │ │ -and file priorities (file prio should take precedence)</h2><h4>../test/test_resume.cpp:582</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		{
│ │ │ │ -			TEST_EQUAL(pieces[i], true);
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -} // anonymous namespace
│ │ │ │ -
│ │ │ │ -TORRENT_TEST(piece_slots_seed)
│ │ │ │ -{
│ │ │ │ -	test_piece_slots_seed(settings());
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -TORRENT_TEST(piece_slots_seed_suggest_cache)
│ │ │ │ -{
│ │ │ │ -	settings_pack sett = settings();
│ │ │ │ -	sett.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);
│ │ │ │ -	test_piece_slots_seed(sett);
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(146)">../test/test_resume.cpp:585</a></td><td>make sure a resume file only ever contain file priorities OR piece priorities. Never both.</td></tr><tr id="146" style="display: none;" colspan="3"><td colspan="3"><h2>make sure a resume file only ever contain file priorities OR piece
│ │ │ │ -priorities. Never both.</h2><h4>../test/test_resume.cpp:585</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			TEST_EQUAL(pieces[i], true);
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -}
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(133)">../test/test_resume.cpp:585</a></td><td>make sure a resume file only ever contain file priorities OR piece priorities. Never both.</td></tr><tr id="133" style="display: none;" colspan="3"><td colspan="3"><h2>make sure a resume file only ever contain file priorities OR piece
│ │ │ │ +priorities. Never both.</h2><h4>../test/test_resume.cpp:585</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			TEST_EQUAL(pieces[i], true);
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +}
│ │ │ │  
│ │ │ │  } // anonymous namespace
│ │ │ │  
│ │ │ │  TORRENT_TEST(piece_slots_seed)
│ │ │ │  {
│ │ │ │  	test_piece_slots_seed(settings());
│ │ │ │  }
│ │ │ │ @@ -5355,15 +5075,15 @@
│ │ │ │  	settings_pack sett = settings();
│ │ │ │  	sett.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);
│ │ │ │  	test_piece_slots_seed(sett);
│ │ │ │  }
│ │ │ │  
│ │ │ │  
│ │ │ │  <div style="background: #ffff00" width="100%">
│ │ │ │ -</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(147)">../test/test_resume.cpp:588</a></td><td>generally save</td></tr><tr id="147" style="display: none;" colspan="3"><td colspan="3"><h2>generally save</h2><h4>../test/test_resume.cpp:588</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		}
│ │ │ │ +</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(134)">../test/test_resume.cpp:588</a></td><td>generally save</td></tr><tr id="134" style="display: none;" colspan="3"><td colspan="3"><h2>generally save</h2><h4>../test/test_resume.cpp:588</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		}
│ │ │ │  	}
│ │ │ │  }
│ │ │ │  
│ │ │ │  } // anonymous namespace
│ │ │ │  
│ │ │ │  TORRENT_TEST(piece_slots_seed)
│ │ │ │  {
│ │ │ │ @@ -5406,15 +5126,15 @@
│ │ │ │  	TEST_EQUAL(file_priorities[2], 3);
│ │ │ │  }
│ │ │ │  
│ │ │ │  // if both resume data and add_torrent_params has file_priorities, the
│ │ │ │  // add_torrent_params one take precedence
│ │ │ │  TORRENT_TEST(file_priorities_in_resume_and_params_deprecated)
│ │ │ │  {
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(148)">../test/test_resume.cpp:911</a></td><td>test all other resume flags here too. This would require returning more than just the torrent_status from test_resume_flags. Also http seeds and trackers for instance</td></tr><tr id="148" style="display: none;" colspan="3"><td colspan="3"><h2>test all other resume flags here too. This would require returning
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(135)">../test/test_resume.cpp:911</a></td><td>test all other resume flags here too. This would require returning more than just the torrent_status from test_resume_flags. Also http seeds and trackers for instance</td></tr><tr id="135" style="display: none;" colspan="3"><td colspan="3"><h2>test all other resume flags here too. This would require returning
│ │ │ │  more than just the torrent_status from test_resume_flags. Also http seeds
│ │ │ │  and trackers for instance</h2><h4>../test/test_resume.cpp:911</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	TEST_EQUAL(s.connections_limit, 1345);
│ │ │ │  	TEST_EQUAL(s.uploads_limit, 1346);
│ │ │ │  }
│ │ │ │  
│ │ │ │  TORRENT_TEST(paused_deprecated)
│ │ │ │  {
│ │ │ │ @@ -5459,15 +5179,15 @@
│ │ │ │  
│ │ │ │  TORRENT_TEST(resume_override_torrent_deprecated)
│ │ │ │  {
│ │ │ │  	// resume data overrides the .torrent_file
│ │ │ │  	std::printf("flags: no merge_resume_http_seed\n");
│ │ │ │  	lt::session ses(settings());
│ │ │ │  	torrent_handle h = test_resume_flags(ses,
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(149)">../test/test_resume.cpp:1683</a></td><td>test all other resume flags here too. This would require returning more than just the torrent_status from test_resume_flags. Also http seeds and trackers for instance</td></tr><tr id="149" style="display: none;" colspan="3"><td colspan="3"><h2>test all other resume flags here too. This would require returning
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(136)">../test/test_resume.cpp:1683</a></td><td>test all other resume flags here too. This would require returning more than just the torrent_status from test_resume_flags. Also http seeds and trackers for instance</td></tr><tr id="136" style="display: none;" colspan="3"><td colspan="3"><h2>test all other resume flags here too. This would require returning
│ │ │ │  more than just the torrent_status from test_resume_flags. Also http seeds
│ │ │ │  and trackers for instance</h2><h4>../test/test_resume.cpp:1683</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	TEST_EQUAL(s.connections_limit, 1345);
│ │ │ │  	TEST_EQUAL(s.uploads_limit, 1346);
│ │ │ │  }
│ │ │ │  
│ │ │ │  TORRENT_TEST(paused)
│ │ │ │  {
│ │ │ │ @@ -5512,1952 +5232,554 @@
│ │ │ │  template &lt;typename Fun&gt;
│ │ │ │  void test_unfinished_pieces(Fun f)
│ │ │ │  {
│ │ │ │  	// create a torrent and complete files
│ │ │ │  	std::shared_ptr&lt;torrent_info&gt; ti = generate_torrent(true, true);
│ │ │ │  
│ │ │ │  	add_torrent_params p;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(150)">../test/test_flags.cpp:163</a></td><td>change to a different test setup. currently always paused. test_set_after_add(torrent_flags::paused); test_unset_after_add(torrent_flags::paused);</td></tr><tr id="150" style="display: none;" colspan="3"><td colspan="3"><h2>change to a different test setup. currently always paused.
│ │ │ │ -test_set_after_add(torrent_flags::paused);
│ │ │ │ -test_unset_after_add(torrent_flags::paused);</h2><h4>../test/test_flags.cpp:163</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">{
│ │ │ │ -	// share-mode
│ │ │ │ -	test_add_and_get_flags(torrent_flags::share_mode);
│ │ │ │ -	test_set_after_add(torrent_flags::share_mode);
│ │ │ │ -	test_unset_after_add(torrent_flags::share_mode);
│ │ │ │ -}
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -TORRENT_TEST(flag_apply_ip_filter)
│ │ │ │ -{
│ │ │ │ -	// apply-ip-filter
│ │ │ │ -	test_add_and_get_flags(torrent_flags::apply_ip_filter);
│ │ │ │ -	test_set_after_add(torrent_flags::apply_ip_filter);
│ │ │ │ -	test_unset_after_add(torrent_flags::apply_ip_filter);
│ │ │ │ -}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(137)">../test/test_resolve_links.cpp:95</a></td><td>test files with different piece size (negative test)</td></tr><tr id="137" style="display: none;" colspan="3"><td colspan="3"><h2>test files with different piece size (negative test)</h2><h4>../test/test_resolve_links.cpp:95</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{ "test2", "test1_pad_files", 0},
│ │ │ │ +	{ "test3", "test1_pad_files", 0},
│ │ │ │ +	{ "test2", "test1_single", 0},
│ │ │ │  
│ │ │ │ -TORRENT_TEST(flag_paused)
│ │ │ │ -{
│ │ │ │ -	// paused
│ │ │ │ -	test_add_and_get_flags(torrent_flags::paused);
│ │ │ │ -<div style="background: #ffff00" width="100%">}
│ │ │ │ -</div>
│ │ │ │ -TORRENT_TEST(flag_auto_managed)
│ │ │ │ -{
│ │ │ │ -	// auto-managed
│ │ │ │ -	test_add_and_get_flags(torrent_flags::auto_managed);
│ │ │ │ -	test_set_after_add(torrent_flags::auto_managed);
│ │ │ │ -	test_unset_after_add(torrent_flags::auto_managed);
│ │ │ │ -}
│ │ │ │ +	// these are all padded. The first small file will accidentally also
│ │ │ │ +	// match, even though it's not tail padded, the following file is identical
│ │ │ │ +	{ "test2_pad_files", "test1_pad_files", 2},
│ │ │ │ +	{ "test3_pad_files", "test1_pad_files", 2},
│ │ │ │ +	{ "test3_pad_files", "test2_pad_files", 2},
│ │ │ │ +	{ "test1_pad_files", "test2_pad_files", 2},
│ │ │ │ +	{ "test1_pad_files", "test3_pad_files", 2},
│ │ │ │ +	{ "test2_pad_files", "test3_pad_files", 2},
│ │ │ │  
│ │ │ │ -// super seeding mode is automatically turned off if we're not a seed
│ │ │ │ -// since the posix_disk_io is not threaded, this will happen immediately
│ │ │ │ -#if TORRENT_HAVE_MMAP
│ │ │ │ -#ifndef TORRENT_DISABLE_SUPERSEEDING
│ │ │ │ -TORRENT_TEST(flag_super_seeding)
│ │ │ │ -{
│ │ │ │ -	// super-seeding
│ │ │ │ -	test_add_and_get_flags(torrent_flags::super_seeding);
│ │ │ │ -	test_unset_after_add(torrent_flags::super_seeding);
│ │ │ │ -	test_set_after_add(torrent_flags::super_seeding);
│ │ │ │ -}
│ │ │ │ -#endif
│ │ │ │ -#endif
│ │ │ │ +	// one might expect this to work, but since the tail of the single file
│ │ │ │ +	// torrent is not padded, the last piece hash won't match
│ │ │ │ +	{ "test1_pad_files", "test1_single", 0},
│ │ │ │  
│ │ │ │ -TORRENT_TEST(flag_sequential_download)
│ │ │ │ -{
│ │ │ │ -	// sequential-download
│ │ │ │ -	test_add_and_get_flags(torrent_flags::sequential_download);
│ │ │ │ -	test_set_after_add(torrent_flags::sequential_download);
│ │ │ │ -	test_unset_after_add(torrent_flags::sequential_download);
│ │ │ │ -}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(151)">../test/test_flags.cpp:205</a></td><td>this test is flaky, since the torrent will become ready before asking for the flags, and by then stop_when_ready will have been cleared test_add_and_get_flags(torrent_flags::stop_when_ready); setting stop-when-ready when already stopped has no effect.</td></tr><tr id="151" style="display: none;" colspan="3"><td colspan="3"><h2>this test is flaky, since the torrent will become ready before
│ │ │ │ -asking for the flags, and by then stop_when_ready will have been cleared
│ │ │ │ -test_add_and_get_flags(torrent_flags::stop_when_ready);
│ │ │ │ -setting stop-when-ready when already stopped has no effect.</h2><h4>../test/test_flags.cpp:205</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(152)">../test/test_flags.cpp:209</a></td><td>change to a different test setup. currently always paused. test_set_after_add(torrent_flags::stop_when_ready);</td></tr><tr id="152" style="display: none;" colspan="3"><td colspan="3"><h2>change to a different test setup. currently always paused.
│ │ │ │ -test_set_after_add(torrent_flags::stop_when_ready);</h2><h4>../test/test_flags.cpp:209</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	test_set_after_add(torrent_flags::super_seeding);
│ │ │ │ -}
│ │ │ │ -#endif
│ │ │ │ -#endif
│ │ │ │ +	// if it's padded on the other hand, it will work
│ │ │ │ +	{ "test1_pad_files", "test1_single_padded", 1},
│ │ │ │  
│ │ │ │ -TORRENT_TEST(flag_sequential_download)
│ │ │ │ -{
│ │ │ │ -	// sequential-download
│ │ │ │ -	test_add_and_get_flags(torrent_flags::sequential_download);
│ │ │ │ -	test_set_after_add(torrent_flags::sequential_download);
│ │ │ │ -	test_unset_after_add(torrent_flags::sequential_download);
│ │ │ │ -}
│ │ │ │ +<div style="background: #ffff00" width="100%">};
│ │ │ │ +</div>
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(138)">../test/test_resolve_links.cpp:98</a></td><td>it would be nice to test resolving of more than just 2 files as well. like 3 single file torrents merged into one, resolving all 3 files.</td></tr><tr id="138" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to test resolving of more than just 2 files as well.
│ │ │ │ +like 3 single file torrents merged into one, resolving all 3 files.</h2><h4>../test/test_resolve_links.cpp:98</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{ "test2", "test1_single", 0},
│ │ │ │  
│ │ │ │ -// the stop when ready flag will be cleared when the torrent is ready to start
│ │ │ │ -// downloading.
│ │ │ │ -// since the posix_disk_io is not threaded, this will happen immediately
│ │ │ │ -#if TORRENT_HAVE_MMAP
│ │ │ │ -TORRENT_TEST(flag_stop_when_ready)
│ │ │ │ -{
│ │ │ │ -	// stop-when-ready
│ │ │ │ -<div style="background: #ffff00" width="100%">	test_unset_after_add(torrent_flags::stop_when_ready);
│ │ │ │ -</div>}
│ │ │ │ -#endif
│ │ │ │ +	// these are all padded. The first small file will accidentally also
│ │ │ │ +	// match, even though it's not tail padded, the following file is identical
│ │ │ │ +	{ "test2_pad_files", "test1_pad_files", 2},
│ │ │ │ +	{ "test3_pad_files", "test1_pad_files", 2},
│ │ │ │ +	{ "test3_pad_files", "test2_pad_files", 2},
│ │ │ │ +	{ "test1_pad_files", "test2_pad_files", 2},
│ │ │ │ +	{ "test1_pad_files", "test3_pad_files", 2},
│ │ │ │ +	{ "test2_pad_files", "test3_pad_files", 2},
│ │ │ │  
│ │ │ │ -TORRENT_TEST(flag_disable_dht)
│ │ │ │ -{
│ │ │ │ -	test_add_and_get_flags(torrent_flags::disable_dht);
│ │ │ │ -	test_set_after_add(torrent_flags::disable_dht);
│ │ │ │ -	test_unset_after_add(torrent_flags::disable_dht);
│ │ │ │ -}
│ │ │ │ +	// one might expect this to work, but since the tail of the single file
│ │ │ │ +	// torrent is not padded, the last piece hash won't match
│ │ │ │ +	{ "test1_pad_files", "test1_single", 0},
│ │ │ │  
│ │ │ │ +	// if it's padded on the other hand, it will work
│ │ │ │ +	{ "test1_pad_files", "test1_single_padded", 1},
│ │ │ │  
│ │ │ │ -TORRENT_TEST(flag_disable_lsd)
│ │ │ │ -{
│ │ │ │ -	test_add_and_get_flags(torrent_flags::disable_lsd);
│ │ │ │ -	test_set_after_add(torrent_flags::disable_lsd);
│ │ │ │ -	test_unset_after_add(torrent_flags::disable_lsd);
│ │ │ │ -}
│ │ │ │ +};
│ │ │ │  
│ │ │ │ -TORRENT_TEST(flag_disable_pex)
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>TORRENT_TEST(resolve_links)
│ │ │ │  {
│ │ │ │ -	test_add_and_get_flags(torrent_flags::disable_pex);
│ │ │ │ -	test_set_after_add(torrent_flags::disable_pex);
│ │ │ │ -	test_unset_after_add(torrent_flags::disable_pex);
│ │ │ │ -}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(153)">../src/packet_buffer.cpp:157</a></td><td>use compare_less_wrap for this comparison as well</td></tr><tr id="153" style="display: none;" colspan="3"><td colspan="3"><h2>use compare_less_wrap for this comparison as well</h2><h4>../src/packet_buffer.cpp:157</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{
│ │ │ │ -		INVARIANT_CHECK;
│ │ │ │ -		TORRENT_ASSERT_VAL(size &lt;= 0xffff, size);
│ │ │ │ -		std::uint32_t new_size = m_capacity == 0 ? 16 : m_capacity;
│ │ │ │ -
│ │ │ │ -		while (new_size &lt; size)
│ │ │ │ -			new_size &lt;&lt;= 1;
│ │ │ │ -
│ │ │ │ -		aux::unique_ptr&lt;packet_ptr[], index_type&gt; new_storage(new packet_ptr[new_size]);
│ │ │ │ -
│ │ │ │ -		for (index_type i = m_first; i &lt; (m_first + m_capacity); ++i)
│ │ │ │ -			new_storage[i &amp; (new_size - 1)] = std::move(m_storage[i &amp; (m_capacity - 1)]);
│ │ │ │ -
│ │ │ │ -		m_storage = std::move(new_storage);
│ │ │ │ -		m_capacity = new_size;
│ │ │ │ -	}
│ │ │ │ +	std::string path = combine_path(parent_path(current_working_directory())
│ │ │ │ +		, "mutable_test_torrents");
│ │ │ │  
│ │ │ │ -	packet_ptr packet_buffer::remove(index_type idx)
│ │ │ │ +	for (int i = 0; i &lt; int(sizeof(test_torrents)/sizeof(test_torrents[0])); ++i)
│ │ │ │  	{
│ │ │ │ -		INVARIANT_CHECK;
│ │ │ │ -<div style="background: #ffff00" width="100%">		if (idx &gt;= m_first + m_capacity)
│ │ │ │ -</div>			return packet_ptr();
│ │ │ │ -
│ │ │ │ -		if (compare_less_wrap(idx, m_first, 0xffff))
│ │ │ │ -			return packet_ptr();
│ │ │ │ -
│ │ │ │ -		std::size_t const mask = m_capacity - 1;
│ │ │ │ -		packet_ptr old_value = std::move(m_storage[idx &amp; mask]);
│ │ │ │ -		m_storage[idx &amp; mask].reset();
│ │ │ │ -
│ │ │ │ -		if (old_value)
│ │ │ │ -		{
│ │ │ │ -			--m_size;
│ │ │ │ -			if (m_size == 0) m_last = m_first;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		if (idx == m_first &amp;&amp; m_size != 0)
│ │ │ │ -		{
│ │ │ │ -			++m_first;
│ │ │ │ -			for (index_type i = 0; i &lt; m_capacity; ++i, ++m_first)
│ │ │ │ -				if (m_storage[m_first &amp; mask]) break;
│ │ │ │ -			m_first &amp;= 0xffff;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		if (((idx + 1) &amp; 0xffff) == m_last &amp;&amp; m_size != 0)
│ │ │ │ -		{
│ │ │ │ -			--m_last;
│ │ │ │ -			for (index_type i = 0; i &lt; m_capacity; ++i, --m_last)
│ │ │ │ -				if (m_storage[m_last &amp; mask]) break;
│ │ │ │ -			++m_last;
│ │ │ │ -			m_last &amp;= 0xffff;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(154)">../src/session_handle.cpp:499</a></td><td>in C++14, use unique_ptr and move it into the lambda</td></tr><tr id="154" style="display: none;" colspan="3"><td colspan="3"><h2>in C++14, use unique_ptr and move it into the lambda</h2><h4>../src/session_handle.cpp:499</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ -		if (params.save_path.empty())
│ │ │ │ -			aux::throw_ex&lt;system_error&gt;(error_code(errors::invalid_save_path));
│ │ │ │ -#else
│ │ │ │ -		TORRENT_ASSERT_PRECOND(!params.save_path.empty());
│ │ │ │ -#endif
│ │ │ │ +		test_torrent_t const&amp; e = test_torrents[i];
│ │ │ │  
│ │ │ │ -#if TORRENT_ABI_VERSION &lt; 3
│ │ │ │ -		if (!params.info_hashes.has_v1() &amp;&amp; !params.info_hashes.has_v2() &amp;&amp; !params.ti)
│ │ │ │ -			params.info_hashes.v1 = params.info_hash;
│ │ │ │ -#endif
│ │ │ │ +		std::string p = combine_path(path, e.filename1) + ".torrent";
│ │ │ │ +		std::printf("loading %s\n", p.c_str());
│ │ │ │ +		std::shared_ptr&lt;torrent_info&gt; ti1 = std::make_shared&lt;torrent_info&gt;(p);
│ │ │ │  
│ │ │ │ -		// the internal torrent object keeps and mutates state in the
│ │ │ │ -		// torrent_info object. We can't let that leak back to the client
│ │ │ │ -		if (params.ti)
│ │ │ │ -			params.ti = std::make_shared&lt;torrent_info&gt;(*params.ti);
│ │ │ │ +		p = combine_path(path, e.filename2) + ".torrent";
│ │ │ │ +		std::printf("loading %s\n", p.c_str());
│ │ │ │ +		std::shared_ptr&lt;torrent_info&gt; ti2 = std::make_shared&lt;torrent_info&gt;(p);
│ │ │ │  
│ │ │ │ -		// we cannot capture a unique_ptr into a lambda in c++11, so we use a raw
│ │ │ │ -		// pointer for now. async_call uses a lambda expression to post the call
│ │ │ │ -		// to the main thread
│ │ │ │ -<div style="background: #ffff00" width="100%">		auto* p = new add_torrent_params(std::move(params));
│ │ │ │ -</div>		auto guard = aux::scope_end([p]{ delete p; });
│ │ │ │ -		p-&gt;save_path = complete(p-&gt;save_path);
│ │ │ │ +		std::printf("resolving\n");
│ │ │ │ +		resolve_links l(ti1);
│ │ │ │ +		l.match(ti2, ".");
│ │ │ │  
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ -		handle_backwards_compatible_resume_data(*p);
│ │ │ │ -#endif
│ │ │ │ +		aux::vector&lt;resolve_links::link_t, file_index_t&gt; const&amp; links = l.get_links();
│ │ │ │  
│ │ │ │ -		async_call(&amp;session_impl::async_add_torrent, p);
│ │ │ │ -		guard.disarm();
│ │ │ │ -	}
│ │ │ │ +		auto const num_matches = std::size_t(std::count_if(links.begin(), links.end()
│ │ │ │ +			, std::bind(&amp;resolve_links::link_t::ti, _1)));
│ │ │ │  
│ │ │ │ -#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ -	// if the torrent already exists, this will throw duplicate_torrent
│ │ │ │ -	torrent_handle session_handle::add_torrent(
│ │ │ │ -		torrent_info const&amp; ti
│ │ │ │ -		, std::string const&amp; save_path
│ │ │ │ -		, entry const&amp; resume_data
│ │ │ │ -		, storage_mode_t storage_mode
│ │ │ │ -		, bool const add_paused)
│ │ │ │ -	{
│ │ │ │ -		add_torrent_params p;
│ │ │ │ -		p.ti = std::make_shared&lt;torrent_info&gt;(ti);
│ │ │ │ -		p.save_path = save_path;
│ │ │ │ -		if (resume_data.type() != entry::undefined_t)
│ │ │ │ +		// some debug output in case the test fails
│ │ │ │ +		if (num_matches &gt; e.expected_matches)
│ │ │ │  		{
│ │ │ │ -			bencode(std::back_inserter(p.resume_data), resume_data);
│ │ │ │ -		}
│ │ │ │ -		p.storage_mode = storage_mode;
│ │ │ │ -		if (add_paused) p.flags |= add_torrent_params::flag_paused;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(155)">../src/posix_part_file.cpp:337</a></td><td>what do we do if someone is currently reading from the disk from this piece? does it matter? Since we won't actively erase the data from disk, but it may be overwritten soon, it's probably not that big of a deal</td></tr><tr id="155" style="display: none;" colspan="3"><td colspan="3"><h2>what do we do if someone is currently reading from the disk
│ │ │ │ -from this piece? does it matter? Since we won't actively erase the
│ │ │ │ -data from disk, but it may be overwritten soon, it's probably not that
│ │ │ │ -big of a deal</h2><h4>../src/posix_part_file.cpp:337</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -			if (ec) return {};
│ │ │ │ -
│ │ │ │ -#ifdef TORRENT_WINDOWS
│ │ │ │ -			ret = file_pointer(::_wfopen(convert_to_native_path_string(fn).c_str(), L"wb+"));
│ │ │ │ -#else
│ │ │ │ -			ret = file_pointer(::fopen(fn.c_str(), "wb+"));
│ │ │ │ -#endif
│ │ │ │ -			if (ret.file() == nullptr)
│ │ │ │ -				ec.assign(errno, generic_category());
│ │ │ │ -		}
│ │ │ │ -		if (ec) return {};
│ │ │ │ -		return ret;
│ │ │ │ -	}
│ │ │ │ +			file_storage const&amp; fs = ti1-&gt;files();
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(139)">../test/test_tracker.cpp:60</a></td><td>test scrape requests</td></tr><tr id="139" style="display: none;" colspan="3"><td colspan="3"><h2>test scrape requests</h2><h4>../test/test_tracker.cpp:60</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(140)">../test/test_tracker.cpp:61</a></td><td>test parse peers6</td></tr><tr id="140" style="display: none;" colspan="3"><td colspan="3"><h2>test parse peers6</h2><h4>../test/test_tracker.cpp:61</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(141)">../test/test_tracker.cpp:62</a></td><td>test parse tracker-id</td></tr><tr id="141" style="display: none;" colspan="3"><td colspan="3"><h2>test parse tracker-id</h2><h4>../test/test_tracker.cpp:62</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(142)">../test/test_tracker.cpp:63</a></td><td>test parse failure-reason</td></tr><tr id="142" style="display: none;" colspan="3"><td colspan="3"><h2>test parse failure-reason</h2><h4>../test/test_tracker.cpp:63</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(143)">../test/test_tracker.cpp:64</a></td><td>test all failure paths, including invalid bencoding not a dictionary no files entry in scrape response no info-hash entry in scrape response malformed peers in peer list of dictionaries uneven number of bytes in peers and peers6 string responses</td></tr><tr id="143" style="display: none;" colspan="3"><td colspan="3"><h2>test all failure paths, including
│ │ │ │ +invalid bencoding
│ │ │ │ +not a dictionary
│ │ │ │ +no files entry in scrape response
│ │ │ │ +no info-hash entry in scrape response
│ │ │ │ +malformed peers in peer list of dictionaries
│ │ │ │ +uneven number of bytes in peers and peers6 string responses</h2><h4>../test/test_tracker.cpp:64</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include "test_utils.hpp"
│ │ │ │ +#include "udp_tracker.hpp"
│ │ │ │ +#include "settings.hpp"
│ │ │ │ +#include "test_utils.hpp"
│ │ │ │ +#include "libtorrent/alert.hpp"
│ │ │ │ +#include "libtorrent/peer_info.hpp" // for peer_list_entry
│ │ │ │ +#include "libtorrent/alert_types.hpp"
│ │ │ │ +#include "libtorrent/session.hpp"
│ │ │ │ +#include "libtorrent/session_params.hpp"
│ │ │ │ +#include "libtorrent/error_code.hpp"
│ │ │ │ +#include "libtorrent/tracker_manager.hpp"
│ │ │ │ +#include "libtorrent/http_tracker_connection.hpp" // for parse_tracker_response
│ │ │ │ +#include "libtorrent/torrent_info.hpp"
│ │ │ │ +#include "libtorrent/announce_entry.hpp"
│ │ │ │ +#include "libtorrent/torrent.hpp"
│ │ │ │ +#include "libtorrent/aux_/path.hpp"
│ │ │ │ +#include "libtorrent/socket_io.hpp"
│ │ │ │  
│ │ │ │ -	void posix_part_file::free_piece(piece_index_t const piece)
│ │ │ │ -	{
│ │ │ │ -		auto const i = m_piece_map.find(piece);
│ │ │ │ -		if (i == m_piece_map.end()) return;
│ │ │ │ +using namespace lt;
│ │ │ │  
│ │ │ │  <div style="background: #ffff00" width="100%">
│ │ │ │ -</div>		m_free_slots.push_back(i-&gt;second);
│ │ │ │ -		m_piece_map.erase(i);
│ │ │ │ -		m_dirty_metadata = true;
│ │ │ │ -	}
│ │ │ │ +</div>TORRENT_TEST(parse_hostname_peers)
│ │ │ │ +{
│ │ │ │ +	char const response[] = "d5:peersld7:peer id20:aaaaaaaaaaaaaaaaaaaa"
│ │ │ │ +		"2:ip13:test_hostname4:porti1000eed"
│ │ │ │ +		"7:peer id20:bbbbabaababababababa2:ip12:another_host4:porti1001eeee";
│ │ │ │ +	error_code ec;
│ │ │ │ +	tracker_response resp = parse_tracker_response(response
│ │ │ │ +		, ec, {}, sha1_hash());
│ │ │ │  
│ │ │ │ -	void posix_part_file::move_partfile(std::string const&amp; path, error_code&amp; ec)
│ │ │ │ +	TEST_EQUAL(ec, error_code());
│ │ │ │ +	TEST_EQUAL(resp.peers.size(), 2);
│ │ │ │ +	if (resp.peers.size() == 2)
│ │ │ │  	{
│ │ │ │ -		flush_metadata_impl(ec);
│ │ │ │ -		if (ec) return;
│ │ │ │ -
│ │ │ │ -		if (!m_piece_map.empty())
│ │ │ │ -		{
│ │ │ │ -			std::string old_path = combine_path(m_path, m_name);
│ │ │ │ -			std::string new_path = combine_path(path, m_name);
│ │ │ │ -
│ │ │ │ -			rename(old_path, new_path, ec);
│ │ │ │ -			if (ec == boost::system::errc::no_such_file_or_directory)
│ │ │ │ -				ec.clear();
│ │ │ │ +		peer_entry const&amp; e0 = resp.peers[0];
│ │ │ │ +		peer_entry const&amp; e1 = resp.peers[1];
│ │ │ │ +		TEST_EQUAL(e0.hostname, "test_hostname");
│ │ │ │ +		TEST_EQUAL(e0.port, 1000);
│ │ │ │ +		TEST_EQUAL(e0.pid, peer_id("aaaaaaaaaaaaaaaaaaaa"));
│ │ │ │  
│ │ │ │ -			if (ec)
│ │ │ │ -			{
│ │ │ │ -				storage_error se;
│ │ │ │ -				aux::copy_file(old_path, new_path, se);
│ │ │ │ -				ec = se.ec;
│ │ │ │ -				if (ec) return;
│ │ │ │ -				remove(old_path, ec);
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ -		m_path = path;
│ │ │ │ +		TEST_EQUAL(e1.hostname, "another_host");
│ │ │ │ +		TEST_EQUAL(e1.port, 1001);
│ │ │ │ +		TEST_EQUAL(e1.pid, peer_id("bbbbabaababababababa"));
│ │ │ │  	}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(156)">../src/posix_part_file.cpp:424</a></td><td>instead of rebuilding the whole file header and flushing it, update the slot entries as we go</td></tr><tr id="156" style="display: none;" colspan="3"><td colspan="3"><h2>instead of rebuilding the whole file header
│ │ │ │ -and flushing it, update the slot entries as we go</h2><h4>../src/posix_part_file.cpp:424</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				}
│ │ │ │ -				auto bytes_read = std::fread(buf.get(), 1, std::size_t(block_to_copy), file.file());
│ │ │ │ -				if (int(bytes_read) != block_to_copy)
│ │ │ │ -					ec.assign(errno, generic_category());
│ │ │ │ -
│ │ │ │ -				if (ec) return;
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -				f(file_offset, {buf.get(), block_to_copy});
│ │ │ │ -			}
│ │ │ │ -			file_offset += block_to_copy;
│ │ │ │ -			piece_offset = 0;
│ │ │ │ -			size -= block_to_copy;
│ │ │ │ +TORRENT_TEST(parse_peers4)
│ │ │ │ +{
│ │ │ │ +	char const response[] = "d5:peers12:\x01\x02\x03\x04\x30\x10"
│ │ │ │ +		"\x09\x08\x07\x06\x20\x10" "e";
│ │ │ │ +	error_code ec;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(144)">../test/test_upnp.cpp:156</a></td><td>store the log and verify that some key messages are there</td></tr><tr id="144" style="display: none;" colspan="3"><td colspan="3"><h2>store the log and verify that some key messages are there</h2><h4>../test/test_upnp.cpp:156</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			, portmap_protocol const protocol, error_code const&amp; err
│ │ │ │ +			, portmap_transport, aux::listen_socket_handle const&amp;) override
│ │ │ │ +		{
│ │ │ │ +			callback_info info = {mapping, port, err};
│ │ │ │ +			callbacks.push_back(info);
│ │ │ │ +			std::cout &lt;&lt; "mapping: " &lt;&lt; static_cast&lt;int&gt;(mapping)
│ │ │ │ +				&lt;&lt; ", port: " &lt;&lt; port &lt;&lt; ", IP: " &lt;&lt; ip
│ │ │ │ +				&lt;&lt; ", proto: " &lt;&lt; static_cast&lt;int&gt;(protocol)
│ │ │ │ +				&lt;&lt; ", error: \"" &lt;&lt; err.message() &lt;&lt; "\"\n";
│ │ │ │  		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void posix_part_file::flush_metadata(error_code&amp; ec)
│ │ │ │ -	{
│ │ │ │ -		flush_metadata_impl(ec);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	void posix_part_file::flush_metadata_impl(error_code&amp; ec)
│ │ │ │ -</div>	{
│ │ │ │ -		// do we need to flush the metadata?
│ │ │ │ -		if (m_dirty_metadata == false) return;
│ │ │ │ -
│ │ │ │ -		if (m_piece_map.empty())
│ │ │ │ +	#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		bool should_log_portmap(portmap_transport) const override
│ │ │ │  		{
│ │ │ │ -			// if we don't have any pieces left in the
│ │ │ │ -			// part file, remove it
│ │ │ │ -			std::string const p = combine_path(m_path, m_name);
│ │ │ │ -			remove(p, ec);
│ │ │ │ -
│ │ │ │ -			if (ec == boost::system::errc::no_such_file_or_directory)
│ │ │ │ -				ec.clear();
│ │ │ │ -			return;
│ │ │ │ +			return true;
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -		auto f = open_file(open_mode::read_write, ec);
│ │ │ │ -		if (ec) return;
│ │ │ │ -
│ │ │ │ -		std::vector&lt;char&gt; header(static_cast&lt;std::size_t&gt;(m_header_size));
│ │ │ │ -
│ │ │ │ -		using namespace libtorrent::aux;
│ │ │ │ -
│ │ │ │ -		char* ptr = header.data();
│ │ │ │ -		write_uint32(m_max_pieces, ptr);
│ │ │ │ -		write_uint32(m_piece_size, ptr);
│ │ │ │ -
│ │ │ │ -		for (piece_index_t piece(0); piece &lt; piece_index_t(m_max_pieces); ++piece)
│ │ │ │ +		void log_portmap(portmap_transport, char const* msg
│ │ │ │ +			, aux::listen_socket_handle const&amp;) const override
│ │ │ │  		{
│ │ │ │ -			auto const i = m_piece_map.find(piece);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(157)">../src/udp_socket.cpp:659</a></td><td>perhaps an attempt should be made to bind m_socks5_sock to the device of m_listen_socket</td></tr><tr id="157" style="display: none;" colspan="3"><td colspan="3"><h2>perhaps an attempt should be made to bind m_socks5_sock to the
│ │ │ │ -device of m_listen_socket</h2><h4>../src/udp_socket.cpp:659</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	if (ec)
│ │ │ │ -	{
│ │ │ │ -		if (m_alerts.should_post&lt;socks5_alert&gt;())
│ │ │ │ -			m_alerts.emplace_alert&lt;socks5_alert&gt;(m_proxy_addr, operation_t::sock_option, ec);
│ │ │ │ -		ec.clear();
│ │ │ │ -	}
│ │ │ │ -#endif
│ │ │ │ -#endif
│ │ │ │ +			std::cout &lt;&lt; "UPnP: " &lt;&lt; msg &lt;&lt; std::endl;
│ │ │ │ +<div style="background: #ffff00" width="100%">		}
│ │ │ │ +</div>	#endif
│ │ │ │ +	};
│ │ │ │  
│ │ │ │ -	tcp::endpoint const bind_ep(m_listen_socket.get_local_endpoint().address(), 0);
│ │ │ │ -	m_socks5_sock.bind(bind_ep, ec);
│ │ │ │ +ip_interface pick_upnp_interface()
│ │ │ │ +{
│ │ │ │ +	lt::io_context ios;
│ │ │ │ +	error_code ec;
│ │ │ │ +	std::vector&lt;ip_route&gt; const routes = enum_routes(ios, ec);
│ │ │ │  	if (ec)
│ │ │ │  	{
│ │ │ │ -		if (m_alerts.should_post&lt;socks5_alert&gt;())
│ │ │ │ -			m_alerts.emplace_alert&lt;socks5_alert&gt;(m_proxy_addr, operation_t::sock_bind, ec);
│ │ │ │ -		++m_failures;
│ │ │ │ -		retry_connection();
│ │ │ │ -		return;
│ │ │ │ +		std::cerr &lt;&lt; "failed to enumerate routes: " &lt;&lt; ec.message() &lt;&lt; '\n';
│ │ │ │ +		TEST_CHECK(false);
│ │ │ │ +		return {};
│ │ │ │  	}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>	ADD_OUTSTANDING_ASYNC("socks5::on_connected");
│ │ │ │ -	m_socks5_sock.async_connect(m_proxy_addr
│ │ │ │ -		, std::bind(&amp;socks5::on_connected, self(), _1));
│ │ │ │ -
│ │ │ │ -	ADD_OUTSTANDING_ASYNC("socks5::on_connect_timeout");
│ │ │ │ -	m_timer.expires_after(seconds(10));
│ │ │ │ -	m_timer.async_wait(std::bind(&amp;socks5::on_connect_timeout
│ │ │ │ -		, self(), _1));
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -void socks5::on_connect_timeout(error_code const&amp; e)
│ │ │ │ -{
│ │ │ │ -	COMPLETE_ASYNC("socks5::on_connect_timeout");
│ │ │ │ -
│ │ │ │ -	if (e == boost::asio::error::operation_aborted) return;
│ │ │ │ -
│ │ │ │ -	if (m_abort) return;
│ │ │ │ -
│ │ │ │ -	if (m_alerts.should_post&lt;socks5_alert&gt;())
│ │ │ │ -		m_alerts.emplace_alert&lt;socks5_alert&gt;(m_proxy_addr, operation_t::connect, errors::timed_out);
│ │ │ │ -
│ │ │ │ -	error_code ignore;
│ │ │ │ -	m_socks5_sock.close(ignore);
│ │ │ │ -
│ │ │ │ -	++m_failures;
│ │ │ │ -	retry_connection();
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -void socks5::on_connected(error_code const&amp; e)
│ │ │ │ -{
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(158)">../src/enum_net.cpp:144</a></td><td>in C++17, use __has_include for this. Other operating systems are likely to require this as well</td></tr><tr id="158" style="display: none;" colspan="3"><td colspan="3"><h2>in C++17, use __has_include for this. Other operating systems are
│ │ │ │ -likely to require this as well</h2><h4>../src/enum_net.cpp:144</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include &lt;arpa/inet.h&gt;
│ │ │ │ -#include &lt;cstring&gt;
│ │ │ │ -#include &lt;cstdlib&gt;
│ │ │ │ -#include &lt;unistd.h&gt;
│ │ │ │ -#include &lt;sys/types.h&gt;
│ │ │ │ -
│ │ │ │ -#if defined TORRENT_ANDROID &amp;&amp; !defined IFA_F_DADFAILED
│ │ │ │ -#define IFA_F_DADFAILED 8
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -#if TORRENT_USE_IFADDRS
│ │ │ │ -#include &lt;ifaddrs.h&gt;
│ │ │ │ -#include &lt;net/if.h&gt;
│ │ │ │ -#include &lt;sys/ioctl.h&gt;
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -#if TORRENT_USE_IFADDRS || TORRENT_USE_IFCONF || TORRENT_USE_NETLINK || TORRENT_USE_SYSCTL
│ │ │ │ -#ifdef TORRENT_BEOS
│ │ │ │ -<div style="background: #ffff00" width="100%">#include &lt;sys/sockio.h&gt;
│ │ │ │ -</div>#endif
│ │ │ │ -// capture this here where warnings are disabled (the macro generates warnings)
│ │ │ │ -const unsigned long siocgifmtu = SIOCGIFMTU;
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │ -
│ │ │ │ -#if defined(TORRENT_OS2) &amp;&amp; !defined(IF_NAMESIZE)
│ │ │ │ -#define IF_NAMESIZE IFNAMSIZ
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -namespace libtorrent {
│ │ │ │ -
│ │ │ │ -namespace {
│ │ │ │ -
│ │ │ │ -#if !defined TORRENT_WINDOWS &amp;&amp; !defined TORRENT_BUILD_SIMULATOR
│ │ │ │ -	struct socket_closer
│ │ │ │ +	std::vector&lt;ip_interface&gt; const ifs = enum_net_interfaces(ios, ec);
│ │ │ │ +	if (ec)
│ │ │ │  	{
│ │ │ │ -		socket_closer(int s) : m_socket(s) {}
│ │ │ │ -		socket_closer(socket_closer const&amp;) = delete;
│ │ │ │ -		socket_closer(socket_closer &amp;&amp;) = delete;
│ │ │ │ -		socket_closer&amp; operator=(socket_closer const&amp;) = delete;
│ │ │ │ -		socket_closer&amp; operator=(socket_closer &amp;&amp;) = delete;
│ │ │ │ -		~socket_closer() { ::close(m_socket); }
│ │ │ │ -	private:
│ │ │ │ -		int m_socket;
│ │ │ │ -	};
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -#if !defined TORRENT_BUILD_SIMULATOR
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(159)">../src/enum_net.cpp:268</a></td><td>if we get here, the caller still assumes the error code is reported via errno</td></tr><tr id="159" style="display: none;" colspan="3"><td colspan="3"><h2>if we get here, the caller still assumes the error code
│ │ │ │ -is reported via errno</h2><h4>../src/enum_net.cpp:268</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		;
│ │ │ │ +		std::cerr &lt;&lt; "failed to enumerate network interfaces: " &lt;&lt; ec.message() &lt;&lt; '\n';
│ │ │ │ +		TEST_CHECK(false);
│ │ │ │ +		return {};
│ │ │ │  	}
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -#if TORRENT_USE_NETLINK
│ │ │ │ -
│ │ │ │ -	int read_nl_sock(int sock, std::uint32_t const seq, std::uint32_t const pid
│ │ │ │ -		, std::function&lt;void(nlmsghdr const*)&gt; on_msg)
│ │ │ │ +	int idx = 0;
│ │ │ │ +	for (auto const&amp; face : ifs)
│ │ │ │  	{
│ │ │ │ -		std::array&lt;char, 4096&gt; buf;
│ │ │ │ -		for (;;)
│ │ │ │ -		{
│ │ │ │ -			int const read_len = int(recv(sock, buf.data(), buf.size(), 0));
│ │ │ │ -			if (read_len &lt; 0) return -1;
│ │ │ │ -
│ │ │ │ -			auto const* nl_hdr = reinterpret_cast&lt;nlmsghdr const*&gt;(buf.data());
│ │ │ │ -			int len = read_len;
│ │ │ │ -
│ │ │ │ -			for (; len &gt; 0 &amp;&amp; aux::nlmsg_ok(nl_hdr, len); nl_hdr = aux::nlmsg_next(nl_hdr, len))
│ │ │ │ -			{
│ │ │ │ -<div style="background: #ffff00" width="100%">				if ((aux::nlmsg_ok(nl_hdr, read_len) == 0) || (nl_hdr-&gt;nlmsg_type == NLMSG_ERROR))
│ │ │ │ -</div>					return -1;
│ │ │ │ -				// this function doesn't handle multiple requests at the same time
│ │ │ │ -				// so report an error if the message does not have the expected seq and pid
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(160)">../src/enum_net.cpp:274</a></td><td>if we get here, the caller still assumes the error code is reported via errno</td></tr><tr id="160" style="display: none;" colspan="3"><td colspan="3"><h2>if we get here, the caller still assumes the error code
│ │ │ │ -is reported via errno</h2><h4>../src/enum_net.cpp:274</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#if TORRENT_USE_NETLINK
│ │ │ │ +		if (!face.interface_address.is_v4()) continue;
│ │ │ │ +		std::cout &lt;&lt; " - " &lt;&lt; idx
│ │ │ │ +			&lt;&lt; ' ' &lt;&lt; face.interface_address.to_string()
│ │ │ │ +			&lt;&lt; ' ' &lt;&lt; int(static_cast&lt;std::uint8_t&gt;(face.state))
│ │ │ │ +			&lt;&lt; ' ' &lt;&lt; static_cast&lt;std::uint32_t&gt;(face.flags)
│ │ │ │ +			&lt;&lt; ' ' &lt;&lt; face.name &lt;&lt; '\n';
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(145)">../test/test_dht.cpp:472</a></td><td>check to make sure the "best" items are stored</td></tr><tr id="145" style="display: none;" colspan="3"><td colspan="3"><h2>check to make sure the "best" items are stored</h2><h4>../test/test_dht.cpp:472</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			, msg_args().target(items[j].target));
│ │ │ │  
│ │ │ │ -	int read_nl_sock(int sock, std::uint32_t const seq, std::uint32_t const pid
│ │ │ │ -		, std::function&lt;void(nlmsghdr const*)&gt; on_msg)
│ │ │ │ -	{
│ │ │ │ -		std::array&lt;char, 4096&gt; buf;
│ │ │ │ -		for (;;)
│ │ │ │ +		key_desc_t const desc[] =
│ │ │ │  		{
│ │ │ │ -			int const read_len = int(recv(sock, buf.data(), buf.size(), 0));
│ │ │ │ -			if (read_len &lt; 0) return -1;
│ │ │ │ -
│ │ │ │ -			auto const* nl_hdr = reinterpret_cast&lt;nlmsghdr const*&gt;(buf.data());
│ │ │ │ -			int len = read_len;
│ │ │ │ -
│ │ │ │ -			for (; len &gt; 0 &amp;&amp; aux::nlmsg_ok(nl_hdr, len); nl_hdr = aux::nlmsg_next(nl_hdr, len))
│ │ │ │ -			{
│ │ │ │ -				if ((aux::nlmsg_ok(nl_hdr, read_len) == 0) || (nl_hdr-&gt;nlmsg_type == NLMSG_ERROR))
│ │ │ │ -					return -1;
│ │ │ │ -				// this function doesn't handle multiple requests at the same time
│ │ │ │ -				// so report an error if the message does not have the expected seq and pid
│ │ │ │ -<div style="background: #ffff00" width="100%">				if (nl_hdr-&gt;nlmsg_seq != seq || nl_hdr-&gt;nlmsg_pid != pid)
│ │ │ │ -</div>					return -1;
│ │ │ │ -
│ │ │ │ -				if (nl_hdr-&gt;nlmsg_type == NLMSG_DONE) return 0;
│ │ │ │ +			{ "r", bdecode_node::dict_t, 0, key_desc_t::parse_children },
│ │ │ │ +				{ "v", bdecode_node::dict_t, 0, 0},
│ │ │ │ +				{ "id", bdecode_node::string_t, 20, key_desc_t::last_child},
│ │ │ │ +			{ "y", bdecode_node::string_t, 1, 0},
│ │ │ │ +		};
│ │ │ │  
│ │ │ │ -				on_msg(nl_hdr);
│ │ │ │ +		bdecode_node parsed[4];
│ │ │ │ +		char error_string[200];
│ │ │ │  
│ │ │ │ -				if ((nl_hdr-&gt;nlmsg_flags &amp; NLM_F_MULTI) == 0) return 0;
│ │ │ │ -			}
│ │ │ │ +		int ret = verify_message(response, desc, parsed, error_string);
│ │ │ │ +		if (ret)
│ │ │ │ +		{
│ │ │ │ +			items_num.insert(items_num.begin(), j);
│ │ │ │  		}
│ │ │ │ -//		return 0;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	int nl_dump_request(int const sock, std::uint32_t const seq
│ │ │ │ -		, nlmsghdr* const request_msg, std::function&lt;void(nlmsghdr const*)&gt; on_msg)
│ │ │ │ -	{
│ │ │ │ -		request_msg-&gt;nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST;
│ │ │ │ -		request_msg-&gt;nlmsg_seq = seq;
│ │ │ │ -		// in theory nlmsg_pid should be set to the netlink port ID (NOT the process ID)
│ │ │ │ -		// of the sender, but the kernel ignores this field so it is typically set to
│ │ │ │ -		// zero
│ │ │ │ -		request_msg-&gt;nlmsg_pid = 0;
│ │ │ │ -
│ │ │ │ -		if (::send(sock, request_msg, request_msg-&gt;nlmsg_len, 0) &lt; 0)
│ │ │ │ -			return -1;
│ │ │ │ -
│ │ │ │ -		// get the socket's port ID so that we can verify it in the response
│ │ │ │ -		sockaddr_nl sock_addr;
│ │ │ │ -		socklen_t sock_addr_len = sizeof(sock_addr);
│ │ │ │ -		if (::getsockname(sock, reinterpret_cast&lt;sockaddr*&gt;(&amp;sock_addr), &amp;sock_addr_len) &lt; 0)
│ │ │ │ -			return -1;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(161)">../src/ut_metadata.cpp:281</a></td><td>we really need to increment the refcounter on the torrent while this buffer is still in the peer's send buffer</td></tr><tr id="161" style="display: none;" colspan="3"><td colspan="3"><h2>we really need to increment the refcounter on the torrent
│ │ │ │ -while this buffer is still in the peer's send buffer</h2><h4>../src/ut_metadata.cpp:281</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				int const offset = piece * 16 * 1024;
│ │ │ │ -				metadata = m_tp.metadata().data() + offset;
│ │ │ │ -				metadata_piece_size = std::min(
│ │ │ │ -					int(m_tp.metadata().size()) - offset, 16 * 1024);
│ │ │ │ -				TORRENT_ASSERT(metadata_piece_size &gt; 0);
│ │ │ │ -				TORRENT_ASSERT(offset &gt;= 0);
│ │ │ │ -				TORRENT_ASSERT(offset + metadata_piece_size &lt;= m_tp.metadata().size());
│ │ │ │ -			}
│ │ │ │ -
│ │ │ │ -			char msg[200];
│ │ │ │ -			char* header = msg;
│ │ │ │ -			char* p = &amp;msg[6];
│ │ │ │ -			int const len = bencode(p, e);
│ │ │ │ -			int const total_size = 2 + len + metadata_piece_size;
│ │ │ │ -			namespace io = aux;
│ │ │ │ -			io::write_uint32(total_size, header);
│ │ │ │ -			io::write_uint8(bt_peer_connection::msg_extended, header);
│ │ │ │ -			io::write_uint8(m_message_index, header);
│ │ │ │ -
│ │ │ │ -			m_pc.send_buffer({msg, len + 6});
│ │ │ │ -<div style="background: #ffff00" width="100%">			if (metadata_piece_size)
│ │ │ │ -</div>			{
│ │ │ │ -				m_pc.append_const_send_buffer(
│ │ │ │ -					span&lt;char&gt;(const_cast&lt;char*&gt;(metadata), metadata_piece_size), metadata_piece_size);
│ │ │ │ -			}
│ │ │ │ -
│ │ │ │ -			m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_extended);
│ │ │ │ -			m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_metadata);
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		bool on_extended(int const length
│ │ │ │ -			, int const extended_msg, span&lt;char const&gt; body) override
│ │ │ │ -		{
│ │ │ │ -			if (extended_msg != 2) return false;
│ │ │ │ -			if (m_message_index == 0) return false;
│ │ │ │ -
│ │ │ │ -			if (length &gt; 17 * 1024)
│ │ │ │ -			{
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -				m_pc.peer_log(peer_log_alert::incoming_message, "UT_METADATA"
│ │ │ │ -					, "packet too big %d", length);
│ │ │ │ -#endif
│ │ │ │ -				m_pc.disconnect(errors::invalid_metadata_message, operation_t::bittorrent, peer_connection_interface::peer_error);
│ │ │ │ -				return true;
│ │ │ │ -			}
│ │ │ │ -
│ │ │ │ -			if (!m_pc.packet_finished()) return true;
│ │ │ │ -
│ │ │ │ -			error_code ec;
│ │ │ │ -			bdecode_node msg = bdecode(body, ec);
│ │ │ │ -			if (msg.type() != bdecode_node::dict_t)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(162)">../src/ip_notifier.cpp:41</a></td><td>simulator support</td></tr><tr id="162" style="display: none;" colspan="3"><td colspan="3"><h2>simulator support</h2><h4>../src/ip_notifier.cpp:41</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">      from this software without specific prior written permission.
│ │ │ │ -
│ │ │ │ -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
│ │ │ │ -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
│ │ │ │ -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
│ │ │ │ -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
│ │ │ │ -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
│ │ │ │ -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
│ │ │ │ -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
│ │ │ │ -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
│ │ │ │ -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
│ │ │ │ -POSSIBILITY OF SUCH DAMAGE.
│ │ │ │ -
│ │ │ │ -*/
│ │ │ │ -
│ │ │ │ -#include "libtorrent/aux_/ip_notifier.hpp"
│ │ │ │ -#include "libtorrent/assert.hpp"
│ │ │ │ +<div style="background: #ffff00" width="100%">	TEST_EQUAL(items_num.size(), 4);
│ │ │ │ +</div>}
│ │ │ │  
│ │ │ │ -#if defined TORRENT_BUILD_SIMULATOR
│ │ │ │ -<div style="background: #ffff00" width="100%">#elif TORRENT_USE_NETLINK
│ │ │ │ -</div>#include "libtorrent/netlink.hpp"
│ │ │ │ -#include "libtorrent/socket.hpp"
│ │ │ │ -#include &lt;array&gt;
│ │ │ │ -#include &lt;unordered_map&gt;
│ │ │ │ -#elif TORRENT_USE_SYSTEMCONFIGURATION || TORRENT_USE_SC_NETWORK_REACHABILITY
│ │ │ │ -#include &lt;SystemConfiguration/SystemConfiguration.h&gt;
│ │ │ │ -#elif defined TORRENT_WINDOWS
│ │ │ │ -#include "libtorrent/aux_/throw.hpp"
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_push.hpp"
│ │ │ │ -#include &lt;iphlpapi.h&gt;
│ │ │ │ -#ifdef TORRENT_WINRT
│ │ │ │ -#include &lt;netioapi.h&gt;
│ │ │ │ -#endif
│ │ │ │ -#include &lt;mutex&gt;
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │ -#endif
│ │ │ │ +int sum_distance_exp(int s, node_entry const&amp; e, node_id const&amp; ref)
│ │ │ │ +{
│ │ │ │ +	return s + distance_exp(e.id, ref);
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -#include "libtorrent/aux_/netlink_utils.hpp"
│ │ │ │ +std::vector&lt;tcp::endpoint&gt; g_got_peers;
│ │ │ │  
│ │ │ │ -namespace libtorrent { namespace aux {
│ │ │ │ +void get_peers_cb(std::vector&lt;tcp::endpoint&gt; const&amp; peers)
│ │ │ │ +{
│ │ │ │ +	g_got_peers.insert(g_got_peers.end(), peers.begin(), peers.end());
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -namespace {
│ │ │ │ +std::vector&lt;dht::item&gt; g_got_items;
│ │ │ │ +dht::item g_put_item;
│ │ │ │ +int g_put_count;
│ │ │ │  
│ │ │ │ -#if (TORRENT_USE_SYSTEMCONFIGURATION || TORRENT_USE_SC_NETWORK_REACHABILITY) &amp;&amp; \
│ │ │ │ -	!defined TORRENT_BUILD_SIMULATOR
│ │ │ │ +void get_mutable_item_cb(dht::item const&amp; i, bool a)
│ │ │ │ +{
│ │ │ │ +	if (!a) return;
│ │ │ │ +	if (!i.empty())
│ │ │ │ +		g_got_items.push_back(i);
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -// common utilities for Mac and iOS
│ │ │ │ -template &lt;typename T&gt; void CFRefRetain(T h) { CFRetain(h); }
│ │ │ │ -template &lt;typename T&gt; void CFRefRelease(T h) { CFRelease(h); }
│ │ │ │ +void put_mutable_item_data_cb(dht::item&amp; i)
│ │ │ │ +{
│ │ │ │ +	if (!i.empty())
│ │ │ │ +		g_got_items.push_back(i);
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(163)">../src/http_seed_connection.cpp:441</a></td><td>technically, this isn't supposed to happen, but it seems to sometimes. Some of the accounting is probably wrong in certain cases</td></tr><tr id="163" style="display: none;" colspan="3"><td colspan="3"><h2>technically, this isn't supposed to happen, but it seems to
│ │ │ │ -sometimes. Some of the accounting is probably wrong in certain
│ │ │ │ -cases</h2><h4>../src/http_seed_connection.cpp:441</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">					// cut out the chunk header from the receive buffer
│ │ │ │ -					TORRENT_ASSERT(m_chunk_pos + m_body_start &lt; INT_MAX);
│ │ │ │ -					m_recv_buffer.cut(header_size, t-&gt;block_size() + 1024, aux::numeric_cast&lt;int&gt;(m_chunk_pos + m_body_start));
│ │ │ │ -					recv_buffer = m_recv_buffer.get();
│ │ │ │ -					recv_buffer = recv_buffer.subspan(m_body_start);
│ │ │ │ -					m_chunk_pos += chunk_size;
│ │ │ │ -					if (chunk_size == 0)
│ │ │ │ -					{
│ │ │ │ -						TORRENT_ASSERT(m_recv_buffer.get().size() &lt; m_chunk_pos + m_body_start + 1
│ │ │ │ -							|| m_recv_buffer.get()[static_cast&lt;std::ptrdiff_t&gt;(m_chunk_pos + m_body_start)] == 'H'
│ │ │ │ -							|| (m_parser.chunked_encoding()
│ │ │ │ -								&amp;&amp; m_recv_buffer.get()[static_cast&lt;std::ptrdiff_t&gt;(m_chunk_pos + m_body_start)] == '\r'));
│ │ │ │ -						m_chunk_pos = -1;
│ │ │ │ -					}
│ │ │ │ -				}
│ │ │ │ -			}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(146)">../test/test_dht.cpp:3223</a></td><td>this won't work because the second node isn't pinged so it wont be added to the routing table</td></tr><tr id="146" style="display: none;" colspan="3"><td colspan="3"><h2>this won't work because the second node isn't pinged so it wont
│ │ │ │ +be added to the routing table</h2><h4>../test/test_dht.cpp:3223</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	bool ret = verify_message(request, get_item_desc_ro, parsed, error_string);
│ │ │ │  
│ │ │ │ -			int payload = int(bytes_transferred);
│ │ │ │ -			if (payload &gt; m_response_left) payload = int(m_response_left);
│ │ │ │ -			if (payload &gt; front_request.length) payload = front_request.length;
│ │ │ │ -<div style="background: #ffff00" width="100%">			if (payload &gt; outstanding_bytes()) payload = outstanding_bytes();
│ │ │ │ -</div>			received_bytes(payload, 0);
│ │ │ │ -			incoming_piece_fragment(payload);
│ │ │ │ -			m_response_left -= payload;
│ │ │ │ +	TEST_CHECK(ret);
│ │ │ │ +	TEST_EQUAL(parsed[3].int_value(), 1);
│ │ │ │  
│ │ │ │ -			if (m_parser.status_code() == 503)
│ │ │ │ -			{
│ │ │ │ -				if (!m_parser.finished()) return;
│ │ │ │ +	// should have one node now, which is 4.4.4.4:1234
│ │ │ │ +	TEST_EQUAL(std::get&lt;0&gt;(node.size()), 1);
│ │ │ │ +	// and no replacement nodes
│ │ │ │ +	TEST_EQUAL(std::get&lt;1&gt;(node.size()), 0);
│ │ │ │  
│ │ │ │ -				int retry_time = std::atoi(std::string(recv_buffer.begin(), recv_buffer.end()).c_str());
│ │ │ │ -				if (retry_time &lt;= 0) retry_time = 60;
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -				peer_log(peer_log_alert::info, "CONNECT", "retrying in %d seconds", retry_time);
│ │ │ │ -#endif
│ │ │ │ +	// now, disable read_only, try again.
│ │ │ │ +	g_sent_packets.clear();
│ │ │ │ +	sett.set_bool(settings_pack::dht_read_only, false);
│ │ │ │  
│ │ │ │ -				received_bytes(0, int(bytes_transferred));
│ │ │ │ -				// temporarily unavailable, retry later
│ │ │ │ -				t-&gt;retry_web_seed(this, seconds32(retry_time));
│ │ │ │ -				disconnect(error_code(m_parser.status_code(), http_category()), operation_t::bittorrent, failure);
│ │ │ │ -				return;
│ │ │ │ -			}
│ │ │ │ +	send_dht_request(node, "get", source, &amp;response);
│ │ │ │ +	// sender should be added to replacement bucket
│ │ │ │ +	TEST_EQUAL(std::get&lt;1&gt;(node.size()), 1);
│ │ │ │  
│ │ │ │ +	g_sent_packets.clear();
│ │ │ │ +#if 0
│ │ │ │ +<div style="background: #ffff00" width="100%">	target = generate_next();
│ │ │ │ +</div>	node.get_item(target, get_immutable_item_cb);
│ │ │ │  
│ │ │ │ -			// we only received the header, no data
│ │ │ │ -			if (recv_buffer.empty()) break;
│ │ │ │ +	// since we have 2 nodes, we should have two packets.
│ │ │ │ +	TEST_EQUAL(g_sent_packets.size(), 2);
│ │ │ │  
│ │ │ │ -			if (recv_buffer.size() &lt; front_request.length) break;
│ │ │ │ +	// both of them shouldn't have a 'ro' key.
│ │ │ │ +	node_from_entry(g_sent_packets.front().second, request);
│ │ │ │ +	ret = verify_message(request, get_item_desc_ro, parsed, error_string);
│ │ │ │  
│ │ │ │ -			// if the response is chunked, we need to receive the last
│ │ │ │ -			// terminating chunk and the tail headers before we can proceed
│ │ │ │ -			if (m_parser.chunked_encoding() &amp;&amp; m_chunk_pos &gt;= 0) break;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(164)">../src/session_impl.cpp:615</a></td><td>come up with some abstraction to do this for gnutls as well load certificates from the windows system certificate store</td></tr><tr id="164" style="display: none;" colspan="3"><td colspan="3"><h2>come up with some abstraction to do this for gnutls as well
│ │ │ │ -load certificates from the windows system certificate store</h2><h4>../src/session_impl.cpp:615</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		pause();
│ │ │ │ -	}
│ │ │ │ -#endif
│ │ │ │ +	TEST_CHECK(ret);
│ │ │ │ +	TEST_CHECK(!parsed[3]);
│ │ │ │  
│ │ │ │ -	// This function is called by the creating thread, not in the message loop's
│ │ │ │ -	// io_context thread.
│ │ │ │ -	void session_impl::start_session()
│ │ │ │ -	{
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		session_log("start session");
│ │ │ │ -#endif
│ │ │ │ +	node_from_entry(g_sent_packets.back().second, request);
│ │ │ │ +	ret = verify_message(request, get_item_desc_ro, parsed, error_string);
│ │ │ │  
│ │ │ │ -#if TORRENT_USE_SSL
│ │ │ │ -		error_code ec;
│ │ │ │ -		m_ssl_ctx.set_default_verify_paths(ec);
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		if (ec) session_log("SSL set_default verify_paths failed: %s", ec.message().c_str());
│ │ │ │ -		ec.clear();
│ │ │ │ +	TEST_CHECK(ret);
│ │ │ │ +	TEST_CHECK(!parsed[3]);
│ │ │ │  #endif
│ │ │ │ -#if defined TORRENT_WINDOWS &amp;&amp; defined TORRENT_USE_OPENSSL &amp;&amp; !defined TORRENT_WINRT
│ │ │ │ -<div style="background: #ffff00" width="100%">		X509_STORE* store = X509_STORE_new();
│ │ │ │ -</div>		if (store)
│ │ │ │ -		{
│ │ │ │ -			HCERTSTORE system_store = CertOpenSystemStoreA(0, "ROOT");
│ │ │ │ -			// this is best effort
│ │ │ │ -			if (system_store)
│ │ │ │ -			{
│ │ │ │ -				CERT_CONTEXT const* ctx = nullptr;
│ │ │ │ -				while ((ctx = CertEnumCertificatesInStore(system_store, ctx)) != nullptr)
│ │ │ │ -				{
│ │ │ │ -					unsigned char const* cert_ptr = reinterpret_cast&lt;unsigned char const*&gt;(ctx-&gt;pbCertEncoded);
│ │ │ │ -					X509* x509 = d2i_X509(nullptr, &amp;cert_ptr, ctx-&gt;cbCertEncoded);
│ │ │ │ -					// this is best effort
│ │ │ │ -					if (!x509) continue;
│ │ │ │ -					X509_STORE_add_cert(store, x509);
│ │ │ │ -					X509_free(x509);
│ │ │ │ -				}
│ │ │ │ -				CertFreeCertificateContext(ctx);
│ │ │ │ -				CertCloseStore(system_store, 0);
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -		SSL_CTX* ssl_ctx = m_ssl_ctx.native_handle();
│ │ │ │ -		SSL_CTX_set_cert_store(ssl_ctx, store);
│ │ │ │ -#endif
│ │ │ │ -#ifdef __APPLE__
│ │ │ │ -		m_ssl_ctx.load_verify_file("/etc/ssl/cert.pem", ec);
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		if (ec) session_log("SSL load_verify_file failed: %s", ec.message().c_str());
│ │ │ │ -		ec.clear();
│ │ │ │ -#endif
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(165)">../src/session_impl.cpp:1484</a></td><td>it would be nice to reserve() these vectors up front</td></tr><tr id="165" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to reserve() these vectors up front</h2><h4>../src/session_impl.cpp:1484</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			bandwidth_channel* ch = &amp;p-&gt;channel[peer_connection::download_channel];
│ │ │ │ -			if (use_quota_overhead(ch, amount_down))
│ │ │ │ -				ret |= 1 &lt;&lt; peer_connection::download_channel;
│ │ │ │ -			ch = &amp;p-&gt;channel[peer_connection::upload_channel];
│ │ │ │ -			if (use_quota_overhead(ch, amount_up))
│ │ │ │ -				ret |= 1 &lt;&lt; peer_connection::upload_channel;
│ │ │ │ -		}
│ │ │ │ -		return ret;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	// session_impl is responsible for deleting 'pack'
│ │ │ │ -	void session_impl::apply_settings_pack(std::shared_ptr&lt;settings_pack&gt; pack)
│ │ │ │ -	{
│ │ │ │ -		INVARIANT_CHECK;
│ │ │ │ -		apply_settings_pack_impl(*pack);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	settings_pack session_impl::get_settings() const
│ │ │ │ -	{
│ │ │ │ -		settings_pack ret;
│ │ │ │ -<div style="background: #ffff00" width="100%">		for (int i = settings_pack::string_type_base;
│ │ │ │ -</div>			i &lt; settings_pack::max_string_setting_internal; ++i)
│ │ │ │ -		{
│ │ │ │ -			ret.set_str(i, m_settings.get_str(i));
│ │ │ │ -		}
│ │ │ │ -		for (int i = settings_pack::int_type_base;
│ │ │ │ -			i &lt; settings_pack::max_int_setting_internal; ++i)
│ │ │ │ -		{
│ │ │ │ -			ret.set_int(i, m_settings.get_int(i));
│ │ │ │ -		}
│ │ │ │ -		for (int i = settings_pack::bool_type_base;
│ │ │ │ -			i &lt; settings_pack::max_bool_setting_internal; ++i)
│ │ │ │ -		{
│ │ │ │ -			ret.set_bool(i, m_settings.get_bool(i));
│ │ │ │ -		}
│ │ │ │ -		return ret;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -namespace {
│ │ │ │ -	template &lt;typename Pack&gt;
│ │ │ │ -	int get_setting_impl(Pack const&amp; p, int name, int*)
│ │ │ │ -	{ return p.get_int(name); }
│ │ │ │ -
│ │ │ │ -	template &lt;typename Pack&gt;
│ │ │ │ -	bool get_setting_impl(Pack const&amp; p, int name, bool*)
│ │ │ │ -	{ return p.get_bool(name); }
│ │ │ │ -
│ │ │ │ -	template &lt;typename Pack&gt;
│ │ │ │ -	std::string get_setting_impl(Pack const&amp; p, int name, std::string*)
│ │ │ │ -	{ return p.get_str(name); }
│ │ │ │ -
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(166)">../src/session_impl.cpp:1998</a></td><td>could this function be merged with expand_unspecified_addresses? right now both listen_endpoint_t and listen_interface_t are almost identical, maybe the latter could be removed too</td></tr><tr id="166" style="display: none;" colspan="3"><td colspan="3"><h2>could this function be merged with expand_unspecified_addresses?
│ │ │ │ -right now both listen_endpoint_t and listen_interface_t are almost
│ │ │ │ -identical, maybe the latter could be removed too</h2><h4>../src/session_impl.cpp:1998</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		session_log("FATAL SESSION ERROR (%s : %d) [%s]"
│ │ │ │ -			, ec.category().name(), ec.value(), ec.message().c_str());
│ │ │ │ -#endif
│ │ │ │ -		this-&gt;abort();
│ │ │ │ -	}
│ │ │ │ +// these tests rely on logging being enabled
│ │ │ │  
│ │ │ │ -	void session_impl::on_ip_change(error_code const&amp; ec)
│ │ │ │ -	{
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		if (!ec)
│ │ │ │ -			session_log("received ip change from internal ip_notifier");
│ │ │ │ -		else
│ │ │ │ -			session_log("received error on_ip_change: %d, %s", ec.value(), ec.message().c_str());
│ │ │ │ -#endif
│ │ │ │ -		if (ec || m_abort || !m_ip_notifier) return;
│ │ │ │ -		m_ip_notifier-&gt;async_wait([this] (error_code const&amp; e)
│ │ │ │ -			{ wrap(&amp;session_impl::on_ip_change, e); });
│ │ │ │ -		reopen_network_sockets({});
│ │ │ │ -	}
│ │ │ │ +TORRENT_TEST(invalid_error_msg)
│ │ │ │ +{
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(147)">../test/test_dht.cpp:4081</a></td><td>test obfuscated_get_peers</td></tr><tr id="147" style="display: none;" colspan="3"><td colspan="3"><h2>test obfuscated_get_peers</h2><h4>../test/test_dht.cpp:4081</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		TEST_CHECK(sm.has_quota());
│ │ │ │ +	});
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">	void interface_to_endpoints(listen_interface_t const&amp; iface
│ │ │ │ -</div>		, listen_socket_flags_t flags
│ │ │ │ -		, span&lt;ip_interface const&gt; const ifs
│ │ │ │ -		, std::vector&lt;listen_endpoint_t&gt;&amp; eps)
│ │ │ │ -	{
│ │ │ │ -		flags |= iface.local ? listen_socket_t::local_network : listen_socket_flags_t{};
│ │ │ │ -		transport const ssl = iface.ssl ? transport::ssl : transport::plaintext;
│ │ │ │ +TORRENT_TEST(rate_limit_accrue_limit)
│ │ │ │ +{
│ │ │ │ +	aux::session_settings sett;
│ │ │ │ +	sett.set_int(settings_pack::dht_upload_rate_limit, std::numeric_limits&lt;int&gt;::max());
│ │ │ │  
│ │ │ │ -		// First, check to see if it's an IP address
│ │ │ │ -		error_code err;
│ │ │ │ -		address const adr = make_address(iface.device.c_str(), err);
│ │ │ │ -		if (!err)
│ │ │ │ +	test_rate_limit(sett, [](lt::dht::socket_manager&amp; sm) {
│ │ │ │ +		TEST_CHECK(sm.has_quota());
│ │ │ │ +		for (int i = 0; i &lt; 10; ++i)
│ │ │ │  		{
│ │ │ │ -			eps.emplace_back(adr, iface.port, std::string{}, ssl, flags);
│ │ │ │ +			std::this_thread::sleep_for(milliseconds(500));
│ │ │ │ +			TEST_CHECK(sm.has_quota());
│ │ │ │  		}
│ │ │ │ -		else
│ │ │ │ -		{
│ │ │ │ -			flags |= listen_socket_t::was_expanded;
│ │ │ │ -
│ │ │ │ -			// this is the case where device names a network device. We need to
│ │ │ │ -			// enumerate all IPs associated with this device
│ │ │ │ -			for (auto const&amp; ipface : ifs)
│ │ │ │ -			{
│ │ │ │ -				// we're looking for a specific interface, and its address
│ │ │ │ -				// (which must be of the same family as the address we're
│ │ │ │ -				// connecting to)
│ │ │ │ -				if (iface.device != ipface.name) continue;
│ │ │ │ +	});
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -				bool const local = iface.local
│ │ │ │ -					|| ipface.interface_address.is_loopback()
│ │ │ │ -					|| is_link_local(ipface.interface_address);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(167)">../src/session_impl.cpp:2306</a></td><td>it would probably be better to do this by having a listen-socket "version" number that gets bumped. And instead of setting a bool to disable a tracker, we set the version number that it was disabled at. This change would affect the ABI in 1.2, so should be done in 2.0 or later</td></tr><tr id="167" style="display: none;" colspan="3"><td colspan="3"><h2>it would probably be better to do this by having a
│ │ │ │ -listen-socket "version" number that gets bumped. And instead of
│ │ │ │ -setting a bool to disable a tracker, we set the version number that
│ │ │ │ -it was disabled at. This change would affect the ABI in 1.2, so
│ │ │ │ -should be done in 2.0 or later</h2><h4>../src/session_impl.cpp:2306</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		{
│ │ │ │ -			for (auto const&amp; s : m_listen_sockets)
│ │ │ │ -				remap_ports(remap_natpmp_and_upnp, *s);
│ │ │ │ -		}
│ │ │ │ -		else
│ │ │ │ -		{
│ │ │ │ -			// new sockets need to map ports even if the caller did not request
│ │ │ │ -			// re-mapping
│ │ │ │ -			for (auto const&amp; s : new_sockets)
│ │ │ │ -				remap_ports(remap_natpmp_and_upnp, *s);
│ │ │ │ -		}
│ │ │ │  
│ │ │ │ -		update_lsd();
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>#else
│ │ │ │ +TORRENT_TEST(dht)
│ │ │ │ +{
│ │ │ │ +	// dummy dht test
│ │ │ │ +	TEST_CHECK(true);
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -#if TORRENT_USE_I2P
│ │ │ │ -		open_new_incoming_i2p_connection();
│ │ │ │  #endif
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(148)">../test/test_file_storage.cpp:1208</a></td><td>test file attributes</td></tr><tr id="148" style="display: none;" colspan="3"><td colspan="3"><h2>test file attributes</h2><h4>../test/test_file_storage.cpp:1208</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(149)">../test/test_file_storage.cpp:1209</a></td><td>test symlinks</td></tr><tr id="149" style="display: none;" colspan="3"><td colspan="3"><h2>test symlinks</h2><h4>../test/test_file_storage.cpp:1209</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(150)">../test/test_timestamp_history.cpp:54</a></td><td>test the case where we have > 120 samples (and have the base delay actually be updated)</td></tr><tr id="150" style="display: none;" colspan="3"><td colspan="3"><h2>test the case where we have > 120 samples (and have the base delay actually be updated)</h2><h4>../test/test_timestamp_history.cpp:54</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(151)">../test/test_timestamp_history.cpp:55</a></td><td>test the case where a sample is lower than the history entry but not lower than the base</td></tr><tr id="151" style="display: none;" colspan="3"><td colspan="3"><h2>test the case where a sample is lower than the history entry but not lower than the base</h2><h4>../test/test_timestamp_history.cpp:55</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include "libtorrent/aux_/timestamp_history.hpp"
│ │ │ │  
│ │ │ │ -		// trackers that were not reachable, may have become reachable now.
│ │ │ │ -		// so clear the "disabled" flags to let them be tried one more time
│ │ │ │ -<div style="background: #ffff00" width="100%">		for (auto&amp; t : m_torrents)
│ │ │ │ -</div>			t-&gt;enable_all_trackers();
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void session_impl::reopen_network_sockets(reopen_network_flags_t const options)
│ │ │ │ -	{
│ │ │ │ -		reopen_listen_sockets(bool(options &amp; session_handle::reopen_map_ports));
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	namespace {
│ │ │ │ -		template &lt;typename MapProtocol, typename ProtoType, typename EndpointType&gt;
│ │ │ │ -		void map_port(MapProtocol&amp; m, ProtoType protocol, EndpointType const&amp; ep
│ │ │ │ -			, port_mapping_t&amp; map_handle, std::string const&amp; device)
│ │ │ │ -		{
│ │ │ │ -			if (map_handle != port_mapping_t{-1}) m.delete_mapping(map_handle);
│ │ │ │ -			map_handle = port_mapping_t{-1};
│ │ │ │ -
│ │ │ │ -			address const addr = ep.address();
│ │ │ │ -			// with IPv4 the interface might be behind NAT so we can't skip them
│ │ │ │ -			// based on the scope of the local address
│ │ │ │ -			if (addr.is_v6() &amp;&amp; is_local(addr))
│ │ │ │ -				return;
│ │ │ │ -
│ │ │ │ -			// only update this mapping if we actually have a socket listening
│ │ │ │ -			if (ep != EndpointType())
│ │ │ │ -				map_handle = m.add_mapping(protocol, ep.port(), ep, device);
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void session_impl::remap_ports(remap_port_mask_t const mask
│ │ │ │ -		, listen_socket_t&amp; s)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(168)">../src/session_impl.cpp:2866</a></td><td>this size need to be capped</td></tr><tr id="168" style="display: none;" colspan="3"><td colspan="3"><h2>this size need to be capped</h2><h4>../src/session_impl.cpp:2866</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				// handshaking
│ │ │ │ -				return socket_type(ssl_stream&lt;tcp::socket&gt;(tcp::socket(std::move(s)), m_peer_ssl_ctx));
│ │ │ │ -			}
│ │ │ │ -			else
│ │ │ │ -#endif
│ │ │ │ -			{
│ │ │ │ -				return socket_type(tcp::socket(std::move(s)));
│ │ │ │ -			}
│ │ │ │ -		}();
│ │ │ │ +TORRENT_TEST(timestamp_history)
│ │ │ │ +{
│ │ │ │ +	using namespace lt;
│ │ │ │  
│ │ │ │ -#ifdef TORRENT_SSL_PEERS
│ │ │ │ -		TORRENT_ASSERT((ssl == transport::ssl) == is_ssl(c));
│ │ │ │ -#endif
│ │ │ │ +	aux::timestamp_history h;
│ │ │ │ +	TEST_EQUAL(h.add_sample(0x32, false), 0);
│ │ │ │ +	TEST_EQUAL(h.base(), 0x32);
│ │ │ │ +	TEST_EQUAL(h.add_sample(0x33, false), 0x1);
│ │ │ │ +	TEST_EQUAL(h.base(), 0x32);
│ │ │ │ +	TEST_EQUAL(h.add_sample(0x3433, false), 0x3401);
│ │ │ │ +	TEST_EQUAL(h.base(), 0x32);
│ │ │ │ +	TEST_EQUAL(h.add_sample(0x30, false), 0);
│ │ │ │ +	TEST_EQUAL(h.base(), 0x30);
│ │ │ │  
│ │ │ │ -#ifdef TORRENT_SSL_PEERS
│ │ │ │ -		if (ssl == transport::ssl)
│ │ │ │ -		{
│ │ │ │ -			TORRENT_ASSERT(is_ssl(c));
│ │ │ │ +	// test that wrapping of the timestamp is properly handled
│ │ │ │ +	h.add_sample(0xfffffff3, false);
│ │ │ │ +	TEST_EQUAL(h.base(), 0xfffffff3);
│ │ │ │  
│ │ │ │ -			// save the socket so we can cancel the handshake
│ │ │ │ -<div style="background: #ffff00" width="100%">			auto iter = m_incoming_sockets.emplace(std::make_unique&lt;socket_type&gt;(std::move(c))).first;
│ │ │ │ +<div style="background: #ffff00" width="100%">}
│ │ │ │  </div>
│ │ │ │ -			auto sock = iter-&gt;get();
│ │ │ │ -			// for SSL connections, incoming_connection() is called
│ │ │ │ -			// after the handshake is done
│ │ │ │ -			ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");
│ │ │ │ -			boost::get&lt;ssl_stream&lt;tcp::socket&gt;&gt;(**iter).async_accept_handshake(
│ │ │ │ -				[this, sock] (error_code const&amp; err) { ssl_handshake(err, sock); });
│ │ │ │ -		}
│ │ │ │ -		else
│ │ │ │ -#endif
│ │ │ │ -		{
│ │ │ │ -			incoming_connection(std::move(c));
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -#ifdef TORRENT_SSL_PEERS
│ │ │ │ -
│ │ │ │ -	void session_impl::on_incoming_utp_ssl(socket_type s)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_ssl(s));
│ │ │ │ -
│ │ │ │ -		// save the socket so we can cancel the handshake
│ │ │ │ -
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(169)">../src/session_impl.cpp:2891</a></td><td>this size need to be capped</td></tr><tr id="169" style="display: none;" colspan="3"><td colspan="3"><h2>this size need to be capped</h2><h4>../src/session_impl.cpp:2891</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			// after the handshake is done
│ │ │ │ -			ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");
│ │ │ │ -			boost::get&lt;ssl_stream&lt;tcp::socket&gt;&gt;(**iter).async_accept_handshake(
│ │ │ │ -				[this, sock] (error_code const&amp; err) { ssl_handshake(err, sock); });
│ │ │ │ -		}
│ │ │ │ -		else
│ │ │ │ -#endif
│ │ │ │ -		{
│ │ │ │ -			incoming_connection(std::move(c));
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -#ifdef TORRENT_SSL_PEERS
│ │ │ │ -
│ │ │ │ -	void session_impl::on_incoming_utp_ssl(socket_type s)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_ssl(s));
│ │ │ │ -
│ │ │ │ -		// save the socket so we can cancel the handshake
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		auto iter = m_incoming_sockets.emplace(std::make_unique&lt;socket_type&gt;(std::move(s))).first;
│ │ │ │ -</div>		auto sock = iter-&gt;get();
│ │ │ │ -
│ │ │ │ -		// for SSL connections, incoming_connection() is called
│ │ │ │ -		// after the handshake is done
│ │ │ │ -		ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");
│ │ │ │ -		boost::get&lt;ssl_stream&lt;utp_stream&gt;&gt;(**iter).async_accept_handshake(
│ │ │ │ -			[this, sock] (error_code const&amp; err) { ssl_handshake(err, sock); });
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	// to test SSL connections, one can use this openssl command template:
│ │ │ │ -	//
│ │ │ │ -	// openssl s_client -cert &lt;client-cert&gt;.pem -key &lt;client-private-key&gt;.pem
│ │ │ │ -	//   -CAfile &lt;torrent-cert&gt;.pem  -debug -connect 127.0.0.1:4433 -tls1
│ │ │ │ -	//   -servername &lt;hex-encoded-info-hash&gt;
│ │ │ │ -
│ │ │ │ -	void session_impl::ssl_handshake(error_code const&amp; ec, socket_type* sock)
│ │ │ │ -	{
│ │ │ │ -		COMPLETE_ASYNC("session_impl::ssl_handshake");
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(152)">../test/test_transfer.cpp:173</a></td><td>these settings_pack tests belong in their own test</td></tr><tr id="152" style="display: none;" colspan="3"><td colspan="3"><h2>these settings_pack tests belong in their own test</h2><h4>../test/test_transfer.cpp:173</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	// to the time it will take to complete the test
│ │ │ │ +	pack.set_int(settings_pack::min_reconnect_time, 0);
│ │ │ │ +	pack.set_int(settings_pack::stop_tracker_timeout, 1);
│ │ │ │ +	pack.set_bool(settings_pack::announce_to_all_trackers, true);
│ │ │ │ +	pack.set_bool(settings_pack::announce_to_all_tiers, true);
│ │ │ │  
│ │ │ │ -		auto iter = m_incoming_sockets.find(sock);
│ │ │ │ +	// make sure we announce to both http and udp trackers
│ │ │ │ +	pack.set_bool(settings_pack::prefer_udp_trackers, false);
│ │ │ │ +	pack.set_bool(settings_pack::enable_outgoing_utp, false);
│ │ │ │ +	pack.set_bool(settings_pack::enable_incoming_utp, false);
│ │ │ │ +	pack.set_bool(settings_pack::enable_lsd, false);
│ │ │ │ +	pack.set_bool(settings_pack::enable_natpmp, false);
│ │ │ │ +	pack.set_bool(settings_pack::enable_upnp, false);
│ │ │ │ +	pack.set_bool(settings_pack::enable_dht, false);
│ │ │ │  
│ │ │ │ -		// this happens if the SSL connection is aborted because we're shutting
│ │ │ │ -		// down
│ │ │ │ -		if (iter == m_incoming_sockets.end()) return;
│ │ │ │ +	pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);
│ │ │ │ +	pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_disabled);
│ │ │ │  
│ │ │ │ -		socket_type s(std::move(**iter));
│ │ │ │ -		TORRENT_ASSERT(is_ssl(s));
│ │ │ │ -		m_incoming_sockets.erase(iter);
│ │ │ │ +	pack.set_bool(settings_pack::allow_multiple_connections_per_ip, false);
│ │ │ │  
│ │ │ │ -		error_code e;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(170)">../src/session_impl.cpp:3590</a></td><td>have a separate list for these connections, instead of having to loop through all of them</td></tr><tr id="170" style="display: none;" colspan="3"><td colspan="3"><h2>have a separate list for these connections, instead of having to loop through all of them</h2><h4>../src/session_impl.cpp:3590</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// --------------------------------------------------------------
│ │ │ │ -		if (!m_paused) m_auto_manage_time_scaler--;
│ │ │ │ -		if (m_auto_manage_time_scaler &lt; 0)
│ │ │ │ -		{
│ │ │ │ -			m_auto_manage_time_scaler = settings().get_int(settings_pack::auto_manage_interval);
│ │ │ │ -			recalculate_auto_managed_torrents();
│ │ │ │ -		}
│ │ │ │ +<div style="background: #ffff00" width="100%">	pack.set_int(settings_pack::unchoke_slots_limit, 0);
│ │ │ │ +</div>	ses1.apply_settings(pack);
│ │ │ │ +	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == 0);
│ │ │ │  
│ │ │ │ -		// --------------------------------------------------------------
│ │ │ │ -		// check for incoming connections that might have timed out
│ │ │ │ -		// --------------------------------------------------------------
│ │ │ │ +	pack.set_int(settings_pack::unchoke_slots_limit, -1);
│ │ │ │ +	ses1.apply_settings(pack);
│ │ │ │ +	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == -1);
│ │ │ │  
│ │ │ │ -		for (auto i = m_connections.begin(); i != m_connections.end();)
│ │ │ │ -		{
│ │ │ │ -			peer_connection* p = (*i).get();
│ │ │ │ -			++i;
│ │ │ │ -			// ignore connections that already have a torrent, since they
│ │ │ │ -			// are ticked through the torrents' second_tick
│ │ │ │ -			if (!p-&gt;associated_torrent().expired()) continue;
│ │ │ │ +	pack.set_int(settings_pack::unchoke_slots_limit, 8);
│ │ │ │ +	ses1.apply_settings(pack);
│ │ │ │ +	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == 8);
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">			int timeout = m_settings.get_int(settings_pack::handshake_timeout);
│ │ │ │ -</div>#if TORRENT_USE_I2P
│ │ │ │ -			timeout *= is_i2p(p-&gt;get_socket()) ? 4 : 1;
│ │ │ │ -#endif
│ │ │ │ -			if (m_last_tick - p-&gt;connected_time () &gt; seconds(timeout))
│ │ │ │ -				p-&gt;disconnect(errors::timed_out, operation_t::bittorrent);
│ │ │ │ -		}
│ │ │ │ +	ses2.apply_settings(pack);
│ │ │ │  
│ │ │ │ -		// --------------------------------------------------------------
│ │ │ │ -		// second_tick every torrent (that wants it)
│ │ │ │ -		// --------------------------------------------------------------
│ │ │ │ +	torrent_handle tor1;
│ │ │ │ +	torrent_handle tor2;
│ │ │ │  
│ │ │ │ -#if TORRENT_DEBUG_STREAMING &gt; 0
│ │ │ │ -		std::printf("\033[2J\033[0;0H");
│ │ │ │ -#endif
│ │ │ │ +	create_directory("tmp1_transfer", ec);
│ │ │ │ +	std::ofstream file("tmp1_transfer/temporary");
│ │ │ │ +	std::shared_ptr&lt;torrent_info&gt; t = ::create_torrent(&amp;file, "temporary", 32 * 1024, 13, false);
│ │ │ │ +	file.close();
│ │ │ │  
│ │ │ │ -		aux::vector&lt;torrent*&gt;&amp; want_tick = m_torrent_lists[torrent_want_tick];
│ │ │ │ -		for (int i = 0; i &lt; int(want_tick.size()); ++i)
│ │ │ │ -		{
│ │ │ │ -			torrent&amp; t = *want_tick[i];
│ │ │ │ -			TORRENT_ASSERT(t.want_tick());
│ │ │ │ -			TORRENT_ASSERT(!t.is_aborted());
│ │ │ │ +	TEST_CHECK(exists(combine_path("tmp1_transfer", "temporary")));
│ │ │ │  
│ │ │ │ -			t.second_tick(tick_interval_ms);
│ │ │ │ +	add_torrent_params params;
│ │ │ │ +	params.storage_mode = storage_mode;
│ │ │ │ +	params.flags &amp;= ~torrent_flags::paused;
│ │ │ │ +	params.flags &amp;= ~torrent_flags::auto_managed;
│ │ │ │  
│ │ │ │ -			// if the call to second_tick caused the torrent
│ │ │ │ -			// to no longer want to be ticked (i.e. it was
│ │ │ │ -			// removed from the list) we need to back up the counter
│ │ │ │ -			// to not miss the torrent after it
│ │ │ │ -			if (!t.want_tick()) --i;
│ │ │ │ -		}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(171)">../src/session_impl.cpp:3623</a></td><td>this should apply to all bandwidth channels</td></tr><tr id="171" style="display: none;" colspan="3"><td colspan="3"><h2>this should apply to all bandwidth channels</h2><h4>../src/session_impl.cpp:3623</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#if TORRENT_DEBUG_STREAMING &gt; 0
│ │ │ │ -		std::printf("\033[2J\033[0;0H");
│ │ │ │ -#endif
│ │ │ │ +	wait_for_listen(ses1, "ses1");
│ │ │ │ +	wait_for_listen(ses2, "ses2");
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(153)">../src/storage_utils.cpp:230</a></td><td>ideally, if we end up copying files because of a move across volumes, the source should not be deleted until they've all been copied. That would let us rollback with higher confidence.</td></tr><tr id="153" style="display: none;" colspan="3"><td colspan="3"><h2>ideally, if we end up copying files because of a move across
│ │ │ │ +volumes, the source should not be deleted until they've all been
│ │ │ │ +copied. That would let us rollback with higher confidence.</h2><h4>../src/storage_utils.cpp:230</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// later
│ │ │ │ +		aux::vector&lt;bool, file_index_t&gt; copied_files(std::size_t(f.num_files()), false);
│ │ │ │  
│ │ │ │ -		aux::vector&lt;torrent*&gt;&amp; want_tick = m_torrent_lists[torrent_want_tick];
│ │ │ │ -		for (int i = 0; i &lt; int(want_tick.size()); ++i)
│ │ │ │ +		// track how far we got in case of an error
│ │ │ │ +		file_index_t file_index{};
│ │ │ │ +		for (auto const i : f.file_range())
│ │ │ │  		{
│ │ │ │ -			torrent&amp; t = *want_tick[i];
│ │ │ │ -			TORRENT_ASSERT(t.want_tick());
│ │ │ │ -			TORRENT_ASSERT(!t.is_aborted());
│ │ │ │ -
│ │ │ │ -			t.second_tick(tick_interval_ms);
│ │ │ │ -
│ │ │ │ -			// if the call to second_tick caused the torrent
│ │ │ │ -			// to no longer want to be ticked (i.e. it was
│ │ │ │ -			// removed from the list) we need to back up the counter
│ │ │ │ -			// to not miss the torrent after it
│ │ │ │ -			if (!t.want_tick()) --i;
│ │ │ │ -		}
│ │ │ │ +			// files moved out to absolute paths are not moved
│ │ │ │ +			if (f.file_absolute_path(i)) continue;
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">		if (m_settings.get_bool(settings_pack::rate_limit_ip_overhead))
│ │ │ │ -</div>		{
│ │ │ │ -			int const up_limit = upload_rate_limit(m_global_class);
│ │ │ │ -			int const down_limit = download_rate_limit(m_global_class);
│ │ │ │ +			std::string const old_path = combine_path(save_path, f.file_path(i));
│ │ │ │ +			std::string const new_path = combine_path(new_save_path, f.file_path(i));
│ │ │ │  
│ │ │ │ -			if (down_limit &gt; 0
│ │ │ │ -				&amp;&amp; m_stat.download_ip_overhead() &gt;= down_limit
│ │ │ │ -				&amp;&amp; m_alerts.should_post&lt;performance_alert&gt;())
│ │ │ │ +			error_code ignore;
│ │ │ │ +			if (flags == move_flags_t::dont_replace &amp;&amp; exists(new_path, ignore))
│ │ │ │  			{
│ │ │ │ -				m_alerts.emplace_alert&lt;performance_alert&gt;(torrent_handle()
│ │ │ │ -					, performance_alert::download_limit_too_low);
│ │ │ │ +				if (ret == status_t::no_error) ret = status_t::need_full_check;
│ │ │ │ +				continue;
│ │ │ │  			}
│ │ │ │  
│ │ │ │ -			if (up_limit &gt; 0
│ │ │ │ -				&amp;&amp; m_stat.upload_ip_overhead() &gt;= up_limit
│ │ │ │ -				&amp;&amp; m_alerts.should_post&lt;performance_alert&gt;())
│ │ │ │ +<div style="background: #ffff00" width="100%">			move_file(old_path, new_path, ec);
│ │ │ │ +</div>
│ │ │ │ +			// if the source file doesn't exist. That's not a problem
│ │ │ │ +			// we just ignore that file
│ │ │ │ +			if (ec.ec == boost::system::errc::no_such_file_or_directory)
│ │ │ │ +				ec.ec.clear();
│ │ │ │ +			else if (ec
│ │ │ │ +				&amp;&amp; ec.ec != boost::system::errc::invalid_argument
│ │ │ │ +				&amp;&amp; ec.ec != boost::system::errc::permission_denied)
│ │ │ │  			{
│ │ │ │ -				m_alerts.emplace_alert&lt;performance_alert&gt;(torrent_handle()
│ │ │ │ -					, performance_alert::upload_limit_too_low);
│ │ │ │ +				// moving the file failed
│ │ │ │ +				// on OSX, the error when trying to rename a file across different
│ │ │ │ +				// volumes is EXDEV, which will make it fall back to copying.
│ │ │ │ +				ec.ec.clear();
│ │ │ │ +				copy_file(old_path, new_path, ec);
│ │ │ │ +				if (!ec) copied_files[i] = true;
│ │ │ │  			}
│ │ │ │ -		}
│ │ │ │  
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ -		m_peak_up_rate = std::max(m_stat.upload_rate(), m_peak_up_rate);
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		m_stat.second_tick(tick_interval_ms);
│ │ │ │ -
│ │ │ │ -		// --------------------------------------------------------------
│ │ │ │ -		// scrape paused torrents that are auto managed
│ │ │ │ -		// (unless the session is paused)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(172)">../src/session_impl.cpp:4314</a></td><td>use a lower limit than m_settings.connections_limit to allocate the to 10% or so of connection slots for incoming connections cap this at max - 1, since we may add one below</td></tr><tr id="172" style="display: none;" colspan="3"><td colspan="3"><h2>use a lower limit than m_settings.connections_limit
│ │ │ │ -to allocate the to 10% or so of connection slots for incoming
│ │ │ │ -connections
│ │ │ │ -cap this at max - 1, since we may add one below</h2><h4>../src/session_impl.cpp:4314</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// boost, which are done immediately on a tracker response. These
│ │ │ │ -		// connections needs to be deducted from the regular connection attempt
│ │ │ │ -		// quota for this tick
│ │ │ │ -		if (m_boost_connections &gt; 0)
│ │ │ │ -		{
│ │ │ │ -			if (m_boost_connections &gt; max_connections)
│ │ │ │ -			{
│ │ │ │ -				m_boost_connections -= max_connections;
│ │ │ │ -				max_connections = 0;
│ │ │ │ -			}
│ │ │ │ -			else
│ │ │ │ +			if (ec)
│ │ │ │  			{
│ │ │ │ -				max_connections -= m_boost_connections;
│ │ │ │ -				m_boost_connections = 0;
│ │ │ │ +				ec.file(i);
│ │ │ │ +				file_index = i;
│ │ │ │ +				break;
│ │ │ │  			}
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -		// zero connections speeds are allowed, we just won't make any connections
│ │ │ │ -		if (max_connections &lt;= 0) return;
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		int const limit = std::min(m_settings.get_int(settings_pack::connections_limit)
│ │ │ │ -</div>			- num_connections(), std::numeric_limits&lt;int&gt;::max() - 1);
│ │ │ │ -
│ │ │ │ -		// this logic is here to smooth out the number of new connection
│ │ │ │ -		// attempts over time, to prevent connecting a large number of
│ │ │ │ -		// sockets, wait 10 seconds, and then try again
│ │ │ │ -		if (m_settings.get_bool(settings_pack::smooth_connects) &amp;&amp; max_connections &gt; (limit+1) / 2)
│ │ │ │ -			max_connections = (limit + 1) / 2;
│ │ │ │ -
│ │ │ │ -		aux::vector&lt;torrent*&gt;&amp; want_peers_download = m_torrent_lists[torrent_want_peers_download];
│ │ │ │ -		aux::vector&lt;torrent*&gt;&amp; want_peers_finished = m_torrent_lists[torrent_want_peers_finished];
│ │ │ │ -
│ │ │ │ -		// if no torrent want any peers, just return
│ │ │ │ -		if (want_peers_download.empty() &amp;&amp; want_peers_finished.empty()) return;
│ │ │ │ -
│ │ │ │ -		// if we don't have any connection attempt quota, return
│ │ │ │ -		if (max_connections &lt;= 0) return;
│ │ │ │ -
│ │ │ │ -		int steps_since_last_connect = 0;
│ │ │ │ -		int const num_torrents = int(want_peers_finished.size() + want_peers_download.size());
│ │ │ │ -		for (;;)
│ │ │ │ +		if (!ec &amp;&amp; move_partfile)
│ │ │ │  		{
│ │ │ │ -			if (m_next_downloading_connect_torrent &gt;= int(want_peers_download.size()))
│ │ │ │ -				m_next_downloading_connect_torrent = 0;
│ │ │ │ -
│ │ │ │ -			if (m_next_finished_connect_torrent &gt;= int(want_peers_finished.size()))
│ │ │ │ -				m_next_finished_connect_torrent = 0;
│ │ │ │ +			error_code e;
│ │ │ │ +			move_partfile(new_save_path, e);
│ │ │ │ +			if (e)
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(154)">../src/storage_utils.cpp:538</a></td><td>it would seem reasonable to, instead, set the have_pieces bits for the pieces representing these files, and resume with the normal logic</td></tr><tr id="154" style="display: none;" colspan="3"><td colspan="3"><h2>it would seem reasonable to, instead, set the have_pieces bits
│ │ │ │ +for the pieces representing these files, and resume with the normal
│ │ │ │ +logic</h2><h4>../src/storage_utils.cpp:538</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">					continue;
│ │ │ │  
│ │ │ │ -			torrent* t = nullptr;
│ │ │ │ -			// there are prioritized torrents. Pick one of those
│ │ │ │ -			while (!m_prio_torrents.empty())
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(173)">../src/session_impl.cpp:4459</a></td><td>post a message to have this happen immediately instead of waiting for the next tick</td></tr><tr id="173" style="display: none;" colspan="3"><td colspan="3"><h2>post a message to have this happen
│ │ │ │ -immediately instead of waiting for the next tick</h2><h4>../src/session_impl.cpp:4459</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				continue;
│ │ │ │ -			}
│ │ │ │ +				std::int64_t const size = get_filesize(stat, file_index, fs
│ │ │ │ +					, save_path, ec);
│ │ │ │ +				if (size &lt; 0) return false;
│ │ │ │  
│ │ │ │ -			if (!p-&gt;is_peer_interested()
│ │ │ │ -				|| p-&gt;is_disconnecting()
│ │ │ │ -				|| p-&gt;is_connecting())
│ │ │ │ -			{
│ │ │ │ -				// this peer is not unchokable. So, if it's unchoked
│ │ │ │ -				// already, make sure to choke it.
│ │ │ │ -				if (p-&gt;is_choked())
│ │ │ │ +				if (size &lt; fs.file_size(file_index))
│ │ │ │  				{
│ │ │ │ -					p-&gt;reset_choke_counters();
│ │ │ │ -					continue;
│ │ │ │ +					ec.ec = errors::mismatching_file_size;
│ │ │ │ +					ec.file(file_index);
│ │ │ │ +					ec.operation = operation_t::check_resume;
│ │ │ │ +					return false;
│ │ │ │  				}
│ │ │ │ -				if (pi &amp;&amp; pi-&gt;optimistically_unchoked)
│ │ │ │ -				{
│ │ │ │ -					m_stats_counters.inc_stats_counter(counters::num_peers_up_unchoked_optimistic, -1);
│ │ │ │ -					pi-&gt;optimistically_unchoked = false;
│ │ │ │ -					// force a new optimistic unchoke
│ │ │ │ -					m_optimistic_unchoke_time_scaler = 0;
│ │ │ │ -<div style="background: #ffff00" width="100%">				}
│ │ │ │ -</div>				t-&gt;choke_peer(*p);
│ │ │ │ -				p-&gt;reset_choke_counters();
│ │ │ │ -				continue;
│ │ │ │  			}
│ │ │ │ -
│ │ │ │ -			peers.push_back(p.get());
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		int const allowed_upload_slots = unchoke_sort(peers
│ │ │ │ -			, unchoke_interval, m_settings);
│ │ │ │ -
│ │ │ │ -		if (m_settings.get_int(settings_pack::choking_algorithm) == settings_pack::fixed_slots_choker)
│ │ │ │ -		{
│ │ │ │ -			int const upload_slots = get_int_setting(settings_pack::unchoke_slots_limit);
│ │ │ │ -			m_stats_counters.set_value(counters::num_unchoke_slots, upload_slots);
│ │ │ │ -		}
│ │ │ │ -		else
│ │ │ │ -		{
│ │ │ │ -			m_stats_counters.set_value(counters::num_unchoke_slots
│ │ │ │ -				, allowed_upload_slots);
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		if (should_log())
│ │ │ │ -		{
│ │ │ │ -			session_log("RECALCULATE UNCHOKE SLOTS: [ peers: %d "
│ │ │ │ -				"eligible-peers: %d"
│ │ │ │ -				" allowed-slots: %d ]"
│ │ │ │ -				, int(m_connections.size())
│ │ │ │ -				, int(peers.size())
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(174)">../src/session_impl.cpp:4786</a></td><td>it might be a nice feature here to limit the number of torrents to send in a single update. By just posting the first n torrents, they would nicely be round-robined because the torrent lists are always pushed back. Perhaps the status_update_alert could even have a fixed array of n entries rather than a vector, to further improve memory locality.</td></tr><tr id="174" style="display: none;" colspan="3"><td colspan="3"><h2>it might be a nice feature here to limit the number of torrents
│ │ │ │ -to send in a single update. By just posting the first n torrents, they
│ │ │ │ -would nicely be round-robined because the torrent lists are always
│ │ │ │ -pushed back. Perhaps the status_update_alert could even have a fixed
│ │ │ │ -array of n entries rather than a vector, to further improve memory
│ │ │ │ -locality.</h2><h4>../src/session_impl.cpp:4786</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			t-&gt;status(&amp;st, flags);
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void session_impl::post_torrent_updates(status_flags_t const flags)
│ │ │ │ -	{
│ │ │ │ -		INVARIANT_CHECK;
│ │ │ │ -
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -
│ │ │ │ -		std::vector&lt;torrent*&gt;&amp; state_updates
│ │ │ │ -			= m_torrent_lists[aux::session_impl::torrent_state_updates];
│ │ │ │ -
│ │ │ │ -#if TORRENT_USE_ASSERTS
│ │ │ │ -		m_posting_torrent_updates = true;
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		std::vector&lt;torrent_status&gt; status;
│ │ │ │ -		status.reserve(state_updates.size());
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		for (auto&amp; t : state_updates)
│ │ │ │ -</div>		{
│ │ │ │ -			TORRENT_ASSERT(t-&gt;m_links[aux::session_impl::torrent_state_updates].in_list());
│ │ │ │ -			status.emplace_back();
│ │ │ │ -			// querying accurate download counters may require
│ │ │ │ -			// the torrent to be loaded. Loading a torrent, and evicting another
│ │ │ │ -			// one will lead to calling state_updated(), which screws with
│ │ │ │ -			// this list while we're working on it, and break things
│ │ │ │ -			t-&gt;status(&amp;status.back(), flags);
│ │ │ │ -			t-&gt;clear_in_state_update();
│ │ │ │ -		}
│ │ │ │ -		state_updates.clear();
│ │ │ │ -
│ │ │ │ -#if TORRENT_USE_ASSERTS
│ │ │ │ -		m_posting_torrent_updates = false;
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		m_alerts.emplace_alert&lt;state_update_alert&gt;(std::move(status));
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void session_impl::post_session_stats()
│ │ │ │ -	{
│ │ │ │ -		if (!m_posted_stats_header)
│ │ │ │ -		{
│ │ │ │ -			m_posted_stats_header = true;
│ │ │ │ -			m_alerts.emplace_alert&lt;session_stats_header_alert&gt;();
│ │ │ │ -		}
│ │ │ │ -		m_disk_thread-&gt;update_stats_counters(m_stats_counters);
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_DHT
│ │ │ │ -		if (m_dht)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(175)">../src/session_impl.cpp:5161</a></td><td>factor out this logic into a separate function for unit testing</td></tr><tr id="175" style="display: none;" colspan="3"><td colspan="3"><h2>factor out this logic into a separate function for unit
│ │ │ │ -testing</h2><h4>../src/session_impl.cpp:5161</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		if (m_settings.get_int(settings_pack::outgoing_port) &gt; 0)
│ │ │ │ -		{
│ │ │ │ -#ifdef TORRENT_WINDOWS
│ │ │ │ -			s.set_option(exclusive_address_use(true), ec);
│ │ │ │ -#else
│ │ │ │ -			s.set_option(tcp::acceptor::reuse_address(true), ec);
│ │ │ │ -#endif
│ │ │ │ -			// ignore errors because the underlying socket may not
│ │ │ │ -			// be opened yet. This happens when we're routing through
│ │ │ │ -			// a proxy. In that case, we don't yet know the address of
│ │ │ │ -			// the proxy server, and more importantly, we don't know
│ │ │ │ -			// the address family of its address. This means we can't
│ │ │ │ -			// open the socket yet. The socks abstraction layer defers
│ │ │ │ -			// opening it.
│ │ │ │ -			ec.clear();
│ │ │ │ -			bind_ep.port(std::uint16_t(next_port()));
│ │ │ │ +			return true;
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -		if (is_utp(s))
│ │ │ │ -		{
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>			utp_socket_impl* impl = nullptr;
│ │ │ │ -			transport ssl = transport::plaintext;
│ │ │ │ -#if TORRENT_USE_SSL
│ │ │ │ -			if (boost::get&lt;ssl_stream&lt;utp_stream&gt;&gt;(&amp;s) != nullptr)
│ │ │ │ -			{
│ │ │ │ -				impl = boost::get&lt;ssl_stream&lt;utp_stream&gt;&gt;(s).next_layer().get_impl();
│ │ │ │ -				ssl = transport::ssl;
│ │ │ │ -			}
│ │ │ │ -			else
│ │ │ │ -#endif
│ │ │ │ -				impl = boost::get&lt;utp_stream&gt;(s).get_impl();
│ │ │ │ -
│ │ │ │ -			std::vector&lt;std::shared_ptr&lt;listen_socket_t&gt;&gt; with_gateways;
│ │ │ │ -			std::shared_ptr&lt;listen_socket_t&gt; match;
│ │ │ │ -			for (auto&amp; ls : m_listen_sockets)
│ │ │ │ -			{
│ │ │ │ -				// this is almost, but not quite, like can_route()
│ │ │ │ -				if (!(ls-&gt;flags &amp; listen_socket_t::proxy)
│ │ │ │ -					&amp;&amp; is_v4(ls-&gt;local_endpoint) != remote_address.is_v4())
│ │ │ │ -					continue;
│ │ │ │ -				if (ls-&gt;ssl != ssl) continue;
│ │ │ │ -				if (!(ls-&gt;flags &amp; listen_socket_t::local_network))
│ │ │ │ -					with_gateways.push_back(ls);
│ │ │ │ -
│ │ │ │ -				if (ls-&gt;flags &amp; listen_socket_t::proxy
│ │ │ │ -					|| match_addr_mask(ls-&gt;local_endpoint.address(), remote_address, ls-&gt;netmask))
│ │ │ │ -				{
│ │ │ │ -					// is this better than the previous match?
│ │ │ │ -					match = ls;
│ │ │ │ -				}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(176)">../src/session_impl.cpp:5880</a></td><td>refactor, move the storage to dht_tracker</td></tr><tr id="176" style="display: none;" colspan="3"><td colspan="3"><h2>refactor, move the storage to dht_tracker</h2><h4>../src/session_impl.cpp:5880</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -			session_log("not starting DHT, outstanding router lookups: %d"
│ │ │ │ -				, m_outstanding_router_lookups);
│ │ │ │ -#endif
│ │ │ │ -			return;
│ │ │ │ -		}
│ │ │ │ +#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS
│ │ │ │ +		// always trigger a full recheck when we pull in files from other
│ │ │ │ +		// torrents, via hard links
│ │ │ │ +<div style="background: #ffff00" width="100%">		if (added_files) return false;
│ │ │ │ +</div>#endif
│ │ │ │  
│ │ │ │ -		if (m_abort)
│ │ │ │ +		// parse have bitmask. Verify that the files we expect to have
│ │ │ │ +		// actually do exist
│ │ │ │ +		piece_index_t const end_piece = std::min(rd.have_pieces.end_index(), fs.end_piece());
│ │ │ │ +		for (piece_index_t i(0); i &lt; end_piece; ++i)
│ │ │ │  		{
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -			session_log("not starting DHT, aborting");
│ │ │ │ -#endif
│ │ │ │ -			return;
│ │ │ │ -		}
│ │ │ │ +			if (rd.have_pieces.get_bit(i) == false) continue;
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		session_log("starting DHT, running: %s, router lookups: %d"
│ │ │ │ -			, m_dht ? "true" : "false", m_outstanding_router_lookups);
│ │ │ │ -#endif
│ │ │ │ +			std::vector&lt;file_slice&gt; f = fs.map_block(i, 0, 1);
│ │ │ │ +			TORRENT_ASSERT(!f.empty());
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">		m_dht_storage = m_dht_storage_constructor(m_settings);
│ │ │ │ -</div>		m_dht = std::make_shared&lt;dht::dht_tracker&gt;(
│ │ │ │ -			static_cast&lt;dht::dht_observer*&gt;(this)
│ │ │ │ -			, m_io_context
│ │ │ │ -			, [this](aux::listen_socket_handle const&amp; sock
│ │ │ │ -				, udp::endpoint const&amp; ep
│ │ │ │ -				, span&lt;char const&gt; p
│ │ │ │ -				, error_code&amp; ec
│ │ │ │ -				, udp_send_flags_t const flags)
│ │ │ │ -				{ send_udp_packet_listen(sock, ep, p, ec, flags); }
│ │ │ │ -			, m_settings
│ │ │ │ -			, m_stats_counters
│ │ │ │ -			, *m_dht_storage
│ │ │ │ -			, std::move(m_dht_state));
│ │ │ │ +			file_index_t const file_index = f[0].file_index;
│ │ │ │  
│ │ │ │ -		for (auto&amp; s : m_listen_sockets)
│ │ │ │ -		{
│ │ │ │ -			if (s-&gt;ssl != transport::ssl
│ │ │ │ -				&amp;&amp; !(s-&gt;flags &amp; listen_socket_t::local_network))
│ │ │ │ -			{
│ │ │ │ -				m_dht-&gt;new_socket(s);
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ +			// files with priority zero may not have been saved to disk at their
│ │ │ │ +			// expected location, but is likely to be in a partfile. Just exempt it
│ │ │ │ +			// from checking
│ │ │ │ +			if (file_index &lt; file_priority.end_index()
│ │ │ │ +				&amp;&amp; file_priority[file_index] == dont_download)
│ │ │ │ +				continue;
│ │ │ │  
│ │ │ │ -		for (auto const&amp; n : m_dht_router_nodes)
│ │ │ │ -		{
│ │ │ │ -			m_dht-&gt;add_router_node(n);
│ │ │ │ -		}
│ │ │ │ +			if (fs.pad_file_at(file_index)) continue;
│ │ │ │  
│ │ │ │ -		for (auto const&amp; n : m_dht_nodes)
│ │ │ │ -		{
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(177)">../src/session_impl.cpp:6267</a></td><td>asserts that no outstanding async operations are still in flight</td></tr><tr id="177" style="display: none;" colspan="3"><td colspan="3"><h2>asserts that no outstanding async operations are still in flight</h2><h4>../src/session_impl.cpp:6267</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		if (!m_dht) return;
│ │ │ │ -		m_dht-&gt;direct_request(ep, e, std::bind(&amp;on_direct_response, std::ref(m_alerts), userdata, _1));
│ │ │ │ -	}
│ │ │ │ +			if (get_filesize(stat, file_index, fs, save_path, ec) &lt; 0)
│ │ │ │ +				return false;
│ │ │ │  
│ │ │ │ +			// OK, this file existed, good. Now, skip all remaining pieces in
│ │ │ │ +			// this file. We're just sanity-checking whether the files exist
│ │ │ │ +			// or not.
│ │ │ │ +			peer_request const pr = fs.map_file(file_index
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(155)">../src/random.cpp:141</a></td><td>improve calling RAND_bytes multiple times, using fallback for now</td></tr><tr id="155" style="display: none;" colspan="3"><td colspan="3"><h2>improve calling RAND_bytes multiple times, using fallback for now</h2><h4>../src/random.cpp:141</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#else
│ │ │ │ +			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });
│ │ │ │  #endif
│ │ │ │ -
│ │ │ │ -	bool session_impl::is_listening() const
│ │ │ │ -	{
│ │ │ │ -		return !m_listen_sockets.empty();
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	session_impl::~session_impl()
│ │ │ │ -	{
│ │ │ │ -		// since we're destructing the session, no more alerts will make it out to
│ │ │ │ -		// the user. So stop posting them now
│ │ │ │ -		m_alerts.set_alert_mask({});
│ │ │ │ -		m_alerts.set_notify_function({});
│ │ │ │ -
│ │ │ │ -		// this is not allowed to be the network thread!
│ │ │ │ -//		TORRENT_ASSERT(is_not_thread());
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>		// this can happen if we end the io_context run loop with an exception
│ │ │ │ -		m_connections.clear();
│ │ │ │ -		for (auto&amp; t : m_torrents)
│ │ │ │ -		{
│ │ │ │ -			t-&gt;panic();
│ │ │ │ -			t-&gt;abort();
│ │ │ │  		}
│ │ │ │ -		m_torrents.clear();
│ │ │ │  
│ │ │ │ -		// this has probably been called already, but in case of sudden
│ │ │ │ -		// termination through an exception, it may not have been done
│ │ │ │ -		abort_stage2();
│ │ │ │ -
│ │ │ │ -#if defined TORRENT_ASIO_DEBUGGING
│ │ │ │ -		FILE* f = fopen("wakeups.log", "w+");
│ │ │ │ -		if (f != nullptr)
│ │ │ │ +		void crypto_random_bytes(span&lt;char&gt; buffer)
│ │ │ │  		{
│ │ │ │ -			time_point m = min_time();
│ │ │ │ -			if (!_wakeups.empty()) m = _wakeups[0].timestamp;
│ │ │ │ -			time_point prev = m;
│ │ │ │ -			std::uint64_t prev_csw = 0;
│ │ │ │ -			if (!_wakeups.empty()) prev_csw = _wakeups[0].context_switches;
│ │ │ │ -			std::fprintf(f, "abs. time\trel. time\tctx switch\tidle-wakeup\toperation\n");
│ │ │ │ -			for (wakeup_t const&amp; w : _wakeups)
│ │ │ │ -			{
│ │ │ │ -				bool const idle_wakeup = w.context_switches &gt; prev_csw;
│ │ │ │ -				std::fprintf(f, "%" PRId64 "\t%" PRId64 "\t%" PRId64 "\t%c\t%s\n"
│ │ │ │ -					, total_microseconds(w.timestamp - m)
│ │ │ │ -					, total_microseconds(w.timestamp - prev)
│ │ │ │ -					, w.context_switches
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(178)">../src/part_file.cpp:300</a></td><td>what do we do if someone is currently reading from the disk from this piece? does it matter? Since we won't actively erase the data from disk, but it may be overwritten soon, it's probably not that big of a deal</td></tr><tr id="178" style="display: none;" colspan="3"><td colspan="3"><h2>what do we do if someone is currently reading from the disk
│ │ │ │ -from this piece? does it matter? Since we won't actively erase the
│ │ │ │ -data from disk, but it may be overwritten soon, it's probably not that
│ │ │ │ -big of a deal</h2><h4>../src/part_file.cpp:300</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				create_directories(m_path, ec);
│ │ │ │ -				if (ec) return {};
│ │ │ │ -				return aux::file_handle(fn, 0, mode);
│ │ │ │ -			}
│ │ │ │ -			return {};
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -	catch (storage_error const&amp; e)
│ │ │ │ -	{
│ │ │ │ -		ec = e.ec;
│ │ │ │ -		return {};
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void part_file::free_piece(piece_index_t const piece)
│ │ │ │ -	{
│ │ │ │ -		std::lock_guard&lt;std::mutex&gt; l(m_mutex);
│ │ │ │ -
│ │ │ │ -		auto const i = m_piece_map.find(piece);
│ │ │ │ -		if (i == m_piece_map.end()) return;
│ │ │ │ -
│ │ │ │ +#ifdef TORRENT_BUILD_SIMULATOR
│ │ │ │ +			// In the simulator we want deterministic random numbers
│ │ │ │ +			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });
│ │ │ │ +#elif TORRENT_USE_CNG
│ │ │ │ +			aux::cng_gen_random(buffer);
│ │ │ │ +#elif TORRENT_USE_CRYPTOAPI
│ │ │ │ +			// windows
│ │ │ │ +			aux::crypt_gen_random(buffer);
│ │ │ │ +#elif defined TORRENT_USE_LIBCRYPTO &amp;&amp; !defined TORRENT_USE_WOLFSSL
│ │ │ │ +// wolfSSL uses wc_RNG_GenerateBlock as the internal function for the
│ │ │ │ +// openssl compatibility layer. This function API does not support
│ │ │ │ +// an arbitrary buffer size (openssl does), it is limited by the
│ │ │ │ +// constant RNG_MAX_BLOCK_LEN.
│ │ │ │  <div style="background: #ffff00" width="100%">
│ │ │ │ -</div>		m_free_slots.push_back(i-&gt;second);
│ │ │ │ -		m_piece_map.erase(i);
│ │ │ │ -		m_dirty_metadata = true;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void part_file::move_partfile(std::string const&amp; path, error_code&amp; ec)
│ │ │ │ -	{
│ │ │ │ -		std::lock_guard&lt;std::mutex&gt; l(m_mutex);
│ │ │ │ -
│ │ │ │ -		flush_metadata_impl(ec);
│ │ │ │ -		if (ec) return;
│ │ │ │ -
│ │ │ │ -		if (!m_piece_map.empty())
│ │ │ │ -		{
│ │ │ │ -			std::string old_path = combine_path(m_path, m_name);
│ │ │ │ -			std::string new_path = combine_path(path, m_name);
│ │ │ │ -
│ │ │ │ -			rename(old_path, new_path, ec);
│ │ │ │ -			if (ec == boost::system::errc::no_such_file_or_directory)
│ │ │ │ -				ec.clear();
│ │ │ │ -
│ │ │ │ -			if (ec)
│ │ │ │ -			{
│ │ │ │ -				storage_error se;
│ │ │ │ -				aux::copy_file(old_path, new_path, se);
│ │ │ │ -				ec = se.ec;
│ │ │ │ -				if (ec) return;
│ │ │ │ -				remove(old_path, ec);
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(179)">../src/part_file.cpp:411</a></td><td>instead of rebuilding the whole file header and flushing it, update the slot entries as we go</td></tr><tr id="179" style="display: none;" colspan="3"><td colspan="3"><h2>instead of rebuilding the whole file header
│ │ │ │ -and flushing it, update the slot entries as we go</h2><h4>../src/part_file.cpp:411</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">						TORRENT_ASSERT(j-&gt;second == slot);
│ │ │ │ -						m_free_slots.push_back(j-&gt;second);
│ │ │ │ -						m_piece_map.erase(j);
│ │ │ │ -						m_dirty_metadata = true;
│ │ │ │ -					}
│ │ │ │ -				}
│ │ │ │ -			}
│ │ │ │ -			file_offset += block_to_copy;
│ │ │ │ -			piece_offset = 0;
│ │ │ │ -			size -= block_to_copy;
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void part_file::flush_metadata(error_code&amp; ec)
│ │ │ │ -	{
│ │ │ │ -		std::lock_guard&lt;std::mutex&gt; l(m_mutex);
│ │ │ │ -
│ │ │ │ -		flush_metadata_impl(ec);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	void part_file::flush_metadata_impl(error_code&amp; ec)
│ │ │ │ -</div>	{
│ │ │ │ -		// do we need to flush the metadata?
│ │ │ │ -		if (m_dirty_metadata == false) return;
│ │ │ │ -
│ │ │ │ -		if (m_piece_map.empty())
│ │ │ │ -		{
│ │ │ │ -			// if we don't have any pieces left in the
│ │ │ │ -			// part file, remove it
│ │ │ │ -			std::string const p = combine_path(m_path, m_name);
│ │ │ │ -			remove(p, ec);
│ │ │ │ -
│ │ │ │ -			if (ec == boost::system::errc::no_such_file_or_directory)
│ │ │ │ -				ec.clear();
│ │ │ │ -			return;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		auto f = open_file(aux::open_mode::write | aux::open_mode::hidden, ec);
│ │ │ │ -		if (ec) return;
│ │ │ │ -
│ │ │ │ -		std::vector&lt;char&gt; header(static_cast&lt;std::size_t&gt;(m_header_size));
│ │ │ │ -
│ │ │ │ -		using namespace libtorrent::aux;
│ │ │ │ -
│ │ │ │ -		char* ptr = header.data();
│ │ │ │ -		write_uint32(m_max_pieces, ptr);
│ │ │ │ -		write_uint32(m_piece_size, ptr);
│ │ │ │ -
│ │ │ │ -		for (piece_index_t piece(0); piece &lt; piece_index_t(m_max_pieces); ++piece)
│ │ │ │ -		{
│ │ │ │ -			auto const i = m_piece_map.find(piece);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(180)">../src/utp_stream.cpp:1467</a></td><td>this loop is not very efficient. It could be fixed by having a separate list of sequence numbers that need resending</td></tr><tr id="180" style="display: none;" colspan="3"><td colspan="3"><h2>this loop is not very efficient. It could be fixed by having
│ │ │ │ -a separate list of sequence numbers that need resending</h2><h4>../src/utp_stream.cpp:1467</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#endif
│ │ │ │ -
│ │ │ │ -	if (m_stalled)
│ │ │ │ -	{
│ │ │ │ -		if (flags &amp; pkt_ack)
│ │ │ │ -			defer_ack();
│ │ │ │ -		return false;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	// m_out_eof means we're trying to close the write side of this socket,
│ │ │ │ -	// we need to flush all payload before we can send the FIN packet, so don't
│ │ │ │ -	// store any payload in the nagle packet
│ │ │ │ -	bool const force = (flags &amp; pkt_ack) || (flags &amp; pkt_fin) || m_out_eof;
│ │ │ │ -
│ │ │ │ -	// when we want to close the outgoing stream, we need to send the
│ │ │ │ -	// remaining nagle packet even though it won't fill a packet.
│ │ │ │ -	bool const force_flush_nagle = m_out_eof &amp;&amp; m_write_buffer_size;
│ │ │ │ -
│ │ │ │ -	// first see if we need to resend any packets
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	for (int i = (m_acked_seq_nr + 1) &amp; ACK_MASK; i != m_seq_nr; i = (i + 1) &amp; ACK_MASK)
│ │ │ │ -</div>	{
│ │ │ │ -		packet* p = m_outbuf.at(aux::numeric_cast&lt;packet_buffer::index_type&gt;(i));
│ │ │ │ -		if (!p) continue;
│ │ │ │ -		if (!p-&gt;need_resend) continue;
│ │ │ │ -		if (!resend_packet(p))
│ │ │ │ -		{
│ │ │ │ -			// we couldn't resend the packet. It probably doesn't
│ │ │ │ -			// fit in our cwnd. If force is set, we need to continue
│ │ │ │ -			// to send our packet anyway, if we don't have force set,
│ │ │ │ -			// we might as well return
│ │ │ │ -			if (!force) return false;
│ │ │ │ -			// resend_packet might have failed
│ │ │ │ -			if (state() == state_t::error_wait || state() == state_t::deleting) return false;
│ │ │ │ -			if (m_stalled) return false;
│ │ │ │ -			break;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		// don't fast-resend this packet
│ │ │ │ -		if (m_fast_resend_seq_nr == i)
│ │ │ │ -			m_fast_resend_seq_nr = (m_fast_resend_seq_nr + 1) &amp; ACK_MASK;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	// MTU DISCOVERY
│ │ │ │ -
│ │ │ │ -	// under these conditions, the next packet we send should be an MTU probe.
│ │ │ │ -	// MTU probes get to use the mid-point packet size, whereas other packets
│ │ │ │ -	// use a conservative packet size of the largest known to work. The reason
│ │ │ │ -	// for the cwnd condition is to make sure the probe is surrounded by non-
│ │ │ │ -	// probes, to be able to distinguish a loss of the probe vs. just loss in
│ │ │ │ -	// general.
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(181)">../src/torrent_handle.cpp:589</a></td><td>support moving files into this call</td></tr><tr id="181" style="display: none;" colspan="3"><td colspan="3"><h2>support moving files into this call</h2><h4>../src/torrent_handle.cpp:589</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		auto retp = &amp;prio;
│ │ │ │ -		sync_call(&amp;torrent::piece_priorities, retp);
│ │ │ │ -		std::vector&lt;int&gt; ret;
│ │ │ │ -		ret.reserve(prio.size());
│ │ │ │ -		for (auto p : prio)
│ │ │ │ -			ret.push_back(int(static_cast&lt;std::uint8_t&gt;(p)));
│ │ │ │ -		return ret;
│ │ │ │ -	}
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -	void torrent_handle::file_priority(file_index_t index, download_priority_t priority) const
│ │ │ │ -	{
│ │ │ │ -		async_call(&amp;torrent::set_file_priority, index, priority);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	download_priority_t torrent_handle::file_priority(file_index_t index) const
│ │ │ │ -	{
│ │ │ │ -		return sync_call_ret&lt;download_priority_t&gt;(dont_download, &amp;torrent::file_priority, index);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	void torrent_handle::prioritize_files(std::vector&lt;download_priority_t&gt; const&amp; files) const
│ │ │ │ -</div>	{
│ │ │ │ -		async_call(&amp;torrent::prioritize_files
│ │ │ │ -			, static_cast&lt;aux::vector&lt;download_priority_t, file_index_t&gt; const&amp;&gt;(files));
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	std::vector&lt;download_priority_t&gt; torrent_handle::get_file_priorities() const
│ │ │ │ -	{
│ │ │ │ -		aux::vector&lt;download_priority_t, file_index_t&gt; ret;
│ │ │ │ -		auto retp = &amp;ret;
│ │ │ │ -		sync_call(&amp;torrent::file_priorities, retp);
│ │ │ │ -		return TORRENT_RVO(ret);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ -
│ │ │ │ -// ============ start deprecation ===============
│ │ │ │ -
│ │ │ │ -	void torrent_handle::prioritize_files(std::vector&lt;int&gt; const&amp; files) const
│ │ │ │ -	{
│ │ │ │ -		aux::vector&lt;download_priority_t, file_index_t&gt; file_prio;
│ │ │ │ -		file_prio.reserve(files.size());
│ │ │ │ -		for (auto const p : files) {
│ │ │ │ -			file_prio.push_back(download_priority_t(static_cast&lt;std::uint8_t&gt;(p)));
│ │ │ │ -		}
│ │ │ │ -		async_call(&amp;torrent::prioritize_files, file_prio);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	std::vector&lt;int&gt; torrent_handle::file_priorities() const
│ │ │ │ -	{
│ │ │ │ -		aux::vector&lt;download_priority_t, file_index_t&gt; prio;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(182)">../src/settings_pack.cpp:305</a></td><td>deprecate this</td></tr><tr id="182" style="display: none;" colspan="3"><td colspan="3"><h2>deprecate this</h2><h4>../src/settings_pack.cpp:305</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		SET(outgoing_port, 0, nullptr),
│ │ │ │ -		SET(num_outgoing_ports, 0, nullptr),
│ │ │ │ -		SET(peer_dscp, 0x04, &amp;session_impl::update_peer_dscp),
│ │ │ │ -		SET(active_downloads, 3, &amp;session_impl::trigger_auto_manage),
│ │ │ │ -		SET(active_seeds, 5, &amp;session_impl::trigger_auto_manage),
│ │ │ │ -		SET(active_checking, 1, &amp;session_impl::trigger_auto_manage),
│ │ │ │ -		SET(active_dht_limit, 88, nullptr),
│ │ │ │ -		SET(active_tracker_limit, 1600, nullptr),
│ │ │ │ -		SET(active_lsd_limit, 60, nullptr),
│ │ │ │ -		SET(active_limit, 500, &amp;session_impl::trigger_auto_manage),
│ │ │ │ -		DEPRECATED_SET(active_loaded_limit, 0, &amp;session_impl::trigger_auto_manage),
│ │ │ │ -		SET(auto_manage_interval, 30, nullptr),
│ │ │ │ -		SET(seed_time_limit, 24 * 60 * 60, nullptr),
│ │ │ │ -		SET(auto_scrape_interval, 1800, nullptr),
│ │ │ │ -		SET(auto_scrape_min_interval, 300, nullptr),
│ │ │ │ -		SET(max_peerlist_size, 3000, nullptr),
│ │ │ │ -		SET(max_paused_peerlist_size, 1000, nullptr),
│ │ │ │ -		SET(min_announce_interval, 5 * 60, nullptr),
│ │ │ │ -		SET(auto_manage_startup, 60, nullptr),
│ │ │ │ -		SET(seeding_piece_quota, 20, nullptr),
│ │ │ │ -<div style="background: #ffff00" width="100%">		SET(max_rejects, 50, nullptr),
│ │ │ │ -</div>		SET(recv_socket_buffer_size, 0, &amp;session_impl::update_socket_buffer_size),
│ │ │ │ -		SET(send_socket_buffer_size, 0, &amp;session_impl::update_socket_buffer_size),
│ │ │ │ -		SET(max_peer_recv_buffer_size, 2 * 1024 * 1024, nullptr),
│ │ │ │ -		DEPRECATED_SET(file_checks_delay_per_block, 0, nullptr),
│ │ │ │ -		DEPRECATED2_SET(read_cache_line_size, 32, nullptr),
│ │ │ │ -		DEPRECATED2_SET(write_cache_line_size, 16, nullptr),
│ │ │ │ -		SET(optimistic_disk_retry, 10 * 60, nullptr),
│ │ │ │ -		SET(max_suggest_pieces, 16, nullptr),
│ │ │ │ -		SET(local_service_announce_interval, 5 * 60, nullptr),
│ │ │ │ -		SET(dht_announce_interval, 15 * 60, &amp;session_impl::update_dht_announce_interval),
│ │ │ │ -		SET(udp_tracker_token_expiry, 60, nullptr),
│ │ │ │ -		DEPRECATED_SET(default_cache_min_age, 1, nullptr),
│ │ │ │ -		SET(num_optimistic_unchoke_slots, 0, nullptr),
│ │ │ │ -		DEPRECATED_SET(default_est_reciprocation_rate, 16000, nullptr),
│ │ │ │ -		DEPRECATED_SET(increase_est_reciprocation_rate, 20, nullptr),
│ │ │ │ -		DEPRECATED_SET(decrease_est_reciprocation_rate, 3, nullptr),
│ │ │ │ -		SET(max_pex_peers, 50, nullptr),
│ │ │ │ -		SET(tick_interval, 500, nullptr),
│ │ │ │ -		SET(share_mode_target, 3, nullptr),
│ │ │ │ -		SET(upload_rate_limit, 0, &amp;session_impl::update_upload_rate),
│ │ │ │ -		SET(download_rate_limit, 0, &amp;session_impl::update_download_rate),
│ │ │ │ -		DEPRECATED_SET(local_upload_rate_limit, 0, &amp;session_impl::update_local_upload_rate),
│ │ │ │ -		DEPRECATED_SET(local_download_rate_limit, 0, &amp;session_impl::update_local_download_rate),
│ │ │ │ -		SET(dht_upload_rate_limit, 8000, &amp;session_impl::update_dht_upload_rate_limit),
│ │ │ │ -		SET(unchoke_slots_limit, 8, &amp;session_impl::update_unchoke_limit),
│ │ │ │ -		DEPRECATED_SET(half_open_limit, 0, nullptr),
│ │ │ │ -		SET(connections_limit, 200, &amp;session_impl::update_connections_limit),
│ │ │ │ -		SET(connections_slack, 10, nullptr),
│ │ │ │ -		SET(utp_target_delay, 100, nullptr),
│ │ │ │ -		SET(utp_gain_factor, 3000, nullptr),
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(183)">../src/settings_pack.cpp:590</a></td><td>it would be nice to reserve() these vectors up front</td></tr><tr id="183" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to reserve() these vectors up front</h2><h4>../src/settings_pack.cpp:590</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			s.set_str(settings_pack::string_type_base | i, str_settings[i].default_value);
│ │ │ │ -			TORRENT_ASSERT(s.get_str(settings_pack::string_type_base + i) == str_settings[i].default_value);
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		for (int i = 0; i &lt; settings_pack::num_int_settings; ++i)
│ │ │ │ -		{
│ │ │ │ -			s.set_int(settings_pack::int_type_base | i, int_settings[i].default_value);
│ │ │ │ -			TORRENT_ASSERT(s.get_int(settings_pack::int_type_base + i) == int_settings[i].default_value);
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		for (int i = 0; i &lt; settings_pack::num_bool_settings; ++i)
│ │ │ │ -		{
│ │ │ │ -			s.set_bool(settings_pack::bool_type_base | i, bool_settings[i].default_value);
│ │ │ │ -			TORRENT_ASSERT(s.get_bool(settings_pack::bool_type_base + i) == bool_settings[i].default_value);
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	settings_pack default_settings()
│ │ │ │ -	{
│ │ │ │ -		settings_pack ret;
│ │ │ │ -<div style="background: #ffff00" width="100%">		for (int i = 0; i &lt; settings_pack::num_string_settings; ++i)
│ │ │ │ -</div>		{
│ │ │ │ -			if (str_settings[i].default_value == nullptr) continue;
│ │ │ │ -			ret.set_str(settings_pack::string_type_base + i, str_settings[i].default_value);
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		for (int i = 0; i &lt; settings_pack::num_int_settings; ++i)
│ │ │ │ -		{
│ │ │ │ -			ret.set_int(settings_pack::int_type_base + i, int_settings[i].default_value);
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		for (int i = 0; i &lt; settings_pack::num_bool_settings; ++i)
│ │ │ │ -		{
│ │ │ │ -			ret.set_bool(settings_pack::bool_type_base + i, bool_settings[i].default_value);
│ │ │ │ -		}
│ │ │ │ -		return ret;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void apply_pack(settings_pack const* pack, aux::session_settings&amp; sett
│ │ │ │ -		, aux::session_impl* ses)
│ │ │ │ -	{
│ │ │ │ -		using fun_t = void (aux::session_impl::*)();
│ │ │ │ -		std::vector&lt;fun_t&gt; callbacks;
│ │ │ │ -
│ │ │ │ -		sett.bulk_set([&amp;](aux::session_settings_single_thread&amp; s)
│ │ │ │ -		{
│ │ │ │ -			apply_pack_impl(pack, s, ses ? &amp;callbacks : nullptr);
│ │ │ │ -		});
│ │ │ │ -
│ │ │ │ -		// call the callbacks once all the settings have been applied, and
│ │ │ │ -		// only once per callback
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(184)">../src/udp_tracker_connection.cpp:633</a></td><td>why is this a linked list?</td></tr><tr id="184" style="display: none;" colspan="3"><td colspan="3"><h2>why is this a linked list?</h2><h4>../src/udp_tracker_connection.cpp:633</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				ipv6_peer_entry e{};
│ │ │ │ -				std::memcpy(e.ip.data(), buf.data(), 16);
│ │ │ │ -				buf = buf.subspan(16);
│ │ │ │ -				e.port = aux::read_uint16(buf);
│ │ │ │ -				resp.peers6.push_back(e);
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ -		else
│ │ │ │ -		{
│ │ │ │ -			resp.peers4.reserve(static_cast&lt;std::size_t&gt;(num_peers));
│ │ │ │ -			for (int i = 0; i &lt; num_peers; ++i)
│ │ │ │ -			{
│ │ │ │ -				ipv4_peer_entry e{};
│ │ │ │ -				std::memcpy(e.ip.data(), buf.data(), 4);
│ │ │ │ -				buf = buf.subspan(4);
│ │ │ │ -				e.port = aux::read_uint16(buf);
│ │ │ │ -				resp.peers4.push_back(e);
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		std::list&lt;address&gt; ip_list;
│ │ │ │ -</div>		std::transform(m_endpoints.begin(), m_endpoints.end(), std::back_inserter(ip_list)
│ │ │ │ -			, [](tcp::endpoint const&amp; ep) { return ep.address(); } );
│ │ │ │ -
│ │ │ │ -		cb-&gt;tracker_response(tracker_req(), m_target.address(), ip_list, resp);
│ │ │ │ -
│ │ │ │ -		close();
│ │ │ │ -		return true;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	bool udp_tracker_connection::on_scrape_response(span&lt;char const&gt; buf)
│ │ │ │ -	{
│ │ │ │ -		restart_read_timeout();
│ │ │ │ -		auto const action = static_cast&lt;action_t&gt;(aux::read_int32(buf));
│ │ │ │ -		std::uint32_t const transaction = aux::read_uint32(buf);
│ │ │ │ -
│ │ │ │ -		if (transaction != m_transaction_id)
│ │ │ │ -		{
│ │ │ │ -			fail(error_code(errors::invalid_tracker_transaction_id), operation_t::bittorrent);
│ │ │ │ -			return false;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		if (action == action_t::error)
│ │ │ │ -		{
│ │ │ │ -			fail(error_code(errors::tracker_failure), operation_t::bittorrent
│ │ │ │ -				, std::string(buf.data(), static_cast&lt;std::size_t&gt;(buf.size())).c_str());
│ │ │ │ -			return true;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		if (action != action_t::scrape)
│ │ │ │ -		{
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(185)">../src/magnet_uri.cpp:439</a></td><td>what's the right number here?</td></tr><tr id="185" style="display: none;" colspan="3"><td colspan="3"><h2>what's the right number here?</h2><h4>../src/magnet_uri.cpp:439</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			}
│ │ │ │ -			else if (string_equal_no_case(name, "so"_sv)) // select-only (files)
│ │ │ │ -			{
│ │ │ │ -				// accept only digits, '-' and ','
│ │ │ │ -				if (std::any_of(value.begin(), value.end(), [](char c)
│ │ │ │ -					{ return !is_digit(c) &amp;&amp; c != '-' &amp;&amp; c != ','; }))
│ │ │ │ -					continue;
│ │ │ │ -
│ │ │ │ -				// make sure all file priorities are set to 0, except the ones
│ │ │ │ -				// we specify in the file_priorities
│ │ │ │ -				p.flags |= torrent_flags::default_dont_download;
│ │ │ │ -
│ │ │ │ -				do
│ │ │ │ -				{
│ │ │ │ -					string_view token;
│ │ │ │ -					std::tie(token, value) = split_string(value, ',');
│ │ │ │ -
│ │ │ │ -					if (token.empty()) continue;
│ │ │ │ -
│ │ │ │ -					int idx1, idx2;
│ │ │ │ -<div style="background: #ffff00" width="100%">					constexpr int max_index = 10000; // can't risk out of memory
│ │ │ │ -</div>
│ │ │ │ -					auto const divider = token.find_first_of('-');
│ │ │ │ -					if (divider != std::string::npos) // it's a range
│ │ │ │ -					{
│ │ │ │ -						if (divider == 0) // no start index
│ │ │ │ -							continue;
│ │ │ │ -						if (divider == token.size() - 1) // no end index
│ │ │ │ -							continue;
│ │ │ │ -
│ │ │ │ -						idx1 = std::atoi(token.substr(0, divider).to_string().c_str());
│ │ │ │ -						if (idx1 &lt; 0 || idx1 &gt; max_index) // invalid index
│ │ │ │ -							continue;
│ │ │ │ -						idx2 = std::atoi(token.substr(divider + 1).to_string().c_str());
│ │ │ │ -						if (idx2 &lt; 0 || idx2 &gt; max_index) // invalid index
│ │ │ │ -							continue;
│ │ │ │ -
│ │ │ │ -						if (idx1 &gt; idx2) // wrong range limits
│ │ │ │ -							continue;
│ │ │ │ -					}
│ │ │ │ -					else // it's an index
│ │ │ │ -					{
│ │ │ │ -						idx1 = std::atoi(token.to_string().c_str());
│ │ │ │ -						if (idx1 &lt; 0 || idx1 &gt; max_index) // invalid index
│ │ │ │ -							continue;
│ │ │ │ -						idx2 = idx1;
│ │ │ │ -					}
│ │ │ │ -
│ │ │ │ -					if (int(p.file_priorities.size()) &lt;= idx2)
│ │ │ │ -						p.file_priorities.resize(static_cast&lt;std::size_t&gt;(idx2) + 1, dont_download);
│ │ │ │ -
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(186)">../src/hash_picker.cpp:309</a></td><td>use structured bindings in C++17</td></tr><tr id="186" style="display: none;" colspan="3"><td colspan="3"><h2>use structured bindings in C++17</h2><h4>../src/hash_picker.cpp:309</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		, int const offset, sha256_hash const&amp; h)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(offset &gt;= 0);
│ │ │ │ -		auto const f = m_files.file_index_at_piece(piece);
│ │ │ │ -
│ │ │ │ -		if (m_files.pad_file_at(f))
│ │ │ │ -			return { set_block_hash_result::result::success, 0, 0 };
│ │ │ │ -
│ │ │ │ -		auto&amp; merkle_tree = m_merkle_trees[f];
│ │ │ │ -		piece_index_t const file_first_piece = m_files.piece_index_at_file(f);
│ │ │ │ -		std::int64_t const block_offset = static_cast&lt;int&gt;(piece) * std::int64_t(m_files.piece_length())
│ │ │ │ -			+ offset - m_files.file_offset(f);
│ │ │ │ -		int const block_index = aux::numeric_cast&lt;int&gt;(block_offset / default_block_size);
│ │ │ │ -
│ │ │ │ -		if (h.is_all_zeros())
│ │ │ │ -		{
│ │ │ │ -			TORRENT_ASSERT_FAIL();
│ │ │ │ -			return set_block_hash_result::block_hash_failed();
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		aux::merkle_tree::set_block_result result;
│ │ │ │ -</div>		int leafs_index;
│ │ │ │ -		int leafs_size;
│ │ │ │ -		std::tie(result, leafs_index, leafs_size) = merkle_tree.set_block(block_index, h);
│ │ │ │ -
│ │ │ │ -		if (result == aux::merkle_tree::set_block_result::unknown)
│ │ │ │ -			return set_block_hash_result::unknown();
│ │ │ │ -		if (result == aux::merkle_tree::set_block_result::block_hash_failed)
│ │ │ │ -			return set_block_hash_result::block_hash_failed();
│ │ │ │ -
│ │ │ │ -		auto const status = (result == aux::merkle_tree::set_block_result::hash_failed)
│ │ │ │ -			? set_block_hash_result::result::piece_hash_failed
│ │ │ │ -			: set_block_hash_result::result::success;
│ │ │ │ -
│ │ │ │ -		int const blocks_per_piece = m_files.piece_length() / default_block_size;
│ │ │ │ -
│ │ │ │ -		return { status
│ │ │ │ -			, int(leafs_index - static_cast&lt;int&gt;(piece - file_first_piece) * blocks_per_piece)
│ │ │ │ -			, std::min(leafs_size, m_files.file_num_pieces(f) * blocks_per_piece - leafs_index) };
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void hash_picker::hashes_rejected(hash_request const&amp; req)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(req.base == m_piece_layer &amp;&amp; req.index % 512 == 0);
│ │ │ │ -
│ │ │ │ -		for (int i = req.index; i &lt; req.index + req.count; i += 512)
│ │ │ │ -		{
│ │ │ │ -			m_piece_hash_requested[req.file][i / 512].last_request = min_time();
│ │ │ │ -			--m_piece_hash_requested[req.file][i / 512].num_requests;
│ │ │ │ -		}
│ │ │ │ +</div>			// openssl
│ │ │ │ +			int r = RAND_bytes(reinterpret_cast&lt;unsigned char*&gt;(buffer.data())
│ │ │ │ +				, int(buffer.size()));
│ │ │ │ +			if (r != 1) aux::throw_ex&lt;system_error&gt;(errors::no_entropy);
│ │ │ │ +#elif TORRENT_USE_GETRANDOM
│ │ │ │ +			ssize_t const r = ::getrandom(buffer.data(), static_cast&lt;std::size_t&gt;(buffer.size()), 0);
│ │ │ │ +			if (r == ssize_t(buffer.size())) return;
│ │ │ │ +			if (r == -1 &amp;&amp; errno != ENOSYS) aux::throw_ex&lt;system_error&gt;(error_code(errno, generic_category()));
│ │ │ │ +			static dev_random dev;
│ │ │ │ +			dev.read(buffer);
│ │ │ │ +#elif TORRENT_USE_DEV_RANDOM
│ │ │ │ +			static dev_random dev;
│ │ │ │ +			dev.read(buffer);
│ │ │ │ +#else
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(187)">../src/torrent_peer.cpp:192</a></td><td>how do we deal with our external address changing?</td></tr><tr id="187" style="display: none;" colspan="3"><td colspan="3"><h2>how do we deal with our external address changing?</h2><h4>../src/torrent_peer.cpp:192</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// connections. If it fails, we'll
│ │ │ │ -		// retry with encryption
│ │ │ │ -		, pe_support(false)
│ │ │ │ +#if TORRENT_BROKEN_RANDOM_DEVICE
│ │ │ │ +			// even pseudo random numbers rely on being able to seed the random
│ │ │ │ +			// generator
│ │ │ │ +#error "no entropy source available"
│ │ │ │ +#else
│ │ │ │ +#ifdef TORRENT_I_WANT_INSECURE_RANDOM_NUMBERS
│ │ │ │ +			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });
│ │ │ │ +#else
│ │ │ │ +#error "no secure entropy source available. If you really want insecure random numbers, define TORRENT_I_WANT_INSECURE_RANDOM_NUMBERS"
│ │ │ │  #endif
│ │ │ │ -		, is_v6_addr(false)
│ │ │ │ -#if TORRENT_USE_I2P
│ │ │ │ -		, is_i2p_addr(false)
│ │ │ │  #endif
│ │ │ │ -		, on_parole(false)
│ │ │ │ -		, banned(false)
│ │ │ │ -		, supports_utp(true) // assume peers support utp
│ │ │ │ -		, confirmed_supports_utp(false)
│ │ │ │ -		, supports_holepunch(false)
│ │ │ │ -		, web_seed(false)
│ │ │ │ -		, protocol_v2(false)
│ │ │ │ -	{}
│ │ │ │  
│ │ │ │ -	std::uint32_t torrent_peer::rank(external_ip const&amp; external, int external_port) const
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(in_use);
│ │ │ │ -<div style="background: #ffff00" width="100%">		if (peer_rank == 0)
│ │ │ │ -</div>			peer_rank = peer_priority(
│ │ │ │ -				tcp::endpoint(external.external_address(this-&gt;address()), std::uint16_t(external_port))
│ │ │ │ -				, tcp::endpoint(this-&gt;address(), this-&gt;port));
│ │ │ │ -		return peer_rank;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -	std::string torrent_peer::to_string() const
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(in_use);
│ │ │ │ -#if TORRENT_USE_I2P
│ │ │ │ -		if (is_i2p_addr) return dest().to_string();
│ │ │ │ -#endif // TORRENT_USE_I2P
│ │ │ │ -		return address().to_string();
│ │ │ │ -	}
│ │ │ │  #endif
│ │ │ │ -
│ │ │ │ -	std::int64_t torrent_peer::total_download() const
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(in_use);
│ │ │ │ -		if (connection != nullptr)
│ │ │ │ -		{
│ │ │ │ -			TORRENT_ASSERT(prev_amount_download == 0);
│ │ │ │ -			return connection-&gt;statistics().total_payload_download();
│ │ │ │  		}
│ │ │ │ -		else
│ │ │ │ -		{
│ │ │ │ -			return std::int64_t(prev_amount_download) &lt;&lt; 10;
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(188)">../src/disabled_disk_io.cpp:106</a></td><td>it would be nice to return a valid hash of zeroes here</td></tr><tr id="188" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to return a valid hash of zeroes here</h2><h4>../src/disabled_disk_io.cpp:106</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		});
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	bool async_write(storage_index_t
│ │ │ │ -		, peer_request const&amp; r
│ │ │ │ -		, char const*, std::shared_ptr&lt;disk_observer&gt;
│ │ │ │ -		, std::function&lt;void(storage_error const&amp;)&gt; handler
│ │ │ │ -		, disk_job_flags_t) override
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(r.length &lt;= default_block_size);
│ │ │ │ -		TORRENT_UNUSED(r);
│ │ │ │ -
│ │ │ │ -		post(m_ios, [h = std::move(handler)] { h(storage_error{}); });
│ │ │ │ -		return false;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void async_hash(storage_index_t
│ │ │ │ -		, piece_index_t piece, span&lt;sha256_hash&gt;, disk_job_flags_t
│ │ │ │ -		, std::function&lt;void(piece_index_t, sha1_hash const&amp;, storage_error const&amp;)&gt; handler) override
│ │ │ │ -	{
│ │ │ │ -<div style="background: #ffff00" width="100%">		post(m_ios, [h = std::move(handler), piece] { h(piece, sha1_hash{}, storage_error{}); });
│ │ │ │ -</div>	}
│ │ │ │ -
│ │ │ │ -	void async_hash2(storage_index_t, piece_index_t piece, int
│ │ │ │ -		, disk_job_flags_t
│ │ │ │ -		, std::function&lt;void(piece_index_t, sha256_hash const&amp;, storage_error const&amp;)&gt; handler) override
│ │ │ │ -	{
│ │ │ │ -		post(m_ios, [h = std::move(handler), piece]() { h(piece, sha256_hash{}, storage_error{}); });
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void async_move_storage(storage_index_t
│ │ │ │ -		, std::string p, move_flags_t
│ │ │ │ -		, std::function&lt;void(status_t, std::string const&amp;, storage_error const&amp;)&gt; handler) override
│ │ │ │ -	{
│ │ │ │ -		post(m_ios, [h = std::move(handler), path = std::move(p)] () mutable
│ │ │ │ -			{ h(status_t::no_error, std::move(path), storage_error{}); });
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void async_release_files(storage_index_t, std::function&lt;void()&gt; handler) override
│ │ │ │ -	{
│ │ │ │ -		post(m_ios, [h = std::move(handler)] { h(); });
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void async_delete_files(storage_index_t
│ │ │ │ -		, remove_flags_t, std::function&lt;void(storage_error const&amp;)&gt; handler) override
│ │ │ │ -	{
│ │ │ │ -		post(m_ios, [h = std::move(handler)] { h(storage_error{}); });
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void async_check_files(storage_index_t
│ │ │ │ -		, add_torrent_params const*
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(189)">../src/alert.cpp:404</a></td><td>move this field into tracker_alert</td></tr><tr id="189" style="display: none;" colspan="3"><td colspan="3"><h2>move this field into tracker_alert</h2><h4>../src/alert.cpp:404</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(156)">../src/alert.cpp:404</a></td><td>move this field into tracker_alert</td></tr><tr id="156" style="display: none;" colspan="3"><td colspan="3"><h2>move this field into tracker_alert</h2><h4>../src/alert.cpp:404</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  		return torrent_alert::message() + ": state changed to: "
│ │ │ │  			+ state_str[state];
│ │ │ │  #endif
│ │ │ │  	}
│ │ │ │  
│ │ │ │  	tracker_error_alert::tracker_error_alert(aux::stack_allocator&amp; alloc
│ │ │ │  		, torrent_handle const&amp; h, tcp::endpoint const&amp; ep, int times
│ │ │ │ @@ -7500,15 +5822,15 @@
│ │ │ │  
│ │ │ │  	tracker_warning_alert::tracker_warning_alert(aux::stack_allocator&amp; alloc
│ │ │ │  		, torrent_handle const&amp; h, tcp::endpoint const&amp; ep
│ │ │ │  		, string_view u, protocol_version v, string_view m)
│ │ │ │  		: tracker_alert(alloc, h, ep, u)
│ │ │ │  		, m_msg_idx(alloc.copy_string(m))
│ │ │ │  #if TORRENT_ABI_VERSION == 1
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(190)">../src/alert.cpp:438</a></td><td>move this into tracker_alert</td></tr><tr id="190" style="display: none;" colspan="3"><td colspan="3"><h2>move this into tracker_alert</h2><h4>../src/alert.cpp:438</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		return {};
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(157)">../src/alert.cpp:438</a></td><td>move this into tracker_alert</td></tr><tr id="157" style="display: none;" colspan="3"><td colspan="3"><h2>move this into tracker_alert</h2><h4>../src/alert.cpp:438</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		return {};
│ │ │ │  #else
│ │ │ │  		char ret[400];
│ │ │ │  		std::snprintf(ret, sizeof(ret), "%s %s %s \"%s\" (%d)"
│ │ │ │  			, tracker_alert::message().c_str()
│ │ │ │  			, version == protocol_version::V1 ? "v1" : "v2"
│ │ │ │  			, convert_from_native(error.message()).c_str(), error_message()
│ │ │ │  			, times_in_row);
│ │ │ │ @@ -7545,15 +5867,15 @@
│ │ │ │  
│ │ │ │  	scrape_reply_alert::scrape_reply_alert(aux::stack_allocator&amp; alloc
│ │ │ │  		, torrent_handle const&amp; h, tcp::endpoint const&amp; ep
│ │ │ │  		, int incomp, int comp, string_view u, protocol_version const v)
│ │ │ │  		: tracker_alert(alloc, h, ep, u)
│ │ │ │  		, incomplete(incomp)
│ │ │ │  		, complete(comp)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(191)">../src/alert.cpp:464</a></td><td>move this into tracker_alert</td></tr><tr id="191" style="display: none;" colspan="3"><td colspan="3"><h2>move this into tracker_alert</h2><h4>../src/alert.cpp:464</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	char const* tracker_warning_alert::warning_message() const
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(158)">../src/alert.cpp:464</a></td><td>move this into tracker_alert</td></tr><tr id="158" style="display: none;" colspan="3"><td colspan="3"><h2>move this into tracker_alert</h2><h4>../src/alert.cpp:464</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	char const* tracker_warning_alert::warning_message() const
│ │ │ │  	{
│ │ │ │  		return m_alloc.get().ptr(m_msg_idx);
│ │ │ │  	}
│ │ │ │  
│ │ │ │  	std::string tracker_warning_alert::message() const
│ │ │ │  	{
│ │ │ │  #ifdef TORRENT_DISABLE_ALERT_MSG
│ │ │ │ @@ -7593,15 +5915,15 @@
│ │ │ │  		, string_view u, protocol_version const v, error_code const&amp; e)
│ │ │ │  		: tracker_alert(alloc, h, ep, u)
│ │ │ │  		, error(e)
│ │ │ │  		, m_msg_idx()
│ │ │ │  #if TORRENT_ABI_VERSION == 1
│ │ │ │  		, msg(convert_from_native(e.message()))
│ │ │ │  #endif
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(192)">../src/alert.cpp:493</a></td><td>move this into tracker_alert</td></tr><tr id="192" style="display: none;" colspan="3"><td colspan="3"><h2>move this into tracker_alert</h2><h4>../src/alert.cpp:493</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		return {};
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(159)">../src/alert.cpp:493</a></td><td>move this into tracker_alert</td></tr><tr id="159" style="display: none;" colspan="3"><td colspan="3"><h2>move this into tracker_alert</h2><h4>../src/alert.cpp:493</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		return {};
│ │ │ │  #else
│ │ │ │  		char ret[400];
│ │ │ │  		std::snprintf(ret, sizeof(ret), "%s %s scrape reply: %d %d"
│ │ │ │  			, tracker_alert::message().c_str()
│ │ │ │  			, version == protocol_version::V1 ? "v1" : "v2"
│ │ │ │  			, incomplete, complete);
│ │ │ │  		return ret;
│ │ │ │ @@ -7644,15 +5966,15 @@
│ │ │ │  	std::string scrape_failed_alert::message() const
│ │ │ │  	{
│ │ │ │  #ifdef TORRENT_DISABLE_ALERT_MSG
│ │ │ │  		return {};
│ │ │ │  #else
│ │ │ │  		return tracker_alert::message() + " scrape failed: " + error_message();
│ │ │ │  #endif
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(193)">../src/alert.cpp:532</a></td><td>move this field into tracker_alert</td></tr><tr id="193" style="display: none;" colspan="3"><td colspan="3"><h2>move this field into tracker_alert</h2><h4>../src/alert.cpp:532</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	char const* scrape_failed_alert::error_message() const
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(160)">../src/alert.cpp:532</a></td><td>move this field into tracker_alert</td></tr><tr id="160" style="display: none;" colspan="3"><td colspan="3"><h2>move this field into tracker_alert</h2><h4>../src/alert.cpp:532</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	char const* scrape_failed_alert::error_message() const
│ │ │ │  	{
│ │ │ │  		if (m_msg_idx == aux::allocation_slot()) return "";
│ │ │ │  		else return m_alloc.get().ptr(m_msg_idx);
│ │ │ │  	}
│ │ │ │  
│ │ │ │  	std::string scrape_failed_alert::message() const
│ │ │ │  	{
│ │ │ │ @@ -7695,15 +6017,15 @@
│ │ │ │  	{}
│ │ │ │  
│ │ │ │  	std::string dht_reply_alert::message() const
│ │ │ │  	{
│ │ │ │  #ifdef TORRENT_DISABLE_ALERT_MSG
│ │ │ │  		return {};
│ │ │ │  #else
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(194)">../src/alert.cpp:576</a></td><td>move this to tracker_alert</td></tr><tr id="194" style="display: none;" colspan="3"><td colspan="3"><h2>move this to tracker_alert</h2><h4>../src/alert.cpp:576</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		, num_peers(np)
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(161)">../src/alert.cpp:576</a></td><td>move this to tracker_alert</td></tr><tr id="161" style="display: none;" colspan="3"><td colspan="3"><h2>move this to tracker_alert</h2><h4>../src/alert.cpp:576</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		, num_peers(np)
│ │ │ │  	{}
│ │ │ │  
│ │ │ │  	std::string dht_reply_alert::message() const
│ │ │ │  	{
│ │ │ │  #ifdef TORRENT_DISABLE_ALERT_MSG
│ │ │ │  		return {};
│ │ │ │  #else
│ │ │ │ @@ -7746,632 +6068,196 @@
│ │ │ │  		TORRENT_ASSERT(index &gt;= piece_index_t(0));
│ │ │ │  	}
│ │ │ │  
│ │ │ │  	std::string hash_failed_alert::message() const
│ │ │ │  	{
│ │ │ │  #ifdef TORRENT_DISABLE_ALERT_MSG
│ │ │ │  		return {};
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(195)">../src/random.cpp:141</a></td><td>improve calling RAND_bytes multiple times, using fallback for now</td></tr><tr id="195" style="display: none;" colspan="3"><td colspan="3"><h2>improve calling RAND_bytes multiple times, using fallback for now</h2><h4>../src/random.cpp:141</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#else
│ │ │ │ -			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });
│ │ │ │ -#endif
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		void crypto_random_bytes(span&lt;char&gt; buffer)
│ │ │ │ -		{
│ │ │ │ -#ifdef TORRENT_BUILD_SIMULATOR
│ │ │ │ -			// In the simulator we want deterministic random numbers
│ │ │ │ -			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });
│ │ │ │ -#elif TORRENT_USE_CNG
│ │ │ │ -			aux::cng_gen_random(buffer);
│ │ │ │ -#elif TORRENT_USE_CRYPTOAPI
│ │ │ │ -			// windows
│ │ │ │ -			aux::crypt_gen_random(buffer);
│ │ │ │ -#elif defined TORRENT_USE_LIBCRYPTO &amp;&amp; !defined TORRENT_USE_WOLFSSL
│ │ │ │ -// wolfSSL uses wc_RNG_GenerateBlock as the internal function for the
│ │ │ │ -// openssl compatibility layer. This function API does not support
│ │ │ │ -// an arbitrary buffer size (openssl does), it is limited by the
│ │ │ │ -// constant RNG_MAX_BLOCK_LEN.
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>			// openssl
│ │ │ │ -			int r = RAND_bytes(reinterpret_cast&lt;unsigned char*&gt;(buffer.data())
│ │ │ │ -				, int(buffer.size()));
│ │ │ │ -			if (r != 1) aux::throw_ex&lt;system_error&gt;(errors::no_entropy);
│ │ │ │ -#elif TORRENT_USE_GETRANDOM
│ │ │ │ -			ssize_t const r = ::getrandom(buffer.data(), static_cast&lt;std::size_t&gt;(buffer.size()), 0);
│ │ │ │ -			if (r == ssize_t(buffer.size())) return;
│ │ │ │ -			if (r == -1 &amp;&amp; errno != ENOSYS) aux::throw_ex&lt;system_error&gt;(error_code(errno, generic_category()));
│ │ │ │ -			static dev_random dev;
│ │ │ │ -			dev.read(buffer);
│ │ │ │ -#elif TORRENT_USE_DEV_RANDOM
│ │ │ │ -			static dev_random dev;
│ │ │ │ -			dev.read(buffer);
│ │ │ │ -#else
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(162)">../src/enum_net.cpp:144</a></td><td>in C++17, use __has_include for this. Other operating systems are likely to require this as well</td></tr><tr id="162" style="display: none;" colspan="3"><td colspan="3"><h2>in C++17, use __has_include for this. Other operating systems are
│ │ │ │ +likely to require this as well</h2><h4>../src/enum_net.cpp:144</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include &lt;arpa/inet.h&gt;
│ │ │ │ +#include &lt;cstring&gt;
│ │ │ │ +#include &lt;cstdlib&gt;
│ │ │ │ +#include &lt;unistd.h&gt;
│ │ │ │ +#include &lt;sys/types.h&gt;
│ │ │ │  
│ │ │ │ -#if TORRENT_BROKEN_RANDOM_DEVICE
│ │ │ │ -			// even pseudo random numbers rely on being able to seed the random
│ │ │ │ -			// generator
│ │ │ │ -#error "no entropy source available"
│ │ │ │ -#else
│ │ │ │ -#ifdef TORRENT_I_WANT_INSECURE_RANDOM_NUMBERS
│ │ │ │ -			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });
│ │ │ │ -#else
│ │ │ │ -#error "no secure entropy source available. If you really want insecure random numbers, define TORRENT_I_WANT_INSECURE_RANDOM_NUMBERS"
│ │ │ │ -#endif
│ │ │ │ +#if defined TORRENT_ANDROID &amp;&amp; !defined IFA_F_DADFAILED
│ │ │ │ +#define IFA_F_DADFAILED 8
│ │ │ │  #endif
│ │ │ │  
│ │ │ │  #endif
│ │ │ │ -		}
│ │ │ │ -}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(196)">../src/storage_utils.cpp:230</a></td><td>ideally, if we end up copying files because of a move across volumes, the source should not be deleted until they've all been copied. That would let us rollback with higher confidence.</td></tr><tr id="196" style="display: none;" colspan="3"><td colspan="3"><h2>ideally, if we end up copying files because of a move across
│ │ │ │ -volumes, the source should not be deleted until they've all been
│ │ │ │ -copied. That would let us rollback with higher confidence.</h2><h4>../src/storage_utils.cpp:230</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// later
│ │ │ │ -		aux::vector&lt;bool, file_index_t&gt; copied_files(std::size_t(f.num_files()), false);
│ │ │ │ -
│ │ │ │ -		// track how far we got in case of an error
│ │ │ │ -		file_index_t file_index{};
│ │ │ │ -		for (auto const i : f.file_range())
│ │ │ │ -		{
│ │ │ │ -			// files moved out to absolute paths are not moved
│ │ │ │ -			if (f.file_absolute_path(i)) continue;
│ │ │ │ -
│ │ │ │ -			std::string const old_path = combine_path(save_path, f.file_path(i));
│ │ │ │ -			std::string const new_path = combine_path(new_save_path, f.file_path(i));
│ │ │ │ -
│ │ │ │ -			error_code ignore;
│ │ │ │ -			if (flags == move_flags_t::dont_replace &amp;&amp; exists(new_path, ignore))
│ │ │ │ -			{
│ │ │ │ -				if (ret == status_t::no_error) ret = status_t::need_full_check;
│ │ │ │ -				continue;
│ │ │ │ -			}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">			move_file(old_path, new_path, ec);
│ │ │ │ -</div>
│ │ │ │ -			// if the source file doesn't exist. That's not a problem
│ │ │ │ -			// we just ignore that file
│ │ │ │ -			if (ec.ec == boost::system::errc::no_such_file_or_directory)
│ │ │ │ -				ec.ec.clear();
│ │ │ │ -			else if (ec
│ │ │ │ -				&amp;&amp; ec.ec != boost::system::errc::invalid_argument
│ │ │ │ -				&amp;&amp; ec.ec != boost::system::errc::permission_denied)
│ │ │ │ -			{
│ │ │ │ -				// moving the file failed
│ │ │ │ -				// on OSX, the error when trying to rename a file across different
│ │ │ │ -				// volumes is EXDEV, which will make it fall back to copying.
│ │ │ │ -				ec.ec.clear();
│ │ │ │ -				copy_file(old_path, new_path, ec);
│ │ │ │ -				if (!ec) copied_files[i] = true;
│ │ │ │ -			}
│ │ │ │ -
│ │ │ │ -			if (ec)
│ │ │ │ -			{
│ │ │ │ -				ec.file(i);
│ │ │ │ -				file_index = i;
│ │ │ │ -				break;
│ │ │ │ -			}
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		if (!ec &amp;&amp; move_partfile)
│ │ │ │ -		{
│ │ │ │ -			error_code e;
│ │ │ │ -			move_partfile(new_save_path, e);
│ │ │ │ -			if (e)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(197)">../src/storage_utils.cpp:538</a></td><td>it would seem reasonable to, instead, set the have_pieces bits for the pieces representing these files, and resume with the normal logic</td></tr><tr id="197" style="display: none;" colspan="3"><td colspan="3"><h2>it would seem reasonable to, instead, set the have_pieces bits
│ │ │ │ -for the pieces representing these files, and resume with the normal
│ │ │ │ -logic</h2><h4>../src/storage_utils.cpp:538</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">					continue;
│ │ │ │ -
│ │ │ │ -				std::int64_t const size = get_filesize(stat, file_index, fs
│ │ │ │ -					, save_path, ec);
│ │ │ │ -				if (size &lt; 0) return false;
│ │ │ │  
│ │ │ │ -				if (size &lt; fs.file_size(file_index))
│ │ │ │ -				{
│ │ │ │ -					ec.ec = errors::mismatching_file_size;
│ │ │ │ -					ec.file(file_index);
│ │ │ │ -					ec.operation = operation_t::check_resume;
│ │ │ │ -					return false;
│ │ │ │ -				}
│ │ │ │ -			}
│ │ │ │ -			return true;
│ │ │ │ -		}
│ │ │ │ +#if TORRENT_USE_IFADDRS
│ │ │ │ +#include &lt;ifaddrs.h&gt;
│ │ │ │ +#include &lt;net/if.h&gt;
│ │ │ │ +#include &lt;sys/ioctl.h&gt;
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS
│ │ │ │ -		// always trigger a full recheck when we pull in files from other
│ │ │ │ -		// torrents, via hard links
│ │ │ │ -<div style="background: #ffff00" width="100%">		if (added_files) return false;
│ │ │ │ +#if TORRENT_USE_IFADDRS || TORRENT_USE_IFCONF || TORRENT_USE_NETLINK || TORRENT_USE_SYSCTL
│ │ │ │ +#ifdef TORRENT_BEOS
│ │ │ │ +<div style="background: #ffff00" width="100%">#include &lt;sys/sockio.h&gt;
│ │ │ │  </div>#endif
│ │ │ │ +// capture this here where warnings are disabled (the macro generates warnings)
│ │ │ │ +const unsigned long siocgifmtu = SIOCGIFMTU;
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -		// parse have bitmask. Verify that the files we expect to have
│ │ │ │ -		// actually do exist
│ │ │ │ -		piece_index_t const end_piece = std::min(rd.have_pieces.end_index(), fs.end_piece());
│ │ │ │ -		for (piece_index_t i(0); i &lt; end_piece; ++i)
│ │ │ │ -		{
│ │ │ │ -			if (rd.have_pieces.get_bit(i) == false) continue;
│ │ │ │ -
│ │ │ │ -			std::vector&lt;file_slice&gt; f = fs.map_block(i, 0, 1);
│ │ │ │ -			TORRENT_ASSERT(!f.empty());
│ │ │ │ -
│ │ │ │ -			file_index_t const file_index = f[0].file_index;
│ │ │ │ -
│ │ │ │ -			// files with priority zero may not have been saved to disk at their
│ │ │ │ -			// expected location, but is likely to be in a partfile. Just exempt it
│ │ │ │ -			// from checking
│ │ │ │ -			if (file_index &lt; file_priority.end_index()
│ │ │ │ -				&amp;&amp; file_priority[file_index] == dont_download)
│ │ │ │ -				continue;
│ │ │ │ -
│ │ │ │ -			if (fs.pad_file_at(file_index)) continue;
│ │ │ │ -
│ │ │ │ -			if (get_filesize(stat, file_index, fs, save_path, ec) &lt; 0)
│ │ │ │ -				return false;
│ │ │ │ -
│ │ │ │ -			// OK, this file existed, good. Now, skip all remaining pieces in
│ │ │ │ -			// this file. We're just sanity-checking whether the files exist
│ │ │ │ -			// or not.
│ │ │ │ -			peer_request const pr = fs.map_file(file_index
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(198)">../src/peer_connection.cpp:1105</a></td><td>this should be the global download rate</td></tr><tr id="198" style="display: none;" colspan="3"><td colspan="3"><h2>this should be the global download rate</h2><h4>../src/peer_connection.cpp:1105</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -		int rate = 0;
│ │ │ │ -
│ │ │ │ -		// if we haven't received any data recently, the current download rate
│ │ │ │ -		// is not representative
│ │ │ │ -		if (aux::time_now() - m_last_piece.get(m_connect) &gt; seconds(30) &amp;&amp; m_download_rate_peak &gt; 0)
│ │ │ │ -		{
│ │ │ │ -			rate = m_download_rate_peak;
│ │ │ │ -		}
│ │ │ │ -		else if (aux::time_now() - m_last_unchoked.get(m_connect) &lt; seconds(5)
│ │ │ │ -			&amp;&amp; m_statistics.total_payload_upload() &lt; 2 * 0x4000)
│ │ │ │ -		{
│ │ │ │ -			// if we're have only been unchoked for a short period of time,
│ │ │ │ -			// we don't know what rate we can get from this peer. Instead of assuming
│ │ │ │ -			// the lowest possible rate, assume the average.
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │  
│ │ │ │ -			int peers_with_requests = int(stats_counters()[counters::num_peers_down_requests]);
│ │ │ │ -			// avoid division by 0
│ │ │ │ -			if (peers_with_requests == 0) peers_with_requests = 1;
│ │ │ │ +#if defined(TORRENT_OS2) &amp;&amp; !defined(IF_NAMESIZE)
│ │ │ │ +#define IF_NAMESIZE IFNAMSIZ
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">			rate = t-&gt;statistics().transfer_rate(stat::download_payload) / peers_with_requests;
│ │ │ │ -</div>		}
│ │ │ │ -		else
│ │ │ │ -		{
│ │ │ │ -			// current download rate in bytes per seconds
│ │ │ │ -			rate = m_statistics.transfer_rate(stat::download_payload);
│ │ │ │ -		}
│ │ │ │ +namespace libtorrent {
│ │ │ │  
│ │ │ │ -		// avoid division by zero
│ │ │ │ -		if (rate &lt; 50) rate = 50;
│ │ │ │ +namespace {
│ │ │ │  
│ │ │ │ -		// average of current rate and peak
│ │ │ │ -//		rate = (rate + m_download_rate_peak) / 2;
│ │ │ │ +#if !defined TORRENT_WINDOWS &amp;&amp; !defined TORRENT_BUILD_SIMULATOR
│ │ │ │ +	struct socket_closer
│ │ │ │ +	{
│ │ │ │ +		socket_closer(int s) : m_socket(s) {}
│ │ │ │ +		socket_closer(socket_closer const&amp;) = delete;
│ │ │ │ +		socket_closer(socket_closer &amp;&amp;) = delete;
│ │ │ │ +		socket_closer&amp; operator=(socket_closer const&amp;) = delete;
│ │ │ │ +		socket_closer&amp; operator=(socket_closer &amp;&amp;) = delete;
│ │ │ │ +		~socket_closer() { ::close(m_socket); }
│ │ │ │ +	private:
│ │ │ │ +		int m_socket;
│ │ │ │ +	};
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -		return milliseconds((m_outstanding_bytes + extra_bytes
│ │ │ │ -			+ m_queued_time_critical * t-&gt;block_size() * 1000) / rate);
│ │ │ │ +#if !defined TORRENT_BUILD_SIMULATOR
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(163)">../src/enum_net.cpp:268</a></td><td>if we get here, the caller still assumes the error code is reported via errno</td></tr><tr id="163" style="display: none;" colspan="3"><td colspan="3"><h2>if we get here, the caller still assumes the error code
│ │ │ │ +is reported via errno</h2><h4>../src/enum_net.cpp:268</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		;
│ │ │ │  	}
│ │ │ │ +#endif
│ │ │ │  
│ │ │ │ -	void peer_connection::add_stat(std::int64_t const downloaded, std::int64_t const uploaded)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -		m_statistics.add_stat(downloaded, uploaded);
│ │ │ │ -	}
│ │ │ │ +#if TORRENT_USE_NETLINK
│ │ │ │  
│ │ │ │ -	sha1_hash peer_connection::associated_info_hash() const
│ │ │ │ +	int read_nl_sock(int sock, std::uint32_t const seq, std::uint32_t const pid
│ │ │ │ +		, std::function&lt;void(nlmsghdr const*)&gt; on_msg)
│ │ │ │  	{
│ │ │ │ -		std::shared_ptr&lt;torrent&gt; t = associated_torrent().lock();
│ │ │ │ -		TORRENT_ASSERT(t);
│ │ │ │ -		auto const&amp; ih = t-&gt;info_hash();
│ │ │ │ -		// if protocol_v2 is set on the peer, this better be a v2 torrent,
│ │ │ │ -		// otherwise something isn't right
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(199)">../src/peer_connection.cpp:3536</a></td><td>sort the allowed fast set in priority order</td></tr><tr id="199" style="display: none;" colspan="3"><td colspan="3"><h2>sort the allowed fast set in priority order</h2><h4>../src/peer_connection.cpp:3536</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -		// if the peer has the piece and we want
│ │ │ │ -		// to download it, request it
│ │ │ │ -		if (index &lt; m_have_piece.end_index()
│ │ │ │ -			&amp;&amp; m_have_piece[index]
│ │ │ │ -			&amp;&amp; !t-&gt;have_piece(index)
│ │ │ │ -			&amp;&amp; t-&gt;valid_metadata()
│ │ │ │ -			&amp;&amp; t-&gt;has_picker()
│ │ │ │ -			&amp;&amp; t-&gt;picker().piece_priority(index) &gt; dont_download)
│ │ │ │ +		std::array&lt;char, 4096&gt; buf;
│ │ │ │ +		for (;;)
│ │ │ │  		{
│ │ │ │ -			t-&gt;peer_is_interesting(*this);
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	std::vector&lt;piece_index_t&gt; const&amp; peer_connection::allowed_fast()
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -		std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ -		TORRENT_ASSERT(t);
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		return m_allowed_fast;
│ │ │ │ -</div>	}
│ │ │ │ +			int const read_len = int(recv(sock, buf.data(), buf.size(), 0));
│ │ │ │ +			if (read_len &lt; 0) return -1;
│ │ │ │  
│ │ │ │ -	bool peer_connection::can_request_time_critical() const
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -		if (has_peer_choked() || !is_interesting()) return false;
│ │ │ │ -		if (int(m_download_queue.size()) + int(m_request_queue.size())
│ │ │ │ -			&gt; m_desired_queue_size * 2) return false;
│ │ │ │ -		if (on_parole()) return false;
│ │ │ │ -		if (m_disconnecting) return false;
│ │ │ │ -		std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ -		TORRENT_ASSERT(t);
│ │ │ │ -		if (t-&gt;upload_mode()) return false;
│ │ │ │ +			auto const* nl_hdr = reinterpret_cast&lt;nlmsghdr const*&gt;(buf.data());
│ │ │ │ +			int len = read_len;
│ │ │ │  
│ │ │ │ -		// ignore snubbed peers, since they're not likely to return pieces in a
│ │ │ │ -		// timely manner anyway
│ │ │ │ -		if (m_snubbed) return false;
│ │ │ │ -		return true;
│ │ │ │ -	}
│ │ │ │ +			for (; len &gt; 0 &amp;&amp; aux::nlmsg_ok(nl_hdr, len); nl_hdr = aux::nlmsg_next(nl_hdr, len))
│ │ │ │ +			{
│ │ │ │ +<div style="background: #ffff00" width="100%">				if ((aux::nlmsg_ok(nl_hdr, read_len) == 0) || (nl_hdr-&gt;nlmsg_type == NLMSG_ERROR))
│ │ │ │ +</div>					return -1;
│ │ │ │ +				// this function doesn't handle multiple requests at the same time
│ │ │ │ +				// so report an error if the message does not have the expected seq and pid
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(164)">../src/enum_net.cpp:274</a></td><td>if we get here, the caller still assumes the error code is reported via errno</td></tr><tr id="164" style="display: none;" colspan="3"><td colspan="3"><h2>if we get here, the caller still assumes the error code
│ │ │ │ +is reported via errno</h2><h4>../src/enum_net.cpp:274</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#if TORRENT_USE_NETLINK
│ │ │ │  
│ │ │ │ -	bool peer_connection::make_time_critical(piece_block const&amp; block)
│ │ │ │ +	int read_nl_sock(int sock, std::uint32_t const seq, std::uint32_t const pid
│ │ │ │ +		, std::function&lt;void(nlmsghdr const*)&gt; on_msg)
│ │ │ │  	{
│ │ │ │ -		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -		auto const rit = std::find_if(m_request_queue.begin()
│ │ │ │ -			, m_request_queue.end(), aux::has_block(block));
│ │ │ │ -		if (rit == m_request_queue.end()) return false;
│ │ │ │ -#if TORRENT_USE_ASSERTS
│ │ │ │ -		std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ -		TORRENT_ASSERT(t);
│ │ │ │ -		TORRENT_ASSERT(t-&gt;has_picker());
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(200)">../src/performance_counters.cpp:40</a></td><td>move stats_counter_t out of counters</td></tr><tr id="200" style="display: none;" colspan="3"><td colspan="3"><h2>move stats_counter_t out of counters</h2><h4>../src/performance_counters.cpp:40</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(201)">../src/performance_counters.cpp:41</a></td><td>should bittorrent keep-alive messages have a counter too?</td></tr><tr id="201" style="display: none;" colspan="3"><td colspan="3"><h2>should bittorrent keep-alive messages have a counter too?</h2><h4>../src/performance_counters.cpp:41</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(202)">../src/performance_counters.cpp:42</a></td><td>It would be nice if this could be an internal type. default_disk_constructor depends on it now</td></tr><tr id="202" style="display: none;" colspan="3"><td colspan="3"><h2>It would be nice if this could be an internal type. default_disk_constructor depends on it now</h2><h4>../src/performance_counters.cpp:42</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
│ │ │ │ -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
│ │ │ │ -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
│ │ │ │ -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
│ │ │ │ -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
│ │ │ │ -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
│ │ │ │ -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
│ │ │ │ -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
│ │ │ │ -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
│ │ │ │ -POSSIBILITY OF SUCH DAMAGE.
│ │ │ │ -
│ │ │ │ -*/
│ │ │ │ +		std::array&lt;char, 4096&gt; buf;
│ │ │ │ +		for (;;)
│ │ │ │ +		{
│ │ │ │ +			int const read_len = int(recv(sock, buf.data(), buf.size(), 0));
│ │ │ │ +			if (read_len &lt; 0) return -1;
│ │ │ │  
│ │ │ │ -#include "libtorrent/performance_counters.hpp"
│ │ │ │ -#include "libtorrent/assert.hpp"
│ │ │ │ -#include &lt;cstring&gt; // for memset
│ │ │ │ +			auto const* nl_hdr = reinterpret_cast&lt;nlmsghdr const*&gt;(buf.data());
│ │ │ │ +			int len = read_len;
│ │ │ │  
│ │ │ │ -namespace libtorrent {
│ │ │ │ +			for (; len &gt; 0 &amp;&amp; aux::nlmsg_ok(nl_hdr, len); nl_hdr = aux::nlmsg_next(nl_hdr, len))
│ │ │ │ +			{
│ │ │ │ +				if ((aux::nlmsg_ok(nl_hdr, read_len) == 0) || (nl_hdr-&gt;nlmsg_type == NLMSG_ERROR))
│ │ │ │ +					return -1;
│ │ │ │ +				// this function doesn't handle multiple requests at the same time
│ │ │ │ +				// so report an error if the message does not have the expected seq and pid
│ │ │ │ +<div style="background: #ffff00" width="100%">				if (nl_hdr-&gt;nlmsg_seq != seq || nl_hdr-&gt;nlmsg_pid != pid)
│ │ │ │ +</div>					return -1;
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">	counters::counters() TORRENT_COUNTER_NOEXCEPT
│ │ │ │ -</div>	{
│ │ │ │ -#ifdef ATOMIC_LLONG_LOCK_FREE
│ │ │ │ -		for (auto&amp; counter : m_stats_counter)
│ │ │ │ -			counter.store(0, std::memory_order_relaxed);
│ │ │ │ -#else
│ │ │ │ -		m_stats_counter.fill(0);
│ │ │ │ -#endif
│ │ │ │ -	}
│ │ │ │ +				if (nl_hdr-&gt;nlmsg_type == NLMSG_DONE) return 0;
│ │ │ │  
│ │ │ │ -	counters::counters(counters const&amp; c) TORRENT_COUNTER_NOEXCEPT
│ │ │ │ -	{
│ │ │ │ -#ifdef ATOMIC_LLONG_LOCK_FREE
│ │ │ │ -		for (int i = 0; i &lt; m_stats_counter.end_index(); ++i)
│ │ │ │ -			m_stats_counter[i].store(
│ │ │ │ -				c.m_stats_counter[i].load(std::memory_order_relaxed)
│ │ │ │ -					, std::memory_order_relaxed);
│ │ │ │ -#else
│ │ │ │ -		std::lock_guard&lt;std::mutex&gt; l(c.m_mutex);
│ │ │ │ -		m_stats_counter = c.m_stats_counter;
│ │ │ │ -#endif
│ │ │ │ -	}
│ │ │ │ +				on_msg(nl_hdr);
│ │ │ │  
│ │ │ │ -	counters&amp; counters::operator=(counters const&amp; c) &amp; TORRENT_COUNTER_NOEXCEPT
│ │ │ │ -	{
│ │ │ │ -		if (&amp;c == this) return *this;
│ │ │ │ -#ifdef ATOMIC_LLONG_LOCK_FREE
│ │ │ │ -		for (int i = 0; i &lt; m_stats_counter.end_index(); ++i)
│ │ │ │ -			m_stats_counter[i].store(
│ │ │ │ -				c.m_stats_counter[i].load(std::memory_order_relaxed)
│ │ │ │ -					, std::memory_order_relaxed);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(203)">../src/piece_picker.cpp:121</a></td><td>find a better place for this</td></tr><tr id="203" style="display: none;" colspan="3"><td colspan="3"><h2>find a better place for this</h2><h4>../src/piece_picker.cpp:121</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			if (limit == 0)
│ │ │ │ -			{
│ │ │ │ -				std::cerr &lt;&lt; " ...";
│ │ │ │ -				break;
│ │ │ │ -			}
│ │ │ │ -			if (*i == -1) break;
│ │ │ │ -			while (j != p.m_priority_boundaries.end() &amp;&amp; *j &lt;= index)
│ │ │ │ -			{
│ │ │ │ -				std::cerr &lt;&lt; "| ";
│ │ │ │ -				++j;
│ │ │ │ +				if ((nl_hdr-&gt;nlmsg_flags &amp; NLM_F_MULTI) == 0) return 0;
│ │ │ │  			}
│ │ │ │ -			std::cerr &lt;&lt; *i &lt;&lt; "(" &lt;&lt; p.m_piece_map[*i].index &lt;&lt; ") ";
│ │ │ │ -			--limit;
│ │ │ │  		}
│ │ │ │ -		std::cerr &lt;&lt; std::endl;
│ │ │ │ +//		return 0;
│ │ │ │  	}
│ │ │ │ -}
│ │ │ │ -#endif // TORRENT_PICKER_LOG
│ │ │ │ -namespace libtorrent {
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	const piece_block piece_block::invalid(
│ │ │ │ -</div>		std::numeric_limits&lt;piece_index_t&gt;::max()
│ │ │ │ -		, std::numeric_limits&lt;int&gt;::max());
│ │ │ │ -
│ │ │ │ -	constexpr prio_index_t piece_picker::piece_pos::we_have_index;
│ │ │ │ -
│ │ │ │ -	constexpr picker_options_t piece_picker::rarest_first;
│ │ │ │ -	constexpr picker_options_t piece_picker::reverse;
│ │ │ │ -	constexpr picker_options_t piece_picker::on_parole;
│ │ │ │ -	constexpr picker_options_t piece_picker::prioritize_partials;
│ │ │ │ -	constexpr picker_options_t piece_picker::sequential;
│ │ │ │ -	constexpr picker_options_t piece_picker::align_expanded_pieces;
│ │ │ │ -	constexpr picker_options_t piece_picker::piece_extent_affinity;
│ │ │ │ -
│ │ │ │ -	constexpr download_queue_t piece_picker::piece_pos::piece_downloading;
│ │ │ │ -	constexpr download_queue_t piece_picker::piece_pos::piece_full;
│ │ │ │ -	constexpr download_queue_t piece_picker::piece_pos::piece_finished;
│ │ │ │ -	constexpr download_queue_t piece_picker::piece_pos::piece_zero_prio;
│ │ │ │ -	constexpr download_queue_t piece_picker::piece_pos::num_download_categories;
│ │ │ │ -	constexpr download_queue_t piece_picker::piece_pos::piece_open;
│ │ │ │ -	constexpr download_queue_t piece_picker::piece_pos::piece_downloading_reverse;
│ │ │ │ -	constexpr download_queue_t piece_picker::piece_pos::piece_full_reverse;
│ │ │ │ -
│ │ │ │ -	// the max number of blocks to create an affinity for
│ │ │ │ -	constexpr int max_piece_affinity_extent = 4 * 1024 * 1024 / default_block_size;
│ │ │ │  
│ │ │ │ -	piece_picker::piece_picker(std::int64_t const total_size, int const piece_size)
│ │ │ │ -		: m_priority_boundaries(1, m_pieces.end_index())
│ │ │ │ +	int nl_dump_request(int const sock, std::uint32_t const seq
│ │ │ │ +		, nlmsghdr* const request_msg, std::function&lt;void(nlmsghdr const*)&gt; on_msg)
│ │ │ │  	{
│ │ │ │ -		TORRENT_ASSERT(total_size &gt; 0);
│ │ │ │ -		TORRENT_ASSERT(piece_size &gt; 0);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(204)">../src/piece_picker.cpp:2067</a></td><td>this could probably be optimized by incrementally calling partial_sort to sort one more element in the list. Because chances are that we'll just need a single piece, and once we've picked from it we're done. Sorting the rest of the list in that case is a waste of time.</td></tr><tr id="204" style="display: none;" colspan="3"><td colspan="3"><h2>this could probably be optimized by incrementally
│ │ │ │ -calling partial_sort to sort one more element in the list. Because
│ │ │ │ -chances are that we'll just need a single piece, and once we've
│ │ │ │ -picked from it we're done. Sorting the rest of the list in that
│ │ │ │ -case is a waste of time.</h2><h4>../src/piece_picker.cpp:2067</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			// now, copy over the pointers. We also apply a filter here to not
│ │ │ │ -			// include ineligible pieces in certain modes. For instance, a piece
│ │ │ │ -			// that the current peer doesn't have is not included.
│ │ │ │ -			for (auto&amp; dp : m_downloads[piece_pos::piece_downloading])
│ │ │ │ -			{
│ │ │ │ -				pc.inc_stats_counter(counters::piece_picker_partial_loops);
│ │ │ │ -
│ │ │ │ -				if (!is_piece_free(dp.index, pieces)) continue;
│ │ │ │ -
│ │ │ │ -				TORRENT_ASSERT(m_piece_map[dp.index].download_queue()
│ │ │ │ -					== piece_pos::piece_downloading);
│ │ │ │ -
│ │ │ │ -				ordered_partials[num_ordered_partials++] = &amp;dp;
│ │ │ │ -			}
│ │ │ │ +		request_msg-&gt;nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST;
│ │ │ │ +		request_msg-&gt;nlmsg_seq = seq;
│ │ │ │ +		// in theory nlmsg_pid should be set to the netlink port ID (NOT the process ID)
│ │ │ │ +		// of the sender, but the kernel ignores this field so it is typically set to
│ │ │ │ +		// zero
│ │ │ │ +		request_msg-&gt;nlmsg_pid = 0;
│ │ │ │  
│ │ │ │ -			// now, sort the list.
│ │ │ │ -			if (options &amp; rarest_first)
│ │ │ │ -			{
│ │ │ │ -				ret |= picker_log_alert::rarest_first_partials;
│ │ │ │ +		if (::send(sock, request_msg, request_msg-&gt;nlmsg_len, 0) &lt; 0)
│ │ │ │ +			return -1;
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">				std::sort(ordered_partials.begin(), ordered_partials.begin() + num_ordered_partials
│ │ │ │ -</div>					, std::bind(&amp;piece_picker::partial_compare_rarest_first, this
│ │ │ │ -						, _1, _2));
│ │ │ │ +		// get the socket's port ID so that we can verify it in the response
│ │ │ │ +		sockaddr_nl sock_addr;
│ │ │ │ +		socklen_t sock_addr_len = sizeof(sock_addr);
│ │ │ │ +		if (::getsockname(sock, reinterpret_cast&lt;sockaddr*&gt;(&amp;sock_addr), &amp;sock_addr_len) &lt; 0)
│ │ │ │ +			return -1;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(165)">../src/ut_metadata.cpp:281</a></td><td>we really need to increment the refcounter on the torrent while this buffer is still in the peer's send buffer</td></tr><tr id="165" style="display: none;" colspan="3"><td colspan="3"><h2>we really need to increment the refcounter on the torrent
│ │ │ │ +while this buffer is still in the peer's send buffer</h2><h4>../src/ut_metadata.cpp:281</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				int const offset = piece * 16 * 1024;
│ │ │ │ +				metadata = m_tp.metadata().data() + offset;
│ │ │ │ +				metadata_piece_size = std::min(
│ │ │ │ +					int(m_tp.metadata().size()) - offset, 16 * 1024);
│ │ │ │ +				TORRENT_ASSERT(metadata_piece_size &gt; 0);
│ │ │ │ +				TORRENT_ASSERT(offset &gt;= 0);
│ │ │ │ +				TORRENT_ASSERT(offset + metadata_piece_size &lt;= m_tp.metadata().size());
│ │ │ │  			}
│ │ │ │  
│ │ │ │ -			for (int i = 0; i &lt; num_ordered_partials; ++i)
│ │ │ │ -			{
│ │ │ │ -				ret |= picker_log_alert::prioritize_partials;
│ │ │ │ +			char msg[200];
│ │ │ │ +			char* header = msg;
│ │ │ │ +			char* p = &amp;msg[6];
│ │ │ │ +			int const len = bencode(p, e);
│ │ │ │ +			int const total_size = 2 + len + metadata_piece_size;
│ │ │ │ +			namespace io = aux;
│ │ │ │ +			io::write_uint32(total_size, header);
│ │ │ │ +			io::write_uint8(bt_peer_connection::msg_extended, header);
│ │ │ │ +			io::write_uint8(m_message_index, header);
│ │ │ │  
│ │ │ │ -				num_blocks = add_blocks_downloading(*ordered_partials[i], pieces
│ │ │ │ -					, interesting_blocks, backup_blocks, backup_blocks2
│ │ │ │ -					, num_blocks, prefer_contiguous_blocks, peer, options);
│ │ │ │ -				if (num_blocks &lt;= 0) return ret;
│ │ │ │ -				if (int(backup_blocks.size()) &gt;= num_blocks
│ │ │ │ -					&amp;&amp; int(backup_blocks2.size()) &gt;= num_blocks)
│ │ │ │ -					break;
│ │ │ │ +			m_pc.send_buffer({msg, len + 6});
│ │ │ │ +<div style="background: #ffff00" width="100%">			if (metadata_piece_size)
│ │ │ │ +</div>			{
│ │ │ │ +				m_pc.append_const_send_buffer(
│ │ │ │ +					span&lt;char&gt;(const_cast&lt;char*&gt;(metadata), metadata_piece_size), metadata_piece_size);
│ │ │ │  			}
│ │ │ │  
│ │ │ │ -			num_blocks = append_blocks(interesting_blocks, backup_blocks
│ │ │ │ -				, num_blocks);
│ │ │ │ -			if (num_blocks &lt;= 0) return ret;
│ │ │ │ -
│ │ │ │ -			num_blocks = append_blocks(interesting_blocks, backup_blocks2
│ │ │ │ -				, num_blocks);
│ │ │ │ -			if (num_blocks &lt;= 0) return ret;
│ │ │ │ +			m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_extended);
│ │ │ │ +			m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_metadata);
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -		if (!suggested_pieces.empty())
│ │ │ │ +		bool on_extended(int const length
│ │ │ │ +			, int const extended_msg, span&lt;char const&gt; body) override
│ │ │ │  		{
│ │ │ │ -			for (piece_index_t i : suggested_pieces)
│ │ │ │ -			{
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(205)">../src/piece_picker.cpp:2211</a></td><td>Is it a good idea that this affinity takes precedence over piece priority?</td></tr><tr id="205" style="display: none;" colspan="3"><td colspan="3"><h2>Is it a good idea that this affinity takes precedence over
│ │ │ │ -piece priority?</h2><h4>../src/piece_picker.cpp:2211</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">					prio_index_t const end = priority_end(i);
│ │ │ │ -					for (prio_index_t p = prev(end); p &gt;= start; --p)
│ │ │ │ -					{
│ │ │ │ -						pc.inc_stats_counter(counters::piece_picker_reverse_rare_loops);
│ │ │ │ -
│ │ │ │ -						if (!is_piece_free(m_pieces[p], pieces)) continue;
│ │ │ │ -
│ │ │ │ -						ret |= picker_log_alert::reverse_rarest_first;
│ │ │ │ +			if (extended_msg != 2) return false;
│ │ │ │ +			if (m_message_index == 0) return false;
│ │ │ │  
│ │ │ │ -						num_blocks = add_blocks(m_pieces[p], pieces
│ │ │ │ -							, interesting_blocks, backup_blocks
│ │ │ │ -							, backup_blocks2, num_blocks
│ │ │ │ -							, prefer_contiguous_blocks, peer, ignored_pieces
│ │ │ │ -							, options);
│ │ │ │ -						if (num_blocks &lt;= 0) return ret;
│ │ │ │ -					}
│ │ │ │ -				}
│ │ │ │ -			}
│ │ │ │ -			else
│ │ │ │ +			if (length &gt; 17 * 1024)
│ │ │ │  			{
│ │ │ │ -<div style="background: #ffff00" width="100%">				if (options &amp; piece_extent_affinity)
│ │ │ │ -</div>				{
│ │ │ │ -					int to_erase = -1;
│ │ │ │ -					int idx = -1;
│ │ │ │ -					for (piece_extent_t const e : m_recent_extents)
│ │ │ │ -					{
│ │ │ │ -						++idx;
│ │ │ │ -						bool have_all = true;
│ │ │ │ -						for (piece_index_t const p : extent_for(e))
│ │ │ │ -						{
│ │ │ │ -							if (!m_piece_map[p].have()) have_all = false;
│ │ │ │ -							if (!is_piece_free(p, pieces)) continue;
│ │ │ │ -
│ │ │ │ -							ret |= picker_log_alert::extent_affinity;
│ │ │ │ -
│ │ │ │ -							num_blocks = add_blocks(p, pieces
│ │ │ │ -								, interesting_blocks, backup_blocks
│ │ │ │ -								, backup_blocks2, num_blocks
│ │ │ │ -								, prefer_contiguous_blocks, peer, ignored_pieces
│ │ │ │ -								, options);
│ │ │ │ -							if (num_blocks &lt;= 0)
│ │ │ │ -							{
│ │ │ │ -								// if we have all pieces belonging to this extent, remove it
│ │ │ │ -								if (to_erase != -1) m_recent_extents.erase(m_recent_extents.begin() + to_erase);
│ │ │ │ -								return ret;
│ │ │ │ -							}
│ │ │ │ -						}
│ │ │ │ -						// if we have all pieces belonging to this extent, remove it
│ │ │ │ -						if (have_all) to_erase = idx;
│ │ │ │ -					}
│ │ │ │ -					if (to_erase != -1) m_recent_extents.erase(m_recent_extents.begin() + to_erase);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(206)">../src/piece_picker.cpp:2566</a></td><td>when expanding pieces for cache stripe reasons, the !downloading condition doesn't make much sense</td></tr><tr id="206" style="display: none;" colspan="3"><td colspan="3"><h2>when expanding pieces for cache stripe reasons,
│ │ │ │ -the !downloading condition doesn't make much sense</h2><h4>../src/piece_picker.cpp:2566</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		TORRENT_ASSERT(index &lt; m_piece_map.end_index());
│ │ │ │ -		if (next(index) == m_piece_map.end_index())
│ │ │ │ -			return m_blocks_in_last_piece;
│ │ │ │ -		else
│ │ │ │ -			return blocks_per_piece();
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	bool piece_picker::is_piece_free(piece_index_t const piece
│ │ │ │ -		, typed_bitfield&lt;piece_index_t&gt; const&amp; bitmask) const
│ │ │ │ -	{
│ │ │ │ -		return bitmask[piece]
│ │ │ │ -			&amp;&amp; !m_piece_map[piece].have()
│ │ │ │ -			&amp;&amp; !m_piece_map[piece].filtered();
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	bool piece_picker::can_pick(piece_index_t const piece
│ │ │ │ -		, typed_bitfield&lt;piece_index_t&gt; const&amp; bitmask) const
│ │ │ │ -	{
│ │ │ │ -		return bitmask[piece]
│ │ │ │ -			&amp;&amp; !m_piece_map[piece].have()
│ │ │ │ -<div style="background: #ffff00" width="100%">			&amp;&amp; !m_piece_map[piece].downloading()
│ │ │ │ -</div>			&amp;&amp; !m_piece_map[piece].filtered();
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -#if TORRENT_USE_INVARIANT_CHECKS
│ │ │ │ -	void piece_picker::check_peers()
│ │ │ │ -	{
│ │ │ │ -		for (auto const&amp; b : m_block_info)
│ │ │ │ -		{
│ │ │ │ -			TORRENT_ASSERT(b.peer == nullptr || static_cast&lt;torrent_peer*&gt;(b.peer)-&gt;in_use);
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -	void piece_picker::clear_peer(torrent_peer* peer)
│ │ │ │ -	{
│ │ │ │ -		for (auto&amp; b : m_block_info)
│ │ │ │ -		{
│ │ │ │ -			if (b.peer == peer) b.peer = nullptr;
│ │ │ │ -		}
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	// the first bool is true if this is the only peer that has requested and downloaded
│ │ │ │ -	// blocks from this piece.
│ │ │ │ -	// the second bool is true if this is the only active peer that is requesting
│ │ │ │ -	// and downloading blocks from this piece. Active means having a connection.
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(207)">../src/piece_picker.cpp:3144</a></td><td>should 5 be configurable?</td></tr><tr id="207" style="display: none;" colspan="3"><td colspan="3"><h2>should 5 be configurable?</h2><h4>../src/piece_picker.cpp:3144</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		bool have_all = true;
│ │ │ │ -
│ │ │ │ -		for (auto const piece : extent_for(this_extent))
│ │ │ │ -		{
│ │ │ │ -			if (piece == p) continue;
│ │ │ │ -
│ │ │ │ -			if (!m_piece_map[piece].have()) have_all = false;
│ │ │ │ -
│ │ │ │ -			// if at least one piece in this extent has a different priority than
│ │ │ │ -			// the one we just started downloading, don't create an affinity for
│ │ │ │ -			// adjacent pieces. This probably means the pieces belong to different
│ │ │ │ -			// files, or that some other mechanism determining the priority should
│ │ │ │ -			// take precedence.
│ │ │ │ -			if (piece_priority(piece) != this_prio) return;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		// if we already have all the *other* pieces in this extent, there's no
│ │ │ │ -		// need to inflate their priorities
│ │ │ │ -		if (have_all) return;
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		if (m_recent_extents.size() &lt; 5)
│ │ │ │ -</div>			m_recent_extents.push_back(this_extent);
│ │ │ │ -
│ │ │ │ -		// limit the number of extent affinities active at any given time to limit
│ │ │ │ -		// the cost of checking them. Also, don't replace them, commit to
│ │ │ │ -		// finishing them before starting another extent. This is analogous to
│ │ │ │ -		// limiting the number of partial pieces.
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	// options may be 0 or piece_picker::reverse
│ │ │ │ -	// returns false if the block could not be marked as downloading
│ │ │ │ -	bool piece_picker::mark_as_downloading(piece_block const block
│ │ │ │ -		, torrent_peer* peer, picker_options_t const options)
│ │ │ │ -	{
│ │ │ │ -#ifdef TORRENT_PICKER_LOG
│ │ │ │ -		std::cerr &lt;&lt; "[" &lt;&lt; this &lt;&lt; "] " &lt;&lt; "mark_as_downloading( {"
│ │ │ │ -			&lt;&lt; block.piece_index &lt;&lt; ", " &lt;&lt; block.block_index &lt;&lt; "} )" &lt;&lt; std::endl;
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +				m_pc.peer_log(peer_log_alert::incoming_message, "UT_METADATA"
│ │ │ │ +					, "packet too big %d", length);
│ │ │ │  #endif
│ │ │ │ +				m_pc.disconnect(errors::invalid_metadata_message, operation_t::bittorrent, peer_connection_interface::peer_error);
│ │ │ │ +				return true;
│ │ │ │ +			}
│ │ │ │  
│ │ │ │ -		TORRENT_ASSERT(peer == nullptr || peer-&gt;in_use);
│ │ │ │ -		TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
│ │ │ │ -		TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
│ │ │ │ -		TORRENT_ASSERT(block.piece_index &lt; m_piece_map.end_index());
│ │ │ │ -		TORRENT_ASSERT(block.block_index &lt; blocks_in_piece(block.piece_index));
│ │ │ │ -		TORRENT_ASSERT(!m_piece_map[block.piece_index].have());
│ │ │ │ -
│ │ │ │ -		piece_pos&amp; p = m_piece_map[block.piece_index];
│ │ │ │ -		if (p.download_queue() == piece_pos::piece_open)
│ │ │ │ -		{
│ │ │ │ -#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
│ │ │ │ -			INVARIANT_CHECK;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(208)">../src/create_torrent.cpp:618</a></td><td>this can be optimized</td></tr><tr id="208" style="display: none;" colspan="3"><td colspan="3"><h2>this can be optimized</h2><h4>../src/create_torrent.cpp:618</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		std::string&amp; attr = e["attr"].string();
│ │ │ │ -		if (flags &amp; file_storage::flag_pad_file) attr += 'p';
│ │ │ │ -		if (flags &amp; file_storage::flag_hidden) attr += 'h';
│ │ │ │ -		if (flags &amp; file_storage::flag_executable) attr += 'x';
│ │ │ │ -		if (include_symlinks &amp;&amp; (flags &amp; file_storage::flag_symlink)) attr += 'l';
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void add_symlink_path(entry&amp; e, std::string symlink_path)
│ │ │ │ -	{
│ │ │ │ -		entry&amp; sympath_e = e["symlink path"];
│ │ │ │ -
│ │ │ │ -		std::string const link = lexically_relative("", symlink_path);
│ │ │ │ -		for (auto elems = lsplit_path(link); !elems.first.empty();
│ │ │ │ -			elems = lsplit_path(elems.second))
│ │ │ │ -			sympath_e.list().emplace_back(elems.first);
│ │ │ │ -	}
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -	std::vector&lt;char&gt; create_torrent::generate_buf() const
│ │ │ │ -	{
│ │ │ │ -<div style="background: #ffff00" width="100%">		std::vector&lt;char&gt; ret;
│ │ │ │ -</div>		bencode(std::back_inserter(ret), generate());
│ │ │ │ -		return ret;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	entry create_torrent::generate() const
│ │ │ │ -	{
│ │ │ │ -		if (m_files.num_files() == 0 || m_files.total_size() == 0)
│ │ │ │ -			aux::throw_ex&lt;system_error&gt;(errors::torrent_missing_file_tree);
│ │ │ │ -
│ │ │ │ -		// if all v2 hashes are set correctly, generate the v2 parts of the
│ │ │ │ -		// torrent
│ │ │ │ -		bool const make_v2 = validate_v2_hashes(m_files, m_file_piece_hash);
│ │ │ │ -		bool const make_v1 = validate_v1_hashes(m_files, m_piece_hash);
│ │ │ │ -
│ │ │ │ -		// if neither v1 nor v2 hashes were set, we can't create a torrent
│ │ │ │ -		if (!make_v1 &amp;&amp; !make_v2)
│ │ │ │ -			aux::throw_ex&lt;system_error&gt;(errors::invalid_hash_entry);
│ │ │ │ -
│ │ │ │ -		TORRENT_ASSERT(m_files.piece_length() &gt; 0);
│ │ │ │ -
│ │ │ │ -		entry dict;
│ │ │ │ -
│ │ │ │ -		if (!m_urls.empty()) dict["announce"] = m_urls.front().first;
│ │ │ │ +			if (!m_pc.packet_finished()) return true;
│ │ │ │  
│ │ │ │ -		if (!m_nodes.empty())
│ │ │ │ -		{
│ │ │ │ -			entry&amp; nodes = dict["nodes"];
│ │ │ │ -			entry::list_type&amp; nodes_list = nodes.list();
│ │ │ │ -			for (auto const&amp; n : m_nodes)
│ │ │ │ -			{
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(209)">../src/torrent.cpp:1951</a></td><td>this could be optimized by looking up which files are complete and just look at those</td></tr><tr id="209" style="display: none;" colspan="3"><td colspan="3"><h2>this could be optimized by looking up which files are
│ │ │ │ +			error_code ec;
│ │ │ │ +			bdecode_node msg = bdecode(body, ec);
│ │ │ │ +			if (msg.type() != bdecode_node::dict_t)
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(166)">../src/torrent.cpp:1951</a></td><td>this could be optimized by looking up which files are complete and just look at those</td></tr><tr id="166" style="display: none;" colspan="3"><td colspan="3"><h2>this could be optimized by looking up which files are
│ │ │ │  complete and just look at those</h2><h4>../src/torrent.cpp:1951</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">//				TORRENT_ASSERT(picker().have_piece(i));
│ │ │ │  				we_have(i);
│ │ │ │  			}
│ │ │ │  		}
│ │ │ │  
│ │ │ │  		set_state(torrent_status::checking_resume_data);
│ │ │ │  
│ │ │ │ @@ -8395,15 +6281,15 @@
│ │ │ │  			for (auto const&amp; c : m_torrent_file-&gt;collections())
│ │ │ │  			{
│ │ │ │  				std::vector&lt;std::shared_ptr&lt;torrent&gt;&gt; ts = m_ses.find_collection(c);
│ │ │ │  
│ │ │ │  				for (auto const&amp; t : ts)
│ │ │ │  				{
│ │ │ │  					// Only attempt to reuse files from torrents that are seeding.
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(210)">../src/torrent.cpp:1964</a></td><td>this could be optimized by looking up which files are complete and just look at those</td></tr><tr id="210" style="display: none;" colspan="3"><td colspan="3"><h2>this could be optimized by looking up which files are
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(167)">../src/torrent.cpp:1964</a></td><td>this could be optimized by looking up which files are complete and just look at those</td></tr><tr id="167" style="display: none;" colspan="3"><td colspan="3"><h2>this could be optimized by looking up which files are
│ │ │ │  complete and just look at those</h2><h4>../src/torrent.cpp:1964</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		{
│ │ │ │  			resolve_links res(m_torrent_file);
│ │ │ │  
│ │ │ │  			for (auto const&amp; ih : m_torrent_file-&gt;similar_torrents())
│ │ │ │  			{
│ │ │ │  				std::shared_ptr&lt;torrent&gt; t = m_ses.find_torrent(info_hash_t(ih)).lock();
│ │ │ │  				if (!t) continue;
│ │ │ │ @@ -8447,15 +6333,15 @@
│ │ │ │  
│ │ │ │  		if (!m_add_torrent_params || !(m_add_torrent_params-&gt;flags &amp; torrent_flags::no_verify_files))
│ │ │ │  		{
│ │ │ │  			m_ses.disk_thread().async_check_files(
│ │ │ │  				m_storage, m_add_torrent_params ? m_add_torrent_params.get() : nullptr
│ │ │ │  				, std::move(links), [self = shared_from_this()](status_t st, storage_error const&amp; error)
│ │ │ │  				{ self-&gt;on_resume_data_checked(st, error); });
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(211)">../src/torrent.cpp:2728</a></td><td>this pattern is repeated in a few places. Factor this into a function and generalize the concept of a torrent having a dedicated listen port</td></tr><tr id="211" style="display: none;" colspan="3"><td colspan="3"><h2>this pattern is repeated in a few places. Factor this into
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(168)">../src/torrent.cpp:2728</a></td><td>this pattern is repeated in a few places. Factor this into a function and generalize the concept of a torrent having a dedicated listen port</td></tr><tr id="168" style="display: none;" colspan="3"><td colspan="3"><h2>this pattern is repeated in a few places. Factor this into
│ │ │ │  a function and generalize the concept of a torrent having a
│ │ │ │  dedicated listen port</h2><h4>../src/torrent.cpp:2728</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// not ready for peers. Except, if we don't have metadata,
│ │ │ │  		// we need peers to download from
│ │ │ │  		if (!m_files_checked &amp;&amp; valid_metadata()) return;
│ │ │ │  
│ │ │ │  		if (!m_announce_to_lsd) return;
│ │ │ │  
│ │ │ │ @@ -8500,15 +6386,15 @@
│ │ │ │  		}
│ │ │ │  		if (!should_announce_dht())
│ │ │ │  		{
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  			if (should_log())
│ │ │ │  			{
│ │ │ │  #if TORRENT_USE_I2P
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(212)">../src/torrent.cpp:3885</a></td><td>add one peer per IP the hostname resolves to</td></tr><tr id="212" style="display: none;" colspan="3"><td colspan="3"><h2>add one peer per IP the hostname resolves to</h2><h4>../src/torrent.cpp:3885</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	catch (...) { handle_exception(); }
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(169)">../src/torrent.cpp:3885</a></td><td>add one peer per IP the hostname resolves to</td></tr><tr id="169" style="display: none;" colspan="3"><td colspan="3"><h2>add one peer per IP the hostname resolves to</h2><h4>../src/torrent.cpp:3885</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	catch (...) { handle_exception(); }
│ │ │ │  #endif
│ │ │ │  
│ │ │ │  	void torrent::on_peer_name_lookup(error_code const&amp; e
│ │ │ │  		, std::vector&lt;address&gt; const&amp; host_list, int const port
│ │ │ │  		, protocol_version const v) try
│ │ │ │  	{
│ │ │ │  		TORRENT_ASSERT(is_single_thread());
│ │ │ │ @@ -8551,15 +6437,15 @@
│ │ │ │  					, host.address().to_string().c_str()
│ │ │ │  					, m_peer_list ? m_peer_list-&gt;num_connect_candidates() : -1);
│ │ │ │  			}
│ │ │ │  #endif
│ │ │ │  		}
│ │ │ │  		update_want_peers();
│ │ │ │  	}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(213)">../src/torrent.cpp:4581</a></td><td>only do this if the piece size > 1 blocks This is a v2 torrent so we can request get block level hashes.</td></tr><tr id="213" style="display: none;" colspan="3"><td colspan="3"><h2>only do this if the piece size > 1 blocks
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(170)">../src/torrent.cpp:4581</a></td><td>only do this if the piece size > 1 blocks This is a v2 torrent so we can request get block level hashes.</td></tr><tr id="170" style="display: none;" colspan="3"><td colspan="3"><h2>only do this if the piece size > 1 blocks
│ │ │ │  This is a v2 torrent so we can request get block
│ │ │ │  level hashes.</h2><h4>../src/torrent.cpp:4581</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		{
│ │ │ │  			std::set&lt;torrent_peer*&gt; ret;
│ │ │ │  			if (!blocks.empty() &amp;&amp; !downloaders.empty())
│ │ │ │  			{
│ │ │ │  				for (auto const b : blocks) ret.insert(downloaders[std::size_t(b)]);
│ │ │ │  			}
│ │ │ │ @@ -8604,15 +6490,15 @@
│ │ │ │  			penalize_peers(peers, index, known_bad_peer);
│ │ │ │  		}
│ │ │ │  
│ │ │ │  		// If m_storage isn't set here, it means we're shutting down
│ │ │ │  		if (m_storage)
│ │ │ │  		{
│ │ │ │  			// it doesn't make much sense to fail to hash a piece
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(214)">../src/torrent.cpp:7525</a></td><td>come up with a better way of doing this, instead of an immediately invoked lambda expression.</td></tr><tr id="214" style="display: none;" colspan="3"><td colspan="3"><h2>come up with a better way of doing this, instead of an
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(171)">../src/torrent.cpp:7525</a></td><td>come up with a better way of doing this, instead of an immediately invoked lambda expression.</td></tr><tr id="171" style="display: none;" colspan="3"><td colspan="3"><h2>come up with a better way of doing this, instead of an
│ │ │ │  immediately invoked lambda expression.</h2><h4>../src/torrent.cpp:7525</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">					|| peerinfo-&gt;confirmed_supports_utp))
│ │ │ │  			{
│ │ │ │  				sm = m_ses.utp_socket_manager();
│ │ │ │  			}
│ │ │ │  
│ │ │ │  			// don't make a TCP connection if it's disabled
│ │ │ │  			if (sm == nullptr &amp;&amp; !settings().get_bool(settings_pack::enable_outgoing_tcp))
│ │ │ │ @@ -8656,15 +6542,15 @@
│ │ │ │  		else
│ │ │ │  #endif
│ │ │ │  		{
│ │ │ │  			void* userdata = nullptr;
│ │ │ │  #ifdef TORRENT_SSL_PEERS
│ │ │ │  			if (is_ssl_torrent())
│ │ │ │  			{
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(215)">../src/torrent.cpp:9118</a></td><td>perhaps 0 should actually mean 0</td></tr><tr id="215" style="display: none;" colspan="3"><td colspan="3"><h2>perhaps 0 should actually mean 0</h2><h4>../src/torrent.cpp:9118</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// finished torrents may not change their queue positions, as it's set to
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(172)">../src/torrent.cpp:9118</a></td><td>perhaps 0 should actually mean 0</td></tr><tr id="172" style="display: none;" colspan="3"><td colspan="3"><h2>perhaps 0 should actually mean 0</h2><h4>../src/torrent.cpp:9118</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// finished torrents may not change their queue positions, as it's set to
│ │ │ │  		// -1
│ │ │ │  		if ((m_abort || is_finished()) &amp;&amp; p != no_pos) return;
│ │ │ │  
│ │ │ │  		TORRENT_ASSERT((p == no_pos) == is_finished()
│ │ │ │  			|| (!m_auto_managed &amp;&amp; p == no_pos)
│ │ │ │  			|| (m_abort &amp;&amp; p == no_pos)
│ │ │ │  			|| (!m_added &amp;&amp; p == no_pos));
│ │ │ │ @@ -8692,15 +6578,15 @@
│ │ │ │  		if (state_update)
│ │ │ │  			set_need_save_resume(torrent_handle::if_config_changed);
│ │ │ │  	}
│ │ │ │  
│ │ │ │  	void torrent::set_max_connections(int limit, bool const state_update)
│ │ │ │  	{
│ │ │ │  		TORRENT_ASSERT(is_single_thread());
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(216)">../src/torrent.cpp:9135</a></td><td>perhaps 0 should actually mean 0</td></tr><tr id="216" style="display: none;" colspan="3"><td colspan="3"><h2>perhaps 0 should actually mean 0</h2><h4>../src/torrent.cpp:9135</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(173)">../src/torrent.cpp:9135</a></td><td>perhaps 0 should actually mean 0</td></tr><tr id="173" style="display: none;" colspan="3"><td colspan="3"><h2>perhaps 0 should actually mean 0</h2><h4>../src/torrent.cpp:9135</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  	void torrent::set_max_uploads(int limit, bool const state_update)
│ │ │ │  	{
│ │ │ │  		TORRENT_ASSERT(is_single_thread());
│ │ │ │  		if (limit &lt;= 0) limit = (1 &lt;&lt; 24) - 1;
│ │ │ │  		if (int(m_max_uploads) == limit) return;
│ │ │ │  		if (state_update) state_updated();
│ │ │ │  		m_max_uploads = aux::numeric_cast&lt;std::uint32_t&gt;(limit);
│ │ │ │ @@ -8743,15 +6629,15 @@
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  		debug_log("*** set-upload-limit: %d", limit);
│ │ │ │  #endif
│ │ │ │  	}
│ │ │ │  
│ │ │ │  	void torrent::set_download_limit(int const limit)
│ │ │ │  	{
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(217)">../src/torrent.cpp:11061</a></td><td>instead of resorting the whole list, insert the peers directly into the right place</td></tr><tr id="217" style="display: none;" colspan="3"><td colspan="3"><h2>instead of resorting the whole list, insert the peers
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(174)">../src/torrent.cpp:11061</a></td><td>instead of resorting the whole list, insert the peers directly into the right place</td></tr><tr id="174" style="display: none;" colspan="3"><td colspan="3"><h2>instead of resorting the whole list, insert the peers
│ │ │ │  directly into the right place</h2><h4>../src/torrent.cpp:11061</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				std::printf("timed out [average-piece-time: %d ms ]\n"
│ │ │ │  					, m_average_piece_time);
│ │ │ │  #endif
│ │ │ │  			}
│ │ │ │  
│ │ │ │  			// pick all blocks for this piece. the peers list is kept up to date
│ │ │ │  			// and sorted. when we issue a request to a peer, its download queue
│ │ │ │ @@ -8795,15 +6681,15 @@
│ │ │ │  		{
│ │ │ │  			if (s.peer_info.banned) continue;
│ │ │ │  			if (s.removed) continue;
│ │ │ │  			if (s.type != type) continue;
│ │ │ │  			ret.insert(s.url);
│ │ │ │  		}
│ │ │ │  		return ret;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(218)">../src/session.cpp:540</a></td><td>In C++17. use if constexpr instead</td></tr><tr id="218" style="display: none;" colspan="3"><td colspan="3"><h2>In C++17. use if constexpr instead</h2><h4>../src/session.cpp:540</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(175)">../src/session.cpp:540</a></td><td>In C++17. use if constexpr instead</td></tr><tr id="175" style="display: none;" colspan="3"><td colspan="3"><h2>In C++17. use if constexpr instead</h2><h4>../src/session.cpp:540</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{}
│ │ │ │  	session_proxy::session_proxy(session_proxy const&amp;) = default;
│ │ │ │  	session_proxy&amp; session_proxy::operator=(session_proxy const&amp;) &amp; = default;
│ │ │ │  	session_proxy::session_proxy(session_proxy&amp;&amp;) noexcept = default;
│ │ │ │  	session_proxy&amp; session_proxy::operator=(session_proxy&amp;&amp;) &amp; noexcept = default;
│ │ │ │  	session_proxy::~session_proxy()
│ │ │ │  	{
│ │ │ │  		if (m_thread &amp;&amp; m_thread.use_count() == 1)
│ │ │ │ @@ -8827,15 +6713,220 @@
│ │ │ │  #include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │  #else
│ │ │ │  		return posix_disk_io_constructor(ios, sett, cnt);
│ │ │ │  #endif
│ │ │ │  	}
│ │ │ │  
│ │ │ │  }
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(219)">../src/cpuid.cpp:131</a></td><td>enable when aarch64 is really tested</td></tr><tr id="219" style="display: none;" colspan="3"><td colspan="3"><h2>enable when aarch64 is really tested</h2><h4>../src/cpuid.cpp:131</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	bool supports_mmx() noexcept
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(176)">../src/file_storage.cpp:457</a></td><td>maybe it would be nice to have a better index here</td></tr><tr id="176" style="display: none;" colspan="3"><td colspan="3"><h2>maybe it would be nice to have a better index here</h2><h4>../src/file_storage.cpp:457</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// find the file iterator and file offset
│ │ │ │ +		aux::file_entry target;
│ │ │ │ +		target.offset = aux::numeric_cast&lt;std::uint64_t&gt;(offset);
│ │ │ │ +		TORRENT_ASSERT(!compare_file_offset(target, m_files.front()));
│ │ │ │ +
│ │ │ │ +		auto file_iter = std::upper_bound(
│ │ │ │ +			m_files.begin(), m_files.end(), target, compare_file_offset);
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(file_iter != m_files.begin());
│ │ │ │ +		--file_iter;
│ │ │ │ +		return file_index_t{int(file_iter - m_files.begin())};
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	file_index_t file_storage::file_index_at_piece(piece_index_t const piece) const
│ │ │ │ +	{
│ │ │ │ +		return file_index_at_offset(static_cast&lt;int&gt;(piece) * std::int64_t(piece_length()));
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	file_index_t file_storage::file_index_for_root(sha256_hash const&amp; root_hash) const
│ │ │ │ +	{
│ │ │ │ +<div style="background: #ffff00" width="100%">		for (file_index_t const i : file_range())
│ │ │ │ +</div>		{
│ │ │ │ +			if (root(i) == root_hash) return i;
│ │ │ │ +		}
│ │ │ │ +		return file_index_t{-1};
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	piece_index_t file_storage::piece_index_at_file(file_index_t f) const
│ │ │ │ +	{
│ │ │ │ +		return piece_index_t{aux::numeric_cast&lt;int&gt;(file_offset(f) / piece_length())};
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION &lt;= 2
│ │ │ │ +	char const* file_storage::file_name_ptr(file_index_t const index) const
│ │ │ │ +	{
│ │ │ │ +		return m_files[index].name;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	int file_storage::file_name_len(file_index_t const index) const
│ │ │ │ +	{
│ │ │ │ +		if (m_files[index].name_len == aux::file_entry::name_is_owned)
│ │ │ │ +			return -1;
│ │ │ │ +		return m_files[index].name_len;
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	std::vector&lt;file_slice&gt; file_storage::map_block(piece_index_t const piece
│ │ │ │ +		, std::int64_t const offset, std::int64_t size) const
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT_PRECOND(piece &gt;= piece_index_t{0});
│ │ │ │ +		TORRENT_ASSERT_PRECOND(piece &lt; end_piece());
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(177)">../src/file_storage.cpp:1242</a></td><td>this would be more efficient if m_paths was sorted first, such that a lower path index always meant sorted-before</td></tr><tr id="177" style="display: none;" colspan="3"><td colspan="3"><h2>this would be more efficient if m_paths was sorted first, such
│ │ │ │ +that a lower path index always meant sorted-before</h2><h4>../src/file_storage.cpp:1242</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │ +
│ │ │ │ +	void file_storage::canonicalize_impl(bool const backwards_compatible)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(piece_length() &gt;= 16 * 1024);
│ │ │ │ +
│ │ │ │ +		// use this vector to track the new ordering of files
│ │ │ │ +		// this allows the use of STL algorithms despite them
│ │ │ │ +		// not supporting a custom swap functor
│ │ │ │ +		aux::vector&lt;file_index_t, file_index_t&gt; new_order(end_file());
│ │ │ │ +		for (auto i : file_range())
│ │ │ │ +			new_order[i] = i;
│ │ │ │ +
│ │ │ │ +		// remove any existing pad files
│ │ │ │ +		{
│ │ │ │ +			auto pad_begin = std::partition(new_order.begin(), new_order.end()
│ │ │ │ +				, [this](file_index_t i) { return !m_files[i].pad_file; });
│ │ │ │ +			new_order.erase(pad_begin, new_order.end());
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>		// sort files by path/name
│ │ │ │ +		std::sort(new_order.begin(), new_order.end()
│ │ │ │ +			, [this](file_index_t l, file_index_t r)
│ │ │ │ +		{
│ │ │ │ +			// assuming m_paths are unique!
│ │ │ │ +			auto const&amp; lf = m_files[l];
│ │ │ │ +			auto const&amp; rf = m_files[r];
│ │ │ │ +			if (lf.path_index != rf.path_index)
│ │ │ │ +			{
│ │ │ │ +				int const ret = path_compare(m_paths[lf.path_index], lf.filename()
│ │ │ │ +					, m_paths[rf.path_index], rf.filename());
│ │ │ │ +				if (ret != 0) return ret &lt; 0;
│ │ │ │ +			}
│ │ │ │ +			return lf.filename() &lt; rf.filename();
│ │ │ │ +		});
│ │ │ │ +
│ │ │ │ +		aux::vector&lt;aux::file_entry, file_index_t&gt; new_files;
│ │ │ │ +		aux::vector&lt;char const*, file_index_t&gt; new_file_hashes;
│ │ │ │ +		aux::vector&lt;std::time_t, file_index_t&gt; new_mtime;
│ │ │ │ +
│ │ │ │ +		// reserve enough space for the worst case after padding
│ │ │ │ +		new_files.reserve(new_order.size() * 2 - 1);
│ │ │ │ +		if (!m_file_hashes.empty())
│ │ │ │ +			new_file_hashes.reserve(new_order.size() * 2 - 1);
│ │ │ │ +		if (!m_mtime.empty())
│ │ │ │ +			new_mtime.reserve(new_order.size() * 2 - 1);
│ │ │ │ +
│ │ │ │ +		// re-compute offsets and insert pad files as necessary
│ │ │ │ +		std::int64_t off = 0;
│ │ │ │ +
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(178)">../src/file_storage.cpp:1345</a></td><td>in C++17 this could be string_view</td></tr><tr id="178" style="display: none;" colspan="3"><td colspan="3"><h2>in C++17 this could be string_view</h2><h4>../src/file_storage.cpp:1345</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				add_pad_file(i);
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		m_files = std::move(new_files);
│ │ │ │ +		m_file_hashes = std::move(new_file_hashes);
│ │ │ │ +		m_mtime = std::move(new_mtime);
│ │ │ │ +
│ │ │ │ +		m_total_size = off;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void file_storage::sanitize_symlinks()
│ │ │ │ +	{
│ │ │ │ +		// symlinks are unusual, this function is optimized assuming there are no
│ │ │ │ +		// symbolic links in the torrent. If we find one symbolic link, we'll
│ │ │ │ +		// build the hash table of files it's allowed to refer to, but don't pay
│ │ │ │ +		// that price up-front.
│ │ │ │ +		std::unordered_map&lt;std::string, file_index_t&gt; file_map;
│ │ │ │ +		bool file_map_initialized = false;
│ │ │ │ +
│ │ │ │ +		// lazily instantiated set of all valid directories a symlink may point to
│ │ │ │ +<div style="background: #ffff00" width="100%">		std::unordered_set&lt;std::string&gt; dir_map;
│ │ │ │ +</div>		bool dir_map_initialized = false;
│ │ │ │ +
│ │ │ │ +		// symbolic links that points to directories
│ │ │ │ +		std::unordered_map&lt;std::string, std::string&gt; dir_links;
│ │ │ │ +
│ │ │ │ +		// we validate symlinks in (potentially) 2 passes over the files.
│ │ │ │ +		// remaining symlinks to validate after the first pass
│ │ │ │ +		std::vector&lt;file_index_t&gt; symlinks_to_validate;
│ │ │ │ +
│ │ │ │ +		for (auto const i : file_range())
│ │ │ │ +		{
│ │ │ │ +			if (!(file_flags(i) &amp; file_storage::flag_symlink)) continue;
│ │ │ │ +
│ │ │ │ +			if (!file_map_initialized)
│ │ │ │ +			{
│ │ │ │ +				for (auto const j : file_range())
│ │ │ │ +					file_map.insert({internal_file_path(j), j});
│ │ │ │ +				file_map_initialized = true;
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +			aux::file_entry const&amp; fe = m_files[i];
│ │ │ │ +			TORRENT_ASSERT(fe.symlink_index &lt; int(m_symlinks.size()));
│ │ │ │ +
│ │ │ │ +			// symlink targets are only allowed to point to files or directories in
│ │ │ │ +			// this torrent.
│ │ │ │ +			{
│ │ │ │ +				std::string target = m_symlinks[fe.symlink_index];
│ │ │ │ +
│ │ │ │ +				if (is_complete(target))
│ │ │ │ +				{
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(179)">../src/web_connection_base.cpp:72</a></td><td>introduce a web-seed default class which has a low download priority</td></tr><tr id="179" style="display: none;" colspan="3"><td colspan="3"><h2>introduce a web-seed default class which has a low download priority</h2><h4>../src/web_connection_base.cpp:72</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		: peer_connection(pack)
│ │ │ │ +		, m_first_request(true)
│ │ │ │ +		, m_ssl(false)
│ │ │ │ +		, m_external_auth(web.auth)
│ │ │ │ +		, m_extra_headers(web.extra_headers)
│ │ │ │ +		, m_parser(http_parser::dont_parse_chunks)
│ │ │ │ +		, m_body_start(0)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(&amp;web.peer_info == pack.peerinfo);
│ │ │ │ +		// when going through a proxy, we don't necessarily have an endpoint here,
│ │ │ │ +		// since the proxy might be resolving the hostname, not us
│ │ │ │ +		TORRENT_ASSERT(web.endpoints.empty() || web.endpoints.front() == pack.endp);
│ │ │ │ +
│ │ │ │ +		INVARIANT_CHECK;
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(is_outgoing());
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(!m_torrent.lock()-&gt;is_upload_only());
│ │ │ │ +
│ │ │ │ +		// we only want left-over bandwidth
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>		std::string protocol;
│ │ │ │ +		error_code ec;
│ │ │ │ +		std::tie(protocol, m_basic_auth, m_host, m_port, m_path)
│ │ │ │ +			= parse_url_components(web.url, ec);
│ │ │ │ +		TORRENT_ASSERT(!ec);
│ │ │ │ +
│ │ │ │ +		if (m_port == -1 &amp;&amp; protocol == "http")
│ │ │ │ +			m_port = 80;
│ │ │ │ +
│ │ │ │ +#if TORRENT_USE_SSL
│ │ │ │ +		if (protocol == "https")
│ │ │ │ +		{
│ │ │ │ +			m_ssl = true;
│ │ │ │ +			if (m_port == -1) m_port = 443;
│ │ │ │ +		}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		if (!m_basic_auth.empty())
│ │ │ │ +			m_basic_auth = base64encode(m_basic_auth);
│ │ │ │ +
│ │ │ │ +		m_server_string = m_host;
│ │ │ │ +		aux::verify_encoding(m_server_string);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	int web_connection_base::timeout() const
│ │ │ │ +	{
│ │ │ │ +		// since this is a web seed, change the timeout
│ │ │ │ +		// according to the settings.
│ │ │ │ +		return m_settings.get_int(settings_pack::urlseed_timeout);
│ │ │ │ +	}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(180)">../src/cpuid.cpp:131</a></td><td>enable when aarch64 is really tested</td></tr><tr id="180" style="display: none;" colspan="3"><td colspan="3"><h2>enable when aarch64 is really tested</h2><h4>../src/cpuid.cpp:131</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	bool supports_mmx() noexcept
│ │ │ │  	{
│ │ │ │  #if TORRENT_HAS_SSE
│ │ │ │  		std::uint32_t cpui[4] = {0};
│ │ │ │  		cpuid(cpui, 1);
│ │ │ │  		return (cpui[2] &amp; (1 &lt;&lt; 23)) != 0;
│ │ │ │  #else
│ │ │ │  		return false;
│ │ │ │ @@ -8878,15 +6969,456 @@
│ │ │ │  } // anonymous namespace
│ │ │ │  
│ │ │ │  	bool const sse42_support = supports_sse42();
│ │ │ │  	bool const mmx_support = supports_mmx();
│ │ │ │  	bool const arm_neon_support = supports_arm_neon();
│ │ │ │  	bool const arm_crc32c_support = supports_arm_crc32c();
│ │ │ │  } }
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(220)">../src/choker.cpp:258</a></td><td>make configurable</td></tr><tr id="220" style="display: none;" colspan="3"><td colspan="3"><h2>make configurable</h2><h4>../src/choker.cpp:258</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			// first reset the number of unchoke slots, because we'll calculate
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(181)">../src/disabled_disk_io.cpp:106</a></td><td>it would be nice to return a valid hash of zeroes here</td></tr><tr id="181" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to return a valid hash of zeroes here</h2><h4>../src/disabled_disk_io.cpp:106</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		});
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	bool async_write(storage_index_t
│ │ │ │ +		, peer_request const&amp; r
│ │ │ │ +		, char const*, std::shared_ptr&lt;disk_observer&gt;
│ │ │ │ +		, std::function&lt;void(storage_error const&amp;)&gt; handler
│ │ │ │ +		, disk_job_flags_t) override
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(r.length &lt;= default_block_size);
│ │ │ │ +		TORRENT_UNUSED(r);
│ │ │ │ +
│ │ │ │ +		post(m_ios, [h = std::move(handler)] { h(storage_error{}); });
│ │ │ │ +		return false;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void async_hash(storage_index_t
│ │ │ │ +		, piece_index_t piece, span&lt;sha256_hash&gt;, disk_job_flags_t
│ │ │ │ +		, std::function&lt;void(piece_index_t, sha1_hash const&amp;, storage_error const&amp;)&gt; handler) override
│ │ │ │ +	{
│ │ │ │ +<div style="background: #ffff00" width="100%">		post(m_ios, [h = std::move(handler), piece] { h(piece, sha1_hash{}, storage_error{}); });
│ │ │ │ +</div>	}
│ │ │ │ +
│ │ │ │ +	void async_hash2(storage_index_t, piece_index_t piece, int
│ │ │ │ +		, disk_job_flags_t
│ │ │ │ +		, std::function&lt;void(piece_index_t, sha256_hash const&amp;, storage_error const&amp;)&gt; handler) override
│ │ │ │ +	{
│ │ │ │ +		post(m_ios, [h = std::move(handler), piece]() { h(piece, sha256_hash{}, storage_error{}); });
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void async_move_storage(storage_index_t
│ │ │ │ +		, std::string p, move_flags_t
│ │ │ │ +		, std::function&lt;void(status_t, std::string const&amp;, storage_error const&amp;)&gt; handler) override
│ │ │ │ +	{
│ │ │ │ +		post(m_ios, [h = std::move(handler), path = std::move(p)] () mutable
│ │ │ │ +			{ h(status_t::no_error, std::move(path), storage_error{}); });
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void async_release_files(storage_index_t, std::function&lt;void()&gt; handler) override
│ │ │ │ +	{
│ │ │ │ +		post(m_ios, [h = std::move(handler)] { h(); });
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void async_delete_files(storage_index_t
│ │ │ │ +		, remove_flags_t, std::function&lt;void(storage_error const&amp;)&gt; handler) override
│ │ │ │ +	{
│ │ │ │ +		post(m_ios, [h = std::move(handler)] { h(storage_error{}); });
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void async_check_files(storage_index_t
│ │ │ │ +		, add_torrent_params const*
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(182)">../src/udp_socket.cpp:659</a></td><td>perhaps an attempt should be made to bind m_socks5_sock to the device of m_listen_socket</td></tr><tr id="182" style="display: none;" colspan="3"><td colspan="3"><h2>perhaps an attempt should be made to bind m_socks5_sock to the
│ │ │ │ +device of m_listen_socket</h2><h4>../src/udp_socket.cpp:659</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	if (ec)
│ │ │ │ +	{
│ │ │ │ +		if (m_alerts.should_post&lt;socks5_alert&gt;())
│ │ │ │ +			m_alerts.emplace_alert&lt;socks5_alert&gt;(m_proxy_addr, operation_t::sock_option, ec);
│ │ │ │ +		ec.clear();
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	tcp::endpoint const bind_ep(m_listen_socket.get_local_endpoint().address(), 0);
│ │ │ │ +	m_socks5_sock.bind(bind_ep, ec);
│ │ │ │ +	if (ec)
│ │ │ │ +	{
│ │ │ │ +		if (m_alerts.should_post&lt;socks5_alert&gt;())
│ │ │ │ +			m_alerts.emplace_alert&lt;socks5_alert&gt;(m_proxy_addr, operation_t::sock_bind, ec);
│ │ │ │ +		++m_failures;
│ │ │ │ +		retry_connection();
│ │ │ │ +		return;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>	ADD_OUTSTANDING_ASYNC("socks5::on_connected");
│ │ │ │ +	m_socks5_sock.async_connect(m_proxy_addr
│ │ │ │ +		, std::bind(&amp;socks5::on_connected, self(), _1));
│ │ │ │ +
│ │ │ │ +	ADD_OUTSTANDING_ASYNC("socks5::on_connect_timeout");
│ │ │ │ +	m_timer.expires_after(seconds(10));
│ │ │ │ +	m_timer.async_wait(std::bind(&amp;socks5::on_connect_timeout
│ │ │ │ +		, self(), _1));
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +void socks5::on_connect_timeout(error_code const&amp; e)
│ │ │ │ +{
│ │ │ │ +	COMPLETE_ASYNC("socks5::on_connect_timeout");
│ │ │ │ +
│ │ │ │ +	if (e == boost::asio::error::operation_aborted) return;
│ │ │ │ +
│ │ │ │ +	if (m_abort) return;
│ │ │ │ +
│ │ │ │ +	if (m_alerts.should_post&lt;socks5_alert&gt;())
│ │ │ │ +		m_alerts.emplace_alert&lt;socks5_alert&gt;(m_proxy_addr, operation_t::connect, errors::timed_out);
│ │ │ │ +
│ │ │ │ +	error_code ignore;
│ │ │ │ +	m_socks5_sock.close(ignore);
│ │ │ │ +
│ │ │ │ +	++m_failures;
│ │ │ │ +	retry_connection();
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +void socks5::on_connected(error_code const&amp; e)
│ │ │ │ +{
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(183)">../src/posix_part_file.cpp:337</a></td><td>what do we do if someone is currently reading from the disk from this piece? does it matter? Since we won't actively erase the data from disk, but it may be overwritten soon, it's probably not that big of a deal</td></tr><tr id="183" style="display: none;" colspan="3"><td colspan="3"><h2>what do we do if someone is currently reading from the disk
│ │ │ │ +from this piece? does it matter? Since we won't actively erase the
│ │ │ │ +data from disk, but it may be overwritten soon, it's probably not that
│ │ │ │ +big of a deal</h2><h4>../src/posix_part_file.cpp:337</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +			if (ec) return {};
│ │ │ │ +
│ │ │ │ +#ifdef TORRENT_WINDOWS
│ │ │ │ +			ret = file_pointer(::_wfopen(convert_to_native_path_string(fn).c_str(), L"wb+"));
│ │ │ │ +#else
│ │ │ │ +			ret = file_pointer(::fopen(fn.c_str(), "wb+"));
│ │ │ │ +#endif
│ │ │ │ +			if (ret.file() == nullptr)
│ │ │ │ +				ec.assign(errno, generic_category());
│ │ │ │ +		}
│ │ │ │ +		if (ec) return {};
│ │ │ │ +		return ret;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void posix_part_file::free_piece(piece_index_t const piece)
│ │ │ │ +	{
│ │ │ │ +		auto const i = m_piece_map.find(piece);
│ │ │ │ +		if (i == m_piece_map.end()) return;
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>		m_free_slots.push_back(i-&gt;second);
│ │ │ │ +		m_piece_map.erase(i);
│ │ │ │ +		m_dirty_metadata = true;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void posix_part_file::move_partfile(std::string const&amp; path, error_code&amp; ec)
│ │ │ │ +	{
│ │ │ │ +		flush_metadata_impl(ec);
│ │ │ │ +		if (ec) return;
│ │ │ │ +
│ │ │ │ +		if (!m_piece_map.empty())
│ │ │ │ +		{
│ │ │ │ +			std::string old_path = combine_path(m_path, m_name);
│ │ │ │ +			std::string new_path = combine_path(path, m_name);
│ │ │ │ +
│ │ │ │ +			rename(old_path, new_path, ec);
│ │ │ │ +			if (ec == boost::system::errc::no_such_file_or_directory)
│ │ │ │ +				ec.clear();
│ │ │ │ +
│ │ │ │ +			if (ec)
│ │ │ │ +			{
│ │ │ │ +				storage_error se;
│ │ │ │ +				aux::copy_file(old_path, new_path, se);
│ │ │ │ +				ec = se.ec;
│ │ │ │ +				if (ec) return;
│ │ │ │ +				remove(old_path, ec);
│ │ │ │ +			}
│ │ │ │ +		}
│ │ │ │ +		m_path = path;
│ │ │ │ +	}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(184)">../src/posix_part_file.cpp:424</a></td><td>instead of rebuilding the whole file header and flushing it, update the slot entries as we go</td></tr><tr id="184" style="display: none;" colspan="3"><td colspan="3"><h2>instead of rebuilding the whole file header
│ │ │ │ +and flushing it, update the slot entries as we go</h2><h4>../src/posix_part_file.cpp:424</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				}
│ │ │ │ +				auto bytes_read = std::fread(buf.get(), 1, std::size_t(block_to_copy), file.file());
│ │ │ │ +				if (int(bytes_read) != block_to_copy)
│ │ │ │ +					ec.assign(errno, generic_category());
│ │ │ │ +
│ │ │ │ +				if (ec) return;
│ │ │ │ +
│ │ │ │ +				f(file_offset, {buf.get(), block_to_copy});
│ │ │ │ +			}
│ │ │ │ +			file_offset += block_to_copy;
│ │ │ │ +			piece_offset = 0;
│ │ │ │ +			size -= block_to_copy;
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void posix_part_file::flush_metadata(error_code&amp; ec)
│ │ │ │ +	{
│ │ │ │ +		flush_metadata_impl(ec);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	void posix_part_file::flush_metadata_impl(error_code&amp; ec)
│ │ │ │ +</div>	{
│ │ │ │ +		// do we need to flush the metadata?
│ │ │ │ +		if (m_dirty_metadata == false) return;
│ │ │ │ +
│ │ │ │ +		if (m_piece_map.empty())
│ │ │ │ +		{
│ │ │ │ +			// if we don't have any pieces left in the
│ │ │ │ +			// part file, remove it
│ │ │ │ +			std::string const p = combine_path(m_path, m_name);
│ │ │ │ +			remove(p, ec);
│ │ │ │ +
│ │ │ │ +			if (ec == boost::system::errc::no_such_file_or_directory)
│ │ │ │ +				ec.clear();
│ │ │ │ +			return;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		auto f = open_file(open_mode::read_write, ec);
│ │ │ │ +		if (ec) return;
│ │ │ │ +
│ │ │ │ +		std::vector&lt;char&gt; header(static_cast&lt;std::size_t&gt;(m_header_size));
│ │ │ │ +
│ │ │ │ +		using namespace libtorrent::aux;
│ │ │ │ +
│ │ │ │ +		char* ptr = header.data();
│ │ │ │ +		write_uint32(m_max_pieces, ptr);
│ │ │ │ +		write_uint32(m_piece_size, ptr);
│ │ │ │ +
│ │ │ │ +		for (piece_index_t piece(0); piece &lt; piece_index_t(m_max_pieces); ++piece)
│ │ │ │ +		{
│ │ │ │ +			auto const i = m_piece_map.find(piece);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(185)">../src/torrent_handle.cpp:589</a></td><td>support moving files into this call</td></tr><tr id="185" style="display: none;" colspan="3"><td colspan="3"><h2>support moving files into this call</h2><h4>../src/torrent_handle.cpp:589</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		auto retp = &amp;prio;
│ │ │ │ +		sync_call(&amp;torrent::piece_priorities, retp);
│ │ │ │ +		std::vector&lt;int&gt; ret;
│ │ │ │ +		ret.reserve(prio.size());
│ │ │ │ +		for (auto p : prio)
│ │ │ │ +			ret.push_back(int(static_cast&lt;std::uint8_t&gt;(p)));
│ │ │ │ +		return ret;
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	void torrent_handle::file_priority(file_index_t index, download_priority_t priority) const
│ │ │ │ +	{
│ │ │ │ +		async_call(&amp;torrent::set_file_priority, index, priority);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	download_priority_t torrent_handle::file_priority(file_index_t index) const
│ │ │ │ +	{
│ │ │ │ +		return sync_call_ret&lt;download_priority_t&gt;(dont_download, &amp;torrent::file_priority, index);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	void torrent_handle::prioritize_files(std::vector&lt;download_priority_t&gt; const&amp; files) const
│ │ │ │ +</div>	{
│ │ │ │ +		async_call(&amp;torrent::prioritize_files
│ │ │ │ +			, static_cast&lt;aux::vector&lt;download_priority_t, file_index_t&gt; const&amp;&gt;(files));
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	std::vector&lt;download_priority_t&gt; torrent_handle::get_file_priorities() const
│ │ │ │ +	{
│ │ │ │ +		aux::vector&lt;download_priority_t, file_index_t&gt; ret;
│ │ │ │ +		auto retp = &amp;ret;
│ │ │ │ +		sync_call(&amp;torrent::file_priorities, retp);
│ │ │ │ +		return TORRENT_RVO(ret);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │ +
│ │ │ │ +// ============ start deprecation ===============
│ │ │ │ +
│ │ │ │ +	void torrent_handle::prioritize_files(std::vector&lt;int&gt; const&amp; files) const
│ │ │ │ +	{
│ │ │ │ +		aux::vector&lt;download_priority_t, file_index_t&gt; file_prio;
│ │ │ │ +		file_prio.reserve(files.size());
│ │ │ │ +		for (auto const p : files) {
│ │ │ │ +			file_prio.push_back(download_priority_t(static_cast&lt;std::uint8_t&gt;(p)));
│ │ │ │ +		}
│ │ │ │ +		async_call(&amp;torrent::prioritize_files, file_prio);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	std::vector&lt;int&gt; torrent_handle::file_priorities() const
│ │ │ │ +	{
│ │ │ │ +		aux::vector&lt;download_priority_t, file_index_t&gt; prio;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(186)">../src/http_seed_connection.cpp:441</a></td><td>technically, this isn't supposed to happen, but it seems to sometimes. Some of the accounting is probably wrong in certain cases</td></tr><tr id="186" style="display: none;" colspan="3"><td colspan="3"><h2>technically, this isn't supposed to happen, but it seems to
│ │ │ │ +sometimes. Some of the accounting is probably wrong in certain
│ │ │ │ +cases</h2><h4>../src/http_seed_connection.cpp:441</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">					// cut out the chunk header from the receive buffer
│ │ │ │ +					TORRENT_ASSERT(m_chunk_pos + m_body_start &lt; INT_MAX);
│ │ │ │ +					m_recv_buffer.cut(header_size, t-&gt;block_size() + 1024, aux::numeric_cast&lt;int&gt;(m_chunk_pos + m_body_start));
│ │ │ │ +					recv_buffer = m_recv_buffer.get();
│ │ │ │ +					recv_buffer = recv_buffer.subspan(m_body_start);
│ │ │ │ +					m_chunk_pos += chunk_size;
│ │ │ │ +					if (chunk_size == 0)
│ │ │ │ +					{
│ │ │ │ +						TORRENT_ASSERT(m_recv_buffer.get().size() &lt; m_chunk_pos + m_body_start + 1
│ │ │ │ +							|| m_recv_buffer.get()[static_cast&lt;std::ptrdiff_t&gt;(m_chunk_pos + m_body_start)] == 'H'
│ │ │ │ +							|| (m_parser.chunked_encoding()
│ │ │ │ +								&amp;&amp; m_recv_buffer.get()[static_cast&lt;std::ptrdiff_t&gt;(m_chunk_pos + m_body_start)] == '\r'));
│ │ │ │ +						m_chunk_pos = -1;
│ │ │ │ +					}
│ │ │ │ +				}
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +			int payload = int(bytes_transferred);
│ │ │ │ +			if (payload &gt; m_response_left) payload = int(m_response_left);
│ │ │ │ +			if (payload &gt; front_request.length) payload = front_request.length;
│ │ │ │ +<div style="background: #ffff00" width="100%">			if (payload &gt; outstanding_bytes()) payload = outstanding_bytes();
│ │ │ │ +</div>			received_bytes(payload, 0);
│ │ │ │ +			incoming_piece_fragment(payload);
│ │ │ │ +			m_response_left -= payload;
│ │ │ │ +
│ │ │ │ +			if (m_parser.status_code() == 503)
│ │ │ │ +			{
│ │ │ │ +				if (!m_parser.finished()) return;
│ │ │ │ +
│ │ │ │ +				int retry_time = std::atoi(std::string(recv_buffer.begin(), recv_buffer.end()).c_str());
│ │ │ │ +				if (retry_time &lt;= 0) retry_time = 60;
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +				peer_log(peer_log_alert::info, "CONNECT", "retrying in %d seconds", retry_time);
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +				received_bytes(0, int(bytes_transferred));
│ │ │ │ +				// temporarily unavailable, retry later
│ │ │ │ +				t-&gt;retry_web_seed(this, seconds32(retry_time));
│ │ │ │ +				disconnect(error_code(m_parser.status_code(), http_category()), operation_t::bittorrent, failure);
│ │ │ │ +				return;
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +			// we only received the header, no data
│ │ │ │ +			if (recv_buffer.empty()) break;
│ │ │ │ +
│ │ │ │ +			if (recv_buffer.size() &lt; front_request.length) break;
│ │ │ │ +
│ │ │ │ +			// if the response is chunked, we need to receive the last
│ │ │ │ +			// terminating chunk and the tail headers before we can proceed
│ │ │ │ +			if (m_parser.chunked_encoding() &amp;&amp; m_chunk_pos &gt;= 0) break;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(187)">../src/mmap_disk_io.cpp:578</a></td><td>in the future, propagate exceptions back to the handlers</td></tr><tr id="187" style="display: none;" colspan="3"><td colspan="3"><h2>in the future, propagate exceptions back to the handlers</h2><h4>../src/mmap_disk_io.cpp:578</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#if DEBUG_DISK_THREAD
│ │ │ │ +		{
│ │ │ │ +			std::unique_lock&lt;std::mutex&gt; l(m_job_mutex);
│ │ │ │ +
│ │ │ │ +			DLOG("perform_job job: %s ( %s%s) piece: %d offset: %d outstanding: %d\n"
│ │ │ │ +				, job_action_name[j-&gt;action]
│ │ │ │ +				, (j-&gt;flags &amp; mmap_disk_job::fence) ? "fence ": ""
│ │ │ │ +				, (j-&gt;flags &amp; mmap_disk_job::force_copy) ? "force_copy ": ""
│ │ │ │ +				, static_cast&lt;int&gt;(j-&gt;piece), j-&gt;d.io.offset
│ │ │ │ +				, j-&gt;storage ? j-&gt;storage-&gt;num_outstanding_jobs() : -1);
│ │ │ │ +		}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		std::shared_ptr&lt;mmap_storage&gt; storage = j-&gt;storage;
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(static_cast&lt;int&gt;(j-&gt;action) &lt; int(job_functions.size()));
│ │ │ │ +
│ │ │ │ +		m_stats_counters.inc_stats_counter(counters::num_running_disk_jobs, 1);
│ │ │ │ +
│ │ │ │ +		// call disk function
│ │ │ │ +<div style="background: #ffff00" width="100%">		status_t ret = status_t::no_error;
│ │ │ │ +</div>		try
│ │ │ │ +		{
│ │ │ │ +			int const idx = static_cast&lt;int&gt;(j-&gt;action);
│ │ │ │ +			ret = (this-&gt;*(job_functions[static_cast&lt;std::size_t&gt;(idx)]))(j);
│ │ │ │ +		}
│ │ │ │ +		catch (boost::system::system_error const&amp; err)
│ │ │ │ +		{
│ │ │ │ +			ret = status_t::fatal_disk_error;
│ │ │ │ +			j-&gt;error.ec = err.code();
│ │ │ │ +			j-&gt;error.operation = operation_t::exception;
│ │ │ │ +		}
│ │ │ │ +		catch (std::bad_alloc const&amp;)
│ │ │ │ +		{
│ │ │ │ +			ret = status_t::fatal_disk_error;
│ │ │ │ +			j-&gt;error.ec = errors::no_memory;
│ │ │ │ +			j-&gt;error.operation = operation_t::exception;
│ │ │ │ +		}
│ │ │ │ +		catch (std::exception const&amp;)
│ │ │ │ +		{
│ │ │ │ +			ret = status_t::fatal_disk_error;
│ │ │ │ +			j-&gt;error.ec = boost::asio::error::fault;
│ │ │ │ +			j-&gt;error.operation = operation_t::exception;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		// note that -2 errors are OK
│ │ │ │ +		TORRENT_ASSERT(ret != status_t::fatal_disk_error
│ │ │ │ +			|| (j-&gt;error.ec &amp;&amp; j-&gt;error.operation != operation_t::unknown));
│ │ │ │ +
│ │ │ │ +		m_stats_counters.inc_stats_counter(counters::num_running_disk_jobs, -1);
│ │ │ │ +
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(188)">../src/mmap_disk_io.cpp:1017</a></td><td>this is potentially very expensive. One way to solve it would be to have a fence for just this one piece. but it hardly seems worth the complexity and cost just for the edge case of receiving a corrupt piece</td></tr><tr id="188" style="display: none;" colspan="3"><td colspan="3"><h2>this is potentially very expensive. One way to solve
│ │ │ │ +it would be to have a fence for just this one piece.
│ │ │ │ +but it hardly seems worth the complexity and cost just for the edge
│ │ │ │ +case of receiving a corrupt piece</h2><h4>../src/mmap_disk_io.cpp:1017</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::file_priority);
│ │ │ │ +		j-&gt;storage = m_torrents[storage]-&gt;shared_from_this();
│ │ │ │ +		j-&gt;argument = std::move(prios);
│ │ │ │ +		j-&gt;callback = std::move(handler);
│ │ │ │ +
│ │ │ │ +		add_fence_job(j);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void mmap_disk_io::async_clear_piece(storage_index_t const storage
│ │ │ │ +		, piece_index_t const index, std::function&lt;void(piece_index_t)&gt; handler)
│ │ │ │ +	{
│ │ │ │ +		aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::clear_piece);
│ │ │ │ +		j-&gt;storage = m_torrents[storage]-&gt;shared_from_this();
│ │ │ │ +		j-&gt;piece = index;
│ │ │ │ +		j-&gt;callback = std::move(handler);
│ │ │ │ +
│ │ │ │ +		// regular jobs are not guaranteed to be executed in-order
│ │ │ │ +		// since clear piece must guarantee that all write jobs that
│ │ │ │ +		// have been issued finish before the clear piece job completes
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(189)">../src/mmap_disk_io.cpp:1022</a></td><td>Perhaps the job queue could be traversed and all jobs for this piece could be cancelled. If there are no threads currently writing to this piece, we could skip the fence altogether</td></tr><tr id="189" style="display: none;" colspan="3"><td colspan="3"><h2>Perhaps the job queue could be traversed and all jobs for this
│ │ │ │ +piece could be cancelled. If there are no threads currently writing
│ │ │ │ +to this piece, we could skip the fence altogether</h2><h4>../src/mmap_disk_io.cpp:1022</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		j-&gt;storage = m_torrents[storage]-&gt;shared_from_this();
│ │ │ │ +		j-&gt;argument = std::move(prios);
│ │ │ │ +		j-&gt;callback = std::move(handler);
│ │ │ │ +
│ │ │ │ +		add_fence_job(j);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void mmap_disk_io::async_clear_piece(storage_index_t const storage
│ │ │ │ +		, piece_index_t const index, std::function&lt;void(piece_index_t)&gt; handler)
│ │ │ │ +	{
│ │ │ │ +		aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::clear_piece);
│ │ │ │ +		j-&gt;storage = m_torrents[storage]-&gt;shared_from_this();
│ │ │ │ +		j-&gt;piece = index;
│ │ │ │ +		j-&gt;callback = std::move(handler);
│ │ │ │ +
│ │ │ │ +		// regular jobs are not guaranteed to be executed in-order
│ │ │ │ +		// since clear piece must guarantee that all write jobs that
│ │ │ │ +		// have been issued finish before the clear piece job completes
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		add_fence_job(j);
│ │ │ │ +</div>	}
│ │ │ │ +
│ │ │ │ +	status_t mmap_disk_io::do_hash(aux::mmap_disk_job* j)
│ │ │ │ +	{
│ │ │ │ +		// we're not using a cache. This is the simple path
│ │ │ │ +		// just read straight from the file
│ │ │ │ +		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ +
│ │ │ │ +		bool const v1 = bool(j-&gt;flags &amp; disk_interface::v1_hash);
│ │ │ │ +		bool const v2 = !j-&gt;d.h.block_hashes.empty();
│ │ │ │ +
│ │ │ │ +		int const piece_size = v1 ? j-&gt;storage-&gt;files().piece_size(j-&gt;piece) : 0;
│ │ │ │ +		int const piece_size2 = v2 ? j-&gt;storage-&gt;files().piece_size2(j-&gt;piece) : 0;
│ │ │ │ +		int const blocks_in_piece = v1 ? (piece_size + default_block_size - 1) / default_block_size : 0;
│ │ │ │ +		int const blocks_in_piece2 = v2 ? j-&gt;storage-&gt;files().blocks_in_piece2(j-&gt;piece) : 0;
│ │ │ │ +		aux::open_mode_t const file_mode = file_mode_for_job(j);
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(!v2 || int(j-&gt;d.h.block_hashes.size()) &gt;= blocks_in_piece2);
│ │ │ │ +		TORRENT_ASSERT(v1 || v2);
│ │ │ │ +
│ │ │ │ +		hasher h;
│ │ │ │ +		int ret = 0;
│ │ │ │ +		int offset = 0;
│ │ │ │ +		int const blocks_to_read = std::max(blocks_in_piece, blocks_in_piece2);
│ │ │ │ +		time_point const start_time = clock_type::now();
│ │ │ │ +		for (int i = 0; i &lt; blocks_to_read; ++i)
│ │ │ │ +		{
│ │ │ │ +			bool const v2_block = i &lt; blocks_in_piece2;
│ │ │ │ +
│ │ │ │ +			DLOG("do_hash: reading (piece: %d block: %d)\n", int(j-&gt;piece), i);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(190)">../src/choker.cpp:258</a></td><td>make configurable</td></tr><tr id="190" style="display: none;" colspan="3"><td colspan="3"><h2>make configurable</h2><h4>../src/choker.cpp:258</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			// first reset the number of unchoke slots, because we'll calculate
│ │ │ │  			// it purely based on the current state of our peers.
│ │ │ │  			upload_slots = 0;
│ │ │ │  
│ │ │ │  			int rate_threshold = sett.get_int(settings_pack::rate_choker_initial_threshold);
│ │ │ │  
│ │ │ │  			std::sort(peers.begin(), peers.end()
│ │ │ │  				, [](peer_connection const* lhs, peer_connection const* rhs)
│ │ │ │ @@ -8929,15 +7461,15 @@
│ │ │ │  		}
│ │ │ │  		else if (sett.get_int(settings_pack::seed_choking_algorithm)
│ │ │ │  			== settings_pack::fastest_upload)
│ │ │ │  		{
│ │ │ │  			std::nth_element(peers.begin(), peers.begin()
│ │ │ │  				+ slots, peers.end()
│ │ │ │  				, [](peer_connection const* lhs, peer_connection const* rhs)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(221)">../src/merkle_tree.cpp:110</a></td><td>in C++20, use std::identity</td></tr><tr id="221" style="display: none;" colspan="3"><td colspan="3"><h2>in C++20, use std::identity</h2><h4>../src/merkle_tree.cpp:110</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		allocate_full();
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(191)">../src/merkle_tree.cpp:110</a></td><td>in C++20, use std::identity</td></tr><tr id="191" style="display: none;" colspan="3"><td colspan="3"><h2>in C++20, use std::identity</h2><h4>../src/merkle_tree.cpp:110</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		allocate_full();
│ │ │ │  
│ │ │ │  		merkle_validate_copy(t, m_tree, root(), m_block_verified);
│ │ │ │  
│ │ │ │  		load_verified_bits(verified);
│ │ │ │  
│ │ │ │  		optimize_storage();
│ │ │ │  		optimize_storage_piece_layer();
│ │ │ │ @@ -8980,15 +7512,15 @@
│ │ │ │  			// the index in t that points to first_block
│ │ │ │  			auto const block_index = std::count_if(mask.begin(), mask.begin() + first_block, identity());
│ │ │ │  
│ │ │ │  			// discrepancy
│ │ │ │  			if (t.size() &lt; block_index + m_num_blocks)
│ │ │ │  				return clear();
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(222)">../src/merkle_tree.cpp:319</a></td><td>this can be optimized by using m_tree as storage to fill this tree into, and then clear it if the hashes fail</td></tr><tr id="222" style="display: none;" colspan="3"><td colspan="3"><h2>this can be optimized by using m_tree as storage to fill this
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(192)">../src/merkle_tree.cpp:319</a></td><td>this can be optimized by using m_tree as storage to fill this tree into, and then clear it if the hashes fail</td></tr><tr id="192" style="display: none;" colspan="3"><td colspan="3"><h2>this can be optimized by using m_tree as storage to fill this
│ │ │ │  tree into, and then clear it if the hashes fail</h2><h4>../src/merkle_tree.cpp:319</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{
│ │ │ │  		INVARIANT_CHECK;
│ │ │ │  
│ │ │ │  		// as we set the hashes of interior nodes, we may be able to validate
│ │ │ │  		// block hashes that we had since earlier. Any blocks that can be
│ │ │ │  		// validated, and failed, are added to this list
│ │ │ │  		add_hashes_result_t ret;
│ │ │ │ @@ -9032,15 +7564,15 @@
│ │ │ │  		// subtree (tree). It's also the hash the uncle_hashes are here to prove
│ │ │ │  		// is valid.
│ │ │ │  		int const insert_root_idx = dest_start_idx &gt;&gt; base_num_layers;
│ │ │ │  
│ │ │ │  		// start with validating the proofs, and inserting them as we go.
│ │ │ │  		if (!merkle_validate_and_insert_proofs(m_tree, insert_root_idx, tree[0], uncle_hashes))
│ │ │ │  			return {};
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(223)">../src/merkle_tree.cpp:367</a></td><td>a piece outside of this range may also fail, if one of the uncle hashes is at the layer right above the block hashes</td></tr><tr id="223" style="display: none;" colspan="3"><td colspan="3"><h2>a piece outside of this range may also fail, if one of the uncle
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(193)">../src/merkle_tree.cpp:367</a></td><td>a piece outside of this range may also fail, if one of the uncle hashes is at the layer right above the block hashes</td></tr><tr id="193" style="display: none;" colspan="3"><td colspan="3"><h2>a piece outside of this range may also fail, if one of the uncle
│ │ │ │  hashes is at the layer right above the block hashes</h2><h4>../src/merkle_tree.cpp:367</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		int const insert_root_idx = dest_start_idx &gt;&gt; base_num_layers;
│ │ │ │  
│ │ │ │  		// start with validating the proofs, and inserting them as we go.
│ │ │ │  		if (!merkle_validate_and_insert_proofs(m_tree, insert_root_idx, tree[0], uncle_hashes))
│ │ │ │  			return {};
│ │ │ │  
│ │ │ │  		// first fill in the subtree of known hashes from the base layer
│ │ │ │ @@ -9084,15 +7616,15 @@
│ │ │ │  
│ │ │ │  						// now that this hash has been reported as failing, we
│ │ │ │  						// can clear it. This will prevent it from being
│ │ │ │  						// reported as failing again.
│ │ │ │  						m_tree[dst_idx].clear();
│ │ │ │  					}
│ │ │ │  					else if (dst_idx &gt;= first_leaf)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(224)">../src/merkle_tree.cpp:447</a></td><td>instead of overwriting the root and comparing it against hashes[], write a functions that *validates* a tree by just filling it up to the level below the root and then validates it.</td></tr><tr id="224" style="display: none;" colspan="3"><td colspan="3"><h2>instead of overwriting the root and comparing it
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(194)">../src/merkle_tree.cpp:447</a></td><td>instead of overwriting the root and comparing it against hashes[], write a functions that *validates* a tree by just filling it up to the level below the root and then validates it.</td></tr><tr id="194" style="display: none;" colspan="3"><td colspan="3"><h2>instead of overwriting the root and comparing it
│ │ │ │  against hashes[], write a functions that *validates* a tree
│ │ │ │  by just filling it up to the level below the root and then
│ │ │ │  validates it.</h2><h4>../src/merkle_tree.cpp:447</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			&amp;&amp; dest_start_idx &lt; first_piece_idx + num_pieces())
│ │ │ │  		{
│ │ │ │  			int const blocks_in_piece = 1 &lt;&lt; base;
│ │ │ │  
│ │ │ │  			// it may now be possible to verify the hashes of previously received blocks
│ │ │ │ @@ -9127,15 +7659,15 @@
│ │ │ │  				}
│ │ │ │  				else
│ │ │ │  				{
│ │ │ │  					ret.passed.push_back(piece_index_t{piece - first_piece_idx} + file_piece_offset);
│ │ │ │  					// record that these block hashes are correct!
│ │ │ │  					int const leafs_start = block_idx - block_layer_start();
│ │ │ │  					int const leafs_end = std::min(m_num_blocks, leafs_start + blocks_in_piece);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(225)">../src/merkle_tree.cpp:471</a></td><td>this could be done more efficiently if bitfield had a function to set a range of bits</td></tr><tr id="225" style="display: none;" colspan="3"><td colspan="3"><h2>this could be done more efficiently if bitfield had a function
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(195)">../src/merkle_tree.cpp:471</a></td><td>this could be done more efficiently if bitfield had a function to set a range of bits</td></tr><tr id="195" style="display: none;" colspan="3"><td colspan="3"><h2>this could be done more efficiently if bitfield had a function
│ │ │ │  to set a range of bits</h2><h4>../src/merkle_tree.cpp:471</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				merkle_fill_tree(m_tree, blocks_in_piece, block_idx);
│ │ │ │  				if (m_tree[piece] != hashes[i])
│ │ │ │  				{
│ │ │ │  					merkle_clear_tree(m_tree, blocks_in_piece, block_idx);
│ │ │ │  					// write back the correct hash
│ │ │ │  					m_tree[piece] = hashes[i];
│ │ │ │  					TORRENT_ASSERT(blocks_in_piece == blocks_per_piece());
│ │ │ │ @@ -9179,15 +7711,15 @@
│ │ │ │  		if (blocks_verified(block_index, 1))
│ │ │ │  		{
│ │ │ │  			// if this blocks's hash is already known, check the passed-in hash against it
│ │ │ │  			if (compare_node(block_tree_index, h))
│ │ │ │  				return std::make_tuple(set_block_result::ok, block_index, 1);
│ │ │ │  			else
│ │ │ │  				return std::make_tuple(set_block_result::block_hash_failed, block_index, 1);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(226)">../src/merkle_tree.cpp:514</a></td><td>use structured binding in C++17</td></tr><tr id="226" style="display: none;" colspan="3"><td colspan="3"><h2>use structured binding in C++17</h2><h4>../src/merkle_tree.cpp:514</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		auto const first_leaf = merkle_first_leaf(num_leafs);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(196)">../src/merkle_tree.cpp:514</a></td><td>use structured binding in C++17</td></tr><tr id="196" style="display: none;" colspan="3"><td colspan="3"><h2>use structured binding in C++17</h2><h4>../src/merkle_tree.cpp:514</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		auto const first_leaf = merkle_first_leaf(num_leafs);
│ │ │ │  		auto const block_tree_index = first_leaf + block_index;
│ │ │ │  
│ │ │ │  		if (blocks_verified(block_index, 1))
│ │ │ │  		{
│ │ │ │  			// if this blocks's hash is already known, check the passed-in hash against it
│ │ │ │  			if (compare_node(block_tree_index, h))
│ │ │ │  				return std::make_tuple(set_block_result::ok, block_index, 1);
│ │ │ │ @@ -9223,15 +7755,15 @@
│ │ │ │  			// the whole piece failed the hash check. Clear all block hashes
│ │ │ │  			// in this piece and report a hash failure
│ │ │ │  			merkle_clear_tree(m_tree, leafs_size, first_leaf + leafs_start);
│ │ │ │  			m_tree[root_index] = root;
│ │ │ │  			return std::make_tuple(set_block_result::hash_failed, leafs_start, leafs_size);
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(227)">../src/merkle_tree.cpp:539</a></td><td>this could be done more efficiently if bitfield had a function to set a range of bits</td></tr><tr id="227" style="display: none;" colspan="3"><td colspan="3"><h2>this could be done more efficiently if bitfield had a function
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(197)">../src/merkle_tree.cpp:539</a></td><td>this could be done more efficiently if bitfield had a function to set a range of bits</td></tr><tr id="197" style="display: none;" colspan="3"><td colspan="3"><h2>this could be done more efficiently if bitfield had a function
│ │ │ │  to set a range of bits</h2><h4>../src/merkle_tree.cpp:539</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			merkle_find_known_subtree(m_tree, block_index, m_num_blocks);
│ │ │ │  
│ │ │ │  		// if the root node is unknown the hashes cannot be verified yet
│ │ │ │  		if (m_tree[root_index].is_all_zeros())
│ │ │ │  			return std::make_tuple(set_block_result::unknown, leafs_start, leafs_size);
│ │ │ │  
│ │ │ │  		// save the root hash because merkle_fill_tree will overwrite it
│ │ │ │ @@ -9275,251 +7807,488 @@
│ │ │ │  	int merkle_tree::block_layer_start() const
│ │ │ │  	{
│ │ │ │  		int const num_leafs = merkle_num_leafs(m_num_blocks);
│ │ │ │  		TORRENT_ASSERT(num_leafs &gt; 0);
│ │ │ │  		return merkle_first_leaf(num_leafs);
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(228)">../src/pe_crypto.cpp:60</a></td><td>it would be nice to get the literal working</td></tr><tr id="228" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to get the literal working</h2><h4>../src/pe_crypto.cpp:60</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include &lt;algorithm&gt;
│ │ │ │ -#include &lt;random&gt;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(198)">../src/add_torrent_params.cpp:78</a></td><td>pre C++17, GCC and msvc does not make std::string nothrow move assignable, which means no type containing a string will be nothrow move assignable by default either static_assert(std::is_nothrow_move_assignable<add_torrent_params>::value , "should be nothrow move assignable");</td></tr><tr id="198" style="display: none;" colspan="3"><td colspan="3"><h2>pre C++17, GCC and msvc does not make std::string nothrow move
│ │ │ │ +assignable, which means no type containing a string will be nothrow move
│ │ │ │ +assignable by default either
│ │ │ │ +static_assert(std::is_nothrow_move_assignable<add_torrent_params>::value
│ │ │ │ +, "should be nothrow move assignable");</h2><h4>../src/add_torrent_params.cpp:78</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			DECL_FLAG(sequential_download);
│ │ │ │ +			DECL_FLAG(pinned);
│ │ │ │ +			DECL_FLAG(stop_when_ready);
│ │ │ │ +			DECL_FLAG(override_trackers);
│ │ │ │ +			DECL_FLAG(override_web_seeds);
│ │ │ │ +			DECL_FLAG(need_save_resume);
│ │ │ │ +			DECL_FLAG(override_resume_data);
│ │ │ │ +			DECL_FLAG(merge_resume_trackers);
│ │ │ │ +			DECL_FLAG(use_resume_save_path);
│ │ │ │ +			DECL_FLAG(merge_resume_http_seeds);
│ │ │ │ +			DECL_FLAG(default_flags);
│ │ │ │ +#undef DECL_FLAG
│ │ │ │ +#endif // TORRENT_ABI_VERSION
│ │ │ │  
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_push.hpp"
│ │ │ │ +	static_assert(std::is_nothrow_move_constructible&lt;add_torrent_params&gt;::value
│ │ │ │ +		, "should be nothrow move constructible");
│ │ │ │  
│ │ │ │ -#include &lt;boost/multiprecision/integer.hpp&gt;
│ │ │ │ -#include &lt;boost/multiprecision/cpp_int.hpp&gt;
│ │ │ │ +	static_assert(std::is_nothrow_move_constructible&lt;std::string&gt;::value
│ │ │ │ +		, "should be nothrow move constructible");
│ │ │ │  
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(199)">../src/add_torrent_params.cpp:84</a></td><td>it would be nice if this was nothrow default constructible static_assert(std::is_nothrow_default_constructible<add_torrent_params>::value , "should be nothrow default constructible");</td></tr><tr id="199" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice if this was nothrow default constructible
│ │ │ │ +static_assert(std::is_nothrow_default_constructible<add_torrent_params>::value
│ │ │ │ +, "should be nothrow default constructible");</h2><h4>../src/add_torrent_params.cpp:84</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			DECL_FLAG(pinned);
│ │ │ │ +			DECL_FLAG(stop_when_ready);
│ │ │ │ +			DECL_FLAG(override_trackers);
│ │ │ │ +			DECL_FLAG(override_web_seeds);
│ │ │ │ +			DECL_FLAG(need_save_resume);
│ │ │ │ +			DECL_FLAG(override_resume_data);
│ │ │ │ +			DECL_FLAG(merge_resume_trackers);
│ │ │ │ +			DECL_FLAG(use_resume_save_path);
│ │ │ │ +			DECL_FLAG(merge_resume_http_seeds);
│ │ │ │ +			DECL_FLAG(default_flags);
│ │ │ │ +#undef DECL_FLAG
│ │ │ │ +#endif // TORRENT_ABI_VERSION
│ │ │ │  
│ │ │ │ -#include "libtorrent/random.hpp"
│ │ │ │ -#include "libtorrent/aux_/alloca.hpp"
│ │ │ │ -#include "libtorrent/pe_crypto.hpp"
│ │ │ │ -#include "libtorrent/hasher.hpp"
│ │ │ │ +	static_assert(std::is_nothrow_move_constructible&lt;add_torrent_params&gt;::value
│ │ │ │ +		, "should be nothrow move constructible");
│ │ │ │  
│ │ │ │ -namespace libtorrent {
│ │ │ │ +	static_assert(std::is_nothrow_move_constructible&lt;std::string&gt;::value
│ │ │ │ +		, "should be nothrow move constructible");
│ │ │ │  
│ │ │ │ -	namespace mp = boost::multiprecision;
│ │ │ │  
│ │ │ │ -	namespace {
│ │ │ │ -<div style="background: #ffff00" width="100%">		key_t const dh_prime
│ │ │ │ -</div>			("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A36210000000000090563");
│ │ │ │ -	}
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>namespace aux {
│ │ │ │  
│ │ │ │ -	std::array&lt;char, 96&gt; export_key(key_t const&amp; k)
│ │ │ │ +	// returns whether this add_torrent_params object has "resume-data", i.e.
│ │ │ │ +	// information about which pieces we have.
│ │ │ │ +	bool contains_resume_data(add_torrent_params const&amp; atp)
│ │ │ │  	{
│ │ │ │ -		std::array&lt;char, 96&gt; ret;
│ │ │ │ -		auto* begin = reinterpret_cast&lt;std::uint8_t*&gt;(ret.data());
│ │ │ │ -		std::uint8_t* end = mp::export_bits(k, begin, 8);
│ │ │ │ +		return !atp.have_pieces.empty()
│ │ │ │ +			|| (atp.flags &amp; torrent_flags::seed_mode);
│ │ │ │ +	}
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(229)">../src/pe_crypto.cpp:71</a></td><td>it would be nice to be able to export to a fixed width field, so we wouldn't have to shift it later</td></tr><tr id="229" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to be able to export to a fixed width field, so
│ │ │ │ -we wouldn't have to shift it later</h2><h4>../src/pe_crypto.cpp:71</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include "libtorrent/random.hpp"
│ │ │ │ -#include "libtorrent/aux_/alloca.hpp"
│ │ │ │ -#include "libtorrent/pe_crypto.hpp"
│ │ │ │ -#include "libtorrent/hasher.hpp"
│ │ │ │ +}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(200)">../src/part_file.cpp:300</a></td><td>what do we do if someone is currently reading from the disk from this piece? does it matter? Since we won't actively erase the data from disk, but it may be overwritten soon, it's probably not that big of a deal</td></tr><tr id="200" style="display: none;" colspan="3"><td colspan="3"><h2>what do we do if someone is currently reading from the disk
│ │ │ │ +from this piece? does it matter? Since we won't actively erase the
│ │ │ │ +data from disk, but it may be overwritten soon, it's probably not that
│ │ │ │ +big of a deal</h2><h4>../src/part_file.cpp:300</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				create_directories(m_path, ec);
│ │ │ │ +				if (ec) return {};
│ │ │ │ +				return aux::file_handle(fn, 0, mode);
│ │ │ │ +			}
│ │ │ │ +			return {};
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +	catch (storage_error const&amp; e)
│ │ │ │ +	{
│ │ │ │ +		ec = e.ec;
│ │ │ │ +		return {};
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -namespace libtorrent {
│ │ │ │ +	void part_file::free_piece(piece_index_t const piece)
│ │ │ │ +	{
│ │ │ │ +		std::lock_guard&lt;std::mutex&gt; l(m_mutex);
│ │ │ │  
│ │ │ │ -	namespace mp = boost::multiprecision;
│ │ │ │ +		auto const i = m_piece_map.find(piece);
│ │ │ │ +		if (i == m_piece_map.end()) return;
│ │ │ │  
│ │ │ │ -	namespace {
│ │ │ │ -		key_t const dh_prime
│ │ │ │ -			("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A36210000000000090563");
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>		m_free_slots.push_back(i-&gt;second);
│ │ │ │ +		m_piece_map.erase(i);
│ │ │ │ +		m_dirty_metadata = true;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	std::array&lt;char, 96&gt; export_key(key_t const&amp; k)
│ │ │ │ +	void part_file::move_partfile(std::string const&amp; path, error_code&amp; ec)
│ │ │ │  	{
│ │ │ │ -		std::array&lt;char, 96&gt; ret;
│ │ │ │ -		auto* begin = reinterpret_cast&lt;std::uint8_t*&gt;(ret.data());
│ │ │ │ -		std::uint8_t* end = mp::export_bits(k, begin, 8);
│ │ │ │ +		std::lock_guard&lt;std::mutex&gt; l(m_mutex);
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">		if (end &lt; begin + 96)
│ │ │ │ -</div>		{
│ │ │ │ -			int const len = int(end - begin);
│ │ │ │ -#if defined __GNUC__ &amp;&amp; __GNUC__ == 12
│ │ │ │ -#pragma GCC diagnostic push
│ │ │ │ -#pragma GCC diagnostic ignored "-Wstringop-overflow"
│ │ │ │ -#endif
│ │ │ │ -			std::memmove(begin + 96 - len, begin, aux::numeric_cast&lt;std::size_t&gt;(len));
│ │ │ │ -#if defined __GNUC__ &amp;&amp; __GNUC__ == 12
│ │ │ │ -#pragma GCC diagnostic pop
│ │ │ │ -#endif
│ │ │ │ -			std::memset(begin, 0, aux::numeric_cast&lt;std::size_t&gt;(96 - len));
│ │ │ │ +		flush_metadata_impl(ec);
│ │ │ │ +		if (ec) return;
│ │ │ │ +
│ │ │ │ +		if (!m_piece_map.empty())
│ │ │ │ +		{
│ │ │ │ +			std::string old_path = combine_path(m_path, m_name);
│ │ │ │ +			std::string new_path = combine_path(path, m_name);
│ │ │ │ +
│ │ │ │ +			rename(old_path, new_path, ec);
│ │ │ │ +			if (ec == boost::system::errc::no_such_file_or_directory)
│ │ │ │ +				ec.clear();
│ │ │ │ +
│ │ │ │ +			if (ec)
│ │ │ │ +			{
│ │ │ │ +				storage_error se;
│ │ │ │ +				aux::copy_file(old_path, new_path, se);
│ │ │ │ +				ec = se.ec;
│ │ │ │ +				if (ec) return;
│ │ │ │ +				remove(old_path, ec);
│ │ │ │ +			}
│ │ │ │ +		}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(201)">../src/part_file.cpp:411</a></td><td>instead of rebuilding the whole file header and flushing it, update the slot entries as we go</td></tr><tr id="201" style="display: none;" colspan="3"><td colspan="3"><h2>instead of rebuilding the whole file header
│ │ │ │ +and flushing it, update the slot entries as we go</h2><h4>../src/part_file.cpp:411</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">						TORRENT_ASSERT(j-&gt;second == slot);
│ │ │ │ +						m_free_slots.push_back(j-&gt;second);
│ │ │ │ +						m_piece_map.erase(j);
│ │ │ │ +						m_dirty_metadata = true;
│ │ │ │ +					}
│ │ │ │ +				}
│ │ │ │ +			}
│ │ │ │ +			file_offset += block_to_copy;
│ │ │ │ +			piece_offset = 0;
│ │ │ │ +			size -= block_to_copy;
│ │ │ │  		}
│ │ │ │ -		return ret;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	void rc4_init(const unsigned char* in, std::size_t len, rc4 *state);
│ │ │ │ -	std::size_t rc4_encrypt(unsigned char *out, std::size_t outlen, rc4 *state);
│ │ │ │ -
│ │ │ │ -	// Set the prime P and the generator, generate local public key
│ │ │ │ -	dh_key_exchange::dh_key_exchange()
│ │ │ │ +	void part_file::flush_metadata(error_code&amp; ec)
│ │ │ │  	{
│ │ │ │ -		aux::array&lt;std::uint8_t, 96&gt; random_key;
│ │ │ │ -		aux::random_bytes({reinterpret_cast&lt;char*&gt;(random_key.data())
│ │ │ │ -			, static_cast&lt;std::ptrdiff_t&gt;(random_key.size())});
│ │ │ │ +		std::lock_guard&lt;std::mutex&gt; l(m_mutex);
│ │ │ │  
│ │ │ │ -		// create local key (random)
│ │ │ │ -		mp::import_bits(m_dh_local_secret, random_key.begin(), random_key.end());
│ │ │ │ +		flush_metadata_impl(ec);
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -		// key = (2 ^ secret) % prime
│ │ │ │ -		m_dh_local_key = mp::powm(key_t(2), m_dh_local_secret, dh_prime);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(230)">../src/file_storage.cpp:457</a></td><td>maybe it would be nice to have a better index here</td></tr><tr id="230" style="display: none;" colspan="3"><td colspan="3"><h2>maybe it would be nice to have a better index here</h2><h4>../src/file_storage.cpp:457</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// find the file iterator and file offset
│ │ │ │ -		aux::file_entry target;
│ │ │ │ -		target.offset = aux::numeric_cast&lt;std::uint64_t&gt;(offset);
│ │ │ │ -		TORRENT_ASSERT(!compare_file_offset(target, m_files.front()));
│ │ │ │ +<div style="background: #ffff00" width="100%">	void part_file::flush_metadata_impl(error_code&amp; ec)
│ │ │ │ +</div>	{
│ │ │ │ +		// do we need to flush the metadata?
│ │ │ │ +		if (m_dirty_metadata == false) return;
│ │ │ │  
│ │ │ │ -		auto file_iter = std::upper_bound(
│ │ │ │ -			m_files.begin(), m_files.end(), target, compare_file_offset);
│ │ │ │ +		if (m_piece_map.empty())
│ │ │ │ +		{
│ │ │ │ +			// if we don't have any pieces left in the
│ │ │ │ +			// part file, remove it
│ │ │ │ +			std::string const p = combine_path(m_path, m_name);
│ │ │ │ +			remove(p, ec);
│ │ │ │  
│ │ │ │ -		TORRENT_ASSERT(file_iter != m_files.begin());
│ │ │ │ -		--file_iter;
│ │ │ │ -		return file_index_t{int(file_iter - m_files.begin())};
│ │ │ │ +			if (ec == boost::system::errc::no_such_file_or_directory)
│ │ │ │ +				ec.clear();
│ │ │ │ +			return;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		auto f = open_file(aux::open_mode::write | aux::open_mode::hidden, ec);
│ │ │ │ +		if (ec) return;
│ │ │ │ +
│ │ │ │ +		std::vector&lt;char&gt; header(static_cast&lt;std::size_t&gt;(m_header_size));
│ │ │ │ +
│ │ │ │ +		using namespace libtorrent::aux;
│ │ │ │ +
│ │ │ │ +		char* ptr = header.data();
│ │ │ │ +		write_uint32(m_max_pieces, ptr);
│ │ │ │ +		write_uint32(m_piece_size, ptr);
│ │ │ │ +
│ │ │ │ +		for (piece_index_t piece(0); piece &lt; piece_index_t(m_max_pieces); ++piece)
│ │ │ │ +		{
│ │ │ │ +			auto const i = m_piece_map.find(piece);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(202)">../src/peer_connection.cpp:1105</a></td><td>this should be the global download rate</td></tr><tr id="202" style="display: none;" colspan="3"><td colspan="3"><h2>this should be the global download rate</h2><h4>../src/peer_connection.cpp:1105</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +		int rate = 0;
│ │ │ │ +
│ │ │ │ +		// if we haven't received any data recently, the current download rate
│ │ │ │ +		// is not representative
│ │ │ │ +		if (aux::time_now() - m_last_piece.get(m_connect) &gt; seconds(30) &amp;&amp; m_download_rate_peak &gt; 0)
│ │ │ │ +		{
│ │ │ │ +			rate = m_download_rate_peak;
│ │ │ │ +		}
│ │ │ │ +		else if (aux::time_now() - m_last_unchoked.get(m_connect) &lt; seconds(5)
│ │ │ │ +			&amp;&amp; m_statistics.total_payload_upload() &lt; 2 * 0x4000)
│ │ │ │ +		{
│ │ │ │ +			// if we're have only been unchoked for a short period of time,
│ │ │ │ +			// we don't know what rate we can get from this peer. Instead of assuming
│ │ │ │ +			// the lowest possible rate, assume the average.
│ │ │ │ +
│ │ │ │ +			int peers_with_requests = int(stats_counters()[counters::num_peers_down_requests]);
│ │ │ │ +			// avoid division by 0
│ │ │ │ +			if (peers_with_requests == 0) peers_with_requests = 1;
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">			rate = t-&gt;statistics().transfer_rate(stat::download_payload) / peers_with_requests;
│ │ │ │ +</div>		}
│ │ │ │ +		else
│ │ │ │ +		{
│ │ │ │ +			// current download rate in bytes per seconds
│ │ │ │ +			rate = m_statistics.transfer_rate(stat::download_payload);
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		// avoid division by zero
│ │ │ │ +		if (rate &lt; 50) rate = 50;
│ │ │ │ +
│ │ │ │ +		// average of current rate and peak
│ │ │ │ +//		rate = (rate + m_download_rate_peak) / 2;
│ │ │ │ +
│ │ │ │ +		return milliseconds((m_outstanding_bytes + extra_bytes
│ │ │ │ +			+ m_queued_time_critical * t-&gt;block_size() * 1000) / rate);
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	file_index_t file_storage::file_index_at_piece(piece_index_t const piece) const
│ │ │ │ +	void peer_connection::add_stat(std::int64_t const downloaded, std::int64_t const uploaded)
│ │ │ │  	{
│ │ │ │ -		return file_index_at_offset(static_cast&lt;int&gt;(piece) * std::int64_t(piece_length()));
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +		m_statistics.add_stat(downloaded, uploaded);
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	file_index_t file_storage::file_index_for_root(sha256_hash const&amp; root_hash) const
│ │ │ │ +	sha1_hash peer_connection::associated_info_hash() const
│ │ │ │  	{
│ │ │ │ -<div style="background: #ffff00" width="100%">		for (file_index_t const i : file_range())
│ │ │ │ -</div>		{
│ │ │ │ -			if (root(i) == root_hash) return i;
│ │ │ │ +		std::shared_ptr&lt;torrent&gt; t = associated_torrent().lock();
│ │ │ │ +		TORRENT_ASSERT(t);
│ │ │ │ +		auto const&amp; ih = t-&gt;info_hash();
│ │ │ │ +		// if protocol_v2 is set on the peer, this better be a v2 torrent,
│ │ │ │ +		// otherwise something isn't right
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(203)">../src/peer_connection.cpp:3536</a></td><td>sort the allowed fast set in priority order</td></tr><tr id="203" style="display: none;" colspan="3"><td colspan="3"><h2>sort the allowed fast set in priority order</h2><h4>../src/peer_connection.cpp:3536</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +		// if the peer has the piece and we want
│ │ │ │ +		// to download it, request it
│ │ │ │ +		if (index &lt; m_have_piece.end_index()
│ │ │ │ +			&amp;&amp; m_have_piece[index]
│ │ │ │ +			&amp;&amp; !t-&gt;have_piece(index)
│ │ │ │ +			&amp;&amp; t-&gt;valid_metadata()
│ │ │ │ +			&amp;&amp; t-&gt;has_picker()
│ │ │ │ +			&amp;&amp; t-&gt;picker().piece_priority(index) &gt; dont_download)
│ │ │ │ +		{
│ │ │ │ +			t-&gt;peer_is_interesting(*this);
│ │ │ │  		}
│ │ │ │ -		return file_index_t{-1};
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	piece_index_t file_storage::piece_index_at_file(file_index_t f) const
│ │ │ │ +	std::vector&lt;piece_index_t&gt; const&amp; peer_connection::allowed_fast()
│ │ │ │  	{
│ │ │ │ -		return piece_index_t{aux::numeric_cast&lt;int&gt;(file_offset(f) / piece_length())};
│ │ │ │ -	}
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +		std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ +		TORRENT_ASSERT(t);
│ │ │ │  
│ │ │ │ -#if TORRENT_ABI_VERSION &lt;= 2
│ │ │ │ -	char const* file_storage::file_name_ptr(file_index_t const index) const
│ │ │ │ +<div style="background: #ffff00" width="100%">		return m_allowed_fast;
│ │ │ │ +</div>	}
│ │ │ │ +
│ │ │ │ +	bool peer_connection::can_request_time_critical() const
│ │ │ │  	{
│ │ │ │ -		return m_files[index].name;
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +		if (has_peer_choked() || !is_interesting()) return false;
│ │ │ │ +		if (int(m_download_queue.size()) + int(m_request_queue.size())
│ │ │ │ +			&gt; m_desired_queue_size * 2) return false;
│ │ │ │ +		if (on_parole()) return false;
│ │ │ │ +		if (m_disconnecting) return false;
│ │ │ │ +		std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ +		TORRENT_ASSERT(t);
│ │ │ │ +		if (t-&gt;upload_mode()) return false;
│ │ │ │ +
│ │ │ │ +		// ignore snubbed peers, since they're not likely to return pieces in a
│ │ │ │ +		// timely manner anyway
│ │ │ │ +		if (m_snubbed) return false;
│ │ │ │ +		return true;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	int file_storage::file_name_len(file_index_t const index) const
│ │ │ │ +	bool peer_connection::make_time_critical(piece_block const&amp; block)
│ │ │ │  	{
│ │ │ │ -		if (m_files[index].name_len == aux::file_entry::name_is_owned)
│ │ │ │ -			return -1;
│ │ │ │ -		return m_files[index].name_len;
│ │ │ │ -	}
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +		auto const rit = std::find_if(m_request_queue.begin()
│ │ │ │ +			, m_request_queue.end(), aux::has_block(block));
│ │ │ │ +		if (rit == m_request_queue.end()) return false;
│ │ │ │ +#if TORRENT_USE_ASSERTS
│ │ │ │ +		std::shared_ptr&lt;torrent&gt; t = m_torrent.lock();
│ │ │ │ +		TORRENT_ASSERT(t);
│ │ │ │ +		TORRENT_ASSERT(t-&gt;has_picker());
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(204)">../src/ip_notifier.cpp:41</a></td><td>simulator support</td></tr><tr id="204" style="display: none;" colspan="3"><td colspan="3"><h2>simulator support</h2><h4>../src/ip_notifier.cpp:41</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">      from this software without specific prior written permission.
│ │ │ │ +
│ │ │ │ +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
│ │ │ │ +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
│ │ │ │ +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
│ │ │ │ +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
│ │ │ │ +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
│ │ │ │ +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
│ │ │ │ +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
│ │ │ │ +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
│ │ │ │ +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
│ │ │ │ +POSSIBILITY OF SUCH DAMAGE.
│ │ │ │ +
│ │ │ │ +*/
│ │ │ │ +
│ │ │ │ +#include "libtorrent/aux_/ip_notifier.hpp"
│ │ │ │ +#include "libtorrent/assert.hpp"
│ │ │ │ +
│ │ │ │ +#if defined TORRENT_BUILD_SIMULATOR
│ │ │ │ +<div style="background: #ffff00" width="100%">#elif TORRENT_USE_NETLINK
│ │ │ │ +</div>#include "libtorrent/netlink.hpp"
│ │ │ │ +#include "libtorrent/socket.hpp"
│ │ │ │ +#include &lt;array&gt;
│ │ │ │ +#include &lt;unordered_map&gt;
│ │ │ │ +#elif TORRENT_USE_SYSTEMCONFIGURATION || TORRENT_USE_SC_NETWORK_REACHABILITY
│ │ │ │ +#include &lt;SystemConfiguration/SystemConfiguration.h&gt;
│ │ │ │ +#elif defined TORRENT_WINDOWS
│ │ │ │ +#include "libtorrent/aux_/throw.hpp"
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_push.hpp"
│ │ │ │ +#include &lt;iphlpapi.h&gt;
│ │ │ │ +#ifdef TORRENT_WINRT
│ │ │ │ +#include &lt;netioapi.h&gt;
│ │ │ │ +#endif
│ │ │ │ +#include &lt;mutex&gt;
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │  #endif
│ │ │ │  
│ │ │ │ -	std::vector&lt;file_slice&gt; file_storage::map_block(piece_index_t const piece
│ │ │ │ -		, std::int64_t const offset, std::int64_t size) const
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT_PRECOND(piece &gt;= piece_index_t{0});
│ │ │ │ -		TORRENT_ASSERT_PRECOND(piece &lt; end_piece());
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(231)">../src/file_storage.cpp:1242</a></td><td>this would be more efficient if m_paths was sorted first, such that a lower path index always meant sorted-before</td></tr><tr id="231" style="display: none;" colspan="3"><td colspan="3"><h2>this would be more efficient if m_paths was sorted first, such
│ │ │ │ -that a lower path index always meant sorted-before</h2><h4>../src/file_storage.cpp:1242</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │ +#include "libtorrent/aux_/netlink_utils.hpp"
│ │ │ │  
│ │ │ │ -	void file_storage::canonicalize_impl(bool const backwards_compatible)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(piece_length() &gt;= 16 * 1024);
│ │ │ │ +namespace libtorrent { namespace aux {
│ │ │ │  
│ │ │ │ -		// use this vector to track the new ordering of files
│ │ │ │ -		// this allows the use of STL algorithms despite them
│ │ │ │ -		// not supporting a custom swap functor
│ │ │ │ -		aux::vector&lt;file_index_t, file_index_t&gt; new_order(end_file());
│ │ │ │ -		for (auto i : file_range())
│ │ │ │ -			new_order[i] = i;
│ │ │ │ +namespace {
│ │ │ │  
│ │ │ │ -		// remove any existing pad files
│ │ │ │ -		{
│ │ │ │ -			auto pad_begin = std::partition(new_order.begin(), new_order.end()
│ │ │ │ -				, [this](file_index_t i) { return !m_files[i].pad_file; });
│ │ │ │ -			new_order.erase(pad_begin, new_order.end());
│ │ │ │ +#if (TORRENT_USE_SYSTEMCONFIGURATION || TORRENT_USE_SC_NETWORK_REACHABILITY) &amp;&amp; \
│ │ │ │ +	!defined TORRENT_BUILD_SIMULATOR
│ │ │ │ +
│ │ │ │ +// common utilities for Mac and iOS
│ │ │ │ +template &lt;typename T&gt; void CFRefRetain(T h) { CFRetain(h); }
│ │ │ │ +template &lt;typename T&gt; void CFRefRelease(T h) { CFRelease(h); }
│ │ │ │ +
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(205)">../src/settings_pack.cpp:305</a></td><td>deprecate this</td></tr><tr id="205" style="display: none;" colspan="3"><td colspan="3"><h2>deprecate this</h2><h4>../src/settings_pack.cpp:305</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		SET(outgoing_port, 0, nullptr),
│ │ │ │ +		SET(num_outgoing_ports, 0, nullptr),
│ │ │ │ +		SET(peer_dscp, 0x04, &amp;session_impl::update_peer_dscp),
│ │ │ │ +		SET(active_downloads, 3, &amp;session_impl::trigger_auto_manage),
│ │ │ │ +		SET(active_seeds, 5, &amp;session_impl::trigger_auto_manage),
│ │ │ │ +		SET(active_checking, 1, &amp;session_impl::trigger_auto_manage),
│ │ │ │ +		SET(active_dht_limit, 88, nullptr),
│ │ │ │ +		SET(active_tracker_limit, 1600, nullptr),
│ │ │ │ +		SET(active_lsd_limit, 60, nullptr),
│ │ │ │ +		SET(active_limit, 500, &amp;session_impl::trigger_auto_manage),
│ │ │ │ +		DEPRECATED_SET(active_loaded_limit, 0, &amp;session_impl::trigger_auto_manage),
│ │ │ │ +		SET(auto_manage_interval, 30, nullptr),
│ │ │ │ +		SET(seed_time_limit, 24 * 60 * 60, nullptr),
│ │ │ │ +		SET(auto_scrape_interval, 1800, nullptr),
│ │ │ │ +		SET(auto_scrape_min_interval, 300, nullptr),
│ │ │ │ +		SET(max_peerlist_size, 3000, nullptr),
│ │ │ │ +		SET(max_paused_peerlist_size, 1000, nullptr),
│ │ │ │ +		SET(min_announce_interval, 5 * 60, nullptr),
│ │ │ │ +		SET(auto_manage_startup, 60, nullptr),
│ │ │ │ +		SET(seeding_piece_quota, 20, nullptr),
│ │ │ │ +<div style="background: #ffff00" width="100%">		SET(max_rejects, 50, nullptr),
│ │ │ │ +</div>		SET(recv_socket_buffer_size, 0, &amp;session_impl::update_socket_buffer_size),
│ │ │ │ +		SET(send_socket_buffer_size, 0, &amp;session_impl::update_socket_buffer_size),
│ │ │ │ +		SET(max_peer_recv_buffer_size, 2 * 1024 * 1024, nullptr),
│ │ │ │ +		DEPRECATED_SET(file_checks_delay_per_block, 0, nullptr),
│ │ │ │ +		DEPRECATED2_SET(read_cache_line_size, 32, nullptr),
│ │ │ │ +		DEPRECATED2_SET(write_cache_line_size, 16, nullptr),
│ │ │ │ +		SET(optimistic_disk_retry, 10 * 60, nullptr),
│ │ │ │ +		SET(max_suggest_pieces, 16, nullptr),
│ │ │ │ +		SET(local_service_announce_interval, 5 * 60, nullptr),
│ │ │ │ +		SET(dht_announce_interval, 15 * 60, &amp;session_impl::update_dht_announce_interval),
│ │ │ │ +		SET(udp_tracker_token_expiry, 60, nullptr),
│ │ │ │ +		DEPRECATED_SET(default_cache_min_age, 1, nullptr),
│ │ │ │ +		SET(num_optimistic_unchoke_slots, 0, nullptr),
│ │ │ │ +		DEPRECATED_SET(default_est_reciprocation_rate, 16000, nullptr),
│ │ │ │ +		DEPRECATED_SET(increase_est_reciprocation_rate, 20, nullptr),
│ │ │ │ +		DEPRECATED_SET(decrease_est_reciprocation_rate, 3, nullptr),
│ │ │ │ +		SET(max_pex_peers, 50, nullptr),
│ │ │ │ +		SET(tick_interval, 500, nullptr),
│ │ │ │ +		SET(share_mode_target, 3, nullptr),
│ │ │ │ +		SET(upload_rate_limit, 0, &amp;session_impl::update_upload_rate),
│ │ │ │ +		SET(download_rate_limit, 0, &amp;session_impl::update_download_rate),
│ │ │ │ +		DEPRECATED_SET(local_upload_rate_limit, 0, &amp;session_impl::update_local_upload_rate),
│ │ │ │ +		DEPRECATED_SET(local_download_rate_limit, 0, &amp;session_impl::update_local_download_rate),
│ │ │ │ +		SET(dht_upload_rate_limit, 8000, &amp;session_impl::update_dht_upload_rate_limit),
│ │ │ │ +		SET(unchoke_slots_limit, 8, &amp;session_impl::update_unchoke_limit),
│ │ │ │ +		DEPRECATED_SET(half_open_limit, 0, nullptr),
│ │ │ │ +		SET(connections_limit, 200, &amp;session_impl::update_connections_limit),
│ │ │ │ +		SET(connections_slack, 10, nullptr),
│ │ │ │ +		SET(utp_target_delay, 100, nullptr),
│ │ │ │ +		SET(utp_gain_factor, 3000, nullptr),
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(206)">../src/settings_pack.cpp:590</a></td><td>it would be nice to reserve() these vectors up front</td></tr><tr id="206" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to reserve() these vectors up front</h2><h4>../src/settings_pack.cpp:590</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			s.set_str(settings_pack::string_type_base | i, str_settings[i].default_value);
│ │ │ │ +			TORRENT_ASSERT(s.get_str(settings_pack::string_type_base + i) == str_settings[i].default_value);
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>		// sort files by path/name
│ │ │ │ -		std::sort(new_order.begin(), new_order.end()
│ │ │ │ -			, [this](file_index_t l, file_index_t r)
│ │ │ │ +		for (int i = 0; i &lt; settings_pack::num_int_settings; ++i)
│ │ │ │  		{
│ │ │ │ -			// assuming m_paths are unique!
│ │ │ │ -			auto const&amp; lf = m_files[l];
│ │ │ │ -			auto const&amp; rf = m_files[r];
│ │ │ │ -			if (lf.path_index != rf.path_index)
│ │ │ │ -			{
│ │ │ │ -				int const ret = path_compare(m_paths[lf.path_index], lf.filename()
│ │ │ │ -					, m_paths[rf.path_index], rf.filename());
│ │ │ │ -				if (ret != 0) return ret &lt; 0;
│ │ │ │ -			}
│ │ │ │ -			return lf.filename() &lt; rf.filename();
│ │ │ │ -		});
│ │ │ │ +			s.set_int(settings_pack::int_type_base | i, int_settings[i].default_value);
│ │ │ │ +			TORRENT_ASSERT(s.get_int(settings_pack::int_type_base + i) == int_settings[i].default_value);
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -		aux::vector&lt;aux::file_entry, file_index_t&gt; new_files;
│ │ │ │ -		aux::vector&lt;char const*, file_index_t&gt; new_file_hashes;
│ │ │ │ -		aux::vector&lt;std::time_t, file_index_t&gt; new_mtime;
│ │ │ │ +		for (int i = 0; i &lt; settings_pack::num_bool_settings; ++i)
│ │ │ │ +		{
│ │ │ │ +			s.set_bool(settings_pack::bool_type_base | i, bool_settings[i].default_value);
│ │ │ │ +			TORRENT_ASSERT(s.get_bool(settings_pack::bool_type_base + i) == bool_settings[i].default_value);
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -		// reserve enough space for the worst case after padding
│ │ │ │ -		new_files.reserve(new_order.size() * 2 - 1);
│ │ │ │ -		if (!m_file_hashes.empty())
│ │ │ │ -			new_file_hashes.reserve(new_order.size() * 2 - 1);
│ │ │ │ -		if (!m_mtime.empty())
│ │ │ │ -			new_mtime.reserve(new_order.size() * 2 - 1);
│ │ │ │ +	settings_pack default_settings()
│ │ │ │ +	{
│ │ │ │ +		settings_pack ret;
│ │ │ │ +<div style="background: #ffff00" width="100%">		for (int i = 0; i &lt; settings_pack::num_string_settings; ++i)
│ │ │ │ +</div>		{
│ │ │ │ +			if (str_settings[i].default_value == nullptr) continue;
│ │ │ │ +			ret.set_str(settings_pack::string_type_base + i, str_settings[i].default_value);
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -		// re-compute offsets and insert pad files as necessary
│ │ │ │ -		std::int64_t off = 0;
│ │ │ │ +		for (int i = 0; i &lt; settings_pack::num_int_settings; ++i)
│ │ │ │ +		{
│ │ │ │ +			ret.set_int(settings_pack::int_type_base + i, int_settings[i].default_value);
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(232)">../src/file_storage.cpp:1345</a></td><td>in C++17 this could be string_view</td></tr><tr id="232" style="display: none;" colspan="3"><td colspan="3"><h2>in C++17 this could be string_view</h2><h4>../src/file_storage.cpp:1345</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				add_pad_file(i);
│ │ │ │ +		for (int i = 0; i &lt; settings_pack::num_bool_settings; ++i)
│ │ │ │ +		{
│ │ │ │ +			ret.set_bool(settings_pack::bool_type_base + i, bool_settings[i].default_value);
│ │ │ │  		}
│ │ │ │ +		return ret;
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -		m_files = std::move(new_files);
│ │ │ │ -		m_file_hashes = std::move(new_file_hashes);
│ │ │ │ -		m_mtime = std::move(new_mtime);
│ │ │ │ +	void apply_pack(settings_pack const* pack, aux::session_settings&amp; sett
│ │ │ │ +		, aux::session_impl* ses)
│ │ │ │ +	{
│ │ │ │ +		using fun_t = void (aux::session_impl::*)();
│ │ │ │ +		std::vector&lt;fun_t&gt; callbacks;
│ │ │ │  
│ │ │ │ -		m_total_size = off;
│ │ │ │ -	}
│ │ │ │ +		sett.bulk_set([&amp;](aux::session_settings_single_thread&amp; s)
│ │ │ │ +		{
│ │ │ │ +			apply_pack_impl(pack, s, ses ? &amp;callbacks : nullptr);
│ │ │ │ +		});
│ │ │ │  
│ │ │ │ -	void file_storage::sanitize_symlinks()
│ │ │ │ +		// call the callbacks once all the settings have been applied, and
│ │ │ │ +		// only once per callback
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(207)">../src/utp_stream.cpp:1467</a></td><td>this loop is not very efficient. It could be fixed by having a separate list of sequence numbers that need resending</td></tr><tr id="207" style="display: none;" colspan="3"><td colspan="3"><h2>this loop is not very efficient. It could be fixed by having
│ │ │ │ +a separate list of sequence numbers that need resending</h2><h4>../src/utp_stream.cpp:1467</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#endif
│ │ │ │ +
│ │ │ │ +	if (m_stalled)
│ │ │ │  	{
│ │ │ │ -		// symlinks are unusual, this function is optimized assuming there are no
│ │ │ │ -		// symbolic links in the torrent. If we find one symbolic link, we'll
│ │ │ │ -		// build the hash table of files it's allowed to refer to, but don't pay
│ │ │ │ -		// that price up-front.
│ │ │ │ -		std::unordered_map&lt;std::string, file_index_t&gt; file_map;
│ │ │ │ -		bool file_map_initialized = false;
│ │ │ │ +		if (flags &amp; pkt_ack)
│ │ │ │ +			defer_ack();
│ │ │ │ +		return false;
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -		// lazily instantiated set of all valid directories a symlink may point to
│ │ │ │ -<div style="background: #ffff00" width="100%">		std::unordered_set&lt;std::string&gt; dir_map;
│ │ │ │ -</div>		bool dir_map_initialized = false;
│ │ │ │ +	// m_out_eof means we're trying to close the write side of this socket,
│ │ │ │ +	// we need to flush all payload before we can send the FIN packet, so don't
│ │ │ │ +	// store any payload in the nagle packet
│ │ │ │ +	bool const force = (flags &amp; pkt_ack) || (flags &amp; pkt_fin) || m_out_eof;
│ │ │ │  
│ │ │ │ -		// symbolic links that points to directories
│ │ │ │ -		std::unordered_map&lt;std::string, std::string&gt; dir_links;
│ │ │ │ +	// when we want to close the outgoing stream, we need to send the
│ │ │ │ +	// remaining nagle packet even though it won't fill a packet.
│ │ │ │ +	bool const force_flush_nagle = m_out_eof &amp;&amp; m_write_buffer_size;
│ │ │ │  
│ │ │ │ -		// we validate symlinks in (potentially) 2 passes over the files.
│ │ │ │ -		// remaining symlinks to validate after the first pass
│ │ │ │ -		std::vector&lt;file_index_t&gt; symlinks_to_validate;
│ │ │ │ +	// first see if we need to resend any packets
│ │ │ │  
│ │ │ │ -		for (auto const i : file_range())
│ │ │ │ +<div style="background: #ffff00" width="100%">	for (int i = (m_acked_seq_nr + 1) &amp; ACK_MASK; i != m_seq_nr; i = (i + 1) &amp; ACK_MASK)
│ │ │ │ +</div>	{
│ │ │ │ +		packet* p = m_outbuf.at(aux::numeric_cast&lt;packet_buffer::index_type&gt;(i));
│ │ │ │ +		if (!p) continue;
│ │ │ │ +		if (!p-&gt;need_resend) continue;
│ │ │ │ +		if (!resend_packet(p))
│ │ │ │  		{
│ │ │ │ -			if (!(file_flags(i) &amp; file_storage::flag_symlink)) continue;
│ │ │ │ -
│ │ │ │ -			if (!file_map_initialized)
│ │ │ │ -			{
│ │ │ │ -				for (auto const j : file_range())
│ │ │ │ -					file_map.insert({internal_file_path(j), j});
│ │ │ │ -				file_map_initialized = true;
│ │ │ │ -			}
│ │ │ │ +			// we couldn't resend the packet. It probably doesn't
│ │ │ │ +			// fit in our cwnd. If force is set, we need to continue
│ │ │ │ +			// to send our packet anyway, if we don't have force set,
│ │ │ │ +			// we might as well return
│ │ │ │ +			if (!force) return false;
│ │ │ │ +			// resend_packet might have failed
│ │ │ │ +			if (state() == state_t::error_wait || state() == state_t::deleting) return false;
│ │ │ │ +			if (m_stalled) return false;
│ │ │ │ +			break;
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -			aux::file_entry const&amp; fe = m_files[i];
│ │ │ │ -			TORRENT_ASSERT(fe.symlink_index &lt; int(m_symlinks.size()));
│ │ │ │ +		// don't fast-resend this packet
│ │ │ │ +		if (m_fast_resend_seq_nr == i)
│ │ │ │ +			m_fast_resend_seq_nr = (m_fast_resend_seq_nr + 1) &amp; ACK_MASK;
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -			// symlink targets are only allowed to point to files or directories in
│ │ │ │ -			// this torrent.
│ │ │ │ -			{
│ │ │ │ -				std::string target = m_symlinks[fe.symlink_index];
│ │ │ │ +	// MTU DISCOVERY
│ │ │ │  
│ │ │ │ -				if (is_complete(target))
│ │ │ │ -				{
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(233)">../src/utp_socket_manager.cpp:204</a></td><td>this should not be heap allocated, sockets should be movable</td></tr><tr id="233" style="display: none;" colspan="3"><td colspan="3"><h2>this should not be heap allocated, sockets should be movable</h2><h4>../src/utp_socket_manager.cpp:204</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +	// under these conditions, the next packet we send should be an MTU probe.
│ │ │ │ +	// MTU probes get to use the mid-point packet size, whereas other packets
│ │ │ │ +	// use a conservative packet size of the largest known to work. The reason
│ │ │ │ +	// for the cwnd condition is to make sure the probe is surrounded by non-
│ │ │ │ +	// probes, to be able to distinguish a loss of the probe vs. just loss in
│ │ │ │ +	// general.
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(208)">../src/utp_socket_manager.cpp:204</a></td><td>this should not be heap allocated, sockets should be movable</td></tr><tr id="208" style="display: none;" colspan="3"><td colspan="3"><h2>this should not be heap allocated, sockets should be movable</h2><h4>../src/utp_socket_manager.cpp:204</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  //		UTP_LOGV("incoming packet id:%d source:%s\n", id, print_endpoint(ep).c_str());
│ │ │ │  
│ │ │ │  		if (!m_sett.get_bool(settings_pack::enable_incoming_utp))
│ │ │ │  			return false;
│ │ │ │  
│ │ │ │  		// if not found, see if it's a SYN packet, if it is,
│ │ │ │  		// create a new utp_stream
│ │ │ │ @@ -9562,194 +8331,245 @@
│ │ │ │  
│ │ │ │  		// #error send reset
│ │ │ │  
│ │ │ │  		return false;
│ │ │ │  	}
│ │ │ │  
│ │ │ │  	void utp_socket_manager::subscribe_writable(utp_socket_impl* s)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(234)">../src/mmap_disk_io.cpp:578</a></td><td>in the future, propagate exceptions back to the handlers</td></tr><tr id="234" style="display: none;" colspan="3"><td colspan="3"><h2>in the future, propagate exceptions back to the handlers</h2><h4>../src/mmap_disk_io.cpp:578</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#if DEBUG_DISK_THREAD
│ │ │ │ -		{
│ │ │ │ -			std::unique_lock&lt;std::mutex&gt; l(m_job_mutex);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(209)">../src/performance_counters.cpp:40</a></td><td>move stats_counter_t out of counters</td></tr><tr id="209" style="display: none;" colspan="3"><td colspan="3"><h2>move stats_counter_t out of counters</h2><h4>../src/performance_counters.cpp:40</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(210)">../src/performance_counters.cpp:41</a></td><td>should bittorrent keep-alive messages have a counter too?</td></tr><tr id="210" style="display: none;" colspan="3"><td colspan="3"><h2>should bittorrent keep-alive messages have a counter too?</h2><h4>../src/performance_counters.cpp:41</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(211)">../src/performance_counters.cpp:42</a></td><td>It would be nice if this could be an internal type. default_disk_constructor depends on it now</td></tr><tr id="211" style="display: none;" colspan="3"><td colspan="3"><h2>It would be nice if this could be an internal type. default_disk_constructor depends on it now</h2><h4>../src/performance_counters.cpp:42</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
│ │ │ │ +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
│ │ │ │ +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
│ │ │ │ +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
│ │ │ │ +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
│ │ │ │ +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
│ │ │ │ +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
│ │ │ │ +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
│ │ │ │ +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
│ │ │ │ +POSSIBILITY OF SUCH DAMAGE.
│ │ │ │  
│ │ │ │ -			DLOG("perform_job job: %s ( %s%s) piece: %d offset: %d outstanding: %d\n"
│ │ │ │ -				, job_action_name[j-&gt;action]
│ │ │ │ -				, (j-&gt;flags &amp; mmap_disk_job::fence) ? "fence ": ""
│ │ │ │ -				, (j-&gt;flags &amp; mmap_disk_job::force_copy) ? "force_copy ": ""
│ │ │ │ -				, static_cast&lt;int&gt;(j-&gt;piece), j-&gt;d.io.offset
│ │ │ │ -				, j-&gt;storage ? j-&gt;storage-&gt;num_outstanding_jobs() : -1);
│ │ │ │ -		}
│ │ │ │ +*/
│ │ │ │ +
│ │ │ │ +#include "libtorrent/performance_counters.hpp"
│ │ │ │ +#include "libtorrent/assert.hpp"
│ │ │ │ +#include &lt;cstring&gt; // for memset
│ │ │ │ +
│ │ │ │ +namespace libtorrent {
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	counters::counters() TORRENT_COUNTER_NOEXCEPT
│ │ │ │ +</div>	{
│ │ │ │ +#ifdef ATOMIC_LLONG_LOCK_FREE
│ │ │ │ +		for (auto&amp; counter : m_stats_counter)
│ │ │ │ +			counter.store(0, std::memory_order_relaxed);
│ │ │ │ +#else
│ │ │ │ +		m_stats_counter.fill(0);
│ │ │ │  #endif
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -		std::shared_ptr&lt;mmap_storage&gt; storage = j-&gt;storage;
│ │ │ │ +	counters::counters(counters const&amp; c) TORRENT_COUNTER_NOEXCEPT
│ │ │ │ +	{
│ │ │ │ +#ifdef ATOMIC_LLONG_LOCK_FREE
│ │ │ │ +		for (int i = 0; i &lt; m_stats_counter.end_index(); ++i)
│ │ │ │ +			m_stats_counter[i].store(
│ │ │ │ +				c.m_stats_counter[i].load(std::memory_order_relaxed)
│ │ │ │ +					, std::memory_order_relaxed);
│ │ │ │ +#else
│ │ │ │ +		std::lock_guard&lt;std::mutex&gt; l(c.m_mutex);
│ │ │ │ +		m_stats_counter = c.m_stats_counter;
│ │ │ │ +#endif
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -		TORRENT_ASSERT(static_cast&lt;int&gt;(j-&gt;action) &lt; int(job_functions.size()));
│ │ │ │ +	counters&amp; counters::operator=(counters const&amp; c) &amp; TORRENT_COUNTER_NOEXCEPT
│ │ │ │ +	{
│ │ │ │ +		if (&amp;c == this) return *this;
│ │ │ │ +#ifdef ATOMIC_LLONG_LOCK_FREE
│ │ │ │ +		for (int i = 0; i &lt; m_stats_counter.end_index(); ++i)
│ │ │ │ +			m_stats_counter[i].store(
│ │ │ │ +				c.m_stats_counter[i].load(std::memory_order_relaxed)
│ │ │ │ +					, std::memory_order_relaxed);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(212)">../src/hash_picker.cpp:309</a></td><td>use structured bindings in C++17</td></tr><tr id="212" style="display: none;" colspan="3"><td colspan="3"><h2>use structured bindings in C++17</h2><h4>../src/hash_picker.cpp:309</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		, int const offset, sha256_hash const&amp; h)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(offset &gt;= 0);
│ │ │ │ +		auto const f = m_files.file_index_at_piece(piece);
│ │ │ │  
│ │ │ │ -		m_stats_counters.inc_stats_counter(counters::num_running_disk_jobs, 1);
│ │ │ │ +		if (m_files.pad_file_at(f))
│ │ │ │ +			return { set_block_hash_result::result::success, 0, 0 };
│ │ │ │  
│ │ │ │ -		// call disk function
│ │ │ │ -<div style="background: #ffff00" width="100%">		status_t ret = status_t::no_error;
│ │ │ │ -</div>		try
│ │ │ │ -		{
│ │ │ │ -			int const idx = static_cast&lt;int&gt;(j-&gt;action);
│ │ │ │ -			ret = (this-&gt;*(job_functions[static_cast&lt;std::size_t&gt;(idx)]))(j);
│ │ │ │ -		}
│ │ │ │ -		catch (boost::system::system_error const&amp; err)
│ │ │ │ -		{
│ │ │ │ -			ret = status_t::fatal_disk_error;
│ │ │ │ -			j-&gt;error.ec = err.code();
│ │ │ │ -			j-&gt;error.operation = operation_t::exception;
│ │ │ │ -		}
│ │ │ │ -		catch (std::bad_alloc const&amp;)
│ │ │ │ -		{
│ │ │ │ -			ret = status_t::fatal_disk_error;
│ │ │ │ -			j-&gt;error.ec = errors::no_memory;
│ │ │ │ -			j-&gt;error.operation = operation_t::exception;
│ │ │ │ -		}
│ │ │ │ -		catch (std::exception const&amp;)
│ │ │ │ +		auto&amp; merkle_tree = m_merkle_trees[f];
│ │ │ │ +		piece_index_t const file_first_piece = m_files.piece_index_at_file(f);
│ │ │ │ +		std::int64_t const block_offset = static_cast&lt;int&gt;(piece) * std::int64_t(m_files.piece_length())
│ │ │ │ +			+ offset - m_files.file_offset(f);
│ │ │ │ +		int const block_index = aux::numeric_cast&lt;int&gt;(block_offset / default_block_size);
│ │ │ │ +
│ │ │ │ +		if (h.is_all_zeros())
│ │ │ │  		{
│ │ │ │ -			ret = status_t::fatal_disk_error;
│ │ │ │ -			j-&gt;error.ec = boost::asio::error::fault;
│ │ │ │ -			j-&gt;error.operation = operation_t::exception;
│ │ │ │ +			TORRENT_ASSERT_FAIL();
│ │ │ │ +			return set_block_hash_result::block_hash_failed();
│ │ │ │  		}
│ │ │ │  
│ │ │ │ -		// note that -2 errors are OK
│ │ │ │ -		TORRENT_ASSERT(ret != status_t::fatal_disk_error
│ │ │ │ -			|| (j-&gt;error.ec &amp;&amp; j-&gt;error.operation != operation_t::unknown));
│ │ │ │ +<div style="background: #ffff00" width="100%">		aux::merkle_tree::set_block_result result;
│ │ │ │ +</div>		int leafs_index;
│ │ │ │ +		int leafs_size;
│ │ │ │ +		std::tie(result, leafs_index, leafs_size) = merkle_tree.set_block(block_index, h);
│ │ │ │  
│ │ │ │ -		m_stats_counters.inc_stats_counter(counters::num_running_disk_jobs, -1);
│ │ │ │ +		if (result == aux::merkle_tree::set_block_result::unknown)
│ │ │ │ +			return set_block_hash_result::unknown();
│ │ │ │ +		if (result == aux::merkle_tree::set_block_result::block_hash_failed)
│ │ │ │ +			return set_block_hash_result::block_hash_failed();
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(235)">../src/mmap_disk_io.cpp:1017</a></td><td>this is potentially very expensive. One way to solve it would be to have a fence for just this one piece. but it hardly seems worth the complexity and cost just for the edge case of receiving a corrupt piece</td></tr><tr id="235" style="display: none;" colspan="3"><td colspan="3"><h2>this is potentially very expensive. One way to solve
│ │ │ │ -it would be to have a fence for just this one piece.
│ │ │ │ -but it hardly seems worth the complexity and cost just for the edge
│ │ │ │ -case of receiving a corrupt piece</h2><h4>../src/mmap_disk_io.cpp:1017</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::file_priority);
│ │ │ │ -		j-&gt;storage = m_torrents[storage]-&gt;shared_from_this();
│ │ │ │ -		j-&gt;argument = std::move(prios);
│ │ │ │ -		j-&gt;callback = std::move(handler);
│ │ │ │ +		auto const status = (result == aux::merkle_tree::set_block_result::hash_failed)
│ │ │ │ +			? set_block_hash_result::result::piece_hash_failed
│ │ │ │ +			: set_block_hash_result::result::success;
│ │ │ │  
│ │ │ │ -		add_fence_job(j);
│ │ │ │ +		int const blocks_per_piece = m_files.piece_length() / default_block_size;
│ │ │ │ +
│ │ │ │ +		return { status
│ │ │ │ +			, int(leafs_index - static_cast&lt;int&gt;(piece - file_first_piece) * blocks_per_piece)
│ │ │ │ +			, std::min(leafs_size, m_files.file_num_pieces(f) * blocks_per_piece - leafs_index) };
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	void mmap_disk_io::async_clear_piece(storage_index_t const storage
│ │ │ │ -		, piece_index_t const index, std::function&lt;void(piece_index_t)&gt; handler)
│ │ │ │ +	void hash_picker::hashes_rejected(hash_request const&amp; req)
│ │ │ │  	{
│ │ │ │ -		aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::clear_piece);
│ │ │ │ -		j-&gt;storage = m_torrents[storage]-&gt;shared_from_this();
│ │ │ │ -		j-&gt;piece = index;
│ │ │ │ -		j-&gt;callback = std::move(handler);
│ │ │ │ +		TORRENT_ASSERT(req.base == m_piece_layer &amp;&amp; req.index % 512 == 0);
│ │ │ │  
│ │ │ │ -		// regular jobs are not guaranteed to be executed in-order
│ │ │ │ -		// since clear piece must guarantee that all write jobs that
│ │ │ │ -		// have been issued finish before the clear piece job completes
│ │ │ │ +		for (int i = req.index; i &lt; req.index + req.count; i += 512)
│ │ │ │ +		{
│ │ │ │ +			m_piece_hash_requested[req.file][i / 512].last_request = min_time();
│ │ │ │ +			--m_piece_hash_requested[req.file][i / 512].num_requests;
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(236)">../src/mmap_disk_io.cpp:1022</a></td><td>Perhaps the job queue could be traversed and all jobs for this piece could be cancelled. If there are no threads currently writing to this piece, we could skip the fence altogether</td></tr><tr id="236" style="display: none;" colspan="3"><td colspan="3"><h2>Perhaps the job queue could be traversed and all jobs for this
│ │ │ │ -piece could be cancelled. If there are no threads currently writing
│ │ │ │ -to this piece, we could skip the fence altogether</h2><h4>../src/mmap_disk_io.cpp:1022</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		j-&gt;storage = m_torrents[storage]-&gt;shared_from_this();
│ │ │ │ -		j-&gt;argument = std::move(prios);
│ │ │ │ -		j-&gt;callback = std::move(handler);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(213)">../src/pe_crypto.cpp:60</a></td><td>it would be nice to get the literal working</td></tr><tr id="213" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to get the literal working</h2><h4>../src/pe_crypto.cpp:60</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include &lt;algorithm&gt;
│ │ │ │ +#include &lt;random&gt;
│ │ │ │  
│ │ │ │ -		add_fence_job(j);
│ │ │ │ -	}
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_push.hpp"
│ │ │ │  
│ │ │ │ -	void mmap_disk_io::async_clear_piece(storage_index_t const storage
│ │ │ │ -		, piece_index_t const index, std::function&lt;void(piece_index_t)&gt; handler)
│ │ │ │ -	{
│ │ │ │ -		aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::clear_piece);
│ │ │ │ -		j-&gt;storage = m_torrents[storage]-&gt;shared_from_this();
│ │ │ │ -		j-&gt;piece = index;
│ │ │ │ -		j-&gt;callback = std::move(handler);
│ │ │ │ +#include &lt;boost/multiprecision/integer.hpp&gt;
│ │ │ │ +#include &lt;boost/multiprecision/cpp_int.hpp&gt;
│ │ │ │  
│ │ │ │ -		// regular jobs are not guaranteed to be executed in-order
│ │ │ │ -		// since clear piece must guarantee that all write jobs that
│ │ │ │ -		// have been issued finish before the clear piece job completes
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │  
│ │ │ │ +#include "libtorrent/random.hpp"
│ │ │ │ +#include "libtorrent/aux_/alloca.hpp"
│ │ │ │ +#include "libtorrent/pe_crypto.hpp"
│ │ │ │ +#include "libtorrent/hasher.hpp"
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">		add_fence_job(j);
│ │ │ │ -</div>	}
│ │ │ │ +namespace libtorrent {
│ │ │ │  
│ │ │ │ -	status_t mmap_disk_io::do_hash(aux::mmap_disk_job* j)
│ │ │ │ +	namespace mp = boost::multiprecision;
│ │ │ │ +
│ │ │ │ +	namespace {
│ │ │ │ +<div style="background: #ffff00" width="100%">		key_t const dh_prime
│ │ │ │ +</div>			("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A36210000000000090563");
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	std::array&lt;char, 96&gt; export_key(key_t const&amp; k)
│ │ │ │  	{
│ │ │ │ -		// we're not using a cache. This is the simple path
│ │ │ │ -		// just read straight from the file
│ │ │ │ -		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ +		std::array&lt;char, 96&gt; ret;
│ │ │ │ +		auto* begin = reinterpret_cast&lt;std::uint8_t*&gt;(ret.data());
│ │ │ │ +		std::uint8_t* end = mp::export_bits(k, begin, 8);
│ │ │ │  
│ │ │ │ -		bool const v1 = bool(j-&gt;flags &amp; disk_interface::v1_hash);
│ │ │ │ -		bool const v2 = !j-&gt;d.h.block_hashes.empty();
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(214)">../src/pe_crypto.cpp:71</a></td><td>it would be nice to be able to export to a fixed width field, so we wouldn't have to shift it later</td></tr><tr id="214" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to be able to export to a fixed width field, so
│ │ │ │ +we wouldn't have to shift it later</h2><h4>../src/pe_crypto.cpp:71</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#include "libtorrent/random.hpp"
│ │ │ │ +#include "libtorrent/aux_/alloca.hpp"
│ │ │ │ +#include "libtorrent/pe_crypto.hpp"
│ │ │ │ +#include "libtorrent/hasher.hpp"
│ │ │ │  
│ │ │ │ -		int const piece_size = v1 ? j-&gt;storage-&gt;files().piece_size(j-&gt;piece) : 0;
│ │ │ │ -		int const piece_size2 = v2 ? j-&gt;storage-&gt;files().piece_size2(j-&gt;piece) : 0;
│ │ │ │ -		int const blocks_in_piece = v1 ? (piece_size + default_block_size - 1) / default_block_size : 0;
│ │ │ │ -		int const blocks_in_piece2 = v2 ? j-&gt;storage-&gt;files().blocks_in_piece2(j-&gt;piece) : 0;
│ │ │ │ -		aux::open_mode_t const file_mode = file_mode_for_job(j);
│ │ │ │ +namespace libtorrent {
│ │ │ │  
│ │ │ │ -		TORRENT_ASSERT(!v2 || int(j-&gt;d.h.block_hashes.size()) &gt;= blocks_in_piece2);
│ │ │ │ -		TORRENT_ASSERT(v1 || v2);
│ │ │ │ +	namespace mp = boost::multiprecision;
│ │ │ │  
│ │ │ │ -		hasher h;
│ │ │ │ -		int ret = 0;
│ │ │ │ -		int offset = 0;
│ │ │ │ -		int const blocks_to_read = std::max(blocks_in_piece, blocks_in_piece2);
│ │ │ │ -		time_point const start_time = clock_type::now();
│ │ │ │ -		for (int i = 0; i &lt; blocks_to_read; ++i)
│ │ │ │ -		{
│ │ │ │ -			bool const v2_block = i &lt; blocks_in_piece2;
│ │ │ │ +	namespace {
│ │ │ │ +		key_t const dh_prime
│ │ │ │ +			("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A36210000000000090563");
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -			DLOG("do_hash: reading (piece: %d block: %d)\n", int(j-&gt;piece), i);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(237)">../src/web_connection_base.cpp:72</a></td><td>introduce a web-seed default class which has a low download priority</td></tr><tr id="237" style="display: none;" colspan="3"><td colspan="3"><h2>introduce a web-seed default class which has a low download priority</h2><h4>../src/web_connection_base.cpp:72</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		: peer_connection(pack)
│ │ │ │ -		, m_first_request(true)
│ │ │ │ -		, m_ssl(false)
│ │ │ │ -		, m_external_auth(web.auth)
│ │ │ │ -		, m_extra_headers(web.extra_headers)
│ │ │ │ -		, m_parser(http_parser::dont_parse_chunks)
│ │ │ │ -		, m_body_start(0)
│ │ │ │ +	std::array&lt;char, 96&gt; export_key(key_t const&amp; k)
│ │ │ │  	{
│ │ │ │ -		TORRENT_ASSERT(&amp;web.peer_info == pack.peerinfo);
│ │ │ │ -		// when going through a proxy, we don't necessarily have an endpoint here,
│ │ │ │ -		// since the proxy might be resolving the hostname, not us
│ │ │ │ -		TORRENT_ASSERT(web.endpoints.empty() || web.endpoints.front() == pack.endp);
│ │ │ │ -
│ │ │ │ -		INVARIANT_CHECK;
│ │ │ │ +		std::array&lt;char, 96&gt; ret;
│ │ │ │ +		auto* begin = reinterpret_cast&lt;std::uint8_t*&gt;(ret.data());
│ │ │ │ +		std::uint8_t* end = mp::export_bits(k, begin, 8);
│ │ │ │  
│ │ │ │ -		TORRENT_ASSERT(is_outgoing());
│ │ │ │ +<div style="background: #ffff00" width="100%">		if (end &lt; begin + 96)
│ │ │ │ +</div>		{
│ │ │ │ +			int const len = int(end - begin);
│ │ │ │ +#if defined __GNUC__ &amp;&amp; __GNUC__ == 12
│ │ │ │ +#pragma GCC diagnostic push
│ │ │ │ +#pragma GCC diagnostic ignored "-Wstringop-overflow"
│ │ │ │ +#endif
│ │ │ │ +			std::memmove(begin + 96 - len, begin, aux::numeric_cast&lt;std::size_t&gt;(len));
│ │ │ │ +#if defined __GNUC__ &amp;&amp; __GNUC__ == 12
│ │ │ │ +#pragma GCC diagnostic pop
│ │ │ │ +#endif
│ │ │ │ +			std::memset(begin, 0, aux::numeric_cast&lt;std::size_t&gt;(96 - len));
│ │ │ │ +		}
│ │ │ │ +		return ret;
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -		TORRENT_ASSERT(!m_torrent.lock()-&gt;is_upload_only());
│ │ │ │ +	void rc4_init(const unsigned char* in, std::size_t len, rc4 *state);
│ │ │ │ +	std::size_t rc4_encrypt(unsigned char *out, std::size_t outlen, rc4 *state);
│ │ │ │  
│ │ │ │ -		// we only want left-over bandwidth
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>		std::string protocol;
│ │ │ │ -		error_code ec;
│ │ │ │ -		std::tie(protocol, m_basic_auth, m_host, m_port, m_path)
│ │ │ │ -			= parse_url_components(web.url, ec);
│ │ │ │ -		TORRENT_ASSERT(!ec);
│ │ │ │ +	// Set the prime P and the generator, generate local public key
│ │ │ │ +	dh_key_exchange::dh_key_exchange()
│ │ │ │ +	{
│ │ │ │ +		aux::array&lt;std::uint8_t, 96&gt; random_key;
│ │ │ │ +		aux::random_bytes({reinterpret_cast&lt;char*&gt;(random_key.data())
│ │ │ │ +			, static_cast&lt;std::ptrdiff_t&gt;(random_key.size())});
│ │ │ │  
│ │ │ │ -		if (m_port == -1 &amp;&amp; protocol == "http")
│ │ │ │ -			m_port = 80;
│ │ │ │ +		// create local key (random)
│ │ │ │ +		mp::import_bits(m_dh_local_secret, random_key.begin(), random_key.end());
│ │ │ │  
│ │ │ │ -#if TORRENT_USE_SSL
│ │ │ │ -		if (protocol == "https")
│ │ │ │ -		{
│ │ │ │ -			m_ssl = true;
│ │ │ │ -			if (m_port == -1) m_port = 443;
│ │ │ │ +		// key = (2 ^ secret) % prime
│ │ │ │ +		m_dh_local_key = mp::powm(key_t(2), m_dh_local_secret, dh_prime);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(215)">../src/load_torrent.cpp:121</a></td><td>move the loading logic from torrent_info constructor into here</td></tr><tr id="215" style="display: none;" colspan="3"><td colspan="3"><h2>move the loading logic from torrent_info constructor into here</h2><h4>../src/load_torrent.cpp:121</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				mask.resize(std::size_t(full_size), false);
│ │ │ │ +				for (int i = merkle_first_leaf(piece_layer_size)
│ │ │ │ +					, end = i + num_pieces; i &lt; end; ++i)
│ │ │ │ +				{
│ │ │ │ +					mask[std::size_t(i)] = true;
│ │ │ │ +				}
│ │ │ │ +			}
│ │ │ │ +			ti-&gt;free_piece_layers();
│ │ │ │  		}
│ │ │ │ -#endif
│ │ │ │ +		atp.info_hashes = atp.ti-&gt;info_hashes();
│ │ │ │ +	}
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -		if (!m_basic_auth.empty())
│ │ │ │ -			m_basic_auth = base64encode(m_basic_auth);
│ │ │ │ +	add_torrent_params load_torrent_file(std::string const&amp; filename)
│ │ │ │ +	{ return load_torrent_file(filename, load_torrent_limits{}); }
│ │ │ │ +	add_torrent_params load_torrent_buffer(span&lt;char const&gt; buffer)
│ │ │ │ +	{ return load_torrent_buffer(buffer, load_torrent_limits{}); }
│ │ │ │ +	add_torrent_params load_torrent_parsed(bdecode_node const&amp; torrent_file)
│ │ │ │ +	{ return load_torrent_parsed(torrent_file, load_torrent_limits{}); }
│ │ │ │  
│ │ │ │ -		m_server_string = m_host;
│ │ │ │ -		aux::verify_encoding(m_server_string);
│ │ │ │ +<div style="background: #ffff00" width="100%">	add_torrent_params load_torrent_file(std::string const&amp; filename, load_torrent_limits const&amp; cfg)
│ │ │ │ +</div>	{
│ │ │ │ +		add_torrent_params ret;
│ │ │ │ +		ret.ti = std::make_shared&lt;torrent_info&gt;(filename, cfg);
│ │ │ │ +		update_atp(ret);
│ │ │ │ +		return ret;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	int web_connection_base::timeout() const
│ │ │ │ +	add_torrent_params load_torrent_buffer(span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg)
│ │ │ │  	{
│ │ │ │ -		// since this is a web seed, change the timeout
│ │ │ │ -		// according to the settings.
│ │ │ │ -		return m_settings.get_int(settings_pack::urlseed_timeout);
│ │ │ │ +		add_torrent_params ret;
│ │ │ │ +		ret.ti = std::make_shared&lt;torrent_info&gt;(buffer, cfg, from_span);
│ │ │ │ +		update_atp(ret);
│ │ │ │ +		return ret;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	add_torrent_params load_torrent_parsed(bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg)
│ │ │ │ +	{
│ │ │ │ +		add_torrent_params ret;
│ │ │ │ +		ret.ti = std::make_shared&lt;torrent_info&gt;(torrent_file, cfg);
│ │ │ │ +		update_atp(ret);
│ │ │ │ +		return ret;
│ │ │ │  	}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(238)">../src/torrent_info.cpp:887</a></td><td>this should be considered a failure, and the .torrent file rejected</td></tr><tr id="238" style="display: none;" colspan="3"><td colspan="3"><h2>this should be considered a failure, and the .torrent file
│ │ │ │ +
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(216)">../src/torrent_info.cpp:887</a></td><td>this should be considered a failure, and the .torrent file rejected</td></tr><tr id="216" style="display: none;" colspan="3"><td colspan="3"><h2>this should be considered a failure, and the .torrent file
│ │ │ │  rejected</h2><h4>../src/torrent_info.cpp:887</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			std::string ext = extension(filename);
│ │ │ │  			int cnt = 0;
│ │ │ │  			for (;;)
│ │ │ │  			{
│ │ │ │  				++cnt;
│ │ │ │  				char new_ext[50];
│ │ │ │  				std::snprintf(new_ext, sizeof(new_ext), ".%d%s", cnt, ext.c_str());
│ │ │ │ @@ -9793,120 +8613,1300 @@
│ │ │ │  #if TORRENT_ABI_VERSION == 1
│ │ │ │  	// standard constructor that parses a torrent file
│ │ │ │  	torrent_info::torrent_info(entry const&amp; torrent_file)
│ │ │ │  	{
│ │ │ │  		std::vector&lt;char&gt; tmp;
│ │ │ │  		std::back_insert_iterator&lt;std::vector&lt;char&gt;&gt; out(tmp);
│ │ │ │  		bencode(out, torrent_file);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(239)">../src/load_torrent.cpp:121</a></td><td>move the loading logic from torrent_info constructor into here</td></tr><tr id="239" style="display: none;" colspan="3"><td colspan="3"><h2>move the loading logic from torrent_info constructor into here</h2><h4>../src/load_torrent.cpp:121</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				mask.resize(std::size_t(full_size), false);
│ │ │ │ -				for (int i = merkle_first_leaf(piece_layer_size)
│ │ │ │ -					, end = i + num_pieces; i &lt; end; ++i)
│ │ │ │ -				{
│ │ │ │ -					mask[std::size_t(i)] = true;
│ │ │ │ -				}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(217)">../src/session_handle.cpp:499</a></td><td>in C++14, use unique_ptr and move it into the lambda</td></tr><tr id="217" style="display: none;" colspan="3"><td colspan="3"><h2>in C++14, use unique_ptr and move it into the lambda</h2><h4>../src/session_handle.cpp:499</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ +		if (params.save_path.empty())
│ │ │ │ +			aux::throw_ex&lt;system_error&gt;(error_code(errors::invalid_save_path));
│ │ │ │ +#else
│ │ │ │ +		TORRENT_ASSERT_PRECOND(!params.save_path.empty());
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION &lt; 3
│ │ │ │ +		if (!params.info_hashes.has_v1() &amp;&amp; !params.info_hashes.has_v2() &amp;&amp; !params.ti)
│ │ │ │ +			params.info_hashes.v1 = params.info_hash;
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		// the internal torrent object keeps and mutates state in the
│ │ │ │ +		// torrent_info object. We can't let that leak back to the client
│ │ │ │ +		if (params.ti)
│ │ │ │ +			params.ti = std::make_shared&lt;torrent_info&gt;(*params.ti);
│ │ │ │ +
│ │ │ │ +		// we cannot capture a unique_ptr into a lambda in c++11, so we use a raw
│ │ │ │ +		// pointer for now. async_call uses a lambda expression to post the call
│ │ │ │ +		// to the main thread
│ │ │ │ +<div style="background: #ffff00" width="100%">		auto* p = new add_torrent_params(std::move(params));
│ │ │ │ +</div>		auto guard = aux::scope_end([p]{ delete p; });
│ │ │ │ +		p-&gt;save_path = complete(p-&gt;save_path);
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │ +		handle_backwards_compatible_resume_data(*p);
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		async_call(&amp;session_impl::async_add_torrent, p);
│ │ │ │ +		guard.disarm();
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │ +	// if the torrent already exists, this will throw duplicate_torrent
│ │ │ │ +	torrent_handle session_handle::add_torrent(
│ │ │ │ +		torrent_info const&amp; ti
│ │ │ │ +		, std::string const&amp; save_path
│ │ │ │ +		, entry const&amp; resume_data
│ │ │ │ +		, storage_mode_t storage_mode
│ │ │ │ +		, bool const add_paused)
│ │ │ │ +	{
│ │ │ │ +		add_torrent_params p;
│ │ │ │ +		p.ti = std::make_shared&lt;torrent_info&gt;(ti);
│ │ │ │ +		p.save_path = save_path;
│ │ │ │ +		if (resume_data.type() != entry::undefined_t)
│ │ │ │ +		{
│ │ │ │ +			bencode(std::back_inserter(p.resume_data), resume_data);
│ │ │ │ +		}
│ │ │ │ +		p.storage_mode = storage_mode;
│ │ │ │ +		if (add_paused) p.flags |= add_torrent_params::flag_paused;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(218)">../src/udp_tracker_connection.cpp:633</a></td><td>why is this a linked list?</td></tr><tr id="218" style="display: none;" colspan="3"><td colspan="3"><h2>why is this a linked list?</h2><h4>../src/udp_tracker_connection.cpp:633</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				ipv6_peer_entry e{};
│ │ │ │ +				std::memcpy(e.ip.data(), buf.data(), 16);
│ │ │ │ +				buf = buf.subspan(16);
│ │ │ │ +				e.port = aux::read_uint16(buf);
│ │ │ │ +				resp.peers6.push_back(e);
│ │ │ │  			}
│ │ │ │ -			ti-&gt;free_piece_layers();
│ │ │ │  		}
│ │ │ │ -		atp.info_hashes = atp.ti-&gt;info_hashes();
│ │ │ │ +		else
│ │ │ │ +		{
│ │ │ │ +			resp.peers4.reserve(static_cast&lt;std::size_t&gt;(num_peers));
│ │ │ │ +			for (int i = 0; i &lt; num_peers; ++i)
│ │ │ │ +			{
│ │ │ │ +				ipv4_peer_entry e{};
│ │ │ │ +				std::memcpy(e.ip.data(), buf.data(), 4);
│ │ │ │ +				buf = buf.subspan(4);
│ │ │ │ +				e.port = aux::read_uint16(buf);
│ │ │ │ +				resp.peers4.push_back(e);
│ │ │ │ +			}
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		std::list&lt;address&gt; ip_list;
│ │ │ │ +</div>		std::transform(m_endpoints.begin(), m_endpoints.end(), std::back_inserter(ip_list)
│ │ │ │ +			, [](tcp::endpoint const&amp; ep) { return ep.address(); } );
│ │ │ │ +
│ │ │ │ +		cb-&gt;tracker_response(tracker_req(), m_target.address(), ip_list, resp);
│ │ │ │ +
│ │ │ │ +		close();
│ │ │ │ +		return true;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	bool udp_tracker_connection::on_scrape_response(span&lt;char const&gt; buf)
│ │ │ │ +	{
│ │ │ │ +		restart_read_timeout();
│ │ │ │ +		auto const action = static_cast&lt;action_t&gt;(aux::read_int32(buf));
│ │ │ │ +		std::uint32_t const transaction = aux::read_uint32(buf);
│ │ │ │ +
│ │ │ │ +		if (transaction != m_transaction_id)
│ │ │ │ +		{
│ │ │ │ +			fail(error_code(errors::invalid_tracker_transaction_id), operation_t::bittorrent);
│ │ │ │ +			return false;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		if (action == action_t::error)
│ │ │ │ +		{
│ │ │ │ +			fail(error_code(errors::tracker_failure), operation_t::bittorrent
│ │ │ │ +				, std::string(buf.data(), static_cast&lt;std::size_t&gt;(buf.size())).c_str());
│ │ │ │ +			return true;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		if (action != action_t::scrape)
│ │ │ │ +		{
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(219)">../src/piece_picker.cpp:121</a></td><td>find a better place for this</td></tr><tr id="219" style="display: none;" colspan="3"><td colspan="3"><h2>find a better place for this</h2><h4>../src/piece_picker.cpp:121</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			if (limit == 0)
│ │ │ │ +			{
│ │ │ │ +				std::cerr &lt;&lt; " ...";
│ │ │ │ +				break;
│ │ │ │ +			}
│ │ │ │ +			if (*i == -1) break;
│ │ │ │ +			while (j != p.m_priority_boundaries.end() &amp;&amp; *j &lt;= index)
│ │ │ │ +			{
│ │ │ │ +				std::cerr &lt;&lt; "| ";
│ │ │ │ +				++j;
│ │ │ │ +			}
│ │ │ │ +			std::cerr &lt;&lt; *i &lt;&lt; "(" &lt;&lt; p.m_piece_map[*i].index &lt;&lt; ") ";
│ │ │ │ +			--limit;
│ │ │ │ +		}
│ │ │ │ +		std::cerr &lt;&lt; std::endl;
│ │ │ │  	}
│ │ │ │  }
│ │ │ │ +#endif // TORRENT_PICKER_LOG
│ │ │ │ +namespace libtorrent {
│ │ │ │  
│ │ │ │ -	add_torrent_params load_torrent_file(std::string const&amp; filename)
│ │ │ │ -	{ return load_torrent_file(filename, load_torrent_limits{}); }
│ │ │ │ -	add_torrent_params load_torrent_buffer(span&lt;char const&gt; buffer)
│ │ │ │ -	{ return load_torrent_buffer(buffer, load_torrent_limits{}); }
│ │ │ │ -	add_torrent_params load_torrent_parsed(bdecode_node const&amp; torrent_file)
│ │ │ │ -	{ return load_torrent_parsed(torrent_file, load_torrent_limits{}); }
│ │ │ │ +<div style="background: #ffff00" width="100%">	const piece_block piece_block::invalid(
│ │ │ │ +</div>		std::numeric_limits&lt;piece_index_t&gt;::max()
│ │ │ │ +		, std::numeric_limits&lt;int&gt;::max());
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">	add_torrent_params load_torrent_file(std::string const&amp; filename, load_torrent_limits const&amp; cfg)
│ │ │ │ -</div>	{
│ │ │ │ -		add_torrent_params ret;
│ │ │ │ -		ret.ti = std::make_shared&lt;torrent_info&gt;(filename, cfg);
│ │ │ │ -		update_atp(ret);
│ │ │ │ +	constexpr prio_index_t piece_picker::piece_pos::we_have_index;
│ │ │ │ +
│ │ │ │ +	constexpr picker_options_t piece_picker::rarest_first;
│ │ │ │ +	constexpr picker_options_t piece_picker::reverse;
│ │ │ │ +	constexpr picker_options_t piece_picker::on_parole;
│ │ │ │ +	constexpr picker_options_t piece_picker::prioritize_partials;
│ │ │ │ +	constexpr picker_options_t piece_picker::sequential;
│ │ │ │ +	constexpr picker_options_t piece_picker::align_expanded_pieces;
│ │ │ │ +	constexpr picker_options_t piece_picker::piece_extent_affinity;
│ │ │ │ +
│ │ │ │ +	constexpr download_queue_t piece_picker::piece_pos::piece_downloading;
│ │ │ │ +	constexpr download_queue_t piece_picker::piece_pos::piece_full;
│ │ │ │ +	constexpr download_queue_t piece_picker::piece_pos::piece_finished;
│ │ │ │ +	constexpr download_queue_t piece_picker::piece_pos::piece_zero_prio;
│ │ │ │ +	constexpr download_queue_t piece_picker::piece_pos::num_download_categories;
│ │ │ │ +	constexpr download_queue_t piece_picker::piece_pos::piece_open;
│ │ │ │ +	constexpr download_queue_t piece_picker::piece_pos::piece_downloading_reverse;
│ │ │ │ +	constexpr download_queue_t piece_picker::piece_pos::piece_full_reverse;
│ │ │ │ +
│ │ │ │ +	// the max number of blocks to create an affinity for
│ │ │ │ +	constexpr int max_piece_affinity_extent = 4 * 1024 * 1024 / default_block_size;
│ │ │ │ +
│ │ │ │ +	piece_picker::piece_picker(std::int64_t const total_size, int const piece_size)
│ │ │ │ +		: m_priority_boundaries(1, m_pieces.end_index())
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(total_size &gt; 0);
│ │ │ │ +		TORRENT_ASSERT(piece_size &gt; 0);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(220)">../src/piece_picker.cpp:2067</a></td><td>this could probably be optimized by incrementally calling partial_sort to sort one more element in the list. Because chances are that we'll just need a single piece, and once we've picked from it we're done. Sorting the rest of the list in that case is a waste of time.</td></tr><tr id="220" style="display: none;" colspan="3"><td colspan="3"><h2>this could probably be optimized by incrementally
│ │ │ │ +calling partial_sort to sort one more element in the list. Because
│ │ │ │ +chances are that we'll just need a single piece, and once we've
│ │ │ │ +picked from it we're done. Sorting the rest of the list in that
│ │ │ │ +case is a waste of time.</h2><h4>../src/piece_picker.cpp:2067</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			// now, copy over the pointers. We also apply a filter here to not
│ │ │ │ +			// include ineligible pieces in certain modes. For instance, a piece
│ │ │ │ +			// that the current peer doesn't have is not included.
│ │ │ │ +			for (auto&amp; dp : m_downloads[piece_pos::piece_downloading])
│ │ │ │ +			{
│ │ │ │ +				pc.inc_stats_counter(counters::piece_picker_partial_loops);
│ │ │ │ +
│ │ │ │ +				if (!is_piece_free(dp.index, pieces)) continue;
│ │ │ │ +
│ │ │ │ +				TORRENT_ASSERT(m_piece_map[dp.index].download_queue()
│ │ │ │ +					== piece_pos::piece_downloading);
│ │ │ │ +
│ │ │ │ +				ordered_partials[num_ordered_partials++] = &amp;dp;
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +			// now, sort the list.
│ │ │ │ +			if (options &amp; rarest_first)
│ │ │ │ +			{
│ │ │ │ +				ret |= picker_log_alert::rarest_first_partials;
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">				std::sort(ordered_partials.begin(), ordered_partials.begin() + num_ordered_partials
│ │ │ │ +</div>					, std::bind(&amp;piece_picker::partial_compare_rarest_first, this
│ │ │ │ +						, _1, _2));
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +			for (int i = 0; i &lt; num_ordered_partials; ++i)
│ │ │ │ +			{
│ │ │ │ +				ret |= picker_log_alert::prioritize_partials;
│ │ │ │ +
│ │ │ │ +				num_blocks = add_blocks_downloading(*ordered_partials[i], pieces
│ │ │ │ +					, interesting_blocks, backup_blocks, backup_blocks2
│ │ │ │ +					, num_blocks, prefer_contiguous_blocks, peer, options);
│ │ │ │ +				if (num_blocks &lt;= 0) return ret;
│ │ │ │ +				if (int(backup_blocks.size()) &gt;= num_blocks
│ │ │ │ +					&amp;&amp; int(backup_blocks2.size()) &gt;= num_blocks)
│ │ │ │ +					break;
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +			num_blocks = append_blocks(interesting_blocks, backup_blocks
│ │ │ │ +				, num_blocks);
│ │ │ │ +			if (num_blocks &lt;= 0) return ret;
│ │ │ │ +
│ │ │ │ +			num_blocks = append_blocks(interesting_blocks, backup_blocks2
│ │ │ │ +				, num_blocks);
│ │ │ │ +			if (num_blocks &lt;= 0) return ret;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		if (!suggested_pieces.empty())
│ │ │ │ +		{
│ │ │ │ +			for (piece_index_t i : suggested_pieces)
│ │ │ │ +			{
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(221)">../src/piece_picker.cpp:2211</a></td><td>Is it a good idea that this affinity takes precedence over piece priority?</td></tr><tr id="221" style="display: none;" colspan="3"><td colspan="3"><h2>Is it a good idea that this affinity takes precedence over
│ │ │ │ +piece priority?</h2><h4>../src/piece_picker.cpp:2211</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">					prio_index_t const end = priority_end(i);
│ │ │ │ +					for (prio_index_t p = prev(end); p &gt;= start; --p)
│ │ │ │ +					{
│ │ │ │ +						pc.inc_stats_counter(counters::piece_picker_reverse_rare_loops);
│ │ │ │ +
│ │ │ │ +						if (!is_piece_free(m_pieces[p], pieces)) continue;
│ │ │ │ +
│ │ │ │ +						ret |= picker_log_alert::reverse_rarest_first;
│ │ │ │ +
│ │ │ │ +						num_blocks = add_blocks(m_pieces[p], pieces
│ │ │ │ +							, interesting_blocks, backup_blocks
│ │ │ │ +							, backup_blocks2, num_blocks
│ │ │ │ +							, prefer_contiguous_blocks, peer, ignored_pieces
│ │ │ │ +							, options);
│ │ │ │ +						if (num_blocks &lt;= 0) return ret;
│ │ │ │ +					}
│ │ │ │ +				}
│ │ │ │ +			}
│ │ │ │ +			else
│ │ │ │ +			{
│ │ │ │ +<div style="background: #ffff00" width="100%">				if (options &amp; piece_extent_affinity)
│ │ │ │ +</div>				{
│ │ │ │ +					int to_erase = -1;
│ │ │ │ +					int idx = -1;
│ │ │ │ +					for (piece_extent_t const e : m_recent_extents)
│ │ │ │ +					{
│ │ │ │ +						++idx;
│ │ │ │ +						bool have_all = true;
│ │ │ │ +						for (piece_index_t const p : extent_for(e))
│ │ │ │ +						{
│ │ │ │ +							if (!m_piece_map[p].have()) have_all = false;
│ │ │ │ +							if (!is_piece_free(p, pieces)) continue;
│ │ │ │ +
│ │ │ │ +							ret |= picker_log_alert::extent_affinity;
│ │ │ │ +
│ │ │ │ +							num_blocks = add_blocks(p, pieces
│ │ │ │ +								, interesting_blocks, backup_blocks
│ │ │ │ +								, backup_blocks2, num_blocks
│ │ │ │ +								, prefer_contiguous_blocks, peer, ignored_pieces
│ │ │ │ +								, options);
│ │ │ │ +							if (num_blocks &lt;= 0)
│ │ │ │ +							{
│ │ │ │ +								// if we have all pieces belonging to this extent, remove it
│ │ │ │ +								if (to_erase != -1) m_recent_extents.erase(m_recent_extents.begin() + to_erase);
│ │ │ │ +								return ret;
│ │ │ │ +							}
│ │ │ │ +						}
│ │ │ │ +						// if we have all pieces belonging to this extent, remove it
│ │ │ │ +						if (have_all) to_erase = idx;
│ │ │ │ +					}
│ │ │ │ +					if (to_erase != -1) m_recent_extents.erase(m_recent_extents.begin() + to_erase);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(222)">../src/piece_picker.cpp:2566</a></td><td>when expanding pieces for cache stripe reasons, the !downloading condition doesn't make much sense</td></tr><tr id="222" style="display: none;" colspan="3"><td colspan="3"><h2>when expanding pieces for cache stripe reasons,
│ │ │ │ +the !downloading condition doesn't make much sense</h2><h4>../src/piece_picker.cpp:2566</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		TORRENT_ASSERT(index &lt; m_piece_map.end_index());
│ │ │ │ +		if (next(index) == m_piece_map.end_index())
│ │ │ │ +			return m_blocks_in_last_piece;
│ │ │ │ +		else
│ │ │ │ +			return blocks_per_piece();
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	bool piece_picker::is_piece_free(piece_index_t const piece
│ │ │ │ +		, typed_bitfield&lt;piece_index_t&gt; const&amp; bitmask) const
│ │ │ │ +	{
│ │ │ │ +		return bitmask[piece]
│ │ │ │ +			&amp;&amp; !m_piece_map[piece].have()
│ │ │ │ +			&amp;&amp; !m_piece_map[piece].filtered();
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	bool piece_picker::can_pick(piece_index_t const piece
│ │ │ │ +		, typed_bitfield&lt;piece_index_t&gt; const&amp; bitmask) const
│ │ │ │ +	{
│ │ │ │ +		return bitmask[piece]
│ │ │ │ +			&amp;&amp; !m_piece_map[piece].have()
│ │ │ │ +<div style="background: #ffff00" width="100%">			&amp;&amp; !m_piece_map[piece].downloading()
│ │ │ │ +</div>			&amp;&amp; !m_piece_map[piece].filtered();
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#if TORRENT_USE_INVARIANT_CHECKS
│ │ │ │ +	void piece_picker::check_peers()
│ │ │ │ +	{
│ │ │ │ +		for (auto const&amp; b : m_block_info)
│ │ │ │ +		{
│ │ │ │ +			TORRENT_ASSERT(b.peer == nullptr || static_cast&lt;torrent_peer*&gt;(b.peer)-&gt;in_use);
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	void piece_picker::clear_peer(torrent_peer* peer)
│ │ │ │ +	{
│ │ │ │ +		for (auto&amp; b : m_block_info)
│ │ │ │ +		{
│ │ │ │ +			if (b.peer == peer) b.peer = nullptr;
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	// the first bool is true if this is the only peer that has requested and downloaded
│ │ │ │ +	// blocks from this piece.
│ │ │ │ +	// the second bool is true if this is the only active peer that is requesting
│ │ │ │ +	// and downloading blocks from this piece. Active means having a connection.
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(223)">../src/piece_picker.cpp:3144</a></td><td>should 5 be configurable?</td></tr><tr id="223" style="display: none;" colspan="3"><td colspan="3"><h2>should 5 be configurable?</h2><h4>../src/piece_picker.cpp:3144</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		bool have_all = true;
│ │ │ │ +
│ │ │ │ +		for (auto const piece : extent_for(this_extent))
│ │ │ │ +		{
│ │ │ │ +			if (piece == p) continue;
│ │ │ │ +
│ │ │ │ +			if (!m_piece_map[piece].have()) have_all = false;
│ │ │ │ +
│ │ │ │ +			// if at least one piece in this extent has a different priority than
│ │ │ │ +			// the one we just started downloading, don't create an affinity for
│ │ │ │ +			// adjacent pieces. This probably means the pieces belong to different
│ │ │ │ +			// files, or that some other mechanism determining the priority should
│ │ │ │ +			// take precedence.
│ │ │ │ +			if (piece_priority(piece) != this_prio) return;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		// if we already have all the *other* pieces in this extent, there's no
│ │ │ │ +		// need to inflate their priorities
│ │ │ │ +		if (have_all) return;
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		if (m_recent_extents.size() &lt; 5)
│ │ │ │ +</div>			m_recent_extents.push_back(this_extent);
│ │ │ │ +
│ │ │ │ +		// limit the number of extent affinities active at any given time to limit
│ │ │ │ +		// the cost of checking them. Also, don't replace them, commit to
│ │ │ │ +		// finishing them before starting another extent. This is analogous to
│ │ │ │ +		// limiting the number of partial pieces.
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	// options may be 0 or piece_picker::reverse
│ │ │ │ +	// returns false if the block could not be marked as downloading
│ │ │ │ +	bool piece_picker::mark_as_downloading(piece_block const block
│ │ │ │ +		, torrent_peer* peer, picker_options_t const options)
│ │ │ │ +	{
│ │ │ │ +#ifdef TORRENT_PICKER_LOG
│ │ │ │ +		std::cerr &lt;&lt; "[" &lt;&lt; this &lt;&lt; "] " &lt;&lt; "mark_as_downloading( {"
│ │ │ │ +			&lt;&lt; block.piece_index &lt;&lt; ", " &lt;&lt; block.block_index &lt;&lt; "} )" &lt;&lt; std::endl;
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(peer == nullptr || peer-&gt;in_use);
│ │ │ │ +		TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
│ │ │ │ +		TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
│ │ │ │ +		TORRENT_ASSERT(block.piece_index &lt; m_piece_map.end_index());
│ │ │ │ +		TORRENT_ASSERT(block.block_index &lt; blocks_in_piece(block.piece_index));
│ │ │ │ +		TORRENT_ASSERT(!m_piece_map[block.piece_index].have());
│ │ │ │ +
│ │ │ │ +		piece_pos&amp; p = m_piece_map[block.piece_index];
│ │ │ │ +		if (p.download_queue() == piece_pos::piece_open)
│ │ │ │ +		{
│ │ │ │ +#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
│ │ │ │ +			INVARIANT_CHECK;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(224)">../src/torrent_peer.cpp:192</a></td><td>how do we deal with our external address changing?</td></tr><tr id="224" style="display: none;" colspan="3"><td colspan="3"><h2>how do we deal with our external address changing?</h2><h4>../src/torrent_peer.cpp:192</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// connections. If it fails, we'll
│ │ │ │ +		// retry with encryption
│ │ │ │ +		, pe_support(false)
│ │ │ │ +#endif
│ │ │ │ +		, is_v6_addr(false)
│ │ │ │ +#if TORRENT_USE_I2P
│ │ │ │ +		, is_i2p_addr(false)
│ │ │ │ +#endif
│ │ │ │ +		, on_parole(false)
│ │ │ │ +		, banned(false)
│ │ │ │ +		, supports_utp(true) // assume peers support utp
│ │ │ │ +		, confirmed_supports_utp(false)
│ │ │ │ +		, supports_holepunch(false)
│ │ │ │ +		, web_seed(false)
│ │ │ │ +		, protocol_v2(false)
│ │ │ │ +	{}
│ │ │ │ +
│ │ │ │ +	std::uint32_t torrent_peer::rank(external_ip const&amp; external, int external_port) const
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(in_use);
│ │ │ │ +<div style="background: #ffff00" width="100%">		if (peer_rank == 0)
│ │ │ │ +</div>			peer_rank = peer_priority(
│ │ │ │ +				tcp::endpoint(external.external_address(this-&gt;address()), std::uint16_t(external_port))
│ │ │ │ +				, tcp::endpoint(this-&gt;address(), this-&gt;port));
│ │ │ │ +		return peer_rank;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +	std::string torrent_peer::to_string() const
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(in_use);
│ │ │ │ +#if TORRENT_USE_I2P
│ │ │ │ +		if (is_i2p_addr) return dest().to_string();
│ │ │ │ +#endif // TORRENT_USE_I2P
│ │ │ │ +		return address().to_string();
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	std::int64_t torrent_peer::total_download() const
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(in_use);
│ │ │ │ +		if (connection != nullptr)
│ │ │ │ +		{
│ │ │ │ +			TORRENT_ASSERT(prev_amount_download == 0);
│ │ │ │ +			return connection-&gt;statistics().total_payload_download();
│ │ │ │ +		}
│ │ │ │ +		else
│ │ │ │ +		{
│ │ │ │ +			return std::int64_t(prev_amount_download) &lt;&lt; 10;
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(225)">../src/create_torrent.cpp:618</a></td><td>this can be optimized</td></tr><tr id="225" style="display: none;" colspan="3"><td colspan="3"><h2>this can be optimized</h2><h4>../src/create_torrent.cpp:618</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		std::string&amp; attr = e["attr"].string();
│ │ │ │ +		if (flags &amp; file_storage::flag_pad_file) attr += 'p';
│ │ │ │ +		if (flags &amp; file_storage::flag_hidden) attr += 'h';
│ │ │ │ +		if (flags &amp; file_storage::flag_executable) attr += 'x';
│ │ │ │ +		if (include_symlinks &amp;&amp; (flags &amp; file_storage::flag_symlink)) attr += 'l';
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void add_symlink_path(entry&amp; e, std::string symlink_path)
│ │ │ │ +	{
│ │ │ │ +		entry&amp; sympath_e = e["symlink path"];
│ │ │ │ +
│ │ │ │ +		std::string const link = lexically_relative("", symlink_path);
│ │ │ │ +		for (auto elems = lsplit_path(link); !elems.first.empty();
│ │ │ │ +			elems = lsplit_path(elems.second))
│ │ │ │ +			sympath_e.list().emplace_back(elems.first);
│ │ │ │ +	}
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +	std::vector&lt;char&gt; create_torrent::generate_buf() const
│ │ │ │ +	{
│ │ │ │ +<div style="background: #ffff00" width="100%">		std::vector&lt;char&gt; ret;
│ │ │ │ +</div>		bencode(std::back_inserter(ret), generate());
│ │ │ │  		return ret;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	add_torrent_params load_torrent_buffer(span&lt;char const&gt; buffer, load_torrent_limits const&amp; cfg)
│ │ │ │ +	entry create_torrent::generate() const
│ │ │ │  	{
│ │ │ │ -		add_torrent_params ret;
│ │ │ │ -		ret.ti = std::make_shared&lt;torrent_info&gt;(buffer, cfg, from_span);
│ │ │ │ -		update_atp(ret);
│ │ │ │ +		if (m_files.num_files() == 0 || m_files.total_size() == 0)
│ │ │ │ +			aux::throw_ex&lt;system_error&gt;(errors::torrent_missing_file_tree);
│ │ │ │ +
│ │ │ │ +		// if all v2 hashes are set correctly, generate the v2 parts of the
│ │ │ │ +		// torrent
│ │ │ │ +		bool const make_v2 = validate_v2_hashes(m_files, m_file_piece_hash);
│ │ │ │ +		bool const make_v1 = validate_v1_hashes(m_files, m_piece_hash);
│ │ │ │ +
│ │ │ │ +		// if neither v1 nor v2 hashes were set, we can't create a torrent
│ │ │ │ +		if (!make_v1 &amp;&amp; !make_v2)
│ │ │ │ +			aux::throw_ex&lt;system_error&gt;(errors::invalid_hash_entry);
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(m_files.piece_length() &gt; 0);
│ │ │ │ +
│ │ │ │ +		entry dict;
│ │ │ │ +
│ │ │ │ +		if (!m_urls.empty()) dict["announce"] = m_urls.front().first;
│ │ │ │ +
│ │ │ │ +		if (!m_nodes.empty())
│ │ │ │ +		{
│ │ │ │ +			entry&amp; nodes = dict["nodes"];
│ │ │ │ +			entry::list_type&amp; nodes_list = nodes.list();
│ │ │ │ +			for (auto const&amp; n : m_nodes)
│ │ │ │ +			{
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(226)">../src/magnet_uri.cpp:439</a></td><td>what's the right number here?</td></tr><tr id="226" style="display: none;" colspan="3"><td colspan="3"><h2>what's the right number here?</h2><h4>../src/magnet_uri.cpp:439</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			}
│ │ │ │ +			else if (string_equal_no_case(name, "so"_sv)) // select-only (files)
│ │ │ │ +			{
│ │ │ │ +				// accept only digits, '-' and ','
│ │ │ │ +				if (std::any_of(value.begin(), value.end(), [](char c)
│ │ │ │ +					{ return !is_digit(c) &amp;&amp; c != '-' &amp;&amp; c != ','; }))
│ │ │ │ +					continue;
│ │ │ │ +
│ │ │ │ +				// make sure all file priorities are set to 0, except the ones
│ │ │ │ +				// we specify in the file_priorities
│ │ │ │ +				p.flags |= torrent_flags::default_dont_download;
│ │ │ │ +
│ │ │ │ +				do
│ │ │ │ +				{
│ │ │ │ +					string_view token;
│ │ │ │ +					std::tie(token, value) = split_string(value, ',');
│ │ │ │ +
│ │ │ │ +					if (token.empty()) continue;
│ │ │ │ +
│ │ │ │ +					int idx1, idx2;
│ │ │ │ +<div style="background: #ffff00" width="100%">					constexpr int max_index = 10000; // can't risk out of memory
│ │ │ │ +</div>
│ │ │ │ +					auto const divider = token.find_first_of('-');
│ │ │ │ +					if (divider != std::string::npos) // it's a range
│ │ │ │ +					{
│ │ │ │ +						if (divider == 0) // no start index
│ │ │ │ +							continue;
│ │ │ │ +						if (divider == token.size() - 1) // no end index
│ │ │ │ +							continue;
│ │ │ │ +
│ │ │ │ +						idx1 = std::atoi(token.substr(0, divider).to_string().c_str());
│ │ │ │ +						if (idx1 &lt; 0 || idx1 &gt; max_index) // invalid index
│ │ │ │ +							continue;
│ │ │ │ +						idx2 = std::atoi(token.substr(divider + 1).to_string().c_str());
│ │ │ │ +						if (idx2 &lt; 0 || idx2 &gt; max_index) // invalid index
│ │ │ │ +							continue;
│ │ │ │ +
│ │ │ │ +						if (idx1 &gt; idx2) // wrong range limits
│ │ │ │ +							continue;
│ │ │ │ +					}
│ │ │ │ +					else // it's an index
│ │ │ │ +					{
│ │ │ │ +						idx1 = std::atoi(token.to_string().c_str());
│ │ │ │ +						if (idx1 &lt; 0 || idx1 &gt; max_index) // invalid index
│ │ │ │ +							continue;
│ │ │ │ +						idx2 = idx1;
│ │ │ │ +					}
│ │ │ │ +
│ │ │ │ +					if (int(p.file_priorities.size()) &lt;= idx2)
│ │ │ │ +						p.file_priorities.resize(static_cast&lt;std::size_t&gt;(idx2) + 1, dont_download);
│ │ │ │ +
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(227)">../src/session_impl.cpp:615</a></td><td>come up with some abstraction to do this for gnutls as well load certificates from the windows system certificate store</td></tr><tr id="227" style="display: none;" colspan="3"><td colspan="3"><h2>come up with some abstraction to do this for gnutls as well
│ │ │ │ +load certificates from the windows system certificate store</h2><h4>../src/session_impl.cpp:615</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		pause();
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	// This function is called by the creating thread, not in the message loop's
│ │ │ │ +	// io_context thread.
│ │ │ │ +	void session_impl::start_session()
│ │ │ │ +	{
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		session_log("start session");
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +#if TORRENT_USE_SSL
│ │ │ │ +		error_code ec;
│ │ │ │ +		m_ssl_ctx.set_default_verify_paths(ec);
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		if (ec) session_log("SSL set_default verify_paths failed: %s", ec.message().c_str());
│ │ │ │ +		ec.clear();
│ │ │ │ +#endif
│ │ │ │ +#if defined TORRENT_WINDOWS &amp;&amp; defined TORRENT_USE_OPENSSL &amp;&amp; !defined TORRENT_WINRT
│ │ │ │ +<div style="background: #ffff00" width="100%">		X509_STORE* store = X509_STORE_new();
│ │ │ │ +</div>		if (store)
│ │ │ │ +		{
│ │ │ │ +			HCERTSTORE system_store = CertOpenSystemStoreA(0, "ROOT");
│ │ │ │ +			// this is best effort
│ │ │ │ +			if (system_store)
│ │ │ │ +			{
│ │ │ │ +				CERT_CONTEXT const* ctx = nullptr;
│ │ │ │ +				while ((ctx = CertEnumCertificatesInStore(system_store, ctx)) != nullptr)
│ │ │ │ +				{
│ │ │ │ +					unsigned char const* cert_ptr = reinterpret_cast&lt;unsigned char const*&gt;(ctx-&gt;pbCertEncoded);
│ │ │ │ +					X509* x509 = d2i_X509(nullptr, &amp;cert_ptr, ctx-&gt;cbCertEncoded);
│ │ │ │ +					// this is best effort
│ │ │ │ +					if (!x509) continue;
│ │ │ │ +					X509_STORE_add_cert(store, x509);
│ │ │ │ +					X509_free(x509);
│ │ │ │ +				}
│ │ │ │ +				CertFreeCertificateContext(ctx);
│ │ │ │ +				CertCloseStore(system_store, 0);
│ │ │ │ +			}
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		SSL_CTX* ssl_ctx = m_ssl_ctx.native_handle();
│ │ │ │ +		SSL_CTX_set_cert_store(ssl_ctx, store);
│ │ │ │ +#endif
│ │ │ │ +#ifdef __APPLE__
│ │ │ │ +		m_ssl_ctx.load_verify_file("/etc/ssl/cert.pem", ec);
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		if (ec) session_log("SSL load_verify_file failed: %s", ec.message().c_str());
│ │ │ │ +		ec.clear();
│ │ │ │ +#endif
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(228)">../src/session_impl.cpp:1484</a></td><td>it would be nice to reserve() these vectors up front</td></tr><tr id="228" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to reserve() these vectors up front</h2><h4>../src/session_impl.cpp:1484</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			bandwidth_channel* ch = &amp;p-&gt;channel[peer_connection::download_channel];
│ │ │ │ +			if (use_quota_overhead(ch, amount_down))
│ │ │ │ +				ret |= 1 &lt;&lt; peer_connection::download_channel;
│ │ │ │ +			ch = &amp;p-&gt;channel[peer_connection::upload_channel];
│ │ │ │ +			if (use_quota_overhead(ch, amount_up))
│ │ │ │ +				ret |= 1 &lt;&lt; peer_connection::upload_channel;
│ │ │ │ +		}
│ │ │ │  		return ret;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -	add_torrent_params load_torrent_parsed(bdecode_node const&amp; torrent_file, load_torrent_limits const&amp; cfg)
│ │ │ │ +	// session_impl is responsible for deleting 'pack'
│ │ │ │ +	void session_impl::apply_settings_pack(std::shared_ptr&lt;settings_pack&gt; pack)
│ │ │ │  	{
│ │ │ │ -		add_torrent_params ret;
│ │ │ │ -		ret.ti = std::make_shared&lt;torrent_info&gt;(torrent_file, cfg);
│ │ │ │ -		update_atp(ret);
│ │ │ │ +		INVARIANT_CHECK;
│ │ │ │ +		apply_settings_pack_impl(*pack);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	settings_pack session_impl::get_settings() const
│ │ │ │ +	{
│ │ │ │ +		settings_pack ret;
│ │ │ │ +<div style="background: #ffff00" width="100%">		for (int i = settings_pack::string_type_base;
│ │ │ │ +</div>			i &lt; settings_pack::max_string_setting_internal; ++i)
│ │ │ │ +		{
│ │ │ │ +			ret.set_str(i, m_settings.get_str(i));
│ │ │ │ +		}
│ │ │ │ +		for (int i = settings_pack::int_type_base;
│ │ │ │ +			i &lt; settings_pack::max_int_setting_internal; ++i)
│ │ │ │ +		{
│ │ │ │ +			ret.set_int(i, m_settings.get_int(i));
│ │ │ │ +		}
│ │ │ │ +		for (int i = settings_pack::bool_type_base;
│ │ │ │ +			i &lt; settings_pack::max_bool_setting_internal; ++i)
│ │ │ │ +		{
│ │ │ │ +			ret.set_bool(i, m_settings.get_bool(i));
│ │ │ │ +		}
│ │ │ │  		return ret;
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -}
│ │ │ │ +namespace {
│ │ │ │ +	template &lt;typename Pack&gt;
│ │ │ │ +	int get_setting_impl(Pack const&amp; p, int name, int*)
│ │ │ │ +	{ return p.get_int(name); }
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(240)">../src/add_torrent_params.cpp:78</a></td><td>pre C++17, GCC and msvc does not make std::string nothrow move assignable, which means no type containing a string will be nothrow move assignable by default either static_assert(std::is_nothrow_move_assignable<add_torrent_params>::value , "should be nothrow move assignable");</td></tr><tr id="240" style="display: none;" colspan="3"><td colspan="3"><h2>pre C++17, GCC and msvc does not make std::string nothrow move
│ │ │ │ -assignable, which means no type containing a string will be nothrow move
│ │ │ │ -assignable by default either
│ │ │ │ -static_assert(std::is_nothrow_move_assignable<add_torrent_params>::value
│ │ │ │ -, "should be nothrow move assignable");</h2><h4>../src/add_torrent_params.cpp:78</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			DECL_FLAG(sequential_download);
│ │ │ │ -			DECL_FLAG(pinned);
│ │ │ │ -			DECL_FLAG(stop_when_ready);
│ │ │ │ -			DECL_FLAG(override_trackers);
│ │ │ │ -			DECL_FLAG(override_web_seeds);
│ │ │ │ -			DECL_FLAG(need_save_resume);
│ │ │ │ -			DECL_FLAG(override_resume_data);
│ │ │ │ -			DECL_FLAG(merge_resume_trackers);
│ │ │ │ -			DECL_FLAG(use_resume_save_path);
│ │ │ │ -			DECL_FLAG(merge_resume_http_seeds);
│ │ │ │ -			DECL_FLAG(default_flags);
│ │ │ │ -#undef DECL_FLAG
│ │ │ │ -#endif // TORRENT_ABI_VERSION
│ │ │ │ +	template &lt;typename Pack&gt;
│ │ │ │ +	bool get_setting_impl(Pack const&amp; p, int name, bool*)
│ │ │ │ +	{ return p.get_bool(name); }
│ │ │ │  
│ │ │ │ -	static_assert(std::is_nothrow_move_constructible&lt;add_torrent_params&gt;::value
│ │ │ │ -		, "should be nothrow move constructible");
│ │ │ │ +	template &lt;typename Pack&gt;
│ │ │ │ +	std::string get_setting_impl(Pack const&amp; p, int name, std::string*)
│ │ │ │ +	{ return p.get_str(name); }
│ │ │ │  
│ │ │ │ -	static_assert(std::is_nothrow_move_constructible&lt;std::string&gt;::value
│ │ │ │ -		, "should be nothrow move constructible");
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(229)">../src/session_impl.cpp:1998</a></td><td>could this function be merged with expand_unspecified_addresses? right now both listen_endpoint_t and listen_interface_t are almost identical, maybe the latter could be removed too</td></tr><tr id="229" style="display: none;" colspan="3"><td colspan="3"><h2>could this function be merged with expand_unspecified_addresses?
│ │ │ │ +right now both listen_endpoint_t and listen_interface_t are almost
│ │ │ │ +identical, maybe the latter could be removed too</h2><h4>../src/session_impl.cpp:1998</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		session_log("FATAL SESSION ERROR (%s : %d) [%s]"
│ │ │ │ +			, ec.category().name(), ec.value(), ec.message().c_str());
│ │ │ │ +#endif
│ │ │ │ +		this-&gt;abort();
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(241)">../src/add_torrent_params.cpp:84</a></td><td>it would be nice if this was nothrow default constructible static_assert(std::is_nothrow_default_constructible<add_torrent_params>::value , "should be nothrow default constructible");</td></tr><tr id="241" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice if this was nothrow default constructible
│ │ │ │ -static_assert(std::is_nothrow_default_constructible<add_torrent_params>::value
│ │ │ │ -, "should be nothrow default constructible");</h2><h4>../src/add_torrent_params.cpp:84</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			DECL_FLAG(pinned);
│ │ │ │ -			DECL_FLAG(stop_when_ready);
│ │ │ │ -			DECL_FLAG(override_trackers);
│ │ │ │ -			DECL_FLAG(override_web_seeds);
│ │ │ │ -			DECL_FLAG(need_save_resume);
│ │ │ │ -			DECL_FLAG(override_resume_data);
│ │ │ │ -			DECL_FLAG(merge_resume_trackers);
│ │ │ │ -			DECL_FLAG(use_resume_save_path);
│ │ │ │ -			DECL_FLAG(merge_resume_http_seeds);
│ │ │ │ -			DECL_FLAG(default_flags);
│ │ │ │ -#undef DECL_FLAG
│ │ │ │ -#endif // TORRENT_ABI_VERSION
│ │ │ │ +	void session_impl::on_ip_change(error_code const&amp; ec)
│ │ │ │ +	{
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		if (!ec)
│ │ │ │ +			session_log("received ip change from internal ip_notifier");
│ │ │ │ +		else
│ │ │ │ +			session_log("received error on_ip_change: %d, %s", ec.value(), ec.message().c_str());
│ │ │ │ +#endif
│ │ │ │ +		if (ec || m_abort || !m_ip_notifier) return;
│ │ │ │ +		m_ip_notifier-&gt;async_wait([this] (error_code const&amp; e)
│ │ │ │ +			{ wrap(&amp;session_impl::on_ip_change, e); });
│ │ │ │ +		reopen_network_sockets({});
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -	static_assert(std::is_nothrow_move_constructible&lt;add_torrent_params&gt;::value
│ │ │ │ -		, "should be nothrow move constructible");
│ │ │ │ +<div style="background: #ffff00" width="100%">	void interface_to_endpoints(listen_interface_t const&amp; iface
│ │ │ │ +</div>		, listen_socket_flags_t flags
│ │ │ │ +		, span&lt;ip_interface const&gt; const ifs
│ │ │ │ +		, std::vector&lt;listen_endpoint_t&gt;&amp; eps)
│ │ │ │ +	{
│ │ │ │ +		flags |= iface.local ? listen_socket_t::local_network : listen_socket_flags_t{};
│ │ │ │ +		transport const ssl = iface.ssl ? transport::ssl : transport::plaintext;
│ │ │ │  
│ │ │ │ -	static_assert(std::is_nothrow_move_constructible&lt;std::string&gt;::value
│ │ │ │ -		, "should be nothrow move constructible");
│ │ │ │ +		// First, check to see if it's an IP address
│ │ │ │ +		error_code err;
│ │ │ │ +		address const adr = make_address(iface.device.c_str(), err);
│ │ │ │ +		if (!err)
│ │ │ │ +		{
│ │ │ │ +			eps.emplace_back(adr, iface.port, std::string{}, ssl, flags);
│ │ │ │ +		}
│ │ │ │ +		else
│ │ │ │ +		{
│ │ │ │ +			flags |= listen_socket_t::was_expanded;
│ │ │ │ +
│ │ │ │ +			// this is the case where device names a network device. We need to
│ │ │ │ +			// enumerate all IPs associated with this device
│ │ │ │ +			for (auto const&amp; ipface : ifs)
│ │ │ │ +			{
│ │ │ │ +				// we're looking for a specific interface, and its address
│ │ │ │ +				// (which must be of the same family as the address we're
│ │ │ │ +				// connecting to)
│ │ │ │ +				if (iface.device != ipface.name) continue;
│ │ │ │ +
│ │ │ │ +				bool const local = iface.local
│ │ │ │ +					|| ipface.interface_address.is_loopback()
│ │ │ │ +					|| is_link_local(ipface.interface_address);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(230)">../src/session_impl.cpp:2306</a></td><td>it would probably be better to do this by having a listen-socket "version" number that gets bumped. And instead of setting a bool to disable a tracker, we set the version number that it was disabled at. This change would affect the ABI in 1.2, so should be done in 2.0 or later</td></tr><tr id="230" style="display: none;" colspan="3"><td colspan="3"><h2>it would probably be better to do this by having a
│ │ │ │ +listen-socket "version" number that gets bumped. And instead of
│ │ │ │ +setting a bool to disable a tracker, we set the version number that
│ │ │ │ +it was disabled at. This change would affect the ABI in 1.2, so
│ │ │ │ +should be done in 2.0 or later</h2><h4>../src/session_impl.cpp:2306</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		{
│ │ │ │ +			for (auto const&amp; s : m_listen_sockets)
│ │ │ │ +				remap_ports(remap_natpmp_and_upnp, *s);
│ │ │ │ +		}
│ │ │ │ +		else
│ │ │ │ +		{
│ │ │ │ +			// new sockets need to map ports even if the caller did not request
│ │ │ │ +			// re-mapping
│ │ │ │ +			for (auto const&amp; s : new_sockets)
│ │ │ │ +				remap_ports(remap_natpmp_and_upnp, *s);
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		update_lsd();
│ │ │ │ +
│ │ │ │ +#if TORRENT_USE_I2P
│ │ │ │ +		open_new_incoming_i2p_connection();
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		// trackers that were not reachable, may have become reachable now.
│ │ │ │ +		// so clear the "disabled" flags to let them be tried one more time
│ │ │ │ +<div style="background: #ffff00" width="100%">		for (auto&amp; t : m_torrents)
│ │ │ │ +</div>			t-&gt;enable_all_trackers();
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void session_impl::reopen_network_sockets(reopen_network_flags_t const options)
│ │ │ │ +	{
│ │ │ │ +		reopen_listen_sockets(bool(options &amp; session_handle::reopen_map_ports));
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	namespace {
│ │ │ │ +		template &lt;typename MapProtocol, typename ProtoType, typename EndpointType&gt;
│ │ │ │ +		void map_port(MapProtocol&amp; m, ProtoType protocol, EndpointType const&amp; ep
│ │ │ │ +			, port_mapping_t&amp; map_handle, std::string const&amp; device)
│ │ │ │ +		{
│ │ │ │ +			if (map_handle != port_mapping_t{-1}) m.delete_mapping(map_handle);
│ │ │ │ +			map_handle = port_mapping_t{-1};
│ │ │ │ +
│ │ │ │ +			address const addr = ep.address();
│ │ │ │ +			// with IPv4 the interface might be behind NAT so we can't skip them
│ │ │ │ +			// based on the scope of the local address
│ │ │ │ +			if (addr.is_v6() &amp;&amp; is_local(addr))
│ │ │ │ +				return;
│ │ │ │ +
│ │ │ │ +			// only update this mapping if we actually have a socket listening
│ │ │ │ +			if (ep != EndpointType())
│ │ │ │ +				map_handle = m.add_mapping(protocol, ep.port(), ep, device);
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void session_impl::remap_ports(remap_port_mask_t const mask
│ │ │ │ +		, listen_socket_t&amp; s)
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(231)">../src/session_impl.cpp:2866</a></td><td>this size need to be capped</td></tr><tr id="231" style="display: none;" colspan="3"><td colspan="3"><h2>this size need to be capped</h2><h4>../src/session_impl.cpp:2866</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				// handshaking
│ │ │ │ +				return socket_type(ssl_stream&lt;tcp::socket&gt;(tcp::socket(std::move(s)), m_peer_ssl_ctx));
│ │ │ │ +			}
│ │ │ │ +			else
│ │ │ │ +#endif
│ │ │ │ +			{
│ │ │ │ +				return socket_type(tcp::socket(std::move(s)));
│ │ │ │ +			}
│ │ │ │ +		}();
│ │ │ │ +
│ │ │ │ +#ifdef TORRENT_SSL_PEERS
│ │ │ │ +		TORRENT_ASSERT((ssl == transport::ssl) == is_ssl(c));
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +#ifdef TORRENT_SSL_PEERS
│ │ │ │ +		if (ssl == transport::ssl)
│ │ │ │ +		{
│ │ │ │ +			TORRENT_ASSERT(is_ssl(c));
│ │ │ │ +
│ │ │ │ +			// save the socket so we can cancel the handshake
│ │ │ │ +<div style="background: #ffff00" width="100%">			auto iter = m_incoming_sockets.emplace(std::make_unique&lt;socket_type&gt;(std::move(c))).first;
│ │ │ │ +</div>
│ │ │ │ +			auto sock = iter-&gt;get();
│ │ │ │ +			// for SSL connections, incoming_connection() is called
│ │ │ │ +			// after the handshake is done
│ │ │ │ +			ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");
│ │ │ │ +			boost::get&lt;ssl_stream&lt;tcp::socket&gt;&gt;(**iter).async_accept_handshake(
│ │ │ │ +				[this, sock] (error_code const&amp; err) { ssl_handshake(err, sock); });
│ │ │ │ +		}
│ │ │ │ +		else
│ │ │ │ +#endif
│ │ │ │ +		{
│ │ │ │ +			incoming_connection(std::move(c));
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#ifdef TORRENT_SSL_PEERS
│ │ │ │ +
│ │ │ │ +	void session_impl::on_incoming_utp_ssl(socket_type s)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(is_ssl(s));
│ │ │ │ +
│ │ │ │ +		// save the socket so we can cancel the handshake
│ │ │ │ +
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(232)">../src/session_impl.cpp:2891</a></td><td>this size need to be capped</td></tr><tr id="232" style="display: none;" colspan="3"><td colspan="3"><h2>this size need to be capped</h2><h4>../src/session_impl.cpp:2891</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			// after the handshake is done
│ │ │ │ +			ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");
│ │ │ │ +			boost::get&lt;ssl_stream&lt;tcp::socket&gt;&gt;(**iter).async_accept_handshake(
│ │ │ │ +				[this, sock] (error_code const&amp; err) { ssl_handshake(err, sock); });
│ │ │ │ +		}
│ │ │ │ +		else
│ │ │ │ +#endif
│ │ │ │ +		{
│ │ │ │ +			incoming_connection(std::move(c));
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#ifdef TORRENT_SSL_PEERS
│ │ │ │ +
│ │ │ │ +	void session_impl::on_incoming_utp_ssl(socket_type s)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(is_ssl(s));
│ │ │ │ +
│ │ │ │ +		// save the socket so we can cancel the handshake
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		auto iter = m_incoming_sockets.emplace(std::make_unique&lt;socket_type&gt;(std::move(s))).first;
│ │ │ │ +</div>		auto sock = iter-&gt;get();
│ │ │ │ +
│ │ │ │ +		// for SSL connections, incoming_connection() is called
│ │ │ │ +		// after the handshake is done
│ │ │ │ +		ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");
│ │ │ │ +		boost::get&lt;ssl_stream&lt;utp_stream&gt;&gt;(**iter).async_accept_handshake(
│ │ │ │ +			[this, sock] (error_code const&amp; err) { ssl_handshake(err, sock); });
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	// to test SSL connections, one can use this openssl command template:
│ │ │ │ +	//
│ │ │ │ +	// openssl s_client -cert &lt;client-cert&gt;.pem -key &lt;client-private-key&gt;.pem
│ │ │ │ +	//   -CAfile &lt;torrent-cert&gt;.pem  -debug -connect 127.0.0.1:4433 -tls1
│ │ │ │ +	//   -servername &lt;hex-encoded-info-hash&gt;
│ │ │ │ +
│ │ │ │ +	void session_impl::ssl_handshake(error_code const&amp; ec, socket_type* sock)
│ │ │ │ +	{
│ │ │ │ +		COMPLETE_ASYNC("session_impl::ssl_handshake");
│ │ │ │ +
│ │ │ │ +		auto iter = m_incoming_sockets.find(sock);
│ │ │ │ +
│ │ │ │ +		// this happens if the SSL connection is aborted because we're shutting
│ │ │ │ +		// down
│ │ │ │ +		if (iter == m_incoming_sockets.end()) return;
│ │ │ │ +
│ │ │ │ +		socket_type s(std::move(**iter));
│ │ │ │ +		TORRENT_ASSERT(is_ssl(s));
│ │ │ │ +		m_incoming_sockets.erase(iter);
│ │ │ │ +
│ │ │ │ +		error_code e;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(233)">../src/session_impl.cpp:3590</a></td><td>have a separate list for these connections, instead of having to loop through all of them</td></tr><tr id="233" style="display: none;" colspan="3"><td colspan="3"><h2>have a separate list for these connections, instead of having to loop through all of them</h2><h4>../src/session_impl.cpp:3590</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// --------------------------------------------------------------
│ │ │ │ +		if (!m_paused) m_auto_manage_time_scaler--;
│ │ │ │ +		if (m_auto_manage_time_scaler &lt; 0)
│ │ │ │ +		{
│ │ │ │ +			m_auto_manage_time_scaler = settings().get_int(settings_pack::auto_manage_interval);
│ │ │ │ +			recalculate_auto_managed_torrents();
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		// --------------------------------------------------------------
│ │ │ │ +		// check for incoming connections that might have timed out
│ │ │ │ +		// --------------------------------------------------------------
│ │ │ │ +
│ │ │ │ +		for (auto i = m_connections.begin(); i != m_connections.end();)
│ │ │ │ +		{
│ │ │ │ +			peer_connection* p = (*i).get();
│ │ │ │ +			++i;
│ │ │ │ +			// ignore connections that already have a torrent, since they
│ │ │ │ +			// are ticked through the torrents' second_tick
│ │ │ │ +			if (!p-&gt;associated_torrent().expired()) continue;
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">			int timeout = m_settings.get_int(settings_pack::handshake_timeout);
│ │ │ │ +</div>#if TORRENT_USE_I2P
│ │ │ │ +			timeout *= is_i2p(p-&gt;get_socket()) ? 4 : 1;
│ │ │ │ +#endif
│ │ │ │ +			if (m_last_tick - p-&gt;connected_time () &gt; seconds(timeout))
│ │ │ │ +				p-&gt;disconnect(errors::timed_out, operation_t::bittorrent);
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		// --------------------------------------------------------------
│ │ │ │ +		// second_tick every torrent (that wants it)
│ │ │ │ +		// --------------------------------------------------------------
│ │ │ │ +
│ │ │ │ +#if TORRENT_DEBUG_STREAMING &gt; 0
│ │ │ │ +		std::printf("\033[2J\033[0;0H");
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		aux::vector&lt;torrent*&gt;&amp; want_tick = m_torrent_lists[torrent_want_tick];
│ │ │ │ +		for (int i = 0; i &lt; int(want_tick.size()); ++i)
│ │ │ │ +		{
│ │ │ │ +			torrent&amp; t = *want_tick[i];
│ │ │ │ +			TORRENT_ASSERT(t.want_tick());
│ │ │ │ +			TORRENT_ASSERT(!t.is_aborted());
│ │ │ │ +
│ │ │ │ +			t.second_tick(tick_interval_ms);
│ │ │ │ +
│ │ │ │ +			// if the call to second_tick caused the torrent
│ │ │ │ +			// to no longer want to be ticked (i.e. it was
│ │ │ │ +			// removed from the list) we need to back up the counter
│ │ │ │ +			// to not miss the torrent after it
│ │ │ │ +			if (!t.want_tick()) --i;
│ │ │ │ +		}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(234)">../src/session_impl.cpp:3623</a></td><td>this should apply to all bandwidth channels</td></tr><tr id="234" style="display: none;" colspan="3"><td colspan="3"><h2>this should apply to all bandwidth channels</h2><h4>../src/session_impl.cpp:3623</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#if TORRENT_DEBUG_STREAMING &gt; 0
│ │ │ │ +		std::printf("\033[2J\033[0;0H");
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		aux::vector&lt;torrent*&gt;&amp; want_tick = m_torrent_lists[torrent_want_tick];
│ │ │ │ +		for (int i = 0; i &lt; int(want_tick.size()); ++i)
│ │ │ │ +		{
│ │ │ │ +			torrent&amp; t = *want_tick[i];
│ │ │ │ +			TORRENT_ASSERT(t.want_tick());
│ │ │ │ +			TORRENT_ASSERT(!t.is_aborted());
│ │ │ │ +
│ │ │ │ +			t.second_tick(tick_interval_ms);
│ │ │ │ +
│ │ │ │ +			// if the call to second_tick caused the torrent
│ │ │ │ +			// to no longer want to be ticked (i.e. it was
│ │ │ │ +			// removed from the list) we need to back up the counter
│ │ │ │ +			// to not miss the torrent after it
│ │ │ │ +			if (!t.want_tick()) --i;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		if (m_settings.get_bool(settings_pack::rate_limit_ip_overhead))
│ │ │ │ +</div>		{
│ │ │ │ +			int const up_limit = upload_rate_limit(m_global_class);
│ │ │ │ +			int const down_limit = download_rate_limit(m_global_class);
│ │ │ │ +
│ │ │ │ +			if (down_limit &gt; 0
│ │ │ │ +				&amp;&amp; m_stat.download_ip_overhead() &gt;= down_limit
│ │ │ │ +				&amp;&amp; m_alerts.should_post&lt;performance_alert&gt;())
│ │ │ │ +			{
│ │ │ │ +				m_alerts.emplace_alert&lt;performance_alert&gt;(torrent_handle()
│ │ │ │ +					, performance_alert::download_limit_too_low);
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +			if (up_limit &gt; 0
│ │ │ │ +				&amp;&amp; m_stat.upload_ip_overhead() &gt;= up_limit
│ │ │ │ +				&amp;&amp; m_alerts.should_post&lt;performance_alert&gt;())
│ │ │ │ +			{
│ │ │ │ +				m_alerts.emplace_alert&lt;performance_alert&gt;(torrent_handle()
│ │ │ │ +					, performance_alert::upload_limit_too_low);
│ │ │ │ +			}
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │ +		m_peak_up_rate = std::max(m_stat.upload_rate(), m_peak_up_rate);
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		m_stat.second_tick(tick_interval_ms);
│ │ │ │ +
│ │ │ │ +		// --------------------------------------------------------------
│ │ │ │ +		// scrape paused torrents that are auto managed
│ │ │ │ +		// (unless the session is paused)
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(235)">../src/session_impl.cpp:4314</a></td><td>use a lower limit than m_settings.connections_limit to allocate the to 10% or so of connection slots for incoming connections cap this at max - 1, since we may add one below</td></tr><tr id="235" style="display: none;" colspan="3"><td colspan="3"><h2>use a lower limit than m_settings.connections_limit
│ │ │ │ +to allocate the to 10% or so of connection slots for incoming
│ │ │ │ +connections
│ │ │ │ +cap this at max - 1, since we may add one below</h2><h4>../src/session_impl.cpp:4314</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// boost, which are done immediately on a tracker response. These
│ │ │ │ +		// connections needs to be deducted from the regular connection attempt
│ │ │ │ +		// quota for this tick
│ │ │ │ +		if (m_boost_connections &gt; 0)
│ │ │ │ +		{
│ │ │ │ +			if (m_boost_connections &gt; max_connections)
│ │ │ │ +			{
│ │ │ │ +				m_boost_connections -= max_connections;
│ │ │ │ +				max_connections = 0;
│ │ │ │ +			}
│ │ │ │ +			else
│ │ │ │ +			{
│ │ │ │ +				max_connections -= m_boost_connections;
│ │ │ │ +				m_boost_connections = 0;
│ │ │ │ +			}
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		// zero connections speeds are allowed, we just won't make any connections
│ │ │ │ +		if (max_connections &lt;= 0) return;
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		int const limit = std::min(m_settings.get_int(settings_pack::connections_limit)
│ │ │ │ +</div>			- num_connections(), std::numeric_limits&lt;int&gt;::max() - 1);
│ │ │ │ +
│ │ │ │ +		// this logic is here to smooth out the number of new connection
│ │ │ │ +		// attempts over time, to prevent connecting a large number of
│ │ │ │ +		// sockets, wait 10 seconds, and then try again
│ │ │ │ +		if (m_settings.get_bool(settings_pack::smooth_connects) &amp;&amp; max_connections &gt; (limit+1) / 2)
│ │ │ │ +			max_connections = (limit + 1) / 2;
│ │ │ │ +
│ │ │ │ +		aux::vector&lt;torrent*&gt;&amp; want_peers_download = m_torrent_lists[torrent_want_peers_download];
│ │ │ │ +		aux::vector&lt;torrent*&gt;&amp; want_peers_finished = m_torrent_lists[torrent_want_peers_finished];
│ │ │ │ +
│ │ │ │ +		// if no torrent want any peers, just return
│ │ │ │ +		if (want_peers_download.empty() &amp;&amp; want_peers_finished.empty()) return;
│ │ │ │ +
│ │ │ │ +		// if we don't have any connection attempt quota, return
│ │ │ │ +		if (max_connections &lt;= 0) return;
│ │ │ │ +
│ │ │ │ +		int steps_since_last_connect = 0;
│ │ │ │ +		int const num_torrents = int(want_peers_finished.size() + want_peers_download.size());
│ │ │ │ +		for (;;)
│ │ │ │ +		{
│ │ │ │ +			if (m_next_downloading_connect_torrent &gt;= int(want_peers_download.size()))
│ │ │ │ +				m_next_downloading_connect_torrent = 0;
│ │ │ │ +
│ │ │ │ +			if (m_next_finished_connect_torrent &gt;= int(want_peers_finished.size()))
│ │ │ │ +				m_next_finished_connect_torrent = 0;
│ │ │ │ +
│ │ │ │ +			torrent* t = nullptr;
│ │ │ │ +			// there are prioritized torrents. Pick one of those
│ │ │ │ +			while (!m_prio_torrents.empty())
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(236)">../src/session_impl.cpp:4459</a></td><td>post a message to have this happen immediately instead of waiting for the next tick</td></tr><tr id="236" style="display: none;" colspan="3"><td colspan="3"><h2>post a message to have this happen
│ │ │ │ +immediately instead of waiting for the next tick</h2><h4>../src/session_impl.cpp:4459</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">				continue;
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +			if (!p-&gt;is_peer_interested()
│ │ │ │ +				|| p-&gt;is_disconnecting()
│ │ │ │ +				|| p-&gt;is_connecting())
│ │ │ │ +			{
│ │ │ │ +				// this peer is not unchokable. So, if it's unchoked
│ │ │ │ +				// already, make sure to choke it.
│ │ │ │ +				if (p-&gt;is_choked())
│ │ │ │ +				{
│ │ │ │ +					p-&gt;reset_choke_counters();
│ │ │ │ +					continue;
│ │ │ │ +				}
│ │ │ │ +				if (pi &amp;&amp; pi-&gt;optimistically_unchoked)
│ │ │ │ +				{
│ │ │ │ +					m_stats_counters.inc_stats_counter(counters::num_peers_up_unchoked_optimistic, -1);
│ │ │ │ +					pi-&gt;optimistically_unchoked = false;
│ │ │ │ +					// force a new optimistic unchoke
│ │ │ │ +					m_optimistic_unchoke_time_scaler = 0;
│ │ │ │ +<div style="background: #ffff00" width="100%">				}
│ │ │ │ +</div>				t-&gt;choke_peer(*p);
│ │ │ │ +				p-&gt;reset_choke_counters();
│ │ │ │ +				continue;
│ │ │ │ +			}
│ │ │ │ +
│ │ │ │ +			peers.push_back(p.get());
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		int const allowed_upload_slots = unchoke_sort(peers
│ │ │ │ +			, unchoke_interval, m_settings);
│ │ │ │ +
│ │ │ │ +		if (m_settings.get_int(settings_pack::choking_algorithm) == settings_pack::fixed_slots_choker)
│ │ │ │ +		{
│ │ │ │ +			int const upload_slots = get_int_setting(settings_pack::unchoke_slots_limit);
│ │ │ │ +			m_stats_counters.set_value(counters::num_unchoke_slots, upload_slots);
│ │ │ │ +		}
│ │ │ │ +		else
│ │ │ │ +		{
│ │ │ │ +			m_stats_counters.set_value(counters::num_unchoke_slots
│ │ │ │ +				, allowed_upload_slots);
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		if (should_log())
│ │ │ │ +		{
│ │ │ │ +			session_log("RECALCULATE UNCHOKE SLOTS: [ peers: %d "
│ │ │ │ +				"eligible-peers: %d"
│ │ │ │ +				" allowed-slots: %d ]"
│ │ │ │ +				, int(m_connections.size())
│ │ │ │ +				, int(peers.size())
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(237)">../src/session_impl.cpp:4786</a></td><td>it might be a nice feature here to limit the number of torrents to send in a single update. By just posting the first n torrents, they would nicely be round-robined because the torrent lists are always pushed back. Perhaps the status_update_alert could even have a fixed array of n entries rather than a vector, to further improve memory locality.</td></tr><tr id="237" style="display: none;" colspan="3"><td colspan="3"><h2>it might be a nice feature here to limit the number of torrents
│ │ │ │ +to send in a single update. By just posting the first n torrents, they
│ │ │ │ +would nicely be round-robined because the torrent lists are always
│ │ │ │ +pushed back. Perhaps the status_update_alert could even have a fixed
│ │ │ │ +array of n entries rather than a vector, to further improve memory
│ │ │ │ +locality.</h2><h4>../src/session_impl.cpp:4786</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			t-&gt;status(&amp;st, flags);
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void session_impl::post_torrent_updates(status_flags_t const flags)
│ │ │ │ +	{
│ │ │ │ +		INVARIANT_CHECK;
│ │ │ │ +
│ │ │ │ +		TORRENT_ASSERT(is_single_thread());
│ │ │ │ +
│ │ │ │ +		std::vector&lt;torrent*&gt;&amp; state_updates
│ │ │ │ +			= m_torrent_lists[aux::session_impl::torrent_state_updates];
│ │ │ │ +
│ │ │ │ +#if TORRENT_USE_ASSERTS
│ │ │ │ +		m_posting_torrent_updates = true;
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		std::vector&lt;torrent_status&gt; status;
│ │ │ │ +		status.reserve(state_updates.size());
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		for (auto&amp; t : state_updates)
│ │ │ │ +</div>		{
│ │ │ │ +			TORRENT_ASSERT(t-&gt;m_links[aux::session_impl::torrent_state_updates].in_list());
│ │ │ │ +			status.emplace_back();
│ │ │ │ +			// querying accurate download counters may require
│ │ │ │ +			// the torrent to be loaded. Loading a torrent, and evicting another
│ │ │ │ +			// one will lead to calling state_updated(), which screws with
│ │ │ │ +			// this list while we're working on it, and break things
│ │ │ │ +			t-&gt;status(&amp;status.back(), flags);
│ │ │ │ +			t-&gt;clear_in_state_update();
│ │ │ │ +		}
│ │ │ │ +		state_updates.clear();
│ │ │ │ +
│ │ │ │ +#if TORRENT_USE_ASSERTS
│ │ │ │ +		m_posting_torrent_updates = false;
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		m_alerts.emplace_alert&lt;state_update_alert&gt;(std::move(status));
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ +	void session_impl::post_session_stats()
│ │ │ │ +	{
│ │ │ │ +		if (!m_posted_stats_header)
│ │ │ │ +		{
│ │ │ │ +			m_posted_stats_header = true;
│ │ │ │ +			m_alerts.emplace_alert&lt;session_stats_header_alert&gt;();
│ │ │ │ +		}
│ │ │ │ +		m_disk_thread-&gt;update_stats_counters(m_stats_counters);
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_DHT
│ │ │ │ +		if (m_dht)
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(238)">../src/session_impl.cpp:5161</a></td><td>factor out this logic into a separate function for unit testing</td></tr><tr id="238" style="display: none;" colspan="3"><td colspan="3"><h2>factor out this logic into a separate function for unit
│ │ │ │ +testing</h2><h4>../src/session_impl.cpp:5161</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		if (m_settings.get_int(settings_pack::outgoing_port) &gt; 0)
│ │ │ │ +		{
│ │ │ │ +#ifdef TORRENT_WINDOWS
│ │ │ │ +			s.set_option(exclusive_address_use(true), ec);
│ │ │ │ +#else
│ │ │ │ +			s.set_option(tcp::acceptor::reuse_address(true), ec);
│ │ │ │ +#endif
│ │ │ │ +			// ignore errors because the underlying socket may not
│ │ │ │ +			// be opened yet. This happens when we're routing through
│ │ │ │ +			// a proxy. In that case, we don't yet know the address of
│ │ │ │ +			// the proxy server, and more importantly, we don't know
│ │ │ │ +			// the address family of its address. This means we can't
│ │ │ │ +			// open the socket yet. The socks abstraction layer defers
│ │ │ │ +			// opening it.
│ │ │ │ +			ec.clear();
│ │ │ │ +			bind_ep.port(std::uint16_t(next_port()));
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ +		if (is_utp(s))
│ │ │ │ +		{
│ │ │ │  <div style="background: #ffff00" width="100%">
│ │ │ │ -</div>namespace aux {
│ │ │ │ +</div>			utp_socket_impl* impl = nullptr;
│ │ │ │ +			transport ssl = transport::plaintext;
│ │ │ │ +#if TORRENT_USE_SSL
│ │ │ │ +			if (boost::get&lt;ssl_stream&lt;utp_stream&gt;&gt;(&amp;s) != nullptr)
│ │ │ │ +			{
│ │ │ │ +				impl = boost::get&lt;ssl_stream&lt;utp_stream&gt;&gt;(s).next_layer().get_impl();
│ │ │ │ +				ssl = transport::ssl;
│ │ │ │ +			}
│ │ │ │ +			else
│ │ │ │ +#endif
│ │ │ │ +				impl = boost::get&lt;utp_stream&gt;(s).get_impl();
│ │ │ │  
│ │ │ │ -	// returns whether this add_torrent_params object has "resume-data", i.e.
│ │ │ │ -	// information about which pieces we have.
│ │ │ │ -	bool contains_resume_data(add_torrent_params const&amp; atp)
│ │ │ │ +			std::vector&lt;std::shared_ptr&lt;listen_socket_t&gt;&gt; with_gateways;
│ │ │ │ +			std::shared_ptr&lt;listen_socket_t&gt; match;
│ │ │ │ +			for (auto&amp; ls : m_listen_sockets)
│ │ │ │ +			{
│ │ │ │ +				// this is almost, but not quite, like can_route()
│ │ │ │ +				if (!(ls-&gt;flags &amp; listen_socket_t::proxy)
│ │ │ │ +					&amp;&amp; is_v4(ls-&gt;local_endpoint) != remote_address.is_v4())
│ │ │ │ +					continue;
│ │ │ │ +				if (ls-&gt;ssl != ssl) continue;
│ │ │ │ +				if (!(ls-&gt;flags &amp; listen_socket_t::local_network))
│ │ │ │ +					with_gateways.push_back(ls);
│ │ │ │ +
│ │ │ │ +				if (ls-&gt;flags &amp; listen_socket_t::proxy
│ │ │ │ +					|| match_addr_mask(ls-&gt;local_endpoint.address(), remote_address, ls-&gt;netmask))
│ │ │ │ +				{
│ │ │ │ +					// is this better than the previous match?
│ │ │ │ +					match = ls;
│ │ │ │ +				}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(239)">../src/session_impl.cpp:5880</a></td><td>refactor, move the storage to dht_tracker</td></tr><tr id="239" style="display: none;" colspan="3"><td colspan="3"><h2>refactor, move the storage to dht_tracker</h2><h4>../src/session_impl.cpp:5880</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +			session_log("not starting DHT, outstanding router lookups: %d"
│ │ │ │ +				, m_outstanding_router_lookups);
│ │ │ │ +#endif
│ │ │ │ +			return;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		if (m_abort)
│ │ │ │ +		{
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +			session_log("not starting DHT, aborting");
│ │ │ │ +#endif
│ │ │ │ +			return;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		session_log("starting DHT, running: %s, router lookups: %d"
│ │ │ │ +			, m_dht ? "true" : "false", m_outstanding_router_lookups);
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		m_dht_storage = m_dht_storage_constructor(m_settings);
│ │ │ │ +</div>		m_dht = std::make_shared&lt;dht::dht_tracker&gt;(
│ │ │ │ +			static_cast&lt;dht::dht_observer*&gt;(this)
│ │ │ │ +			, m_io_context
│ │ │ │ +			, [this](aux::listen_socket_handle const&amp; sock
│ │ │ │ +				, udp::endpoint const&amp; ep
│ │ │ │ +				, span&lt;char const&gt; p
│ │ │ │ +				, error_code&amp; ec
│ │ │ │ +				, udp_send_flags_t const flags)
│ │ │ │ +				{ send_udp_packet_listen(sock, ep, p, ec, flags); }
│ │ │ │ +			, m_settings
│ │ │ │ +			, m_stats_counters
│ │ │ │ +			, *m_dht_storage
│ │ │ │ +			, std::move(m_dht_state));
│ │ │ │ +
│ │ │ │ +		for (auto&amp; s : m_listen_sockets)
│ │ │ │ +		{
│ │ │ │ +			if (s-&gt;ssl != transport::ssl
│ │ │ │ +				&amp;&amp; !(s-&gt;flags &amp; listen_socket_t::local_network))
│ │ │ │ +			{
│ │ │ │ +				m_dht-&gt;new_socket(s);
│ │ │ │ +			}
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		for (auto const&amp; n : m_dht_router_nodes)
│ │ │ │ +		{
│ │ │ │ +			m_dht-&gt;add_router_node(n);
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		for (auto const&amp; n : m_dht_nodes)
│ │ │ │ +		{
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(240)">../src/session_impl.cpp:6267</a></td><td>asserts that no outstanding async operations are still in flight</td></tr><tr id="240" style="display: none;" colspan="3"><td colspan="3"><h2>asserts that no outstanding async operations are still in flight</h2><h4>../src/session_impl.cpp:6267</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		if (!m_dht) return;
│ │ │ │ +		m_dht-&gt;direct_request(ep, e, std::bind(&amp;on_direct_response, std::ref(m_alerts), userdata, _1));
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	bool session_impl::is_listening() const
│ │ │ │  	{
│ │ │ │ -		return !atp.have_pieces.empty()
│ │ │ │ -			|| (atp.flags &amp; torrent_flags::seed_mode);
│ │ │ │ +		return !m_listen_sockets.empty();
│ │ │ │  	}
│ │ │ │ -}
│ │ │ │  
│ │ │ │ -}
│ │ │ │ +	session_impl::~session_impl()
│ │ │ │ +	{
│ │ │ │ +		// since we're destructing the session, no more alerts will make it out to
│ │ │ │ +		// the user. So stop posting them now
│ │ │ │ +		m_alerts.set_alert_mask({});
│ │ │ │ +		m_alerts.set_notify_function({});
│ │ │ │ +
│ │ │ │ +		// this is not allowed to be the network thread!
│ │ │ │ +//		TORRENT_ASSERT(is_not_thread());
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>		// this can happen if we end the io_context run loop with an exception
│ │ │ │ +		m_connections.clear();
│ │ │ │ +		for (auto&amp; t : m_torrents)
│ │ │ │ +		{
│ │ │ │ +			t-&gt;panic();
│ │ │ │ +			t-&gt;abort();
│ │ │ │ +		}
│ │ │ │ +		m_torrents.clear();
│ │ │ │ +
│ │ │ │ +		// this has probably been called already, but in case of sudden
│ │ │ │ +		// termination through an exception, it may not have been done
│ │ │ │ +		abort_stage2();
│ │ │ │ +
│ │ │ │ +#if defined TORRENT_ASIO_DEBUGGING
│ │ │ │ +		FILE* f = fopen("wakeups.log", "w+");
│ │ │ │ +		if (f != nullptr)
│ │ │ │ +		{
│ │ │ │ +			time_point m = min_time();
│ │ │ │ +			if (!_wakeups.empty()) m = _wakeups[0].timestamp;
│ │ │ │ +			time_point prev = m;
│ │ │ │ +			std::uint64_t prev_csw = 0;
│ │ │ │ +			if (!_wakeups.empty()) prev_csw = _wakeups[0].context_switches;
│ │ │ │ +			std::fprintf(f, "abs. time\trel. time\tctx switch\tidle-wakeup\toperation\n");
│ │ │ │ +			for (wakeup_t const&amp; w : _wakeups)
│ │ │ │ +			{
│ │ │ │ +				bool const idle_wakeup = w.context_switches &gt; prev_csw;
│ │ │ │ +				std::fprintf(f, "%" PRId64 "\t%" PRId64 "\t%" PRId64 "\t%c\t%s\n"
│ │ │ │ +					, total_microseconds(w.timestamp - m)
│ │ │ │ +					, total_microseconds(w.timestamp - prev)
│ │ │ │ +					, w.context_switches
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(241)">../src/packet_buffer.cpp:157</a></td><td>use compare_less_wrap for this comparison as well</td></tr><tr id="241" style="display: none;" colspan="3"><td colspan="3"><h2>use compare_less_wrap for this comparison as well</h2><h4>../src/packet_buffer.cpp:157</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	{
│ │ │ │ +		INVARIANT_CHECK;
│ │ │ │ +		TORRENT_ASSERT_VAL(size &lt;= 0xffff, size);
│ │ │ │ +		std::uint32_t new_size = m_capacity == 0 ? 16 : m_capacity;
│ │ │ │ +
│ │ │ │ +		while (new_size &lt; size)
│ │ │ │ +			new_size &lt;&lt;= 1;
│ │ │ │ +
│ │ │ │ +		aux::unique_ptr&lt;packet_ptr[], index_type&gt; new_storage(new packet_ptr[new_size]);
│ │ │ │ +
│ │ │ │ +		for (index_type i = m_first; i &lt; (m_first + m_capacity); ++i)
│ │ │ │ +			new_storage[i &amp; (new_size - 1)] = std::move(m_storage[i &amp; (m_capacity - 1)]);
│ │ │ │ +
│ │ │ │ +		m_storage = std::move(new_storage);
│ │ │ │ +		m_capacity = new_size;
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	packet_ptr packet_buffer::remove(index_type idx)
│ │ │ │ +	{
│ │ │ │ +		INVARIANT_CHECK;
│ │ │ │ +<div style="background: #ffff00" width="100%">		if (idx &gt;= m_first + m_capacity)
│ │ │ │ +</div>			return packet_ptr();
│ │ │ │ +
│ │ │ │ +		if (compare_less_wrap(idx, m_first, 0xffff))
│ │ │ │ +			return packet_ptr();
│ │ │ │ +
│ │ │ │ +		std::size_t const mask = m_capacity - 1;
│ │ │ │ +		packet_ptr old_value = std::move(m_storage[idx &amp; mask]);
│ │ │ │ +		m_storage[idx &amp; mask].reset();
│ │ │ │ +
│ │ │ │ +		if (old_value)
│ │ │ │ +		{
│ │ │ │ +			--m_size;
│ │ │ │ +			if (m_size == 0) m_last = m_first;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		if (idx == m_first &amp;&amp; m_size != 0)
│ │ │ │ +		{
│ │ │ │ +			++m_first;
│ │ │ │ +			for (index_type i = 0; i &lt; m_capacity; ++i, ++m_first)
│ │ │ │ +				if (m_storage[m_first &amp; mask]) break;
│ │ │ │ +			m_first &amp;= 0xffff;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		if (((idx + 1) &amp; 0xffff) == m_last &amp;&amp; m_size != 0)
│ │ │ │ +		{
│ │ │ │ +			--m_last;
│ │ │ │ +			for (index_type i = 0; i &lt; m_capacity; ++i, --m_last)
│ │ │ │ +				if (m_storage[m_last &amp; mask]) break;
│ │ │ │ +			++m_last;
│ │ │ │ +			m_last &amp;= 0xffff;
│ │ │ │  </pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(242)">../src/kademlia/node.cpp:1177</a></td><td>keep the returned value to pass as a limit to write_nodes_entries when implemented</td></tr><tr id="242" style="display: none;" colspan="3"><td colspan="3"><h2>keep the returned value to pass as a limit
│ │ │ │  to write_nodes_entries when implemented</h2><h4>../src/kademlia/node.cpp:1177</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		}
│ │ │ │  	}
│ │ │ │  	else if (query == "sample_infohashes")
│ │ │ │  	{
│ │ │ │  		static key_desc_t const msg_desc[] = {
│ │ │ │  			{"target", bdecode_node::string_t, 20, 0},
│ │ │ │ @@ -9997,15 +9997,157 @@
│ │ │ │  		std::vector&lt;node_entry&gt; const n = wanted_node-&gt;m_table.find_node(info_hash, {});
│ │ │ │  		r[wanted_node-&gt;protocol_nodes_key()] = write_nodes_entry(n);
│ │ │ │  	}
│ │ │ │  }
│ │ │ │  
│ │ │ │  node::protocol_descriptor const&amp; node::map_protocol_to_descriptor(udp const protocol)
│ │ │ │  {
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(244)">../src/kademlia/put_data.cpp:92</a></td><td>what if o is not an instance of put_data_observer? This need to be redesigned for better type safety.</td></tr><tr id="244" style="display: none;" colspan="3"><td colspan="3"><h2>what if o is not an instance of put_data_observer? This need to be
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(244)">../src/kademlia/routing_table.cpp:289</a></td><td>This is temporary. For now, only report the largest routing table (of potentially multiple ones, for multi-homed systems) in next major version, break the ABI and support reporting all of them in the dht_stats_alert</td></tr><tr id="244" style="display: none;" colspan="3"><td colspan="3"><h2>This is temporary. For now, only report the largest routing table
│ │ │ │ +(of potentially multiple ones, for multi-homed systems)
│ │ │ │ +in next major version, break the ABI and support reporting all of them in
│ │ │ │ +the dht_stats_alert</h2><h4>../src/kademlia/routing_table.cpp:289</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	, m_bucket_size(bucket_size)
│ │ │ │ +{
│ │ │ │ +	// bucket sizes must be a power of 2
│ │ │ │ +	TORRENT_ASSERT_VAL(((bucket_size - 1) &amp; bucket_size) == 0, bucket_size);
│ │ │ │ +	TORRENT_UNUSED(log);
│ │ │ │ +	m_buckets.reserve(30);
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +int routing_table::bucket_limit(int bucket) const
│ │ │ │ +{
│ │ │ │ +	if (!m_settings.get_bool(settings_pack::dht_extended_routing_table)) return m_bucket_size;
│ │ │ │ +
│ │ │ │ +	static const aux::array&lt;int, 4&gt; size_exceptions{{{16, 8, 4, 2}}};
│ │ │ │ +	if (bucket &lt; size_exceptions.end_index())
│ │ │ │ +		return m_bucket_size * size_exceptions[bucket];
│ │ │ │ +	return m_bucket_size;
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +void routing_table::status(std::vector&lt;dht_routing_bucket&gt;&amp; s) const
│ │ │ │ +{
│ │ │ │ +<div style="background: #ffff00" width="100%">	if (s.size() &gt; m_buckets.size()) return;
│ │ │ │ +</div>	s.clear();
│ │ │ │ +	for (auto const&amp; i : m_buckets)
│ │ │ │ +	{
│ │ │ │ +		dht_routing_bucket b;
│ │ │ │ +		b.num_nodes = int(i.live_nodes.size());
│ │ │ │ +		b.num_replacements = int(i.replacements.size());
│ │ │ │ +		s.push_back(b);
│ │ │ │ +	}
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(245)">../src/kademlia/routing_table.cpp:314</a></td><td>arvidn note when it's across IPv4 and IPv6, adding (dht_global_nodes) would make sense. in the future though, where we may have one DHT node per external interface (which may be multiple of the same address family), then it becomes a bit trickier</td></tr><tr id="245" style="display: none;" colspan="3"><td colspan="3"><h2>arvidn note
│ │ │ │ +when it's across IPv4 and IPv6, adding (dht_global_nodes) would
│ │ │ │ +make sense. in the future though, where we may have one DHT node
│ │ │ │ +per external interface (which may be multiple of the same address
│ │ │ │ +family), then it becomes a bit trickier</h2><h4>../src/kademlia/routing_table.cpp:314</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	if (s.size() &gt; m_buckets.size()) return;
│ │ │ │ +	s.clear();
│ │ │ │ +	for (auto const&amp; i : m_buckets)
│ │ │ │ +	{
│ │ │ │ +		dht_routing_bucket b;
│ │ │ │ +		b.num_nodes = int(i.live_nodes.size());
│ │ │ │ +		b.num_replacements = int(i.replacements.size());
│ │ │ │ +		s.push_back(b);
│ │ │ │ +	}
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │ +void routing_table::status(session_status&amp; s) const
│ │ │ │ +{
│ │ │ │ +	int dht_nodes;
│ │ │ │ +	int dht_node_cache;
│ │ │ │ +	int ignore;
│ │ │ │ +	std::tie(dht_nodes, dht_node_cache, ignore) = size();
│ │ │ │ +	s.dht_nodes += dht_nodes;
│ │ │ │ +	s.dht_node_cache += dht_node_cache;
│ │ │ │ +<div style="background: #ffff00" width="100%">	s.dht_global_nodes += num_global_nodes();
│ │ │ │ +</div>
│ │ │ │ +	for (auto const&amp; i : m_buckets)
│ │ │ │ +	{
│ │ │ │ +		dht_routing_bucket b;
│ │ │ │ +		b.num_nodes = int(i.live_nodes.size());
│ │ │ │ +		b.num_replacements = int(i.replacements.size());
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │ +		b.last_active = 0;
│ │ │ │ +#endif
│ │ │ │ +		s.dht_routing_table.push_back(b);
│ │ │ │ +	}
│ │ │ │ +}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +std::tuple&lt;int, int, int&gt; routing_table::size() const
│ │ │ │ +{
│ │ │ │ +	int nodes = 0;
│ │ │ │ +	int replacements = 0;
│ │ │ │ +	int confirmed = 0;
│ │ │ │ +	for (auto const&amp; i : m_buckets)
│ │ │ │ +	{
│ │ │ │ +		nodes += int(i.live_nodes.size());
│ │ │ │ +		confirmed += static_cast&lt;int&gt;(std::count_if(i.live_nodes.begin(), i.live_nodes.end()
│ │ │ │ +			, [](node_entry const&amp; k) { return k.confirmed(); } ));
│ │ │ │ +
│ │ │ │ +		replacements += int(i.replacements.size());
│ │ │ │ +	}
│ │ │ │ +	return std::make_tuple(nodes, replacements, confirmed);
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(246)">../src/kademlia/routing_table.cpp:518</a></td><td>this need to take bucket "prefix" into account. It should be unified with add_node_impl()</td></tr><tr id="246" style="display: none;" colspan="3"><td colspan="3"><h2>this need to take bucket "prefix" into account. It should be unified
│ │ │ │ +with add_node_impl()</h2><h4>../src/kademlia/routing_table.cpp:518</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">{
│ │ │ │ +	for (auto i = m_buckets.begin() , end(m_buckets.end()); i != end; ++i)
│ │ │ │ +	{
│ │ │ │ +		for (auto j = i-&gt;replacements.begin(); j != i-&gt;replacements.end(); ++j)
│ │ │ │ +		{
│ │ │ │ +			if (j-&gt;addr() != ep.address()) continue;
│ │ │ │ +			if (j-&gt;port() != ep.port()) continue;
│ │ │ │ +			return std::make_tuple(&amp;*j, i, &amp;i-&gt;replacements);
│ │ │ │ +		}
│ │ │ │ +		for (auto j = i-&gt;live_nodes.begin(); j != i-&gt;live_nodes.end(); ++j)
│ │ │ │ +		{
│ │ │ │ +			if (j-&gt;addr() != ep.address()) continue;
│ │ │ │ +			if (j-&gt;port() != ep.port()) continue;
│ │ │ │ +			return std::make_tuple(&amp;*j, i, &amp;i-&gt;live_nodes);
│ │ │ │ +		}
│ │ │ │ +	}
│ │ │ │ +	return std::tuple&lt;node_entry*, routing_table::table_t::iterator, bucket_t*&gt;
│ │ │ │ +	{nullptr, m_buckets.end(), nullptr};
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">void routing_table::fill_from_replacements(table_t::iterator bucket)
│ │ │ │ +</div>{
│ │ │ │ +	bucket_t&amp; b = bucket-&gt;live_nodes;
│ │ │ │ +	bucket_t&amp; rb = bucket-&gt;replacements;
│ │ │ │ +	int const bucket_size = bucket_limit(int(std::distance(m_buckets.begin(), bucket)));
│ │ │ │ +
│ │ │ │ +	if (int(b.size()) &gt;= bucket_size) return;
│ │ │ │ +
│ │ │ │ +	// sort by RTT first, to find the node with the lowest
│ │ │ │ +	// RTT that is pinged
│ │ │ │ +	std::sort(rb.begin(), rb.end());
│ │ │ │ +
│ │ │ │ +	while (int(b.size()) &lt; bucket_size &amp;&amp; !rb.empty())
│ │ │ │ +	{
│ │ │ │ +		auto j = std::find_if(rb.begin(), rb.end(), std::bind(&amp;node_entry::pinged, _1));
│ │ │ │ +		if (j == rb.end()) break;
│ │ │ │ +		b.push_back(*j);
│ │ │ │ +		rb.erase(j);
│ │ │ │ +	}
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +void routing_table::prune_empty_bucket()
│ │ │ │ +{
│ │ │ │ +	if (m_buckets.back().live_nodes.empty()
│ │ │ │ +		&amp;&amp; m_buckets.back().replacements.empty())
│ │ │ │ +	{
│ │ │ │ +		m_buckets.erase(m_buckets.end() - 1);
│ │ │ │ +	}
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +void routing_table::remove_node(node_entry* n, bucket_t* b)
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(247)">../src/kademlia/put_data.cpp:92</a></td><td>what if o is not an instance of put_data_observer? This need to be redesigned for better type safety.</td></tr><tr id="247" style="display: none;" colspan="3"><td colspan="3"><h2>what if o is not an instance of put_data_observer? This need to be
│ │ │ │  redesigned for better type safety.</h2><h4>../src/kademlia/put_data.cpp:92</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	}
│ │ │ │  }
│ │ │ │  
│ │ │ │  void put_data::done()
│ │ │ │  {
│ │ │ │  	m_done = true;
│ │ │ │  
│ │ │ │ @@ -10043,15 +10185,15 @@
│ │ │ │  
│ │ │ │  	m_node.stats_counters().inc_stats_counter(counters::dht_put_out);
│ │ │ │  
│ │ │ │  	return m_node.m_rpc.invoke(e, o-&gt;target_ep(), o);
│ │ │ │  }
│ │ │ │  
│ │ │ │  } } // namespace libtorrent::dht
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(245)">../src/kademlia/node_id.cpp:66</a></td><td>it's a little bit weird to return 159 - leading zeroes. It should probably be 160 - leading zeroes, but all other code in here is tuned to this expectation now, and it doesn't really matter (other than complexity)</td></tr><tr id="245" style="display: none;" colspan="3"><td colspan="3"><h2>it's a little bit weird to return 159 - leading zeroes. It should
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(248)">../src/kademlia/node_id.cpp:66</a></td><td>it's a little bit weird to return 159 - leading zeroes. It should probably be 160 - leading zeroes, but all other code in here is tuned to this expectation now, and it doesn't really matter (other than complexity)</td></tr><tr id="248" style="display: none;" colspan="3"><td colspan="3"><h2>it's a little bit weird to return 159 - leading zeroes. It should
│ │ │ │  probably be 160 - leading zeroes, but all other code in here is tuned to
│ │ │ │  this expectation now, and it doesn't really matter (other than complexity)</h2><h4>../src/kademlia/node_id.cpp:66</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  // returns the distance between the two nodes
│ │ │ │  // using the kademlia XOR-metric
│ │ │ │  node_id distance(node_id const&amp; n1, node_id const&amp; n2)
│ │ │ │  {
│ │ │ │  	return n1 ^ n2;
│ │ │ │ @@ -10096,66 +10238,15 @@
│ │ │ │  
│ │ │ │  	address_v4::bytes_type b4{};
│ │ │ │  	address_v6::bytes_type b6{};
│ │ │ │  	if (ip_.is_v6())
│ │ │ │  	{
│ │ │ │  		b6 = ip_.to_v6().to_bytes();
│ │ │ │  		ip = b6.data();
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(246)">../src/kademlia/dht_tracker.cpp:317</a></td><td>pick the closest node rather than the first</td></tr><tr id="246" style="display: none;" colspan="3"><td colspan="3"><h2>pick the closest node rather than the first</h2><h4>../src/kademlia/dht_tracker.cpp:317</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ -		m_log-&gt;log(dht_logger::tracker, "*** new write key*** %d nodes"
│ │ │ │ -			, int(m_nodes.size()));
│ │ │ │ -#endif
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void dht_tracker::update_storage_node_ids()
│ │ │ │ -	{
│ │ │ │ -		std::vector&lt;sha1_hash&gt; ids;
│ │ │ │ -		for (auto&amp; n : m_nodes)
│ │ │ │ -			ids.push_back(n.second.dht.nid());
│ │ │ │ -		m_storage.update_node_ids(ids);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	node* dht_tracker::get_node(node_id const&amp; id, std::string const&amp; family_name)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_UNUSED(id);
│ │ │ │ -		for (auto&amp; n : m_nodes)
│ │ │ │ -		{
│ │ │ │ -<div style="background: #ffff00" width="100%">			if (n.second.dht.protocol_family_name() == family_name)
│ │ │ │ -</div>				return &amp;n.second.dht;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		return nullptr;
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void dht_tracker::get_peers(sha1_hash const&amp; ih
│ │ │ │ -		, std::function&lt;void(std::vector&lt;tcp::endpoint&gt; const&amp;)&gt; f)
│ │ │ │ -	{
│ │ │ │ -		for (auto&amp; n : m_nodes)
│ │ │ │ -			n.second.dht.get_peers(ih, f, {}, {});
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void dht_tracker::announce(sha1_hash const&amp; ih, int listen_port
│ │ │ │ -		, announce_flags_t const flags
│ │ │ │ -		, std::function&lt;void(std::vector&lt;tcp::endpoint&gt; const&amp;)&gt; f)
│ │ │ │ -	{
│ │ │ │ -		for (auto&amp; n : m_nodes)
│ │ │ │ -			n.second.dht.announce(ih, listen_port, flags, f);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void dht_tracker::sample_infohashes(udp::endpoint const&amp; ep, sha1_hash const&amp; target
│ │ │ │ -		, std::function&lt;void(node_id
│ │ │ │ -			, time_duration
│ │ │ │ -			, int, std::vector&lt;sha1_hash&gt;
│ │ │ │ -			, std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt;)&gt; f)
│ │ │ │ -	{
│ │ │ │ -		for (auto&amp; n : m_nodes)
│ │ │ │ -		{
│ │ │ │ -			if (ep.protocol() != (n.first.get_external_address().is_v4() ? udp::v4() : udp::v6()))
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(247)">../src/kademlia/item.cpp:143</a></td><td>implement ctor for entry from bdecode_node?</td></tr><tr id="247" style="display: none;" colspan="3"><td colspan="3"><h2>implement ctor for entry from bdecode_node?</h2><h4>../src/kademlia/item.cpp:143</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	, secret_key const&amp; sk)
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(249)">../src/kademlia/item.cpp:143</a></td><td>implement ctor for entry from bdecode_node?</td></tr><tr id="249" style="display: none;" colspan="3"><td colspan="3"><h2>implement ctor for entry from bdecode_node?</h2><h4>../src/kademlia/item.cpp:143</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	, secret_key const&amp; sk)
│ │ │ │  {
│ │ │ │  	char str[1200];
│ │ │ │  	int const len = canonical_string(v, seq, salt, str);
│ │ │ │  
│ │ │ │  	return ed25519_sign({str, len}, pk, sk);
│ │ │ │  }
│ │ │ │  
│ │ │ │ @@ -10198,156 +10289,65 @@
│ │ │ │  	m_pk = pk;
│ │ │ │  	m_seq = seq;
│ │ │ │  	m_mutable = true;
│ │ │ │  	m_value = std::move(v);
│ │ │ │  }
│ │ │ │  
│ │ │ │  void item::assign(bdecode_node const&amp; v)
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(248)">../src/kademlia/routing_table.cpp:289</a></td><td>This is temporary. For now, only report the largest routing table (of potentially multiple ones, for multi-homed systems) in next major version, break the ABI and support reporting all of them in the dht_stats_alert</td></tr><tr id="248" style="display: none;" colspan="3"><td colspan="3"><h2>This is temporary. For now, only report the largest routing table
│ │ │ │ -(of potentially multiple ones, for multi-homed systems)
│ │ │ │ -in next major version, break the ABI and support reporting all of them in
│ │ │ │ -the dht_stats_alert</h2><h4>../src/kademlia/routing_table.cpp:289</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	, m_bucket_size(bucket_size)
│ │ │ │ -{
│ │ │ │ -	// bucket sizes must be a power of 2
│ │ │ │ -	TORRENT_ASSERT_VAL(((bucket_size - 1) &amp; bucket_size) == 0, bucket_size);
│ │ │ │ -	TORRENT_UNUSED(log);
│ │ │ │ -	m_buckets.reserve(30);
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -int routing_table::bucket_limit(int bucket) const
│ │ │ │ -{
│ │ │ │ -	if (!m_settings.get_bool(settings_pack::dht_extended_routing_table)) return m_bucket_size;
│ │ │ │ -
│ │ │ │ -	static const aux::array&lt;int, 4&gt; size_exceptions{{{16, 8, 4, 2}}};
│ │ │ │ -	if (bucket &lt; size_exceptions.end_index())
│ │ │ │ -		return m_bucket_size * size_exceptions[bucket];
│ │ │ │ -	return m_bucket_size;
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -void routing_table::status(std::vector&lt;dht_routing_bucket&gt;&amp; s) const
│ │ │ │ -{
│ │ │ │ -<div style="background: #ffff00" width="100%">	if (s.size() &gt; m_buckets.size()) return;
│ │ │ │ -</div>	s.clear();
│ │ │ │ -	for (auto const&amp; i : m_buckets)
│ │ │ │ -	{
│ │ │ │ -		dht_routing_bucket b;
│ │ │ │ -		b.num_nodes = int(i.live_nodes.size());
│ │ │ │ -		b.num_replacements = int(i.replacements.size());
│ │ │ │ -		s.push_back(b);
│ │ │ │ -	}
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(249)">../src/kademlia/routing_table.cpp:314</a></td><td>arvidn note when it's across IPv4 and IPv6, adding (dht_global_nodes) would make sense. in the future though, where we may have one DHT node per external interface (which may be multiple of the same address family), then it becomes a bit trickier</td></tr><tr id="249" style="display: none;" colspan="3"><td colspan="3"><h2>arvidn note
│ │ │ │ -when it's across IPv4 and IPv6, adding (dht_global_nodes) would
│ │ │ │ -make sense. in the future though, where we may have one DHT node
│ │ │ │ -per external interface (which may be multiple of the same address
│ │ │ │ -family), then it becomes a bit trickier</h2><h4>../src/kademlia/routing_table.cpp:314</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	if (s.size() &gt; m_buckets.size()) return;
│ │ │ │ -	s.clear();
│ │ │ │ -	for (auto const&amp; i : m_buckets)
│ │ │ │ -	{
│ │ │ │ -		dht_routing_bucket b;
│ │ │ │ -		b.num_nodes = int(i.live_nodes.size());
│ │ │ │ -		b.num_replacements = int(i.replacements.size());
│ │ │ │ -		s.push_back(b);
│ │ │ │ -	}
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ -void routing_table::status(session_status&amp; s) const
│ │ │ │ -{
│ │ │ │ -	int dht_nodes;
│ │ │ │ -	int dht_node_cache;
│ │ │ │ -	int ignore;
│ │ │ │ -	std::tie(dht_nodes, dht_node_cache, ignore) = size();
│ │ │ │ -	s.dht_nodes += dht_nodes;
│ │ │ │ -	s.dht_node_cache += dht_node_cache;
│ │ │ │ -<div style="background: #ffff00" width="100%">	s.dht_global_nodes += num_global_nodes();
│ │ │ │ -</div>
│ │ │ │ -	for (auto const&amp; i : m_buckets)
│ │ │ │ -	{
│ │ │ │ -		dht_routing_bucket b;
│ │ │ │ -		b.num_nodes = int(i.live_nodes.size());
│ │ │ │ -		b.num_replacements = int(i.replacements.size());
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ -		b.last_active = 0;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(250)">../src/kademlia/dht_tracker.cpp:317</a></td><td>pick the closest node rather than the first</td></tr><tr id="250" style="display: none;" colspan="3"><td colspan="3"><h2>pick the closest node rather than the first</h2><h4>../src/kademlia/dht_tracker.cpp:317</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
│ │ │ │ +		m_log-&gt;log(dht_logger::tracker, "*** new write key*** %d nodes"
│ │ │ │ +			, int(m_nodes.size()));
│ │ │ │  #endif
│ │ │ │ -		s.dht_routing_table.push_back(b);
│ │ │ │  	}
│ │ │ │ -}
│ │ │ │ -#endif
│ │ │ │  
│ │ │ │ -std::tuple&lt;int, int, int&gt; routing_table::size() const
│ │ │ │ -{
│ │ │ │ -	int nodes = 0;
│ │ │ │ -	int replacements = 0;
│ │ │ │ -	int confirmed = 0;
│ │ │ │ -	for (auto const&amp; i : m_buckets)
│ │ │ │ +	void dht_tracker::update_storage_node_ids()
│ │ │ │  	{
│ │ │ │ -		nodes += int(i.live_nodes.size());
│ │ │ │ -		confirmed += static_cast&lt;int&gt;(std::count_if(i.live_nodes.begin(), i.live_nodes.end()
│ │ │ │ -			, [](node_entry const&amp; k) { return k.confirmed(); } ));
│ │ │ │ -
│ │ │ │ -		replacements += int(i.replacements.size());
│ │ │ │ +		std::vector&lt;sha1_hash&gt; ids;
│ │ │ │ +		for (auto&amp; n : m_nodes)
│ │ │ │ +			ids.push_back(n.second.dht.nid());
│ │ │ │ +		m_storage.update_node_ids(ids);
│ │ │ │  	}
│ │ │ │ -	return std::make_tuple(nodes, replacements, confirmed);
│ │ │ │ -}
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(250)">../src/kademlia/routing_table.cpp:518</a></td><td>this need to take bucket "prefix" into account. It should be unified with add_node_impl()</td></tr><tr id="250" style="display: none;" colspan="3"><td colspan="3"><h2>this need to take bucket "prefix" into account. It should be unified
│ │ │ │ -with add_node_impl()</h2><h4>../src/kademlia/routing_table.cpp:518</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">{
│ │ │ │ -	for (auto i = m_buckets.begin() , end(m_buckets.end()); i != end; ++i)
│ │ │ │ +	node* dht_tracker::get_node(node_id const&amp; id, std::string const&amp; family_name)
│ │ │ │  	{
│ │ │ │ -		for (auto j = i-&gt;replacements.begin(); j != i-&gt;replacements.end(); ++j)
│ │ │ │ -		{
│ │ │ │ -			if (j-&gt;addr() != ep.address()) continue;
│ │ │ │ -			if (j-&gt;port() != ep.port()) continue;
│ │ │ │ -			return std::make_tuple(&amp;*j, i, &amp;i-&gt;replacements);
│ │ │ │ -		}
│ │ │ │ -		for (auto j = i-&gt;live_nodes.begin(); j != i-&gt;live_nodes.end(); ++j)
│ │ │ │ +		TORRENT_UNUSED(id);
│ │ │ │ +		for (auto&amp; n : m_nodes)
│ │ │ │  		{
│ │ │ │ -			if (j-&gt;addr() != ep.address()) continue;
│ │ │ │ -			if (j-&gt;port() != ep.port()) continue;
│ │ │ │ -			return std::make_tuple(&amp;*j, i, &amp;i-&gt;live_nodes);
│ │ │ │ +<div style="background: #ffff00" width="100%">			if (n.second.dht.protocol_family_name() == family_name)
│ │ │ │ +</div>				return &amp;n.second.dht;
│ │ │ │  		}
│ │ │ │ -	}
│ │ │ │ -	return std::tuple&lt;node_entry*, routing_table::table_t::iterator, bucket_t*&gt;
│ │ │ │ -	{nullptr, m_buckets.end(), nullptr};
│ │ │ │ -}
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">void routing_table::fill_from_replacements(table_t::iterator bucket)
│ │ │ │ -</div>{
│ │ │ │ -	bucket_t&amp; b = bucket-&gt;live_nodes;
│ │ │ │ -	bucket_t&amp; rb = bucket-&gt;replacements;
│ │ │ │ -	int const bucket_size = bucket_limit(int(std::distance(m_buckets.begin(), bucket)));
│ │ │ │ -
│ │ │ │ -	if (int(b.size()) &gt;= bucket_size) return;
│ │ │ │ -
│ │ │ │ -	// sort by RTT first, to find the node with the lowest
│ │ │ │ -	// RTT that is pinged
│ │ │ │ -	std::sort(rb.begin(), rb.end());
│ │ │ │ +		return nullptr;
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -	while (int(b.size()) &lt; bucket_size &amp;&amp; !rb.empty())
│ │ │ │ +	void dht_tracker::get_peers(sha1_hash const&amp; ih
│ │ │ │ +		, std::function&lt;void(std::vector&lt;tcp::endpoint&gt; const&amp;)&gt; f)
│ │ │ │  	{
│ │ │ │ -		auto j = std::find_if(rb.begin(), rb.end(), std::bind(&amp;node_entry::pinged, _1));
│ │ │ │ -		if (j == rb.end()) break;
│ │ │ │ -		b.push_back(*j);
│ │ │ │ -		rb.erase(j);
│ │ │ │ +		for (auto&amp; n : m_nodes)
│ │ │ │ +			n.second.dht.get_peers(ih, f, {}, {});
│ │ │ │  	}
│ │ │ │ -}
│ │ │ │  
│ │ │ │ -void routing_table::prune_empty_bucket()
│ │ │ │ -{
│ │ │ │ -	if (m_buckets.back().live_nodes.empty()
│ │ │ │ -		&amp;&amp; m_buckets.back().replacements.empty())
│ │ │ │ +	void dht_tracker::announce(sha1_hash const&amp; ih, int listen_port
│ │ │ │ +		, announce_flags_t const flags
│ │ │ │ +		, std::function&lt;void(std::vector&lt;tcp::endpoint&gt; const&amp;)&gt; f)
│ │ │ │  	{
│ │ │ │ -		m_buckets.erase(m_buckets.end() - 1);
│ │ │ │ +		for (auto&amp; n : m_nodes)
│ │ │ │ +			n.second.dht.announce(ih, listen_port, flags, f);
│ │ │ │  	}
│ │ │ │ -}
│ │ │ │  
│ │ │ │ -void routing_table::remove_node(node_entry* n, bucket_t* b)
│ │ │ │ +	void dht_tracker::sample_infohashes(udp::endpoint const&amp; ep, sha1_hash const&amp; target
│ │ │ │ +		, std::function&lt;void(node_id
│ │ │ │ +			, time_duration
│ │ │ │ +			, int, std::vector&lt;sha1_hash&gt;
│ │ │ │ +			, std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt;)&gt; f)
│ │ │ │ +	{
│ │ │ │ +		for (auto&amp; n : m_nodes)
│ │ │ │ +		{
│ │ │ │ +			if (ep.protocol() != (n.first.get_external_address().is_v4() ? udp::v4() : udp::v6()))
│ │ │ │  </pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(251)">../include/libtorrent/torrent_info.hpp:729</a></td><td>change the type to std::shared_ptr<char const> in C++17 it is used as if immutable, it cannot be const for technical reasons right now.</td></tr><tr id="251" style="display: none;" colspan="3"><td colspan="3"><h2>change the type to std::shared_ptr<char const> in C++17
│ │ │ │  it is used as if immutable, it cannot be const for technical reasons
│ │ │ │  right now.</h2><h4>../include/libtorrent/torrent_info.hpp:729</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  		// these are the collections from outside of the info-dict. These are
│ │ │ │  		// owning strings, since we only keep the info-section around, these
│ │ │ │  		// cannot be pointers into that buffer.
│ │ │ │  		std::vector&lt;std::string&gt; m_owned_collections;
│ │ │ │ @@ -10393,144 +10393,116 @@
│ │ │ │  		std::int32_t m_piece_hashes = 0;
│ │ │ │  
│ │ │ │  		// the number of bytes in m_info_section
│ │ │ │  		std::int32_t m_info_section_size = 0;
│ │ │ │  
│ │ │ │  		// this is used when creating a torrent. If there's
│ │ │ │  		// only one file there are cases where it's impossible
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(252)">../include/libtorrent/identify_client.hpp:48</a></td><td>hide this declaration when deprecated functions are disabled, and remove its internal use</td></tr><tr id="252" style="display: none;" colspan="3"><td colspan="3"><h2>hide this declaration when deprecated functions are disabled, and
│ │ │ │ -remove its internal use</h2><h4>../include/libtorrent/identify_client.hpp:48</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
│ │ │ │ -POSSIBILITY OF SUCH DAMAGE.
│ │ │ │ -
│ │ │ │ -*/
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED
│ │ │ │ -#define TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(252)">../include/libtorrent/piece_picker.hpp:823</a></td><td>should this be allocated lazily?</td></tr><tr id="252" style="display: none;" colspan="3"><td colspan="3"><h2>should this be allocated lazily?</h2><h4>../include/libtorrent/piece_picker.hpp:823</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// download list it may live in now
│ │ │ │ +		std::vector&lt;downloading_piece&gt;::iterator update_piece_state(
│ │ │ │ +			std::vector&lt;downloading_piece&gt;::iterator dp);
│ │ │ │  
│ │ │ │ -#include "libtorrent/config.hpp"
│ │ │ │ +	private:
│ │ │ │  
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_push.hpp"
│ │ │ │ -#include &lt;boost/optional.hpp&gt;
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │ +#if TORRENT_USE_ASSERTS || TORRENT_USE_INVARIANT_CHECKS
│ │ │ │ +		index_range&lt;download_queue_t&gt; categories() const
│ │ │ │ +		{ return {{}, piece_picker::piece_pos::num_download_categories}; }
│ │ │ │  #endif
│ │ │ │  
│ │ │ │ -#include "libtorrent/peer_id.hpp"
│ │ │ │ -#include "libtorrent/fingerprint.hpp"
│ │ │ │ +		// the following vectors are mutable because they sometimes may
│ │ │ │ +		// be updated lazily, triggered by const functions
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">namespace libtorrent {
│ │ │ │ +		// this maps indices to number of peers that has this piece and
│ │ │ │ +		// index into the m_piece_info vectors.
│ │ │ │ +		// piece_pos::we_have_index means that we have the piece, so it
│ │ │ │ +		// doesn't exist in the piece_info buckets
│ │ │ │ +		// pieces with the filtered flag set doesn't have entries in
│ │ │ │ +		// the m_piece_info buckets either
│ │ │ │ +<div style="background: #ffff00" width="100%">		mutable aux::vector&lt;piece_pos, piece_index_t&gt; m_piece_map;
│ │ │ │  </div>
│ │ │ │ -namespace aux {
│ │ │ │ -
│ │ │ │ -	TORRENT_EXTRA_EXPORT
│ │ │ │ -	std::string identify_client_impl(const peer_id&amp; p);
│ │ │ │ +		// tracks the number of bytes in a specific piece that are part of a pad
│ │ │ │ +		// file. The padding is assumed to be at the end of the piece, and the
│ │ │ │ +		// blocks covered by the pad bytes are not picked by the piece picker
│ │ │ │ +		std::unordered_map&lt;piece_index_t, int&gt; m_pads_in_piece;
│ │ │ │  
│ │ │ │ -}
│ │ │ │ +		// when the adjacent_piece affinity is enabled, this contains the most
│ │ │ │ +		// recent "extents" of adjacent pieces that have been requested from
│ │ │ │ +		// this is mutable because it's updated by functions to pick pieces, which
│ │ │ │ +		// are const. That's an efficient place to update it, since it's being
│ │ │ │ +		// traversed already.
│ │ │ │ +		mutable std::vector&lt;piece_extent_t&gt; m_recent_extents;
│ │ │ │  
│ │ │ │ -	// these functions don't really need to be public. This mechanism of
│ │ │ │ -	// advertising client software and version is also out-dated.
│ │ │ │ +		// the number of bytes of pad file set in this piece picker
│ │ │ │ +		std::int64_t m_num_pad_bytes = 0;
│ │ │ │  
│ │ │ │ -	// This function can can be used to extract a string describing a client
│ │ │ │ -	// version from its peer-id. It will recognize most clients that have this
│ │ │ │ -	// kind of identification in the peer-id.
│ │ │ │ -	TORRENT_DEPRECATED_EXPORT
│ │ │ │ -	std::string identify_client(const peer_id&amp; p);
│ │ │ │ +		// the number of pad blocks that we already have
│ │ │ │ +		std::int64_t m_have_pad_bytes = 0;
│ │ │ │  
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ +		// the number of pad blocks part of filtered pieces we don't have
│ │ │ │ +		std::int64_t m_filtered_pad_bytes = 0;
│ │ │ │  
│ │ │ │ -#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
│ │ │ │ +		// the number of pad blocks we have that are also filtered
│ │ │ │ +		std::int64_t m_have_filtered_pad_bytes = 0;
│ │ │ │  
│ │ │ │ -	// Returns an optional fingerprint if any can be identified from the peer
│ │ │ │ -	// id. This can be used to automate the identification of clients. It will
│ │ │ │ -	// not be able to identify peers with non- standard encodings. Only Azureus
│ │ │ │ -	// style, Shadow's style and Mainline style.
│ │ │ │ -	TORRENT_DEPRECATED_EXPORT
│ │ │ │ -	boost::optional&lt;fingerprint&gt;
│ │ │ │ -		client_fingerprint(peer_id const&amp; p);
│ │ │ │ +		// the number of seeds. These are not added to
│ │ │ │ +		// the availability counters of the pieces
│ │ │ │ +		int m_seeds = 0;
│ │ │ │  
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(253)">../include/libtorrent/socket_type.hpp:60</a></td><td>move to aux</td></tr><tr id="253" style="display: none;" colspan="3"><td colspan="3"><h2>move to aux</h2><h4>../include/libtorrent/socket_type.hpp:60</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">namespace libtorrent {
│ │ │ │ +		// this vector contains all piece indices that are pickable
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(253)">../include/libtorrent/piece_picker.hpp:895</a></td><td>it would be more intuitive to account "wanted" pieces instead of filtered</td></tr><tr id="253" style="display: none;" colspan="3"><td colspan="3"><h2>it would be more intuitive to account "wanted" pieces
│ │ │ │ +instead of filtered</h2><h4>../include/libtorrent/piece_picker.hpp:895</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +		// this holds the information of the blocks in partially downloaded
│ │ │ │ +		// pieces. the downloading_piece::info index point into this vector for
│ │ │ │ +		// its storage
│ │ │ │ +		aux::vector&lt;block_info&gt; m_block_info;
│ │ │ │  
│ │ │ │ -// A type describing kinds of sockets involved in various operations or events.
│ │ │ │ -enum class socket_type_t : std::uint8_t {
│ │ │ │ -	tcp,
│ │ │ │ -	socks5,
│ │ │ │ -	http,
│ │ │ │ -	utp,
│ │ │ │ -	i2p,
│ │ │ │ -	tcp_ssl,
│ │ │ │ -	socks5_ssl,
│ │ │ │ -	http_ssl,
│ │ │ │ -	utp_ssl,
│ │ │ │ +		// these are block ranges in m_block_info that are free. The numbers
│ │ │ │ +		// in here, when multiplied by blocks_per_piece is the index to the
│ │ │ │ +		// first block in the range that's free to use by a new downloading_piece.
│ │ │ │ +		// this is a free-list.
│ │ │ │ +		std::vector&lt;std::uint16_t&gt; m_free_block_infos;
│ │ │ │  
│ │ │ │ -#if TORRENT_ABI_VERSION &lt;= 2
│ │ │ │ -	udp TORRENT_DEPRECATED_ENUM = utp,
│ │ │ │ -#endif
│ │ │ │ -};
│ │ │ │ +		std::uint16_t m_blocks_in_last_piece = 0;
│ │ │ │ +		int m_piece_size = 0;
│ │ │ │ +		std::int64_t m_total_size = 0;
│ │ │ │  
│ │ │ │ -// return a short human readable name for types of socket
│ │ │ │ -<div style="background: #ffff00" width="100%">char const* socket_type_name(socket_type_t);
│ │ │ │ +		// the number of filtered pieces that we don't already
│ │ │ │ +		// have. total_number_of_pieces - number_of_pieces_we_have
│ │ │ │ +		// - num_filtered is supposed to the number of pieces
│ │ │ │ +		// we still want to download
│ │ │ │ +<div style="background: #ffff00" width="100%">		int m_num_filtered = 0;
│ │ │ │  </div>
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -#endif
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(254)">../include/libtorrent/announce_entry.hpp:76</a></td><td>include the number of peers received from this tracker, at last announce</td></tr><tr id="254" style="display: none;" colspan="3"><td colspan="3"><h2>include the number of peers received from this tracker, at last
│ │ │ │ -announce</h2><h4>../include/libtorrent/announce_entry.hpp:76</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -	struct TORRENT_EXPORT announce_infohash
│ │ │ │ -	{
│ │ │ │ -		// internal
│ │ │ │ -		TORRENT_UNEXPORT announce_infohash();
│ │ │ │ -
│ │ │ │ -		// if this tracker has returned an error or warning message
│ │ │ │ -		// that message is stored here
│ │ │ │ -		std::string message;
│ │ │ │ -
│ │ │ │ -		// if this tracker failed the last time it was contacted
│ │ │ │ -		// this error code specifies what error occurred
│ │ │ │ -		error_code last_error;
│ │ │ │ -
│ │ │ │ -		// the time of next tracker announce
│ │ │ │ -		time_point32 next_announce = (time_point32::min)();
│ │ │ │ +		// the number of pieces we have that also are filtered
│ │ │ │ +		int m_num_have_filtered = 0;
│ │ │ │  
│ │ │ │ -		// no announces before this time
│ │ │ │ -		time_point32 min_announce = (time_point32::min)();
│ │ │ │ +		// we have all pieces in the range [0, m_cursor)
│ │ │ │ +		// m_cursor is the first piece we don't have
│ │ │ │ +		piece_index_t m_cursor{0};
│ │ │ │  
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>		// these are either -1 or the scrape information this tracker last
│ │ │ │ -		// responded with. *incomplete* is the current number of downloaders in
│ │ │ │ -		// the swarm, *complete* is the current number of seeds in the swarm and
│ │ │ │ -		// *downloaded* is the cumulative number of completed downloads of this
│ │ │ │ -		// torrent, since the beginning of time (from this tracker's point of
│ │ │ │ -		// view).
│ │ │ │ +		// we have all pieces in the range [m_reverse_cursor, end)
│ │ │ │ +		// m_reverse_cursor is the first piece where we also have
│ │ │ │ +		// all the subsequent pieces
│ │ │ │ +		piece_index_t m_reverse_cursor{0};
│ │ │ │  
│ │ │ │ -		// if this tracker has returned scrape data, these fields are filled in
│ │ │ │ -		// with valid numbers. Otherwise they are set to -1. ``incomplete`` counts
│ │ │ │ -		// the number of current downloaders. ``complete`` counts the number of
│ │ │ │ -		// current peers completed the download, or "seeds". ``downloaded`` is the
│ │ │ │ -		// cumulative number of completed downloads.
│ │ │ │ -		int scrape_incomplete = -1;
│ │ │ │ -		int scrape_complete = -1;
│ │ │ │ -		int scrape_downloaded = -1;
│ │ │ │ +		// the number of pieces we have (i.e. passed hash check).
│ │ │ │ +		// This includes pieces that we have filtered but still have
│ │ │ │ +		int m_num_have = 0;
│ │ │ │  
│ │ │ │ -		// the number of times in a row we have failed to announce to this
│ │ │ │ -		// tracker.
│ │ │ │ -		std::uint8_t fails : 7;
│ │ │ │ +		// if this is set to true, it means update_pieces()
│ │ │ │ +		// has to be called before accessing m_pieces.
│ │ │ │ +		mutable bool m_dirty = false;
│ │ │ │ +	public:
│ │ │ │  
│ │ │ │ -		// true while we're waiting for a response from the tracker.
│ │ │ │ -		bool updating : 1;
│ │ │ │ +		enum { max_pieces = (std::numeric_limits&lt;int&gt;::max)() - 1 };
│ │ │ │  
│ │ │ │ -		// set to true when we get a valid response from an announce
│ │ │ │ -		// with event=started. If it is set, we won't send start in the subsequent
│ │ │ │ -		// announces.
│ │ │ │ -		bool start_sent : 1;
│ │ │ │ +	};
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -		// set to true when we send a event=completed.
│ │ │ │ -		bool complete_sent : 1;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(255)">../include/libtorrent/torrent.hpp:280</a></td><td>make this a raw pointer. perhaps keep the shared_ptr around further down the object to maintain an owner</td></tr><tr id="255" style="display: none;" colspan="3"><td colspan="3"><h2>make this a raw pointer. perhaps keep the shared_ptr
│ │ │ │ +#endif // TORRENT_PIECE_PICKER_HPP_INCLUDED
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(254)">../include/libtorrent/torrent.hpp:280</a></td><td>make this a raw pointer. perhaps keep the shared_ptr around further down the object to maintain an owner</td></tr><tr id="254" style="display: none;" colspan="3"><td colspan="3"><h2>make this a raw pointer. perhaps keep the shared_ptr
│ │ │ │  around further down the object to maintain an owner</h2><h4>../include/libtorrent/torrent.hpp:280</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#endif
│ │ │ │  	};
│ │ │ │  
│ │ │ │  	struct TORRENT_EXTRA_EXPORT torrent_hot_members
│ │ │ │  	{
│ │ │ │  		torrent_hot_members(aux::session_interface&amp; ses
│ │ │ │  			, add_torrent_params const&amp; p, bool session_paused);
│ │ │ │ @@ -10574,15 +10546,15 @@
│ │ │ │  		// this is set to false as long as the connections
│ │ │ │  		// of this torrent haven't been initialized. If we
│ │ │ │  		// have metadata from the start, connections are
│ │ │ │  		// initialized immediately, if we didn't have metadata,
│ │ │ │  		// they are initialized right after files_checked().
│ │ │ │  		// valid_resume_data() will return false as long as
│ │ │ │  		// the connections aren't initialized, to avoid
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(256)">../include/libtorrent/torrent.hpp:463</a></td><td>make graceful pause also finish all sending blocks before disconnecting</td></tr><tr id="256" style="display: none;" colspan="3"><td colspan="3"><h2>make graceful pause also finish all sending blocks
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(255)">../include/libtorrent/torrent.hpp:463</a></td><td>make graceful pause also finish all sending blocks before disconnecting</td></tr><tr id="255" style="display: none;" colspan="3"><td colspan="3"><h2>make graceful pause also finish all sending blocks
│ │ │ │  before disconnecting</h2><h4>../include/libtorrent/torrent.hpp:463</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  		void on_resume_data_checked(status_t status, storage_error const&amp; error);
│ │ │ │  		void on_force_recheck(status_t status, storage_error const&amp; error);
│ │ │ │  		void on_piece_hashed(aux::vector&lt;sha256_hash&gt; block_hashes
│ │ │ │  			, piece_index_t piece, sha1_hash const&amp; piece_hash
│ │ │ │  			, storage_error const&amp; error);
│ │ │ │  		void files_checked();
│ │ │ │ @@ -10626,15 +10598,15 @@
│ │ │ │  		void read_piece(piece_index_t);
│ │ │ │  		void on_disk_read_complete(disk_buffer_holder, storage_error const&amp;
│ │ │ │  			, peer_request const&amp;, std::shared_ptr&lt;read_piece_struct&gt;);
│ │ │ │  
│ │ │ │  		storage_mode_t storage_mode() const;
│ │ │ │  
│ │ │ │  		// this will flag the torrent as aborted. The main
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(257)">../include/libtorrent/torrent.hpp:600</a></td><td>make this flag a combination of the other ones</td></tr><tr id="257" style="display: none;" colspan="3"><td colspan="3"><h2>make this flag a combination
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(256)">../include/libtorrent/torrent.hpp:600</a></td><td>make this flag a combination of the other ones</td></tr><tr id="256" style="display: none;" colspan="3"><td colspan="3"><h2>make this flag a combination
│ │ │ │  of the other ones</h2><h4>../include/libtorrent/torrent.hpp:600</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		void do_pause(bool was_paused = false);
│ │ │ │  		void do_resume();
│ │ │ │  
│ │ │ │  		seconds32 finished_time() const;
│ │ │ │  		seconds32 active_time() const;
│ │ │ │  		seconds32 seeding_time() const;
│ │ │ │  		seconds32 upload_mode_time() const;
│ │ │ │ @@ -10678,15 +10650,15 @@
│ │ │ │  		void set_piece_priority(piece_index_t index, download_priority_t priority);
│ │ │ │  		download_priority_t piece_priority(piece_index_t index) const;
│ │ │ │  
│ │ │ │  		void prioritize_pieces(aux::vector&lt;download_priority_t, piece_index_t&gt; const&amp; pieces);
│ │ │ │  		void prioritize_piece_list(std::vector&lt;std::pair&lt;piece_index_t, download_priority_t&gt;&gt; const&amp; pieces);
│ │ │ │  		void piece_priorities(aux::vector&lt;download_priority_t, piece_index_t&gt;*) const;
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(258)">../include/libtorrent/torrent.hpp:1381</a></td><td>this wastes 5 bits per file</td></tr><tr id="258" style="display: none;" colspan="3"><td colspan="3"><h2>this wastes 5 bits per file</h2><h4>../include/libtorrent/torrent.hpp:1381</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifndef TORRENT_DISABLE_EXTENSIONS
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(257)">../include/libtorrent/torrent.hpp:1381</a></td><td>this wastes 5 bits per file</td></tr><tr id="257" style="display: none;" colspan="3"><td colspan="3"><h2>this wastes 5 bits per file</h2><h4>../include/libtorrent/torrent.hpp:1381</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifndef TORRENT_DISABLE_EXTENSIONS
│ │ │ │  		std::list&lt;std::shared_ptr&lt;torrent_plugin&gt;&gt; m_extensions;
│ │ │ │  #endif
│ │ │ │  
│ │ │ │  		// used for tracker announces
│ │ │ │  		deadline_timer m_tracker_timer;
│ │ │ │  
│ │ │ │  		// used to detect when we are active or inactive for long enough
│ │ │ │ @@ -10729,15 +10701,15 @@
│ │ │ │  #if TORRENT_ABI_VERSION == 1
│ │ │ │  		// deprecated in 1.1
│ │ │ │  		std::string m_username;
│ │ │ │  		std::string m_password;
│ │ │ │  #endif
│ │ │ │  
│ │ │ │  		std::string m_save_path;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(259)">../include/libtorrent/torrent.hpp:1696</a></td><td>this member can probably be removed</td></tr><tr id="259" style="display: none;" colspan="3"><td colspan="3"><h2>this member can probably be removed</h2><h4>../include/libtorrent/torrent.hpp:1696</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		unsigned int m_num_uploads:24;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(258)">../include/libtorrent/torrent.hpp:1696</a></td><td>this member can probably be removed</td></tr><tr id="258" style="display: none;" colspan="3"><td colspan="3"><h2>this member can probably be removed</h2><h4>../include/libtorrent/torrent.hpp:1696</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		unsigned int m_num_uploads:24;
│ │ │ │  
│ │ │ │  		// 4 unused bits
│ │ │ │  
│ │ │ │  		// when this is true, this torrent supports peer exchange
│ │ │ │  		bool m_enable_pex:1;
│ │ │ │  
│ │ │ │  		// set to true if the session IP filter applies to this
│ │ │ │ @@ -10780,15 +10752,101 @@
│ │ │ │  		// remember that this is an SSL torrent, so that we don't
│ │ │ │  		// accidentally start seeding it without any authentication.
│ │ │ │  		bool m_ssl_torrent:1;
│ │ │ │  
│ │ │ │  		// this is set to true if we're trying to delete the
│ │ │ │  		// files belonging to it. When set, don't write any
│ │ │ │  		// more blocks to disk!
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(260)">../include/libtorrent/peer_connection_interface.hpp:51</a></td><td>make this interface smaller!</td></tr><tr id="260" style="display: none;" colspan="3"><td colspan="3"><h2>make this interface smaller!</h2><h4>../include/libtorrent/peer_connection_interface.hpp:51</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(259)">../include/libtorrent/performance_counters.hpp:485</a></td><td>some space could be saved here by making gauges 32 bits</td></tr><tr id="259" style="display: none;" colspan="3"><td colspan="3"><h2>some space could be saved here by making gauges 32 bits</h2><h4>../include/libtorrent/performance_counters.hpp:485</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(260)">../include/libtorrent/performance_counters.hpp:486</a></td><td>restore these to regular integers. Instead have one copy of the counters per thread and collect them at convenient synchronization points</td></tr><tr id="260" style="display: none;" colspan="3"><td colspan="3"><h2>restore these to regular integers. Instead have one copy
│ │ │ │ +of the counters per thread and collect them at convenient
│ │ │ │ +synchronization points</h2><h4>../include/libtorrent/performance_counters.hpp:486</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifdef ATOMIC_LLONG_LOCK_FREE
│ │ │ │ +#define TORRENT_COUNTER_NOEXCEPT noexcept
│ │ │ │ +#else
│ │ │ │ +#define TORRENT_COUNTER_NOEXCEPT
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		counters() TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ +
│ │ │ │ +		counters(counters const&amp;) TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ +		counters&amp; operator=(counters const&amp;) &amp; TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ +
│ │ │ │ +		// returns the new value
│ │ │ │ +		std::int64_t inc_stats_counter(int c, std::int64_t value = 1) TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ +		std::int64_t operator[](int i) const TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ +
│ │ │ │ +		void set_value(int c, std::int64_t value) TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ +		void blend_stats_counter(int c, std::int64_t value, int ratio) TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ +
│ │ │ │ +	private:
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">#ifdef ATOMIC_LLONG_LOCK_FREE
│ │ │ │ +</div>		aux::array&lt;std::atomic&lt;std::int64_t&gt;, num_counters&gt; m_stats_counter;
│ │ │ │ +#else
│ │ │ │ +		// if the atomic type isn't lock-free, use a single lock instead, for
│ │ │ │ +		// the whole array
│ │ │ │ +		mutable std::mutex m_mutex;
│ │ │ │ +		aux::array&lt;std::int64_t, num_counters&gt; m_stats_counter;
│ │ │ │ +#endif
│ │ │ │ +	};
│ │ │ │ +}
│ │ │ │ +
│ │ │ │ +#endif
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(261)">../include/libtorrent/announce_entry.hpp:76</a></td><td>include the number of peers received from this tracker, at last announce</td></tr><tr id="261" style="display: none;" colspan="3"><td colspan="3"><h2>include the number of peers received from this tracker, at last
│ │ │ │ +announce</h2><h4>../include/libtorrent/announce_entry.hpp:76</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +	struct TORRENT_EXPORT announce_infohash
│ │ │ │ +	{
│ │ │ │ +		// internal
│ │ │ │ +		TORRENT_UNEXPORT announce_infohash();
│ │ │ │ +
│ │ │ │ +		// if this tracker has returned an error or warning message
│ │ │ │ +		// that message is stored here
│ │ │ │ +		std::string message;
│ │ │ │ +
│ │ │ │ +		// if this tracker failed the last time it was contacted
│ │ │ │ +		// this error code specifies what error occurred
│ │ │ │ +		error_code last_error;
│ │ │ │ +
│ │ │ │ +		// the time of next tracker announce
│ │ │ │ +		time_point32 next_announce = (time_point32::min)();
│ │ │ │ +
│ │ │ │ +		// no announces before this time
│ │ │ │ +		time_point32 min_announce = (time_point32::min)();
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>		// these are either -1 or the scrape information this tracker last
│ │ │ │ +		// responded with. *incomplete* is the current number of downloaders in
│ │ │ │ +		// the swarm, *complete* is the current number of seeds in the swarm and
│ │ │ │ +		// *downloaded* is the cumulative number of completed downloads of this
│ │ │ │ +		// torrent, since the beginning of time (from this tracker's point of
│ │ │ │ +		// view).
│ │ │ │ +
│ │ │ │ +		// if this tracker has returned scrape data, these fields are filled in
│ │ │ │ +		// with valid numbers. Otherwise they are set to -1. ``incomplete`` counts
│ │ │ │ +		// the number of current downloaders. ``complete`` counts the number of
│ │ │ │ +		// current peers completed the download, or "seeds". ``downloaded`` is the
│ │ │ │ +		// cumulative number of completed downloads.
│ │ │ │ +		int scrape_incomplete = -1;
│ │ │ │ +		int scrape_complete = -1;
│ │ │ │ +		int scrape_downloaded = -1;
│ │ │ │ +
│ │ │ │ +		// the number of times in a row we have failed to announce to this
│ │ │ │ +		// tracker.
│ │ │ │ +		std::uint8_t fails : 7;
│ │ │ │ +
│ │ │ │ +		// true while we're waiting for a response from the tracker.
│ │ │ │ +		bool updating : 1;
│ │ │ │ +
│ │ │ │ +		// set to true when we get a valid response from an announce
│ │ │ │ +		// with event=started. If it is set, we won't send start in the subsequent
│ │ │ │ +		// announces.
│ │ │ │ +		bool start_sent : 1;
│ │ │ │ +
│ │ │ │ +		// set to true when we send a event=completed.
│ │ │ │ +		bool complete_sent : 1;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(262)">../include/libtorrent/peer_connection_interface.hpp:51</a></td><td>make this interface smaller!</td></tr><tr id="262" style="display: none;" colspan="3"><td colspan="3"><h2>make this interface smaller!</h2><h4>../include/libtorrent/peer_connection_interface.hpp:51</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  */
│ │ │ │  
│ │ │ │  #ifndef TORRENT_PEER_CONNECTION_INTERFACE_HPP
│ │ │ │  #define TORRENT_PEER_CONNECTION_INTERFACE_HPP
│ │ │ │  
│ │ │ │  #include "libtorrent/fwd.hpp"
│ │ │ │  #include "libtorrent/socket.hpp"
│ │ │ │ @@ -10831,116 +10889,194 @@
│ │ │ │  		virtual stat const&amp; statistics() const = 0;
│ │ │ │  		virtual void get_peer_info(peer_info&amp; p) const = 0;
│ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
│ │ │ │  		virtual bool should_log(peer_log_alert::direction_t direction) const = 0;
│ │ │ │  		virtual void peer_log(peer_log_alert::direction_t direction
│ │ │ │  			, char const* event, char const* fmt = "", ...) const noexcept TORRENT_FORMAT(4,5) = 0;
│ │ │ │  #endif
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(261)">../include/libtorrent/piece_picker.hpp:823</a></td><td>should this be allocated lazily?</td></tr><tr id="261" style="display: none;" colspan="3"><td colspan="3"><h2>should this be allocated lazily?</h2><h4>../include/libtorrent/piece_picker.hpp:823</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// download list it may live in now
│ │ │ │ -		std::vector&lt;downloading_piece&gt;::iterator update_piece_state(
│ │ │ │ -			std::vector&lt;downloading_piece&gt;::iterator dp);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(263)">../include/libtorrent/hash_picker.hpp:155</a></td><td>support batched adding of block hashes for reduced overhead?</td></tr><tr id="263" style="display: none;" colspan="3"><td colspan="3"><h2>support batched adding of block hashes for reduced overhead?</h2><h4>../include/libtorrent/hash_picker.hpp:155</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// the number of hashes in the range
│ │ │ │ +		int count = 0;
│ │ │ │ +		int proof_layers = 0;
│ │ │ │ +	};
│ │ │ │ +
│ │ │ │ +	// validates the hash_request, to ensure its invariant as well as matching
│ │ │ │ +	// the torrent's file_storage and the number of hashes accompanying the
│ │ │ │ +	// request
│ │ │ │ +	TORRENT_EXTRA_EXPORT
│ │ │ │ +	bool validate_hash_request(hash_request const&amp; hr, file_storage const&amp; fs);
│ │ │ │ +
│ │ │ │ +	class TORRENT_EXTRA_EXPORT hash_picker
│ │ │ │ +	{
│ │ │ │ +	public:
│ │ │ │ +		hash_picker(file_storage const&amp; files
│ │ │ │ +			, aux::vector&lt;aux::merkle_tree, file_index_t&gt;&amp; trees);
│ │ │ │ +
│ │ │ │ +		hash_request pick_hashes(typed_bitfield&lt;piece_index_t&gt; const&amp; pieces);
│ │ │ │ +
│ │ │ │ +		add_hashes_result add_hashes(hash_request const&amp; req, span&lt;sha256_hash const&gt; hashes);
│ │ │ │ +<div style="background: #ffff00" width="100%">		set_block_hash_result set_block_hash(piece_index_t piece, int offset, sha256_hash const&amp; h);
│ │ │ │ +</div>		void hashes_rejected(hash_request const&amp; req);
│ │ │ │ +		void verify_block_hashes(piece_index_t index);
│ │ │ │ +
│ │ │ │ +		// do we know the piece layer hash for a piece
│ │ │ │ +		bool have_hash(piece_index_t index) const;
│ │ │ │ +		// do we know all the block hashes for a file?
│ │ │ │ +		bool have_all(file_index_t file) const;
│ │ │ │ +		bool have_all() const;
│ │ │ │ +		bool piece_verified(piece_index_t piece) const;
│ │ │ │ +
│ │ │ │ +		int piece_layer() const { return m_piece_layer; }
│ │ │ │  
│ │ │ │  	private:
│ │ │ │ +		// returns the number of proof layers needed to verify the node's hash
│ │ │ │ +		int layers_to_verify(node_index idx) const;
│ │ │ │ +		int file_num_layers(file_index_t idx) const;
│ │ │ │  
│ │ │ │ -#if TORRENT_USE_ASSERTS || TORRENT_USE_INVARIANT_CHECKS
│ │ │ │ -		index_range&lt;download_queue_t&gt; categories() const
│ │ │ │ -		{ return {{}, piece_picker::piece_pos::num_download_categories}; }
│ │ │ │ +		struct piece_hash_request
│ │ │ │ +		{
│ │ │ │ +			time_point last_request = min_time();
│ │ │ │ +			int num_requests = 0;
│ │ │ │ +			bool have = false;
│ │ │ │ +		};
│ │ │ │ +
│ │ │ │ +		struct priority_block_request
│ │ │ │ +		{
│ │ │ │ +			priority_block_request(file_index_t const f, int const b)
│ │ │ │ +				: file(f), block(b) {}
│ │ │ │ +			file_index_t file;
│ │ │ │ +			int block;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(264)">../include/libtorrent/identify_client.hpp:48</a></td><td>hide this declaration when deprecated functions are disabled, and remove its internal use</td></tr><tr id="264" style="display: none;" colspan="3"><td colspan="3"><h2>hide this declaration when deprecated functions are disabled, and
│ │ │ │ +remove its internal use</h2><h4>../include/libtorrent/identify_client.hpp:48</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
│ │ │ │ +POSSIBILITY OF SUCH DAMAGE.
│ │ │ │ +
│ │ │ │ +*/
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED
│ │ │ │ +#define TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED
│ │ │ │ +
│ │ │ │ +#include "libtorrent/config.hpp"
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_push.hpp"
│ │ │ │ +#include &lt;boost/optional.hpp&gt;
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │  #endif
│ │ │ │  
│ │ │ │ -		// the following vectors are mutable because they sometimes may
│ │ │ │ -		// be updated lazily, triggered by const functions
│ │ │ │ +#include "libtorrent/peer_id.hpp"
│ │ │ │ +#include "libtorrent/fingerprint.hpp"
│ │ │ │  
│ │ │ │ -		// this maps indices to number of peers that has this piece and
│ │ │ │ -		// index into the m_piece_info vectors.
│ │ │ │ -		// piece_pos::we_have_index means that we have the piece, so it
│ │ │ │ -		// doesn't exist in the piece_info buckets
│ │ │ │ -		// pieces with the filtered flag set doesn't have entries in
│ │ │ │ -		// the m_piece_info buckets either
│ │ │ │ -<div style="background: #ffff00" width="100%">		mutable aux::vector&lt;piece_pos, piece_index_t&gt; m_piece_map;
│ │ │ │ +<div style="background: #ffff00" width="100%">namespace libtorrent {
│ │ │ │  </div>
│ │ │ │ -		// tracks the number of bytes in a specific piece that are part of a pad
│ │ │ │ -		// file. The padding is assumed to be at the end of the piece, and the
│ │ │ │ -		// blocks covered by the pad bytes are not picked by the piece picker
│ │ │ │ -		std::unordered_map&lt;piece_index_t, int&gt; m_pads_in_piece;
│ │ │ │ +namespace aux {
│ │ │ │  
│ │ │ │ -		// when the adjacent_piece affinity is enabled, this contains the most
│ │ │ │ -		// recent "extents" of adjacent pieces that have been requested from
│ │ │ │ -		// this is mutable because it's updated by functions to pick pieces, which
│ │ │ │ -		// are const. That's an efficient place to update it, since it's being
│ │ │ │ -		// traversed already.
│ │ │ │ -		mutable std::vector&lt;piece_extent_t&gt; m_recent_extents;
│ │ │ │ +	TORRENT_EXTRA_EXPORT
│ │ │ │ +	std::string identify_client_impl(const peer_id&amp; p);
│ │ │ │  
│ │ │ │ -		// the number of bytes of pad file set in this piece picker
│ │ │ │ -		std::int64_t m_num_pad_bytes = 0;
│ │ │ │ +}
│ │ │ │  
│ │ │ │ -		// the number of pad blocks that we already have
│ │ │ │ -		std::int64_t m_have_pad_bytes = 0;
│ │ │ │ +	// these functions don't really need to be public. This mechanism of
│ │ │ │ +	// advertising client software and version is also out-dated.
│ │ │ │  
│ │ │ │ -		// the number of pad blocks part of filtered pieces we don't have
│ │ │ │ -		std::int64_t m_filtered_pad_bytes = 0;
│ │ │ │ +	// This function can can be used to extract a string describing a client
│ │ │ │ +	// version from its peer-id. It will recognize most clients that have this
│ │ │ │ +	// kind of identification in the peer-id.
│ │ │ │ +	TORRENT_DEPRECATED_EXPORT
│ │ │ │ +	std::string identify_client(const peer_id&amp; p);
│ │ │ │  
│ │ │ │ -		// the number of pad blocks we have that are also filtered
│ │ │ │ -		std::int64_t m_have_filtered_pad_bytes = 0;
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │  
│ │ │ │ -		// the number of seeds. These are not added to
│ │ │ │ -		// the availability counters of the pieces
│ │ │ │ -		int m_seeds = 0;
│ │ │ │ +#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
│ │ │ │  
│ │ │ │ -		// this vector contains all piece indices that are pickable
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(262)">../include/libtorrent/piece_picker.hpp:895</a></td><td>it would be more intuitive to account "wanted" pieces instead of filtered</td></tr><tr id="262" style="display: none;" colspan="3"><td colspan="3"><h2>it would be more intuitive to account "wanted" pieces
│ │ │ │ -instead of filtered</h2><h4>../include/libtorrent/piece_picker.hpp:895</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -		// this holds the information of the blocks in partially downloaded
│ │ │ │ -		// pieces. the downloading_piece::info index point into this vector for
│ │ │ │ -		// its storage
│ │ │ │ -		aux::vector&lt;block_info&gt; m_block_info;
│ │ │ │ +	// Returns an optional fingerprint if any can be identified from the peer
│ │ │ │ +	// id. This can be used to automate the identification of clients. It will
│ │ │ │ +	// not be able to identify peers with non- standard encodings. Only Azureus
│ │ │ │ +	// style, Shadow's style and Mainline style.
│ │ │ │ +	TORRENT_DEPRECATED_EXPORT
│ │ │ │ +	boost::optional&lt;fingerprint&gt;
│ │ │ │ +		client_fingerprint(peer_id const&amp; p);
│ │ │ │  
│ │ │ │ -		// these are block ranges in m_block_info that are free. The numbers
│ │ │ │ -		// in here, when multiplied by blocks_per_piece is the index to the
│ │ │ │ -		// first block in the range that's free to use by a new downloading_piece.
│ │ │ │ -		// this is a free-list.
│ │ │ │ -		std::vector&lt;std::uint16_t&gt; m_free_block_infos;
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(265)">../include/libtorrent/upnp.hpp:162</a></td><td>support using the windows API for UPnP operations as well</td></tr><tr id="265" 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:162</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">{
│ │ │ │ +	bool in_error_code = false;
│ │ │ │ +	bool exit = false;
│ │ │ │ +	int error_code = -1;
│ │ │ │ +};
│ │ │ │  
│ │ │ │ -		std::uint16_t m_blocks_in_last_piece = 0;
│ │ │ │ -		int m_piece_size = 0;
│ │ │ │ -		std::int64_t m_total_size = 0;
│ │ │ │ +struct ip_address_parse_state: error_code_parse_state
│ │ │ │ +{
│ │ │ │ +	bool in_ip_address = false;
│ │ │ │ +	std::string ip_address;
│ │ │ │ +};
│ │ │ │  
│ │ │ │ -		// the number of filtered pieces that we don't already
│ │ │ │ -		// have. total_number_of_pieces - number_of_pieces_we_have
│ │ │ │ -		// - num_filtered is supposed to the number of pieces
│ │ │ │ -		// we still want to download
│ │ │ │ -<div style="background: #ffff00" width="100%">		int m_num_filtered = 0;
│ │ │ │ -</div>
│ │ │ │ -		// the number of pieces we have that also are filtered
│ │ │ │ -		int m_num_have_filtered = 0;
│ │ │ │ +TORRENT_EXTRA_EXPORT void find_control_url(int type, string_view, parse_state&amp; state);
│ │ │ │  
│ │ │ │ -		// we have all pieces in the range [0, m_cursor)
│ │ │ │ -		// m_cursor is the first piece we don't have
│ │ │ │ -		piece_index_t m_cursor{0};
│ │ │ │ +TORRENT_EXTRA_EXPORT void find_error_code(int type, string_view string
│ │ │ │ +	, error_code_parse_state&amp; state);
│ │ │ │  
│ │ │ │ -		// we have all pieces in the range [m_reverse_cursor, end)
│ │ │ │ -		// m_reverse_cursor is the first piece where we also have
│ │ │ │ -		// all the subsequent pieces
│ │ │ │ -		piece_index_t m_reverse_cursor{0};
│ │ │ │ +TORRENT_EXTRA_EXPORT void find_ip_address(int type, string_view string
│ │ │ │ +	, ip_address_parse_state&amp; state);
│ │ │ │  
│ │ │ │ -		// the number of pieces we have (i.e. passed hash check).
│ │ │ │ -		// This includes pieces that we have filtered but still have
│ │ │ │ -		int m_num_have = 0;
│ │ │ │ +<div style="background: #ffff00" width="100%">struct TORRENT_EXTRA_EXPORT upnp final
│ │ │ │ +</div>	: std::enable_shared_from_this&lt;upnp&gt;
│ │ │ │ +	, single_threaded
│ │ │ │ +{
│ │ │ │ +	upnp(io_context&amp; ios
│ │ │ │ +		, aux::session_settings const&amp; settings
│ │ │ │ +		, aux::portmap_callback&amp; cb
│ │ │ │ +		, address_v4 listen_address
│ │ │ │ +		, address_v4 netmask
│ │ │ │ +		, std::string listen_device
│ │ │ │ +		, aux::listen_socket_handle ls);
│ │ │ │ +	~upnp();
│ │ │ │  
│ │ │ │ -		// if this is set to true, it means update_pieces()
│ │ │ │ -		// has to be called before accessing m_pieces.
│ │ │ │ -		mutable bool m_dirty = false;
│ │ │ │ -	public:
│ │ │ │ +	void start();
│ │ │ │  
│ │ │ │ -		enum { max_pieces = (std::numeric_limits&lt;int&gt;::max)() - 1 };
│ │ │ │ +	// Attempts to add a port mapping for the specified protocol. Valid protocols are
│ │ │ │ +	// ``upnp::tcp`` and ``upnp::udp`` for the UPnP class and ``natpmp::tcp`` and
│ │ │ │ +	// ``natpmp::udp`` for the NAT-PMP class.
│ │ │ │ +	//
│ │ │ │ +	// ``external_port`` is the port on the external address that will be mapped. This
│ │ │ │ +	// is a hint, you are not guaranteed that this port will be available, and it may
│ │ │ │ +	// end up being something else. In the portmap_alert_ notification, the actual
│ │ │ │ +	// external port is reported.
│ │ │ │ +	//
│ │ │ │ +	// ``local_port`` is the port in the local machine that the mapping should forward
│ │ │ │ +	// to.
│ │ │ │ +	//
│ │ │ │ +	// The return value is an index that identifies this port mapping. This is used
│ │ │ │ +	// to refer to mappings that fails or succeeds in the portmap_error_alert_ and
│ │ │ │ +	// portmap_alert_ respectively. If The mapping fails immediately, the return value
│ │ │ │ +	// is -1, which means failure. There will not be any error alert notification for
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(266)">../include/libtorrent/socket_type.hpp:60</a></td><td>move to aux</td></tr><tr id="266" style="display: none;" colspan="3"><td colspan="3"><h2>move to aux</h2><h4>../include/libtorrent/socket_type.hpp:60</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">namespace libtorrent {
│ │ │ │  
│ │ │ │ -	};
│ │ │ │ +// A type describing kinds of sockets involved in various operations or events.
│ │ │ │ +enum class socket_type_t : std::uint8_t {
│ │ │ │ +	tcp,
│ │ │ │ +	socks5,
│ │ │ │ +	http,
│ │ │ │ +	utp,
│ │ │ │ +	i2p,
│ │ │ │ +	tcp_ssl,
│ │ │ │ +	socks5_ssl,
│ │ │ │ +	http_ssl,
│ │ │ │ +	utp_ssl,
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION &lt;= 2
│ │ │ │ +	udp TORRENT_DEPRECATED_ENUM = utp,
│ │ │ │ +#endif
│ │ │ │ +};
│ │ │ │ +
│ │ │ │ +// return a short human readable name for types of socket
│ │ │ │ +<div style="background: #ffff00" width="100%">char const* socket_type_name(socket_type_t);
│ │ │ │ +</div>
│ │ │ │  }
│ │ │ │  
│ │ │ │ -#endif // TORRENT_PIECE_PICKER_HPP_INCLUDED
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(263)">../include/libtorrent/i2p_stream.hpp:533</a></td><td>make this a string_view</td></tr><tr id="263" style="display: none;" colspan="3"><td colspan="3"><h2>make this a string_view</h2><h4>../include/libtorrent/i2p_stream.hpp:533</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +#endif
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(267)">../include/libtorrent/i2p_stream.hpp:533</a></td><td>make this a string_view</td></tr><tr id="267" style="display: none;" colspan="3"><td colspan="3"><h2>make this a string_view</h2><h4>../include/libtorrent/i2p_stream.hpp:533</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  		char tmp[20];
│ │ │ │  		aux::random_bytes(tmp);
│ │ │ │  		m_session_id.resize(sizeof(tmp)*2);
│ │ │ │  		aux::to_hex(tmp, &amp;m_session_id[0]);
│ │ │ │  
│ │ │ │  		m_sam_socket = std::make_shared&lt;i2p_stream&gt;(m_io_service);
│ │ │ │  		m_sam_socket-&gt;set_proxy(m_hostname, m_port);
│ │ │ │ @@ -10983,15 +11119,67 @@
│ │ │ │  			return;
│ │ │ │  		}
│ │ │ │  
│ │ │ │  		do_name_lookup("ME", wrap_allocator(
│ │ │ │  			[this](error_code const&amp; e, char const* dst, Handler hn) {
│ │ │ │  				set_local_endpoint(e, dst, std::move(hn));
│ │ │ │  			}, std::move(h)));
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(264)">../include/libtorrent/string_view.hpp:40</a></td><td>replace this by the standard string_view in C++17</td></tr><tr id="264" style="display: none;" colspan="3"><td colspan="3"><h2>replace this by the standard string_view in C++17</h2><h4>../include/libtorrent/string_view.hpp:40</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(268)">../include/libtorrent/proxy_base.hpp:227</a></td><td>it would be nice to remember the bind port and bind once we know where the proxy is m_sock.bind(endpoint, ec);</td></tr><tr id="268" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to remember the bind port and bind once we know where the proxy is
│ │ │ │ +m_sock.bind(endpoint, ec);</h2><h4>../include/libtorrent/proxy_base.hpp:227</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ +		m_sock.cancel();
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void cancel(error_code&amp; ec)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ +		m_sock.cancel(ec);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +	void bind(endpoint_type const&amp; /* endpoint */, error_code&amp; /* ec */)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ +		// the reason why we ignore binds here is because we don't
│ │ │ │ +		// (necessarily) yet know what address family the proxy
│ │ │ │ +		// will resolve to, and binding to the wrong one would
│ │ │ │ +		// break our connection attempt later. The caller here
│ │ │ │ +		// doesn't necessarily know that we're proxying, so this
│ │ │ │ +		// bind address is based on the final endpoint, not the
│ │ │ │ +		// proxy.
│ │ │ │ +<div style="background: #ffff00" width="100%">	}
│ │ │ │ +</div>
│ │ │ │ +#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ +	void open(protocol_type const&amp;)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ +//		m_sock.open(p);
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	void open(protocol_type const&amp;, error_code&amp;)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ +		// we need to ignore this for the same reason as stated
│ │ │ │ +		// for ignoring bind()
│ │ │ │ +//		m_sock.open(p, ec);
│ │ │ │ +	}
│ │ │ │ +
│ │ │ │ +#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ +	void close()
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ +		m_remote_endpoint = endpoint_type();
│ │ │ │ +		m_sock.close();
│ │ │ │ +		m_resolver.cancel();
│ │ │ │ +	}
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +	void close(error_code&amp; ec)
│ │ │ │ +	{
│ │ │ │ +		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(269)">../include/libtorrent/string_view.hpp:40</a></td><td>replace this by the standard string_view in C++17</td></tr><tr id="269" style="display: none;" colspan="3"><td colspan="3"><h2>replace this by the standard string_view in C++17</h2><h4>../include/libtorrent/string_view.hpp:40</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
│ │ │ │  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
│ │ │ │  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
│ │ │ │  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
│ │ │ │  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
│ │ │ │  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
│ │ │ │  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
│ │ │ │  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ @@ -11034,118 +11222,67 @@
│ │ │ │  {
│ │ │ │  	while (pos &lt; v.size())
│ │ │ │  	{
│ │ │ │  		if (std::strchr(c, v[pos]) != nullptr) return pos;
│ │ │ │  		++pos;
│ │ │ │  	}
│ │ │ │  	return string_view::npos;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(265)">../include/libtorrent/hash_picker.hpp:155</a></td><td>support batched adding of block hashes for reduced overhead?</td></tr><tr id="265" style="display: none;" colspan="3"><td colspan="3"><h2>support batched adding of block hashes for reduced overhead?</h2><h4>../include/libtorrent/hash_picker.hpp:155</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		// the number of hashes in the range
│ │ │ │ -		int count = 0;
│ │ │ │ -		int proof_layers = 0;
│ │ │ │ -	};
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(270)">../include/libtorrent/socks5_stream.hpp:197</a></td><td>we could bind the socket here, since we know what the target endpoint is of the proxy</td></tr><tr id="270" style="display: none;" colspan="3"><td colspan="3"><h2>we could bind the socket here, since we know what the
│ │ │ │ +target endpoint is of the proxy</h2><h4>../include/libtorrent/socks5_stream.hpp:197</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			}, std::move(handler)));
│ │ │ │ +	}
│ │ │ │  
│ │ │ │ -	// validates the hash_request, to ensure its invariant as well as matching
│ │ │ │ -	// the torrent's file_storage and the number of hashes accompanying the
│ │ │ │ -	// request
│ │ │ │ -	TORRENT_EXTRA_EXPORT
│ │ │ │ -	bool validate_hash_request(hash_request const&amp; hr, file_storage const&amp; fs);
│ │ │ │ +private:
│ │ │ │  
│ │ │ │ -	class TORRENT_EXTRA_EXPORT hash_picker
│ │ │ │ +	template &lt;typename Handler&gt;
│ │ │ │ +	void name_lookup(error_code const&amp; e, tcp::resolver::results_type ips
│ │ │ │ +		, Handler h)
│ │ │ │  	{
│ │ │ │ -	public:
│ │ │ │ -		hash_picker(file_storage const&amp; files
│ │ │ │ -			, aux::vector&lt;aux::merkle_tree, file_index_t&gt;&amp; trees);
│ │ │ │ -
│ │ │ │ -		hash_request pick_hashes(typed_bitfield&lt;piece_index_t&gt; const&amp; pieces);
│ │ │ │ -
│ │ │ │ -		add_hashes_result add_hashes(hash_request const&amp; req, span&lt;sha256_hash const&gt; hashes);
│ │ │ │ -<div style="background: #ffff00" width="100%">		set_block_hash_result set_block_hash(piece_index_t piece, int offset, sha256_hash const&amp; h);
│ │ │ │ -</div>		void hashes_rejected(hash_request const&amp; req);
│ │ │ │ -		void verify_block_hashes(piece_index_t index);
│ │ │ │ -
│ │ │ │ -		// do we know the piece layer hash for a piece
│ │ │ │ -		bool have_hash(piece_index_t index) const;
│ │ │ │ -		// do we know all the block hashes for a file?
│ │ │ │ -		bool have_all(file_index_t file) const;
│ │ │ │ -		bool have_all() const;
│ │ │ │ -		bool piece_verified(piece_index_t piece) const;
│ │ │ │ -
│ │ │ │ -		int piece_layer() const { return m_piece_layer; }
│ │ │ │ -
│ │ │ │ -	private:
│ │ │ │ -		// returns the number of proof layers needed to verify the node's hash
│ │ │ │ -		int layers_to_verify(node_index idx) const;
│ │ │ │ -		int file_num_layers(file_index_t idx) const;
│ │ │ │ -
│ │ │ │ -		struct piece_hash_request
│ │ │ │ -		{
│ │ │ │ -			time_point last_request = min_time();
│ │ │ │ -			int num_requests = 0;
│ │ │ │ -			bool have = false;
│ │ │ │ -		};
│ │ │ │ +		COMPLETE_ASYNC("socks5_stream::name_lookup");
│ │ │ │ +		if (handle_error(e, std::move(h))) return;
│ │ │ │  
│ │ │ │ -		struct priority_block_request
│ │ │ │ +		auto i = ips.begin();
│ │ │ │ +		if (!m_sock.is_open())
│ │ │ │  		{
│ │ │ │ -			priority_block_request(file_index_t const f, int const b)
│ │ │ │ -				: file(f), block(b) {}
│ │ │ │ -			file_index_t file;
│ │ │ │ -			int block;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(266)">../include/libtorrent/proxy_base.hpp:227</a></td><td>it would be nice to remember the bind port and bind once we know where the proxy is m_sock.bind(endpoint, ec);</td></tr><tr id="266" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to remember the bind port and bind once we know where the proxy is
│ │ │ │ -m_sock.bind(endpoint, ec);</h2><h4>../include/libtorrent/proxy_base.hpp:227</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ -		m_sock.cancel();
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void cancel(error_code&amp; ec)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ -		m_sock.cancel(ec);
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	void bind(endpoint_type const&amp; /* endpoint */, error_code&amp; /* ec */)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ -		// the reason why we ignore binds here is because we don't
│ │ │ │ -		// (necessarily) yet know what address family the proxy
│ │ │ │ -		// will resolve to, and binding to the wrong one would
│ │ │ │ -		// break our connection attempt later. The caller here
│ │ │ │ -		// doesn't necessarily know that we're proxying, so this
│ │ │ │ -		// bind address is based on the final endpoint, not the
│ │ │ │ -		// proxy.
│ │ │ │ -<div style="background: #ffff00" width="100%">	}
│ │ │ │ -</div>
│ │ │ │ -#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ -	void open(protocol_type const&amp;)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ -//		m_sock.open(p);
│ │ │ │ -	}
│ │ │ │ -#endif
│ │ │ │ +			error_code ec;
│ │ │ │ +			m_sock.open(i-&gt;endpoint().protocol(), ec);
│ │ │ │ +			if (handle_error(ec, std::move(h))) return;
│ │ │ │ +		}
│ │ │ │  
│ │ │ │ -	void open(protocol_type const&amp;, error_code&amp;)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ -		// we need to ignore this for the same reason as stated
│ │ │ │ -		// for ignoring bind()
│ │ │ │ -//		m_sock.open(p, ec);
│ │ │ │ +<div style="background: #ffff00" width="100%">		ADD_OUTSTANDING_ASYNC("socks5_stream::connected");
│ │ │ │ +</div>		m_sock.async_connect(i-&gt;endpoint(), wrap_allocator(
│ │ │ │ +			[this](error_code const&amp; ec, Handler hn)
│ │ │ │ +			{ connected(ec, std::move(hn)); }, std::move(h)));
│ │ │ │  	}
│ │ │ │  
│ │ │ │ -#ifndef BOOST_NO_EXCEPTIONS
│ │ │ │ -	void close()
│ │ │ │ +	template &lt;typename Handler&gt;
│ │ │ │ +	void connected(error_code const&amp; e, Handler h)
│ │ │ │  	{
│ │ │ │ -		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ -		m_remote_endpoint = endpoint_type();
│ │ │ │ -		m_sock.close();
│ │ │ │ -		m_resolver.cancel();
│ │ │ │ -	}
│ │ │ │ -#endif
│ │ │ │ +		COMPLETE_ASYNC("socks5_stream::connected");
│ │ │ │ +		if (handle_error(e, std::move(h))) return;
│ │ │ │  
│ │ │ │ -	void close(error_code&amp; ec)
│ │ │ │ -	{
│ │ │ │ -		TORRENT_ASSERT(m_magic == 0x1337);
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(267)">../include/libtorrent/peer_connection.hpp:218</a></td><td>make this a raw pointer (to save size in the first cache line) and make the constructor take a raw pointer. torrent objects should always outlive their peers</td></tr><tr id="267" style="display: none;" colspan="3"><td colspan="3"><h2>make this a raw pointer (to save size in
│ │ │ │ +		using namespace libtorrent::aux;
│ │ │ │ +		if (m_version == 5)
│ │ │ │ +		{
│ │ │ │ +			// send SOCKS5 authentication methods
│ │ │ │ +			m_buffer.resize(m_user.empty()?3:4);
│ │ │ │ +			char* p = &amp;m_buffer[0];
│ │ │ │ +			write_uint8(5, p); // SOCKS VERSION 5
│ │ │ │ +			if (m_user.empty())
│ │ │ │ +			{
│ │ │ │ +				write_uint8(1, p); // 1 authentication method (no auth)
│ │ │ │ +				write_uint8(0, p); // no authentication
│ │ │ │ +			}
│ │ │ │ +			else
│ │ │ │ +			{
│ │ │ │ +				write_uint8(2, p); // 2 authentication methods
│ │ │ │ +				write_uint8(0, p); // no authentication
│ │ │ │ +				write_uint8(2, p); // username/password
│ │ │ │ +			}
│ │ │ │ +			ADD_OUTSTANDING_ASYNC("socks5_stream::handshake1");
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(271)">../include/libtorrent/peer_connection.hpp:218</a></td><td>make this a raw pointer (to save size in the first cache line) and make the constructor take a raw pointer. torrent objects should always outlive their peers</td></tr><tr id="271" style="display: none;" colspan="3"><td colspan="3"><h2>make this a raw pointer (to save size in
│ │ │ │  the first cache line) and make the constructor
│ │ │ │  take a raw pointer. torrent objects should always
│ │ │ │  outlive their peers</h2><h4>../include/libtorrent/peer_connection.hpp:218</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			, m_snubbed(false)
│ │ │ │  			, m_interesting(false)
│ │ │ │  			, m_choked(true)
│ │ │ │  			, m_ignore_stats(false)
│ │ │ │  		{}
│ │ │ │ @@ -11191,15 +11328,15 @@
│ │ │ │  		// time out is reached.
│ │ │ │  		bool m_connecting:1;
│ │ │ │  
│ │ │ │  		// this is set to true if the last time we tried to
│ │ │ │  		// pick a piece to download, we could only find
│ │ │ │  		// blocks that were already requested from other
│ │ │ │  		// peers. In this case, we should not try to pick
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(268)">../include/libtorrent/peer_connection.hpp:1026</a></td><td>factor this out into its own class with a virtual interface torrent and session should implement this interface</td></tr><tr id="268" style="display: none;" colspan="3"><td colspan="3"><h2>factor this out into its own class with a virtual interface
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(272)">../include/libtorrent/peer_connection.hpp:1026</a></td><td>factor this out into its own class with a virtual interface torrent and session should implement this interface</td></tr><tr id="272" style="display: none;" colspan="3"><td colspan="3"><h2>factor this out into its own class with a virtual interface
│ │ │ │  torrent and session should implement this interface</h2><h4>../include/libtorrent/peer_connection.hpp:1026</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  		// the local endpoint for this peer, i.e. our address
│ │ │ │  		// and our port. If this is set for outgoing connections
│ │ │ │  		// before the connection completes, it means we want to
│ │ │ │  		// force the connection to be bound to the specified interface.
│ │ │ │  		// if it ends up being bound to a different local IP, the connection
│ │ │ │  		// is closed.
│ │ │ │ @@ -11243,151 +11380,14 @@
│ │ │ │  		// let plugins control flags that should always be set
│ │ │ │  		picker_options_t m_picker_options{};
│ │ │ │  
│ │ │ │  		// the number of invalid piece-requests
│ │ │ │  		// we have got from this peer. If the request
│ │ │ │  		// queue gets empty, and there have been
│ │ │ │  		// invalid requests, we can assume the
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(269)">../include/libtorrent/socks5_stream.hpp:197</a></td><td>we could bind the socket here, since we know what the target endpoint is of the proxy</td></tr><tr id="269" style="display: none;" colspan="3"><td colspan="3"><h2>we could bind the socket here, since we know what the
│ │ │ │ -target endpoint is of the proxy</h2><h4>../include/libtorrent/socks5_stream.hpp:197</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			}, std::move(handler)));
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -private:
│ │ │ │ -
│ │ │ │ -	template &lt;typename Handler&gt;
│ │ │ │ -	void name_lookup(error_code const&amp; e, tcp::resolver::results_type ips
│ │ │ │ -		, Handler h)
│ │ │ │ -	{
│ │ │ │ -		COMPLETE_ASYNC("socks5_stream::name_lookup");
│ │ │ │ -		if (handle_error(e, std::move(h))) return;
│ │ │ │ -
│ │ │ │ -		auto i = ips.begin();
│ │ │ │ -		if (!m_sock.is_open())
│ │ │ │ -		{
│ │ │ │ -			error_code ec;
│ │ │ │ -			m_sock.open(i-&gt;endpoint().protocol(), ec);
│ │ │ │ -			if (handle_error(ec, std::move(h))) return;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		ADD_OUTSTANDING_ASYNC("socks5_stream::connected");
│ │ │ │ -</div>		m_sock.async_connect(i-&gt;endpoint(), wrap_allocator(
│ │ │ │ -			[this](error_code const&amp; ec, Handler hn)
│ │ │ │ -			{ connected(ec, std::move(hn)); }, std::move(h)));
│ │ │ │ -	}
│ │ │ │ -
│ │ │ │ -	template &lt;typename Handler&gt;
│ │ │ │ -	void connected(error_code const&amp; e, Handler h)
│ │ │ │ -	{
│ │ │ │ -		COMPLETE_ASYNC("socks5_stream::connected");
│ │ │ │ -		if (handle_error(e, std::move(h))) return;
│ │ │ │ -
│ │ │ │ -		using namespace libtorrent::aux;
│ │ │ │ -		if (m_version == 5)
│ │ │ │ -		{
│ │ │ │ -			// send SOCKS5 authentication methods
│ │ │ │ -			m_buffer.resize(m_user.empty()?3:4);
│ │ │ │ -			char* p = &amp;m_buffer[0];
│ │ │ │ -			write_uint8(5, p); // SOCKS VERSION 5
│ │ │ │ -			if (m_user.empty())
│ │ │ │ -			{
│ │ │ │ -				write_uint8(1, p); // 1 authentication method (no auth)
│ │ │ │ -				write_uint8(0, p); // no authentication
│ │ │ │ -			}
│ │ │ │ -			else
│ │ │ │ -			{
│ │ │ │ -				write_uint8(2, p); // 2 authentication methods
│ │ │ │ -				write_uint8(0, p); // no authentication
│ │ │ │ -				write_uint8(2, p); // username/password
│ │ │ │ -			}
│ │ │ │ -			ADD_OUTSTANDING_ASYNC("socks5_stream::handshake1");
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(270)">../include/libtorrent/upnp.hpp:162</a></td><td>support using the windows API for UPnP operations as well</td></tr><tr id="270" 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:162</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">{
│ │ │ │ -	bool in_error_code = false;
│ │ │ │ -	bool exit = false;
│ │ │ │ -	int error_code = -1;
│ │ │ │ -};
│ │ │ │ -
│ │ │ │ -struct ip_address_parse_state: error_code_parse_state
│ │ │ │ -{
│ │ │ │ -	bool in_ip_address = false;
│ │ │ │ -	std::string ip_address;
│ │ │ │ -};
│ │ │ │ -
│ │ │ │ -TORRENT_EXTRA_EXPORT void find_control_url(int type, string_view, parse_state&amp; state);
│ │ │ │ -
│ │ │ │ -TORRENT_EXTRA_EXPORT void find_error_code(int type, string_view string
│ │ │ │ -	, error_code_parse_state&amp; state);
│ │ │ │ -
│ │ │ │ -TORRENT_EXTRA_EXPORT void find_ip_address(int type, string_view string
│ │ │ │ -	, ip_address_parse_state&amp; state);
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">struct TORRENT_EXTRA_EXPORT upnp final
│ │ │ │ -</div>	: std::enable_shared_from_this&lt;upnp&gt;
│ │ │ │ -	, single_threaded
│ │ │ │ -{
│ │ │ │ -	upnp(io_context&amp; ios
│ │ │ │ -		, aux::session_settings const&amp; settings
│ │ │ │ -		, aux::portmap_callback&amp; cb
│ │ │ │ -		, address_v4 listen_address
│ │ │ │ -		, address_v4 netmask
│ │ │ │ -		, std::string listen_device
│ │ │ │ -		, aux::listen_socket_handle ls);
│ │ │ │ -	~upnp();
│ │ │ │ -
│ │ │ │ -	void start();
│ │ │ │ -
│ │ │ │ -	// Attempts to add a port mapping for the specified protocol. Valid protocols are
│ │ │ │ -	// ``upnp::tcp`` and ``upnp::udp`` for the UPnP class and ``natpmp::tcp`` and
│ │ │ │ -	// ``natpmp::udp`` for the NAT-PMP class.
│ │ │ │ -	//
│ │ │ │ -	// ``external_port`` is the port on the external address that will be mapped. This
│ │ │ │ -	// is a hint, you are not guaranteed that this port will be available, and it may
│ │ │ │ -	// end up being something else. In the portmap_alert_ notification, the actual
│ │ │ │ -	// external port is reported.
│ │ │ │ -	//
│ │ │ │ -	// ``local_port`` is the port in the local machine that the mapping should forward
│ │ │ │ -	// to.
│ │ │ │ -	//
│ │ │ │ -	// The return value is an index that identifies this port mapping. This is used
│ │ │ │ -	// to refer to mappings that fails or succeeds in the portmap_error_alert_ and
│ │ │ │ -	// portmap_alert_ respectively. If The mapping fails immediately, the return value
│ │ │ │ -	// is -1, which means failure. There will not be any error alert notification for
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(271)">../include/libtorrent/performance_counters.hpp:485</a></td><td>some space could be saved here by making gauges 32 bits</td></tr><tr id="271" style="display: none;" colspan="3"><td colspan="3"><h2>some space could be saved here by making gauges 32 bits</h2><h4>../include/libtorrent/performance_counters.hpp:485</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;"></pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(272)">../include/libtorrent/performance_counters.hpp:486</a></td><td>restore these to regular integers. Instead have one copy of the counters per thread and collect them at convenient synchronization points</td></tr><tr id="272" style="display: none;" colspan="3"><td colspan="3"><h2>restore these to regular integers. Instead have one copy
│ │ │ │ -of the counters per thread and collect them at convenient
│ │ │ │ -synchronization points</h2><h4>../include/libtorrent/performance_counters.hpp:486</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifdef ATOMIC_LLONG_LOCK_FREE
│ │ │ │ -#define TORRENT_COUNTER_NOEXCEPT noexcept
│ │ │ │ -#else
│ │ │ │ -#define TORRENT_COUNTER_NOEXCEPT
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		counters() TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ -
│ │ │ │ -		counters(counters const&amp;) TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ -		counters&amp; operator=(counters const&amp;) &amp; TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ -
│ │ │ │ -		// returns the new value
│ │ │ │ -		std::int64_t inc_stats_counter(int c, std::int64_t value = 1) TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ -		std::int64_t operator[](int i) const TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ -
│ │ │ │ -		void set_value(int c, std::int64_t value) TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ -		void blend_stats_counter(int c, std::int64_t value, int ratio) TORRENT_COUNTER_NOEXCEPT;
│ │ │ │ -
│ │ │ │ -	private:
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">#ifdef ATOMIC_LLONG_LOCK_FREE
│ │ │ │ -</div>		aux::array&lt;std::atomic&lt;std::int64_t&gt;, num_counters&gt; m_stats_counter;
│ │ │ │ -#else
│ │ │ │ -		// if the atomic type isn't lock-free, use a single lock instead, for
│ │ │ │ -		// the whole array
│ │ │ │ -		mutable std::mutex m_mutex;
│ │ │ │ -		aux::array&lt;std::int64_t, num_counters&gt; m_stats_counter;
│ │ │ │ -#endif
│ │ │ │ -	};
│ │ │ │ -}
│ │ │ │ -
│ │ │ │ -#endif
│ │ │ │  </pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(273)">../include/libtorrent/kademlia/msg.hpp:87</a></td><td>move this to its own .hpp/.cpp pair?</td></tr><tr id="273" style="display: none;" colspan="3"><td colspan="3"><h2>move this to its own .hpp/.cpp pair?</h2><h4>../include/libtorrent/kademlia/msg.hpp:87</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	int flags;
│ │ │ │  
│ │ │ │  	enum {
│ │ │ │  		// this argument is optional, parsing will not
│ │ │ │  		// fail if it's not present
│ │ │ │  		optional = 1,
│ │ │ │  		// for dictionaries, the following entries refer
│ │ │ │ @@ -11468,306 +11468,56 @@
│ │ │ │  		, secret_key const&amp; sk);
│ │ │ │  	explicit item(bdecode_node const&amp; v);
│ │ │ │  
│ │ │ │  	void assign(entry v);
│ │ │ │  	void assign(entry v, span&lt;char const&gt; salt
│ │ │ │  		, sequence_number seq
│ │ │ │  		, public_key const&amp; pk
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(275)">../include/libtorrent/aux_/session_interface.hpp:212</a></td><td>it would be nice to not have this be part of session_interface</td></tr><tr id="275" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to not have this be part of session_interface</h2><h4>../include/libtorrent/aux_/session_interface.hpp:212</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		virtual void deferred_submit_jobs() = 0;
│ │ │ │ -
│ │ │ │ -		virtual std::uint16_t listen_port() const = 0;
│ │ │ │ -		virtual std::uint16_t ssl_listen_port() const = 0;
│ │ │ │ -
│ │ │ │ -		virtual int listen_port(aux::transport ssl, address const&amp; local_addr) = 0;
│ │ │ │ -
│ │ │ │ -		virtual void for_each_listen_socket(std::function&lt;void(aux::listen_socket_handle const&amp;)&gt; f) = 0;
│ │ │ │ -
│ │ │ │ -		// ask for which interface and port to bind outgoing peer connections on
│ │ │ │ -		virtual tcp::endpoint bind_outgoing_socket(socket_type&amp; s, address const&amp;
│ │ │ │ -			remote_address, error_code&amp; ec) const = 0;
│ │ │ │ -		virtual bool verify_bound_address(address const&amp; addr, bool utp
│ │ │ │ -			, error_code&amp; ec) = 0;
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS
│ │ │ │ -		virtual std::vector&lt;std::shared_ptr&lt;torrent&gt;&gt; find_collection(
│ │ │ │ -			std::string const&amp; collection) const = 0;
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">		virtual proxy_settings proxy() const = 0;
│ │ │ │ -</div>
│ │ │ │ -#if TORRENT_USE_I2P
│ │ │ │ -		virtual char const* i2p_session() const = 0;
│ │ │ │ -		virtual std::string const&amp; local_i2p_endpoint() const = 0;
│ │ │ │ -#endif
│ │ │ │ -
│ │ │ │ -		virtual void prioritize_connections(std::weak_ptr&lt;torrent&gt; t) = 0;
│ │ │ │ -
│ │ │ │ -		virtual void trigger_auto_manage() = 0;
│ │ │ │ -
│ │ │ │ -		virtual void apply_settings_pack(std::shared_ptr&lt;settings_pack&gt; pack) = 0;
│ │ │ │ -		virtual session_settings const&amp; settings() const = 0;
│ │ │ │ -
│ │ │ │ -		virtual void queue_tracker_request(tracker_request req
│ │ │ │ -			, std::weak_ptr&lt;request_callback&gt; c) = 0;
│ │ │ │ -
│ │ │ │ -		// peer-classes
│ │ │ │ -		virtual void set_peer_classes(peer_class_set* s, address const&amp; a, socket_type_t st) = 0;
│ │ │ │ -		virtual peer_class_pool const&amp; peer_classes() const = 0;
│ │ │ │ -		virtual peer_class_pool&amp; peer_classes() = 0;
│ │ │ │ -		virtual bool ignore_unchoke_slots_set(peer_class_set const&amp; set) const = 0;
│ │ │ │ -		virtual int copy_pertinent_channels(peer_class_set const&amp; set
│ │ │ │ -			, int channel, bandwidth_channel** dst, int m) = 0;
│ │ │ │ -		virtual int use_quota_overhead(peer_class_set&amp; set, int amount_down, int amount_up) = 0;
│ │ │ │ -
│ │ │ │ -		virtual bandwidth_manager* get_bandwidth_manager(int channel) = 0;
│ │ │ │ -
│ │ │ │ -		virtual void sent_bytes(int bytes_payload, int bytes_protocol) = 0;
│ │ │ │ -		virtual void received_bytes(int bytes_payload, int bytes_protocol) = 0;
│ │ │ │ -		virtual void trancieve_ip_packet(int bytes, bool ipv6) = 0;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(276)">../include/libtorrent/aux_/session_impl.hpp:265</a></td><td>make these direct members and generate shared_ptrs to them which alias the listen_socket_t shared_ptr</td></tr><tr id="276" style="display: none;" colspan="3"><td colspan="3"><h2>make these direct members and generate shared_ptrs to them
│ │ │ │ -which alias the listen_socket_t shared_ptr</h2><h4>../include/libtorrent/aux_/session_impl.hpp:265</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			if (udp_sock) return udp_sock-&gt;sock.local_port();
│ │ │ │ -			return 0;
│ │ │ │ -		}
│ │ │ │ -
│ │ │ │ -		// 0 is natpmp 1 is upnp
│ │ │ │ -		// the order of these arrays determines the priority in
│ │ │ │ -		// which their ports will be announced to peers
│ │ │ │ -		aux::array&lt;listen_port_mapping, 2, portmap_transport&gt; tcp_port_mapping;
│ │ │ │ -		aux::array&lt;listen_port_mapping, 2, portmap_transport&gt; udp_port_mapping;
│ │ │ │ -
│ │ │ │ -		// indicates whether this is an SSL listen socket or not
│ │ │ │ -		transport ssl = transport::plaintext;
│ │ │ │ -
│ │ │ │ -		listen_socket_flags_t flags = accept_incoming;
│ │ │ │ -
│ │ │ │ -		// the actual sockets (TCP listen socket and UDP socket)
│ │ │ │ -		// An entry does not necessarily have a UDP or TCP socket. One of these
│ │ │ │ -		// pointers may be nullptr!
│ │ │ │ -		// These must be shared_ptr to avoid a dangling reference if an
│ │ │ │ -		// incoming packet is in the event queue when the socket is erased
│ │ │ │ -<div style="background: #ffff00" width="100%">		std::shared_ptr&lt;tcp::acceptor&gt; sock;
│ │ │ │ -</div>		std::shared_ptr&lt;aux::session_udp_socket&gt; udp_sock;
│ │ │ │ -
│ │ │ │ -		// since udp packets are expected to be dispatched frequently, this saves
│ │ │ │ -		// time on handler allocation every time we read again.
│ │ │ │ -		aux::handler_storage&lt;aux::udp_handler_max_size, aux::udp_handler&gt; udp_handler_storage;
│ │ │ │ -
│ │ │ │ -		std::shared_ptr&lt;natpmp&gt; natpmp_mapper;
│ │ │ │ -		std::shared_ptr&lt;upnp&gt; upnp_mapper;
│ │ │ │ -
│ │ │ │ -		std::shared_ptr&lt;struct lsd&gt; lsd;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(275)">../include/libtorrent/aux_/deprecated.hpp:47</a></td><td>figure out which version of clang this is supported in</td></tr><tr id="275" style="display: none;" colspan="3"><td colspan="3"><h2>figure out which version of clang this is supported in</h2><h4>../include/libtorrent/aux_/deprecated.hpp:47</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
│ │ │ │ +POSSIBILITY OF SUCH DAMAGE.
│ │ │ │  
│ │ │ │ -		// set to true when we receive an incoming connection from this listen
│ │ │ │ -		// socket
│ │ │ │ -		bool incoming_connection = false;
│ │ │ │ -	};
│ │ │ │ +*/
│ │ │ │  
│ │ │ │ -		struct TORRENT_EXTRA_EXPORT listen_endpoint_t
│ │ │ │ -		{
│ │ │ │ -			listen_endpoint_t(address const&amp; adr, int p, std::string dev, transport s
│ │ │ │ -				, listen_socket_flags_t f, address const&amp; nmask = address{})
│ │ │ │ -				: addr(adr), netmask(nmask), port(p), device(std::move(dev)), ssl(s), flags(f) {}
│ │ │ │ +#ifndef TORRENT_DEPRECATED_HPP_INCLUDED
│ │ │ │ +#define TORRENT_DEPRECATED_HPP_INCLUDED
│ │ │ │  
│ │ │ │ -			bool operator==(listen_endpoint_t const&amp; o) const
│ │ │ │ -			{
│ │ │ │ -				return addr == o.addr
│ │ │ │ -					&amp;&amp; port == o.port
│ │ │ │ -					&amp;&amp; device == o.device
│ │ │ │ -					&amp;&amp; ssl == o.ssl
│ │ │ │ -					&amp;&amp; flags == o.flags;
│ │ │ │ -			}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(277)">../include/libtorrent/aux_/session_impl.hpp:1068</a></td><td>replace this by a proper asio timer</td></tr><tr id="277" style="display: none;" colspan="3"><td colspan="3"><h2>replace this by a proper asio timer</h2><h4>../include/libtorrent/aux_/session_impl.hpp:1068</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifdef TORRENT_SSL_PEERS
│ │ │ │ -			void on_incoming_utp_ssl(socket_type s);
│ │ │ │ -			void ssl_handshake(error_code const&amp; ec, socket_type* s);
│ │ │ │ +#if !defined TORRENT_BUILDING_LIBRARY
│ │ │ │ +# define TORRENT_DEPRECATED [[deprecated]]
│ │ │ │ +#else
│ │ │ │ +# define TORRENT_DEPRECATED
│ │ │ │  #endif
│ │ │ │  
│ │ │ │ -			// round-robin index into m_outgoing_interfaces
│ │ │ │ -			mutable std::uint8_t m_interface_index = 0;
│ │ │ │ -
│ │ │ │ -			std::shared_ptr&lt;listen_socket_t&gt; setup_listener(
│ │ │ │ -				listen_endpoint_t const&amp; lep, error_code&amp; ec);
│ │ │ │ +#if defined __clang__
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DISABLE_DHT
│ │ │ │ -			dht::dht_state m_dht_state;
│ │ │ │ -#endif
│ │ │ │ +// ====== CLANG ========
│ │ │ │  
│ │ │ │ -			// this is initialized to the unchoke_interval
│ │ │ │ -			// session_setting and decreased every second.
│ │ │ │ -			// when it reaches zero, it is reset to the
│ │ │ │ -			// unchoke_interval and the unchoke set is
│ │ │ │ -			// recomputed.
│ │ │ │ -<div style="background: #ffff00" width="100%">			int m_unchoke_time_scaler = 0;
│ │ │ │ -</div>
│ │ │ │ -			// this is used to decide when to recalculate which
│ │ │ │ -			// torrents to keep queued and which to activate
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(278)">../include/libtorrent/aux_/session_impl.hpp:1073</a></td><td>replace this by a proper asio timer</td></tr><tr id="278" style="display: none;" colspan="3"><td colspan="3"><h2>replace this by a proper asio timer</h2><h4>../include/libtorrent/aux_/session_impl.hpp:1073</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -			// round-robin index into m_outgoing_interfaces
│ │ │ │ -			mutable std::uint8_t m_interface_index = 0;
│ │ │ │ +# if !defined TORRENT_BUILDING_LIBRARY
│ │ │ │ +<div style="background: #ffff00" width="100%">#  define TORRENT_DEPRECATED_ENUM __attribute__ ((deprecated))
│ │ │ │ +</div># endif
│ │ │ │  
│ │ │ │ -			std::shared_ptr&lt;listen_socket_t&gt; setup_listener(
│ │ │ │ -				listen_endpoint_t const&amp; lep, error_code&amp; ec);
│ │ │ │ +#elif defined __GNUC__
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DISABLE_DHT
│ │ │ │ -			dht::dht_state m_dht_state;
│ │ │ │ -#endif
│ │ │ │ +// ======== GCC ========
│ │ │ │  
│ │ │ │ -			// this is initialized to the unchoke_interval
│ │ │ │ -			// session_setting and decreased every second.
│ │ │ │ -			// when it reaches zero, it is reset to the
│ │ │ │ -			// unchoke_interval and the unchoke set is
│ │ │ │ -			// recomputed.
│ │ │ │ -			int m_unchoke_time_scaler = 0;
│ │ │ │ +// deprecation markup is only enabled when libtorrent
│ │ │ │ +// headers are included by clients, not while building
│ │ │ │ +// libtorrent itself
│ │ │ │ +# if __GNUC__ &gt;= 6 &amp;&amp; !defined TORRENT_BUILDING_LIBRARY
│ │ │ │ +#  define TORRENT_DEPRECATED_ENUM __attribute__ ((deprecated))
│ │ │ │ +# endif
│ │ │ │  
│ │ │ │ -			// this is used to decide when to recalculate which
│ │ │ │ -			// torrents to keep queued and which to activate
│ │ │ │ -<div style="background: #ffff00" width="100%">			int m_auto_manage_time_scaler = 0;
│ │ │ │ -</div>
│ │ │ │ -			// works like unchoke_time_scaler but it
│ │ │ │ -			// is only decreased when the unchoke set
│ │ │ │ -			// is recomputed, and when it reaches zero,
│ │ │ │ -			// the optimistic unchoke is moved to another peer.
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(279)">../include/libtorrent/aux_/session_impl.hpp:1080</a></td><td>replace this by a proper asio timer</td></tr><tr id="279" style="display: none;" colspan="3"><td colspan="3"><h2>replace this by a proper asio timer</h2><h4>../include/libtorrent/aux_/session_impl.hpp:1080</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ -#ifndef TORRENT_DISABLE_DHT
│ │ │ │ -			dht::dht_state m_dht_state;
│ │ │ │  #endif
│ │ │ │  
│ │ │ │ -			// this is initialized to the unchoke_interval
│ │ │ │ -			// session_setting and decreased every second.
│ │ │ │ -			// when it reaches zero, it is reset to the
│ │ │ │ -			// unchoke_interval and the unchoke set is
│ │ │ │ -			// recomputed.
│ │ │ │ -			int m_unchoke_time_scaler = 0;
│ │ │ │ -
│ │ │ │ -			// this is used to decide when to recalculate which
│ │ │ │ -			// torrents to keep queued and which to activate
│ │ │ │ -			int m_auto_manage_time_scaler = 0;
│ │ │ │ -
│ │ │ │ -			// works like unchoke_time_scaler but it
│ │ │ │ -			// is only decreased when the unchoke set
│ │ │ │ -			// is recomputed, and when it reaches zero,
│ │ │ │ -			// the optimistic unchoke is moved to another peer.
│ │ │ │ -<div style="background: #ffff00" width="100%">			int m_optimistic_unchoke_time_scaler = 0;
│ │ │ │ -</div>
│ │ │ │ -			// works like unchoke_time_scaler. Each time
│ │ │ │ -			// it reaches 0, and all the connections are
│ │ │ │ -			// used, the worst connection will be disconnected
│ │ │ │ -			// from the torrent with the most peers
│ │ │ │ -			int m_disconnect_time_scaler = 90;
│ │ │ │ -
│ │ │ │ -			// when this scaler reaches zero, it will
│ │ │ │ -			// scrape one of the auto managed, paused,
│ │ │ │ -			// torrents.
│ │ │ │ -			int m_auto_scrape_time_scaler = 180;
│ │ │ │ -
│ │ │ │ -			// statistics gathered from all torrents.
│ │ │ │ -			stat m_stat;
│ │ │ │ -
│ │ │ │ -			// implements session_interface
│ │ │ │ -			void sent_bytes(int bytes_payload, int bytes_protocol) override;
│ │ │ │ -			void received_bytes(int bytes_payload, int bytes_protocol) override;
│ │ │ │ -			void trancieve_ip_packet(int bytes, bool ipv6) override;
│ │ │ │ -			void sent_syn(bool ipv6) override;
│ │ │ │ -			void received_synack(bool ipv6) override;
│ │ │ │ -
│ │ │ │ -#if TORRENT_ABI_VERSION == 1
│ │ │ │ -			int m_peak_up_rate = 0;
│ │ │ │ +#ifndef TORRENT_DEPRECATED_ENUM
│ │ │ │ +#define TORRENT_DEPRECATED_ENUM
│ │ │ │  #endif
│ │ │ │  
│ │ │ │ -			void on_tick(error_code const&amp; e);
│ │ │ │ -
│ │ │ │ -			void try_connect_more_peers();
│ │ │ │ -			void auto_manage_checking_torrents(std::vector&lt;torrent*&gt;&amp; list
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(280)">../include/libtorrent/aux_/announce_entry.hpp:74</a></td><td>include the number of peers received from this tracker, at last announce</td></tr><tr id="280" style="display: none;" colspan="3"><td colspan="3"><h2>include the number of peers received from this tracker, at last
│ │ │ │ -announce</h2><h4>../include/libtorrent/aux_/announce_entry.hpp:74</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">namespace aux {
│ │ │ │ -
│ │ │ │ -	struct TORRENT_EXTRA_EXPORT announce_infohash
│ │ │ │ -	{
│ │ │ │ -		announce_infohash();
│ │ │ │ -
│ │ │ │ -		// if this tracker has returned an error or warning message
│ │ │ │ -		// that message is stored here
│ │ │ │ -		std::string message;
│ │ │ │ -
│ │ │ │ -		// if this tracker failed the last time it was contacted
│ │ │ │ -		// this error code specifies what error occurred
│ │ │ │ -		error_code last_error;
│ │ │ │ -
│ │ │ │ -		// the time of next tracker announce
│ │ │ │ -		time_point32 next_announce = (time_point32::min)();
│ │ │ │ -
│ │ │ │ -		// no announces before this time
│ │ │ │ -		time_point32 min_announce = (time_point32::min)();
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">
│ │ │ │ -</div>		// these are either -1 or the scrape information this tracker last
│ │ │ │ -		// responded with. *incomplete* is the current number of downloaders in
│ │ │ │ -		// the swarm, *complete* is the current number of seeds in the swarm and
│ │ │ │ -		// *downloaded* is the cumulative number of completed downloads of this
│ │ │ │ -		// torrent, since the beginning of time (from this tracker's point of
│ │ │ │ -		// view).
│ │ │ │ -
│ │ │ │ -		// if this tracker has returned scrape data, these fields are filled in
│ │ │ │ -		// with valid numbers. Otherwise they are set to -1. ``incomplete`` counts
│ │ │ │ -		// the number of current downloaders. ``complete`` counts the number of
│ │ │ │ -		// current peers completed the download, or "seeds". ``downloaded`` is the
│ │ │ │ -		// cumulative number of completed downloads.
│ │ │ │ -		int scrape_incomplete = -1;
│ │ │ │ -		int scrape_complete = -1;
│ │ │ │ -		int scrape_downloaded = -1;
│ │ │ │ -
│ │ │ │ -		// the number of times in a row we have failed to announce to this
│ │ │ │ -		// tracker.
│ │ │ │ -		std::uint8_t fails : 7;
│ │ │ │ -
│ │ │ │ -		// true while we're waiting for a response from the tracker.
│ │ │ │ -		bool updating : 1;
│ │ │ │ -
│ │ │ │ -		// set to true when we get a valid response from an announce
│ │ │ │ -		// with event=started. If it is set, we won't send start in the subsequent
│ │ │ │ -		// announces.
│ │ │ │ -		bool start_sent : 1;
│ │ │ │ -
│ │ │ │ -		// set to true when we send a event=completed.
│ │ │ │ -		bool complete_sent : 1;
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(281)">../include/libtorrent/aux_/pool.hpp:49</a></td><td>ensure the alignment is good here</td></tr><tr id="281" style="display: none;" colspan="3"><td colspan="3"><h2>ensure the alignment is good here</h2><h4>../include/libtorrent/aux_/pool.hpp:49</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">POSSIBILITY OF SUCH DAMAGE.
│ │ │ │ -
│ │ │ │ -*/
│ │ │ │ -
│ │ │ │ -#ifndef TORRENT_POOL_HPP
│ │ │ │ -#define TORRENT_POOL_HPP
│ │ │ │ -
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_push.hpp"
│ │ │ │ -#include &lt;boost/pool/pool.hpp&gt;
│ │ │ │ -#include &lt;boost/pool/object_pool.hpp&gt;
│ │ │ │ -#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │ -
│ │ │ │ -namespace libtorrent {
│ │ │ │ -namespace aux {
│ │ │ │ -
│ │ │ │ -struct allocator_new_delete
│ │ │ │ -{
│ │ │ │ -	using size_type = std::size_t;
│ │ │ │ -	using difference_type = std::ptrdiff_t;
│ │ │ │ -
│ │ │ │ -<div style="background: #ffff00" width="100%">	static char* malloc(size_type const bytes)
│ │ │ │ -</div>	{ return new char[bytes]; }
│ │ │ │ -	static void free(char* const block)
│ │ │ │ -	{ delete [] block; }
│ │ │ │ -};
│ │ │ │ -
│ │ │ │ -using pool = boost::pool&lt;allocator_new_delete&gt;;
│ │ │ │ -
│ │ │ │ -template &lt;typename T&gt;
│ │ │ │ -using object_pool = boost::object_pool&lt;T, allocator_new_delete&gt;;
│ │ │ │ -
│ │ │ │ -}
│ │ │ │ -}
│ │ │ │ -
│ │ │ │  #endif
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(282)">../include/libtorrent/aux_/merkle_tree.hpp:85</a></td><td>remove this constructor. Don't support "uninitialized" trees. This also requires not constructing these for pad-files and small files as well. So, a sparse hash list in torrent_info</td></tr><tr id="282" style="display: none;" colspan="3"><td colspan="3"><h2>remove this constructor. Don't support "uninitialized" trees. This
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(276)">../include/libtorrent/aux_/merkle_tree.hpp:85</a></td><td>remove this constructor. Don't support "uninitialized" trees. This also requires not constructing these for pad-files and small files as well. So, a sparse hash list in torrent_info</td></tr><tr id="276" style="display: none;" colspan="3"><td colspan="3"><h2>remove this constructor. Don't support "uninitialized" trees. This
│ │ │ │  also requires not constructing these for pad-files and small files as
│ │ │ │  well. So, a sparse hash list in torrent_info</h2><h4>../include/libtorrent/aux_/merkle_tree.hpp:85</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">// The invariant of the tree is that all interior nodes (i.e. all but the very
│ │ │ │  // bottom leaf nodes, representing block hashes) are either set and valid, or
│ │ │ │  // clear. No invalid hashes are allowed, and they can only be added by also
│ │ │ │  // providing proof of being valid.
│ │ │ │  
│ │ │ │  // The leaf blocks on the other hand, MAY be invalid. For instance, when adding
│ │ │ │ @@ -11812,15 +11562,15 @@
│ │ │ │  
│ │ │ │  	// returns true if the entire tree is known and verified
│ │ │ │  	bool is_complete() const;
│ │ │ │  
│ │ │ │  	// returns true if all block hashes in the specified range have been verified
│ │ │ │  	bool blocks_verified(int block_idx, int num_blocks) const;
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(283)">../include/libtorrent/aux_/merkle_tree.hpp:175</a></td><td>make this a std::unique_ptr<sha256_hash[]></td></tr><tr id="283" style="display: none;" colspan="3"><td colspan="3"><h2>make this a std::unique_ptr<sha256_hash[]></h2><h4>../include/libtorrent/aux_/merkle_tree.hpp:175</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(277)">../include/libtorrent/aux_/merkle_tree.hpp:175</a></td><td>make this a std::unique_ptr<sha256_hash[]></td></tr><tr id="277" style="display: none;" colspan="3"><td colspan="3"><h2>make this a std::unique_ptr<sha256_hash[]></h2><h4>../include/libtorrent/aux_/merkle_tree.hpp:175</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  	int blocks_per_piece() const { return 1 &lt;&lt; m_blocks_per_piece_log; }
│ │ │ │  	// the number tree levels per piece. This is 0 if the block layer is also
│ │ │ │  	// the piece layer.
│ │ │ │  	int piece_levels() const { return m_blocks_per_piece_log; }
│ │ │ │  
│ │ │ │  	int block_layer_start() const;
│ │ │ │  	int piece_layer_start() const;
│ │ │ │ @@ -11863,56 +11613,102 @@
│ │ │ │  		// we don't have any hashes in this tree. m_tree should be empty
│ │ │ │  		// an empty tree still always have the root hash (available as root())
│ │ │ │  		empty_tree,
│ │ │ │  
│ │ │ │  		// in this mode, m_tree represents the full tree, including padding.
│ │ │ │  		full_tree,
│ │ │ │  
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(284)">../include/libtorrent/aux_/deprecated.hpp:47</a></td><td>figure out which version of clang this is supported in</td></tr><tr id="284" style="display: none;" colspan="3"><td colspan="3"><h2>figure out which version of clang this is supported in</h2><h4>../include/libtorrent/aux_/deprecated.hpp:47</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
│ │ │ │ -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
│ │ │ │ -POSSIBILITY OF SUCH DAMAGE.
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(278)">../include/libtorrent/aux_/announce_entry.hpp:74</a></td><td>include the number of peers received from this tracker, at last announce</td></tr><tr id="278" style="display: none;" colspan="3"><td colspan="3"><h2>include the number of peers received from this tracker, at last
│ │ │ │ +announce</h2><h4>../include/libtorrent/aux_/announce_entry.hpp:74</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">namespace aux {
│ │ │ │  
│ │ │ │ -*/
│ │ │ │ +	struct TORRENT_EXTRA_EXPORT announce_infohash
│ │ │ │ +	{
│ │ │ │ +		announce_infohash();
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DEPRECATED_HPP_INCLUDED
│ │ │ │ -#define TORRENT_DEPRECATED_HPP_INCLUDED
│ │ │ │ +		// if this tracker has returned an error or warning message
│ │ │ │ +		// that message is stored here
│ │ │ │ +		std::string message;
│ │ │ │  
│ │ │ │ -#if !defined TORRENT_BUILDING_LIBRARY
│ │ │ │ -# define TORRENT_DEPRECATED [[deprecated]]
│ │ │ │ -#else
│ │ │ │ -# define TORRENT_DEPRECATED
│ │ │ │ -#endif
│ │ │ │ +		// if this tracker failed the last time it was contacted
│ │ │ │ +		// this error code specifies what error occurred
│ │ │ │ +		error_code last_error;
│ │ │ │  
│ │ │ │ -#if defined __clang__
│ │ │ │ +		// the time of next tracker announce
│ │ │ │ +		time_point32 next_announce = (time_point32::min)();
│ │ │ │  
│ │ │ │ -// ====== CLANG ========
│ │ │ │ +		// no announces before this time
│ │ │ │ +		time_point32 min_announce = (time_point32::min)();
│ │ │ │  
│ │ │ │ -# if !defined TORRENT_BUILDING_LIBRARY
│ │ │ │ -<div style="background: #ffff00" width="100%">#  define TORRENT_DEPRECATED_ENUM __attribute__ ((deprecated))
│ │ │ │ -</div># endif
│ │ │ │ +<div style="background: #ffff00" width="100%">
│ │ │ │ +</div>		// these are either -1 or the scrape information this tracker last
│ │ │ │ +		// responded with. *incomplete* is the current number of downloaders in
│ │ │ │ +		// the swarm, *complete* is the current number of seeds in the swarm and
│ │ │ │ +		// *downloaded* is the cumulative number of completed downloads of this
│ │ │ │ +		// torrent, since the beginning of time (from this tracker's point of
│ │ │ │ +		// view).
│ │ │ │  
│ │ │ │ -#elif defined __GNUC__
│ │ │ │ +		// if this tracker has returned scrape data, these fields are filled in
│ │ │ │ +		// with valid numbers. Otherwise they are set to -1. ``incomplete`` counts
│ │ │ │ +		// the number of current downloaders. ``complete`` counts the number of
│ │ │ │ +		// current peers completed the download, or "seeds". ``downloaded`` is the
│ │ │ │ +		// cumulative number of completed downloads.
│ │ │ │ +		int scrape_incomplete = -1;
│ │ │ │ +		int scrape_complete = -1;
│ │ │ │ +		int scrape_downloaded = -1;
│ │ │ │  
│ │ │ │ -// ======== GCC ========
│ │ │ │ +		// the number of times in a row we have failed to announce to this
│ │ │ │ +		// tracker.
│ │ │ │ +		std::uint8_t fails : 7;
│ │ │ │  
│ │ │ │ -// deprecation markup is only enabled when libtorrent
│ │ │ │ -// headers are included by clients, not while building
│ │ │ │ -// libtorrent itself
│ │ │ │ -# if __GNUC__ &gt;= 6 &amp;&amp; !defined TORRENT_BUILDING_LIBRARY
│ │ │ │ -#  define TORRENT_DEPRECATED_ENUM __attribute__ ((deprecated))
│ │ │ │ -# endif
│ │ │ │ +		// true while we're waiting for a response from the tracker.
│ │ │ │ +		bool updating : 1;
│ │ │ │  
│ │ │ │ -#endif
│ │ │ │ +		// set to true when we get a valid response from an announce
│ │ │ │ +		// with event=started. If it is set, we won't send start in the subsequent
│ │ │ │ +		// announces.
│ │ │ │ +		bool start_sent : 1;
│ │ │ │  
│ │ │ │ -#ifndef TORRENT_DEPRECATED_ENUM
│ │ │ │ -#define TORRENT_DEPRECATED_ENUM
│ │ │ │ -#endif
│ │ │ │ +		// set to true when we send a event=completed.
│ │ │ │ +		bool complete_sent : 1;
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(279)">../include/libtorrent/aux_/pool.hpp:49</a></td><td>ensure the alignment is good here</td></tr><tr id="279" style="display: none;" colspan="3"><td colspan="3"><h2>ensure the alignment is good here</h2><h4>../include/libtorrent/aux_/pool.hpp:49</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">POSSIBILITY OF SUCH DAMAGE.
│ │ │ │ +
│ │ │ │ +*/
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_POOL_HPP
│ │ │ │ +#define TORRENT_POOL_HPP
│ │ │ │ +
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_push.hpp"
│ │ │ │ +#include &lt;boost/pool/pool.hpp&gt;
│ │ │ │ +#include &lt;boost/pool/object_pool.hpp&gt;
│ │ │ │ +#include "libtorrent/aux_/disable_warnings_pop.hpp"
│ │ │ │ +
│ │ │ │ +namespace libtorrent {
│ │ │ │ +namespace aux {
│ │ │ │ +
│ │ │ │ +struct allocator_new_delete
│ │ │ │ +{
│ │ │ │ +	using size_type = std::size_t;
│ │ │ │ +	using difference_type = std::ptrdiff_t;
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">	static char* malloc(size_type const bytes)
│ │ │ │ +</div>	{ return new char[bytes]; }
│ │ │ │ +	static void free(char* const block)
│ │ │ │ +	{ delete [] block; }
│ │ │ │ +};
│ │ │ │ +
│ │ │ │ +using pool = boost::pool&lt;allocator_new_delete&gt;;
│ │ │ │ +
│ │ │ │ +template &lt;typename T&gt;
│ │ │ │ +using object_pool = boost::object_pool&lt;T, allocator_new_delete&gt;;
│ │ │ │ +
│ │ │ │ +}
│ │ │ │ +}
│ │ │ │  
│ │ │ │  #endif
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(285)">../include/libtorrent/aux_/allocating_handler.hpp:316</a></td><td>in C++17, Handler and Storage could just use "auto"</td></tr><tr id="285" style="display: none;" colspan="3"><td colspan="3"><h2>in C++17, Handler and Storage could just use "auto"</h2><h4>../include/libtorrent/aux_/allocating_handler.hpp:316</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(280)">../include/libtorrent/aux_/allocating_handler.hpp:316</a></td><td>in C++17, Handler and Storage could just use "auto"</td></tr><tr id="280" style="display: none;" colspan="3"><td colspan="3"><h2>in C++17, Handler and Storage could just use "auto"</h2><h4>../include/libtorrent/aux_/allocating_handler.hpp:316</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │  	private:
│ │ │ │  
│ │ │ │  		Handler handler;
│ │ │ │  		handler_storage&lt;Size, Name&gt;* storage;
│ │ │ │  #ifndef BOOST_NO_EXCEPTIONS
│ │ │ │  		error_handler_interface* error_handler;
│ │ │ │  #endif
│ │ │ │ @@ -11955,15 +11751,15 @@
│ │ │ │  			{
│ │ │ │  				(ptr_.get()-&gt;*ErrorHandler)(e.code());
│ │ │ │  			}
│ │ │ │  			catch (std::exception const&amp; e)
│ │ │ │  			{
│ │ │ │  				(ptr_.get()-&gt;*ExceptHandler)(e);
│ │ │ │  			}
│ │ │ │ -</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(286)">../include/libtorrent/aux_/utp_stream.hpp:693</a></td><td>it would be nice to make this private</td></tr><tr id="286" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to make this private</h2><h4>../include/libtorrent/aux_/utp_stream.hpp:693</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	bool consume_incoming_data(
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(281)">../include/libtorrent/aux_/utp_stream.hpp:693</a></td><td>it would be nice to make this private</td></tr><tr id="281" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to make this private</h2><h4>../include/libtorrent/aux_/utp_stream.hpp:693</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">	bool consume_incoming_data(
│ │ │ │  		utp_header const* ph, std::uint8_t const* ptr, int payload_size, time_point now);
│ │ │ │  	void update_mtu_limits();
│ │ │ │  	void experienced_loss(std::uint32_t seq_nr, time_point now);
│ │ │ │  
│ │ │ │  	void send_deferred_ack();
│ │ │ │  	void socket_drained();
│ │ │ │  
│ │ │ │ @@ -12006,8 +11802,212 @@
│ │ │ │  	// it's important that these match the enums in performance_counters for
│ │ │ │  	// num_utp_idle etc.
│ │ │ │  	enum class state_t {
│ │ │ │  		// not yet connected
│ │ │ │  		none,
│ │ │ │  		// sent a syn packet, not received any acks
│ │ │ │  		syn_sent,
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(282)">../include/libtorrent/aux_/session_impl.hpp:265</a></td><td>make these direct members and generate shared_ptrs to them which alias the listen_socket_t shared_ptr</td></tr><tr id="282" style="display: none;" colspan="3"><td colspan="3"><h2>make these direct members and generate shared_ptrs to them
│ │ │ │ +which alias the listen_socket_t shared_ptr</h2><h4>../include/libtorrent/aux_/session_impl.hpp:265</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">			if (udp_sock) return udp_sock-&gt;sock.local_port();
│ │ │ │ +			return 0;
│ │ │ │ +		}
│ │ │ │ +
│ │ │ │ +		// 0 is natpmp 1 is upnp
│ │ │ │ +		// the order of these arrays determines the priority in
│ │ │ │ +		// which their ports will be announced to peers
│ │ │ │ +		aux::array&lt;listen_port_mapping, 2, portmap_transport&gt; tcp_port_mapping;
│ │ │ │ +		aux::array&lt;listen_port_mapping, 2, portmap_transport&gt; udp_port_mapping;
│ │ │ │ +
│ │ │ │ +		// indicates whether this is an SSL listen socket or not
│ │ │ │ +		transport ssl = transport::plaintext;
│ │ │ │ +
│ │ │ │ +		listen_socket_flags_t flags = accept_incoming;
│ │ │ │ +
│ │ │ │ +		// the actual sockets (TCP listen socket and UDP socket)
│ │ │ │ +		// An entry does not necessarily have a UDP or TCP socket. One of these
│ │ │ │ +		// pointers may be nullptr!
│ │ │ │ +		// These must be shared_ptr to avoid a dangling reference if an
│ │ │ │ +		// incoming packet is in the event queue when the socket is erased
│ │ │ │ +<div style="background: #ffff00" width="100%">		std::shared_ptr&lt;tcp::acceptor&gt; sock;
│ │ │ │ +</div>		std::shared_ptr&lt;aux::session_udp_socket&gt; udp_sock;
│ │ │ │ +
│ │ │ │ +		// since udp packets are expected to be dispatched frequently, this saves
│ │ │ │ +		// time on handler allocation every time we read again.
│ │ │ │ +		aux::handler_storage&lt;aux::udp_handler_max_size, aux::udp_handler&gt; udp_handler_storage;
│ │ │ │ +
│ │ │ │ +		std::shared_ptr&lt;natpmp&gt; natpmp_mapper;
│ │ │ │ +		std::shared_ptr&lt;upnp&gt; upnp_mapper;
│ │ │ │ +
│ │ │ │ +		std::shared_ptr&lt;struct lsd&gt; lsd;
│ │ │ │ +
│ │ │ │ +		// set to true when we receive an incoming connection from this listen
│ │ │ │ +		// socket
│ │ │ │ +		bool incoming_connection = false;
│ │ │ │ +	};
│ │ │ │ +
│ │ │ │ +		struct TORRENT_EXTRA_EXPORT listen_endpoint_t
│ │ │ │ +		{
│ │ │ │ +			listen_endpoint_t(address const&amp; adr, int p, std::string dev, transport s
│ │ │ │ +				, listen_socket_flags_t f, address const&amp; nmask = address{})
│ │ │ │ +				: addr(adr), netmask(nmask), port(p), device(std::move(dev)), ssl(s), flags(f) {}
│ │ │ │ +
│ │ │ │ +			bool operator==(listen_endpoint_t const&amp; o) const
│ │ │ │ +			{
│ │ │ │ +				return addr == o.addr
│ │ │ │ +					&amp;&amp; port == o.port
│ │ │ │ +					&amp;&amp; device == o.device
│ │ │ │ +					&amp;&amp; ssl == o.ssl
│ │ │ │ +					&amp;&amp; flags == o.flags;
│ │ │ │ +			}
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(283)">../include/libtorrent/aux_/session_impl.hpp:1068</a></td><td>replace this by a proper asio timer</td></tr><tr id="283" style="display: none;" colspan="3"><td colspan="3"><h2>replace this by a proper asio timer</h2><h4>../include/libtorrent/aux_/session_impl.hpp:1068</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">#ifdef TORRENT_SSL_PEERS
│ │ │ │ +			void on_incoming_utp_ssl(socket_type s);
│ │ │ │ +			void ssl_handshake(error_code const&amp; ec, socket_type* s);
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +			// round-robin index into m_outgoing_interfaces
│ │ │ │ +			mutable std::uint8_t m_interface_index = 0;
│ │ │ │ +
│ │ │ │ +			std::shared_ptr&lt;listen_socket_t&gt; setup_listener(
│ │ │ │ +				listen_endpoint_t const&amp; lep, error_code&amp; ec);
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_DHT
│ │ │ │ +			dht::dht_state m_dht_state;
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +			// this is initialized to the unchoke_interval
│ │ │ │ +			// session_setting and decreased every second.
│ │ │ │ +			// when it reaches zero, it is reset to the
│ │ │ │ +			// unchoke_interval and the unchoke set is
│ │ │ │ +			// recomputed.
│ │ │ │ +<div style="background: #ffff00" width="100%">			int m_unchoke_time_scaler = 0;
│ │ │ │ +</div>
│ │ │ │ +			// this is used to decide when to recalculate which
│ │ │ │ +			// torrents to keep queued and which to activate
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(284)">../include/libtorrent/aux_/session_impl.hpp:1073</a></td><td>replace this by a proper asio timer</td></tr><tr id="284" style="display: none;" colspan="3"><td colspan="3"><h2>replace this by a proper asio timer</h2><h4>../include/libtorrent/aux_/session_impl.hpp:1073</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +			// round-robin index into m_outgoing_interfaces
│ │ │ │ +			mutable std::uint8_t m_interface_index = 0;
│ │ │ │ +
│ │ │ │ +			std::shared_ptr&lt;listen_socket_t&gt; setup_listener(
│ │ │ │ +				listen_endpoint_t const&amp; lep, error_code&amp; ec);
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_DHT
│ │ │ │ +			dht::dht_state m_dht_state;
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +			// this is initialized to the unchoke_interval
│ │ │ │ +			// session_setting and decreased every second.
│ │ │ │ +			// when it reaches zero, it is reset to the
│ │ │ │ +			// unchoke_interval and the unchoke set is
│ │ │ │ +			// recomputed.
│ │ │ │ +			int m_unchoke_time_scaler = 0;
│ │ │ │ +
│ │ │ │ +			// this is used to decide when to recalculate which
│ │ │ │ +			// torrents to keep queued and which to activate
│ │ │ │ +<div style="background: #ffff00" width="100%">			int m_auto_manage_time_scaler = 0;
│ │ │ │ +</div>
│ │ │ │ +			// works like unchoke_time_scaler but it
│ │ │ │ +			// is only decreased when the unchoke set
│ │ │ │ +			// is recomputed, and when it reaches zero,
│ │ │ │ +			// the optimistic unchoke is moved to another peer.
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(285)">../include/libtorrent/aux_/session_impl.hpp:1080</a></td><td>replace this by a proper asio timer</td></tr><tr id="285" style="display: none;" colspan="3"><td colspan="3"><h2>replace this by a proper asio timer</h2><h4>../include/libtorrent/aux_/session_impl.hpp:1080</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">
│ │ │ │ +#ifndef TORRENT_DISABLE_DHT
│ │ │ │ +			dht::dht_state m_dht_state;
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +			// this is initialized to the unchoke_interval
│ │ │ │ +			// session_setting and decreased every second.
│ │ │ │ +			// when it reaches zero, it is reset to the
│ │ │ │ +			// unchoke_interval and the unchoke set is
│ │ │ │ +			// recomputed.
│ │ │ │ +			int m_unchoke_time_scaler = 0;
│ │ │ │ +
│ │ │ │ +			// this is used to decide when to recalculate which
│ │ │ │ +			// torrents to keep queued and which to activate
│ │ │ │ +			int m_auto_manage_time_scaler = 0;
│ │ │ │ +
│ │ │ │ +			// works like unchoke_time_scaler but it
│ │ │ │ +			// is only decreased when the unchoke set
│ │ │ │ +			// is recomputed, and when it reaches zero,
│ │ │ │ +			// the optimistic unchoke is moved to another peer.
│ │ │ │ +<div style="background: #ffff00" width="100%">			int m_optimistic_unchoke_time_scaler = 0;
│ │ │ │ +</div>
│ │ │ │ +			// works like unchoke_time_scaler. Each time
│ │ │ │ +			// it reaches 0, and all the connections are
│ │ │ │ +			// used, the worst connection will be disconnected
│ │ │ │ +			// from the torrent with the most peers
│ │ │ │ +			int m_disconnect_time_scaler = 90;
│ │ │ │ +
│ │ │ │ +			// when this scaler reaches zero, it will
│ │ │ │ +			// scrape one of the auto managed, paused,
│ │ │ │ +			// torrents.
│ │ │ │ +			int m_auto_scrape_time_scaler = 180;
│ │ │ │ +
│ │ │ │ +			// statistics gathered from all torrents.
│ │ │ │ +			stat m_stat;
│ │ │ │ +
│ │ │ │ +			// implements session_interface
│ │ │ │ +			void sent_bytes(int bytes_payload, int bytes_protocol) override;
│ │ │ │ +			void received_bytes(int bytes_payload, int bytes_protocol) override;
│ │ │ │ +			void trancieve_ip_packet(int bytes, bool ipv6) override;
│ │ │ │ +			void sent_syn(bool ipv6) override;
│ │ │ │ +			void received_synack(bool ipv6) override;
│ │ │ │ +
│ │ │ │ +#if TORRENT_ABI_VERSION == 1
│ │ │ │ +			int m_peak_up_rate = 0;
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +			void on_tick(error_code const&amp; e);
│ │ │ │ +
│ │ │ │ +			void try_connect_more_peers();
│ │ │ │ +			void auto_manage_checking_torrents(std::vector&lt;torrent*&gt;&amp; list
│ │ │ │ +</pre></td></tr><tr style="background: #ccc"><td>relevance&nbsp;0</td><td><a href="javascript:expand(286)">../include/libtorrent/aux_/session_interface.hpp:212</a></td><td>it would be nice to not have this be part of session_interface</td></tr><tr id="286" style="display: none;" colspan="3"><td colspan="3"><h2>it would be nice to not have this be part of session_interface</h2><h4>../include/libtorrent/aux_/session_interface.hpp:212</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">		virtual void deferred_submit_jobs() = 0;
│ │ │ │ +
│ │ │ │ +		virtual std::uint16_t listen_port() const = 0;
│ │ │ │ +		virtual std::uint16_t ssl_listen_port() const = 0;
│ │ │ │ +
│ │ │ │ +		virtual int listen_port(aux::transport ssl, address const&amp; local_addr) = 0;
│ │ │ │ +
│ │ │ │ +		virtual void for_each_listen_socket(std::function&lt;void(aux::listen_socket_handle const&amp;)&gt; f) = 0;
│ │ │ │ +
│ │ │ │ +		// ask for which interface and port to bind outgoing peer connections on
│ │ │ │ +		virtual tcp::endpoint bind_outgoing_socket(socket_type&amp; s, address const&amp;
│ │ │ │ +			remote_address, error_code&amp; ec) const = 0;
│ │ │ │ +		virtual bool verify_bound_address(address const&amp; addr, bool utp
│ │ │ │ +			, error_code&amp; ec) = 0;
│ │ │ │ +
│ │ │ │ +#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS
│ │ │ │ +		virtual std::vector&lt;std::shared_ptr&lt;torrent&gt;&gt; find_collection(
│ │ │ │ +			std::string const&amp; collection) const = 0;
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +<div style="background: #ffff00" width="100%">		virtual proxy_settings proxy() const = 0;
│ │ │ │ +</div>
│ │ │ │ +#if TORRENT_USE_I2P
│ │ │ │ +		virtual char const* i2p_session() const = 0;
│ │ │ │ +		virtual std::string const&amp; local_i2p_endpoint() const = 0;
│ │ │ │ +#endif
│ │ │ │ +
│ │ │ │ +		virtual void prioritize_connections(std::weak_ptr&lt;torrent&gt; t) = 0;
│ │ │ │ +
│ │ │ │ +		virtual void trigger_auto_manage() = 0;
│ │ │ │ +
│ │ │ │ +		virtual void apply_settings_pack(std::shared_ptr&lt;settings_pack&gt; pack) = 0;
│ │ │ │ +		virtual session_settings const&amp; settings() const = 0;
│ │ │ │ +
│ │ │ │ +		virtual void queue_tracker_request(tracker_request req
│ │ │ │ +			, std::weak_ptr&lt;request_callback&gt; c) = 0;
│ │ │ │ +
│ │ │ │ +		// peer-classes
│ │ │ │ +		virtual void set_peer_classes(peer_class_set* s, address const&amp; a, socket_type_t st) = 0;
│ │ │ │ +		virtual peer_class_pool const&amp; peer_classes() const = 0;
│ │ │ │ +		virtual peer_class_pool&amp; peer_classes() = 0;
│ │ │ │ +		virtual bool ignore_unchoke_slots_set(peer_class_set const&amp; set) const = 0;
│ │ │ │ +		virtual int copy_pertinent_channels(peer_class_set const&amp; set
│ │ │ │ +			, int channel, bandwidth_channel** dst, int m) = 0;
│ │ │ │ +		virtual int use_quota_overhead(peer_class_set&amp; set, int amount_down, int amount_up) = 0;
│ │ │ │ +
│ │ │ │ +		virtual bandwidth_manager* get_bandwidth_manager(int channel) = 0;
│ │ │ │ +
│ │ │ │ +		virtual void sent_bytes(int bytes_payload, int bytes_protocol) = 0;
│ │ │ │ +		virtual void received_bytes(int bytes_payload, int bytes_protocol) = 0;
│ │ │ │ +		virtual void trancieve_ip_packet(int bytes, bool ipv6) = 0;
│ │ │ │  </pre></td></tr></table></body></html>
│ │ │ │ ├── html2text {}
│ │ │ │ │ @@ -454,68 +454,352 @@
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |	auto o = rpc.allocate_observer<null_observer>(std::move(algo), source, node_id());                                                                                            |
│ │ │ │ │  |#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │  |	o->m_in_constructor = false;                                                                                                                                                  |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |	o->flags |= observer::flag_queried;                                                                                                                                           |
│ │ │ │ │  |_	_r_p_c_._i_n_v_o_k_e_(_r_e_q_,_ _s_o_u_r_c_e_,_ _o_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_s_e_s_s_i_o_n___h_a_n_d_l_e_._c_p_p_:_6_9_1_ _|_e_x_p_o_s_e_ _t_h_e_ _s_e_q_u_e_n_c_e___n_u_m_b_e_r_,_ _p_u_b_l_i_c___k_e_y_,_ _s_e_c_r_e_t___k_e_y_ _a_n_d_ _s_i_g_n_a_t_u_r_e_ _t_y_p_e_s_ _t_o_ _t_h_e_ _c_l_i_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** eexxppoossee tthhee sseeqquueennccee__nnuummbbeerr,, ppuubblliicc__kkeeyy,, sseeccrreett__kkeeyy aanndd ssiiggnnaattuurree ttyyppeess ttoo tthhee cclliieenntt **********                                                                               |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__hhaannddllee..ccpppp::669911 ******                                                                                                                                          |
│ │ │ │ │ -|void session_handle::dht_get_item(sha1_hash const& target)                                                                                                                     |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_u_t___m_e_t_a_d_a_t_a_._c_p_p_:_2_6_8_ _ _ _ _|_u_s_e_ _t_h_e_ _a_u_x_:_:_w_r_i_t_e___*_ _f_u_n_c_t_i_o_n_s_ _a_n_d_ _t_h_e_ _s_p_a_n_ _h_e_r_e_ _i_n_s_t_e_a_d_,_ _i_t_ _w_i_l_l_ _f_i_t_ _b_e_t_t_e_r_ _w_i_t_h_ _s_e_n_d___b_u_f_f_e_r_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** uussee tthhee aauuxx::::wwrriittee__** ffuunnccttiioonnss aanndd tthhee ssppaann hheerree iinnsstteeaadd,, iitt wwiillll ffiitt bbeetttteerr wwiitthh sseenndd__bbuuffffeerr(()) **********                                                                    |
│ │ │ │ │ +|****** ....//ssrrcc//uutt__mmeettaaddaattaa..ccpppp::226688 ******                                                                                                                                             |
│ │ │ │ │ +|int metadata_piece_size = 0;                                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (m_torrent.valid_metadata())                                                                                                                                             |
│ │ │ │ │ +|				e["total_size"] = m_tp.metadata().size();                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (type == msg_t::piece)                                                                                                                                                   |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				TORRENT_ASSERT(piece >= 0 && piece < (m_tp.metadata().size() + 16 * 1024 - 1) / (16 * 1024));                                                                              |
│ │ │ │ │ +|				TORRENT_ASSERT(m_pc.associated_torrent().lock()->valid_metadata());                                                                                                        |
│ │ │ │ │ +|				TORRENT_ASSERT(m_torrent.valid_metadata());                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|				int const offset = piece * 16 * 1024;                                                                                                                                      |
│ │ │ │ │ +|				metadata = m_tp.metadata().data() + offset;                                                                                                                                |
│ │ │ │ │ +|				metadata_piece_size = std::min(                                                                                                                                            |
│ │ │ │ │ +|					int(m_tp.metadata().size()) - offset, 16 * 1024);                                                                                                                         |
│ │ │ │ │ +|				TORRENT_ASSERT(metadata_piece_size > 0);                                                                                                                                   |
│ │ │ │ │ +|				TORRENT_ASSERT(offset >= 0);                                                                                                                                               |
│ │ │ │ │ +|				TORRENT_ASSERT(offset + metadata_piece_size <= m_tp.metadata().size());                                                                                                    |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|char msg[200];                                                                                                                                                                 |
│ │ │ │ │ +|char* header = msg;                                                                                                                                                            |
│ │ │ │ │ +|			char* p = &msg[6];                                                                                                                                                          |
│ │ │ │ │ +|			int const len = bencode(p, e);                                                                                                                                              |
│ │ │ │ │ +|			int const total_size = 2 + len + metadata_piece_size;                                                                                                                       |
│ │ │ │ │ +|			namespace io = aux;                                                                                                                                                         |
│ │ │ │ │ +|			io::write_uint32(total_size, header);                                                                                                                                       |
│ │ │ │ │ +|			io::write_uint8(bt_peer_connection::msg_extended, header);                                                                                                                  |
│ │ │ │ │ +|			io::write_uint8(m_message_index, header);                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_	_	_	_m___p_c_._s_e_n_d___b_u_f_f_e_r_(_{_m_s_g_,_ _l_e_n_ _+_ _6_}_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_1_9_ _ _ _ _ _ _ _ _|_w_e_ _c_o_u_l_d_ _p_r_o_b_a_b_l_y_ _g_e_t_ _a_w_a_y_ _w_i_t_h_ _j_u_s_t_ _s_a_v_i_n_g_ _a_ _f_e_w_ _f_i_e_l_d_s_ _h_e_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** wwee ccoouulldd pprroobbaabbllyy ggeett aawwaayy wwiitthh jjuusstt ssaavviinngg aa ffeeww ffiieellddss hheerree **********                                                                                                      |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::441199 ******                                                                                                                                                 |
│ │ │ │ │ +|// --- V2 HASHES ---                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_torrent_file->is_valid() && m_torrent_file->info_hashes().has_v2())                                                                                                    |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (!p.merkle_trees.empty())                                                                                                                                                |
│ │ │ │ │ +|				load_merkle_trees(                                                                                                                                                         |
│ │ │ │ │ +|					std::move(p.merkle_trees)                                                                                                                                                 |
│ │ │ │ │ +|					, std::move(p.merkle_tree_mask)                                                                                                                                           |
│ │ │ │ │ +|					, std::move(p.verified_leaf_hashes));                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// we really don't want to store extra copies of the trees                                                                                                                  |
│ │ │ │ │ +|			TORRENT_ASSERT(p.merkle_trees.empty());                                                                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (valid_metadata())                                                                                                                                                        |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			inc_stats_counter(counters::num_total_pieces_added                                                                                                                          |
│ │ │ │ │ +|				, m_torrent_file->num_pieces());                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|m_add_torrent_params = std::make_unique<add_torrent_params>(std::move(p));                                                                                                     |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void torrent::load_merkle_trees(                                                                                                                                              |
│ │ │ │ │ +|		aux::vector<std::vector<sha256_hash>, file_index_t> trees_import                                                                                                             |
│ │ │ │ │ +|		, aux::vector<std::vector<bool>, file_index_t> mask                                                                                                                          |
│ │ │ │ │ +|		, aux::vector<std::vector<bool>, file_index_t> verified)                                                                                                                     |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|		async_call(&session_impl::dht_get_immutable_item, target);                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		TORRENT_UNUSED(target);                                                                                                                                                      |
│ │ │ │ │ +|		auto const& fs = m_torrent_file->orig_files();                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		std::vector<bool> const empty_verified;                                                                                                                                      |
│ │ │ │ │ +|		for (file_index_t i{0}; i < fs.end_file(); ++i)                                                                                                                              |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (fs.pad_file_at(i) || fs.file_size(i) == 0)                                                                                                                              |
│ │ │ │ │ +|				continue;                                                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (i >= trees_import.end_index()) break;                                                                                                                                   |
│ │ │ │ │ +|			std::vector<bool> const& verified_bitmask = (i >= verified.end_index()) ? empty_verified : verified[i];                                                                     |
│ │ │ │ │ +|			if (i < mask.end_index() && !mask[i].empty())                                                                                                                               |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				mask[i].resize(m_merkle_trees[i].size(), false);                                                                                                                           |
│ │ │ │ │ +|				m_merkle_trees[i].load_sparse_tree(trees_import[i], mask[i], verified_bitmask);                                                                                            |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				m_merkle_trees[i].load_tree(trees_import[i], verified_bitmask);                                                                                                            |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_	_v_o_i_d_ _t_o_r_r_e_n_t_:_:_i_n_c___s_t_a_t_s___c_o_u_n_t_e_r_(_i_n_t_ _c_,_ _i_n_t_ _v_a_l_u_e_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_7_1_5_ _ _ _ _ _ _ _ _|_a_s_s_e_r_t_ _t_h_e_r_e_ _a_r_e_ _n_o_ _o_u_t_s_t_a_n_d_i_n_g_ _a_s_y_n_c_ _o_p_e_r_a_t_i_o_n_s_ _o_n_ _t_h_i_s_ _t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** aasssseerrtt tthheerree aarree nnoo oouuttssttaannddiinngg aassyynncc ooppeerraattiioonnss oonn tthhiiss ttoorrrreenntt **********                                                                                                   |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::771155 ******                                                                                                                                                 |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (!m_ses.dht()) return false;                                                                                                                                              |
│ │ │ │ │ +|		if (m_torrent_file->is_valid() && !m_files_checked) return false;                                                                                                            |
│ │ │ │ │ +|		if (!m_announce_to_dht) return false;                                                                                                                                        |
│ │ │ │ │ +|		if (m_paused) return false;                                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// don't announce private torrents                                                                                                                                           |
│ │ │ │ │ +|		if (m_torrent_file->is_valid() && m_torrent_file->priv()) return false;                                                                                                      |
│ │ │ │ │ +|		if (m_trackers.empty()) return true;                                                                                                                                         |
│ │ │ │ │ +|		if (!settings().get_bool(settings_pack::use_dht_as_fallback)) return true;                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		return std::none_of(m_trackers.begin(), m_trackers.end()                                                                                                                     |
│ │ │ │ │ +|			, [](aux::announce_entry const& tr) { return bool(tr.verified); });                                                                                                         |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_handle::dht_get_item(std::array<char, 32> key                                                                                                                    |
│ │ │ │ │ -|		, std::string salt)                                                                                                                                                          |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	torrent::~torrent()                                                                                                                                                           |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|		async_call(&session_impl::dht_get_mutable_item, key, salt);                                                                                                                  |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		TORRENT_UNUSED(key);                                                                                                                                                         |
│ │ │ │ │ -|		TORRENT_UNUSED(salt);                                                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ +|		for (torrent_list_index_t i{}; i != m_links.end_index(); ++i)                                                                                                                |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (!m_links[i].in_list()) continue;                                                                                                                                        |
│ │ │ │ │ +|			m_links[i].unlink(m_ses.torrent_list(i), i);                                                                                                                                |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// The invariant can't be maintained here, since the torrent                                                                                                                 |
│ │ │ │ │ +|		// is being destructed, all weak references to it have been                                                                                                                  |
│ │ │ │ │ +|		// reset, which means that all its peers already have an                                                                                                                     |
│ │ │ │ │ +|		// invalidated torrent pointer (so it cannot be verified to be correct)                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// i.e. the invariant can only be maintained if all connections have                                                                                                         |
│ │ │ │ │ +|		// been closed by the time the torrent is destructed. And they are                                                                                                           |
│ │ │ │ │ +|		// supposed to be closed. So we can still do the invariant check.                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// however, the torrent object may be destructed from the main                                                                                                               |
│ │ │ │ │ +|		// thread when shutting down, if the disk cache has references to it.                                                                                                        |
│ │ │ │ │ +|		// this means that the invariant check that this is called from the                                                                                                          |
│ │ │ │ │ +|		// network thread cannot be maintained                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(m_peer_class == peer_class_t{0});                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(m_connections.empty());                                                                                                                                       |
│ │ │ │ │ +|		// just in case, make sure the session accounting is kept right                                                                                                              |
│ │ │ │ │ +|		for (auto p : m_connections)                                                                                                                                                 |
│ │ │ │ │ +|			m_ses.close_connection(p);                                                                                                                                                  |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|sha1_hash session_handle::dht_put_item(entry data)                                                                                                                             |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		std::vector<char> buf;                                                                                                                                                       |
│ │ │ │ │ -|		bencode(std::back_inserter(buf), data);                                                                                                                                      |
│ │ │ │ │ -|		sha1_hash const ret = hasher(buf).final();                                                                                                                                   |
│ │ │ │ │ +|_	_v_o_i_d_ _t_o_r_r_e_n_t_:_:_r_e_a_d___p_i_e_c_e_(_p_i_e_c_e___i_n_d_e_x___t_ _c_o_n_s_t_ _p_i_e_c_e_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_3_3_1_ _ _ _ _ _ _ _|_t_h_e_r_e_'_s_ _s_o_m_e_ _d_u_p_l_i_c_a_t_i_o_n_ _b_e_t_w_e_e_n_ _t_h_i_s_ _f_u_n_c_t_i_o_n_ _a_n_d_ _p_e_e_r___c_o_n_n_e_c_t_i_o_n_:_:_i_n_c_o_m_i_n_g___p_i_e_c_e_(_)_._ _i_s_ _t_h_e_r_e_ _a_ _w_a_y_ _t_o_ _m_e_r_g_e_ _s_o_m_e_t_h_i_n_g_?_ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthheerree''ss ssoommee dduupplliiccaattiioonn bbeettwweeeenn tthhiiss ffuunnccttiioonn aanndd ppeeeerr__ccoonnnneeccttiioonn::::iinnccoommiinngg__ppiieeccee(()).. iiss tthheerree aa wwaayy ttoo mmeerrggee ssoommeetthhiinngg?? **********                                           |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::11333311 ******                                                                                                                                                |
│ │ │ │ │ +|piece_index_t m_piece;                                                                                                                                                         |
│ │ │ │ │ +|		bool m_armed = true;                                                                                                                                                         |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|		async_call(&session_impl::dht_put_immutable_item, data, ret);                                                                                                                |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|	void torrent::add_piece_async(piece_index_t const piece                                                                                                                       |
│ │ │ │ │ +|		, std::vector<char> data, add_piece_flags_t const flags)                                                                                                                     |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// make sure the piece index is correct                                                                                                                                      |
│ │ │ │ │ +|		if (piece >= torrent_file().end_piece())                                                                                                                                     |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// make sure the piece size is correct                                                                                                                                       |
│ │ │ │ │ +|		if (data.size() != std::size_t(m_torrent_file->piece_size(piece)))                                                                                                           |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		add_piece(piece, data.data(), flags);                                                                                                                                        |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_handle::dht_put_item(std::array<char, 32> key                                                                                                                    |
│ │ │ │ │ -|		, std::function<void(entry&, std::array<char,64>&                                                                                                                            |
│ │ │ │ │ -|			, std::int64_t&, std::string const&)> cb                                                                                                                                    |
│ │ │ │ │ -|		, std::string salt)                                                                                                                                                          |
│ │ │ │ │ +|void torrent::add_piece(piece_index_t const piece, char const* data                                                                                                            |
│ │ │ │ │ +|, add_piece_flags_t const flags)                                                                                                                                               |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|		async_call(&session_impl::dht_put_mutable_item, key, cb, salt);                                                                                                              |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		TORRENT_UNUSED(key);                                                                                                                                                         |
│ │ │ │ │ -|		TORRENT_UNUSED(cb);                                                                                                                                                          |
│ │ │ │ │ -|		TORRENT_UNUSED(salt);                                                                                                                                                        |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// make sure the piece index is correct                                                                                                                                      |
│ │ │ │ │ +|		if (piece >= torrent_file().end_piece())                                                                                                                                     |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		int const piece_size = m_torrent_file->piece_size(piece);                                                                                                                    |
│ │ │ │ │ +|		int const blocks_in_piece = (piece_size + block_size() - 1) / block_size();                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_deleted) return;                                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// avoid crash trying to access the picker when there is none                                                                                                                |
│ │ │ │ │ +|		if (m_have_all && !has_picker()) return;                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// we don't support clobbering the piece picker while checking the                                                                                                           |
│ │ │ │ │ +|		// files. We may end up having the same piece multiple times                                                                                                                 |
│ │ │ │ │ +|		TORRENT_ASSERT_PRECOND(state() != torrent_status::checking_files                                                                                                             |
│ │ │ │ │ +|			&& state() != torrent_status::checking_resume_data);                                                                                                                        |
│ │ │ │ │ +|		if (state() == torrent_status::checking_files                                                                                                                                |
│ │ │ │ │ +|			|| state() == torrent_status::checking_resume_data)                                                                                                                         |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		need_picker();                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (picker().have_piece(piece)                                                                                                                                               |
│ │ │ │ │ +|			&& !(flags & torrent_handle::overwrite_existing))                                                                                                                           |
│ │ │ │ │ +|_	_	_	_r_e_t_u_r_n_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_3_9_6_6_ _ _ _ _ _ _ _|_t_h_i_s_ _c_o_u_l_d_ _p_r_o_b_a_b_l_y_ _b_e_ _p_u_l_l_e_d_ _o_u_t_ _i_n_t_o_ _a_ _f_r_e_e_ _f_u_n_c_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ccoouulldd pprroobbaabbllyy bbee ppuulllleedd oouutt iinnttoo aa ffrreeee ffuunnccttiioonn **********                                                                                                             |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::33996666 ******                                                                                                                                                |
│ │ │ │ │ +|std::int64_t calc_bytes(file_storage const& fs, piece_count const& pc)                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		// it's an impossible combination to have 0 pieces, but still have one of them be the last piece                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(!(pc.num_pieces == 0 && pc.last_piece == true));                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// if we have 0 pieces, we can't have any pad blocks either                                                                                                                  |
│ │ │ │ │ +|		TORRENT_ASSERT(!(pc.num_pieces == 0 && pc.pad_bytes > 0));                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// if we have all pieces, we must also have the last one                                                                                                                     |
│ │ │ │ │ +|		TORRENT_ASSERT(!(pc.num_pieces == fs.num_pieces() && pc.last_piece == false));                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// every block should not be a pad block                                                                                                                                     |
│ │ │ │ │ +|		TORRENT_ASSERT(pc.pad_bytes <= std::int64_t(pc.num_pieces) * fs.piece_length());                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		return std::int64_t(pc.num_pieces) * fs.piece_length()                                                                                                                       |
│ │ │ │ │ +|			- (pc.last_piece ? fs.piece_length() - fs.piece_size(fs.last_piece()) : 0)                                                                                                  |
│ │ │ │ │ +|			- std::int64_t(pc.pad_bytes);                                                                                                                                               |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_handle::dht_get_peers(sha1_hash const& info_hash)                                                                                                                |
│ │ │ │ │ +|	// fills in total_wanted, total_wanted_done and total_done                                                                                                                    |
│ │ │ │ │ +|void torrent::bytes_done(torrent_status& st, status_flags_t const flags) const                                                                                                 |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		st.total_done = 0;                                                                                                                                                           |
│ │ │ │ │ +|		st.total_wanted_done = 0;                                                                                                                                                    |
│ │ │ │ │ +|		st.total_wanted = m_size_on_disk;                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(st.total_wanted <= m_torrent_file->total_size());                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(st.total_wanted >= 0);                                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(!valid_metadata() || m_torrent_file->num_pieces() > 0);                                                                                                       |
│ │ │ │ │ +|		if (!valid_metadata()) return;                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_seed_mode || is_seed())                                                                                                                                                |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// once we're a seed and remove the piece picker, we stop tracking                                                                                                          |
│ │ │ │ │ +|			// piece- and file priority. We consider everything as being                                                                                                                |
│ │ │ │ │ +|			// "wanted"                                                                                                                                                                 |
│ │ │ │ │ +|			st.total_done = m_torrent_file->total_size() - m_padding_bytes;                                                                                                             |
│ │ │ │ │ +|			st.total_wanted_done = m_size_on_disk;                                                                                                                                      |
│ │ │ │ │ +|			st.total_wanted = m_size_on_disk;                                                                                                                                           |
│ │ │ │ │ +|			TORRENT_ASSERT(st.total_wanted <= st.total_done);                                                                                                                           |
│ │ │ │ │ +|			TORRENT_ASSERT(st.total_wanted_done <= st.total_wanted);                                                                                                                    |
│ │ │ │ │ +|			TORRENT_ASSERT(st.total_done <= m_torrent_file->total_size());                                                                                                              |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		else if (!has_picker())                                                                                                                                                      |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			st.total_done = 0;                                                                                                                                                          |
│ │ │ │ │ +|_	_	_	_s_t_._t_o_t_a_l___w_a_n_t_e_d___d_o_n_e_ _=_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_9_0_5_ _ _ _ _ _ _ _|_s_h_o_u_l_d_ _t_h_i_s_ _a_l_e_r_t_ _h_a_v_e_ _a_n_ _e_r_r_o_r_ _c_o_d_e_ _i_n_ _i_t_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** sshhoouulldd tthhiiss aalleerrtt hhaavvee aann eerrrroorr ccooddee iinn iitt?? **********                                                                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::44990055 ******                                                                                                                                                |
│ │ │ │ │ +|on_remove_peers();                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(m_connections.empty());                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// post a message to the main thread to destruct                                                                                                                             |
│ │ │ │ │ +|		// the torrent object from there                                                                                                                                             |
│ │ │ │ │ +|		if (m_storage)                                                                                                                                                               |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			try {                                                                                                                                                                       |
│ │ │ │ │ +|				m_ses.disk_thread().async_stop_torrent(m_storage                                                                                                                           |
│ │ │ │ │ +|					, std::bind(&torrent::on_torrent_aborted, shared_from_this()));                                                                                                           |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			catch (std::exception const& e)                                                                                                                                             |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				TORRENT_UNUSED(e);                                                                                                                                                         |
│ │ │ │ │ +|				m_storage.reset();                                                                                                                                                         |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|				debug_log("Failed to flush disk cache: %s", e.what());                                                                                                                     |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|				// clients may rely on this alert to be posted, so it's probably a                                                                                                         |
│ │ │ │ │ +|				// good idea to post it here, even though we failed                                                                                                                        |
│ │ │ │ │ +|if (alerts().should_post<cache_flushed_alert>())                                                                                                                               |
│ │ │ │ │ +|alerts().emplace_alert<cache_flushed_alert>(get_handle());                                                                                                                     |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			m_ses.deferred_submit_jobs();                                                                                                                                               |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (alerts().should_post<cache_flushed_alert>())                                                                                                                            |
│ │ │ │ │ +|				alerts().emplace_alert<cache_flushed_alert>(get_handle());                                                                                                                 |
│ │ │ │ │ +|			alerts().emplace_alert<torrent_removed_alert>(get_handle()                                                                                                                  |
│ │ │ │ │ +|				, info_hash(), get_userdata());                                                                                                                                            |
│ │ │ │ │ +|_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_9_7_5_ _ _ _ _ _ _ _|_t_h_i_s_ _s_h_o_u_l_d_ _r_e_t_u_r_n_ _o_p_t_i_o_n_a_l_<_>_._ _p_i_e_c_e_ _i_n_d_e_x_ _-_1_ _s_h_o_u_l_d_ _n_o_t_ _b_e_ _a_l_l_o_w_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss sshhoouulldd rreettuurrnn ooppttiioonnaall<<>>.. ppiieeccee iinnddeexx --11 sshhoouulldd nnoott bbee aalllloowweedd **********                                                                                                |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::44997755 ******                                                                                                                                                |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_SUPERSEEDING                                                                                                                                           |
│ │ │ │ │ +|	void torrent::set_super_seeding(bool const on)                                                                                                                                |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|		async_call(&session_impl::dht_get_peers, info_hash);                                                                                                                         |
│ │ │ │ │ -|_#_e_l_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|		if (on == m_super_seeding) return;                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		m_super_seeding = on;                                                                                                                                                        |
│ │ │ │ │ +|		set_need_save_resume(torrent_handle::if_state_changed);                                                                                                                      |
│ │ │ │ │ +|		state_updated();                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_super_seeding) return;                                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// disable super seeding for all peers                                                                                                                                       |
│ │ │ │ │ +|		for (auto pc : *this)                                                                                                                                                        |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			pc->superseed_piece(piece_index_t(-1), piece_index_t(-1));                                                                                                                  |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|piece_index_t torrent::get_piece_to_super_seed(typed_bitfield<piece_index_t> const& bits)                                                                                      |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		// return a piece with low availability that is not in                                                                                                                       |
│ │ │ │ │ +|		// the bitfield and that is not currently being super                                                                                                                        |
│ │ │ │ │ +|		// seeded by any peer                                                                                                                                                        |
│ │ │ │ │ +|		TORRENT_ASSERT(m_super_seeding);                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// do a linear search from the first piece                                                                                                                                   |
│ │ │ │ │ +|		int min_availability = 9999;                                                                                                                                                 |
│ │ │ │ │ +|		std::vector<piece_index_t> avail_vec;                                                                                                                                        |
│ │ │ │ │ +|		for (auto const i : m_torrent_file->piece_range())                                                                                                                           |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (bits[i]) continue;                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			int availability = 0;                                                                                                                                                       |
│ │ │ │ │ +|			for (auto pc : *this)                                                                                                                                                       |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				if (pc->super_seeded_piece(i))                                                                                                                                             |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					// avoid super-seeding the same piece to more than one                                                                                                                    |
│ │ │ │ │ +|					// peer if we can avoid it. Do this by artificially                                                                                                                       |
│ │ │ │ │ +|					// increase the availability                                                                                                                                              |
│ │ │ │ │ +|					availability = 999;                                                                                                                                                       |
│ │ │ │ │ +|					break;                                                                                                                                                                    |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|				if (pc->has_piece(i)) ++availability;                                                                                                                                      |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			if (availability > min_availability) continue;                                                                                                                              |
│ │ │ │ │ +|			if (availability == min_availability)                                                                                                                                       |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|_	_	_	_	_a_v_a_i_l___v_e_c_._p_u_s_h___b_a_c_k_(_i_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 3|_._._/_s_r_c_/                       |this should be an optional, piece index -1 should not be allowed                                                                    |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_w_e_b___p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:_1_9_9_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** tthhiiss sshhoouulldd bbee aann ooppttiioonnaall,, ppiieeccee iinnddeexx --11 sshhoouulldd nnoott bbee aalllloowweedd **********                                                                                                   |
│ │ │ │ │  |****** ....//ssrrcc//wweebb__ppeeeerr__ccoonnnneeccttiioonn..ccpppp::119999 ******                                                                                                                                     |
│ │ │ │ │  |			auto const range = aux::file_piece_range_inclusive(fs, i);                                                                                                                  |
│ │ │ │ │  |			for (piece_index_t k = std::get<0>(range); k < std::get<1>(range); ++k)                                                                                                     |
│ │ │ │ │  |				have.clear_bit(k);                                                                                                                                                         |
│ │ │ │ │ @@ -727,48 +1011,233 @@
│ │ │ │ │  |		web->have_files.resize(t->torrent_file().num_files(), false);                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// the new web seed we're adding only has this file for now                                                                                                                  |
│ │ │ │ │  |		// we may add more files later                                                                                                                                               |
│ │ │ │ │  |		web->redirects[file_index] = redirect_path;                                                                                                                                  |
│ │ │ │ │  |		if (web->have_files.get_bit(file_index) == false)                                                                                                                            |
│ │ │ │ │  |_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_u_t___m_e_t_a_d_a_t_a_._c_p_p_:_2_6_8_ _ _ _ _|_u_s_e_ _t_h_e_ _a_u_x_:_:_w_r_i_t_e___*_ _f_u_n_c_t_i_o_n_s_ _a_n_d_ _t_h_e_ _s_p_a_n_ _h_e_r_e_ _i_n_s_t_e_a_d_,_ _i_t_ _w_i_l_l_ _f_i_t_ _b_e_t_t_e_r_ _w_i_t_h_ _s_e_n_d___b_u_f_f_e_r_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** uussee tthhee aauuxx::::wwrriittee__** ffuunnccttiioonnss aanndd tthhee ssppaann hheerree iinnsstteeaadd,, iitt wwiillll ffiitt bbeetttteerr wwiitthh sseenndd__bbuuffffeerr(()) **********                                                                    |
│ │ │ │ │ -|****** ....//ssrrcc//uutt__mmeettaaddaattaa..ccpppp::226688 ******                                                                                                                                             |
│ │ │ │ │ -|int metadata_piece_size = 0;                                                                                                                                                   |
│ │ │ │ │ +|           |_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |instead of having to ask the torrent whether it's in graceful pause mode or not, the peers should keep that state (and the torrent  |
│ │ │ │ │ +|relevance 3|_3_1_3_3                          |should update them when it enters graceful pause). When a peer enters graceful pause mode, it should cancel all outstanding requests|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_a_n_d_ _c_l_e_a_r_ _i_t_s_ _r_e_q_u_e_s_t_ _q_u_e_u_e_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinnsstteeaadd ooff hhaavviinngg ttoo aasskk tthhee ttoorrrreenntt wwhheetthheerr iitt''ss iinn ggrraacceeffuull ppaauussee mmooddee oorr nnoott,, tthhee ppeeeerrss sshhoouulldd kkeeeepp tthhaatt ssttaattee ((aanndd tthhee ttoorrrreenntt sshhoouulldd uuppddaattee tthheemm wwhheenn iitt eenntteerrss     |
│ │ │ │ │ +|ggrraacceeffuull ppaauussee)).. WWhheenn aa ppeeeerr eenntteerrss ggrraacceeffuull ppaauussee mmooddee,, iitt sshhoouulldd ccaanncceell aallll oouuttssttaannddiinngg rreeqquueessttss aanndd cclleeaarr iittss rreeqquueesstt qquueeuuee.. **********                                          |
│ │ │ │ │ +|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::33113333 ******                                                                                                                                        |
│ │ │ │ │ +|// to disk or are in the disk write cache                                                                                                                                      |
│ │ │ │ │ +|		if (picker.is_piece_finished(p.piece) && !was_finished)                                                                                                                      |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|#if TORRENT_USE_INVARIANT_CHECKS                                                                                                                                               |
│ │ │ │ │ +|			check_postcondition post_checker2_(t, false);                                                                                                                               |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			t->verify_piece(p.piece);                                                                                                                                                   |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (m_torrent.valid_metadata())                                                                                                                                             |
│ │ │ │ │ -|				e["total_size"] = m_tp.metadata().size();                                                                                                                                  |
│ │ │ │ │ +|		check_graceful_pause();                                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (type == msg_t::piece)                                                                                                                                                   |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				TORRENT_ASSERT(piece >= 0 && piece < (m_tp.metadata().size() + 16 * 1024 - 1) / (16 * 1024));                                                                              |
│ │ │ │ │ -|				TORRENT_ASSERT(m_pc.associated_torrent().lock()->valid_metadata());                                                                                                        |
│ │ │ │ │ -|				TORRENT_ASSERT(m_torrent.valid_metadata());                                                                                                                                |
│ │ │ │ │ +|		if (is_disconnecting()) return;                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				int const offset = piece * 16 * 1024;                                                                                                                                      |
│ │ │ │ │ -|				metadata = m_tp.metadata().data() + offset;                                                                                                                                |
│ │ │ │ │ -|				metadata_piece_size = std::min(                                                                                                                                            |
│ │ │ │ │ -|					int(m_tp.metadata().size()) - offset, 16 * 1024);                                                                                                                         |
│ │ │ │ │ -|				TORRENT_ASSERT(metadata_piece_size > 0);                                                                                                                                   |
│ │ │ │ │ -|				TORRENT_ASSERT(offset >= 0);                                                                                                                                               |
│ │ │ │ │ -|				TORRENT_ASSERT(offset + metadata_piece_size <= m_tp.metadata().size());                                                                                                    |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ +|		if (request_a_block(*t, *this))                                                                                                                                              |
│ │ │ │ │ +|			m_counters.inc_stats_counter(counters::incoming_piece_picks);                                                                                                               |
│ │ │ │ │ +|		send_block_requests();                                                                                                                                                       |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|char msg[200];                                                                                                                                                                 |
│ │ │ │ │ -|char* header = msg;                                                                                                                                                            |
│ │ │ │ │ -|			char* p = &msg[6];                                                                                                                                                          |
│ │ │ │ │ -|			int const len = bencode(p, e);                                                                                                                                              |
│ │ │ │ │ -|			int const total_size = 2 + len + metadata_piece_size;                                                                                                                       |
│ │ │ │ │ -|			namespace io = aux;                                                                                                                                                         |
│ │ │ │ │ -|			io::write_uint32(total_size, header);                                                                                                                                       |
│ │ │ │ │ -|			io::write_uint8(bt_peer_connection::msg_extended, header);                                                                                                                  |
│ │ │ │ │ -|			io::write_uint8(m_message_index, header);                                                                                                                                   |
│ │ │ │ │ +|	void peer_connection::check_graceful_pause()                                                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                                 |
│ │ │ │ │ +|if (!t || !t->graceful_pause()) return;                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_	_	_	_m___p_c_._s_e_n_d___b_u_f_f_e_r_(_{_m_s_g_,_ _l_e_n_ _+_ _6_}_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|		if (m_outstanding_bytes > 0) return;                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		peer_log(peer_log_alert::info, "GRACEFUL_PAUSE", "NO MORE DOWNLOAD");                                                                                                        |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		disconnect(errors::torrent_paused, operation_t::bittorrent);                                                                                                                 |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void peer_connection::on_disk_write_complete(storage_error const& error                                                                                                       |
│ │ │ │ │ +|		, peer_request const& p, std::shared_ptr<torrent> t)                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		if (should_log(peer_log_alert::info))                                                                                                                                        |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			peer_log(peer_log_alert::info, "FILE_ASYNC_WRITE_COMPLETE", "piece: %d s: %x l: %x e: %s"                                                                                   |
│ │ │ │ │ +|				, static_cast<int>(p.piece), p.start, p.length, error.ec.message().c_str());                                                                                               |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		m_counters.inc_stats_counter(counters::queued_write_bytes, -p.length);                                                                                                       |
│ │ │ │ │ +|		m_outstanding_writing_bytes -= p.length;                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(m_outstanding_writing_bytes >= 0);                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// every peer is entitled to allocate a disk buffer if it has no writes outstanding                                                                                          |
│ │ │ │ │ +|		// see the comment in incoming_piece                                                                                                                                         |
│ │ │ │ │ +|_	_	_i_f_ _(_m___o_u_t_s_t_a_n_d_i_n_g___w_r_i_t_i_n_g___b_y_t_e_s_ _=_=_ _0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 3|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |once peers are properly put in graceful pause mode, they can cancel all outstanding requests and this test can be removed.          |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_4_0_4_4_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** oonnccee ppeeeerrss aarree pprrooppeerrllyy ppuutt iinn ggrraacceeffuull ppaauussee mmooddee,, tthheeyy ccaann ccaanncceell aallll oouuttssttaannddiinngg rreeqquueessttss aanndd tthhiiss tteesstt ccaann bbee rreemmoovveedd.. **********                                         |
│ │ │ │ │ +|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::44004444 ******                                                                                                                                        |
│ │ │ │ │ +|			if (!p->m_deferred_send_block_requests)                                                                                                                                     |
│ │ │ │ │ +|				return;                                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			p->m_deferred_send_block_requests = false;                                                                                                                                  |
│ │ │ │ │ +|			p->send_block_requests_impl();                                                                                                                                              |
│ │ │ │ │ +|		});                                                                                                                                                                          |
│ │ │ │ │ +|		m_deferred_send_block_requests = true;                                                                                                                                       |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void peer_connection::send_block_requests_impl()                                                                                                                              |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                               |
│ │ │ │ │ +|		if (!t) return;                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_disconnecting) return;                                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|if (t->graceful_pause()) return;                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// we can't download pieces in these states                                                                                                                                  |
│ │ │ │ │ +|		if (t->state() == torrent_status::checking_files                                                                                                                             |
│ │ │ │ │ +|			|| t->state() == torrent_status::checking_resume_data                                                                                                                       |
│ │ │ │ │ +|			|| t->state() == torrent_status::downloading_metadata)                                                                                                                      |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (int(m_download_queue.size()) >= m_desired_queue_size                                                                                                                     |
│ │ │ │ │ +|			|| t->upload_mode()) return;                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		bool const empty_download_queue = m_download_queue.empty();                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		while (!m_request_queue.empty()                                                                                                                                              |
│ │ │ │ │ +|			&& (int(m_download_queue.size()) < m_desired_queue_size                                                                                                                     |
│ │ │ │ │ +|				|| m_queued_time_critical > 0))                                                                                                                                            |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			pending_block block = m_request_queue.front();                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			m_request_queue.erase(m_request_queue.begin());                                                                                                                             |
│ │ │ │ │ +|			if (m_queued_time_critical) --m_queued_time_critical;                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// if we're a seed, we don't have a piece picker                                                                                                                            |
│ │ │ │ │ +|			// so we don't have to worry about invariants getting                                                                                                                       |
│ │ │ │ │ +|			// out of sync with it                                                                                                                                                      |
│ │ │ │ │ +|			if (!t->has_picker()) continue;                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// this can happen if a block times out, is re-requested and                                                                                                                |
│ │ │ │ │ +|			// then arrives "unexpectedly"                                                                                                                                              |
│ │ │ │ │ +|			if (t->picker().is_downloaded(block.block))                                                                                                                                 |
│ │ │ │ │ +|_	_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 3|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |new_piece should be an optional. piece index -1 should not be allowed                                                               |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_4_7_3_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** nneeww__ppiieeccee sshhoouulldd bbee aann ooppttiioonnaall.. ppiieeccee iinnddeexx --11 sshhoouulldd nnoott bbee aalllloowweedd **********                                                                                              |
│ │ │ │ │ +|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::44773300 ******                                                                                                                                        |
│ │ │ │ │ +|		// pieces may be empty if we don't have metadata yet                                                                                                                         |
│ │ │ │ │ +|		if (p.pieces.empty())                                                                                                                                                        |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			p.progress = 0.f;                                                                                                                                                           |
│ │ │ │ │ +|			p.progress_ppm = 0;                                                                                                                                                         |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|#if TORRENT_NO_FPU                                                                                                                                                             |
│ │ │ │ │ +|			p.progress = 0.f;                                                                                                                                                           |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|			p.progress = float(p.pieces.count()) / float(p.pieces.size());                                                                                                              |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			p.progress_ppm = int(std::int64_t(p.pieces.count()) * 1000000 / p.pieces.size());                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_SUPERSEEDING                                                                                                                                           |
│ │ │ │ │ +|void peer_connection::superseed_piece(piece_index_t const replace_piece                                                                                                        |
│ │ │ │ │ +|, piece_index_t const new_piece)                                                                                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (is_connecting()) return;                                                                                                                                                 |
│ │ │ │ │ +|		if (in_handshake()) return;                                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (new_piece == piece_index_t(-1))                                                                                                                                          |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (m_superseed_piece[0] == piece_index_t(-1)) return;                                                                                                                      |
│ │ │ │ │ +|			m_superseed_piece[0] = piece_index_t(-1);                                                                                                                                   |
│ │ │ │ │ +|			m_superseed_piece[1] = piece_index_t(-1);                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|			peer_log(peer_log_alert::info, "SUPER_SEEDING", "ending");                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                              |
│ │ │ │ │ +|			TORRENT_ASSERT(t);                                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// this will either send a full bitfield or                                                                                                                                 |
│ │ │ │ │ +|			// a have-all message, effectively terminating                                                                                                                              |
│ │ │ │ │ +|			// super-seeding, since the peer may pick any piece                                                                                                                         |
│ │ │ │ │ +|			write_bitfield();                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(!has_piece(new_piece));                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_#_i_f_n_d_e_f_ _T_O_R_R_E_N_T___D_I_S_A_B_L_E___L_O_G_G_I_N_G_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_s_e_s_s_i_o_n___h_a_n_d_l_e_._c_p_p_:_6_9_1_ _|_e_x_p_o_s_e_ _t_h_e_ _s_e_q_u_e_n_c_e___n_u_m_b_e_r_,_ _p_u_b_l_i_c___k_e_y_,_ _s_e_c_r_e_t___k_e_y_ _a_n_d_ _s_i_g_n_a_t_u_r_e_ _t_y_p_e_s_ _t_o_ _t_h_e_ _c_l_i_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** eexxppoossee tthhee sseeqquueennccee__nnuummbbeerr,, ppuubblliicc__kkeeyy,, sseeccrreett__kkeeyy aanndd ssiiggnnaattuurree ttyyppeess ttoo tthhee cclliieenntt **********                                                                               |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__hhaannddllee..ccpppp::669911 ******                                                                                                                                          |
│ │ │ │ │ +|void session_handle::dht_get_item(sha1_hash const& target)                                                                                                                     |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|		async_call(&session_impl::dht_get_immutable_item, target);                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		TORRENT_UNUSED(target);                                                                                                                                                      |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void session_handle::dht_get_item(std::array<char, 32> key                                                                                                                    |
│ │ │ │ │ +|		, std::string salt)                                                                                                                                                          |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|		async_call(&session_impl::dht_get_mutable_item, key, salt);                                                                                                                  |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		TORRENT_UNUSED(key);                                                                                                                                                         |
│ │ │ │ │ +|		TORRENT_UNUSED(salt);                                                                                                                                                        |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|sha1_hash session_handle::dht_put_item(entry data)                                                                                                                             |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		std::vector<char> buf;                                                                                                                                                       |
│ │ │ │ │ +|		bencode(std::back_inserter(buf), data);                                                                                                                                      |
│ │ │ │ │ +|		sha1_hash const ret = hasher(buf).final();                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|		async_call(&session_impl::dht_put_immutable_item, data, ret);                                                                                                                |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void session_handle::dht_put_item(std::array<char, 32> key                                                                                                                    |
│ │ │ │ │ +|		, std::function<void(entry&, std::array<char,64>&                                                                                                                            |
│ │ │ │ │ +|			, std::int64_t&, std::string const&)> cb                                                                                                                                    |
│ │ │ │ │ +|		, std::string salt)                                                                                                                                                          |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|		async_call(&session_impl::dht_put_mutable_item, key, cb, salt);                                                                                                              |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		TORRENT_UNUSED(key);                                                                                                                                                         |
│ │ │ │ │ +|		TORRENT_UNUSED(cb);                                                                                                                                                          |
│ │ │ │ │ +|		TORRENT_UNUSED(salt);                                                                                                                                                        |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void session_handle::dht_get_peers(sha1_hash const& info_hash)                                                                                                                |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|		async_call(&session_impl::dht_get_peers, info_hash);                                                                                                                         |
│ │ │ │ │ +|_#_e_l_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_1_1_4_2_ _ _|_c_l_o_s_i_n_g_ _t_h_e_ _u_d_p_ _s_o_c_k_e_t_s_ _h_e_r_e_ _m_e_a_n_s_ _t_h_a_t_ _t_h_e_ _u_T_P_ _c_o_n_n_e_c_t_i_o_n_s_ _c_a_n_n_o_t_ _b_e_ _c_l_o_s_e_d_ _g_r_a_c_e_f_u_l_l_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** cclloossiinngg tthhee uuddpp ssoocckkeettss hheerree mmeeaannss tthhaatt tthhee uuTTPP ccoonnnneeccttiioonnss ccaannnnoott bbee cclloosseedd ggrraacceeffuullllyy **********                                                                            |
│ │ │ │ │  |****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::11114422 ******                                                                                                                                           |
│ │ │ │ │  |#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │  |		session_log(" aborting all connections (%d)", int(m_connections.size()));                                                                                                    |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |		// abort all connections                                                                                                                                                     |
│ │ │ │ │ @@ -1126,483 +1595,14 @@
│ │ │ │ │  |				alerts.emplace_alert<dht_put_alert>(pk.bytes, sig.bytes                                                                                                                    |
│ │ │ │ │  |					, std::move(salt), seq.value, num);                                                                                                                                       |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		void put_mutable_callback(dht::item& i                                                                                                                                       |
│ │ │ │ │  |_	_	_	_,_ _s_t_d_:_:_f_u_n_c_t_i_o_n_<_v_o_i_d_(_e_n_t_r_y_&_,_ _s_t_d_:_:_a_r_r_a_y_<_c_h_a_r_,_ _6_4_>_&_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|           |_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |instead of having to ask the torrent whether it's in graceful pause mode or not, the peers should keep that state (and the torrent  |
│ │ │ │ │ -|relevance 3|_3_1_3_3                          |should update them when it enters graceful pause). When a peer enters graceful pause mode, it should cancel all outstanding requests|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_a_n_d_ _c_l_e_a_r_ _i_t_s_ _r_e_q_u_e_s_t_ _q_u_e_u_e_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinnsstteeaadd ooff hhaavviinngg ttoo aasskk tthhee ttoorrrreenntt wwhheetthheerr iitt''ss iinn ggrraacceeffuull ppaauussee mmooddee oorr nnoott,, tthhee ppeeeerrss sshhoouulldd kkeeeepp tthhaatt ssttaattee ((aanndd tthhee ttoorrrreenntt sshhoouulldd uuppddaattee tthheemm wwhheenn iitt eenntteerrss     |
│ │ │ │ │ -|ggrraacceeffuull ppaauussee)).. WWhheenn aa ppeeeerr eenntteerrss ggrraacceeffuull ppaauussee mmooddee,, iitt sshhoouulldd ccaanncceell aallll oouuttssttaannddiinngg rreeqquueessttss aanndd cclleeaarr iittss rreeqquueesstt qquueeuuee.. **********                                          |
│ │ │ │ │ -|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::33113333 ******                                                                                                                                        |
│ │ │ │ │ -|// to disk or are in the disk write cache                                                                                                                                      |
│ │ │ │ │ -|		if (picker.is_piece_finished(p.piece) && !was_finished)                                                                                                                      |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|#if TORRENT_USE_INVARIANT_CHECKS                                                                                                                                               |
│ │ │ │ │ -|			check_postcondition post_checker2_(t, false);                                                                                                                               |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			t->verify_piece(p.piece);                                                                                                                                                   |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		check_graceful_pause();                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (is_disconnecting()) return;                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (request_a_block(*t, *this))                                                                                                                                              |
│ │ │ │ │ -|			m_counters.inc_stats_counter(counters::incoming_piece_picks);                                                                                                               |
│ │ │ │ │ -|		send_block_requests();                                                                                                                                                       |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void peer_connection::check_graceful_pause()                                                                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                                 |
│ │ │ │ │ -|if (!t || !t->graceful_pause()) return;                                                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_outstanding_bytes > 0) return;                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		peer_log(peer_log_alert::info, "GRACEFUL_PAUSE", "NO MORE DOWNLOAD");                                                                                                        |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		disconnect(errors::torrent_paused, operation_t::bittorrent);                                                                                                                 |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void peer_connection::on_disk_write_complete(storage_error const& error                                                                                                       |
│ │ │ │ │ -|		, peer_request const& p, std::shared_ptr<torrent> t)                                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (should_log(peer_log_alert::info))                                                                                                                                        |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			peer_log(peer_log_alert::info, "FILE_ASYNC_WRITE_COMPLETE", "piece: %d s: %x l: %x e: %s"                                                                                   |
│ │ │ │ │ -|				, static_cast<int>(p.piece), p.start, p.length, error.ec.message().c_str());                                                                                               |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		m_counters.inc_stats_counter(counters::queued_write_bytes, -p.length);                                                                                                       |
│ │ │ │ │ -|		m_outstanding_writing_bytes -= p.length;                                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(m_outstanding_writing_bytes >= 0);                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// every peer is entitled to allocate a disk buffer if it has no writes outstanding                                                                                          |
│ │ │ │ │ -|		// see the comment in incoming_piece                                                                                                                                         |
│ │ │ │ │ -|_	_	_i_f_ _(_m___o_u_t_s_t_a_n_d_i_n_g___w_r_i_t_i_n_g___b_y_t_e_s_ _=_=_ _0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 3|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |once peers are properly put in graceful pause mode, they can cancel all outstanding requests and this test can be removed.          |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_4_0_4_4_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** oonnccee ppeeeerrss aarree pprrooppeerrllyy ppuutt iinn ggrraacceeffuull ppaauussee mmooddee,, tthheeyy ccaann ccaanncceell aallll oouuttssttaannddiinngg rreeqquueessttss aanndd tthhiiss tteesstt ccaann bbee rreemmoovveedd.. **********                                         |
│ │ │ │ │ -|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::44004444 ******                                                                                                                                        |
│ │ │ │ │ -|			if (!p->m_deferred_send_block_requests)                                                                                                                                     |
│ │ │ │ │ -|				return;                                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			p->m_deferred_send_block_requests = false;                                                                                                                                  |
│ │ │ │ │ -|			p->send_block_requests_impl();                                                                                                                                              |
│ │ │ │ │ -|		});                                                                                                                                                                          |
│ │ │ │ │ -|		m_deferred_send_block_requests = true;                                                                                                                                       |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void peer_connection::send_block_requests_impl()                                                                                                                              |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                               |
│ │ │ │ │ -|		if (!t) return;                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_disconnecting) return;                                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|if (t->graceful_pause()) return;                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// we can't download pieces in these states                                                                                                                                  |
│ │ │ │ │ -|		if (t->state() == torrent_status::checking_files                                                                                                                             |
│ │ │ │ │ -|			|| t->state() == torrent_status::checking_resume_data                                                                                                                       |
│ │ │ │ │ -|			|| t->state() == torrent_status::downloading_metadata)                                                                                                                      |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (int(m_download_queue.size()) >= m_desired_queue_size                                                                                                                     |
│ │ │ │ │ -|			|| t->upload_mode()) return;                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		bool const empty_download_queue = m_download_queue.empty();                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		while (!m_request_queue.empty()                                                                                                                                              |
│ │ │ │ │ -|			&& (int(m_download_queue.size()) < m_desired_queue_size                                                                                                                     |
│ │ │ │ │ -|				|| m_queued_time_critical > 0))                                                                                                                                            |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			pending_block block = m_request_queue.front();                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			m_request_queue.erase(m_request_queue.begin());                                                                                                                             |
│ │ │ │ │ -|			if (m_queued_time_critical) --m_queued_time_critical;                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// if we're a seed, we don't have a piece picker                                                                                                                            |
│ │ │ │ │ -|			// so we don't have to worry about invariants getting                                                                                                                       |
│ │ │ │ │ -|			// out of sync with it                                                                                                                                                      |
│ │ │ │ │ -|			if (!t->has_picker()) continue;                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// this can happen if a block times out, is re-requested and                                                                                                                |
│ │ │ │ │ -|			// then arrives "unexpectedly"                                                                                                                                              |
│ │ │ │ │ -|			if (t->picker().is_downloaded(block.block))                                                                                                                                 |
│ │ │ │ │ -|_	_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 3|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |new_piece should be an optional. piece index -1 should not be allowed                                                               |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_4_7_3_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** nneeww__ppiieeccee sshhoouulldd bbee aann ooppttiioonnaall.. ppiieeccee iinnddeexx --11 sshhoouulldd nnoott bbee aalllloowweedd **********                                                                                              |
│ │ │ │ │ -|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::44773300 ******                                                                                                                                        |
│ │ │ │ │ -|		// pieces may be empty if we don't have metadata yet                                                                                                                         |
│ │ │ │ │ -|		if (p.pieces.empty())                                                                                                                                                        |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			p.progress = 0.f;                                                                                                                                                           |
│ │ │ │ │ -|			p.progress_ppm = 0;                                                                                                                                                         |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|#if TORRENT_NO_FPU                                                                                                                                                             |
│ │ │ │ │ -|			p.progress = 0.f;                                                                                                                                                           |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|			p.progress = float(p.pieces.count()) / float(p.pieces.size());                                                                                                              |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			p.progress_ppm = int(std::int64_t(p.pieces.count()) * 1000000 / p.pieces.size());                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_SUPERSEEDING                                                                                                                                           |
│ │ │ │ │ -|void peer_connection::superseed_piece(piece_index_t const replace_piece                                                                                                        |
│ │ │ │ │ -|, piece_index_t const new_piece)                                                                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (is_connecting()) return;                                                                                                                                                 |
│ │ │ │ │ -|		if (in_handshake()) return;                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (new_piece == piece_index_t(-1))                                                                                                                                          |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (m_superseed_piece[0] == piece_index_t(-1)) return;                                                                                                                      |
│ │ │ │ │ -|			m_superseed_piece[0] = piece_index_t(-1);                                                                                                                                   |
│ │ │ │ │ -|			m_superseed_piece[1] = piece_index_t(-1);                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|			peer_log(peer_log_alert::info, "SUPER_SEEDING", "ending");                                                                                                                  |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                              |
│ │ │ │ │ -|			TORRENT_ASSERT(t);                                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// this will either send a full bitfield or                                                                                                                                 |
│ │ │ │ │ -|			// a have-all message, effectively terminating                                                                                                                              |
│ │ │ │ │ -|			// super-seeding, since the peer may pick any piece                                                                                                                         |
│ │ │ │ │ -|			write_bitfield();                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(!has_piece(new_piece));                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_#_i_f_n_d_e_f_ _T_O_R_R_E_N_T___D_I_S_A_B_L_E___L_O_G_G_I_N_G_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_1_9_ _ _ _ _ _ _ _ _|_w_e_ _c_o_u_l_d_ _p_r_o_b_a_b_l_y_ _g_e_t_ _a_w_a_y_ _w_i_t_h_ _j_u_s_t_ _s_a_v_i_n_g_ _a_ _f_e_w_ _f_i_e_l_d_s_ _h_e_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** wwee ccoouulldd pprroobbaabbllyy ggeett aawwaayy wwiitthh jjuusstt ssaavviinngg aa ffeeww ffiieellddss hheerree **********                                                                                                      |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::441199 ******                                                                                                                                                 |
│ │ │ │ │ -|// --- V2 HASHES ---                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_torrent_file->is_valid() && m_torrent_file->info_hashes().has_v2())                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (!p.merkle_trees.empty())                                                                                                                                                |
│ │ │ │ │ -|				load_merkle_trees(                                                                                                                                                         |
│ │ │ │ │ -|					std::move(p.merkle_trees)                                                                                                                                                 |
│ │ │ │ │ -|					, std::move(p.merkle_tree_mask)                                                                                                                                           |
│ │ │ │ │ -|					, std::move(p.verified_leaf_hashes));                                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// we really don't want to store extra copies of the trees                                                                                                                  |
│ │ │ │ │ -|			TORRENT_ASSERT(p.merkle_trees.empty());                                                                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (valid_metadata())                                                                                                                                                        |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			inc_stats_counter(counters::num_total_pieces_added                                                                                                                          |
│ │ │ │ │ -|				, m_torrent_file->num_pieces());                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|m_add_torrent_params = std::make_unique<add_torrent_params>(std::move(p));                                                                                                     |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::load_merkle_trees(                                                                                                                                              |
│ │ │ │ │ -|		aux::vector<std::vector<sha256_hash>, file_index_t> trees_import                                                                                                             |
│ │ │ │ │ -|		, aux::vector<std::vector<bool>, file_index_t> mask                                                                                                                          |
│ │ │ │ │ -|		, aux::vector<std::vector<bool>, file_index_t> verified)                                                                                                                     |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		auto const& fs = m_torrent_file->orig_files();                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		std::vector<bool> const empty_verified;                                                                                                                                      |
│ │ │ │ │ -|		for (file_index_t i{0}; i < fs.end_file(); ++i)                                                                                                                              |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (fs.pad_file_at(i) || fs.file_size(i) == 0)                                                                                                                              |
│ │ │ │ │ -|				continue;                                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			if (i >= trees_import.end_index()) break;                                                                                                                                   |
│ │ │ │ │ -|			std::vector<bool> const& verified_bitmask = (i >= verified.end_index()) ? empty_verified : verified[i];                                                                     |
│ │ │ │ │ -|			if (i < mask.end_index() && !mask[i].empty())                                                                                                                               |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				mask[i].resize(m_merkle_trees[i].size(), false);                                                                                                                           |
│ │ │ │ │ -|				m_merkle_trees[i].load_sparse_tree(trees_import[i], mask[i], verified_bitmask);                                                                                            |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				m_merkle_trees[i].load_tree(trees_import[i], verified_bitmask);                                                                                                            |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_	_v_o_i_d_ _t_o_r_r_e_n_t_:_:_i_n_c___s_t_a_t_s___c_o_u_n_t_e_r_(_i_n_t_ _c_,_ _i_n_t_ _v_a_l_u_e_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_7_1_5_ _ _ _ _ _ _ _ _|_a_s_s_e_r_t_ _t_h_e_r_e_ _a_r_e_ _n_o_ _o_u_t_s_t_a_n_d_i_n_g_ _a_s_y_n_c_ _o_p_e_r_a_t_i_o_n_s_ _o_n_ _t_h_i_s_ _t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** aasssseerrtt tthheerree aarree nnoo oouuttssttaannddiinngg aassyynncc ooppeerraattiioonnss oonn tthhiiss ttoorrrreenntt **********                                                                                                   |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::771155 ******                                                                                                                                                 |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (!m_ses.dht()) return false;                                                                                                                                              |
│ │ │ │ │ -|		if (m_torrent_file->is_valid() && !m_files_checked) return false;                                                                                                            |
│ │ │ │ │ -|		if (!m_announce_to_dht) return false;                                                                                                                                        |
│ │ │ │ │ -|		if (m_paused) return false;                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// don't announce private torrents                                                                                                                                           |
│ │ │ │ │ -|		if (m_torrent_file->is_valid() && m_torrent_file->priv()) return false;                                                                                                      |
│ │ │ │ │ -|		if (m_trackers.empty()) return true;                                                                                                                                         |
│ │ │ │ │ -|		if (!settings().get_bool(settings_pack::use_dht_as_fallback)) return true;                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		return std::none_of(m_trackers.begin(), m_trackers.end()                                                                                                                     |
│ │ │ │ │ -|			, [](aux::announce_entry const& tr) { return bool(tr.verified); });                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	torrent::~torrent()                                                                                                                                                           |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ -|		for (torrent_list_index_t i{}; i != m_links.end_index(); ++i)                                                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (!m_links[i].in_list()) continue;                                                                                                                                        |
│ │ │ │ │ -|			m_links[i].unlink(m_ses.torrent_list(i), i);                                                                                                                                |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// The invariant can't be maintained here, since the torrent                                                                                                                 |
│ │ │ │ │ -|		// is being destructed, all weak references to it have been                                                                                                                  |
│ │ │ │ │ -|		// reset, which means that all its peers already have an                                                                                                                     |
│ │ │ │ │ -|		// invalidated torrent pointer (so it cannot be verified to be correct)                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// i.e. the invariant can only be maintained if all connections have                                                                                                         |
│ │ │ │ │ -|		// been closed by the time the torrent is destructed. And they are                                                                                                           |
│ │ │ │ │ -|		// supposed to be closed. So we can still do the invariant check.                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// however, the torrent object may be destructed from the main                                                                                                               |
│ │ │ │ │ -|		// thread when shutting down, if the disk cache has references to it.                                                                                                        |
│ │ │ │ │ -|		// this means that the invariant check that this is called from the                                                                                                          |
│ │ │ │ │ -|		// network thread cannot be maintained                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(m_peer_class == peer_class_t{0});                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(m_connections.empty());                                                                                                                                       |
│ │ │ │ │ -|		// just in case, make sure the session accounting is kept right                                                                                                              |
│ │ │ │ │ -|		for (auto p : m_connections)                                                                                                                                                 |
│ │ │ │ │ -|			m_ses.close_connection(p);                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_	_v_o_i_d_ _t_o_r_r_e_n_t_:_:_r_e_a_d___p_i_e_c_e_(_p_i_e_c_e___i_n_d_e_x___t_ _c_o_n_s_t_ _p_i_e_c_e_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_3_3_1_ _ _ _ _ _ _ _|_t_h_e_r_e_'_s_ _s_o_m_e_ _d_u_p_l_i_c_a_t_i_o_n_ _b_e_t_w_e_e_n_ _t_h_i_s_ _f_u_n_c_t_i_o_n_ _a_n_d_ _p_e_e_r___c_o_n_n_e_c_t_i_o_n_:_:_i_n_c_o_m_i_n_g___p_i_e_c_e_(_)_._ _i_s_ _t_h_e_r_e_ _a_ _w_a_y_ _t_o_ _m_e_r_g_e_ _s_o_m_e_t_h_i_n_g_?_ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthheerree''ss ssoommee dduupplliiccaattiioonn bbeettwweeeenn tthhiiss ffuunnccttiioonn aanndd ppeeeerr__ccoonnnneeccttiioonn::::iinnccoommiinngg__ppiieeccee(()).. iiss tthheerree aa wwaayy ttoo mmeerrggee ssoommeetthhiinngg?? **********                                           |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::11333311 ******                                                                                                                                                |
│ │ │ │ │ -|piece_index_t m_piece;                                                                                                                                                         |
│ │ │ │ │ -|		bool m_armed = true;                                                                                                                                                         |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::add_piece_async(piece_index_t const piece                                                                                                                       |
│ │ │ │ │ -|		, std::vector<char> data, add_piece_flags_t const flags)                                                                                                                     |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// make sure the piece index is correct                                                                                                                                      |
│ │ │ │ │ -|		if (piece >= torrent_file().end_piece())                                                                                                                                     |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// make sure the piece size is correct                                                                                                                                       |
│ │ │ │ │ -|		if (data.size() != std::size_t(m_torrent_file->piece_size(piece)))                                                                                                           |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		add_piece(piece, data.data(), flags);                                                                                                                                        |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void torrent::add_piece(piece_index_t const piece, char const* data                                                                                                            |
│ │ │ │ │ -|, add_piece_flags_t const flags)                                                                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// make sure the piece index is correct                                                                                                                                      |
│ │ │ │ │ -|		if (piece >= torrent_file().end_piece())                                                                                                                                     |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		int const piece_size = m_torrent_file->piece_size(piece);                                                                                                                    |
│ │ │ │ │ -|		int const blocks_in_piece = (piece_size + block_size() - 1) / block_size();                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_deleted) return;                                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// avoid crash trying to access the picker when there is none                                                                                                                |
│ │ │ │ │ -|		if (m_have_all && !has_picker()) return;                                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// we don't support clobbering the piece picker while checking the                                                                                                           |
│ │ │ │ │ -|		// files. We may end up having the same piece multiple times                                                                                                                 |
│ │ │ │ │ -|		TORRENT_ASSERT_PRECOND(state() != torrent_status::checking_files                                                                                                             |
│ │ │ │ │ -|			&& state() != torrent_status::checking_resume_data);                                                                                                                        |
│ │ │ │ │ -|		if (state() == torrent_status::checking_files                                                                                                                                |
│ │ │ │ │ -|			|| state() == torrent_status::checking_resume_data)                                                                                                                         |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		need_picker();                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (picker().have_piece(piece)                                                                                                                                               |
│ │ │ │ │ -|			&& !(flags & torrent_handle::overwrite_existing))                                                                                                                           |
│ │ │ │ │ -|_	_	_	_r_e_t_u_r_n_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_3_9_6_6_ _ _ _ _ _ _ _|_t_h_i_s_ _c_o_u_l_d_ _p_r_o_b_a_b_l_y_ _b_e_ _p_u_l_l_e_d_ _o_u_t_ _i_n_t_o_ _a_ _f_r_e_e_ _f_u_n_c_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ccoouulldd pprroobbaabbllyy bbee ppuulllleedd oouutt iinnttoo aa ffrreeee ffuunnccttiioonn **********                                                                                                             |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::33996666 ******                                                                                                                                                |
│ │ │ │ │ -|std::int64_t calc_bytes(file_storage const& fs, piece_count const& pc)                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		// it's an impossible combination to have 0 pieces, but still have one of them be the last piece                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(!(pc.num_pieces == 0 && pc.last_piece == true));                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// if we have 0 pieces, we can't have any pad blocks either                                                                                                                  |
│ │ │ │ │ -|		TORRENT_ASSERT(!(pc.num_pieces == 0 && pc.pad_bytes > 0));                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// if we have all pieces, we must also have the last one                                                                                                                     |
│ │ │ │ │ -|		TORRENT_ASSERT(!(pc.num_pieces == fs.num_pieces() && pc.last_piece == false));                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// every block should not be a pad block                                                                                                                                     |
│ │ │ │ │ -|		TORRENT_ASSERT(pc.pad_bytes <= std::int64_t(pc.num_pieces) * fs.piece_length());                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		return std::int64_t(pc.num_pieces) * fs.piece_length()                                                                                                                       |
│ │ │ │ │ -|			- (pc.last_piece ? fs.piece_length() - fs.piece_size(fs.last_piece()) : 0)                                                                                                  |
│ │ │ │ │ -|			- std::int64_t(pc.pad_bytes);                                                                                                                                               |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// fills in total_wanted, total_wanted_done and total_done                                                                                                                    |
│ │ │ │ │ -|void torrent::bytes_done(torrent_status& st, status_flags_t const flags) const                                                                                                 |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		st.total_done = 0;                                                                                                                                                           |
│ │ │ │ │ -|		st.total_wanted_done = 0;                                                                                                                                                    |
│ │ │ │ │ -|		st.total_wanted = m_size_on_disk;                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(st.total_wanted <= m_torrent_file->total_size());                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(st.total_wanted >= 0);                                                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(!valid_metadata() || m_torrent_file->num_pieces() > 0);                                                                                                       |
│ │ │ │ │ -|		if (!valid_metadata()) return;                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_seed_mode || is_seed())                                                                                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// once we're a seed and remove the piece picker, we stop tracking                                                                                                          |
│ │ │ │ │ -|			// piece- and file priority. We consider everything as being                                                                                                                |
│ │ │ │ │ -|			// "wanted"                                                                                                                                                                 |
│ │ │ │ │ -|			st.total_done = m_torrent_file->total_size() - m_padding_bytes;                                                                                                             |
│ │ │ │ │ -|			st.total_wanted_done = m_size_on_disk;                                                                                                                                      |
│ │ │ │ │ -|			st.total_wanted = m_size_on_disk;                                                                                                                                           |
│ │ │ │ │ -|			TORRENT_ASSERT(st.total_wanted <= st.total_done);                                                                                                                           |
│ │ │ │ │ -|			TORRENT_ASSERT(st.total_wanted_done <= st.total_wanted);                                                                                                                    |
│ │ │ │ │ -|			TORRENT_ASSERT(st.total_done <= m_torrent_file->total_size());                                                                                                              |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		else if (!has_picker())                                                                                                                                                      |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			st.total_done = 0;                                                                                                                                                          |
│ │ │ │ │ -|_	_	_	_s_t_._t_o_t_a_l___w_a_n_t_e_d___d_o_n_e_ _=_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_9_0_5_ _ _ _ _ _ _ _|_s_h_o_u_l_d_ _t_h_i_s_ _a_l_e_r_t_ _h_a_v_e_ _a_n_ _e_r_r_o_r_ _c_o_d_e_ _i_n_ _i_t_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** sshhoouulldd tthhiiss aalleerrtt hhaavvee aann eerrrroorr ccooddee iinn iitt?? **********                                                                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::44990055 ******                                                                                                                                                |
│ │ │ │ │ -|on_remove_peers();                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(m_connections.empty());                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// post a message to the main thread to destruct                                                                                                                             |
│ │ │ │ │ -|		// the torrent object from there                                                                                                                                             |
│ │ │ │ │ -|		if (m_storage)                                                                                                                                                               |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			try {                                                                                                                                                                       |
│ │ │ │ │ -|				m_ses.disk_thread().async_stop_torrent(m_storage                                                                                                                           |
│ │ │ │ │ -|					, std::bind(&torrent::on_torrent_aborted, shared_from_this()));                                                                                                           |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			catch (std::exception const& e)                                                                                                                                             |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				TORRENT_UNUSED(e);                                                                                                                                                         |
│ │ │ │ │ -|				m_storage.reset();                                                                                                                                                         |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|				debug_log("Failed to flush disk cache: %s", e.what());                                                                                                                     |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|				// clients may rely on this alert to be posted, so it's probably a                                                                                                         |
│ │ │ │ │ -|				// good idea to post it here, even though we failed                                                                                                                        |
│ │ │ │ │ -|if (alerts().should_post<cache_flushed_alert>())                                                                                                                               |
│ │ │ │ │ -|alerts().emplace_alert<cache_flushed_alert>(get_handle());                                                                                                                     |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			m_ses.deferred_submit_jobs();                                                                                                                                               |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (alerts().should_post<cache_flushed_alert>())                                                                                                                            |
│ │ │ │ │ -|				alerts().emplace_alert<cache_flushed_alert>(get_handle());                                                                                                                 |
│ │ │ │ │ -|			alerts().emplace_alert<torrent_removed_alert>(get_handle()                                                                                                                  |
│ │ │ │ │ -|				, info_hash(), get_userdata());                                                                                                                                            |
│ │ │ │ │ -|_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _3_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_9_7_5_ _ _ _ _ _ _ _|_t_h_i_s_ _s_h_o_u_l_d_ _r_e_t_u_r_n_ _o_p_t_i_o_n_a_l_<_>_._ _p_i_e_c_e_ _i_n_d_e_x_ _-_1_ _s_h_o_u_l_d_ _n_o_t_ _b_e_ _a_l_l_o_w_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss sshhoouulldd rreettuurrnn ooppttiioonnaall<<>>.. ppiieeccee iinnddeexx --11 sshhoouulldd nnoott bbee aalllloowweedd **********                                                                                                |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::44997755 ******                                                                                                                                                |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_SUPERSEEDING                                                                                                                                           |
│ │ │ │ │ -|	void torrent::set_super_seeding(bool const on)                                                                                                                                |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (on == m_super_seeding) return;                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		m_super_seeding = on;                                                                                                                                                        |
│ │ │ │ │ -|		set_need_save_resume(torrent_handle::if_state_changed);                                                                                                                      |
│ │ │ │ │ -|		state_updated();                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_super_seeding) return;                                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// disable super seeding for all peers                                                                                                                                       |
│ │ │ │ │ -|		for (auto pc : *this)                                                                                                                                                        |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			pc->superseed_piece(piece_index_t(-1), piece_index_t(-1));                                                                                                                  |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|piece_index_t torrent::get_piece_to_super_seed(typed_bitfield<piece_index_t> const& bits)                                                                                      |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		// return a piece with low availability that is not in                                                                                                                       |
│ │ │ │ │ -|		// the bitfield and that is not currently being super                                                                                                                        |
│ │ │ │ │ -|		// seeded by any peer                                                                                                                                                        |
│ │ │ │ │ -|		TORRENT_ASSERT(m_super_seeding);                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// do a linear search from the first piece                                                                                                                                   |
│ │ │ │ │ -|		int min_availability = 9999;                                                                                                                                                 |
│ │ │ │ │ -|		std::vector<piece_index_t> avail_vec;                                                                                                                                        |
│ │ │ │ │ -|		for (auto const i : m_torrent_file->piece_range())                                                                                                                           |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (bits[i]) continue;                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			int availability = 0;                                                                                                                                                       |
│ │ │ │ │ -|			for (auto pc : *this)                                                                                                                                                       |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				if (pc->super_seeded_piece(i))                                                                                                                                             |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					// avoid super-seeding the same piece to more than one                                                                                                                    |
│ │ │ │ │ -|					// peer if we can avoid it. Do this by artificially                                                                                                                       |
│ │ │ │ │ -|					// increase the availability                                                                                                                                              |
│ │ │ │ │ -|					availability = 999;                                                                                                                                                       |
│ │ │ │ │ -|					break;                                                                                                                                                                    |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|				if (pc->has_piece(i)) ++availability;                                                                                                                                      |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			if (availability > min_availability) continue;                                                                                                                              |
│ │ │ │ │ -|			if (availability == min_availability)                                                                                                                                       |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|_	_	_	_	_a_v_a_i_l___v_e_c_._p_u_s_h___b_a_c_k_(_i_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 3|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |move this into it's own .cpp file                                                                                                   |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_r_p_c___m_a_n_a_g_e_r_._c_p_p_:_7_1_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** mmoovvee tthhiiss iinnttoo iitt''ss oowwnn ..ccpppp ffiillee **********                                                                                                                                  |
│ │ │ │ │  |****** ....//ssrrcc//kkaaddeemmlliiaa//rrppcc__mmaannaaggeerr..ccpppp::7711 ******                                                                                                                                     |
│ │ │ │ │  |#include <libtorrent/kademlia/get_item.hpp>                                                                                                                                    |
│ │ │ │ │  |#include <libtorrent/kademlia/sample_infohashes.hpp>                                                                                                                           |
│ │ │ │ │  |#include <libtorrent/aux_/session_settings.hpp>                                                                                                                                |
│ │ │ │ │ @@ -1650,123 +1650,14 @@
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |	else                                                                                                                                                                          |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │  |		flags &= ~flag_ipv6_address;                                                                                                                                                 |
│ │ │ │ │  |		m_addr.v4 = ep.address().to_v4().to_bytes();                                                                                                                                 |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |unify url_seed and http_seed with just web_seed, using the web_seed_entry.                                                          |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_t_o_r_r_e_n_t___h_a_n_d_l_e_._h_p_p_:_5_3_5_ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** uunniiffyy uurrll__sseeeedd aanndd hhttttpp__sseeeedd wwiitthh jjuusstt wweebb__sseeeedd,, uussiinngg tthhee wweebb__sseeeedd__eennttrryy.. **********                                                                                         |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ttoorrrreenntt__hhaannddllee..hhpppp::553355 ******                                                                                                                           |
│ │ │ │ │ -|// one returned from ``trackers()`` and will replace it. If you want an                                                                                                        |
│ │ │ │ │ -|		// immediate effect, you have to call force_reannounce(). See                                                                                                                |
│ │ │ │ │ -|		// announce_entry.                                                                                                                                                           |
│ │ │ │ │ -|		//                                                                                                                                                                           |
│ │ │ │ │ -|		// ``post_trackers()`` is the asynchronous version of ``trackers()``. It                                                                                                     |
│ │ │ │ │ -|		// will trigger a tracker_list_alert to be posted.                                                                                                                           |
│ │ │ │ │ -|		//                                                                                                                                                                           |
│ │ │ │ │ -|		// ``add_tracker()`` will look if the specified tracker is already in the                                                                                                    |
│ │ │ │ │ -|		// set. If it is, it doesn't do anything. If it's not in the current set                                                                                                     |
│ │ │ │ │ -|		// of trackers, it will insert it in the tier specified in the                                                                                                               |
│ │ │ │ │ -|		// announce_entry.                                                                                                                                                           |
│ │ │ │ │ -|		//                                                                                                                                                                           |
│ │ │ │ │ -|		// The updated set of trackers will be saved in the resume data, and when                                                                                                    |
│ │ │ │ │ -|		// a torrent is started with resume data, the trackers from the resume                                                                                                       |
│ │ │ │ │ -|		// data will replace the original ones.                                                                                                                                      |
│ │ │ │ │ -|		std::vector<announce_entry> trackers() const;                                                                                                                                |
│ │ │ │ │ -|		void replace_trackers(std::vector<announce_entry> const&) const;                                                                                                             |
│ │ │ │ │ -|		void add_tracker(announce_entry const&) const;                                                                                                                               |
│ │ │ │ │ -|		void post_trackers() const;                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|// ``add_url_seed()`` adds another url to the torrent's list of url                                                                                                            |
│ │ │ │ │ -|		// seeds. If the given url already exists in that list, the call has no                                                                                                      |
│ │ │ │ │ -|		// effect. The torrent will connect to the server and try to download                                                                                                        |
│ │ │ │ │ -|		// pieces from it, unless it's paused, queued, checking or seeding.                                                                                                          |
│ │ │ │ │ -|		// ``remove_url_seed()`` removes the given url if it exists already.                                                                                                         |
│ │ │ │ │ -|		// ``url_seeds()`` return a set of the url seeds currently in this                                                                                                           |
│ │ │ │ │ -|		// torrent. Note that URLs that fails may be removed automatically from                                                                                                      |
│ │ │ │ │ -|		// the list.                                                                                                                                                                 |
│ │ │ │ │ -|		//                                                                                                                                                                           |
│ │ │ │ │ -|		// See http-seeding_ for more information.                                                                                                                                   |
│ │ │ │ │ -|		void add_url_seed(std::string const& url) const;                                                                                                                             |
│ │ │ │ │ -|		void remove_url_seed(std::string const& url) const;                                                                                                                          |
│ │ │ │ │ -|		std::set<std::string> url_seeds() const;                                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// These functions are identical as the ``*_url_seed()`` variants, but                                                                                                       |
│ │ │ │ │ -|		// they operate on `BEP 17`_ web seeds instead of `BEP 19`_.                                                                                                                 |
│ │ │ │ │ -|		//                                                                                                                                                                           |
│ │ │ │ │ -|		// See http-seeding_ for more information.                                                                                                                                   |
│ │ │ │ │ -|		void add_http_seed(std::string const& url) const;                                                                                                                            |
│ │ │ │ │ -|		void remove_http_seed(std::string const& url) const;                                                                                                                         |
│ │ │ │ │ -|		std::set<std::string> http_seeds() const;                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// add the specified extension to this torrent. The ``ext`` argument is                                                                                                      |
│ │ │ │ │ -|		// a function that will be called from within libtorrent's context                                                                                                           |
│ │ │ │ │ -|		// passing in the internal torrent object and the specified userdata                                                                                                         |
│ │ │ │ │ -|		// pointer. The function is expected to return a shared pointer to                                                                                                           |
│ │ │ │ │ -|		// a torrent_plugin instance.                                                                                                                                                |
│ │ │ │ │ -|		void add_extension(                                                                                                                                                          |
│ │ │ │ │ -|			std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&, client_data_t)> const& ext                                                                             |
│ │ │ │ │ -|_	_	_	_,_ _c_l_i_e_n_t___d_a_t_a___t_ _u_s_e_r_d_a_t_a_ _=_ _c_l_i_e_n_t___d_a_t_a___t_{_}_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |dh_key_exchange should probably move into its own file                                                                              |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_p_e___c_r_y_p_t_o_._h_p_p_:_7_2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ddhh__kkeeyy__eexxcchhaannggee sshhoouulldd pprroobbaabbllyy mmoovvee iinnttoo iittss oowwnn ffiillee **********                                                                                                             |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppee__ccrryyppttoo..hhpppp::7722 ******                                                                                                                                 |
│ │ │ │ │ -|#include <list>                                                                                                                                                                |
│ │ │ │ │ -|#include <array>                                                                                                                                                               |
│ │ │ │ │ -|#include <cstdint>                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	namespace mp = boost::multiprecision;                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	using key_t = mp::number<mp::cpp_int_backend<768, 768, mp::unsigned_magnitude, mp::unchecked, void>>;                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	TORRENT_EXTRA_EXPORT std::array<char, 96> export_key(key_t const& k);                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// RC4 state from libtomcrypt                                                                                                                                                 |
│ │ │ │ │ -|	struct rc4 {                                                                                                                                                                  |
│ │ │ │ │ -|		int x;                                                                                                                                                                       |
│ │ │ │ │ -|		int y;                                                                                                                                                                       |
│ │ │ │ │ -|		aux::array<std::uint8_t, 256> buf;                                                                                                                                           |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|class TORRENT_EXTRA_EXPORT dh_key_exchange                                                                                                                                     |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	public:                                                                                                                                                                       |
│ │ │ │ │ -|		dh_key_exchange();                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// Get local public key                                                                                                                                                      |
│ │ │ │ │ -|		key_t const& get_local_key() const { return m_dh_local_key; }                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// read remote_pubkey, generate and store shared secret in                                                                                                                   |
│ │ │ │ │ -|		// m_dh_shared_secret.                                                                                                                                                       |
│ │ │ │ │ -|		void compute_secret(std::uint8_t const* remote_pubkey);                                                                                                                      |
│ │ │ │ │ -|		void compute_secret(key_t const& remote_pubkey);                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		key_t const& get_secret() const { return m_dh_shared_secret; }                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		sha1_hash const& get_hash_xor_mask() const { return m_xor_mask; }                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	private:                                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		key_t m_dh_local_key;                                                                                                                                                        |
│ │ │ │ │ -|		key_t m_dh_local_secret;                                                                                                                                                     |
│ │ │ │ │ -|		key_t m_dh_shared_secret;                                                                                                                                                    |
│ │ │ │ │ -|		sha1_hash m_xor_mask;                                                                                                                                                        |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	struct TORRENT_EXTRA_EXPORT encryption_handler                                                                                                                                |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::tuple<int, span<span<char const>>>                                                                                                                                      |
│ │ │ │ │ -|		encrypt(span<span<char>> iovec);                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_	_	_i_n_t_ _d_e_c_r_y_p_t_(_a_u_x_:_:_c_r_y_p_t_o___r_e_c_e_i_v_e___b_u_f_f_e_r_&_ _r_e_c_v___b_u_f_f_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |factor out predictive pieces and all operations on it into a separate class (to use as member here instead)                         |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_t_o_r_r_e_n_t_._h_p_p_:_1_4_2_3_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** ffaaccttoorr oouutt pprreeddiiccttiivvee ppiieecceess aanndd aallll ooppeerraattiioonnss oonn iitt iinnttoo aa sseeppaarraattee ccllaassss ((ttoo uussee aass mmeemmbbeerr hheerree iinnsstteeaadd)) **********                                                        |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//ttoorrrreenntt..hhpppp::11442233 ******                                                                                                                                 |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		std::string m_trackerid;                                                                                                                                                     |
│ │ │ │ │ @@ -1868,67 +1759,124 @@
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// the number of pieces we completed the check of                                                                                                                            |
│ │ │ │ │  |		piece_index_t m_num_checked_pieces{0};                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// if the error occurred on a file, this is the index of that file                                                                                                           |
│ │ │ │ │  |		// there are a few special cases, when this is negative. See                                                                                                                 |
│ │ │ │ │  |_	_	_/_/_ _s_e_t___e_r_r_o_r_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |everything but payload counters and rates could probably be removed from here                                                       |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_s_t_a_t_._h_p_p_:_2_5_7_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** eevveerryytthhiinngg bbuutt ppaayyllooaadd ccoouunntteerrss aanndd rraatteess ccoouulldd pprroobbaabbllyy bbee rreemmoovveedd ffrroomm hheerree **********                                                                                      |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ssttaatt..hhpppp::225577 ******                                                                                                                                     |
│ │ │ │ │ -|// peer_connection is opened and have some previous                                                                                                                            |
│ │ │ │ │ -|		// transfers from earlier connections.                                                                                                                                       |
│ │ │ │ │ -|		void add_stat(std::int64_t downloaded, std::int64_t uploaded)                                                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_stat[download_payload].offset(downloaded);                                                                                                                                |
│ │ │ │ │ -|			m_stat[upload_payload].offset(uploaded);                                                                                                                                    |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |use string_view for device_name                                                                                                     |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_e_n_u_m___n_e_t_._h_p_p_:_1_6_4_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** uussee ssttrriinngg__vviieeww ffoorr ddeevviiccee__nnaammee **********                                                                                                                                    |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//eennuumm__nneett..hhpppp::116644 ******                                                                                                                                 |
│ │ │ │ │ +|// return nullopt.                                                                                                                                                             |
│ │ │ │ │ +|	TORRENT_EXTRA_EXPORT boost::optional<address> get_gateway(                                                                                                                    |
│ │ │ │ │ +|		ip_interface const& iface, span<ip_route const> routes);                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		int last_payload_downloaded() const                                                                                                                                          |
│ │ │ │ │ -|		{ return m_stat[download_payload].counter(); }                                                                                                                               |
│ │ │ │ │ -|		int last_payload_uploaded() const                                                                                                                                            |
│ │ │ │ │ -|		{ return m_stat[upload_payload].counter(); }                                                                                                                                 |
│ │ │ │ │ -|		int last_protocol_downloaded() const                                                                                                                                         |
│ │ │ │ │ -|		{ return m_stat[download_protocol].counter(); }                                                                                                                              |
│ │ │ │ │ -|		int last_protocol_uploaded() const                                                                                                                                           |
│ │ │ │ │ -|		{ return m_stat[upload_protocol].counter(); }                                                                                                                                |
│ │ │ │ │ +|	// returns whether there is a route to the specified device for for any global                                                                                                |
│ │ │ │ │ +|	// internet address of the specified address family.                                                                                                                          |
│ │ │ │ │ +|	TORRENT_EXTRA_EXPORT bool has_internet_route(string_view device, int family                                                                                                   |
│ │ │ │ │ +|		, span<ip_route const> routes);                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// these are the channels we keep stats for                                                                                                                                  |
│ │ │ │ │ -|		enum                                                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|upload_payload,                                                                                                                                                                |
│ │ │ │ │ -|upload_protocol,                                                                                                                                                               |
│ │ │ │ │ -|			download_payload,                                                                                                                                                           |
│ │ │ │ │ -|			download_protocol,                                                                                                                                                          |
│ │ │ │ │ -|			upload_ip_protocol,                                                                                                                                                         |
│ │ │ │ │ -|			download_ip_protocol,                                                                                                                                                       |
│ │ │ │ │ -|			num_channels                                                                                                                                                                |
│ │ │ │ │ -|		};                                                                                                                                                                           |
│ │ │ │ │ +|	// returns whether there are *any* routes to the internet in the routing                                                                                                      |
│ │ │ │ │ +|	// table. This can be used to determine if the routing table is fully                                                                                                         |
│ │ │ │ │ +|	// populated or not.                                                                                                                                                          |
│ │ │ │ │ +|	TORRENT_EXTRA_EXPORT bool has_any_internet_route(span<ip_route const> routes);                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		void clear()                                                                                                                                                                 |
│ │ │ │ │ +|	// attempt to bind socket to the device with the specified name. For systems                                                                                                  |
│ │ │ │ │ +|	// that don't support SO_BINDTODEVICE the socket will be bound to one of the                                                                                                  |
│ │ │ │ │ +|	// IP addresses of the specified device. In this case it is necessary to                                                                                                      |
│ │ │ │ │ +|	// verify the local endpoint of the socket once the connection is established.                                                                                                |
│ │ │ │ │ +|	// the returned address is the ip the socket was bound to (or address_v4::any()                                                                                               |
│ │ │ │ │ +|	// in case SO_BINDTODEVICE succeeded and we don't need to verify it).                                                                                                         |
│ │ │ │ │ +|template <class Socket>                                                                                                                                                        |
│ │ │ │ │ +|address bind_socket_to_device(io_context& ios, Socket& sock                                                                                                                    |
│ │ │ │ │ +|		, tcp const& protocol                                                                                                                                                        |
│ │ │ │ │ +|		, char const* device_name, int port, error_code& ec)                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		tcp::endpoint bind_ep(address_v4::any(), std::uint16_t(port));                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		address ip = make_address(device_name, ec);                                                                                                                                  |
│ │ │ │ │ +|		if (!ec)                                                                                                                                                                     |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			for (int i = 0; i < num_channels; ++i)                                                                                                                                      |
│ │ │ │ │ -|				m_stat[i].clear();                                                                                                                                                         |
│ │ │ │ │ +|			// this is to cover the case where "0.0.0.0" is considered any IPv4 or                                                                                                      |
│ │ │ │ │ +|			// IPv6 address. If we're asking to be bound to an IPv6 address and                                                                                                         |
│ │ │ │ │ +|			// providing 0.0.0.0 as the device, turn it into "::"                                                                                                                       |
│ │ │ │ │ +|			if (ip == address_v4::any() && protocol == boost::asio::ip::tcp::v6())                                                                                                      |
│ │ │ │ │ +|				ip = address_v6::any();                                                                                                                                                    |
│ │ │ │ │ +|			bind_ep.address(ip);                                                                                                                                                        |
│ │ │ │ │ +|			// it appears to be an IP. Just bind to that address                                                                                                                        |
│ │ │ │ │ +|			sock.bind(bind_ep, ec);                                                                                                                                                     |
│ │ │ │ │ +|			return bind_ep.address();                                                                                                                                                   |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		stat_channel const& operator[](int i) const                                                                                                                                  |
│ │ │ │ │ +|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_HAS_BINDTODEVICE                                                                                                                                                   |
│ │ │ │ │ +|		// try to use SO_BINDTODEVICE here, if that exists. If it fails,                                                                                                             |
│ │ │ │ │ +|		// fall back to the mechanism we have below                                                                                                                                  |
│ │ │ │ │ +|		aux::bind_device(sock, device_name, ec);                                                                                                                                     |
│ │ │ │ │ +|		if (ec)                                                                                                                                                                      |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			TORRENT_ASSERT(i >= 0 && i < num_channels);                                                                                                                                 |
│ │ │ │ │ -|			return m_stat[i];                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|_	_	_	_e_c_._c_l_e_a_r_(_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |unify url_seed and http_seed with just web_seed, using the web_seed_entry.                                                          |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_t_o_r_r_e_n_t___h_a_n_d_l_e_._h_p_p_:_5_3_5_ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** uunniiffyy uurrll__sseeeedd aanndd hhttttpp__sseeeedd wwiitthh jjuusstt wweebb__sseeeedd,, uussiinngg tthhee wweebb__sseeeedd__eennttrryy.. **********                                                                                         |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ttoorrrreenntt__hhaannddllee..hhpppp::553355 ******                                                                                                                           |
│ │ │ │ │ +|// one returned from ``trackers()`` and will replace it. If you want an                                                                                                        |
│ │ │ │ │ +|		// immediate effect, you have to call force_reannounce(). See                                                                                                                |
│ │ │ │ │ +|		// announce_entry.                                                                                                                                                           |
│ │ │ │ │ +|		//                                                                                                                                                                           |
│ │ │ │ │ +|		// ``post_trackers()`` is the asynchronous version of ``trackers()``. It                                                                                                     |
│ │ │ │ │ +|		// will trigger a tracker_list_alert to be posted.                                                                                                                           |
│ │ │ │ │ +|		//                                                                                                                                                                           |
│ │ │ │ │ +|		// ``add_tracker()`` will look if the specified tracker is already in the                                                                                                    |
│ │ │ │ │ +|		// set. If it is, it doesn't do anything. If it's not in the current set                                                                                                     |
│ │ │ │ │ +|		// of trackers, it will insert it in the tier specified in the                                                                                                               |
│ │ │ │ │ +|		// announce_entry.                                                                                                                                                           |
│ │ │ │ │ +|		//                                                                                                                                                                           |
│ │ │ │ │ +|		// The updated set of trackers will be saved in the resume data, and when                                                                                                    |
│ │ │ │ │ +|		// a torrent is started with resume data, the trackers from the resume                                                                                                       |
│ │ │ │ │ +|		// data will replace the original ones.                                                                                                                                      |
│ │ │ │ │ +|		std::vector<announce_entry> trackers() const;                                                                                                                                |
│ │ │ │ │ +|		void replace_trackers(std::vector<announce_entry> const&) const;                                                                                                             |
│ │ │ │ │ +|		void add_tracker(announce_entry const&) const;                                                                                                                               |
│ │ │ │ │ +|		void post_trackers() const;                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	private:                                                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		stat_channel m_stat[num_channels];                                                                                                                                           |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ +|// ``add_url_seed()`` adds another url to the torrent's list of url                                                                                                            |
│ │ │ │ │ +|		// seeds. If the given url already exists in that list, the call has no                                                                                                      |
│ │ │ │ │ +|		// effect. The torrent will connect to the server and try to download                                                                                                        |
│ │ │ │ │ +|		// pieces from it, unless it's paused, queued, checking or seeding.                                                                                                          |
│ │ │ │ │ +|		// ``remove_url_seed()`` removes the given url if it exists already.                                                                                                         |
│ │ │ │ │ +|		// ``url_seeds()`` return a set of the url seeds currently in this                                                                                                           |
│ │ │ │ │ +|		// torrent. Note that URLs that fails may be removed automatically from                                                                                                      |
│ │ │ │ │ +|		// the list.                                                                                                                                                                 |
│ │ │ │ │ +|		//                                                                                                                                                                           |
│ │ │ │ │ +|		// See http-seeding_ for more information.                                                                                                                                   |
│ │ │ │ │ +|		void add_url_seed(std::string const& url) const;                                                                                                                             |
│ │ │ │ │ +|		void remove_url_seed(std::string const& url) const;                                                                                                                          |
│ │ │ │ │ +|		std::set<std::string> url_seeds() const;                                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|		// These functions are identical as the ``*_url_seed()`` variants, but                                                                                                       |
│ │ │ │ │ +|		// they operate on `BEP 17`_ web seeds instead of `BEP 19`_.                                                                                                                 |
│ │ │ │ │ +|		//                                                                                                                                                                           |
│ │ │ │ │ +|		// See http-seeding_ for more information.                                                                                                                                   |
│ │ │ │ │ +|		void add_http_seed(std::string const& url) const;                                                                                                                            |
│ │ │ │ │ +|		void remove_http_seed(std::string const& url) const;                                                                                                                         |
│ │ │ │ │ +|		std::set<std::string> http_seeds() const;                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_#_e_n_d_i_f_ _/_/_ _T_O_R_R_E_N_T___S_T_A_T___H_P_P___I_N_C_L_U_D_E_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|		// add the specified extension to this torrent. The ``ext`` argument is                                                                                                      |
│ │ │ │ │ +|		// a function that will be called from within libtorrent's context                                                                                                           |
│ │ │ │ │ +|		// passing in the internal torrent object and the specified userdata                                                                                                         |
│ │ │ │ │ +|		// pointer. The function is expected to return a shared pointer to                                                                                                           |
│ │ │ │ │ +|		// a torrent_plugin instance.                                                                                                                                                |
│ │ │ │ │ +|		void add_extension(                                                                                                                                                          |
│ │ │ │ │ +|			std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&, client_data_t)> const& ext                                                                             |
│ │ │ │ │ +|_	_	_	_,_ _c_l_i_e_n_t___d_a_t_a___t_ _u_s_e_r_d_a_t_a_ _=_ _c_l_i_e_n_t___d_a_t_a___t_{_}_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |if we make this be a disk_buffer_holder instead we would save a copy use allocate_disk_receive_buffer and                           |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_w_e_b___p_e_e_r___c_o_n_n_e_c_t_i_o_n_._h_p_p_:_1_1_9_ _ _ _|_r_e_l_e_a_s_e___d_i_s_k___r_e_c_e_i_v_e___b_u_f_f_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** iiff wwee mmaakkee tthhiiss bbee aa ddiisskk__bbuuffffeerr__hhoollddeerr iinnsstteeaadd wwee wwoouulldd ssaavvee aa ccooppyy uussee aallllooccaattee__ddiisskk__rreecceeiivvee__bbuuffffeerr aanndd rreelleeaassee__ddiisskk__rreecceeiivvee__bbuuffffeerr **********                              |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//wweebb__ppeeeerr__ccoonnnneeccttiioonn..hhpppp::111199 ******                                                                                                                      |
│ │ │ │ │  |piece_block_progress downloading_piece_progress() const override;                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		void handle_padfile();                                                                                                                                                       |
│ │ │ │ │ @@ -1971,69 +1919,121 @@
│ │ │ │ │  |		// the number of responses we've received so far on                                                                                                                          |
│ │ │ │ │  |		// this connection                                                                                                                                                           |
│ │ │ │ │  |		int m_num_responses;                                                                                                                                                         |
│ │ │ │ │  |	};                                                                                                                                                                            |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |_#_e_n_d_i_f_ _/_/_ _T_O_R_R_E_N_T___W_E_B___P_E_E_R___C_O_N_N_E_C_T_I_O_N___H_P_P___I_N_C_L_U_D_E_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |use string_view for device_name                                                                                                     |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_e_n_u_m___n_e_t_._h_p_p_:_1_6_4_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** uussee ssttrriinngg__vviieeww ffoorr ddeevviiccee__nnaammee **********                                                                                                                                    |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//eennuumm__nneett..hhpppp::116644 ******                                                                                                                                 |
│ │ │ │ │ -|// return nullopt.                                                                                                                                                             |
│ │ │ │ │ -|	TORRENT_EXTRA_EXPORT boost::optional<address> get_gateway(                                                                                                                    |
│ │ │ │ │ -|		ip_interface const& iface, span<ip_route const> routes);                                                                                                                     |
│ │ │ │ │ +|relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |dh_key_exchange should probably move into its own file                                                                              |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_p_e___c_r_y_p_t_o_._h_p_p_:_7_2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ddhh__kkeeyy__eexxcchhaannggee sshhoouulldd pprroobbaabbllyy mmoovvee iinnttoo iittss oowwnn ffiillee **********                                                                                                             |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppee__ccrryyppttoo..hhpppp::7722 ******                                                                                                                                 |
│ │ │ │ │ +|#include <list>                                                                                                                                                                |
│ │ │ │ │ +|#include <array>                                                                                                                                                               |
│ │ │ │ │ +|#include <cstdint>                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// returns whether there is a route to the specified device for for any global                                                                                                |
│ │ │ │ │ -|	// internet address of the specified address family.                                                                                                                          |
│ │ │ │ │ -|	TORRENT_EXTRA_EXPORT bool has_internet_route(string_view device, int family                                                                                                   |
│ │ │ │ │ -|		, span<ip_route const> routes);                                                                                                                                              |
│ │ │ │ │ +|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// returns whether there are *any* routes to the internet in the routing                                                                                                      |
│ │ │ │ │ -|	// table. This can be used to determine if the routing table is fully                                                                                                         |
│ │ │ │ │ -|	// populated or not.                                                                                                                                                          |
│ │ │ │ │ -|	TORRENT_EXTRA_EXPORT bool has_any_internet_route(span<ip_route const> routes);                                                                                                |
│ │ │ │ │ +|	namespace mp = boost::multiprecision;                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// attempt to bind socket to the device with the specified name. For systems                                                                                                  |
│ │ │ │ │ -|	// that don't support SO_BINDTODEVICE the socket will be bound to one of the                                                                                                  |
│ │ │ │ │ -|	// IP addresses of the specified device. In this case it is necessary to                                                                                                      |
│ │ │ │ │ -|	// verify the local endpoint of the socket once the connection is established.                                                                                                |
│ │ │ │ │ -|	// the returned address is the ip the socket was bound to (or address_v4::any()                                                                                               |
│ │ │ │ │ -|	// in case SO_BINDTODEVICE succeeded and we don't need to verify it).                                                                                                         |
│ │ │ │ │ -|template <class Socket>                                                                                                                                                        |
│ │ │ │ │ -|address bind_socket_to_device(io_context& ios, Socket& sock                                                                                                                    |
│ │ │ │ │ -|		, tcp const& protocol                                                                                                                                                        |
│ │ │ │ │ -|		, char const* device_name, int port, error_code& ec)                                                                                                                         |
│ │ │ │ │ +|	using key_t = mp::number<mp::cpp_int_backend<768, 768, mp::unsigned_magnitude, mp::unchecked, void>>;                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	TORRENT_EXTRA_EXPORT std::array<char, 96> export_key(key_t const& k);                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// RC4 state from libtomcrypt                                                                                                                                                 |
│ │ │ │ │ +|	struct rc4 {                                                                                                                                                                  |
│ │ │ │ │ +|		int x;                                                                                                                                                                       |
│ │ │ │ │ +|		int y;                                                                                                                                                                       |
│ │ │ │ │ +|		aux::array<std::uint8_t, 256> buf;                                                                                                                                           |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|class TORRENT_EXTRA_EXPORT dh_key_exchange                                                                                                                                     |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	public:                                                                                                                                                                       |
│ │ │ │ │ +|		dh_key_exchange();                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// Get local public key                                                                                                                                                      |
│ │ │ │ │ +|		key_t const& get_local_key() const { return m_dh_local_key; }                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// read remote_pubkey, generate and store shared secret in                                                                                                                   |
│ │ │ │ │ +|		// m_dh_shared_secret.                                                                                                                                                       |
│ │ │ │ │ +|		void compute_secret(std::uint8_t const* remote_pubkey);                                                                                                                      |
│ │ │ │ │ +|		void compute_secret(key_t const& remote_pubkey);                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		key_t const& get_secret() const { return m_dh_shared_secret; }                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		sha1_hash const& get_hash_xor_mask() const { return m_xor_mask; }                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	private:                                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		key_t m_dh_local_key;                                                                                                                                                        |
│ │ │ │ │ +|		key_t m_dh_local_secret;                                                                                                                                                     |
│ │ │ │ │ +|		key_t m_dh_shared_secret;                                                                                                                                                    |
│ │ │ │ │ +|		sha1_hash m_xor_mask;                                                                                                                                                        |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	struct TORRENT_EXTRA_EXPORT encryption_handler                                                                                                                                |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		tcp::endpoint bind_ep(address_v4::any(), std::uint16_t(port));                                                                                                               |
│ │ │ │ │ +|		std::tuple<int, span<span<char const>>>                                                                                                                                      |
│ │ │ │ │ +|		encrypt(span<span<char>> iovec);                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		address ip = make_address(device_name, ec);                                                                                                                                  |
│ │ │ │ │ -|		if (!ec)                                                                                                                                                                     |
│ │ │ │ │ +|_	_	_i_n_t_ _d_e_c_r_y_p_t_(_a_u_x_:_:_c_r_y_p_t_o___r_e_c_e_i_v_e___b_u_f_f_e_r_&_ _r_e_c_v___b_u_f_f_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |everything but payload counters and rates could probably be removed from here                                                       |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_s_t_a_t_._h_p_p_:_2_5_7_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** eevveerryytthhiinngg bbuutt ppaayyllooaadd ccoouunntteerrss aanndd rraatteess ccoouulldd pprroobbaabbllyy bbee rreemmoovveedd ffrroomm hheerree **********                                                                                      |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ssttaatt..hhpppp::225577 ******                                                                                                                                     |
│ │ │ │ │ +|// peer_connection is opened and have some previous                                                                                                                            |
│ │ │ │ │ +|		// transfers from earlier connections.                                                                                                                                       |
│ │ │ │ │ +|		void add_stat(std::int64_t downloaded, std::int64_t uploaded)                                                                                                                |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// this is to cover the case where "0.0.0.0" is considered any IPv4 or                                                                                                      |
│ │ │ │ │ -|			// IPv6 address. If we're asking to be bound to an IPv6 address and                                                                                                         |
│ │ │ │ │ -|			// providing 0.0.0.0 as the device, turn it into "::"                                                                                                                       |
│ │ │ │ │ -|			if (ip == address_v4::any() && protocol == boost::asio::ip::tcp::v6())                                                                                                      |
│ │ │ │ │ -|				ip = address_v6::any();                                                                                                                                                    |
│ │ │ │ │ -|			bind_ep.address(ip);                                                                                                                                                        |
│ │ │ │ │ -|			// it appears to be an IP. Just bind to that address                                                                                                                        |
│ │ │ │ │ -|			sock.bind(bind_ep, ec);                                                                                                                                                     |
│ │ │ │ │ -|			return bind_ep.address();                                                                                                                                                   |
│ │ │ │ │ +|			m_stat[download_payload].offset(downloaded);                                                                                                                                |
│ │ │ │ │ +|			m_stat[upload_payload].offset(uploaded);                                                                                                                                    |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ +|		int last_payload_downloaded() const                                                                                                                                          |
│ │ │ │ │ +|		{ return m_stat[download_payload].counter(); }                                                                                                                               |
│ │ │ │ │ +|		int last_payload_uploaded() const                                                                                                                                            |
│ │ │ │ │ +|		{ return m_stat[upload_payload].counter(); }                                                                                                                                 |
│ │ │ │ │ +|		int last_protocol_downloaded() const                                                                                                                                         |
│ │ │ │ │ +|		{ return m_stat[download_protocol].counter(); }                                                                                                                              |
│ │ │ │ │ +|		int last_protocol_uploaded() const                                                                                                                                           |
│ │ │ │ │ +|		{ return m_stat[upload_protocol].counter(); }                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_HAS_BINDTODEVICE                                                                                                                                                   |
│ │ │ │ │ -|		// try to use SO_BINDTODEVICE here, if that exists. If it fails,                                                                                                             |
│ │ │ │ │ -|		// fall back to the mechanism we have below                                                                                                                                  |
│ │ │ │ │ -|		aux::bind_device(sock, device_name, ec);                                                                                                                                     |
│ │ │ │ │ -|		if (ec)                                                                                                                                                                      |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		// these are the channels we keep stats for                                                                                                                                  |
│ │ │ │ │ +|		enum                                                                                                                                                                         |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|_	_	_	_e_c_._c_l_e_a_r_(_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|upload_payload,                                                                                                                                                                |
│ │ │ │ │ +|upload_protocol,                                                                                                                                                               |
│ │ │ │ │ +|			download_payload,                                                                                                                                                           |
│ │ │ │ │ +|			download_protocol,                                                                                                                                                          |
│ │ │ │ │ +|			upload_ip_protocol,                                                                                                                                                         |
│ │ │ │ │ +|			download_ip_protocol,                                                                                                                                                       |
│ │ │ │ │ +|			num_channels                                                                                                                                                                |
│ │ │ │ │ +|		};                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		void clear()                                                                                                                                                                 |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			for (int i = 0; i < num_channels; ++i)                                                                                                                                      |
│ │ │ │ │ +|				m_stat[i].clear();                                                                                                                                                         |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		stat_channel const& operator[](int i) const                                                                                                                                  |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			TORRENT_ASSERT(i >= 0 && i < num_channels);                                                                                                                                 |
│ │ │ │ │ +|			return m_stat[i];                                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	private:                                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		stat_channel m_stat[num_channels];                                                                                                                                           |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_#_e_n_d_i_f_ _/_/_ _T_O_R_R_E_N_T___S_T_A_T___H_P_P___I_N_C_L_U_D_E_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 3|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |to improve memory locality and scanning performance, turn the routing table into a single vector with boundaries for the nodes      |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_k_a_d_e_m_l_i_a_/_r_o_u_t_i_n_g___t_a_b_l_e_._h_p_p_:_1_5_3_|_i_n_s_t_e_a_d_._ _P_e_r_h_a_p_s_ _r_e_p_l_a_c_e_m_e_n_t_ _n_o_d_e_s_ _s_h_o_u_l_d_ _b_e_ _i_n_ _a_ _s_e_p_a_r_a_t_e_ _v_e_c_t_o_r_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** ttoo iimmpprroovvee mmeemmoorryy llooccaalliittyy aanndd ssccaannnniinngg ppeerrffoorrmmaannccee,, ttuurrnn tthhee rroouuttiinngg ttaabbllee iinnttoo aa ssiinnggllee vveeccttoorr wwiitthh bboouunnddaarriieess ffoorr tthhee nnooddeess iinnsstteeaadd.. PPeerrhhaappss rreeppllaacceemmeenntt nnooddeess sshhoouulldd |
│ │ │ │ │  |bbee iinn aa sseeppaarraattee vveeccttoorr.. **********                                                                                                                                                 |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//kkaaddeemmlliiaa//rroouuttiinngg__ttaabbllee..hhpppp::115533 ******                                                                                                                   |
│ │ │ │ │  |// * Nodes are not marked as being stale, they keep a counter                                                                                                                  |
│ │ │ │ │  |// 	that tells how many times in a row they have failed. When                                                                                                                  |
│ │ │ │ │ @@ -2136,14 +2136,18 @@
│ │ │ │ │  |		, move_flags_t flags, storage_error& ec);                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |	// deletes the files on fs from save_path according to options. Options may                                                                                                   |
│ │ │ │ │  |	// opt to only delete the partfile                                                                                                                                            |
│ │ │ │ │  |	TORRENT_EXTRA_EXPORT void                                                                                                                                                     |
│ │ │ │ │  |	delete_files(file_storage const& fs, std::string const& save_path                                                                                                             |
│ │ │ │ │  |_	_	_,_ _s_t_d_:_:_s_t_r_i_n_g_ _c_o_n_s_t_&_ _p_a_r_t___f_i_l_e___n_a_m_e_,_ _r_e_m_o_v_e___f_l_a_g_s___t_ _o_p_t_i_o_n_s_,_ _s_t_o_r_a_g_e___e_r_r_o_r_&_ _e_c_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 2|_._._/_t_e_s_t_/_t_e_s_t___p_i_e_c_e___p_i_c_k_e_r_._c_p_p_:|test picking with partial pieces and other peers present so that both backup_pieces and backup_pieces2 are used                     |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_2_8_7_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt ppiicckkiinngg wwiitthh ppaarrttiiaall ppiieecceess aanndd ootthheerr ppeeeerrss pprreesseenntt ssoo tthhaatt bbootthh bbaacckkuupp__ppiieecceess aanndd bbaacckkuupp__ppiieecceess22 aarree uusseedd **********                                                    |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____pp_ii_ee_cc_ee____pp_ii_cc_kk_ee_rr_.._cc_pp_pp_::_22_88_77_00_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _2_|_._._/_t_e_s_t_/_t_e_s_t___s_t_o_r_a_g_e_._c_p_p_:_7_6_9_ _ _|_s_p_l_i_t_ _t_h_i_s_ _t_e_s_t_ _u_p_ _i_n_t_o_ _s_m_a_l_l_e_r_ _p_a_r_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** sspplliitt tthhiiss tteesstt uupp iinnttoo ssmmaalllleerr ppaarrttss **********                                                                                                                              |
│ │ │ │ │  |****** ....//tteesstt//tteesstt__ssttoorraaggee..ccpppp::776699 ******                                                                                                                                           |
│ │ │ │ │  |io->submit_jobs();                                                                                                                                                             |
│ │ │ │ │  |	ios.restart();                                                                                                                                                                |
│ │ │ │ │  |	run_until(ios, done);                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ @@ -2298,597 +2302,179 @@
│ │ │ │ │  |	bool ret = verify_message(ent, msg_desc, msg_keys, error_string);                                                                                                             |
│ │ │ │ │  |	TEST_CHECK(ret);                                                                                                                                                              |
│ │ │ │ │  |	TEST_CHECK(msg_keys[0]);                                                                                                                                                      |
│ │ │ │ │  |	if (msg_keys[0]) TEST_EQUAL(msg_keys[0].string_value(), "test");                                                                                                              |
│ │ │ │ │  |	TEST_CHECK(msg_keys[1]);                                                                                                                                                      |
│ │ │ │ │  |	TEST_CHECK(msg_keys[2]);                                                                                                                                                      |
│ │ │ │ │  |_	_i_f_ _(_m_s_g___k_e_y_s_[_2_]_)_ _T_E_S_T___E_Q_U_A_L_(_m_s_g___k_e_y_s_[_2_]_._s_t_r_i_n_g___v_a_l_u_e_(_)_,_ _"_t_e_s_t_2_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 2|_._._/_t_e_s_t_/_t_e_s_t___p_i_e_c_e___p_i_c_k_e_r_._c_p_p_:|test picking with partial pieces and other peers present so that both backup_pieces and backup_pieces2 are used                     |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_2_8_7_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt ppiicckkiinngg wwiitthh ppaarrttiiaall ppiieecceess aanndd ootthheerr ppeeeerrss pprreesseenntt ssoo tthhaatt bbootthh bbaacckkuupp__ppiieecceess aanndd bbaacckkuupp__ppiieecceess22 aarree uusseedd **********                                                    |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____pp_ii_ee_cc_ee____pp_ii_cc_kk_ee_rr_.._cc_pp_pp_::_22_88_77_00_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_u_p_n_p_._c_p_p_:_1_0_6_ _ _ _ _ _ _ _ _ _ _ _|_u_s_e_ _b_o_o_s_t_:_:_a_s_i_o_:_:_i_p_:_:_n_e_t_w_o_r_k_ _i_n_s_t_e_a_d_ _o_f_ _n_e_t_m_a_s_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** uussee bboooosstt::::aassiioo::::iipp::::nneettwwoorrkk iinnsstteeaadd ooff nneettmmaasskk **********                                                                                                                    |
│ │ │ │ │ -|****** ....//ssrrcc//uuppnnpp..ccpppp::110066 ******                                                                                                                                                    |
│ │ │ │ │ -|static error_code ignore_error;                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|upnp::rootdevice::rootdevice() = default;                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ -|upnp::rootdevice::~rootdevice()                                                                                                                                                |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	TORRENT_ASSERT(magic == 1337);                                                                                                                                                |
│ │ │ │ │ -|	magic = 0;                                                                                                                                                                    |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|upnp::rootdevice::~rootdevice() = default;                                                                                                                                     |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|upnp::rootdevice::rootdevice(rootdevice const&) = default;                                                                                                                     |
│ │ │ │ │ -|upnp::rootdevice& upnp::rootdevice::operator=(rootdevice const&) & = default;                                                                                                  |
│ │ │ │ │ -|upnp::rootdevice::rootdevice(rootdevice&&) noexcept = default;                                                                                                                 |
│ │ │ │ │ -|upnp::rootdevice& upnp::rootdevice::operator=(rootdevice&&) & = default;                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|upnp::upnp(io_context& ios                                                                                                                                                     |
│ │ │ │ │ -|, aux::session_settings const& settings                                                                                                                                        |
│ │ │ │ │ -|	, aux::portmap_callback& cb                                                                                                                                                   |
│ │ │ │ │ -|	, address_v4 const listen_address                                                                                                                                             |
│ │ │ │ │ -|	, address_v4 const netmask                                                                                                                                                    |
│ │ │ │ │ -|	, std::string listen_device                                                                                                                                                   |
│ │ │ │ │ -|	, listen_socket_handle ls)                                                                                                                                                    |
│ │ │ │ │ -|	: m_settings(settings)                                                                                                                                                        |
│ │ │ │ │ -|	, m_callback(cb)                                                                                                                                                              |
│ │ │ │ │ -|	, m_io_service(ios)                                                                                                                                                           |
│ │ │ │ │ -|	, m_resolver(ios)                                                                                                                                                             |
│ │ │ │ │ -|	, m_multicast(ios)                                                                                                                                                            |
│ │ │ │ │ -|	, m_unicast(ios)                                                                                                                                                              |
│ │ │ │ │ -|	, m_broadcast_timer(ios)                                                                                                                                                      |
│ │ │ │ │ -|	, m_refresh_timer(ios)                                                                                                                                                        |
│ │ │ │ │ -|	, m_map_timer(ios)                                                                                                                                                            |
│ │ │ │ │ -|	, m_listen_address(listen_address)                                                                                                                                            |
│ │ │ │ │ -|	, m_netmask(netmask)                                                                                                                                                          |
│ │ │ │ │ -|	, m_device(std::move(listen_device))                                                                                                                                          |
│ │ │ │ │ -|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ -|	, m_ssl_ctx(ssl::context::sslv23_client)                                                                                                                                      |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	, m_listen_handle(std::move(ls))                                                                                                                                              |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ -|	m_ssl_ctx.set_verify_mode(ssl::context::verify_none);                                                                                                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void upnp::start()                                                                                                                                                             |
│ │ │ │ │ -|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_b_d_e_c_o_d_e_._c_p_p_:_8_2_6_ _ _ _ _ _ _ _ _|_a_t_t_e_m_p_t_ _t_o_ _s_i_m_p_l_i_f_y_ _t_h_i_s_ _i_m_p_l_e_m_e_n_t_a_t_i_o_n_ _b_y_ _e_m_b_r_a_c_i_n_g_ _t_h_e_ _s_p_a_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** aatttteemmpptt ttoo ssiimmpplliiffyy tthhiiss iimmpplleemmeennttaattiioonn bbyy eemmbbrraacciinngg tthhee ssppaann **********                                                                                                      |
│ │ │ │ │ -|****** ....//ssrrcc//bbddeeccooddee..ccpppp::882266 ******                                                                                                                                                 |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	bdecode_node bdecode(span<char const> buffer                                                                                                                                  |
│ │ │ │ │ -|		, error_code& ec, int* error_pos, int depth_limit, int token_limit)                                                                                                          |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		bdecode_node ret;                                                                                                                                                            |
│ │ │ │ │ -|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (buffer.size() > bdecode_token::max_offset)                                                                                                                               |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (error_pos) *error_pos = 0;                                                                                                                                              |
│ │ │ │ │ -|			ec = bdecode_errors::limit_exceeded;                                                                                                                                        |
│ │ │ │ │ -|			return ret;                                                                                                                                                                 |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// this is the stack of bdecode_token indices, into m_tokens.                                                                                                                |
│ │ │ │ │ -|		// sp is the stack pointer, as index into the array, stack                                                                                                                   |
│ │ │ │ │ -|		int sp = 0;                                                                                                                                                                  |
│ │ │ │ │ -|		TORRENT_ALLOCA(stack, stack_frame, depth_limit);                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|char const* start = buffer.data();                                                                                                                                             |
│ │ │ │ │ -|char const* end = start + buffer.size();                                                                                                                                       |
│ │ │ │ │ -|		char const* const orig_start = start;                                                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (start == end)                                                                                                                                                            |
│ │ │ │ │ -|			TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		while (start <= end)                                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (start >= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			if (sp >= depth_limit)                                                                                                                                                      |
│ │ │ │ │ -|				TORRENT_FAIL_BDECODE(bdecode_errors::depth_exceeded);                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			--token_limit;                                                                                                                                                              |
│ │ │ │ │ -|			if (token_limit < 0)                                                                                                                                                        |
│ │ │ │ │ -|				TORRENT_FAIL_BDECODE(bdecode_errors::limit_exceeded);                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// look for a new token                                                                                                                                                     |
│ │ │ │ │ -|			char const t = *start;                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			int const current_frame = sp;                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// if we're currently parsing a dictionary, assert that                                                                                                                     |
│ │ │ │ │ -|			// every other node is a string.                                                                                                                                            |
│ │ │ │ │ -|			if (current_frame > 0                                                                                                                                                       |
│ │ │ │ │ -|				&& ret.m_tokens[stack[current_frame - 1].token].type == bdecode_token::dict)                                                                                               |
│ │ │ │ │ +|           |                              |technically, this is where the transaction of moving the files is completed. This is where the new save_path should be committed. If|
│ │ │ │ │ +|relevance 2|_._._/_s_r_c_/_s_t_o_r_a_g_e___u_t_i_l_s_._c_p_p_:_2_9_4  |there is an error in the code below, that should not prevent the new save path to be set. Maybe it would make sense to make the     |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_s_a_v_e___p_a_t_h_ _a_n_ _i_n_-_o_u_t_ _p_a_r_a_m_e_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteecchhnniiccaallllyy,, tthhiiss iiss wwhheerree tthhee ttrraannssaaccttiioonn ooff mmoovviinngg tthhee ffiilleess iiss ccoommpplleetteedd.. TThhiiss iiss wwhheerree tthhee nneeww ssaavvee__ppaatthh sshhoouulldd bbee ccoommmmiitttteedd.. IIff tthheerree iiss aann eerrrroorr iinn tthhee ccooddee bbeellooww,,|
│ │ │ │ │ +|tthhaatt sshhoouulldd nnoott pprreevveenntt tthhee nneeww ssaavvee ppaatthh ttoo bbee sseett.. MMaayybbee iitt wwoouulldd mmaakkee sseennssee ttoo mmaakkee tthhee ssaavvee__ppaatthh aann iinn--oouutt ppaarraammeetteerr **********                                                 |
│ │ │ │ │ +|****** ....//ssrrcc//ssttoorraaggee__uuttiillss..ccpppp::229944 ******                                                                                                                                           |
│ │ │ │ │ +|while (--file_index >= file_index_t(0))                                                                                                                                        |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				if (stack[current_frame - 1].state == 0)                                                                                                                                   |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|_	_	_	_	_	_/_/_ _t_h_e_ _c_u_r_r_e_n_t_ _p_a_r_e_n_t_ _i_s_ _a_ _d_i_c_t_ _a_n_d_ _w_e_ _a_r_e_ _p_a_r_s_i_n_g_ _a_ _k_e_y_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 2|_._._/_s_r_c_/                       |just make this peer not have the pieces associated with the file we just requested. Only when it doesn't have any of the file do the|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_w_e_b___p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:_6_2_6_ _ _ _|_f_o_l_l_o_w_i_n_g_ _p_a_d_ _f_i_l_e_s_ _w_i_l_l_ _m_a_k_e_ _i_t_ _c_o_m_p_l_i_c_a_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** jjuusstt mmaakkee tthhiiss ppeeeerr nnoott hhaavvee tthhee ppiieecceess aassssoocciiaatteedd wwiitthh tthhee ffiillee wwee jjuusstt rreeqquueesstteedd.. OOnnllyy wwhheenn iitt ddooeessnn''tt hhaavvee aannyy ooff tthhee ffiillee ddoo tthhee ffoolllloowwiinngg ppaadd ffiilleess wwiillll mmaakkee iitt    |
│ │ │ │ │ -|ccoommpplliiccaatteedd **********                                                                                                                                                              |
│ │ │ │ │ -|****** ....//ssrrcc//wweebb__ppeeeerr__ccoonnnneeccttiioonn..ccpppp::662266 ******                                                                                                                                     |
│ │ │ │ │ -|	peer_connection::received_invalid_data(index, single_peer);                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// if we don't think we have any of the files, allow banning the web seed                                                                                                     |
│ │ │ │ │ -|	if (num_have_pieces() == 0) return true;                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// don't disconnect, we won't request anything from this file again                                                                                                           |
│ │ │ │ │ -|	return false;                                                                                                                                                                 |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void web_peer_connection::on_receive_padfile()                                                                                                                                 |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	handle_padfile();                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void web_peer_connection::handle_error(int const bytes_left)                                                                                                                   |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	std::shared_ptr<torrent> t = associated_torrent().lock();                                                                                                                     |
│ │ │ │ │ -|	TORRENT_ASSERT(t);                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|// temporarily unavailable, retry later                                                                                                                                        |
│ │ │ │ │ -|	t->retry_web_seed(this, m_parser.header_duration("retry-after"));                                                                                                             |
│ │ │ │ │ -|	if (t->alerts().should_post<url_seed_alert>())                                                                                                                                |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::string const error_msg = to_string(m_parser.status_code()).data()                                                                                                       |
│ │ │ │ │ -|			+ (" " + m_parser.message());                                                                                                                                               |
│ │ │ │ │ -|		t->alerts().emplace_alert<url_seed_alert>(t->get_handle(), m_url                                                                                                             |
│ │ │ │ │ -|			, error_msg);                                                                                                                                                               |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|	received_bytes(0, bytes_left);                                                                                                                                                |
│ │ │ │ │ -|	disconnect(error_code(m_parser.status_code(), http_category()), operation_t::bittorrent, failure);                                                                            |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void web_peer_connection::disable(error_code const& ec)                                                                                                                        |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	// we should not try this server again.                                                                                                                                       |
│ │ │ │ │ -|	m_web->disabled = true;                                                                                                                                                       |
│ │ │ │ │ -|	disconnect(ec, operation_t::bittorrent, peer_error);                                                                                                                          |
│ │ │ │ │ -|	if (m_web->ephemeral)                                                                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::shared_ptr<torrent> t = associated_torrent().lock();                                                                                                                    |
│ │ │ │ │ -|		TORRENT_ASSERT(t);                                                                                                                                                           |
│ │ │ │ │ -|		t->remove_web_seed_conn(this);                                                                                                                                               |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|	m_web = nullptr;                                                                                                                                                              |
│ │ │ │ │ -|	TORRENT_ASSERT(is_disconnecting());                                                                                                                                           |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void web_peer_connection::handle_redirect(int const bytes_left)                                                                                                                |
│ │ │ │ │ -|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_9_9_ _ _ _|_i_s_ _t_h_e_r_e_ _a_ _r_e_a_s_o_n_ _n_o_t_ _t_o_ _m_o_v_e_ _a_l_l_ _o_f_ _t_h_i_s_ _i_n_t_o_ _i_n_i_t_(_)_?_ _a_n_d_ _j_u_s_t_ _p_o_s_t_ _i_t_ _t_o_ _t_h_e_ _i_o___c_o_n_t_e_x_t_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iiss tthheerree aa rreeaassoonn nnoott ttoo mmoovvee aallll ooff tthhiiss iinnttoo iinniitt(())?? aanndd jjuusstt ppoosstt iitt ttoo tthhee iioo__ccoonntteexxtt?? **********                                                                         |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::559999 ******                                                                                                                                            |
│ │ │ │ │ -|try                                                                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		(this->*f)(std::forward<Args>(a)...);                                                                                                                                        |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ -|	catch (system_error const& e) {                                                                                                                                               |
│ │ │ │ │ -|		alerts().emplace_alert<session_error_alert>(e.code(), e.what());                                                                                                             |
│ │ │ │ │ -|		pause();                                                                                                                                                                     |
│ │ │ │ │ -|	} catch (std::exception const& e) {                                                                                                                                           |
│ │ │ │ │ -|		alerts().emplace_alert<session_error_alert>(error_code(), e.what());                                                                                                         |
│ │ │ │ │ -|		pause();                                                                                                                                                                     |
│ │ │ │ │ -|	} catch (...) {                                                                                                                                                               |
│ │ │ │ │ -|		alerts().emplace_alert<session_error_alert>(error_code(), "unknown error");                                                                                                  |
│ │ │ │ │ -|		pause();                                                                                                                                                                     |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// This function is called by the creating thread, not in the message loop's                                                                                                  |
│ │ │ │ │ -|	// io_context thread.                                                                                                                                                         |
│ │ │ │ │ -|void session_impl::start_session()                                                                                                                                             |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		session_log("start session");                                                                                                                                                |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ -|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ -|		m_ssl_ctx.set_default_verify_paths(ec);                                                                                                                                      |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (ec) session_log("SSL set_default verify_paths failed: %s", ec.message().c_str());                                                                                        |
│ │ │ │ │ -|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|_#_i_f_ _d_e_f_i_n_e_d_ _T_O_R_R_E_N_T___W_I_N_D_O_W_S_ _&_&_ _d_e_f_i_n_e_d_ _T_O_R_R_E_N_T___U_S_E___O_P_E_N_S_S_L_ _&_&_ _!_d_e_f_i_n_e_d_ _T_O_R_R_E_N_T___W_I_N_R_T_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_7_6_1_ _ _ _|_t_h_e_ _i_p_ _f_i_l_t_e_r_ _s_h_o_u_l_d_ _p_r_o_b_a_b_l_y_ _b_e_ _s_a_v_e_d_ _h_e_r_e_ _t_o_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhee iipp ffiilltteerr sshhoouulldd pprroobbaabbllyy bbee ssaavveedd hheerree ttoooo **********                                                                                                                    |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::776611 ******                                                                                                                                            |
│ │ │ │ │ -|m_lsd_announce_timer.async_wait([this](error_code const& e) {                                                                                                                  |
│ │ │ │ │ -|			wrap(&session_impl::on_lsd_announce, e); } );                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		session_log(" done starting session");                                                                                                                                       |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// this applies unchoke settings from m_settings                                                                                                                             |
│ │ │ │ │ -|		recalculate_unchoke_slots();                                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// apply all m_settings to this session                                                                                                                                      |
│ │ │ │ │ -|		run_all_updates(*this);                                                                                                                                                      |
│ │ │ │ │ -|		reopen_listen_sockets(false);                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_INVARIANT_CHECKS                                                                                                                                               |
│ │ │ │ │ -|		check_invariant();                                                                                                                                                           |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION <= 2                                                                                                                                                   |
│ │ │ │ │ -|void session_impl::save_state(entry* eptr, save_state_flags_t const flags) const                                                                                               |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		entry& e = *eptr;                                                                                                                                                            |
│ │ │ │ │ -|		// make it a dict                                                                                                                                                            |
│ │ │ │ │ -|		e.dict();                                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (flags & session::save_settings)                                                                                                                                          |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			entry::dictionary_type& sett = e["settings"].dict();                                                                                                                        |
│ │ │ │ │ -|			save_settings_to_dict(non_default_settings(m_settings), sett);                                                                                                              |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|		if (flags & session::save_dht_settings)                                                                                                                                      |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			e["dht"] = dht::save_dht_settings(get_dht_settings());                                                                                                                      |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|				// files moved out to absolute paths are not moved                                                                                                                         |
│ │ │ │ │ +|				if (f.file_absolute_path(file_index)) continue;                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_dht && (flags & session::save_dht_state))                                                                                                                              |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			e["dht state"] = dht::save_dht_state(m_dht->state());                                                                                                                       |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|				// if we ended up copying the file, don't do anything during                                                                                                               |
│ │ │ │ │ +|				// roll-back                                                                                                                                                               |
│ │ │ │ │ +|				if (copied_files[file_index]) continue;                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_EXTENSIONS                                                                                                                                             |
│ │ │ │ │ -|		for (auto const& ext : m_ses_extensions[plugins_all_idx])                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			ext->save_state(*eptr);                                                                                                                                                     |
│ │ │ │ │ -|_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 2|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_3_8_8_2  |make a list for torrents that want to be announced on the DHT so we don't have to loop over all torrents, just to find the ones that|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_w_a_n_t_ _t_o_ _a_n_n_o_u_n_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmaakkee aa lliisstt ffoorr ttoorrrreennttss tthhaatt wwaanntt ttoo bbee aannnnoouunncceedd oonn tthhee DDHHTT ssoo wwee ddoonn''tt hhaavvee ttoo lloooopp oovveerr aallll ttoorrrreennttss,, jjuusstt ttoo ffiinndd tthhee oonneess tthhaatt wwaanntt ttoo aannnnoouunnccee **********              |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::33888822 ******                                                                                                                                           |
│ │ │ │ │ -|if (!m_dht_torrents.empty())                                                                                                                                                   |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			std::shared_ptr<torrent> t;                                                                                                                                                 |
│ │ │ │ │ -|			do                                                                                                                                                                          |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				t = m_dht_torrents.front().lock();                                                                                                                                         |
│ │ │ │ │ -|				m_dht_torrents.pop_front();                                                                                                                                                |
│ │ │ │ │ -|			} while (!t && !m_dht_torrents.empty());                                                                                                                                    |
│ │ │ │ │ +|				std::string const old_path = combine_path(save_path, f.file_path(file_index));                                                                                             |
│ │ │ │ │ +|				std::string const new_path = combine_path(new_save_path, f.file_path(file_index));                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (t)                                                                                                                                                                      |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				t->dht_announce();                                                                                                                                                         |
│ │ │ │ │ -|				return;                                                                                                                                                                    |
│ │ │ │ │ +|				// ignore errors when rolling back                                                                                                                                         |
│ │ │ │ │ +|				storage_error ignore;                                                                                                                                                      |
│ │ │ │ │ +|				move_file(new_path, old_path, ignore);                                                                                                                                     |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		if (m_torrents.empty()) return;                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_next_dht_torrent >= m_torrents.size())                                                                                                                                 |
│ │ │ │ │ -|			m_next_dht_torrent = 0;                                                                                                                                                     |
│ │ │ │ │ -|		m_torrents[m_next_dht_torrent]->dht_announce();                                                                                                                              |
│ │ │ │ │ -|++m_next_dht_torrent;                                                                                                                                                          |
│ │ │ │ │ -|if (m_next_dht_torrent >= m_torrents.size())                                                                                                                                   |
│ │ │ │ │ -|			m_next_dht_torrent = 0;                                                                                                                                                     |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void session_impl::on_lsd_announce(error_code const& e)                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		COMPLETE_ASYNC("session_impl::on_lsd_announce");                                                                                                                             |
│ │ │ │ │ -|		m_stats_counters.inc_stats_counter(counters::on_lsd_counter);                                                                                                                |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|		if (e) return;                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_abort) return;                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		ADD_OUTSTANDING_ASYNC("session_impl::on_lsd_announce");                                                                                                                      |
│ │ │ │ │ -|		// announce on local network every 5 minutes                                                                                                                                 |
│ │ │ │ │ -|		int const delay = std::max(m_settings.get_int(settings_pack::local_service_announce_interval)                                                                                |
│ │ │ │ │ -|			/ std::max(int(m_torrents.size()), 1), 1);                                                                                                                                  |
│ │ │ │ │ -|		m_lsd_announce_timer.expires_after(seconds(delay));                                                                                                                          |
│ │ │ │ │ -|		m_lsd_announce_timer.async_wait([this](error_code const& err) {                                                                                                              |
│ │ │ │ │ -|			wrap(&session_impl::on_lsd_announce, err); });                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_torrents.empty()) return;                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_next_lsd_torrent >= m_torrents.size())                                                                                                                                 |
│ │ │ │ │ -|			m_next_lsd_torrent = 0;                                                                                                                                                     |
│ │ │ │ │ -|		m_torrents[m_next_lsd_torrent]->lsd_announce();                                                                                                                              |
│ │ │ │ │ -|		++m_next_lsd_torrent;                                                                                                                                                        |
│ │ │ │ │ -|		if (m_next_lsd_torrent >= m_torrents.size())                                                                                                                                 |
│ │ │ │ │ -|_	_	_	_m___n_e_x_t___l_s_d___t_o_r_r_e_n_t_ _=_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_5_1_5_ _ _|_t_h_i_s_ _f_u_n_c_t_i_o_n_ _s_h_o_u_l_d_ _b_e_ _r_e_m_o_v_e_d_ _a_n_d_ _u_s_e_r_s_ _n_e_e_d_ _t_o_ _d_e_a_l_ _w_i_t_h_ _t_h_e_ _m_o_r_e_ _g_e_n_e_r_i_c_ _c_a_s_e_ _o_f_ _h_a_v_i_n_g_ _m_u_l_t_i_p_l_e_ _l_i_s_t_e_n_ _p_o_r_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ffuunnccttiioonn sshhoouulldd bbee rreemmoovveedd aanndd uusseerrss nneeeedd ttoo ddeeaall wwiitthh tthhee mmoorree ggeenneerriicc ccaassee ooff hhaavviinngg mmuullttiippllee lliisstteenn ppoorrttss **********                                                  |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::55551155 ******                                                                                                                                           |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (!node_list.empty() && nodes.empty())                                                                                                                                     |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			session_log("ERROR: failed to parse DHT bootstrap list: %s", node_list.c_str());                                                                                            |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		for (auto const& n : nodes)                                                                                                                                                  |
│ │ │ │ │ -|			add_dht_router(n);                                                                                                                                                          |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_impl::update_count_slow()                                                                                                                                        |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ -|		for (auto const& tp : m_torrents)                                                                                                                                            |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			tp->on_inactivity_tick(ec);                                                                                                                                                 |
│ │ │ │ │ +|			return { status_t::fatal_disk_error, save_path };                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|std::uint16_t session_impl::listen_port() const                                                                                                                                |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		return listen_port(nullptr);                                                                                                                                                 |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::uint16_t session_impl::listen_port(listen_socket_t* sock) const                                                                                                          |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (m_listen_sockets.empty()) return 0;                                                                                                                                      |
│ │ │ │ │ -|		if (sock)                                                                                                                                                                    |
│ │ │ │ │ +|std::set<std::string> subdirs;                                                                                                                                                 |
│ │ │ │ │ +|		for (auto const i : f.file_range())                                                                                                                                          |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// if we're using a proxy, we won't be able to accept any TCP                                                                                                               |
│ │ │ │ │ -|			// connections. Not even uTP connections via the port we know about.                                                                                                        |
│ │ │ │ │ -|			// The DHT may use the implied port to make it work, but the port we                                                                                                        |
│ │ │ │ │ -|			// announce here has no relevance for that.                                                                                                                                 |
│ │ │ │ │ -|			if (sock->flags & listen_socket_t::proxy)                                                                                                                                   |
│ │ │ │ │ -|				return 0;                                                                                                                                                                  |
│ │ │ │ │ +|			// files moved out to absolute paths are not moved                                                                                                                          |
│ │ │ │ │ +|			if (f.file_absolute_path(i)) continue;                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (!(sock->flags & listen_socket_t::accept_incoming))                                                                                                                      |
│ │ │ │ │ -|				return 0;                                                                                                                                                                  |
│ │ │ │ │ +|			if (has_parent_path(f.file_path(i)))                                                                                                                                        |
│ │ │ │ │ +|				subdirs.insert(parent_path(f.file_path(i)));                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			return std::uint16_t(sock->tcp_external_port());                                                                                                                            |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|			// if we ended up renaming the file instead of moving it, there's no                                                                                                        |
│ │ │ │ │ +|			// need to delete the source.                                                                                                                                               |
│ │ │ │ │ +|			if (copied_files[i] == false) continue;                                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ -|		for (auto const& s : m_listen_sockets)                                                                                                                                       |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (!(s->flags & listen_socket_t::accept_incoming)) continue;                                                                                                               |
│ │ │ │ │ -|			if (s->ssl == transport::plaintext)                                                                                                                                         |
│ │ │ │ │ -|				return std::uint16_t(s->tcp_external_port());                                                                                                                              |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|_	_	_r_e_t_u_r_n_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_5_5_5_ _ _|_t_h_i_s_ _f_u_n_c_t_i_o_n_ _s_h_o_u_l_d_ _b_e_ _r_e_m_o_v_e_d_ _a_n_d_ _u_s_e_r_s_ _n_e_e_d_ _t_o_ _d_e_a_l_ _w_i_t_h_ _t_h_e_ _m_o_r_e_ _g_e_n_e_r_i_c_ _c_a_s_e_ _o_f_ _h_a_v_i_n_g_ _m_u_l_t_i_p_l_e_ _s_s_l_ _p_o_r_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ffuunnccttiioonn sshhoouulldd bbee rreemmoovveedd aanndd uusseerrss nneeeedd ttoo ddeeaall wwiitthh tthhee mmoorree ggeenneerriicc ccaassee ooff hhaavviinngg mmuullttiippllee ssssll ppoorrttss **********                                                     |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::55555555 ******                                                                                                                                           |
│ │ │ │ │ -|return 0;                                                                                                                                                                      |
│ │ │ │ │ +|			std::string const old_path = combine_path(save_path, f.file_path(i));                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			return std::uint16_t(sock->tcp_external_port());                                                                                                                            |
│ │ │ │ │ +|			// we may still have some files in old save_path                                                                                                                            |
│ │ │ │ │ +|			// eg. if (flags == dont_replace && exists(new_path))                                                                                                                       |
│ │ │ │ │ +|			// ignore errors when removing                                                                                                                                              |
│ │ │ │ │ +|			error_code ignore;                                                                                                                                                          |
│ │ │ │ │ +|			remove(old_path, ignore);                                                                                                                                                   |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ -|		for (auto const& s : m_listen_sockets)                                                                                                                                       |
│ │ │ │ │ +|		for (std::string const& s : subdirs)                                                                                                                                         |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (!(s->flags & listen_socket_t::accept_incoming)) continue;                                                                                                               |
│ │ │ │ │ -|			if (s->ssl == transport::plaintext)                                                                                                                                         |
│ │ │ │ │ -|				return std::uint16_t(s->tcp_external_port());                                                                                                                              |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		return 0;                                                                                                                                                                    |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		sock = m_listen_sockets.front().get();                                                                                                                                       |
│ │ │ │ │ -|		if (!(sock->flags & listen_socket_t::accept_incoming)) return 0;                                                                                                             |
│ │ │ │ │ -|		return std::uint16_t(sock->tcp_external_port());                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|			error_code err;                                                                                                                                                             |
│ │ │ │ │ +|			std::string subdir = combine_path(save_path, s);                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|std::uint16_t session_impl::ssl_listen_port() const                                                                                                                            |
│ │ │ │ │ +|			while (!path_equal(subdir, save_path) && !err)                                                                                                                              |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|_	_	_	_	_r_e_m_o_v_e_(_s_u_b_d_i_r_,_ _e_r_r_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 2|_._._/_s_r_c_/_s_t_o_r_a_g_e___u_t_i_l_s_._c_p_p_:_4_8_6  |is this risky? The upper layer will assume we have the whole file. Perhaps we should verify that at least the size of the file is   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_c_o_r_r_e_c_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iiss tthhiiss rriisskkyy?? TThhee uuppppeerr llaayyeerr wwiillll aassssuummee wwee hhaavvee tthhee wwhhoollee ffiillee.. PPeerrhhaappss wwee sshhoouulldd vveerriiffyy tthhaatt aatt lleeaasstt tthhee ssiizzee ooff tthhee ffiillee iiss ccoorrrreecctt **********                          |
│ │ │ │ │ +|****** ....//ssrrcc//ssttoorraaggee__uuttiillss..ccpppp::448866 ******                                                                                                                                           |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|		return ssl_listen_port(nullptr);                                                                                                                                             |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	std::uint16_t session_impl::ssl_listen_port(listen_socket_t* sock) const                                                                                                      |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ -|		if (sock)                                                                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (!(sock->flags & listen_socket_t::accept_incoming)) return 0;                                                                                                            |
│ │ │ │ │ -|			return std::uint16_t(sock->tcp_external_port());                                                                                                                            |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_settings.get_int(settings_pack::proxy_type) != settings_pack::none                                                                                                     |
│ │ │ │ │ -|			&& m_settings.get_bool(settings_pack::proxy_peer_connections))                                                                                                              |
│ │ │ │ │ -|			return 0;                                                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		for (auto const& s : m_listen_sockets)                                                                                                                                       |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (!(s->flags & listen_socket_t::accept_incoming)) continue;                                                                                                               |
│ │ │ │ │ -|			if (s->ssl == transport::ssl)                                                                                                                                               |
│ │ │ │ │ -|				return std::uint16_t(s->tcp_external_port());                                                                                                                              |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		TORRENT_UNUSED(sock);                                                                                                                                                        |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		return 0;                                                                                                                                                                    |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_	_i_n_t_ _s_e_s_s_i_o_n___i_m_p_l_:_:_g_e_t___l_i_s_t_e_n___p_o_r_t_(_t_r_a_n_s_p_o_r_t_ _c_o_n_s_t_ _s_s_l_,_ _a_u_x_:_:_l_i_s_t_e_n___s_o_c_k_e_t___h_a_n_d_l_e_ _c_o_n_s_t_&_ _s_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_6_3_9_0_ _ _|_t_h_i_s_ _s_h_o_u_l_d_ _b_e_ _f_a_c_t_o_r_e_d_ _i_n_t_o_ _t_h_e_ _u_d_p_ _s_o_c_k_e_t_,_ _s_o_ _w_e_ _o_n_l_y_ _h_a_v_e_ _t_h_e_ _c_o_d_e_ _o_n_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss sshhoouulldd bbee ffaaccttoorreedd iinnttoo tthhee uuddpp ssoocckkeett,, ssoo wwee oonnllyy hhaavvee tthhee ccooddee oonnccee **********                                                                                         |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::66339900 ******                                                                                                                                           |
│ │ │ │ │ -|return upload_rate_limit(m_local_peer_class);                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	int session_impl::local_download_rate_limit() const                                                                                                                           |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		return download_rate_limit(m_local_peer_class);                                                                                                                              |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|					// we create directories lazily, so it's possible it hasn't                                                                                                               |
│ │ │ │ │ +|					// been created yet. Create the directories now and try                                                                                                                   |
│ │ │ │ │ +|					// again                                                                                                                                                                  |
│ │ │ │ │ +|					create_directories(parent_path(file_path), err);                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	int session_impl::upload_rate_limit_depr() const                                                                                                                              |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		return upload_rate_limit(m_global_class);                                                                                                                                    |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|					if (err)                                                                                                                                                                  |
│ │ │ │ │ +|					{                                                                                                                                                                         |
│ │ │ │ │ +|						ec.file(idx);                                                                                                                                                            |
│ │ │ │ │ +|						ec.operation = operation_t::mkdir;                                                                                                                                       |
│ │ │ │ │ +|						return false;                                                                                                                                                            |
│ │ │ │ │ +|					}                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	int session_impl::download_rate_limit_depr() const                                                                                                                            |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		return download_rate_limit(m_global_class);                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif // DEPRECATE                                                                                                                                                            |
│ │ │ │ │ +|					hard_link(s, file_path, err);                                                                                                                                             |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ +|				// if the file already exists, that's not an error                                                                                                                         |
│ │ │ │ │ +|				if (err == boost::system::errc::file_exists)                                                                                                                               |
│ │ │ │ │ +|					continue;                                                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|void session_impl::update_peer_dscp()                                                                                                                                          |
│ │ │ │ │ +|if (err)                                                                                                                                                                       |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|		int const value = m_settings.get_int(settings_pack::peer_dscp);                                                                                                              |
│ │ │ │ │ -|		for (auto const& l : m_listen_sockets)                                                                                                                                       |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (l->sock)                                                                                                                                                                |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				error_code ec;                                                                                                                                                             |
│ │ │ │ │ -|				set_traffic_class(*l->sock, value, ec);                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|				if (should_log())                                                                                                                                                          |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					session_log(">>> SET_DSCP [ tcp (%s %d) value: %x e: %s ]"                                                                                                                |
│ │ │ │ │ -|						, l->sock->local_endpoint().address().to_string().c_str()                                                                                                                |
│ │ │ │ │ -|						, l->sock->local_endpoint().port(), value, ec.message().c_str());                                                                                                        |
│ │ │ │ │ +|					ec.ec = err;                                                                                                                                                              |
│ │ │ │ │ +|					ec.file(idx);                                                                                                                                                             |
│ │ │ │ │ +|					ec.operation = operation_t::file_hard_link;                                                                                                                               |
│ │ │ │ │ +|					return false;                                                                                                                                                             |
│ │ │ │ │  |				}                                                                                                                                                                          |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|				added_files = true;                                                                                                                                                        |
│ │ │ │ │ +|				stat.set_dirty(idx);                                                                                                                                                       |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			if (l->udp_sock)                                                                                                                                                            |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				error_code ec;                                                                                                                                                             |
│ │ │ │ │ -|				set_traffic_class(l->udp_sock->sock, value, ec);                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|				if (should_log())                                                                                                                                                          |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					session_log(">>> SET_DSCP [ udp (%s %d) value: %x e: %s ]"                                                                                                                |
│ │ │ │ │ -|						, l->udp_sock->sock.local_endpoint().address().to_string().c_str()                                                                                                       |
│ │ │ │ │ -|_	_	_	_	_	_	_,_ _l_-_>_u_d_p___s_o_c_k_-_>_s_o_c_k_._l_o_c_a_l___p_o_r_t_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 2|_._._/_s_r_c_/                       |support authentication here. tracker_req().auth                                                                                     |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_u_d_p___t_r_a_c_k_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:_8_1_ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ssuuppppoorrtt aauutthheennttiiccaattiioonn hheerree.. ttrraacckkeerr__rreeqq(())..aauutthh **********                                                                                                                    |
│ │ │ │ │ -|****** ....//ssrrcc//uuddpp__ttrraacckkeerr__ccoonnnneeccttiioonn..ccpppp::8811 ******                                                                                                                                   |
│ │ │ │ │ -|udp_tracker_connection::m_connection_cache;                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	std::mutex udp_tracker_connection::m_cache_mutex;                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	udp_tracker_connection::udp_tracker_connection(                                                                                                                               |
│ │ │ │ │ -|		io_context& ios                                                                                                                                                              |
│ │ │ │ │ -|		, tracker_manager& man                                                                                                                                                       |
│ │ │ │ │ -|		, tracker_request const& req                                                                                                                                                 |
│ │ │ │ │ -|		, std::weak_ptr<request_callback> c)                                                                                                                                         |
│ │ │ │ │ -|		: tracker_connection(man, req, ios, std::move(c))                                                                                                                            |
│ │ │ │ │ -|		, m_transaction_id(0)                                                                                                                                                        |
│ │ │ │ │ -|		, m_attempts(0)                                                                                                                                                              |
│ │ │ │ │ -|		, m_state(action_t::error)                                                                                                                                                   |
│ │ │ │ │ -|		, m_abort(false)                                                                                                                                                             |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		update_transaction_id();                                                                                                                                                     |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void udp_tracker_connection::start()                                                                                                                                          |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|std::string hostname;                                                                                                                                                          |
│ │ │ │ │ -|std::string protocol;                                                                                                                                                          |
│ │ │ │ │ -|		int port;                                                                                                                                                                    |
│ │ │ │ │ -|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		std::tie(protocol, std::ignore, hostname, port, std::ignore)                                                                                                                 |
│ │ │ │ │ -|			= parse_url_components(tracker_req().url, ec);                                                                                                                              |
│ │ │ │ │ -|		if (port == -1) port = protocol == "http" ? 80 : 443;                                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (ec)                                                                                                                                                                      |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			tracker_connection::fail(ec, operation_t::parse_address);                                                                                                                   |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ +|#endif // TORRENT_DISABLE_MUTABLE_TORRENTS                                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		aux::session_settings const& settings = m_man.settings();                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		int const proxy_type = settings.get_int(settings_pack::proxy_type);                                                                                                          |
│ │ │ │ │ +|		bool const seed = (rd.have_pieces.size() >= fs.num_pieces()                                                                                                                  |
│ │ │ │ │ +|			&& rd.have_pieces.all_set())                                                                                                                                                |
│ │ │ │ │ +|			|| (rd.flags & torrent_flags::seed_mode);                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (settings.get_bool(settings_pack::proxy_hostnames)                                                                                                                        |
│ │ │ │ │ -|			&& (proxy_type == settings_pack::socks5                                                                                                                                     |
│ │ │ │ │ -|				|| proxy_type == settings_pack::socks5_pw))                                                                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_hostname = hostname;                                                                                                                                                      |
│ │ │ │ │ -|			m_target.port(std::uint16_t(port));                                                                                                                                         |
│ │ │ │ │ -|			start_announce();                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ +|		if (seed)                                                                                                                                                                    |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			using namespace std::placeholders;                                                                                                                                          |
│ │ │ │ │ -|_	_	_	_A_D_D___O_U_T_S_T_A_N_D_I_N_G___A_S_Y_N_C_(_"_u_d_p___t_r_a_c_k_e_r___c_o_n_n_e_c_t_i_o_n_:_:_n_a_m_e___l_o_o_k_u_p_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_a_l_e_r_t___m_a_n_a_g_e_r_._c_p_p_:_8_0_ _ _ _|_k_e_e_p_ _a_ _c_o_u_n_t_ _o_f_ _t_h_e_ _n_u_m_b_e_r_ _o_f_ _t_h_r_e_a_d_s_ _w_a_i_t_i_n_g_._ _O_n_l_y_ _i_f_ _i_t_'_s_ _>_ _0_ _n_o_t_i_f_y_ _t_h_e_m_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** kkeeeepp aa ccoouunntt ooff tthhee nnuummbbeerr ooff tthhrreeaaddss wwaaiittiinngg.. OOnnllyy iiff iitt''ss >> 00 nnoottiiffyy tthheemm **********                                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//aalleerrtt__mmaannaaggeerr..ccpppp::8800 ******                                                                                                                                            |
│ │ │ │ │ -|return m_alerts[m_generation].front();                                                                                                                                         |
│ │ │ │ │ +|			for (file_index_t const file_index : fs.file_range())                                                                                                                       |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				if (fs.pad_file_at(file_index)) continue;                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// this call can be interrupted prematurely by other signals                                                                                                                 |
│ │ │ │ │ -|		m_condition.wait_for(lock, max_wait);                                                                                                                                        |
│ │ │ │ │ -|		if (!m_alerts[m_generation].empty())                                                                                                                                         |
│ │ │ │ │ -|			return m_alerts[m_generation].front();                                                                                                                                      |
│ │ │ │ │ +|				// files with priority zero may not have been saved to disk at their                                                                                                       |
│ │ │ │ │ +|				// expected location, but is likely to be in a partfile. Just exempt it                                                                                                    |
│ │ │ │ │ +|				// from checking                                                                                                                                                           |
│ │ │ │ │ +|				if (file_index < file_priority.end_index()                                                                                                                                 |
│ │ │ │ │ +|					&& file_priority[file_index] == dont_download                                                                                                                             |
│ │ │ │ │ +|					&& !(rd.flags & torrent_flags::seed_mode))                                                                                                                                |
│ │ │ │ │ +|_	_	_	_	_	_c_o_n_t_i_n_u_e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_2_0_2_1_ _ _ _ _ _ _ _ _ _|_t_h_e_ _s_a_l_t_ _h_e_r_e_ _i_s_ _a_l_l_o_c_a_t_e_d_ _o_n_ _t_h_e_ _h_e_a_p_._ _I_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _a_l_l_o_c_a_t_e_ _i_n_ _t_h_e_ _s_t_a_c_k___a_l_l_o_c_a_t_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhee ssaalltt hheerree iiss aallllooccaatteedd oonn tthhee hheeaapp.. IItt wwoouulldd bbee nniiccee ttoo aallllooccaattee iinn tthhee ssttaacckk__aallllooccaattoorr **********                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//aalleerrtt..ccpppp::22002211 ******                                                                                                                                                  |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		return nullptr;                                                                                                                                                              |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|	dht_immutable_item_alert::dht_immutable_item_alert(aux::stack_allocator&                                                                                                      |
│ │ │ │ │ +|		, sha1_hash const& t, entry i)                                                                                                                                               |
│ │ │ │ │ +|		: target(t), item(std::move(i))                                                                                                                                              |
│ │ │ │ │ +|	{}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void alert_manager::maybe_notify(alert* a)                                                                                                                                    |
│ │ │ │ │ +|	std::string dht_immutable_item_alert::message() const                                                                                                                         |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (m_alerts[m_generation].size() == 1)                                                                                                                                      |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// we just posted to an empty queue. If anyone is waiting for                                                                                                               |
│ │ │ │ │ -|			// alerts, we need to notify them. Also (potentially) call the                                                                                                              |
│ │ │ │ │ -|			// user supplied m_notify callback to let the client wake up its                                                                                                            |
│ │ │ │ │ -|			// message loop to poll for alerts.                                                                                                                                         |
│ │ │ │ │ -|			if (m_notify) m_notify();                                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|m_condition.notify_all();                                                                                                                                                      |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_EXTENSIONS                                                                                                                                             |
│ │ │ │ │ -|		for (auto& e : m_ses_extensions)                                                                                                                                             |
│ │ │ │ │ -|			e->on_alert(a);                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │  |#else                                                                                                                                                                          |
│ │ │ │ │ -|		TORRENT_UNUSED(a);                                                                                                                                                           |
│ │ │ │ │ +|		char msg[1050];                                                                                                                                                              |
│ │ │ │ │ +|		std::snprintf(msg, sizeof(msg), "DHT immutable item %s [ %s ]"                                                                                                               |
│ │ │ │ │ +|			, aux::to_hex(target).c_str()                                                                                                                                               |
│ │ │ │ │ +|			, item.to_string().c_str());                                                                                                                                                |
│ │ │ │ │ +|		return msg;                                                                                                                                                                  |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void alert_manager::set_notify_function(std::function<void()> const& fun)                                                                                                     |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::unique_lock<std::recursive_mutex> lock(m_mutex);                                                                                                                        |
│ │ │ │ │ -|		m_notify = fun;                                                                                                                                                              |
│ │ │ │ │ -|		if (!m_alerts[m_generation].empty())                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (m_notify) m_notify();                                                                                                                                                   |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|dht_mutable_item_alert::dht_mutable_item_alert(aux::stack_allocator&                                                                                                           |
│ │ │ │ │ +|, std::array<char, 32> const& k                                                                                                                                                |
│ │ │ │ │ +|		, std::array<char, 64> const& sig                                                                                                                                            |
│ │ │ │ │ +|		, std::int64_t sequence                                                                                                                                                      |
│ │ │ │ │ +|		, string_view s                                                                                                                                                              |
│ │ │ │ │ +|		, entry i                                                                                                                                                                    |
│ │ │ │ │ +|		, bool a)                                                                                                                                                                    |
│ │ │ │ │ +|		: key(k), signature(sig), seq(sequence), salt(s), item(std::move(i)), authoritative(a)                                                                                       |
│ │ │ │ │ +|	{}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_EXTENSIONS                                                                                                                                             |
│ │ │ │ │ -|	void alert_manager::add_extension(std::shared_ptr<plugin> ext)                                                                                                                |
│ │ │ │ │ +|	std::string dht_mutable_item_alert::message() const                                                                                                                           |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		m_ses_extensions.push_back(std::move(ext));                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		char msg[1050];                                                                                                                                                              |
│ │ │ │ │ +|		std::snprintf(msg, sizeof(msg), "DHT mutable item (key=%s salt=%s seq=%" PRId64 " %s) [ %s ]"                                                                                |
│ │ │ │ │ +|			, aux::to_hex(key).c_str()                                                                                                                                                  |
│ │ │ │ │ +|			, salt.c_str()                                                                                                                                                              |
│ │ │ │ │ +|			, seq                                                                                                                                                                       |
│ │ │ │ │ +|			, authoritative ? "auth" : "non-auth"                                                                                                                                       |
│ │ │ │ │ +|			, item.to_string().c_str());                                                                                                                                                |
│ │ │ │ │ +|		return msg;                                                                                                                                                                  |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void alert_manager::get_all(std::vector<alert*>& alerts)                                                                                                                      |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|_	_	_s_t_d_:_:_l_o_c_k___g_u_a_r_d_<_s_t_d_:_:_r_e_c_u_r_s_i_v_e___m_u_t_e_x_>_ _l_o_c_k_(_m___m_u_t_e_x_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|	dht_put_alert::dht_put_alert(aux::stack_allocator&, sha1_hash const& t, int n)                                                                                                |
│ │ │ │ │ +|		: target(t)                                                                                                                                                                  |
│ │ │ │ │ +|		, public_key()                                                                                                                                                               |
│ │ │ │ │ +|		, signature()                                                                                                                                                                |
│ │ │ │ │ +|_	_	_,_ _s_a_l_t_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 2|_._._/_s_r_c_/                       |peer_connection and tracker_connection should probably be flags                                                                     |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_i_n_s_t_a_n_t_i_a_t_e___c_o_n_n_e_c_t_i_o_n_._c_p_p_:_4_4_ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** ppeeeerr__ccoonnnneeccttiioonn aanndd ttrraacckkeerr__ccoonnnneeccttiioonn sshhoouulldd pprroobbaabbllyy bbee ffllaaggss **********                                                                                                    |
│ │ │ │ │  |****** ....//ssrrcc//iinnssttaannttiiaattee__ccoonnnneeccttiioonn..ccpppp::4444 ******                                                                                                                                   |
│ │ │ │ │  |ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE                                                                                                       |
│ │ │ │ │  |LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR                                                                                                            |
│ │ │ │ │  |CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF                                                                                                           |
│ │ │ │ │ @@ -2936,233 +2522,502 @@
│ │ │ │ │  |				s.set_impl(sm->new_utp_socket(&s));                                                                                                                                        |
│ │ │ │ │  |				return socket_type(std::move(s));                                                                                                                                          |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │  |		else if (ps.type == settings_pack::i2p_proxy)                                                                                                                                |
│ │ │ │ │  |_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_2_0_2_1_ _ _ _ _ _ _ _ _ _|_t_h_e_ _s_a_l_t_ _h_e_r_e_ _i_s_ _a_l_l_o_c_a_t_e_d_ _o_n_ _t_h_e_ _h_e_a_p_._ _I_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _a_l_l_o_c_a_t_e_ _i_n_ _t_h_e_ _s_t_a_c_k___a_l_l_o_c_a_t_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhee ssaalltt hheerree iiss aallllooccaatteedd oonn tthhee hheeaapp.. IItt wwoouulldd bbee nniiccee ttoo aallllooccaattee iinn tthhee ssttaacckk__aallllooccaattoorr **********                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//aalleerrtt..ccpppp::22002211 ******                                                                                                                                                  |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_5_0_4_ _ _ _ _ _ _ _ _|_p_o_s_t_ _a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ppoosstt aalleerrtt **********                                                                                                                                                         |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::550044 ******                                                                                                                                                 |
│ │ │ │ │ +|if (m_current_gauge_state != no_gauge_state)                                                                                                                                   |
│ │ │ │ │ +|			inc_stats_counter(m_current_gauge_state + counters::num_checking_torrents, -1);                                                                                             |
│ │ │ │ │ +|		if (new_gauge_state != no_gauge_state)                                                                                                                                       |
│ │ │ │ │ +|			inc_stats_counter(new_gauge_state + counters::num_checking_torrents, 1);                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	dht_immutable_item_alert::dht_immutable_item_alert(aux::stack_allocator&                                                                                                      |
│ │ │ │ │ -|		, sha1_hash const& t, entry i)                                                                                                                                               |
│ │ │ │ │ -|		: target(t), item(std::move(i))                                                                                                                                              |
│ │ │ │ │ -|	{}                                                                                                                                                                            |
│ │ │ │ │ +|		TORRENT_ASSERT(new_gauge_state >= 0);                                                                                                                                        |
│ │ │ │ │ +|		TORRENT_ASSERT(new_gauge_state <= no_gauge_state);                                                                                                                           |
│ │ │ │ │ +|		m_current_gauge_state = static_cast<std::uint32_t>(new_gauge_state);                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string dht_immutable_item_alert::message() const                                                                                                                         |
│ │ │ │ │ +|	void torrent::leave_seed_mode(seed_mode_t const checking)                                                                                                                     |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		char msg[1050];                                                                                                                                                              |
│ │ │ │ │ -|		std::snprintf(msg, sizeof(msg), "DHT immutable item %s [ %s ]"                                                                                                               |
│ │ │ │ │ -|			, aux::to_hex(target).c_str()                                                                                                                                               |
│ │ │ │ │ -|			, item.to_string().c_str());                                                                                                                                                |
│ │ │ │ │ -|		return msg;                                                                                                                                                                  |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		if (!m_seed_mode) return;                                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|dht_mutable_item_alert::dht_mutable_item_alert(aux::stack_allocator&                                                                                                           |
│ │ │ │ │ -|, std::array<char, 32> const& k                                                                                                                                                |
│ │ │ │ │ -|		, std::array<char, 64> const& sig                                                                                                                                            |
│ │ │ │ │ -|		, std::int64_t sequence                                                                                                                                                      |
│ │ │ │ │ -|		, string_view s                                                                                                                                                              |
│ │ │ │ │ -|		, entry i                                                                                                                                                                    |
│ │ │ │ │ -|		, bool a)                                                                                                                                                                    |
│ │ │ │ │ -|		: key(k), signature(sig), seq(sequence), salt(s), item(std::move(i)), authoritative(a)                                                                                       |
│ │ │ │ │ -|	{}                                                                                                                                                                            |
│ │ │ │ │ +|		if (checking == seed_mode_t::check_files)                                                                                                                                    |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// this means the user promised we had all the                                                                                                                              |
│ │ │ │ │ +|			// files, but it turned out we didn't. This is                                                                                                                              |
│ │ │ │ │ +|			// an error.                                                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string dht_mutable_item_alert::message() const                                                                                                                           |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		char msg[1050];                                                                                                                                                              |
│ │ │ │ │ -|		std::snprintf(msg, sizeof(msg), "DHT mutable item (key=%s salt=%s seq=%" PRId64 " %s) [ %s ]"                                                                                |
│ │ │ │ │ -|			, aux::to_hex(key).c_str()                                                                                                                                                  |
│ │ │ │ │ -|			, salt.c_str()                                                                                                                                                              |
│ │ │ │ │ -|			, seq                                                                                                                                                                       |
│ │ │ │ │ -|			, authoritative ? "auth" : "non-auth"                                                                                                                                       |
│ │ │ │ │ -|			, item.to_string().c_str());                                                                                                                                                |
│ │ │ │ │ -|		return msg;                                                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|			debug_log("*** FAILED SEED MODE, rechecking");                                                                                                                              |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		debug_log("*** LEAVING SEED MODE (%s)"                                                                                                                                       |
│ │ │ │ │ +|			, checking == seed_mode_t::skip_checking ? "as seed" : "as non-seed");                                                                                                      |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|		m_seed_mode = false;                                                                                                                                                         |
│ │ │ │ │ +|		// seed is false if we turned out not                                                                                                                                        |
│ │ │ │ │ +|		// to be a seed after all                                                                                                                                                    |
│ │ │ │ │ +|		if (checking == seed_mode_t::check_files                                                                                                                                     |
│ │ │ │ │ +|			&& state() != torrent_status::checking_resume_data)                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			m_have_all = false;                                                                                                                                                         |
│ │ │ │ │ +|			set_state(torrent_status::downloading);                                                                                                                                     |
│ │ │ │ │ +|			force_recheck();                                                                                                                                                            |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		m_num_verified = 0;                                                                                                                                                          |
│ │ │ │ │ +|		m_verified.clear();                                                                                                                                                          |
│ │ │ │ │ +|		m_verifying.clear();                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		set_need_save_resume(torrent_handle::if_state_changed);                                                                                                                      |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	dht_put_alert::dht_put_alert(aux::stack_allocator&, sha1_hash const& t, int n)                                                                                                |
│ │ │ │ │ -|		: target(t)                                                                                                                                                                  |
│ │ │ │ │ -|		, public_key()                                                                                                                                                               |
│ │ │ │ │ -|		, signature()                                                                                                                                                                |
│ │ │ │ │ -|_	_	_,_ _s_a_l_t_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|           |                              |technically, this is where the transaction of moving the files is completed. This is where the new save_path should be committed. If|
│ │ │ │ │ -|relevance 2|_._._/_s_r_c_/_s_t_o_r_a_g_e___u_t_i_l_s_._c_p_p_:_2_9_4  |there is an error in the code below, that should not prevent the new save path to be set. Maybe it would make sense to make the     |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_s_a_v_e___p_a_t_h_ _a_n_ _i_n_-_o_u_t_ _p_a_r_a_m_e_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteecchhnniiccaallllyy,, tthhiiss iiss wwhheerree tthhee ttrraannssaaccttiioonn ooff mmoovviinngg tthhee ffiilleess iiss ccoommpplleetteedd.. TThhiiss iiss wwhheerree tthhee nneeww ssaavvee__ppaatthh sshhoouulldd bbee ccoommmmiitttteedd.. IIff tthheerree iiss aann eerrrroorr iinn tthhee ccooddee bbeellooww,,|
│ │ │ │ │ -|tthhaatt sshhoouulldd nnoott pprreevveenntt tthhee nneeww ssaavvee ppaatthh ttoo bbee sseett.. MMaayybbee iitt wwoouulldd mmaakkee sseennssee ttoo mmaakkee tthhee ssaavvee__ppaatthh aann iinn--oouutt ppaarraammeetteerr **********                                                 |
│ │ │ │ │ -|****** ....//ssrrcc//ssttoorraaggee__uuttiillss..ccpppp::229944 ******                                                                                                                                           |
│ │ │ │ │ -|while (--file_index >= file_index_t(0))                                                                                                                                        |
│ │ │ │ │ +|	void torrent::verified(piece_index_t const piece)                                                                                                                             |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(!m_verified.get_bit(piece));                                                                                                                                  |
│ │ │ │ │ +|_	_	_+_+_m___n_u_m___v_e_r_i_f_i_e_d_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_8_5_2_ _ _ _ _ _ _ _|_a_d_d_ _a_ _u_n_i_t_ _t_e_s_t_ _w_h_e_r_e_ _w_e_ _d_o_n_'_t_ _h_a_v_e_ _m_e_t_a_d_a_t_a_,_ _c_o_n_n_e_c_t_ _t_o_ _a_ _p_e_e_r_ _t_h_a_t_ _s_e_n_d_s_ _a_ _b_i_t_f_i_e_l_d_ _t_h_a_t_'_s_ _t_o_o_ _l_a_r_g_e_,_ _t_h_e_n_ _w_e_ _g_e_t_ _t_h_e_ _m_e_t_a_d_a_t_a_ _ _ _ |
│ │ │ │ │ +|********** aadddd aa uunniitt tteesstt wwhheerree wwee ddoonn''tt hhaavvee mmeettaaddaattaa,, ccoonnnneecctt ttoo aa ppeeeerr tthhaatt sseennddss aa bbiittffiieelldd tthhaatt''ss ttoooo llaarrggee,, tthheenn wwee ggeett tthhee mmeettaaddaattaa **********                                   |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::11885522 ******                                                                                                                                                |
│ │ │ │ │ +|for (auto const& f : m_add_torrent_params->renamed_files)                                                                                                                      |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				// files moved out to absolute paths are not moved                                                                                                                         |
│ │ │ │ │ -|				if (f.file_absolute_path(file_index)) continue;                                                                                                                            |
│ │ │ │ │ +|				if (f.first < file_index_t(0) || f.first >= fs.end_file()) continue;                                                                                                       |
│ │ │ │ │ +|				m_torrent_file->rename_file(file_index_t(f.first), f.second);                                                                                                              |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				// if we ended up copying the file, don't do anything during                                                                                                               |
│ │ │ │ │ -|				// roll-back                                                                                                                                                               |
│ │ │ │ │ -|				if (copied_files[file_index]) continue;                                                                                                                                    |
│ │ │ │ │ +|		construct_storage();                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				std::string const old_path = combine_path(save_path, f.file_path(file_index));                                                                                             |
│ │ │ │ │ -|				std::string const new_path = combine_path(new_save_path, f.file_path(file_index));                                                                                         |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_SHARE_MODE                                                                                                                                             |
│ │ │ │ │ +|		if (m_share_mode && valid_metadata())                                                                                                                                        |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// in share mode, all pieces have their priorities initialized to 0                                                                                                         |
│ │ │ │ │ +|			m_file_priority.clear();                                                                                                                                                    |
│ │ │ │ │ +|			m_file_priority.resize(m_torrent_file->num_files(), dont_download);                                                                                                         |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				// ignore errors when rolling back                                                                                                                                         |
│ │ │ │ │ -|				storage_error ignore;                                                                                                                                                      |
│ │ │ │ │ -|				move_file(new_path, old_path, ignore);                                                                                                                                     |
│ │ │ │ │ +|		// it's important to initialize the peers early, because this is what will                                                                                                   |
│ │ │ │ │ +|		// fix up their have-bitmasks to have the correct size                                                                                                                       |
│ │ │ │ │ +|if (!m_connections_initialized)                                                                                                                                                |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|			m_connections_initialized = true;                                                                                                                                           |
│ │ │ │ │ +|			// all peer connections have to initialize themselves now that the metadata                                                                                                 |
│ │ │ │ │ +|			// is available                                                                                                                                                             |
│ │ │ │ │ +|			// copy the peer list since peers may disconnect and invalidate                                                                                                             |
│ │ │ │ │ +|			// m_connections as we initialize them                                                                                                                                      |
│ │ │ │ │ +|			for (auto c : m_connections)                                                                                                                                                |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				auto pc = c->self();                                                                                                                                                       |
│ │ │ │ │ +|				if (pc->is_disconnecting()) continue;                                                                                                                                      |
│ │ │ │ │ +|				pc->on_metadata_impl();                                                                                                                                                    |
│ │ │ │ │ +|				if (pc->is_disconnecting()) continue;                                                                                                                                      |
│ │ │ │ │ +|				pc->init();                                                                                                                                                                |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			return { status_t::fatal_disk_error, save_path };                                                                                                                           |
│ │ │ │ │ +|		// in case file priorities were passed in via the add_torrent_params                                                                                                         |
│ │ │ │ │ +|		// and also in the case of share mode, we need to update the priorities                                                                                                      |
│ │ │ │ │ +|		// this has to be applied before piece priority                                                                                                                              |
│ │ │ │ │ +|		if (!m_file_priority.empty())                                                                                                                                                |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// m_file_priority was loaded from the resume data, this doesn't                                                                                                            |
│ │ │ │ │ +|			// alter any state that needs to be saved in the resume data                                                                                                                |
│ │ │ │ │ +|			auto const ns = m_need_save_resume_data;                                                                                                                                    |
│ │ │ │ │ +|			update_piece_priorities(m_file_priority);                                                                                                                                   |
│ │ │ │ │ +|			m_need_save_resume_data = ns;                                                                                                                                               |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_add_torrent_params)                                                                                                                                                    |
│ │ │ │ │ +|_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_4_9_2_ _ _ _ _ _ _ _|_u_s_e_ _c_h_r_o_n_o_ _t_y_p_e_ _f_o_r_ _t_i_m_e_ _d_u_r_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** uussee cchhrroonnoo ttyyppee ffoorr ttiimmee dduurraattiioonn **********                                                                                                                                  |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::44449922 ******                                                                                                                                                |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|std::set<std::string> subdirs;                                                                                                                                                 |
│ │ │ │ │ -|		for (auto const i : f.file_range())                                                                                                                                          |
│ │ │ │ │ +|		m_picker->piece_passed(index);                                                                                                                                               |
│ │ │ │ │ +|		update_gauge();                                                                                                                                                              |
│ │ │ │ │ +|		we_have(index);                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		if (should_log())                                                                                                                                                            |
│ │ │ │ │ +|			debug_log("we_have(%d) (num_have: %d)", int(index), num_have());                                                                                                            |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_STREAMING                                                                                                                                              |
│ │ │ │ │ +|		remove_time_critical_piece(index, true);                                                                                                                                     |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_PREDICTIVE_PIECES                                                                                                                                      |
│ │ │ │ │ +|	// we believe we will complete this piece very soon                                                                                                                           |
│ │ │ │ │ +|	// announce it to peers ahead of time to eliminate the                                                                                                                        |
│ │ │ │ │ +|	// round-trip times involved in announcing it, requesting it                                                                                                                  |
│ │ │ │ │ +|	// and sending it                                                                                                                                                             |
│ │ │ │ │ +|void torrent::predicted_have_piece(piece_index_t const index, int const milliseconds)                                                                                          |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		auto const i = std::lower_bound(m_predictive_pieces.begin()                                                                                                                  |
│ │ │ │ │ +|			, m_predictive_pieces.end(), index);                                                                                                                                        |
│ │ │ │ │ +|		if (i != m_predictive_pieces.end() && *i == index) return;                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		for (auto p : m_connections)                                                                                                                                                 |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// files moved out to absolute paths are not moved                                                                                                                          |
│ │ │ │ │ -|			if (f.file_absolute_path(i)) continue;                                                                                                                                      |
│ │ │ │ │ +|			TORRENT_INCREMENT(m_iterating_connections);                                                                                                                                 |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|			p->peer_log(peer_log_alert::outgoing, "PREDICTIVE_HAVE", "piece: %d expected in %d ms"                                                                                      |
│ │ │ │ │ +|				, static_cast<int>(index), milliseconds);                                                                                                                                  |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|			TORRENT_UNUSED(milliseconds);                                                                                                                                               |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			p->announce_piece(index);                                                                                                                                                   |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (has_parent_path(f.file_path(i)))                                                                                                                                        |
│ │ │ │ │ -|				subdirs.insert(parent_path(f.file_path(i)));                                                                                                                               |
│ │ │ │ │ +|		m_predictive_pieces.insert(i, index);                                                                                                                                        |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// if we ended up renaming the file instead of moving it, there's no                                                                                                        |
│ │ │ │ │ -|			// need to delete the source.                                                                                                                                               |
│ │ │ │ │ -|			if (copied_files[i] == false) continue;                                                                                                                                     |
│ │ │ │ │ +|	// blocks may contain the block indices of the blocks that failed (if this is                                                                                                 |
│ │ │ │ │ +|	// a v2 torrent).                                                                                                                                                             |
│ │ │ │ │ +|	void torrent::piece_failed(piece_index_t const index, std::vector<int> blocks)                                                                                                |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		// if the last piece fails the peer connection will still                                                                                                                    |
│ │ │ │ │ +|		// think that it has received all of it until this function                                                                                                                  |
│ │ │ │ │ +|		// resets the download queue. So, we cannot do the                                                                                                                           |
│ │ │ │ │ +|		// invariant check here since it assumes:                                                                                                                                    |
│ │ │ │ │ +|_	_	_/_/_ _(_t_o_t_a_l___d_o_n_e_ _=_=_ _m___t_o_r_r_e_n_t___f_i_l_e_-_>_t_o_t_a_l___s_i_z_e_(_)_)_ _=_>_ _i_s___s_e_e_d_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_9_1_9_ _ _ _ _ _ _ _|_a_b_o_r_t_ _l_o_o_k_u_p_s_ _t_h_i_s_ _t_o_r_r_e_n_t_ _h_a_s_ _m_a_d_e_ _v_i_a_ _t_h_e_ _s_e_s_s_i_o_n_ _h_o_s_t_ _r_e_s_o_l_v_e_r_ _i_n_t_e_r_f_a_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** aabboorrtt llooookkuuppss tthhiiss ttoorrrreenntt hhaass mmaaddee vviiaa tthhee sseessssiioonn hhoosstt rreessoollvveerr iinntteerrffaaccee **********                                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::44991199 ******                                                                                                                                                |
│ │ │ │ │ +|TORRENT_UNUSED(e);                                                                                                                                                             |
│ │ │ │ │ +|				m_storage.reset();                                                                                                                                                         |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|				debug_log("Failed to flush disk cache: %s", e.what());                                                                                                                     |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|				// clients may rely on this alert to be posted, so it's probably a                                                                                                         |
│ │ │ │ │ +|				// good idea to post it here, even though we failed                                                                                                                        |
│ │ │ │ │ +|				if (alerts().should_post<cache_flushed_alert>())                                                                                                                           |
│ │ │ │ │ +|					alerts().emplace_alert<cache_flushed_alert>(get_handle());                                                                                                                |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			m_ses.deferred_submit_jobs();                                                                                                                                               |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (alerts().should_post<cache_flushed_alert>())                                                                                                                            |
│ │ │ │ │ +|				alerts().emplace_alert<cache_flushed_alert>(get_handle());                                                                                                                 |
│ │ │ │ │ +|			alerts().emplace_alert<torrent_removed_alert>(get_handle()                                                                                                                  |
│ │ │ │ │ +|				, info_hash(), get_userdata());                                                                                                                                            |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			std::string const old_path = combine_path(save_path, f.file_path(i));                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// we may still have some files in old save_path                                                                                                                            |
│ │ │ │ │ -|			// eg. if (flags == dont_replace && exists(new_path))                                                                                                                       |
│ │ │ │ │ -|			// ignore errors when removing                                                                                                                                              |
│ │ │ │ │ -|			error_code ignore;                                                                                                                                                          |
│ │ │ │ │ -|			remove(old_path, ignore);                                                                                                                                                   |
│ │ │ │ │ +|if (!m_apply_ip_filter)                                                                                                                                                        |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			inc_stats_counter(counters::non_filter_torrents, -1);                                                                                                                       |
│ │ │ │ │ +|			m_apply_ip_filter = true;                                                                                                                                                   |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		for (std::string const& s : subdirs)                                                                                                                                         |
│ │ │ │ │ +|		m_paused = false;                                                                                                                                                            |
│ │ │ │ │ +|		m_auto_managed = false;                                                                                                                                                      |
│ │ │ │ │ +|		update_state_list();                                                                                                                                                         |
│ │ │ │ │ +|		for (torrent_list_index_t i{}; i != m_links.end_index(); ++i)                                                                                                                |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			error_code err;                                                                                                                                                             |
│ │ │ │ │ -|			std::string subdir = combine_path(save_path, s);                                                                                                                            |
│ │ │ │ │ +|			if (!m_links[i].in_list()) continue;                                                                                                                                        |
│ │ │ │ │ +|			m_links[i].unlink(m_ses.torrent_list(i), i);                                                                                                                                |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		// don't re-add this torrent to the state-update list                                                                                                                        |
│ │ │ │ │ +|		m_state_subscription = false;                                                                                                                                                |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			while (!path_equal(subdir, save_path) && !err)                                                                                                                              |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|_	_	_	_	_r_e_m_o_v_e_(_s_u_b_d_i_r_,_ _e_r_r_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 2|_._._/_s_r_c_/_s_t_o_r_a_g_e___u_t_i_l_s_._c_p_p_:_4_8_6  |is this risky? The upper layer will assume we have the whole file. Perhaps we should verify that at least the size of the file is   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_c_o_r_r_e_c_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iiss tthhiiss rriisskkyy?? TThhee uuppppeerr llaayyeerr wwiillll aassssuummee wwee hhaavvee tthhee wwhhoollee ffiillee.. PPeerrhhaappss wwee sshhoouulldd vveerriiffyy tthhaatt aatt lleeaasstt tthhee ssiizzee ooff tthhee ffiillee iiss ccoorrrreecctt **********                          |
│ │ │ │ │ -|****** ....//ssrrcc//ssttoorraaggee__uuttiillss..ccpppp::448866 ******                                                                                                                                           |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|					// we create directories lazily, so it's possible it hasn't                                                                                                               |
│ │ │ │ │ -|					// been created yet. Create the directories now and try                                                                                                                   |
│ │ │ │ │ -|					// again                                                                                                                                                                  |
│ │ │ │ │ -|					create_directories(parent_path(file_path), err);                                                                                                                          |
│ │ │ │ │ +|	// this is called when we're destructing non-gracefully. i.e. we're _just_                                                                                                    |
│ │ │ │ │ +|	// destructing everything.                                                                                                                                                    |
│ │ │ │ │ +|	void torrent::panic()                                                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		m_storage.reset();                                                                                                                                                           |
│ │ │ │ │ +|		// if there are any other peers allocated still, we need to clear them                                                                                                       |
│ │ │ │ │ +|		// now. They can't be cleared later because the allocator will already                                                                                                       |
│ │ │ │ │ +|		// have been destructed                                                                                                                                                      |
│ │ │ │ │ +|		if (m_peer_list) m_peer_list->clear();                                                                                                                                       |
│ │ │ │ │ +|		m_connections.clear();                                                                                                                                                       |
│ │ │ │ │ +|		m_outgoing_pids.clear();                                                                                                                                                     |
│ │ │ │ │ +|_	_	_m___p_e_e_r_s___t_o___d_i_s_c_o_n_n_e_c_t_._c_l_e_a_r_(_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 2|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_8_0_3_2       |if peer is a really good peer, maybe we shouldn't disconnect it perhaps this logic should be disabled if we have too many idle peers|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_(_w_i_t_h_ _s_o_m_e_ _d_e_f_i_n_i_t_i_o_n_ _o_f_ _i_d_l_e_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iiff ppeeeerr iiss aa rreeaallllyy ggoooodd ppeeeerr,, mmaayybbee wwee sshhoouullddnn''tt ddiissccoonnnneecctt iitt ppeerrhhaappss tthhiiss llooggiicc sshhoouulldd bbee ddiissaabblleedd iiff wwee hhaavvee ttoooo mmaannyy iiddllee ppeeeerrss ((wwiitthh ssoommee ddeeffiinniittiioonn ooff iiddllee)) **********|
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::88003322 ******                                                                                                                                                |
│ │ │ │ │ +|		m_peers_to_disconnect.reserve(m_connections.size() + 1);                                                                                                                     |
│ │ │ │ │ +|		m_connections.reserve(m_connections.size() + 1);                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|					if (err)                                                                                                                                                                  |
│ │ │ │ │ -|					{                                                                                                                                                                         |
│ │ │ │ │ -|						ec.file(idx);                                                                                                                                                            |
│ │ │ │ │ -|						ec.operation = operation_t::mkdir;                                                                                                                                       |
│ │ │ │ │ -|						return false;                                                                                                                                                            |
│ │ │ │ │ -|					}                                                                                                                                                                         |
│ │ │ │ │ +|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ +|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(p->remote() == p->get_socket().remote_endpoint(ec) || ec);                                                                                                    |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|					hard_link(s, file_path, err);                                                                                                                                             |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ +|		TORRENT_ASSERT(p->peer_info_struct() != nullptr);                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				// if the file already exists, that's not an error                                                                                                                         |
│ │ │ │ │ -|				if (err == boost::system::errc::file_exists)                                                                                                                               |
│ │ │ │ │ -|					continue;                                                                                                                                                                 |
│ │ │ │ │ +|		// we need to do this after we've added the peer to the peer_list                                                                                                            |
│ │ │ │ │ +|		// since that's when the peer is assigned its peer_info object,                                                                                                              |
│ │ │ │ │ +|		// which holds the rank                                                                                                                                                      |
│ │ │ │ │ +|		if (maybe_replace_peer)                                                                                                                                                      |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// now, find the lowest rank peer and disconnect that                                                                                                                       |
│ │ │ │ │ +|			// if it's lower rank than the incoming connection                                                                                                                          |
│ │ │ │ │ +|			peer_connection* peer = find_lowest_ranking_peer();                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|if (err)                                                                                                                                                                       |
│ │ │ │ │ +|if (peer != nullptr && peer->peer_rank() < p->peer_rank())                                                                                                                     |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|					ec.ec = err;                                                                                                                                                              |
│ │ │ │ │ -|					ec.file(idx);                                                                                                                                                             |
│ │ │ │ │ -|					ec.operation = operation_t::file_hard_link;                                                                                                                               |
│ │ │ │ │ -|					return false;                                                                                                                                                             |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|				if (should_log())                                                                                                                                                          |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					debug_log("CLOSING CONNECTION \"%s\" peer list full (low peer rank) "                                                                                                     |
│ │ │ │ │ +|						"connections: %d limit: %d"                                                                                                                                              |
│ │ │ │ │ +|						, print_endpoint(peer->remote()).c_str()                                                                                                                                 |
│ │ │ │ │ +|						, num_peers()                                                                                                                                                            |
│ │ │ │ │ +|						, m_max_connections);                                                                                                                                                    |
│ │ │ │ │  |				}                                                                                                                                                                          |
│ │ │ │ │ -|				added_files = true;                                                                                                                                                        |
│ │ │ │ │ -|				stat.set_dirty(idx);                                                                                                                                                       |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|				peer->disconnect(errors::too_many_connections, operation_t::bittorrent);                                                                                                   |
│ │ │ │ │ +|				p->peer_disconnected_other();                                                                                                                                              |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|#endif // TORRENT_DISABLE_MUTABLE_TORRENTS                                                                                                                                     |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|				if (should_log())                                                                                                                                                          |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					debug_log("CLOSING CONNECTION \"%s\" peer list full (low peer rank) "                                                                                                     |
│ │ │ │ │ +|						"connections: %d limit: %d"                                                                                                                                              |
│ │ │ │ │ +|						, print_endpoint(p->remote()).c_str()                                                                                                                                    |
│ │ │ │ │ +|						, num_peers()                                                                                                                                                            |
│ │ │ │ │ +|						, m_max_connections);                                                                                                                                                    |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|				p->disconnect(errors::too_many_connections, operation_t::bittorrent);                                                                                                      |
│ │ │ │ │ +|				// we have to do this here because from the peer's point of view                                                                                                           |
│ │ │ │ │ +|				// it wasn't really attached to the torrent, but we do need                                                                                                                |
│ │ │ │ │ +|_	_	_	_	_/_/_ _t_o_ _l_e_t_ _p_e_e_r___l_i_s_t_ _k_n_o_w_ _w_e_'_r_e_ _r_e_m_o_v_i_n_g_ _i_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 2|_._._/_s_r_c_/                       |just make this peer not have the pieces associated with the file we just requested. Only when it doesn't have any of the file do the|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_w_e_b___p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:_6_2_6_ _ _ _|_f_o_l_l_o_w_i_n_g_ _p_a_d_ _f_i_l_e_s_ _w_i_l_l_ _m_a_k_e_ _i_t_ _c_o_m_p_l_i_c_a_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** jjuusstt mmaakkee tthhiiss ppeeeerr nnoott hhaavvee tthhee ppiieecceess aassssoocciiaatteedd wwiitthh tthhee ffiillee wwee jjuusstt rreeqquueesstteedd.. OOnnllyy wwhheenn iitt ddooeessnn''tt hhaavvee aannyy ooff tthhee ffiillee ddoo tthhee ffoolllloowwiinngg ppaadd ffiilleess wwiillll mmaakkee iitt    |
│ │ │ │ │ +|ccoommpplliiccaatteedd **********                                                                                                                                                              |
│ │ │ │ │ +|****** ....//ssrrcc//wweebb__ppeeeerr__ccoonnnneeccttiioonn..ccpppp::662266 ******                                                                                                                                     |
│ │ │ │ │ +|	peer_connection::received_invalid_data(index, single_peer);                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		bool const seed = (rd.have_pieces.size() >= fs.num_pieces()                                                                                                                  |
│ │ │ │ │ -|			&& rd.have_pieces.all_set())                                                                                                                                                |
│ │ │ │ │ -|			|| (rd.flags & torrent_flags::seed_mode);                                                                                                                                   |
│ │ │ │ │ +|	// if we don't think we have any of the files, allow banning the web seed                                                                                                     |
│ │ │ │ │ +|	if (num_have_pieces() == 0) return true;                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (seed)                                                                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			for (file_index_t const file_index : fs.file_range())                                                                                                                       |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				if (fs.pad_file_at(file_index)) continue;                                                                                                                                  |
│ │ │ │ │ +|	// don't disconnect, we won't request anything from this file again                                                                                                           |
│ │ │ │ │ +|	return false;                                                                                                                                                                 |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				// files with priority zero may not have been saved to disk at their                                                                                                       |
│ │ │ │ │ -|				// expected location, but is likely to be in a partfile. Just exempt it                                                                                                    |
│ │ │ │ │ -|				// from checking                                                                                                                                                           |
│ │ │ │ │ -|				if (file_index < file_priority.end_index()                                                                                                                                 |
│ │ │ │ │ -|					&& file_priority[file_index] == dont_download                                                                                                                             |
│ │ │ │ │ -|					&& !(rd.flags & torrent_flags::seed_mode))                                                                                                                                |
│ │ │ │ │ -|_	_	_	_	_	_c_o_n_t_i_n_u_e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_e_s_c_a_p_e___s_t_r_i_n_g_._c_p_p_:_1_9_4_ _ _|_t_h_i_s_ _s_h_o_u_l_d_ _p_r_o_b_a_b_l_y_ _b_e_ _m_o_v_e_d_ _i_n_t_o_ _s_t_r_i_n_g___u_t_i_l_._c_p_p_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss sshhoouulldd pprroobbaabbllyy bbee mmoovveedd iinnttoo ssttrriinngg__uuttiill..ccpppp **********                                                                                                                 |
│ │ │ │ │ -|****** ....//ssrrcc//eessccaappee__ssttrriinngg..ccpppp::119944 ******                                                                                                                                           |
│ │ │ │ │ +|void web_peer_connection::on_receive_padfile()                                                                                                                                 |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|		return escape_string_impl(str.data(), int(str.size()), 10);                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|	handle_padfile();                                                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	bool need_encoding(char const* str, int const len)                                                                                                                            |
│ │ │ │ │ +|void web_peer_connection::handle_error(int const bytes_left)                                                                                                                   |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	std::shared_ptr<torrent> t = associated_torrent().lock();                                                                                                                     |
│ │ │ │ │ +|	TORRENT_ASSERT(t);                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|// temporarily unavailable, retry later                                                                                                                                        |
│ │ │ │ │ +|	t->retry_web_seed(this, m_parser.header_duration("retry-after"));                                                                                                             |
│ │ │ │ │ +|	if (t->alerts().should_post<url_seed_alert>())                                                                                                                                |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		for (int i = 0; i < len; ++i)                                                                                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (std::strchr(unreserved_chars, *str) == nullptr || *str == 0)                                                                                                            |
│ │ │ │ │ -|				return true;                                                                                                                                                               |
│ │ │ │ │ -|			++str;                                                                                                                                                                      |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │ +|		std::string const error_msg = to_string(m_parser.status_code()).data()                                                                                                       |
│ │ │ │ │ +|			+ (" " + m_parser.message());                                                                                                                                               |
│ │ │ │ │ +|		t->alerts().emplace_alert<url_seed_alert>(t->get_handle(), m_url                                                                                                             |
│ │ │ │ │ +|			, error_msg);                                                                                                                                                               |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ +|	received_bytes(0, bytes_left);                                                                                                                                                |
│ │ │ │ │ +|	disconnect(error_code(m_parser.status_code(), http_category()), operation_t::bittorrent, failure);                                                                            |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void convert_path_to_posix(std::string& path)                                                                                                                                 |
│ │ │ │ │ +|void web_peer_connection::disable(error_code const& ec)                                                                                                                        |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	// we should not try this server again.                                                                                                                                       |
│ │ │ │ │ +|	m_web->disabled = true;                                                                                                                                                       |
│ │ │ │ │ +|	disconnect(ec, operation_t::bittorrent, peer_error);                                                                                                                          |
│ │ │ │ │ +|	if (m_web->ephemeral)                                                                                                                                                         |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::replace(path.begin(), path.end(), '\\', '/');                                                                                                                           |
│ │ │ │ │ +|		std::shared_ptr<torrent> t = associated_torrent().lock();                                                                                                                    |
│ │ │ │ │ +|		TORRENT_ASSERT(t);                                                                                                                                                           |
│ │ │ │ │ +|		t->remove_web_seed_conn(this);                                                                                                                                               |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ +|	m_web = nullptr;                                                                                                                                                              |
│ │ │ │ │ +|	TORRENT_ASSERT(is_disconnecting());                                                                                                                                           |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|std::string read_until(char const*& str, char const delim, char const* end)                                                                                                    |
│ │ │ │ │ +|void web_peer_connection::handle_redirect(int const bytes_left)                                                                                                                |
│ │ │ │ │ +|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 2|_._._/_s_r_c_/_p_e_e_r___l_i_s_t_._c_p_p_:_5_3_9      |it would be nice if there was a way to iterate over these torrent_peer objects in the order they are allocated in the pool instead. |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_I_t_ _w_o_u_l_d_ _p_r_o_b_a_b_l_y_ _b_e_ _m_o_r_e_ _e_f_f_i_c_i_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd bbee nniiccee iiff tthheerree wwaass aa wwaayy ttoo iitteerraattee oovveerr tthheessee ttoorrrreenntt__ppeeeerr oobbjjeeccttss iinn tthhee oorrddeerr tthheeyy aarree aallllooccaatteedd iinn tthhee ppooooll iinnsstteeaadd.. IItt wwoouulldd pprroobbaabbllyy bbee mmoorree eeffffiicciieenntt  |
│ │ │ │ │ +|**********                                                                                                                                                                          |
│ │ │ │ │ +|****** ....//ssrrcc//ppeeeerr__lliisstt..ccpppp::553399 ******                                                                                                                                               |
│ │ │ │ │ +|, int session_time, torrent_state* state)                                                                                                                                      |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		const int candidate_count = 10;                                                                                                                                              |
│ │ │ │ │ +|		peers.reserve(candidate_count);                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		int erase_candidate = -1;                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (bool(m_finished) != state->is_finished)                                                                                                                                  |
│ │ │ │ │ +|			recalculate_connect_candidates(state);                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		external_ip const& external = state->ip;                                                                                                                                     |
│ │ │ │ │ +|		int external_port = state->port;                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_round_robin >= int(m_peers.size())) m_round_robin = 0;                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		int max_peerlist_size = state->max_peerlist_size;                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|for (int iterations = std::min(int(m_peers.size()), 300);                                                                                                                      |
│ │ │ │ │ +|iterations > 0; --iterations)                                                                                                                                                  |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			++state->loop_counter;                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (m_round_robin >= int(m_peers.size())) m_round_robin = 0;                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			torrent_peer& pe = *m_peers[m_round_robin];                                                                                                                                 |
│ │ │ │ │ +|			TORRENT_ASSERT(pe.in_use);                                                                                                                                                  |
│ │ │ │ │ +|			int current = m_round_robin;                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// if the number of peers is growing large                                                                                                                                  |
│ │ │ │ │ +|			// we need to start weeding.                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (int(m_peers.size()) >= max_peerlist_size * 0.95                                                                                                                         |
│ │ │ │ │ +|				&& max_peerlist_size > 0)                                                                                                                                                  |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				if (is_erase_candidate(pe)                                                                                                                                                 |
│ │ │ │ │ +|					&& (erase_candidate == -1                                                                                                                                                 |
│ │ │ │ │ +|						|| !compare_peer_erase(*m_peers[erase_candidate], pe)))                                                                                                                  |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					if (should_erase_immediately(pe))                                                                                                                                         |
│ │ │ │ │ +|					{                                                                                                                                                                         |
│ │ │ │ │ +|						if (erase_candidate > current) --erase_candidate;                                                                                                                        |
│ │ │ │ │ +|						erase_peer(m_peers.begin() + current, state);                                                                                                                            |
│ │ │ │ │ +|						continue;                                                                                                                                                                |
│ │ │ │ │ +|					}                                                                                                                                                                         |
│ │ │ │ │ +|					else                                                                                                                                                                      |
│ │ │ │ │ +|					{                                                                                                                                                                         |
│ │ │ │ │ +|						erase_candidate = current;                                                                                                                                               |
│ │ │ │ │ +|_	_	_	_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_u_p_n_p_._c_p_p_:_1_0_6_ _ _ _ _ _ _ _ _ _ _ _|_u_s_e_ _b_o_o_s_t_:_:_a_s_i_o_:_:_i_p_:_:_n_e_t_w_o_r_k_ _i_n_s_t_e_a_d_ _o_f_ _n_e_t_m_a_s_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** uussee bboooosstt::::aassiioo::::iipp::::nneettwwoorrkk iinnsstteeaadd ooff nneettmmaasskk **********                                                                                                                    |
│ │ │ │ │ +|****** ....//ssrrcc//uuppnnpp..ccpppp::110066 ******                                                                                                                                                    |
│ │ │ │ │ +|static error_code ignore_error;                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|upnp::rootdevice::rootdevice() = default;                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ +|upnp::rootdevice::~rootdevice()                                                                                                                                                |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|		TORRENT_ASSERT(str <= end);                                                                                                                                                  |
│ │ │ │ │ +|	TORRENT_ASSERT(magic == 1337);                                                                                                                                                |
│ │ │ │ │ +|	magic = 0;                                                                                                                                                                    |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|upnp::rootdevice::~rootdevice() = default;                                                                                                                                     |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		std::string ret;                                                                                                                                                             |
│ │ │ │ │ -|		while (str != end && *str != delim)                                                                                                                                          |
│ │ │ │ │ +|upnp::rootdevice::rootdevice(rootdevice const&) = default;                                                                                                                     |
│ │ │ │ │ +|upnp::rootdevice& upnp::rootdevice::operator=(rootdevice const&) & = default;                                                                                                  |
│ │ │ │ │ +|upnp::rootdevice::rootdevice(rootdevice&&) noexcept = default;                                                                                                                 |
│ │ │ │ │ +|upnp::rootdevice& upnp::rootdevice::operator=(rootdevice&&) & = default;                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|upnp::upnp(io_context& ios                                                                                                                                                     |
│ │ │ │ │ +|, aux::session_settings const& settings                                                                                                                                        |
│ │ │ │ │ +|	, aux::portmap_callback& cb                                                                                                                                                   |
│ │ │ │ │ +|	, address_v4 const listen_address                                                                                                                                             |
│ │ │ │ │ +|	, address_v4 const netmask                                                                                                                                                    |
│ │ │ │ │ +|	, std::string listen_device                                                                                                                                                   |
│ │ │ │ │ +|	, listen_socket_handle ls)                                                                                                                                                    |
│ │ │ │ │ +|	: m_settings(settings)                                                                                                                                                        |
│ │ │ │ │ +|	, m_callback(cb)                                                                                                                                                              |
│ │ │ │ │ +|	, m_io_service(ios)                                                                                                                                                           |
│ │ │ │ │ +|	, m_resolver(ios)                                                                                                                                                             |
│ │ │ │ │ +|	, m_multicast(ios)                                                                                                                                                            |
│ │ │ │ │ +|	, m_unicast(ios)                                                                                                                                                              |
│ │ │ │ │ +|	, m_broadcast_timer(ios)                                                                                                                                                      |
│ │ │ │ │ +|	, m_refresh_timer(ios)                                                                                                                                                        |
│ │ │ │ │ +|	, m_map_timer(ios)                                                                                                                                                            |
│ │ │ │ │ +|	, m_listen_address(listen_address)                                                                                                                                            |
│ │ │ │ │ +|	, m_netmask(netmask)                                                                                                                                                          |
│ │ │ │ │ +|	, m_device(std::move(listen_device))                                                                                                                                          |
│ │ │ │ │ +|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ +|	, m_ssl_ctx(ssl::context::sslv23_client)                                                                                                                                      |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	, m_listen_handle(std::move(ls))                                                                                                                                              |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ +|	m_ssl_ctx.set_verify_mode(ssl::context::verify_none);                                                                                                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|void upnp::start()                                                                                                                                                             |
│ │ │ │ │ +|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_p_a_t_h_._c_p_p_:_4_2_9_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t_ _t_h_i_s_ _o_n_ _a_ _F_A_T_ _v_o_l_u_m_e_ _t_o_ _s_e_e_ _w_h_a_t_ _e_r_r_o_r_ _w_e_ _g_e_t_!_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt tthhiiss oonn aa FFAATT vvoolluummee ttoo sseeee wwhhaatt eerrrroorr wwee ggeett!! **********                                                                                                                |
│ │ │ │ │ +|****** ....//ssrrcc//ppaatthh..ccpppp::442299 ******                                                                                                                                                    |
│ │ │ │ │ +|// it's possible CreateHardLink will copy the file internally too,                                                                                                             |
│ │ │ │ │ +|			// if the filesystem does not support it.                                                                                                                                   |
│ │ │ │ │ +|			ec.assign(GetLastError(), system_category());                                                                                                                               |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// fall back to making a copy                                                                                                                                                |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		// assume posix's link() function exists                                                                                                                                     |
│ │ │ │ │ +|		int ret = ::link(n_exist.c_str(), n_link.c_str());                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (ret == 0)                                                                                                                                                                |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			ret += *str;                                                                                                                                                                |
│ │ │ │ │ -|			++str;                                                                                                                                                                      |
│ │ │ │ │ +|			ec.clear();                                                                                                                                                                 |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		// skip the delimiter as well                                                                                                                                                |
│ │ │ │ │ -|		while (str != end && *str == delim) ++str;                                                                                                                                   |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string maybe_url_encode(std::string const& url)                                                                                                                          |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::string protocol, host, auth, path;                                                                                                                                      |
│ │ │ │ │ -|		int port;                                                                                                                                                                    |
│ │ │ │ │ -|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ -|		std::tie(protocol, auth, host, port, path) = parse_url_components(url, ec);                                                                                                  |
│ │ │ │ │ -|		if (ec) return url;                                                                                                                                                          |
│ │ │ │ │ +|		// most errors are passed through, except for the ones that indicate that                                                                                                    |
│ │ │ │ │ +|		// hard links are not supported and require a copy.                                                                                                                          |
│ │ │ │ │ +|if (errno != EMLINK                                                                                                                                                            |
│ │ │ │ │ +|&& errno != EXDEV                                                                                                                                                              |
│ │ │ │ │ +|#ifdef TORRENT_BEOS                                                                                                                                                            |
│ │ │ │ │ +|			// haiku returns EPERM when the filesystem doesn't support hard link                                                                                                        |
│ │ │ │ │ +|			&& errno != EPERM                                                                                                                                                           |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			)                                                                                                                                                                           |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// some error happened, report up to the caller                                                                                                                             |
│ │ │ │ │ +|			ec.assign(errno, system_category());                                                                                                                                        |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// first figure out if this url contains unencoded characters                                                                                                                |
│ │ │ │ │ -|		if (!need_encoding(path.c_str(), int(path.size())))                                                                                                                          |
│ │ │ │ │ -|			return url;                                                                                                                                                                 |
│ │ │ │ │ +|		// fall back to making a copy                                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		std::string msg;                                                                                                                                                             |
│ │ │ │ │ -|		std::string escaped_path { escape_path(path) };                                                                                                                              |
│ │ │ │ │ -|		// reserve enough space so further append will                                                                                                                               |
│ │ │ │ │ -|_	_	_/_/_ _o_n_l_y_ _c_o_p_y_ _v_a_l_u_e_s_ _t_o_ _e_x_i_s_t_i_n_g_ _l_o_c_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// if we get here, we should copy the file                                                                                                                                   |
│ │ │ │ │ +|		storage_error se;                                                                                                                                                            |
│ │ │ │ │ +|		aux::copy_file(file, link, se);                                                                                                                                              |
│ │ │ │ │ +|		ec = se.ec;                                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	bool is_directory(std::string const& f, error_code& ec)                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ +|		error_code e;                                                                                                                                                                |
│ │ │ │ │ +|		file_status s;                                                                                                                                                               |
│ │ │ │ │ +|		stat_file(f, &s, e);                                                                                                                                                         |
│ │ │ │ │ +|		if (!e && s.mode & file_status::directory) return true;                                                                                                                      |
│ │ │ │ │ +|_	_	_e_c_ _=_ _e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 2|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |this should probably be based on time instead of number of request messages. For a very high throughput connection, 300 may be a    |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_2_5_6_2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_l_e_g_i_t_i_m_a_t_e_ _n_u_m_b_e_r_ _o_f_ _r_e_q_u_e_s_t_s_ _t_o_ _h_a_v_e_ _i_n_ _f_l_i_g_h_t_ _w_h_e_n_ _g_e_t_t_i_n_g_ _c_h_o_k_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** tthhiiss sshhoouulldd pprroobbaabbllyy bbee bbaasseedd oonn ttiimmee iinnsstteeaadd ooff nnuummbbeerr ooff rreeqquueesstt mmeessssaaggeess.. FFoorr aa vveerryy hhiigghh tthhrroouugghhppuutt ccoonnnneeccttiioonn,, 330000 mmaayy bbee aa lleeggiittiimmaattee nnuummbbeerr ooff rreeqquueessttss ttoo hhaavvee iinn|
│ │ │ │ │  |fflliigghhtt wwhheenn ggeettttiinngg cchhookkeedd **********                                                                                                                                               |
│ │ │ │ │  |****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::22556622 ******                                                                                                                                        |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ @@ -3323,14 +3178,177 @@
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |			disconnect(errors::timed_out_no_handshake, operation_t::bittorrent);                                                                                                        |
│ │ │ │ │  |			return;                                                                                                                                                                     |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// disconnect peers that we unchoked, but they didn't send a request in                                                                                                      |
│ │ │ │ │  |_	_	_/_/_ _t_h_e_ _l_a_s_t_ _6_0_ _s_e_c_o_n_d_s_,_ _a_n_d_ _w_e_ _h_a_v_e_n_'_t_ _b_e_e_n_ _w_o_r_k_i_n_g_ _o_n_ _s_e_r_v_i_c_i_n_g_ _a_ _r_e_q_u_e_s_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_b_d_e_c_o_d_e_._c_p_p_:_8_2_6_ _ _ _ _ _ _ _ _|_a_t_t_e_m_p_t_ _t_o_ _s_i_m_p_l_i_f_y_ _t_h_i_s_ _i_m_p_l_e_m_e_n_t_a_t_i_o_n_ _b_y_ _e_m_b_r_a_c_i_n_g_ _t_h_e_ _s_p_a_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** aatttteemmpptt ttoo ssiimmpplliiffyy tthhiiss iimmpplleemmeennttaattiioonn bbyy eemmbbrraacciinngg tthhee ssppaann **********                                                                                                      |
│ │ │ │ │ +|****** ....//ssrrcc//bbddeeccooddee..ccpppp::882266 ******                                                                                                                                                 |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	bdecode_node bdecode(span<char const> buffer                                                                                                                                  |
│ │ │ │ │ +|		, error_code& ec, int* error_pos, int depth_limit, int token_limit)                                                                                                          |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		bdecode_node ret;                                                                                                                                                            |
│ │ │ │ │ +|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (buffer.size() > bdecode_token::max_offset)                                                                                                                               |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (error_pos) *error_pos = 0;                                                                                                                                              |
│ │ │ │ │ +|			ec = bdecode_errors::limit_exceeded;                                                                                                                                        |
│ │ │ │ │ +|			return ret;                                                                                                                                                                 |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// this is the stack of bdecode_token indices, into m_tokens.                                                                                                                |
│ │ │ │ │ +|		// sp is the stack pointer, as index into the array, stack                                                                                                                   |
│ │ │ │ │ +|		int sp = 0;                                                                                                                                                                  |
│ │ │ │ │ +|		TORRENT_ALLOCA(stack, stack_frame, depth_limit);                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|char const* start = buffer.data();                                                                                                                                             |
│ │ │ │ │ +|char const* end = start + buffer.size();                                                                                                                                       |
│ │ │ │ │ +|		char const* const orig_start = start;                                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (start == end)                                                                                                                                                            |
│ │ │ │ │ +|			TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		while (start <= end)                                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (start >= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (sp >= depth_limit)                                                                                                                                                      |
│ │ │ │ │ +|				TORRENT_FAIL_BDECODE(bdecode_errors::depth_exceeded);                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			--token_limit;                                                                                                                                                              |
│ │ │ │ │ +|			if (token_limit < 0)                                                                                                                                                        |
│ │ │ │ │ +|				TORRENT_FAIL_BDECODE(bdecode_errors::limit_exceeded);                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// look for a new token                                                                                                                                                     |
│ │ │ │ │ +|			char const t = *start;                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			int const current_frame = sp;                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// if we're currently parsing a dictionary, assert that                                                                                                                     |
│ │ │ │ │ +|			// every other node is a string.                                                                                                                                            |
│ │ │ │ │ +|			if (current_frame > 0                                                                                                                                                       |
│ │ │ │ │ +|				&& ret.m_tokens[stack[current_frame - 1].token].type == bdecode_token::dict)                                                                                               |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				if (stack[current_frame - 1].state == 0)                                                                                                                                   |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|_	_	_	_	_	_/_/_ _t_h_e_ _c_u_r_r_e_n_t_ _p_a_r_e_n_t_ _i_s_ _a_ _d_i_c_t_ _a_n_d_ _w_e_ _a_r_e_ _p_a_r_s_i_n_g_ _a_ _k_e_y_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 2|_._._/_s_r_c_/                       |support authentication here. tracker_req().auth                                                                                     |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_u_d_p___t_r_a_c_k_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:_8_1_ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ssuuppppoorrtt aauutthheennttiiccaattiioonn hheerree.. ttrraacckkeerr__rreeqq(())..aauutthh **********                                                                                                                    |
│ │ │ │ │ +|****** ....//ssrrcc//uuddpp__ttrraacckkeerr__ccoonnnneeccttiioonn..ccpppp::8811 ******                                                                                                                                   |
│ │ │ │ │ +|udp_tracker_connection::m_connection_cache;                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	std::mutex udp_tracker_connection::m_cache_mutex;                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	udp_tracker_connection::udp_tracker_connection(                                                                                                                               |
│ │ │ │ │ +|		io_context& ios                                                                                                                                                              |
│ │ │ │ │ +|		, tracker_manager& man                                                                                                                                                       |
│ │ │ │ │ +|		, tracker_request const& req                                                                                                                                                 |
│ │ │ │ │ +|		, std::weak_ptr<request_callback> c)                                                                                                                                         |
│ │ │ │ │ +|		: tracker_connection(man, req, ios, std::move(c))                                                                                                                            |
│ │ │ │ │ +|		, m_transaction_id(0)                                                                                                                                                        |
│ │ │ │ │ +|		, m_attempts(0)                                                                                                                                                              |
│ │ │ │ │ +|		, m_state(action_t::error)                                                                                                                                                   |
│ │ │ │ │ +|		, m_abort(false)                                                                                                                                                             |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		update_transaction_id();                                                                                                                                                     |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void udp_tracker_connection::start()                                                                                                                                          |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|std::string hostname;                                                                                                                                                          |
│ │ │ │ │ +|std::string protocol;                                                                                                                                                          |
│ │ │ │ │ +|		int port;                                                                                                                                                                    |
│ │ │ │ │ +|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		std::tie(protocol, std::ignore, hostname, port, std::ignore)                                                                                                                 |
│ │ │ │ │ +|			= parse_url_components(tracker_req().url, ec);                                                                                                                              |
│ │ │ │ │ +|		if (port == -1) port = protocol == "http" ? 80 : 443;                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (ec)                                                                                                                                                                      |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			tracker_connection::fail(ec, operation_t::parse_address);                                                                                                                   |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		aux::session_settings const& settings = m_man.settings();                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		int const proxy_type = settings.get_int(settings_pack::proxy_type);                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (settings.get_bool(settings_pack::proxy_hostnames)                                                                                                                        |
│ │ │ │ │ +|			&& (proxy_type == settings_pack::socks5                                                                                                                                     |
│ │ │ │ │ +|				|| proxy_type == settings_pack::socks5_pw))                                                                                                                                |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			m_hostname = hostname;                                                                                                                                                      |
│ │ │ │ │ +|			m_target.port(std::uint16_t(port));                                                                                                                                         |
│ │ │ │ │ +|			start_announce();                                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			using namespace std::placeholders;                                                                                                                                          |
│ │ │ │ │ +|_	_	_	_A_D_D___O_U_T_S_T_A_N_D_I_N_G___A_S_Y_N_C_(_"_u_d_p___t_r_a_c_k_e_r___c_o_n_n_e_c_t_i_o_n_:_:_n_a_m_e___l_o_o_k_u_p_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_a_l_e_r_t___m_a_n_a_g_e_r_._c_p_p_:_8_0_ _ _ _|_k_e_e_p_ _a_ _c_o_u_n_t_ _o_f_ _t_h_e_ _n_u_m_b_e_r_ _o_f_ _t_h_r_e_a_d_s_ _w_a_i_t_i_n_g_._ _O_n_l_y_ _i_f_ _i_t_'_s_ _>_ _0_ _n_o_t_i_f_y_ _t_h_e_m_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** kkeeeepp aa ccoouunntt ooff tthhee nnuummbbeerr ooff tthhrreeaaddss wwaaiittiinngg.. OOnnllyy iiff iitt''ss >> 00 nnoottiiffyy tthheemm **********                                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//aalleerrtt__mmaannaaggeerr..ccpppp::8800 ******                                                                                                                                            |
│ │ │ │ │ +|return m_alerts[m_generation].front();                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// this call can be interrupted prematurely by other signals                                                                                                                 |
│ │ │ │ │ +|		m_condition.wait_for(lock, max_wait);                                                                                                                                        |
│ │ │ │ │ +|		if (!m_alerts[m_generation].empty())                                                                                                                                         |
│ │ │ │ │ +|			return m_alerts[m_generation].front();                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		return nullptr;                                                                                                                                                              |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void alert_manager::maybe_notify(alert* a)                                                                                                                                    |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		if (m_alerts[m_generation].size() == 1)                                                                                                                                      |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// we just posted to an empty queue. If anyone is waiting for                                                                                                               |
│ │ │ │ │ +|			// alerts, we need to notify them. Also (potentially) call the                                                                                                              |
│ │ │ │ │ +|			// user supplied m_notify callback to let the client wake up its                                                                                                            |
│ │ │ │ │ +|			// message loop to poll for alerts.                                                                                                                                         |
│ │ │ │ │ +|			if (m_notify) m_notify();                                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|m_condition.notify_all();                                                                                                                                                      |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_EXTENSIONS                                                                                                                                             |
│ │ │ │ │ +|		for (auto& e : m_ses_extensions)                                                                                                                                             |
│ │ │ │ │ +|			e->on_alert(a);                                                                                                                                                             |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		TORRENT_UNUSED(a);                                                                                                                                                           |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void alert_manager::set_notify_function(std::function<void()> const& fun)                                                                                                     |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		std::unique_lock<std::recursive_mutex> lock(m_mutex);                                                                                                                        |
│ │ │ │ │ +|		m_notify = fun;                                                                                                                                                              |
│ │ │ │ │ +|		if (!m_alerts[m_generation].empty())                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (m_notify) m_notify();                                                                                                                                                   |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_EXTENSIONS                                                                                                                                             |
│ │ │ │ │ +|	void alert_manager::add_extension(std::shared_ptr<plugin> ext)                                                                                                                |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		m_ses_extensions.push_back(std::move(ext));                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void alert_manager::get_all(std::vector<alert*>& alerts)                                                                                                                      |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|_	_	_s_t_d_:_:_l_o_c_k___g_u_a_r_d_<_s_t_d_:_:_r_e_c_u_r_s_i_v_e___m_u_t_e_x_>_ _l_o_c_k_(_m___m_u_t_e_x_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_t_r_a_c_k_e_r___m_a_n_a_g_e_r_._c_p_p_:_3_6_9_|_i_m_p_l_e_m_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** iimmpplleemmeenntt **********                                                                                                                                                          |
│ │ │ │ │  |****** ....//ssrrcc//ttrraacckkeerr__mmaannaaggeerr..ccpppp::336699 ******                                                                                                                                         |
│ │ │ │ │  |#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │  |			if (m_ses.should_log())                                                                                                                                                     |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │  |				m_ses.session_log("incoming UDP tracker packet from %s has invalid "                                                                                                       |
│ │ │ │ │ @@ -3540,284 +3558,68 @@
│ │ │ │ │  |		TORRENT_ASSERT(info.num_peers == 0);                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		TORRENT_ASSERT(i->writing > 0);                                                                                                                                              |
│ │ │ │ │  |		TORRENT_ASSERT(info.state == block_info::state_writing);                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		if (info.state == block_info::state_finished) return;                                                                                                                        |
│ │ │ │ │  |_	_	_i_f_ _(_i_n_f_o_._s_t_a_t_e_ _=_=_ _b_l_o_c_k___i_n_f_o_:_:_s_t_a_t_e___w_r_i_t_i_n_g_)_ _-_-_i_-_>_w_r_i_t_i_n_g_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_5_0_4_ _ _ _ _ _ _ _ _|_p_o_s_t_ _a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ppoosstt aalleerrtt **********                                                                                                                                                         |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::550044 ******                                                                                                                                                 |
│ │ │ │ │ -|if (m_current_gauge_state != no_gauge_state)                                                                                                                                   |
│ │ │ │ │ -|			inc_stats_counter(m_current_gauge_state + counters::num_checking_torrents, -1);                                                                                             |
│ │ │ │ │ -|		if (new_gauge_state != no_gauge_state)                                                                                                                                       |
│ │ │ │ │ -|			inc_stats_counter(new_gauge_state + counters::num_checking_torrents, 1);                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(new_gauge_state >= 0);                                                                                                                                        |
│ │ │ │ │ -|		TORRENT_ASSERT(new_gauge_state <= no_gauge_state);                                                                                                                           |
│ │ │ │ │ -|		m_current_gauge_state = static_cast<std::uint32_t>(new_gauge_state);                                                                                                         |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_e_s_c_a_p_e___s_t_r_i_n_g_._c_p_p_:_1_9_4_ _ _|_t_h_i_s_ _s_h_o_u_l_d_ _p_r_o_b_a_b_l_y_ _b_e_ _m_o_v_e_d_ _i_n_t_o_ _s_t_r_i_n_g___u_t_i_l_._c_p_p_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss sshhoouulldd pprroobbaabbllyy bbee mmoovveedd iinnttoo ssttrriinngg__uuttiill..ccpppp **********                                                                                                                 |
│ │ │ │ │ +|****** ....//ssrrcc//eessccaappee__ssttrriinngg..ccpppp::119944 ******                                                                                                                                           |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		return escape_string_impl(str.data(), int(str.size()), 10);                                                                                                                  |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::leave_seed_mode(seed_mode_t const checking)                                                                                                                     |
│ │ │ │ │ +|	bool need_encoding(char const* str, int const len)                                                                                                                            |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (!m_seed_mode) return;                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (checking == seed_mode_t::check_files)                                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// this means the user promised we had all the                                                                                                                              |
│ │ │ │ │ -|			// files, but it turned out we didn't. This is                                                                                                                              |
│ │ │ │ │ -|			// an error.                                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|			debug_log("*** FAILED SEED MODE, rechecking");                                                                                                                              |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		debug_log("*** LEAVING SEED MODE (%s)"                                                                                                                                       |
│ │ │ │ │ -|			, checking == seed_mode_t::skip_checking ? "as seed" : "as non-seed");                                                                                                      |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		m_seed_mode = false;                                                                                                                                                         |
│ │ │ │ │ -|		// seed is false if we turned out not                                                                                                                                        |
│ │ │ │ │ -|		// to be a seed after all                                                                                                                                                    |
│ │ │ │ │ -|		if (checking == seed_mode_t::check_files                                                                                                                                     |
│ │ │ │ │ -|			&& state() != torrent_status::checking_resume_data)                                                                                                                         |
│ │ │ │ │ +|		for (int i = 0; i < len; ++i)                                                                                                                                                |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_have_all = false;                                                                                                                                                         |
│ │ │ │ │ -|			set_state(torrent_status::downloading);                                                                                                                                     |
│ │ │ │ │ -|			force_recheck();                                                                                                                                                            |
│ │ │ │ │ +|			if (std::strchr(unreserved_chars, *str) == nullptr || *str == 0)                                                                                                            |
│ │ │ │ │ +|				return true;                                                                                                                                                               |
│ │ │ │ │ +|			++str;                                                                                                                                                                      |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		m_num_verified = 0;                                                                                                                                                          |
│ │ │ │ │ -|		m_verified.clear();                                                                                                                                                          |
│ │ │ │ │ -|		m_verifying.clear();                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		set_need_save_resume(torrent_handle::if_state_changed);                                                                                                                      |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::verified(piece_index_t const piece)                                                                                                                             |
│ │ │ │ │ +|	void convert_path_to_posix(std::string& path)                                                                                                                                 |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(!m_verified.get_bit(piece));                                                                                                                                  |
│ │ │ │ │ -|_	_	_+_+_m___n_u_m___v_e_r_i_f_i_e_d_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_8_5_2_ _ _ _ _ _ _ _|_a_d_d_ _a_ _u_n_i_t_ _t_e_s_t_ _w_h_e_r_e_ _w_e_ _d_o_n_'_t_ _h_a_v_e_ _m_e_t_a_d_a_t_a_,_ _c_o_n_n_e_c_t_ _t_o_ _a_ _p_e_e_r_ _t_h_a_t_ _s_e_n_d_s_ _a_ _b_i_t_f_i_e_l_d_ _t_h_a_t_'_s_ _t_o_o_ _l_a_r_g_e_,_ _t_h_e_n_ _w_e_ _g_e_t_ _t_h_e_ _m_e_t_a_d_a_t_a_ _ _ _ |
│ │ │ │ │ -|********** aadddd aa uunniitt tteesstt wwhheerree wwee ddoonn''tt hhaavvee mmeettaaddaattaa,, ccoonnnneecctt ttoo aa ppeeeerr tthhaatt sseennddss aa bbiittffiieelldd tthhaatt''ss ttoooo llaarrggee,, tthheenn wwee ggeett tthhee mmeettaaddaattaa **********                                   |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::11885522 ******                                                                                                                                                |
│ │ │ │ │ -|for (auto const& f : m_add_torrent_params->renamed_files)                                                                                                                      |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				if (f.first < file_index_t(0) || f.first >= fs.end_file()) continue;                                                                                                       |
│ │ │ │ │ -|				m_torrent_file->rename_file(file_index_t(f.first), f.second);                                                                                                              |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		construct_storage();                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_SHARE_MODE                                                                                                                                             |
│ │ │ │ │ -|		if (m_share_mode && valid_metadata())                                                                                                                                        |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// in share mode, all pieces have their priorities initialized to 0                                                                                                         |
│ │ │ │ │ -|			m_file_priority.clear();                                                                                                                                                    |
│ │ │ │ │ -|			m_file_priority.resize(m_torrent_file->num_files(), dont_download);                                                                                                         |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// it's important to initialize the peers early, because this is what will                                                                                                   |
│ │ │ │ │ -|		// fix up their have-bitmasks to have the correct size                                                                                                                       |
│ │ │ │ │ -|if (!m_connections_initialized)                                                                                                                                                |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|			m_connections_initialized = true;                                                                                                                                           |
│ │ │ │ │ -|			// all peer connections have to initialize themselves now that the metadata                                                                                                 |
│ │ │ │ │ -|			// is available                                                                                                                                                             |
│ │ │ │ │ -|			// copy the peer list since peers may disconnect and invalidate                                                                                                             |
│ │ │ │ │ -|			// m_connections as we initialize them                                                                                                                                      |
│ │ │ │ │ -|			for (auto c : m_connections)                                                                                                                                                |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				auto pc = c->self();                                                                                                                                                       |
│ │ │ │ │ -|				if (pc->is_disconnecting()) continue;                                                                                                                                      |
│ │ │ │ │ -|				pc->on_metadata_impl();                                                                                                                                                    |
│ │ │ │ │ -|				if (pc->is_disconnecting()) continue;                                                                                                                                      |
│ │ │ │ │ -|				pc->init();                                                                                                                                                                |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// in case file priorities were passed in via the add_torrent_params                                                                                                         |
│ │ │ │ │ -|		// and also in the case of share mode, we need to update the priorities                                                                                                      |
│ │ │ │ │ -|		// this has to be applied before piece priority                                                                                                                              |
│ │ │ │ │ -|		if (!m_file_priority.empty())                                                                                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// m_file_priority was loaded from the resume data, this doesn't                                                                                                            |
│ │ │ │ │ -|			// alter any state that needs to be saved in the resume data                                                                                                                |
│ │ │ │ │ -|			auto const ns = m_need_save_resume_data;                                                                                                                                    |
│ │ │ │ │ -|			update_piece_priorities(m_file_priority);                                                                                                                                   |
│ │ │ │ │ -|			m_need_save_resume_data = ns;                                                                                                                                               |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_add_torrent_params)                                                                                                                                                    |
│ │ │ │ │ -|_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_4_9_2_ _ _ _ _ _ _ _|_u_s_e_ _c_h_r_o_n_o_ _t_y_p_e_ _f_o_r_ _t_i_m_e_ _d_u_r_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** uussee cchhrroonnoo ttyyppee ffoorr ttiimmee dduurraattiioonn **********                                                                                                                                  |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::44449922 ******                                                                                                                                                |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		m_picker->piece_passed(index);                                                                                                                                               |
│ │ │ │ │ -|		update_gauge();                                                                                                                                                              |
│ │ │ │ │ -|		we_have(index);                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (should_log())                                                                                                                                                            |
│ │ │ │ │ -|			debug_log("we_have(%d) (num_have: %d)", int(index), num_have());                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_STREAMING                                                                                                                                              |
│ │ │ │ │ -|		remove_time_critical_piece(index, true);                                                                                                                                     |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		std::replace(path.begin(), path.end(), '\\', '/');                                                                                                                           |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_PREDICTIVE_PIECES                                                                                                                                      |
│ │ │ │ │ -|	// we believe we will complete this piece very soon                                                                                                                           |
│ │ │ │ │ -|	// announce it to peers ahead of time to eliminate the                                                                                                                        |
│ │ │ │ │ -|	// round-trip times involved in announcing it, requesting it                                                                                                                  |
│ │ │ │ │ -|	// and sending it                                                                                                                                                             |
│ │ │ │ │ -|void torrent::predicted_have_piece(piece_index_t const index, int const milliseconds)                                                                                          |
│ │ │ │ │ +|std::string read_until(char const*& str, char const delim, char const* end)                                                                                                    |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|		auto const i = std::lower_bound(m_predictive_pieces.begin()                                                                                                                  |
│ │ │ │ │ -|			, m_predictive_pieces.end(), index);                                                                                                                                        |
│ │ │ │ │ -|		if (i != m_predictive_pieces.end() && *i == index) return;                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		for (auto p : m_connections)                                                                                                                                                 |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			TORRENT_INCREMENT(m_iterating_connections);                                                                                                                                 |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|			p->peer_log(peer_log_alert::outgoing, "PREDICTIVE_HAVE", "piece: %d expected in %d ms"                                                                                      |
│ │ │ │ │ -|				, static_cast<int>(index), milliseconds);                                                                                                                                  |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|			TORRENT_UNUSED(milliseconds);                                                                                                                                               |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			p->announce_piece(index);                                                                                                                                                   |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		m_predictive_pieces.insert(i, index);                                                                                                                                        |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// blocks may contain the block indices of the blocks that failed (if this is                                                                                                 |
│ │ │ │ │ -|	// a v2 torrent).                                                                                                                                                             |
│ │ │ │ │ -|	void torrent::piece_failed(piece_index_t const index, std::vector<int> blocks)                                                                                                |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		// if the last piece fails the peer connection will still                                                                                                                    |
│ │ │ │ │ -|		// think that it has received all of it until this function                                                                                                                  |
│ │ │ │ │ -|		// resets the download queue. So, we cannot do the                                                                                                                           |
│ │ │ │ │ -|		// invariant check here since it assumes:                                                                                                                                    |
│ │ │ │ │ -|_	_	_/_/_ _(_t_o_t_a_l___d_o_n_e_ _=_=_ _m___t_o_r_r_e_n_t___f_i_l_e_-_>_t_o_t_a_l___s_i_z_e_(_)_)_ _=_>_ _i_s___s_e_e_d_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_9_1_9_ _ _ _ _ _ _ _|_a_b_o_r_t_ _l_o_o_k_u_p_s_ _t_h_i_s_ _t_o_r_r_e_n_t_ _h_a_s_ _m_a_d_e_ _v_i_a_ _t_h_e_ _s_e_s_s_i_o_n_ _h_o_s_t_ _r_e_s_o_l_v_e_r_ _i_n_t_e_r_f_a_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** aabboorrtt llooookkuuppss tthhiiss ttoorrrreenntt hhaass mmaaddee vviiaa tthhee sseessssiioonn hhoosstt rreessoollvveerr iinntteerrffaaccee **********                                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::44991199 ******                                                                                                                                                |
│ │ │ │ │ -|TORRENT_UNUSED(e);                                                                                                                                                             |
│ │ │ │ │ -|				m_storage.reset();                                                                                                                                                         |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|				debug_log("Failed to flush disk cache: %s", e.what());                                                                                                                     |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|				// clients may rely on this alert to be posted, so it's probably a                                                                                                         |
│ │ │ │ │ -|				// good idea to post it here, even though we failed                                                                                                                        |
│ │ │ │ │ -|				if (alerts().should_post<cache_flushed_alert>())                                                                                                                           |
│ │ │ │ │ -|					alerts().emplace_alert<cache_flushed_alert>(get_handle());                                                                                                                |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			m_ses.deferred_submit_jobs();                                                                                                                                               |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (alerts().should_post<cache_flushed_alert>())                                                                                                                            |
│ │ │ │ │ -|				alerts().emplace_alert<cache_flushed_alert>(get_handle());                                                                                                                 |
│ │ │ │ │ -|			alerts().emplace_alert<torrent_removed_alert>(get_handle()                                                                                                                  |
│ │ │ │ │ -|				, info_hash(), get_userdata());                                                                                                                                            |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|if (!m_apply_ip_filter)                                                                                                                                                        |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			inc_stats_counter(counters::non_filter_torrents, -1);                                                                                                                       |
│ │ │ │ │ -|			m_apply_ip_filter = true;                                                                                                                                                   |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|		TORRENT_ASSERT(str <= end);                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		m_paused = false;                                                                                                                                                            |
│ │ │ │ │ -|		m_auto_managed = false;                                                                                                                                                      |
│ │ │ │ │ -|		update_state_list();                                                                                                                                                         |
│ │ │ │ │ -|		for (torrent_list_index_t i{}; i != m_links.end_index(); ++i)                                                                                                                |
│ │ │ │ │ +|		std::string ret;                                                                                                                                                             |
│ │ │ │ │ +|		while (str != end && *str != delim)                                                                                                                                          |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (!m_links[i].in_list()) continue;                                                                                                                                        |
│ │ │ │ │ -|			m_links[i].unlink(m_ses.torrent_list(i), i);                                                                                                                                |
│ │ │ │ │ +|			ret += *str;                                                                                                                                                                |
│ │ │ │ │ +|			++str;                                                                                                                                                                      |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		// don't re-add this torrent to the state-update list                                                                                                                        |
│ │ │ │ │ -|		m_state_subscription = false;                                                                                                                                                |
│ │ │ │ │ +|		// skip the delimiter as well                                                                                                                                                |
│ │ │ │ │ +|		while (str != end && *str == delim) ++str;                                                                                                                                   |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// this is called when we're destructing non-gracefully. i.e. we're _just_                                                                                                    |
│ │ │ │ │ -|	// destructing everything.                                                                                                                                                    |
│ │ │ │ │ -|	void torrent::panic()                                                                                                                                                         |
│ │ │ │ │ +|	std::string maybe_url_encode(std::string const& url)                                                                                                                          |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		m_storage.reset();                                                                                                                                                           |
│ │ │ │ │ -|		// if there are any other peers allocated still, we need to clear them                                                                                                       |
│ │ │ │ │ -|		// now. They can't be cleared later because the allocator will already                                                                                                       |
│ │ │ │ │ -|		// have been destructed                                                                                                                                                      |
│ │ │ │ │ -|		if (m_peer_list) m_peer_list->clear();                                                                                                                                       |
│ │ │ │ │ -|		m_connections.clear();                                                                                                                                                       |
│ │ │ │ │ -|		m_outgoing_pids.clear();                                                                                                                                                     |
│ │ │ │ │ -|_	_	_m___p_e_e_r_s___t_o___d_i_s_c_o_n_n_e_c_t_._c_l_e_a_r_(_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 2|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_8_0_3_2       |if peer is a really good peer, maybe we shouldn't disconnect it perhaps this logic should be disabled if we have too many idle peers|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_(_w_i_t_h_ _s_o_m_e_ _d_e_f_i_n_i_t_i_o_n_ _o_f_ _i_d_l_e_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iiff ppeeeerr iiss aa rreeaallllyy ggoooodd ppeeeerr,, mmaayybbee wwee sshhoouullddnn''tt ddiissccoonnnneecctt iitt ppeerrhhaappss tthhiiss llooggiicc sshhoouulldd bbee ddiissaabblleedd iiff wwee hhaavvee ttoooo mmaannyy iiddllee ppeeeerrss ((wwiitthh ssoommee ddeeffiinniittiioonn ooff iiddllee)) **********|
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::88003322 ******                                                                                                                                                |
│ │ │ │ │ -|		m_peers_to_disconnect.reserve(m_connections.size() + 1);                                                                                                                     |
│ │ │ │ │ -|		m_connections.reserve(m_connections.size() + 1);                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ +|		std::string protocol, host, auth, path;                                                                                                                                      |
│ │ │ │ │ +|		int port;                                                                                                                                                                    |
│ │ │ │ │  |		error_code ec;                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(p->remote() == p->get_socket().remote_endpoint(ec) || ec);                                                                                                    |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(p->peer_info_struct() != nullptr);                                                                                                                            |
│ │ │ │ │ +|		std::tie(protocol, auth, host, port, path) = parse_url_components(url, ec);                                                                                                  |
│ │ │ │ │ +|		if (ec) return url;                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// we need to do this after we've added the peer to the peer_list                                                                                                            |
│ │ │ │ │ -|		// since that's when the peer is assigned its peer_info object,                                                                                                              |
│ │ │ │ │ -|		// which holds the rank                                                                                                                                                      |
│ │ │ │ │ -|		if (maybe_replace_peer)                                                                                                                                                      |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// now, find the lowest rank peer and disconnect that                                                                                                                       |
│ │ │ │ │ -|			// if it's lower rank than the incoming connection                                                                                                                          |
│ │ │ │ │ -|			peer_connection* peer = find_lowest_ranking_peer();                                                                                                                         |
│ │ │ │ │ +|		// first figure out if this url contains unencoded characters                                                                                                                |
│ │ │ │ │ +|		if (!need_encoding(path.c_str(), int(path.size())))                                                                                                                          |
│ │ │ │ │ +|			return url;                                                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|if (peer != nullptr && peer->peer_rank() < p->peer_rank())                                                                                                                     |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|				if (should_log())                                                                                                                                                          |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					debug_log("CLOSING CONNECTION \"%s\" peer list full (low peer rank) "                                                                                                     |
│ │ │ │ │ -|						"connections: %d limit: %d"                                                                                                                                              |
│ │ │ │ │ -|						, print_endpoint(peer->remote()).c_str()                                                                                                                                 |
│ │ │ │ │ -|						, num_peers()                                                                                                                                                            |
│ │ │ │ │ -|						, m_max_connections);                                                                                                                                                    |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|				peer->disconnect(errors::too_many_connections, operation_t::bittorrent);                                                                                                   |
│ │ │ │ │ -|				p->peer_disconnected_other();                                                                                                                                              |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|				if (should_log())                                                                                                                                                          |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					debug_log("CLOSING CONNECTION \"%s\" peer list full (low peer rank) "                                                                                                     |
│ │ │ │ │ -|						"connections: %d limit: %d"                                                                                                                                              |
│ │ │ │ │ -|						, print_endpoint(p->remote()).c_str()                                                                                                                                    |
│ │ │ │ │ -|						, num_peers()                                                                                                                                                            |
│ │ │ │ │ -|						, m_max_connections);                                                                                                                                                    |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|				p->disconnect(errors::too_many_connections, operation_t::bittorrent);                                                                                                      |
│ │ │ │ │ -|				// we have to do this here because from the peer's point of view                                                                                                           |
│ │ │ │ │ -|				// it wasn't really attached to the torrent, but we do need                                                                                                                |
│ │ │ │ │ -|_	_	_	_	_/_/_ _t_o_ _l_e_t_ _p_e_e_r___l_i_s_t_ _k_n_o_w_ _w_e_'_r_e_ _r_e_m_o_v_i_n_g_ _i_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|		std::string msg;                                                                                                                                                             |
│ │ │ │ │ +|		std::string escaped_path { escape_path(path) };                                                                                                                              |
│ │ │ │ │ +|		// reserve enough space so further append will                                                                                                                               |
│ │ │ │ │ +|_	_	_/_/_ _o_n_l_y_ _c_o_p_y_ _v_a_l_u_e_s_ _t_o_ _e_x_i_s_t_i_n_g_ _l_o_c_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |           |_._._/_s_r_c_/                       |                                                                                                                                    |
│ │ │ │ │  |relevance 2|_h_t_t_p___t_r_a_c_k_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:  |returning a bool here is redundant. Instead this function should return the peer_entry                                              |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_4_7_9_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** rreettuurrnniinngg aa bbooooll hheerree iiss rreedduunnddaanntt.. IInnsstteeaadd tthhiiss ffuunnccttiioonn sshhoouulldd rreettuurrnn tthhee ppeeeerr__eennttrryy **********                                                                             |
│ │ │ │ │  |****** ....//ssrrcc//hhttttpp__ttrraacckkeerr__ccoonnnneeccttiioonn..ccpppp::447799 ******                                                                                                                                 |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │  |			cb->tracker_scrape_response(tracker_req(), resp.complete                                                                                                                    |
│ │ │ │ │ @@ -3866,124 +3668,322 @@
│ │ │ │ │  |			return false;                                                                                                                                                               |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |		ret.hostname = i.string_value().to_string();                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// extract port                                                                                                                                                              |
│ │ │ │ │  |		i = info.dict_find_int("port");                                                                                                                                              |
│ │ │ │ │  |_	_	_i_f_ _(_!_i_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_p_a_t_h_._c_p_p_:_4_2_9_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t_ _t_h_i_s_ _o_n_ _a_ _F_A_T_ _v_o_l_u_m_e_ _t_o_ _s_e_e_ _w_h_a_t_ _e_r_r_o_r_ _w_e_ _g_e_t_!_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt tthhiiss oonn aa FFAATT vvoolluummee ttoo sseeee wwhhaatt eerrrroorr wwee ggeett!! **********                                                                                                                |
│ │ │ │ │ -|****** ....//ssrrcc//ppaatthh..ccpppp::442299 ******                                                                                                                                                    |
│ │ │ │ │ -|// it's possible CreateHardLink will copy the file internally too,                                                                                                             |
│ │ │ │ │ -|			// if the filesystem does not support it.                                                                                                                                   |
│ │ │ │ │ -|			ec.assign(GetLastError(), system_category());                                                                                                                               |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_9_9_ _ _ _|_i_s_ _t_h_e_r_e_ _a_ _r_e_a_s_o_n_ _n_o_t_ _t_o_ _m_o_v_e_ _a_l_l_ _o_f_ _t_h_i_s_ _i_n_t_o_ _i_n_i_t_(_)_?_ _a_n_d_ _j_u_s_t_ _p_o_s_t_ _i_t_ _t_o_ _t_h_e_ _i_o___c_o_n_t_e_x_t_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iiss tthheerree aa rreeaassoonn nnoott ttoo mmoovvee aallll ooff tthhiiss iinnttoo iinniitt(())?? aanndd jjuusstt ppoosstt iitt ttoo tthhee iioo__ccoonntteexxtt?? **********                                                                         |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::559999 ******                                                                                                                                            |
│ │ │ │ │ +|try                                                                                                                                                                            |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		(this->*f)(std::forward<Args>(a)...);                                                                                                                                        |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ +|	catch (system_error const& e) {                                                                                                                                               |
│ │ │ │ │ +|		alerts().emplace_alert<session_error_alert>(e.code(), e.what());                                                                                                             |
│ │ │ │ │ +|		pause();                                                                                                                                                                     |
│ │ │ │ │ +|	} catch (std::exception const& e) {                                                                                                                                           |
│ │ │ │ │ +|		alerts().emplace_alert<session_error_alert>(error_code(), e.what());                                                                                                         |
│ │ │ │ │ +|		pause();                                                                                                                                                                     |
│ │ │ │ │ +|	} catch (...) {                                                                                                                                                               |
│ │ │ │ │ +|		alerts().emplace_alert<session_error_alert>(error_code(), "unknown error");                                                                                                  |
│ │ │ │ │ +|		pause();                                                                                                                                                                     |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// fall back to making a copy                                                                                                                                                |
│ │ │ │ │ +|	// This function is called by the creating thread, not in the message loop's                                                                                                  |
│ │ │ │ │ +|	// io_context thread.                                                                                                                                                         |
│ │ │ │ │ +|void session_impl::start_session()                                                                                                                                             |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		session_log("start session");                                                                                                                                                |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		// assume posix's link() function exists                                                                                                                                     |
│ │ │ │ │ -|		int ret = ::link(n_exist.c_str(), n_link.c_str());                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (ret == 0)                                                                                                                                                                |
│ │ │ │ │ +|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ +|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ +|		m_ssl_ctx.set_default_verify_paths(ec);                                                                                                                                      |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		if (ec) session_log("SSL set_default verify_paths failed: %s", ec.message().c_str());                                                                                        |
│ │ │ │ │ +|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|_#_i_f_ _d_e_f_i_n_e_d_ _T_O_R_R_E_N_T___W_I_N_D_O_W_S_ _&_&_ _d_e_f_i_n_e_d_ _T_O_R_R_E_N_T___U_S_E___O_P_E_N_S_S_L_ _&_&_ _!_d_e_f_i_n_e_d_ _T_O_R_R_E_N_T___W_I_N_R_T_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_7_6_1_ _ _ _|_t_h_e_ _i_p_ _f_i_l_t_e_r_ _s_h_o_u_l_d_ _p_r_o_b_a_b_l_y_ _b_e_ _s_a_v_e_d_ _h_e_r_e_ _t_o_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhee iipp ffiilltteerr sshhoouulldd pprroobbaabbllyy bbee ssaavveedd hheerree ttoooo **********                                                                                                                    |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::776611 ******                                                                                                                                            |
│ │ │ │ │ +|m_lsd_announce_timer.async_wait([this](error_code const& e) {                                                                                                                  |
│ │ │ │ │ +|			wrap(&session_impl::on_lsd_announce, e); } );                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		session_log(" done starting session");                                                                                                                                       |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// this applies unchoke settings from m_settings                                                                                                                             |
│ │ │ │ │ +|		recalculate_unchoke_slots();                                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// apply all m_settings to this session                                                                                                                                      |
│ │ │ │ │ +|		run_all_updates(*this);                                                                                                                                                      |
│ │ │ │ │ +|		reopen_listen_sockets(false);                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_USE_INVARIANT_CHECKS                                                                                                                                               |
│ │ │ │ │ +|		check_invariant();                                                                                                                                                           |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION <= 2                                                                                                                                                   |
│ │ │ │ │ +|void session_impl::save_state(entry* eptr, save_state_flags_t const flags) const                                                                                               |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		entry& e = *eptr;                                                                                                                                                            |
│ │ │ │ │ +|		// make it a dict                                                                                                                                                            |
│ │ │ │ │ +|		e.dict();                                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (flags & session::save_settings)                                                                                                                                          |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			ec.clear();                                                                                                                                                                 |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ +|			entry::dictionary_type& sett = e["settings"].dict();                                                                                                                        |
│ │ │ │ │ +|			save_settings_to_dict(non_default_settings(m_settings), sett);                                                                                                              |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// most errors are passed through, except for the ones that indicate that                                                                                                    |
│ │ │ │ │ -|		// hard links are not supported and require a copy.                                                                                                                          |
│ │ │ │ │ -|if (errno != EMLINK                                                                                                                                                            |
│ │ │ │ │ -|&& errno != EXDEV                                                                                                                                                              |
│ │ │ │ │ -|#ifdef TORRENT_BEOS                                                                                                                                                            |
│ │ │ │ │ -|			// haiku returns EPERM when the filesystem doesn't support hard link                                                                                                        |
│ │ │ │ │ -|			&& errno != EPERM                                                                                                                                                           |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			)                                                                                                                                                                           |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|		if (flags & session::save_dht_settings)                                                                                                                                      |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// some error happened, report up to the caller                                                                                                                             |
│ │ │ │ │ -|			ec.assign(errno, system_category());                                                                                                                                        |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ +|			e["dht"] = dht::save_dht_settings(get_dht_settings());                                                                                                                      |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// fall back to making a copy                                                                                                                                                |
│ │ │ │ │ +|		if (m_dht && (flags & session::save_dht_state))                                                                                                                              |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			e["dht state"] = dht::save_dht_state(m_dht->state());                                                                                                                       |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_EXTENSIONS                                                                                                                                             |
│ │ │ │ │ +|		for (auto const& ext : m_ses_extensions[plugins_all_idx])                                                                                                                    |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			ext->save_state(*eptr);                                                                                                                                                     |
│ │ │ │ │ +|_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 2|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_3_8_8_2  |make a list for torrents that want to be announced on the DHT so we don't have to loop over all torrents, just to find the ones that|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_w_a_n_t_ _t_o_ _a_n_n_o_u_n_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmaakkee aa lliisstt ffoorr ttoorrrreennttss tthhaatt wwaanntt ttoo bbee aannnnoouunncceedd oonn tthhee DDHHTT ssoo wwee ddoonn''tt hhaavvee ttoo lloooopp oovveerr aallll ttoorrrreennttss,, jjuusstt ttoo ffiinndd tthhee oonneess tthhaatt wwaanntt ttoo aannnnoouunnccee **********              |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::33888822 ******                                                                                                                                           |
│ │ │ │ │ +|if (!m_dht_torrents.empty())                                                                                                                                                   |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			std::shared_ptr<torrent> t;                                                                                                                                                 |
│ │ │ │ │ +|			do                                                                                                                                                                          |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				t = m_dht_torrents.front().lock();                                                                                                                                         |
│ │ │ │ │ +|				m_dht_torrents.pop_front();                                                                                                                                                |
│ │ │ │ │ +|			} while (!t && !m_dht_torrents.empty());                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (t)                                                                                                                                                                      |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				t->dht_announce();                                                                                                                                                         |
│ │ │ │ │ +|				return;                                                                                                                                                                    |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		if (m_torrents.empty()) return;                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_next_dht_torrent >= m_torrents.size())                                                                                                                                 |
│ │ │ │ │ +|			m_next_dht_torrent = 0;                                                                                                                                                     |
│ │ │ │ │ +|		m_torrents[m_next_dht_torrent]->dht_announce();                                                                                                                              |
│ │ │ │ │ +|++m_next_dht_torrent;                                                                                                                                                          |
│ │ │ │ │ +|if (m_next_dht_torrent >= m_torrents.size())                                                                                                                                   |
│ │ │ │ │ +|			m_next_dht_torrent = 0;                                                                                                                                                     |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// if we get here, we should copy the file                                                                                                                                   |
│ │ │ │ │ -|		storage_error se;                                                                                                                                                            |
│ │ │ │ │ -|		aux::copy_file(file, link, se);                                                                                                                                              |
│ │ │ │ │ -|		ec = se.ec;                                                                                                                                                                  |
│ │ │ │ │ +|	void session_impl::on_lsd_announce(error_code const& e)                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		COMPLETE_ASYNC("session_impl::on_lsd_announce");                                                                                                                             |
│ │ │ │ │ +|		m_stats_counters.inc_stats_counter(counters::on_lsd_counter);                                                                                                                |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		if (e) return;                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_abort) return;                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		ADD_OUTSTANDING_ASYNC("session_impl::on_lsd_announce");                                                                                                                      |
│ │ │ │ │ +|		// announce on local network every 5 minutes                                                                                                                                 |
│ │ │ │ │ +|		int const delay = std::max(m_settings.get_int(settings_pack::local_service_announce_interval)                                                                                |
│ │ │ │ │ +|			/ std::max(int(m_torrents.size()), 1), 1);                                                                                                                                  |
│ │ │ │ │ +|		m_lsd_announce_timer.expires_after(seconds(delay));                                                                                                                          |
│ │ │ │ │ +|		m_lsd_announce_timer.async_wait([this](error_code const& err) {                                                                                                              |
│ │ │ │ │ +|			wrap(&session_impl::on_lsd_announce, err); });                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_torrents.empty()) return;                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_next_lsd_torrent >= m_torrents.size())                                                                                                                                 |
│ │ │ │ │ +|			m_next_lsd_torrent = 0;                                                                                                                                                     |
│ │ │ │ │ +|		m_torrents[m_next_lsd_torrent]->lsd_announce();                                                                                                                              |
│ │ │ │ │ +|		++m_next_lsd_torrent;                                                                                                                                                        |
│ │ │ │ │ +|		if (m_next_lsd_torrent >= m_torrents.size())                                                                                                                                 |
│ │ │ │ │ +|_	_	_	_m___n_e_x_t___l_s_d___t_o_r_r_e_n_t_ _=_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_5_1_5_ _ _|_t_h_i_s_ _f_u_n_c_t_i_o_n_ _s_h_o_u_l_d_ _b_e_ _r_e_m_o_v_e_d_ _a_n_d_ _u_s_e_r_s_ _n_e_e_d_ _t_o_ _d_e_a_l_ _w_i_t_h_ _t_h_e_ _m_o_r_e_ _g_e_n_e_r_i_c_ _c_a_s_e_ _o_f_ _h_a_v_i_n_g_ _m_u_l_t_i_p_l_e_ _l_i_s_t_e_n_ _p_o_r_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ffuunnccttiioonn sshhoouulldd bbee rreemmoovveedd aanndd uusseerrss nneeeedd ttoo ddeeaall wwiitthh tthhee mmoorree ggeenneerriicc ccaassee ooff hhaavviinngg mmuullttiippllee lliisstteenn ppoorrttss **********                                                  |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::55551155 ******                                                                                                                                           |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		if (!node_list.empty() && nodes.empty())                                                                                                                                     |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			session_log("ERROR: failed to parse DHT bootstrap list: %s", node_list.c_str());                                                                                            |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		for (auto const& n : nodes)                                                                                                                                                  |
│ │ │ │ │ +|			add_dht_router(n);                                                                                                                                                          |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	bool is_directory(std::string const& f, error_code& ec)                                                                                                                       |
│ │ │ │ │ +|	void session_impl::update_count_slow()                                                                                                                                        |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ -|		error_code e;                                                                                                                                                                |
│ │ │ │ │ -|		file_status s;                                                                                                                                                               |
│ │ │ │ │ -|		stat_file(f, &s, e);                                                                                                                                                         |
│ │ │ │ │ -|		if (!e && s.mode & file_status::directory) return true;                                                                                                                      |
│ │ │ │ │ -|_	_	_e_c_ _=_ _e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 2|_._._/_s_r_c_/_p_e_e_r___l_i_s_t_._c_p_p_:_5_3_9      |it would be nice if there was a way to iterate over these torrent_peer objects in the order they are allocated in the pool instead. |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_I_t_ _w_o_u_l_d_ _p_r_o_b_a_b_l_y_ _b_e_ _m_o_r_e_ _e_f_f_i_c_i_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd bbee nniiccee iiff tthheerree wwaass aa wwaayy ttoo iitteerraattee oovveerr tthheessee ttoorrrreenntt__ppeeeerr oobbjjeeccttss iinn tthhee oorrddeerr tthheeyy aarree aallllooccaatteedd iinn tthhee ppooooll iinnsstteeaadd.. IItt wwoouulldd pprroobbaabbllyy bbee mmoorree eeffffiicciieenntt  |
│ │ │ │ │ -|**********                                                                                                                                                                          |
│ │ │ │ │ -|****** ....//ssrrcc//ppeeeerr__lliisstt..ccpppp::553399 ******                                                                                                                                               |
│ │ │ │ │ -|, int session_time, torrent_state* state)                                                                                                                                      |
│ │ │ │ │ +|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ +|		for (auto const& tp : m_torrents)                                                                                                                                            |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			tp->on_inactivity_tick(ec);                                                                                                                                                 |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|std::uint16_t session_impl::listen_port() const                                                                                                                                |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		return listen_port(nullptr);                                                                                                                                                 |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	std::uint16_t session_impl::listen_port(listen_socket_t* sock) const                                                                                                          |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|		if (m_listen_sockets.empty()) return 0;                                                                                                                                      |
│ │ │ │ │ +|		if (sock)                                                                                                                                                                    |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// if we're using a proxy, we won't be able to accept any TCP                                                                                                               |
│ │ │ │ │ +|			// connections. Not even uTP connections via the port we know about.                                                                                                        |
│ │ │ │ │ +|			// The DHT may use the implied port to make it work, but the port we                                                                                                        |
│ │ │ │ │ +|			// announce here has no relevance for that.                                                                                                                                 |
│ │ │ │ │ +|			if (sock->flags & listen_socket_t::proxy)                                                                                                                                   |
│ │ │ │ │ +|				return 0;                                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		const int candidate_count = 10;                                                                                                                                              |
│ │ │ │ │ -|		peers.reserve(candidate_count);                                                                                                                                              |
│ │ │ │ │ +|			if (!(sock->flags & listen_socket_t::accept_incoming))                                                                                                                      |
│ │ │ │ │ +|				return 0;                                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		int erase_candidate = -1;                                                                                                                                                    |
│ │ │ │ │ +|			return std::uint16_t(sock->tcp_external_port());                                                                                                                            |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (bool(m_finished) != state->is_finished)                                                                                                                                  |
│ │ │ │ │ -|			recalculate_connect_candidates(state);                                                                                                                                      |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|		for (auto const& s : m_listen_sockets)                                                                                                                                       |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (!(s->flags & listen_socket_t::accept_incoming)) continue;                                                                                                               |
│ │ │ │ │ +|			if (s->ssl == transport::plaintext)                                                                                                                                         |
│ │ │ │ │ +|				return std::uint16_t(s->tcp_external_port());                                                                                                                              |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|_	_	_r_e_t_u_r_n_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_5_5_5_ _ _|_t_h_i_s_ _f_u_n_c_t_i_o_n_ _s_h_o_u_l_d_ _b_e_ _r_e_m_o_v_e_d_ _a_n_d_ _u_s_e_r_s_ _n_e_e_d_ _t_o_ _d_e_a_l_ _w_i_t_h_ _t_h_e_ _m_o_r_e_ _g_e_n_e_r_i_c_ _c_a_s_e_ _o_f_ _h_a_v_i_n_g_ _m_u_l_t_i_p_l_e_ _s_s_l_ _p_o_r_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ffuunnccttiioonn sshhoouulldd bbee rreemmoovveedd aanndd uusseerrss nneeeedd ttoo ddeeaall wwiitthh tthhee mmoorree ggeenneerriicc ccaassee ooff hhaavviinngg mmuullttiippllee ssssll ppoorrttss **********                                                     |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::55555555 ******                                                                                                                                           |
│ │ │ │ │ +|return 0;                                                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		external_ip const& external = state->ip;                                                                                                                                     |
│ │ │ │ │ -|		int external_port = state->port;                                                                                                                                             |
│ │ │ │ │ +|			return std::uint16_t(sock->tcp_external_port());                                                                                                                            |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_round_robin >= int(m_peers.size())) m_round_robin = 0;                                                                                                                 |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|		for (auto const& s : m_listen_sockets)                                                                                                                                       |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (!(s->flags & listen_socket_t::accept_incoming)) continue;                                                                                                               |
│ │ │ │ │ +|			if (s->ssl == transport::plaintext)                                                                                                                                         |
│ │ │ │ │ +|				return std::uint16_t(s->tcp_external_port());                                                                                                                              |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		return 0;                                                                                                                                                                    |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		sock = m_listen_sockets.front().get();                                                                                                                                       |
│ │ │ │ │ +|		if (!(sock->flags & listen_socket_t::accept_incoming)) return 0;                                                                                                             |
│ │ │ │ │ +|		return std::uint16_t(sock->tcp_external_port());                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		int max_peerlist_size = state->max_peerlist_size;                                                                                                                            |
│ │ │ │ │ +|std::uint16_t session_impl::ssl_listen_port() const                                                                                                                            |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		return ssl_listen_port(nullptr);                                                                                                                                             |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|for (int iterations = std::min(int(m_peers.size()), 300);                                                                                                                      |
│ │ │ │ │ -|iterations > 0; --iterations)                                                                                                                                                  |
│ │ │ │ │ +|	std::uint16_t session_impl::ssl_listen_port(listen_socket_t* sock) const                                                                                                      |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|		if (sock)                                                                                                                                                                    |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			++state->loop_counter;                                                                                                                                                      |
│ │ │ │ │ +|			if (!(sock->flags & listen_socket_t::accept_incoming)) return 0;                                                                                                            |
│ │ │ │ │ +|			return std::uint16_t(sock->tcp_external_port());                                                                                                                            |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (m_round_robin >= int(m_peers.size())) m_round_robin = 0;                                                                                                                |
│ │ │ │ │ +|		if (m_settings.get_int(settings_pack::proxy_type) != settings_pack::none                                                                                                     |
│ │ │ │ │ +|			&& m_settings.get_bool(settings_pack::proxy_peer_connections))                                                                                                              |
│ │ │ │ │ +|			return 0;                                                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			torrent_peer& pe = *m_peers[m_round_robin];                                                                                                                                 |
│ │ │ │ │ -|			TORRENT_ASSERT(pe.in_use);                                                                                                                                                  |
│ │ │ │ │ -|			int current = m_round_robin;                                                                                                                                                |
│ │ │ │ │ +|		for (auto const& s : m_listen_sockets)                                                                                                                                       |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (!(s->flags & listen_socket_t::accept_incoming)) continue;                                                                                                               |
│ │ │ │ │ +|			if (s->ssl == transport::ssl)                                                                                                                                               |
│ │ │ │ │ +|				return std::uint16_t(s->tcp_external_port());                                                                                                                              |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		TORRENT_UNUSED(sock);                                                                                                                                                        |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		return 0;                                                                                                                                                                    |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// if the number of peers is growing large                                                                                                                                  |
│ │ │ │ │ -|			// we need to start weeding.                                                                                                                                                |
│ │ │ │ │ +|_	_i_n_t_ _s_e_s_s_i_o_n___i_m_p_l_:_:_g_e_t___l_i_s_t_e_n___p_o_r_t_(_t_r_a_n_s_p_o_r_t_ _c_o_n_s_t_ _s_s_l_,_ _a_u_x_:_:_l_i_s_t_e_n___s_o_c_k_e_t___h_a_n_d_l_e_ _c_o_n_s_t_&_ _s_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_6_3_9_0_ _ _|_t_h_i_s_ _s_h_o_u_l_d_ _b_e_ _f_a_c_t_o_r_e_d_ _i_n_t_o_ _t_h_e_ _u_d_p_ _s_o_c_k_e_t_,_ _s_o_ _w_e_ _o_n_l_y_ _h_a_v_e_ _t_h_e_ _c_o_d_e_ _o_n_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss sshhoouulldd bbee ffaaccttoorreedd iinnttoo tthhee uuddpp ssoocckkeett,, ssoo wwee oonnllyy hhaavvee tthhee ccooddee oonnccee **********                                                                                         |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::66339900 ******                                                                                                                                           |
│ │ │ │ │ +|return upload_rate_limit(m_local_peer_class);                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (int(m_peers.size()) >= max_peerlist_size * 0.95                                                                                                                         |
│ │ │ │ │ -|				&& max_peerlist_size > 0)                                                                                                                                                  |
│ │ │ │ │ +|	int session_impl::local_download_rate_limit() const                                                                                                                           |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return download_rate_limit(m_local_peer_class);                                                                                                                              |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	int session_impl::upload_rate_limit_depr() const                                                                                                                              |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return upload_rate_limit(m_global_class);                                                                                                                                    |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	int session_impl::download_rate_limit_depr() const                                                                                                                            |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return download_rate_limit(m_global_class);                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif // DEPRECATE                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|void session_impl::update_peer_dscp()                                                                                                                                          |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		int const value = m_settings.get_int(settings_pack::peer_dscp);                                                                                                              |
│ │ │ │ │ +|		for (auto const& l : m_listen_sockets)                                                                                                                                       |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (l->sock)                                                                                                                                                                |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				if (is_erase_candidate(pe)                                                                                                                                                 |
│ │ │ │ │ -|					&& (erase_candidate == -1                                                                                                                                                 |
│ │ │ │ │ -|						|| !compare_peer_erase(*m_peers[erase_candidate], pe)))                                                                                                                  |
│ │ │ │ │ +|				error_code ec;                                                                                                                                                             |
│ │ │ │ │ +|				set_traffic_class(*l->sock, value, ec);                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|				if (should_log())                                                                                                                                                          |
│ │ │ │ │  |				{                                                                                                                                                                          |
│ │ │ │ │ -|					if (should_erase_immediately(pe))                                                                                                                                         |
│ │ │ │ │ -|					{                                                                                                                                                                         |
│ │ │ │ │ -|						if (erase_candidate > current) --erase_candidate;                                                                                                                        |
│ │ │ │ │ -|						erase_peer(m_peers.begin() + current, state);                                                                                                                            |
│ │ │ │ │ -|						continue;                                                                                                                                                                |
│ │ │ │ │ -|					}                                                                                                                                                                         |
│ │ │ │ │ -|					else                                                                                                                                                                      |
│ │ │ │ │ -|					{                                                                                                                                                                         |
│ │ │ │ │ -|						erase_candidate = current;                                                                                                                                               |
│ │ │ │ │ -|_	_	_	_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|					session_log(">>> SET_DSCP [ tcp (%s %d) value: %x e: %s ]"                                                                                                                |
│ │ │ │ │ +|						, l->sock->local_endpoint().address().to_string().c_str()                                                                                                                |
│ │ │ │ │ +|						, l->sock->local_endpoint().port(), value, ec.message().c_str());                                                                                                        |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (l->udp_sock)                                                                                                                                                            |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				error_code ec;                                                                                                                                                             |
│ │ │ │ │ +|				set_traffic_class(l->udp_sock->sock, value, ec);                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|				if (should_log())                                                                                                                                                          |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					session_log(">>> SET_DSCP [ udp (%s %d) value: %x e: %s ]"                                                                                                                |
│ │ │ │ │ +|						, l->udp_sock->sock.local_endpoint().address().to_string().c_str()                                                                                                       |
│ │ │ │ │ +|_	_	_	_	_	_	_,_ _l_-_>_u_d_p___s_o_c_k_-_>_s_o_c_k_._l_o_c_a_l___p_o_r_t_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _2_|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/_n_o_d_e_._c_p_p_:_6_8_4_ _ _|_i_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _h_a_v_e_ _a_ _b_i_a_s_ _t_o_w_a_r_d_s_ _n_o_d_e_-_i_d_ _p_r_e_f_i_x_e_s_ _t_h_a_t_ _a_r_e_ _m_i_s_s_i_n_g_ _i_n_ _t_h_e_ _b_u_c_k_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** iitt wwoouulldd bbee nniiccee ttoo hhaavvee aa bbiiaass ttoowwaarrddss nnooddee--iidd pprreeffiixxeess tthhaatt aarree mmiissssiinngg iinn tthhee bbuucckkeett **********                                                                            |
│ │ │ │ │  |****** ....//ssrrcc//kkaaddeemmlliiaa//nnooddee..ccpppp::668844 ******                                                                                                                                           |
│ │ │ │ │  |node_entry const* ne = m_table.next_refresh();                                                                                                                                 |
│ │ │ │ │  |	if (ne == nullptr) return;                                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |	// this shouldn't happen                                                                                                                                                      |
│ │ │ │ │ @@ -4084,69 +4084,14 @@
│ │ │ │ │  |entry write_nodes_entry(std::vector<node_entry> const& nodes)                                                                                                                  |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │  |	entry r;                                                                                                                                                                      |
│ │ │ │ │  |	std::back_insert_iterator<std::string> out(r.string());                                                                                                                       |
│ │ │ │ │  |	for (auto const& n : nodes)                                                                                                                                                   |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │  |_	_	_s_t_d_:_:_c_o_p_y_(_n_._i_d_._b_e_g_i_n_(_)_,_ _n_._i_d_._e_n_d_(_)_,_ _o_u_t_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 2|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |make this configurable in dht_settings                                                                                              |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_d_h_t___s_t_o_r_a_g_e_._c_p_p_:_8_7_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmaakkee tthhiiss ccoonnffiigguurraabbllee iinn ddhhtt__sseettttiinnggss **********                                                                                                                             |
│ │ │ │ │ -|****** ....//ssrrcc//kkaaddeemmlliiaa//ddhhtt__ssttoorraaggee..ccpppp::8877 ******                                                                                                                                     |
│ │ │ │ │ -|tcp::endpoint addr;                                                                                                                                                            |
│ │ │ │ │ -|		bool seed = 0;                                                                                                                                                               |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// internal                                                                                                                                                                   |
│ │ │ │ │ -|	bool operator<(peer_entry const& lhs, peer_entry const& rhs)                                                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		return lhs.addr.address() == rhs.addr.address()                                                                                                                              |
│ │ │ │ │ -|			? lhs.addr.port() < rhs.addr.port()                                                                                                                                         |
│ │ │ │ │ -|			: lhs.addr.address() < rhs.addr.address();                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// this is a group. It contains a set of group members                                                                                                                        |
│ │ │ │ │ -|	struct torrent_entry                                                                                                                                                          |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::string name;                                                                                                                                                            |
│ │ │ │ │ -|		std::vector<peer_entry> peers4;                                                                                                                                              |
│ │ │ │ │ -|		std::vector<peer_entry> peers6;                                                                                                                                              |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|constexpr time_duration announce_interval = minutes(30);                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	struct dht_immutable_item                                                                                                                                                     |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		// the actual value                                                                                                                                                          |
│ │ │ │ │ -|		std::unique_ptr<char[]> value;                                                                                                                                               |
│ │ │ │ │ -|		// this counts the number of IPs we have seen                                                                                                                                |
│ │ │ │ │ -|		// announcing this item, this is used to determine                                                                                                                           |
│ │ │ │ │ -|		// popularity if we reach the limit of items to store                                                                                                                        |
│ │ │ │ │ -|		bloom_filter<128> ips;                                                                                                                                                       |
│ │ │ │ │ -|		// the last time we heard about this item                                                                                                                                    |
│ │ │ │ │ -|		// the correct interpretation of this field                                                                                                                                  |
│ │ │ │ │ -|		// requires a time reference                                                                                                                                                 |
│ │ │ │ │ -|		time_point last_seen;                                                                                                                                                        |
│ │ │ │ │ -|		// number of IPs in the bloom filter                                                                                                                                         |
│ │ │ │ │ -|		int num_announcers = 0;                                                                                                                                                      |
│ │ │ │ │ -|		// size of malloced space pointed to by value                                                                                                                                |
│ │ │ │ │ -|		int size = 0;                                                                                                                                                                |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	struct dht_mutable_item : dht_immutable_item                                                                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		signature sig{};                                                                                                                                                             |
│ │ │ │ │ -|		sequence_number seq{};                                                                                                                                                       |
│ │ │ │ │ -|		public_key key{};                                                                                                                                                            |
│ │ │ │ │ -|		std::string salt;                                                                                                                                                            |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void set_value(dht_immutable_item& item, span<char const> buf)                                                                                                                |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|_	_	_i_n_t_ _c_o_n_s_t_ _s_i_z_e_ _=_ _i_n_t_(_b_u_f_._s_i_z_e_(_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 2|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |use the non deprecated function instead of this one                                                                                 |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_r_o_u_t_i_n_g___t_a_b_l_e_._c_p_p_:_3_0_5_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** uussee tthhee nnoonn ddeepprreeccaatteedd ffuunnccttiioonn iinnsstteeaadd ooff tthhiiss oonnee **********                                                                                                                |
│ │ │ │ │  |****** ....//ssrrcc//kkaaddeemmlliiaa//rroouuttiinngg__ttaabbllee..ccpppp::330055 ******                                                                                                                                  |
│ │ │ │ │  |static const aux::array<int, 4> size_exceptions{{{16, 8, 4, 2}}};                                                                                                              |
│ │ │ │ │  |	if (bucket < size_exceptions.end_index())                                                                                                                                     |
│ │ │ │ │  |		return m_bucket_size * size_exceptions[bucket];                                                                                                                              |
│ │ │ │ │ @@ -4226,14 +4171,69 @@
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │  |			// this entry belongs in the new bucket                                                                                                                                     |
│ │ │ │ │  |			if (j->pinged() && int(new_bucket.size()) < new_bucket_size)                                                                                                                |
│ │ │ │ │  |				new_bucket.push_back(*j);                                                                                                                                                  |
│ │ │ │ │  |			else                                                                                                                                                                        |
│ │ │ │ │  |				new_replacement_bucket.push_back(*j);                                                                                                                                      |
│ │ │ │ │  |_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 2|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |make this configurable in dht_settings                                                                                              |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_d_h_t___s_t_o_r_a_g_e_._c_p_p_:_8_7_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmaakkee tthhiiss ccoonnffiigguurraabbllee iinn ddhhtt__sseettttiinnggss **********                                                                                                                             |
│ │ │ │ │ +|****** ....//ssrrcc//kkaaddeemmlliiaa//ddhhtt__ssttoorraaggee..ccpppp::8877 ******                                                                                                                                     |
│ │ │ │ │ +|tcp::endpoint addr;                                                                                                                                                            |
│ │ │ │ │ +|		bool seed = 0;                                                                                                                                                               |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// internal                                                                                                                                                                   |
│ │ │ │ │ +|	bool operator<(peer_entry const& lhs, peer_entry const& rhs)                                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return lhs.addr.address() == rhs.addr.address()                                                                                                                              |
│ │ │ │ │ +|			? lhs.addr.port() < rhs.addr.port()                                                                                                                                         |
│ │ │ │ │ +|			: lhs.addr.address() < rhs.addr.address();                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// this is a group. It contains a set of group members                                                                                                                        |
│ │ │ │ │ +|	struct torrent_entry                                                                                                                                                          |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		std::string name;                                                                                                                                                            |
│ │ │ │ │ +|		std::vector<peer_entry> peers4;                                                                                                                                              |
│ │ │ │ │ +|		std::vector<peer_entry> peers6;                                                                                                                                              |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|constexpr time_duration announce_interval = minutes(30);                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	struct dht_immutable_item                                                                                                                                                     |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		// the actual value                                                                                                                                                          |
│ │ │ │ │ +|		std::unique_ptr<char[]> value;                                                                                                                                               |
│ │ │ │ │ +|		// this counts the number of IPs we have seen                                                                                                                                |
│ │ │ │ │ +|		// announcing this item, this is used to determine                                                                                                                           |
│ │ │ │ │ +|		// popularity if we reach the limit of items to store                                                                                                                        |
│ │ │ │ │ +|		bloom_filter<128> ips;                                                                                                                                                       |
│ │ │ │ │ +|		// the last time we heard about this item                                                                                                                                    |
│ │ │ │ │ +|		// the correct interpretation of this field                                                                                                                                  |
│ │ │ │ │ +|		// requires a time reference                                                                                                                                                 |
│ │ │ │ │ +|		time_point last_seen;                                                                                                                                                        |
│ │ │ │ │ +|		// number of IPs in the bloom filter                                                                                                                                         |
│ │ │ │ │ +|		int num_announcers = 0;                                                                                                                                                      |
│ │ │ │ │ +|		// size of malloced space pointed to by value                                                                                                                                |
│ │ │ │ │ +|		int size = 0;                                                                                                                                                                |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	struct dht_mutable_item : dht_immutable_item                                                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		signature sig{};                                                                                                                                                             |
│ │ │ │ │ +|		sequence_number seq{};                                                                                                                                                       |
│ │ │ │ │ +|		public_key key{};                                                                                                                                                            |
│ │ │ │ │ +|		std::string salt;                                                                                                                                                            |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void set_value(dht_immutable_item& item, span<char const> buf)                                                                                                                |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|_	_	_i_n_t_ _c_o_n_s_t_ _s_i_z_e_ _=_ _i_n_t_(_b_u_f_._s_i_z_e_(_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 2|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |having 8 priority levels is probably excessive. It should probably be changed to 3 levels + dont-download                           |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_p_i_e_c_e___p_i_c_k_e_r_._h_p_p_:_6_6_8_ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** hhaavviinngg 88 pprriioorriittyy lleevveellss iiss pprroobbaabbllyy eexxcceessssiivvee.. IItt sshhoouulldd pprroobbaabbllyy bbee cchhaannggeedd ttoo 33 lleevveellss ++ ddoonntt--ddoowwnnllooaadd **********                                                          |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppiieeccee__ppiicckkeerr..hhpppp::666688 ******                                                                                                                             |
│ │ │ │ │  |else if (state() == piece_full)                                                                                                                                                |
│ │ │ │ │  |						state(piece_full_reverse);                                                                                                                                               |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ @@ -4390,14 +4390,69 @@
│ │ │ │ │  |	using allocator_type = typename boost::asio::associated_allocator<UnderlyingHandler>::type;                                                                                   |
│ │ │ │ │  |	using executor_type = typename boost::asio::associated_executor<UnderlyingHandler>::type;                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |	allocator_type get_allocator() const noexcept                                                                                                                                 |
│ │ │ │ │  |	{ return boost::asio::get_associated_allocator(m_underlying_handler); }                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |_	_e_x_e_c_u_t_o_r___t_y_p_e_ _g_e_t___e_x_e_c_u_t_o_r_(_)_ _c_o_n_s_t_ _n_o_e_x_c_e_p_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 2|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |add async_connect() that takes a hostname and port as well                                                                          |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_s_o_c_k_s_5___s_t_r_e_a_m_._h_p_p_:_1_5_3_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** aadddd aassyynncc__ccoonnnneecctt(()) tthhaatt ttaakkeess aa hhoossttnnaammee aanndd ppoorrtt aass wweellll **********                                                                                                         |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ssoocckkss55__ssttrreeaamm..hhpppp::115533 ******                                                                                                                            |
│ │ │ │ │ +|TORRENT_ASSERT(!aux::is_ip_address(host));                                                                                                                                     |
│ │ │ │ │ +|		m_dst_name = host;                                                                                                                                                           |
│ │ │ │ │ +|		if (m_dst_name.size() > 255)                                                                                                                                                 |
│ │ │ │ │ +|			m_dst_name.resize(255);                                                                                                                                                     |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void close(error_code& ec)                                                                                                                                                    |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		m_dst_name.clear();                                                                                                                                                          |
│ │ │ │ │ +|		proxy_base::close(ec);                                                                                                                                                       |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ +|	void close()                                                                                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		m_dst_name.clear();                                                                                                                                                          |
│ │ │ │ │ +|		proxy_base::close();                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|template <class Handler>                                                                                                                                                       |
│ │ │ │ │ +|void async_connect(endpoint_type const& endpoint, Handler handler)                                                                                                             |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		// make sure we don't try to connect to INADDR_ANY. binding is fine,                                                                                                         |
│ │ │ │ │ +|		// and using a hostname is fine on SOCKS version 5.                                                                                                                          |
│ │ │ │ │ +|		TORRENT_ASSERT(endpoint.address() != address()                                                                                                                               |
│ │ │ │ │ +|			|| (!m_dst_name.empty() && m_version == 5));                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		m_remote_endpoint = endpoint;                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// the connect is split up in the following steps:                                                                                                                           |
│ │ │ │ │ +|		// 1. resolve name of proxy server                                                                                                                                           |
│ │ │ │ │ +|		// 2. connect to proxy server                                                                                                                                                |
│ │ │ │ │ +|		// 3. if version == 5:                                                                                                                                                       |
│ │ │ │ │ +|		//   3.1 send SOCKS5 authentication method message                                                                                                                           |
│ │ │ │ │ +|		//   3.2 read SOCKS5 authentication response                                                                                                                                 |
│ │ │ │ │ +|		//   3.3 send username+password                                                                                                                                              |
│ │ │ │ │ +|		// 4. send SOCKS command message                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		ADD_OUTSTANDING_ASYNC("socks5_stream::name_lookup");                                                                                                                         |
│ │ │ │ │ +|		m_resolver.async_resolve(m_hostname, to_string(m_port).data(), wrap_allocator(                                                                                               |
│ │ │ │ │ +|			[this](error_code const& ec, tcp::resolver::results_type ips, Handler hn) {                                                                                                 |
│ │ │ │ │ +|				name_lookup(ec, std::move(ips), std::move(hn));                                                                                                                            |
│ │ │ │ │ +|			}, std::move(handler)));                                                                                                                                                    |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|private:                                                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	template <typename Handler>                                                                                                                                                   |
│ │ │ │ │ +|	void name_lookup(error_code const& e, tcp::resolver::results_type ips                                                                                                         |
│ │ │ │ │ +|_	_	_,_ _H_a_n_d_l_e_r_ _h_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 2|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |this should really be a circular buffer                                                                                             |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._h_p_p_:_9_9_6_ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** tthhiiss sshhoouulldd rreeaallllyy bbee aa cciirrccuullaarr bbuuffffeerr **********                                                                                                                            |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppeeeerr__ccoonnnneeccttiioonn..hhpppp::999966 ******                                                                                                                          |
│ │ │ │ │  |// it just serves as a queue to remember what we've sent, to avoid                                                                                                             |
│ │ │ │ │  |		// re-sending suggests for the same piece                                                                                                                                    |
│ │ │ │ │  |		// i.e. outgoing suggest pieces                                                                                                                                              |
│ │ │ │ │ @@ -4497,69 +4552,69 @@
│ │ │ │ │  |		// and false if we got an incoming connection                                                                                                                                |
│ │ │ │ │  |		// could be considered: true = local, false = remote                                                                                                                         |
│ │ │ │ │  |		bool m_outgoing:1;                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// is true if we learn the incoming connections listening                                                                                                                    |
│ │ │ │ │  |		// during the extended handshake                                                                                                                                             |
│ │ │ │ │  |_	_	_b_o_o_l_ _m___r_e_c_e_i_v_e_d___l_i_s_t_e_n___p_o_r_t_:_1_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 2|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |add async_connect() that takes a hostname and port as well                                                                          |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_s_o_c_k_s_5___s_t_r_e_a_m_._h_p_p_:_1_5_3_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** aadddd aassyynncc__ccoonnnneecctt(()) tthhaatt ttaakkeess aa hhoossttnnaammee aanndd ppoorrtt aass wweellll **********                                                                                                         |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ssoocckkss55__ssttrreeaamm..hhpppp::115533 ******                                                                                                                            |
│ │ │ │ │ -|TORRENT_ASSERT(!aux::is_ip_address(host));                                                                                                                                     |
│ │ │ │ │ -|		m_dst_name = host;                                                                                                                                                           |
│ │ │ │ │ -|		if (m_dst_name.size() > 255)                                                                                                                                                 |
│ │ │ │ │ -|			m_dst_name.resize(255);                                                                                                                                                     |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|relevance 2|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |this type should probably be renamed to send_buffer                                                                                 |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_c_h_a_i_n_e_d___b_u_f_f_e_r_._h_p_p_:_5_9_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ttyyppee sshhoouulldd pprroobbaabbllyy bbee rreennaammeedd ttoo sseenndd__bbuuffffeerr **********                                                                                                                |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//cchhaaiinneedd__bbuuffffeerr..hhpppp::5599 ******                                                                                                                       |
│ │ │ │ │ +|#include "libtorrent/aux_/buffer.hpp"                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void close(error_code& ec)                                                                                                                                                    |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		m_dst_name.clear();                                                                                                                                                          |
│ │ │ │ │ -|		proxy_base::close(ec);                                                                                                                                                       |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|#include <deque>                                                                                                                                                               |
│ │ │ │ │ +|#include <vector>                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ -|	void close()                                                                                                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		m_dst_name.clear();                                                                                                                                                          |
│ │ │ │ │ -|		proxy_base::close();                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_push.hpp"                                                                                                                           |
│ │ │ │ │ +|#include <boost/asio/buffer.hpp>                                                                                                                                               |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|template <class Handler>                                                                                                                                                       |
│ │ │ │ │ -|void async_connect(endpoint_type const& endpoint, Handler handler)                                                                                                             |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		// make sure we don't try to connect to INADDR_ANY. binding is fine,                                                                                                         |
│ │ │ │ │ -|		// and using a hostname is fine on SOCKS version 5.                                                                                                                          |
│ │ │ │ │ -|		TORRENT_ASSERT(endpoint.address() != address()                                                                                                                               |
│ │ │ │ │ -|			|| (!m_dst_name.empty() && m_version == 5));                                                                                                                                |
│ │ │ │ │ +|#ifdef _MSC_VER                                                                                                                                                                |
│ │ │ │ │ +|// visual studio requires the value in a deque to be copyable. C++11                                                                                                           |
│ │ │ │ │ +|// has looser requirements depending on which functions are actually used.                                                                                                     |
│ │ │ │ │ +|#define TORRENT_CPP98_DEQUE 1                                                                                                                                                  |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|#define TORRENT_CPP98_DEQUE 0                                                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		m_remote_endpoint = endpoint;                                                                                                                                                |
│ │ │ │ │ +|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │ +|namespace aux {                                                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the connect is split up in the following steps:                                                                                                                           |
│ │ │ │ │ -|		// 1. resolve name of proxy server                                                                                                                                           |
│ │ │ │ │ -|		// 2. connect to proxy server                                                                                                                                                |
│ │ │ │ │ -|		// 3. if version == 5:                                                                                                                                                       |
│ │ │ │ │ -|		//   3.1 send SOCKS5 authentication method message                                                                                                                           |
│ │ │ │ │ -|		//   3.2 read SOCKS5 authentication response                                                                                                                                 |
│ │ │ │ │ -|		//   3.3 send username+password                                                                                                                                              |
│ │ │ │ │ -|		// 4. send SOCKS command message                                                                                                                                             |
│ │ │ │ │ +|struct TORRENT_EXTRA_EXPORT chained_buffer : private single_threaded                                                                                                           |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		chained_buffer(): m_bytes(0), m_capacity(0)                                                                                                                                  |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			thread_started();                                                                                                                                                           |
│ │ │ │ │ +|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ +|			m_destructed = false;                                                                                                                                                       |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		ADD_OUTSTANDING_ASYNC("socks5_stream::name_lookup");                                                                                                                         |
│ │ │ │ │ -|		m_resolver.async_resolve(m_hostname, to_string(m_port).data(), wrap_allocator(                                                                                               |
│ │ │ │ │ -|			[this](error_code const& ec, tcp::resolver::results_type ips, Handler hn) {                                                                                                 |
│ │ │ │ │ -|				name_lookup(ec, std::move(ips), std::move(hn));                                                                                                                            |
│ │ │ │ │ -|			}, std::move(handler)));                                                                                                                                                    |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|	private:                                                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|private:                                                                                                                                                                       |
│ │ │ │ │ +|		// destructs/frees the holder object                                                                                                                                         |
│ │ │ │ │ +|		using destruct_holder_fun = void (*)(void*);                                                                                                                                 |
│ │ │ │ │ +|		using move_construct_holder_fun = void (*)(void*, void*);                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	template <typename Handler>                                                                                                                                                   |
│ │ │ │ │ -|	void name_lookup(error_code const& e, tcp::resolver::results_type ips                                                                                                         |
│ │ │ │ │ -|_	_	_,_ _H_a_n_d_l_e_r_ _h_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|		struct buffer_t                                                                                                                                                              |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			buffer_t() {}                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_CPP98_DEQUE                                                                                                                                                        |
│ │ │ │ │ +|			buffer_t(buffer_t&& rhs) noexcept                                                                                                                                           |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				destruct_holder = rhs.destruct_holder;                                                                                                                                     |
│ │ │ │ │ +|				move_holder = rhs.move_holder;                                                                                                                                             |
│ │ │ │ │ +|				buf = rhs.buf;                                                                                                                                                             |
│ │ │ │ │ +|				size = rhs.size;                                                                                                                                                           |
│ │ │ │ │ +|				used_size = rhs.used_size;                                                                                                                                                 |
│ │ │ │ │ +|				move_holder(&holder, &rhs.holder);                                                                                                                                         |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			buffer_t& operator=(buffer_t&& rhs) & noexcept                                                                                                                              |
│ │ │ │ │ +|_	_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 2|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |make this interface a lot smaller. It could be split up into several smaller interfaces. Each subsystem could then limit the size of|
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_n_t_e_r_f_a_c_e_._h_p_p_:_1_2_7_ _ _ _ _ _|_t_h_e_ _m_o_c_k_ _o_b_j_e_c_t_ _t_o_ _t_e_s_t_ _i_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** mmaakkee tthhiiss iinntteerrffaaccee aa lloott ssmmaalllleerr.. IItt ccoouulldd bbee sspplliitt uupp iinnttoo sseevveerraall ssmmaalllleerr iinntteerrffaacceess.. EEaacchh ssuubbssyysstteemm ccoouulldd tthheenn lliimmiitt tthhee ssiizzee ooff tthhee mmoocckk oobbjjeecctt ttoo tteesstt iitt.. **********   |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iinntteerrffaaccee..hhpppp::112277 ******                                                                                                                   |
│ │ │ │ │  |// a release build with logging disabled (which is the default) will                                                                                                           |
│ │ │ │ │  |	// not have this class at all                                                                                                                                                 |
│ │ │ │ │  |	struct TORRENT_EXTRA_EXPORT session_logger                                                                                                                                    |
│ │ │ │ │ @@ -4635,123 +4690,14 @@
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		virtual void remove_torrent(torrent_handle const& h, remove_flags_t options = {}) = 0;                                                                                       |
│ │ │ │ │  |		virtual void remove_torrent_impl(std::shared_ptr<torrent> tptr, remove_flags_t options) = 0;                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// port filter                                                                                                                                                               |
│ │ │ │ │  |		virtual port_filter const& get_port_filter() const = 0;                                                                                                                      |
│ │ │ │ │  |_	_	_v_i_r_t_u_a_l_ _v_o_i_d_ _b_a_n___i_p_(_a_d_d_r_e_s_s_ _a_d_d_r_)_ _=_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 2|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |this type should probably be renamed to send_buffer                                                                                 |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_c_h_a_i_n_e_d___b_u_f_f_e_r_._h_p_p_:_5_9_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ttyyppee sshhoouulldd pprroobbaabbllyy bbee rreennaammeedd ttoo sseenndd__bbuuffffeerr **********                                                                                                                |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//cchhaaiinneedd__bbuuffffeerr..hhpppp::5599 ******                                                                                                                       |
│ │ │ │ │ -|#include "libtorrent/aux_/buffer.hpp"                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#include <deque>                                                                                                                                                               |
│ │ │ │ │ -|#include <vector>                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_push.hpp"                                                                                                                           |
│ │ │ │ │ -|#include <boost/asio/buffer.hpp>                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifdef _MSC_VER                                                                                                                                                                |
│ │ │ │ │ -|// visual studio requires the value in a deque to be copyable. C++11                                                                                                           |
│ │ │ │ │ -|// has looser requirements depending on which functions are actually used.                                                                                                     |
│ │ │ │ │ -|#define TORRENT_CPP98_DEQUE 1                                                                                                                                                  |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|#define TORRENT_CPP98_DEQUE 0                                                                                                                                                  |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │ -|namespace aux {                                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|struct TORRENT_EXTRA_EXPORT chained_buffer : private single_threaded                                                                                                           |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		chained_buffer(): m_bytes(0), m_capacity(0)                                                                                                                                  |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			thread_started();                                                                                                                                                           |
│ │ │ │ │ -|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ -|			m_destructed = false;                                                                                                                                                       |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	private:                                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// destructs/frees the holder object                                                                                                                                         |
│ │ │ │ │ -|		using destruct_holder_fun = void (*)(void*);                                                                                                                                 |
│ │ │ │ │ -|		using move_construct_holder_fun = void (*)(void*, void*);                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		struct buffer_t                                                                                                                                                              |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			buffer_t() {}                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_CPP98_DEQUE                                                                                                                                                        |
│ │ │ │ │ -|			buffer_t(buffer_t&& rhs) noexcept                                                                                                                                           |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				destruct_holder = rhs.destruct_holder;                                                                                                                                     |
│ │ │ │ │ -|				move_holder = rhs.move_holder;                                                                                                                                             |
│ │ │ │ │ -|				buf = rhs.buf;                                                                                                                                                             |
│ │ │ │ │ -|				size = rhs.size;                                                                                                                                                           |
│ │ │ │ │ -|				used_size = rhs.used_size;                                                                                                                                                 |
│ │ │ │ │ -|				move_holder(&holder, &rhs.holder);                                                                                                                                         |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			buffer_t& operator=(buffer_t&& rhs) & noexcept                                                                                                                              |
│ │ │ │ │ -|_	_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _1_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_7_0_7_ _ _|_r_e_p_o_r_t_ _t_h_e_ _p_r_o_p_e_r_ _a_d_d_r_e_s_s_ _o_f_ _t_h_e_ _r_o_u_t_e_r_ _a_s_ _t_h_e_ _s_o_u_r_c_e_ _I_P_ _o_f_ _t_h_i_s_ _v_o_t_e_ _o_f_ _o_u_r_ _e_x_t_e_r_n_a_l_ _a_d_d_r_e_s_s_,_ _i_n_s_t_e_a_d_ _o_f_ _t_h_e_ _e_m_p_t_y_ _a_d_d_r_e_s_s_ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** rreeppoorrtt tthhee pprrooppeerr aaddddrreessss ooff tthhee rroouutteerr aass tthhee ssoouurrccee IIPP ooff tthhiiss vvoottee ooff oouurr eexxtteerrnnaall aaddddrreessss,, iinnsstteeaadd ooff tthhee eemmppttyy aaddddrreessss **********                                        |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::55770077 ******                                                                                                                                           |
│ │ │ │ │ -|, listen_socket_handle const& ls)                                                                                                                                              |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		listen_socket_t* listen_socket = ls.get();                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// NOTE: don't assume that if ec != 0, the rest of the logic                                                                                                                 |
│ │ │ │ │ -|		// is not necessary, the ports still need to be set, in other                                                                                                                |
│ │ │ │ │ -|		// words, don't early return without careful review of the                                                                                                                   |
│ │ │ │ │ -|		// remaining logic                                                                                                                                                           |
│ │ │ │ │ -|		if (ec && m_alerts.should_post<portmap_error_alert>())                                                                                                                       |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_alerts.emplace_alert<portmap_error_alert>(mapping                                                                                                                         |
│ │ │ │ │ -|				, transport, ec, listen_socket ? listen_socket->local_endpoint.address() : address());                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (!listen_socket) return;                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (!ec && !external_ip.is_unspecified())                                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|listen_socket->external_address.cast_vote(external_ip, source_router, address());                                                                                              |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// need to check whether this mapping is for one of session ports (it could also be a user mapping)                                                                          |
│ │ │ │ │ -|		if ((proto == portmap_protocol::tcp) && (listen_socket->tcp_port_mapping[transport].mapping == mapping))                                                                     |
│ │ │ │ │ -|			listen_socket->tcp_port_mapping[transport].port = port;                                                                                                                     |
│ │ │ │ │ -|		else if ((proto == portmap_protocol::udp) && (listen_socket->udp_port_mapping[transport].mapping == mapping))                                                                |
│ │ │ │ │ -|			listen_socket->udp_port_mapping[transport].port = port;                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (!ec && m_alerts.should_post<portmap_alert>())                                                                                                                            |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_alerts.emplace_alert<portmap_alert>(mapping, port                                                                                                                         |
│ │ │ │ │ -|				, transport, proto, listen_socket->local_endpoint.address());                                                                                                              |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|	session_status session_impl::status() const                                                                                                                                   |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|//		INVARIANT_CHECK;                                                                                                                                                           |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		session_status s;                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		s.optimistic_unchoke_counter = m_optimistic_unchoke_time_scaler;                                                                                                             |
│ │ │ │ │ -|		s.unchoke_counter = m_unchoke_time_scaler;                                                                                                                                   |
│ │ │ │ │ -|		s.num_dead_peers = int(m_undead_peers.size());                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		s.num_peers = int(m_stats_counters[counters::num_peers_connected]);                                                                                                          |
│ │ │ │ │ -|		s.num_unchoked = int(m_stats_counters[counters::num_peers_up_unchoked_all]);                                                                                                 |
│ │ │ │ │ -|_	_	_s_._a_l_l_o_w_e_d___u_p_l_o_a_d___s_l_o_t_s_ _=_ _i_n_t_(_m___s_t_a_t_s___c_o_u_n_t_e_r_s_[_c_o_u_n_t_e_r_s_:_:_n_u_m___u_n_c_h_o_k_e___s_l_o_t_s_]_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |           |                              |make this depend on the error and on the filesystem the files are being downloaded to. If the error is no_space_left_on_device and  |
│ │ │ │ │  |relevance 1|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_1_2_6       |the filesystem doesn't support sparse files, only zero the priorities of the pieces that are at the tails of all files, leaving     |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_e_v_e_r_y_t_h_i_n_g_ _u_p_ _t_o_ _t_h_e_ _h_i_g_h_e_s_t_ _w_r_i_t_t_e_n_ _p_i_e_c_e_ _i_n_ _e_a_c_h_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** mmaakkee tthhiiss ddeeppeenndd oonn tthhee eerrrroorr aanndd oonn tthhee ffiilleessyysstteemm tthhee ffiilleess aarree bbeeiinngg ddoowwnnllooaaddeedd ttoo.. IIff tthhee eerrrroorr iiss nnoo__ssppaaccee__lleefftt__oonn__ddeevviiccee aanndd tthhee ffiilleessyysstteemm ddooeessnn''tt ssuuppppoorrtt ssppaarrssee |
│ │ │ │ │  |ffiilleess,, oonnllyy zzeerroo tthhee pprriioorriittiieess ooff tthhee ppiieecceess tthhaatt aarree aatt tthhee ttaaiillss ooff aallll ffiilleess,, lleeaavviinngg eevveerryytthhiinngg uupp ttoo tthhee hhiigghheesstt wwrriitttteenn ppiieeccee iinn eeaacchh ffiillee **********                        |
│ │ │ │ │  |****** ....//ssrrcc//ttoorrrreenntt..ccpppp::11112266 ******                                                                                                                                                |
│ │ │ │ │  |		// notify the user of the error                                                                                                                                              |
│ │ │ │ │ @@ -4853,14 +4799,68 @@
│ │ │ │ │  |			// we need to keep the object alive during this operation                                                                                                                   |
│ │ │ │ │  |			m_ses.disk_thread().async_release_files(m_storage                                                                                                                           |
│ │ │ │ │  |				, std::bind(&torrent::on_cache_flushed, shared_from_this(), false));                                                                                                       |
│ │ │ │ │  |			m_ses.deferred_submit_jobs();                                                                                                                                               |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |_	_	_/_/_ _t_h_i_s_ _t_o_r_r_e_n_t_ _j_u_s_t_ _c_o_m_p_l_e_t_e_d_ _d_o_w_n_l_o_a_d_s_,_ _w_h_i_c_h_ _m_e_a_n_s_ _i_t_ _w_i_l_l_ _f_a_l_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _1_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_7_0_7_ _ _|_r_e_p_o_r_t_ _t_h_e_ _p_r_o_p_e_r_ _a_d_d_r_e_s_s_ _o_f_ _t_h_e_ _r_o_u_t_e_r_ _a_s_ _t_h_e_ _s_o_u_r_c_e_ _I_P_ _o_f_ _t_h_i_s_ _v_o_t_e_ _o_f_ _o_u_r_ _e_x_t_e_r_n_a_l_ _a_d_d_r_e_s_s_,_ _i_n_s_t_e_a_d_ _o_f_ _t_h_e_ _e_m_p_t_y_ _a_d_d_r_e_s_s_ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** rreeppoorrtt tthhee pprrooppeerr aaddddrreessss ooff tthhee rroouutteerr aass tthhee ssoouurrccee IIPP ooff tthhiiss vvoottee ooff oouurr eexxtteerrnnaall aaddddrreessss,, iinnsstteeaadd ooff tthhee eemmppttyy aaddddrreessss **********                                        |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::55770077 ******                                                                                                                                           |
│ │ │ │ │ +|, listen_socket_handle const& ls)                                                                                                                                              |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		listen_socket_t* listen_socket = ls.get();                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// NOTE: don't assume that if ec != 0, the rest of the logic                                                                                                                 |
│ │ │ │ │ +|		// is not necessary, the ports still need to be set, in other                                                                                                                |
│ │ │ │ │ +|		// words, don't early return without careful review of the                                                                                                                   |
│ │ │ │ │ +|		// remaining logic                                                                                                                                                           |
│ │ │ │ │ +|		if (ec && m_alerts.should_post<portmap_error_alert>())                                                                                                                       |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			m_alerts.emplace_alert<portmap_error_alert>(mapping                                                                                                                         |
│ │ │ │ │ +|				, transport, ec, listen_socket ? listen_socket->local_endpoint.address() : address());                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (!listen_socket) return;                                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (!ec && !external_ip.is_unspecified())                                                                                                                                    |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|listen_socket->external_address.cast_vote(external_ip, source_router, address());                                                                                              |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// need to check whether this mapping is for one of session ports (it could also be a user mapping)                                                                          |
│ │ │ │ │ +|		if ((proto == portmap_protocol::tcp) && (listen_socket->tcp_port_mapping[transport].mapping == mapping))                                                                     |
│ │ │ │ │ +|			listen_socket->tcp_port_mapping[transport].port = port;                                                                                                                     |
│ │ │ │ │ +|		else if ((proto == portmap_protocol::udp) && (listen_socket->udp_port_mapping[transport].mapping == mapping))                                                                |
│ │ │ │ │ +|			listen_socket->udp_port_mapping[transport].port = port;                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (!ec && m_alerts.should_post<portmap_alert>())                                                                                                                            |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			m_alerts.emplace_alert<portmap_alert>(mapping, port                                                                                                                         |
│ │ │ │ │ +|				, transport, proto, listen_socket->local_endpoint.address());                                                                                                              |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|	session_status session_impl::status() const                                                                                                                                   |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|//		INVARIANT_CHECK;                                                                                                                                                           |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		session_status s;                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		s.optimistic_unchoke_counter = m_optimistic_unchoke_time_scaler;                                                                                                             |
│ │ │ │ │ +|		s.unchoke_counter = m_unchoke_time_scaler;                                                                                                                                   |
│ │ │ │ │ +|		s.num_dead_peers = int(m_undead_peers.size());                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		s.num_peers = int(m_stats_counters[counters::num_peers_connected]);                                                                                                          |
│ │ │ │ │ +|		s.num_unchoked = int(m_stats_counters[counters::num_peers_up_unchoked_all]);                                                                                                 |
│ │ │ │ │ +|_	_	_s_._a_l_l_o_w_e_d___u_p_l_o_a_d___s_l_o_t_s_ _=_ _i_n_t_(_m___s_t_a_t_s___c_o_u_n_t_e_r_s_[_c_o_u_n_t_e_r_s_:_:_n_u_m___u_n_c_h_o_k_e___s_l_o_t_s_]_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 1|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |have one instance per possible subnet, 192.168.x.x, 10.x.x.x, etc.                                                                  |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_i_p___v_o_t_e_r_._h_p_p_:_1_3_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** hhaavvee oonnee iinnssttaannccee ppeerr ppoossssiibbllee ssuubbnneett,, 119922..116688..xx..xx,, 1100..xx..xx..xx,, eettcc.. **********                                                                                                 |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//iipp__vvootteerr..hhpppp::113300 ******                                                                                                                                 |
│ │ │ │ │  |// stores one address for each combination of local/global and ipv4/ipv6                                                                                                       |
│ │ │ │ │  |	// use of this class should be avoided, get the IP from the appropriate                                                                                                       |
│ │ │ │ │  |	// listen interface wherever possible                                                                                                                                         |
│ │ │ │ │ @@ -4883,251 +4883,89 @@
│ │ │ │ │  |		// [n][0] = IPv4 [n][1] = IPv6                                                                                                                                               |
│ │ │ │ │  |address m_addresses[2][2];                                                                                                                                                     |
│ │ │ │ │  |};                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___s_s_l_._c_p_p_:_4_0_7_ _ _ _ _ _ _|_t_e_s_t_ _u_s_i_n_g_ _a_ _s_i_g_n_e_d_ _c_e_r_t_i_f_i_c_a_t_e_ _w_i_t_h_ _t_h_e_ _w_r_o_n_g_ _i_n_f_o_-_h_a_s_h_ _i_n_ _D_N_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt uussiinngg aa ssiiggnneedd cceerrttiiffiiccaattee wwiitthh tthhee wwrroonngg iinnffoo--hhaasshh iinn DDNN **********                                                                                                     |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__ssssll..ccpppp::440077 ******                                                                                                                                               |
│ │ │ │ │ -|// in verifying peers                                                                                                                                                          |
│ │ │ │ │ -|	ctx.set_verify_mode(context::verify_none, ec);                                                                                                                                |
│ │ │ │ │ -|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::printf("Failed to set SSL verify mode: %s\n"                                                                                                                            |
│ │ │ │ │ -|			, ec.message().c_str());                                                                                                                                                    |
│ │ │ │ │ -|		TEST_CHECK(!ec);                                                                                                                                                             |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___b_l_o_o_m___f_i_l_t_e_r_._c_p_p_:|test size()                                                                                                                         |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_1_3_5_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt ssiizzee(()) **********                                                                                                                                                        |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____bb_ll_oo_oo_mm____ff_ii_ll_tt_ee_rr_.._cc_pp_pp_::_11_33_55_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___b_l_o_o_m___f_i_l_t_e_r_._c_p_p_:|test clear()                                                                                                                        |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_1_3_6_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt cclleeaarr(()) **********                                                                                                                                                       |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__bblloooomm__ffiilltteerr..ccpppp::113366 ******                                                                                                                                      |
│ │ │ │ │ +|sha1_hash k("\x01\x00\x02\x00                ");                                                                                                                               |
│ │ │ │ │ +|	TEST_CHECK(!filter.find(k));                                                                                                                                                  |
│ │ │ │ │ +|	filter.set(k);                                                                                                                                                                |
│ │ │ │ │ +|	TEST_CHECK(filter.find(k));                                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string certificate = combine_path("..", combine_path("ssl", "peer_certificate.pem"));                                                                                    |
│ │ │ │ │ -|	std::string private_key = combine_path("..", combine_path("ssl", "peer_private_key.pem"));                                                                                    |
│ │ │ │ │ -|	std::string dh_params = combine_path("..", combine_path("ssl", "dhparams.pem"));                                                                                              |
│ │ │ │ │ +|	std::uint8_t compare[4] = { 0x16, 0xff, 0x55, 0xaa};                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	if (flags & invalid_certificate)                                                                                                                                              |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		certificate = combine_path("..", combine_path("ssl", "invalid_peer_certificate.pem"));                                                                                       |
│ │ │ │ │ -|		private_key = combine_path("..", combine_path("ssl", "invalid_peer_private_key.pem"));                                                                                       |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|	bits_out = filter.to_string();                                                                                                                                                |
│ │ │ │ │ +|	TEST_EQUAL(memcmp(compare, bits_out.c_str(), 4), 0);                                                                                                                          |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ +|} // anonymous namespace                                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|if (flags & (valid_certificate | invalid_certificate))                                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::printf("set_password_callback\n");                                                                                                                                      |
│ │ │ │ │ -|		ctx.set_password_callback(                                                                                                                                                   |
│ │ │ │ │ -|			[](std::size_t, context::password_purpose) { return "test"; }                                                                                                               |
│ │ │ │ │ -|			, ec);                                                                                                                                                                      |
│ │ │ │ │ -|		if (ec)                                                                                                                                                                      |
│ │ │ │ │ +|TORRENT_TEST(bloom_filter)                                                                                                                                                     |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	test_set_and_get();                                                                                                                                                           |
│ │ │ │ │ +|	test_set_bits();                                                                                                                                                              |
│ │ │ │ │ +|	test_count_zeroes();                                                                                                                                                          |
│ │ │ │ │ +|	test_to_from_string();                                                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___m_e_r_k_l_e___t_r_e_e_._c_p_p_: |use structured bindings in C++17                                                                                                    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_2_3_3_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** uussee ssttrruuccttuurreedd bbiinnddiinnggss iinn CC++++1177 **********                                                                                                                                   |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__mmeerrkkllee__ttrreeee..ccpppp::223333 ******                                                                                                                                       |
│ │ │ │ │ +|mask[std::size_t(i)] = true;                                                                                                                                                   |
│ │ │ │ │ +|		t.load_sparse_tree(span<sha256_hash const>(f).subspan(first_piece, num_pieces), mask, empty_verified);                                                                       |
│ │ │ │ │ +|		int const end_piece_layer = first_piece + merkle_num_leafs(num_pieces);                                                                                                      |
│ │ │ │ │ +|		for (int i = 0; i < end_piece_layer; ++i)                                                                                                                                    |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			std::printf("Failed to set certificate passphrase: %s\n"                                                                                                                    |
│ │ │ │ │ -|				, ec.message().c_str());                                                                                                                                                   |
│ │ │ │ │ -|			TEST_CHECK(!ec);                                                                                                                                                            |
│ │ │ │ │ -|			return false;                                                                                                                                                               |
│ │ │ │ │ +|			TEST_CHECK(t.has_node(i));                                                                                                                                                  |
│ │ │ │ │ +|			TEST_CHECK(t.compare_node(i, f[i]));                                                                                                                                        |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		std::printf("use_certificate_file \"%s\"\n", certificate.c_str());                                                                                                           |
│ │ │ │ │ -|		ctx.use_certificate_file(certificate, context::pem, ec);                                                                                                                     |
│ │ │ │ │ -|		if (ec)                                                                                                                                                                      |
│ │ │ │ │ +|		for (int i = end_piece_layer; i < num_nodes; ++i)                                                                                                                            |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			std::printf("Failed to set certificate file: %s\n"                                                                                                                          |
│ │ │ │ │ -|				, ec.message().c_str());                                                                                                                                                   |
│ │ │ │ │ -|			TEST_CHECK(!ec);                                                                                                                                                            |
│ │ │ │ │ -|			return false;                                                                                                                                                               |
│ │ │ │ │ +|			TEST_CHECK(!t.has_node(i));                                                                                                                                                 |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		std::printf("use_private_key_file \"%s\"\n", private_key.c_str());                                                                                                           |
│ │ │ │ │ -|		ctx.use_private_key_file(private_key, context::pem, ec);                                                                                                                     |
│ │ │ │ │ -|		if (ec)                                                                                                                                                                      |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			std::printf("Failed to set private key: %s\n"                                                                                                                               |
│ │ │ │ │ -|				, ec.message().c_str());                                                                                                                                                   |
│ │ │ │ │ -|			TEST_CHECK(!ec);                                                                                                                                                            |
│ │ │ │ │ -|_	_	_	_r_e_t_u_r_n_ _f_a_l_s_e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___s_s_l_._c_p_p_:_5_0_9_ _ _ _ _ _ _|_a_l_s_o_ _t_e_s_t_ _u_s_i_n_g_ _a_ _h_a_s_h_ _t_h_a_t_ _r_e_f_e_r_s_ _t_o_ _a_ _v_a_l_i_d_ _t_o_r_r_e_n_t_ _b_u_t_ _t_h_a_t_ _d_i_f_f_e_r_s_ _f_r_o_m_ _t_h_e_ _S_N_I_ _h_a_s_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** aallssoo tteesstt uussiinngg aa hhaasshh tthhaatt rreeffeerrss ttoo aa vvaalliidd ttoorrrreenntt bbuutt tthhaatt ddiiffffeerrss ffrroomm tthhee SSNNII hhaasshh **********                                                                           |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__ssssll..ccpppp::550099 ******                                                                                                                                               |
│ │ │ │ │ -|print_alerts(ses1, "ses1", true, true, &on_alert);                                                                                                                             |
│ │ │ │ │ -|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::printf("Failed SSL handshake: %s\n"                                                                                                                                     |
│ │ │ │ │ -|			, ec.message().c_str());                                                                                                                                                    |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	char handshake[] = "\x13" "BitTorrent protocol\0\0\0\0\0\0\0\x04"                                                                                                             |
│ │ │ │ │ -|		"                    " // space for info-hash                                                                                                                                |
│ │ │ │ │ -|		"aaaaaaaaaaaaaaaaaaaa" // peer-id                                                                                                                                            |
│ │ │ │ │ -|		"\0\0\0\x01\x02"; // interested                                                                                                                                              |
│ │ │ │ │ +|namespace {                                                                                                                                                                    |
│ │ │ │ │ +|void test_roundtrip(aux::merkle_tree const& t                                                                                                                                  |
│ │ │ │ │ +|	, int const block_count                                                                                                                                                       |
│ │ │ │ │ +|	, int const blocks_per_piece)                                                                                                                                                 |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|aux::vector<bool> mask;                                                                                                                                                        |
│ │ │ │ │ +|std::vector<sha256_hash> tree;                                                                                                                                                 |
│ │ │ │ │ +|	std::tie(tree, mask) = t.build_sparse_vector();                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// fill in the info-hash                                                                                                                                                      |
│ │ │ │ │ -|	if (flags & valid_bittorrent_hash)                                                                                                                                            |
│ │ │ │ │ +|	aux::merkle_tree t2(block_count, blocks_per_piece, f[0].data());                                                                                                              |
│ │ │ │ │ +|	t2.load_sparse_tree(tree, mask, empty_verified);                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	TEST_CHECK(t.build_vector() == t2.build_vector());                                                                                                                            |
│ │ │ │ │ +|	for (int i = 0; i < int(t.size()); ++i)                                                                                                                                       |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::memcpy(handshake + 28, &t->info_hashes().v1[0], 20);                                                                                                                    |
│ │ │ │ │ +|		TEST_EQUAL(t[i], t2[i]);                                                                                                                                                     |
│ │ │ │ │ +|		TEST_EQUAL(t.has_node(i), t2.has_node(i));                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (!t.has_node(i))                                                                                                                                                          |
│ │ │ │ │ +|			TEST_CHECK(t[i].is_all_zeros());                                                                                                                                            |
│ │ │ │ │ +|		if (!t2.has_node(i))                                                                                                                                                         |
│ │ │ │ │ +|			TEST_CHECK(t2[i].is_all_zeros());                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TEST_CHECK(t.compare_node(i, t2[i]));                                                                                                                                        |
│ │ │ │ │ +|		TEST_CHECK(t2.compare_node(i, t[i]));                                                                                                                                        |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ -|	else                                                                                                                                                                          |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|std::generate(handshake + 28, handshake + 48, &rand);                                                                                                                          |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// fill in the peer-id                                                                                                                                                        |
│ │ │ │ │ -|	std::generate(handshake + 48, handshake + 68, &rand);                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	std::printf("bittorrent handshake\n");                                                                                                                                        |
│ │ │ │ │ -|	boost::asio::write(ssl_sock, boost::asio::buffer(handshake, (sizeof(handshake) - 1)), ec);                                                                                    |
│ │ │ │ │ -|	print_alerts(ses1, "ses1", true, true, &on_alert);                                                                                                                            |
│ │ │ │ │ -|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::printf("failed to write bittorrent handshake: %s\n"                                                                                                                     |
│ │ │ │ │ -|			, ec.message().c_str());                                                                                                                                                    |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	char buf[68];                                                                                                                                                                 |
│ │ │ │ │ -|	std::printf("read bittorrent handshake\n");                                                                                                                                   |
│ │ │ │ │ -|	boost::asio::read(ssl_sock, boost::asio::buffer(buf, sizeof(buf)), ec);                                                                                                       |
│ │ │ │ │ -|	print_alerts(ses1, "ses1", true, true, &on_alert);                                                                                                                            |
│ │ │ │ │ -|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::printf("failed to read bittorrent handshake: %s\n"                                                                                                                      |
│ │ │ │ │ -|			, ec.message().c_str());                                                                                                                                                    |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	if (memcmp(buf, "\x13" "BitTorrent protocol", 20) != 0)                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::printf("invalid bittorrent handshake\n");                                                                                                                               |
│ │ │ │ │ -|_	_	_r_e_t_u_r_n_ _f_a_l_s_e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___u_p_n_p_._c_p_p_:_1_5_6_ _ _ _ _ _|_s_t_o_r_e_ _t_h_e_ _l_o_g_ _a_n_d_ _v_e_r_i_f_y_ _t_h_a_t_ _s_o_m_e_ _k_e_y_ _m_e_s_s_a_g_e_s_ _a_r_e_ _t_h_e_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ssttoorree tthhee lloogg aanndd vveerriiffyy tthhaatt ssoommee kkeeyy mmeessssaaggeess aarree tthheerree **********                                                                                                          |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__uuppnnpp..ccpppp::115566 ******                                                                                                                                              |
│ │ │ │ │ -|, portmap_protocol const protocol, error_code const& err                                                                                                                       |
│ │ │ │ │ -|			, portmap_transport, aux::listen_socket_handle const&) override                                                                                                             |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			callback_info info = {mapping, port, err};                                                                                                                                  |
│ │ │ │ │ -|			callbacks.push_back(info);                                                                                                                                                  |
│ │ │ │ │ -|			std::cout << "mapping: " << static_cast<int>(mapping)                                                                                                                       |
│ │ │ │ │ -|				<< ", port: " << port << ", IP: " << ip                                                                                                                                    |
│ │ │ │ │ -|				<< ", proto: " << static_cast<int>(protocol)                                                                                                                               |
│ │ │ │ │ -|				<< ", error: \"" << err.message() << "\"\n";                                                                                                                               |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|	#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                               |
│ │ │ │ │ -|		bool should_log_portmap(portmap_transport) const override                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			return true;                                                                                                                                                                |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		void log_portmap(portmap_transport, char const* msg                                                                                                                          |
│ │ │ │ │ -|			, aux::listen_socket_handle const&) const override                                                                                                                          |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			std::cout << "UPnP: " << msg << std::endl;                                                                                                                                  |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|ip_interface pick_upnp_interface()                                                                                                                                             |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	lt::io_context ios;                                                                                                                                                           |
│ │ │ │ │ -|	error_code ec;                                                                                                                                                                |
│ │ │ │ │ -|	std::vector<ip_route> const routes = enum_routes(ios, ec);                                                                                                                    |
│ │ │ │ │ -|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::cerr << "failed to enumerate routes: " << ec.message() << '\n';                                                                                                         |
│ │ │ │ │ -|		TEST_CHECK(false);                                                                                                                                                           |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|	std::vector<ip_interface> const ifs = enum_net_interfaces(ios, ec);                                                                                                           |
│ │ │ │ │ -|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::cerr << "failed to enumerate network interfaces: " << ec.message() << '\n';                                                                                             |
│ │ │ │ │ -|		TEST_CHECK(false);                                                                                                                                                           |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|	int idx = 0;                                                                                                                                                                  |
│ │ │ │ │ -|	for (auto const& face : ifs)                                                                                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (!face.interface_address.is_v4()) continue;                                                                                                                               |
│ │ │ │ │ -|		std::cout << " - " << idx                                                                                                                                                    |
│ │ │ │ │ -|			<< ' ' << face.interface_address.to_string()                                                                                                                                |
│ │ │ │ │ -|			<< ' ' << int(static_cast<std::uint8_t>(face.state))                                                                                                                        |
│ │ │ │ │ -|			<< ' ' << static_cast<std::uint32_t>(face.flags)                                                                                                                            |
│ │ │ │ │ -|_	_	_	_<_<_ _'_ _'_ _<_<_ _f_a_c_e_._n_a_m_e_ _<_<_ _'_\_n_'_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___b_l_o_o_m___f_i_l_t_e_r_._c_p_p_:|test size()                                                                                                                         |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_1_3_5_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt ssiizzee(()) **********                                                                                                                                                        |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____bb_ll_oo_oo_mm____ff_ii_ll_tt_ee_rr_.._cc_pp_pp_::_11_33_55_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___b_l_o_o_m___f_i_l_t_e_r_._c_p_p_:|test clear()                                                                                                                        |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_1_3_6_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt cclleeaarr(()) **********                                                                                                                                                       |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__bblloooomm__ffiilltteerr..ccpppp::113366 ******                                                                                                                                      |
│ │ │ │ │ -|sha1_hash k("\x01\x00\x02\x00                ");                                                                                                                               |
│ │ │ │ │ -|	TEST_CHECK(!filter.find(k));                                                                                                                                                  |
│ │ │ │ │ -|	filter.set(k);                                                                                                                                                                |
│ │ │ │ │ -|	TEST_CHECK(filter.find(k));                                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	std::uint8_t compare[4] = { 0x16, 0xff, 0x55, 0xaa};                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	bits_out = filter.to_string();                                                                                                                                                |
│ │ │ │ │ -|	TEST_EQUAL(memcmp(compare, bits_out.c_str(), 4), 0);                                                                                                                          |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|} // anonymous namespace                                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(bloom_filter)                                                                                                                                                     |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	test_set_and_get();                                                                                                                                                           |
│ │ │ │ │ -|	test_set_bits();                                                                                                                                                              |
│ │ │ │ │ -|	test_count_zeroes();                                                                                                                                                          |
│ │ │ │ │ -|	test_to_from_string();                                                                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___m_e_r_k_l_e___t_r_e_e_._c_p_p_: |use structured bindings in C++17                                                                                                    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_2_3_3_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** uussee ssttrruuccttuurreedd bbiinnddiinnggss iinn CC++++1177 **********                                                                                                                                   |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__mmeerrkkllee__ttrreeee..ccpppp::223333 ******                                                                                                                                       |
│ │ │ │ │ -|mask[std::size_t(i)] = true;                                                                                                                                                   |
│ │ │ │ │ -|		t.load_sparse_tree(span<sha256_hash const>(f).subspan(first_piece, num_pieces), mask, empty_verified);                                                                       |
│ │ │ │ │ -|		int const end_piece_layer = first_piece + merkle_num_leafs(num_pieces);                                                                                                      |
│ │ │ │ │ -|		for (int i = 0; i < end_piece_layer; ++i)                                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			TEST_CHECK(t.has_node(i));                                                                                                                                                  |
│ │ │ │ │ -|			TEST_CHECK(t.compare_node(i, f[i]));                                                                                                                                        |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		for (int i = end_piece_layer; i < num_nodes; ++i)                                                                                                                            |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			TEST_CHECK(!t.has_node(i));                                                                                                                                                 |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|namespace {                                                                                                                                                                    |
│ │ │ │ │ -|void test_roundtrip(aux::merkle_tree const& t                                                                                                                                  |
│ │ │ │ │ -|	, int const block_count                                                                                                                                                       |
│ │ │ │ │ -|	, int const blocks_per_piece)                                                                                                                                                 |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|aux::vector<bool> mask;                                                                                                                                                        |
│ │ │ │ │ -|std::vector<sha256_hash> tree;                                                                                                                                                 |
│ │ │ │ │ -|	std::tie(tree, mask) = t.build_sparse_vector();                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	aux::merkle_tree t2(block_count, blocks_per_piece, f[0].data());                                                                                                              |
│ │ │ │ │ -|	t2.load_sparse_tree(tree, mask, empty_verified);                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	TEST_CHECK(t.build_vector() == t2.build_vector());                                                                                                                            |
│ │ │ │ │ -|	for (int i = 0; i < int(t.size()); ++i)                                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TEST_EQUAL(t[i], t2[i]);                                                                                                                                                     |
│ │ │ │ │ -|		TEST_EQUAL(t.has_node(i), t2.has_node(i));                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (!t.has_node(i))                                                                                                                                                          |
│ │ │ │ │ -|			TEST_CHECK(t[i].is_all_zeros());                                                                                                                                            |
│ │ │ │ │ -|		if (!t2.has_node(i))                                                                                                                                                         |
│ │ │ │ │ -|			TEST_CHECK(t2[i].is_all_zeros());                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TEST_CHECK(t.compare_node(i, t2[i]));                                                                                                                                        |
│ │ │ │ │ -|		TEST_CHECK(t2.compare_node(i, t[i]));                                                                                                                                        |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |TORRENT_TEST(roundtrip_empty_tree)                                                                                                                                             |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │  |	aux::merkle_tree t(num_blocks, 1, f[0].data());                                                                                                                               |
│ │ │ │ │  |	test_roundtrip(t, num_blocks, 1);                                                                                                                                             |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │ @@ -5161,22 +4999,122 @@
│ │ │ │ │  |	for (int i = 127; i < 127 + 4; ++i)                                                                                                                                           |
│ │ │ │ │  |		TEST_CHECK(t[i] == f[i]);                                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |	TEST_CHECK(t.verified_leafs() == none_set(num_blocks));                                                                                                                       |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___f_i_l_e___s_t_o_r_a_g_e_._c_p_p_:|test file attributes                                                                                                                |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_1_2_0_8_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt ffiillee aattttrriibbuutteess **********                                                                                                                                               |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____ff_ii_ll_ee____ss_tt_oo_rr_aa_gg_ee_.._cc_pp_pp_::_11_22_00_88_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___f_i_l_e___s_t_o_r_a_g_e_._c_p_p_:|test symlinks                                                                                                                       |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_1_2_0_9_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt ssyymmlliinnkkss **********                                                                                                                                                      |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____ff_ii_ll_ee____ss_tt_oo_rr_aa_gg_ee_.._cc_pp_pp_::_11_22_00_99_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___f_l_a_g_s_._c_p_p_:_1_6_3    |change to a different test setup. currently always paused. test_set_after_add(torrent_flags::paused); test_unset_after_add          |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_(_t_o_r_r_e_n_t___f_l_a_g_s_:_:_p_a_u_s_e_d_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** cchhaannggee ttoo aa ddiiffffeerreenntt tteesstt sseettuupp.. ccuurrrreennttllyy aallwwaayyss ppaauusseedd.. tteesstt__sseett__aafftteerr__aadddd((ttoorrrreenntt__ffllaaggss::::ppaauusseedd));; tteesstt__uunnsseett__aafftteerr__aadddd((ttoorrrreenntt__ffllaaggss::::ppaauusseedd));; **********                 |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__ffllaaggss..ccpppp::116633 ******                                                                                                                                             |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	// share-mode                                                                                                                                                                 |
│ │ │ │ │ +|	test_add_and_get_flags(torrent_flags::share_mode);                                                                                                                            |
│ │ │ │ │ +|	test_set_after_add(torrent_flags::share_mode);                                                                                                                                |
│ │ │ │ │ +|	test_unset_after_add(torrent_flags::share_mode);                                                                                                                              |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(flag_apply_ip_filter)                                                                                                                                             |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	// apply-ip-filter                                                                                                                                                            |
│ │ │ │ │ +|	test_add_and_get_flags(torrent_flags::apply_ip_filter);                                                                                                                       |
│ │ │ │ │ +|	test_set_after_add(torrent_flags::apply_ip_filter);                                                                                                                           |
│ │ │ │ │ +|	test_unset_after_add(torrent_flags::apply_ip_filter);                                                                                                                         |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(flag_paused)                                                                                                                                                      |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	// paused                                                                                                                                                                     |
│ │ │ │ │ +|	test_add_and_get_flags(torrent_flags::paused);                                                                                                                                |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(flag_auto_managed)                                                                                                                                                |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	// auto-managed                                                                                                                                                               |
│ │ │ │ │ +|	test_add_and_get_flags(torrent_flags::auto_managed);                                                                                                                          |
│ │ │ │ │ +|	test_set_after_add(torrent_flags::auto_managed);                                                                                                                              |
│ │ │ │ │ +|	test_unset_after_add(torrent_flags::auto_managed);                                                                                                                            |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|// super seeding mode is automatically turned off if we're not a seed                                                                                                          |
│ │ │ │ │ +|// since the posix_disk_io is not threaded, this will happen immediately                                                                                                       |
│ │ │ │ │ +|#if TORRENT_HAVE_MMAP                                                                                                                                                          |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_SUPERSEEDING                                                                                                                                           |
│ │ │ │ │ +|TORRENT_TEST(flag_super_seeding)                                                                                                                                               |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	// super-seeding                                                                                                                                                              |
│ │ │ │ │ +|	test_add_and_get_flags(torrent_flags::super_seeding);                                                                                                                         |
│ │ │ │ │ +|	test_unset_after_add(torrent_flags::super_seeding);                                                                                                                           |
│ │ │ │ │ +|	test_set_after_add(torrent_flags::super_seeding);                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(flag_sequential_download)                                                                                                                                         |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	// sequential-download                                                                                                                                                        |
│ │ │ │ │ +|	test_add_and_get_flags(torrent_flags::sequential_download);                                                                                                                   |
│ │ │ │ │ +|	test_set_after_add(torrent_flags::sequential_download);                                                                                                                       |
│ │ │ │ │ +|	test_unset_after_add(torrent_flags::sequential_download);                                                                                                                     |
│ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___f_l_a_g_s_._c_p_p_:_2_0_5    |this test is flaky, since the torrent will become ready before asking for the flags, and by then stop_when_ready will have been     |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_c_l_e_a_r_e_d_ _t_e_s_t___a_d_d___a_n_d___g_e_t___f_l_a_g_s_(_t_o_r_r_e_n_t___f_l_a_g_s_:_:_s_t_o_p___w_h_e_n___r_e_a_d_y_)_;_ _s_e_t_t_i_n_g_ _s_t_o_p_-_w_h_e_n_-_r_e_a_d_y_ _w_h_e_n_ _a_l_r_e_a_d_y_ _s_t_o_p_p_e_d_ _h_a_s_ _n_o_ _e_f_f_e_c_t_._ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss tteesstt iiss ffllaakkyy,, ssiinnccee tthhee ttoorrrreenntt wwiillll bbeeccoommee rreeaaddyy bbeeffoorree aasskkiinngg ffoorr tthhee ffllaaggss,, aanndd bbyy tthheenn ssttoopp__wwhheenn__rreeaaddyy wwiillll hhaavvee bbeeeenn cclleeaarreedd tteesstt__aadddd__aanndd__ggeett__ffllaaggss           |
│ │ │ │ │ +|((ttoorrrreenntt__ffllaaggss::::ssttoopp__wwhheenn__rreeaaddyy));; sseettttiinngg ssttoopp--wwhheenn--rreeaaddyy wwhheenn aallrreeaaddyy ssttooppppeedd hhaass nnoo eeffffeecctt.. **********                                                                            |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____ff_ll_aa_gg_ss_.._cc_pp_pp_::_22_00_55_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___f_l_a_g_s_._c_p_p_:_2_0_9_ _ _ _ _|_c_h_a_n_g_e_ _t_o_ _a_ _d_i_f_f_e_r_e_n_t_ _t_e_s_t_ _s_e_t_u_p_._ _c_u_r_r_e_n_t_l_y_ _a_l_w_a_y_s_ _p_a_u_s_e_d_._ _t_e_s_t___s_e_t___a_f_t_e_r___a_d_d_(_t_o_r_r_e_n_t___f_l_a_g_s_:_:_s_t_o_p___w_h_e_n___r_e_a_d_y_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** cchhaannggee ttoo aa ddiiffffeerreenntt tteesstt sseettuupp.. ccuurrrreennttllyy aallwwaayyss ppaauusseedd.. tteesstt__sseett__aafftteerr__aadddd((ttoorrrreenntt__ffllaaggss::::ssttoopp__wwhheenn__rreeaaddyy));; **********                                                     |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__ffllaaggss..ccpppp::220099 ******                                                                                                                                             |
│ │ │ │ │ +|test_set_after_add(torrent_flags::super_seeding);                                                                                                                              |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(flag_sequential_download)                                                                                                                                         |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	// sequential-download                                                                                                                                                        |
│ │ │ │ │ +|	test_add_and_get_flags(torrent_flags::sequential_download);                                                                                                                   |
│ │ │ │ │ +|	test_set_after_add(torrent_flags::sequential_download);                                                                                                                       |
│ │ │ │ │ +|	test_unset_after_add(torrent_flags::sequential_download);                                                                                                                     |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|// the stop when ready flag will be cleared when the torrent is ready to start                                                                                                 |
│ │ │ │ │ +|// downloading.                                                                                                                                                                |
│ │ │ │ │ +|// since the posix_disk_io is not threaded, this will happen immediately                                                                                                       |
│ │ │ │ │ +|#if TORRENT_HAVE_MMAP                                                                                                                                                          |
│ │ │ │ │ +|TORRENT_TEST(flag_stop_when_ready)                                                                                                                                             |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	// stop-when-ready                                                                                                                                                            |
│ │ │ │ │ +|test_unset_after_add(torrent_flags::stop_when_ready);                                                                                                                          |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(flag_disable_dht)                                                                                                                                                 |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	test_add_and_get_flags(torrent_flags::disable_dht);                                                                                                                           |
│ │ │ │ │ +|	test_set_after_add(torrent_flags::disable_dht);                                                                                                                               |
│ │ │ │ │ +|	test_unset_after_add(torrent_flags::disable_dht);                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(flag_disable_lsd)                                                                                                                                                 |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	test_add_and_get_flags(torrent_flags::disable_lsd);                                                                                                                           |
│ │ │ │ │ +|	test_set_after_add(torrent_flags::disable_lsd);                                                                                                                               |
│ │ │ │ │ +|	test_unset_after_add(torrent_flags::disable_lsd);                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(flag_disable_pex)                                                                                                                                                 |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	test_add_and_get_flags(torrent_flags::disable_pex);                                                                                                                           |
│ │ │ │ │ +|	test_set_after_add(torrent_flags::disable_pex);                                                                                                                               |
│ │ │ │ │ +|	test_unset_after_add(torrent_flags::disable_pex);                                                                                                                             |
│ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_t_e_s_t_/_t_e_s_t___t_o_r_r_e_n_t___i_n_f_o_._c_p_p_:|test remap_files                                                                                                                    |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_4_5_9_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** tteesstt rreemmaapp__ffiilleess **********                                                                                                                                                   |
│ │ │ │ │  |_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_oo_rr_rr_ee_nn_tt____ii_nn_ff_oo_.._cc_pp_pp_::_44_55_99_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_t_e_s_t_/_t_e_s_t___t_o_r_r_e_n_t___i_n_f_o_._c_p_p_:|torrent with 'p' (padfile) attribute                                                                                                |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_4_6_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** ttoorrrreenntt wwiitthh ''pp'' ((ppaaddffiillee)) aattttrriibbuuttee **********                                                                                                                               |
│ │ │ │ │ @@ -5285,165 +5223,126 @@
│ │ │ │ │  |	entry::list_type l;                                                                                                                                                           |
│ │ │ │ │  |	l.push_back(entry("http://foo.com/bar1"));                                                                                                                                    |
│ │ │ │ │  |	l.push_back(entry("http://foo.com/bar1"));                                                                                                                                    |
│ │ │ │ │  |	l.push_back(entry("http://foo.com/bar2"));                                                                                                                                    |
│ │ │ │ │  |	entry const e(l);                                                                                                                                                             |
│ │ │ │ │  |	entry torrent;                                                                                                                                                                |
│ │ │ │ │  |_	_t_o_r_r_e_n_t_[_"_u_r_l_-_l_i_s_t_"_]_ _=_ _e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_n_s_f_e_r_._c_p_p_:_1_7_3_ _|_t_h_e_s_e_ _s_e_t_t_i_n_g_s___p_a_c_k_ _t_e_s_t_s_ _b_e_l_o_n_g_ _i_n_ _t_h_e_i_r_ _o_w_n_ _t_e_s_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthheessee sseettttiinnggss__ppaacckk tteessttss bbeelloonngg iinn tthheeiirr oowwnn tteesstt **********                                                                                                                 |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__ttrraannssffeerr..ccpppp::117733 ******                                                                                                                                          |
│ │ │ │ │ -|// to the time it will take to complete the test                                                                                                                               |
│ │ │ │ │ -|	pack.set_int(settings_pack::min_reconnect_time, 0);                                                                                                                           |
│ │ │ │ │ -|	pack.set_int(settings_pack::stop_tracker_timeout, 1);                                                                                                                         |
│ │ │ │ │ -|	pack.set_bool(settings_pack::announce_to_all_trackers, true);                                                                                                                 |
│ │ │ │ │ -|	pack.set_bool(settings_pack::announce_to_all_tiers, true);                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// make sure we announce to both http and udp trackers                                                                                                                        |
│ │ │ │ │ -|	pack.set_bool(settings_pack::prefer_udp_trackers, false);                                                                                                                     |
│ │ │ │ │ -|	pack.set_bool(settings_pack::enable_outgoing_utp, false);                                                                                                                     |
│ │ │ │ │ -|	pack.set_bool(settings_pack::enable_incoming_utp, false);                                                                                                                     |
│ │ │ │ │ -|	pack.set_bool(settings_pack::enable_lsd, false);                                                                                                                              |
│ │ │ │ │ -|	pack.set_bool(settings_pack::enable_natpmp, false);                                                                                                                           |
│ │ │ │ │ -|	pack.set_bool(settings_pack::enable_upnp, false);                                                                                                                             |
│ │ │ │ │ -|	pack.set_bool(settings_pack::enable_dht, false);                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);                                                                                                      |
│ │ │ │ │ -|	pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_disabled);                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	pack.set_bool(settings_pack::allow_multiple_connections_per_ip, false);                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|pack.set_int(settings_pack::unchoke_slots_limit, 0);                                                                                                                           |
│ │ │ │ │ -|ses1.apply_settings(pack);                                                                                                                                                     |
│ │ │ │ │ -|	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == 0);                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	pack.set_int(settings_pack::unchoke_slots_limit, -1);                                                                                                                         |
│ │ │ │ │ -|	ses1.apply_settings(pack);                                                                                                                                                    |
│ │ │ │ │ -|	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == -1);                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	pack.set_int(settings_pack::unchoke_slots_limit, 8);                                                                                                                          |
│ │ │ │ │ -|	ses1.apply_settings(pack);                                                                                                                                                    |
│ │ │ │ │ -|	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == 8);                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	ses2.apply_settings(pack);                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	torrent_handle tor1;                                                                                                                                                          |
│ │ │ │ │ -|	torrent_handle tor2;                                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	create_directory("tmp1_transfer", ec);                                                                                                                                        |
│ │ │ │ │ -|	std::ofstream file("tmp1_transfer/temporary");                                                                                                                                |
│ │ │ │ │ -|	std::shared_ptr<torrent_info> t = ::create_torrent(&file, "temporary", 32 * 1024, 13, false);                                                                                 |
│ │ │ │ │ -|	file.close();                                                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	TEST_CHECK(exists(combine_path("tmp1_transfer", "temporary")));                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	add_torrent_params params;                                                                                                                                                    |
│ │ │ │ │ -|	params.storage_mode = storage_mode;                                                                                                                                           |
│ │ │ │ │ -|	params.flags &= ~torrent_flags::paused;                                                                                                                                       |
│ │ │ │ │ -|	params.flags &= ~torrent_flags::auto_managed;                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	wait_for_listen(ses1, "ses1");                                                                                                                                                |
│ │ │ │ │ -|_	_w_a_i_t___f_o_r___l_i_s_t_e_n_(_s_e_s_2_,_ _"_s_e_s_2_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/                      |test the case where we have > 120 samples (and have the base delay actually be updated)                                             |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t___t_i_m_e_s_t_a_m_p___h_i_s_t_o_r_y_._c_p_p_:_5_4_ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt tthhee ccaassee wwhheerree wwee hhaavvee >> 112200 ssaammpplleess ((aanndd hhaavvee tthhee bbaassee ddeellaayy aaccttuuaallllyy bbee uuppddaatteedd)) **********                                                                            |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_ii_mm_ee_ss_tt_aa_mm_pp____hh_ii_ss_tt_oo_rr_yy_.._cc_pp_pp_::_55_44_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/                      |test the case where a sample is lower than the history entry but not lower than the base                                            |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t___t_i_m_e_s_t_a_m_p___h_i_s_t_o_r_y_._c_p_p_:_5_5_ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt tthhee ccaassee wwhheerree aa ssaammppllee iiss lloowweerr tthhaann tthhee hhiissttoorryy eennttrryy bbuutt nnoott lloowweerr tthhaann tthhee bbaassee **********                                                                           |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__ttiimmeessttaammpp__hhiissttoorryy..ccpppp::5555 ******                                                                                                                                  |
│ │ │ │ │ -|#include "libtorrent/aux_/timestamp_history.hpp"                                                                                                                               |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___s_s_l_._c_p_p_:_4_0_7_ _ _ _ _ _ _|_t_e_s_t_ _u_s_i_n_g_ _a_ _s_i_g_n_e_d_ _c_e_r_t_i_f_i_c_a_t_e_ _w_i_t_h_ _t_h_e_ _w_r_o_n_g_ _i_n_f_o_-_h_a_s_h_ _i_n_ _D_N_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt uussiinngg aa ssiiggnneedd cceerrttiiffiiccaattee wwiitthh tthhee wwrroonngg iinnffoo--hhaasshh iinn DDNN **********                                                                                                     |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__ssssll..ccpppp::440077 ******                                                                                                                                               |
│ │ │ │ │ +|// in verifying peers                                                                                                                                                          |
│ │ │ │ │ +|	ctx.set_verify_mode(context::verify_none, ec);                                                                                                                                |
│ │ │ │ │ +|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		std::printf("Failed to set SSL verify mode: %s\n"                                                                                                                            |
│ │ │ │ │ +|			, ec.message().c_str());                                                                                                                                                    |
│ │ │ │ │ +|		TEST_CHECK(!ec);                                                                                                                                                             |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(timestamp_history)                                                                                                                                                |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	using namespace lt;                                                                                                                                                           |
│ │ │ │ │ +|	std::string certificate = combine_path("..", combine_path("ssl", "peer_certificate.pem"));                                                                                    |
│ │ │ │ │ +|	std::string private_key = combine_path("..", combine_path("ssl", "peer_private_key.pem"));                                                                                    |
│ │ │ │ │ +|	std::string dh_params = combine_path("..", combine_path("ssl", "dhparams.pem"));                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	aux::timestamp_history h;                                                                                                                                                     |
│ │ │ │ │ -|	TEST_EQUAL(h.add_sample(0x32, false), 0);                                                                                                                                     |
│ │ │ │ │ -|	TEST_EQUAL(h.base(), 0x32);                                                                                                                                                   |
│ │ │ │ │ -|	TEST_EQUAL(h.add_sample(0x33, false), 0x1);                                                                                                                                   |
│ │ │ │ │ -|	TEST_EQUAL(h.base(), 0x32);                                                                                                                                                   |
│ │ │ │ │ -|	TEST_EQUAL(h.add_sample(0x3433, false), 0x3401);                                                                                                                              |
│ │ │ │ │ -|	TEST_EQUAL(h.base(), 0x32);                                                                                                                                                   |
│ │ │ │ │ -|	TEST_EQUAL(h.add_sample(0x30, false), 0);                                                                                                                                     |
│ │ │ │ │ -|	TEST_EQUAL(h.base(), 0x30);                                                                                                                                                   |
│ │ │ │ │ +|	if (flags & invalid_certificate)                                                                                                                                              |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		certificate = combine_path("..", combine_path("ssl", "invalid_peer_certificate.pem"));                                                                                       |
│ │ │ │ │ +|		private_key = combine_path("..", combine_path("ssl", "invalid_peer_private_key.pem"));                                                                                       |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// test that wrapping of the timestamp is properly handled                                                                                                                    |
│ │ │ │ │ -|	h.add_sample(0xfffffff3, false);                                                                                                                                              |
│ │ │ │ │ -|	TEST_EQUAL(h.base(), 0xfffffff3);                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_c_k_e_r_._c_p_p_:_6_0_ _ _ _|_t_e_s_t_ _s_c_r_a_p_e_ _r_e_q_u_e_s_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt ssccrraappee rreeqquueessttss **********                                                                                                                                               |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_rr_aa_cc_kk_ee_rr_.._cc_pp_pp_::_66_00_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_c_k_e_r_._c_p_p_:_6_1_ _ _ _|_t_e_s_t_ _p_a_r_s_e_ _p_e_e_r_s_6_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt ppaarrssee ppeeeerrss66 **********                                                                                                                                                  |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_rr_aa_cc_kk_ee_rr_.._cc_pp_pp_::_66_11_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_c_k_e_r_._c_p_p_:_6_2_ _ _ _|_t_e_s_t_ _p_a_r_s_e_ _t_r_a_c_k_e_r_-_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt ppaarrssee ttrraacckkeerr--iidd **********                                                                                                                                              |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_rr_aa_cc_kk_ee_rr_.._cc_pp_pp_::_66_22_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_c_k_e_r_._c_p_p_:_6_3_ _ _ _|_t_e_s_t_ _p_a_r_s_e_ _f_a_i_l_u_r_e_-_r_e_a_s_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt ppaarrssee ffaaiilluurree--rreeaassoonn **********                                                                                                                                          |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_rr_aa_cc_kk_ee_rr_.._cc_pp_pp_::_66_33_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_c_k_e_r_._c_p_p_:_6_4   |test all failure paths, including invalid bencoding not a dictionary no files entry in scrape response no info-hash entry in scrape |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_r_e_s_p_o_n_s_e_ _m_a_l_f_o_r_m_e_d_ _p_e_e_r_s_ _i_n_ _p_e_e_r_ _l_i_s_t_ _o_f_ _d_i_c_t_i_o_n_a_r_i_e_s_ _u_n_e_v_e_n_ _n_u_m_b_e_r_ _o_f_ _b_y_t_e_s_ _i_n_ _p_e_e_r_s_ _a_n_d_ _p_e_e_r_s_6_ _s_t_r_i_n_g_ _r_e_s_p_o_n_s_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt aallll ffaaiilluurree ppaatthhss,, iinncclluuddiinngg iinnvvaalliidd bbeennccooddiinngg nnoott aa ddiiccttiioonnaarryy nnoo ffiilleess eennttrryy iinn ssccrraappee rreessppoonnssee nnoo iinnffoo--hhaasshh eennttrryy iinn ssccrraappee rreessppoonnssee mmaallffoorrmmeedd ppeeeerrss iinn ppeeeerr lliisstt|
│ │ │ │ │ -|ooff ddiiccttiioonnaarriieess uunneevveenn nnuummbbeerr ooff bbyytteess iinn ppeeeerrss aanndd ppeeeerrss66 ssttrriinngg rreessppoonnsseess **********                                                                                              |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__ttrraacckkeerr..ccpppp::6644 ******                                                                                                                                            |
│ │ │ │ │ -|#include "test_utils.hpp"                                                                                                                                                      |
│ │ │ │ │ -|#include "udp_tracker.hpp"                                                                                                                                                     |
│ │ │ │ │ -|#include "settings.hpp"                                                                                                                                                        |
│ │ │ │ │ -|#include "test_utils.hpp"                                                                                                                                                      |
│ │ │ │ │ -|#include "libtorrent/alert.hpp"                                                                                                                                                |
│ │ │ │ │ -|#include "libtorrent/peer_info.hpp" // for peer_list_entry                                                                                                                     |
│ │ │ │ │ -|#include "libtorrent/alert_types.hpp"                                                                                                                                          |
│ │ │ │ │ -|#include "libtorrent/session.hpp"                                                                                                                                              |
│ │ │ │ │ -|#include "libtorrent/session_params.hpp"                                                                                                                                       |
│ │ │ │ │ -|#include "libtorrent/error_code.hpp"                                                                                                                                           |
│ │ │ │ │ -|#include "libtorrent/tracker_manager.hpp"                                                                                                                                      |
│ │ │ │ │ -|#include "libtorrent/http_tracker_connection.hpp" // for parse_tracker_response                                                                                                |
│ │ │ │ │ -|#include "libtorrent/torrent_info.hpp"                                                                                                                                         |
│ │ │ │ │ -|#include "libtorrent/announce_entry.hpp"                                                                                                                                       |
│ │ │ │ │ -|#include "libtorrent/torrent.hpp"                                                                                                                                              |
│ │ │ │ │ -|#include "libtorrent/aux_/path.hpp"                                                                                                                                            |
│ │ │ │ │ -|#include "libtorrent/socket_io.hpp"                                                                                                                                            |
│ │ │ │ │ +|if (flags & (valid_certificate | invalid_certificate))                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		std::printf("set_password_callback\n");                                                                                                                                      |
│ │ │ │ │ +|		ctx.set_password_callback(                                                                                                                                                   |
│ │ │ │ │ +|			[](std::size_t, context::password_purpose) { return "test"; }                                                                                                               |
│ │ │ │ │ +|			, ec);                                                                                                                                                                      |
│ │ │ │ │ +|		if (ec)                                                                                                                                                                      |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			std::printf("Failed to set certificate passphrase: %s\n"                                                                                                                    |
│ │ │ │ │ +|				, ec.message().c_str());                                                                                                                                                   |
│ │ │ │ │ +|			TEST_CHECK(!ec);                                                                                                                                                            |
│ │ │ │ │ +|			return false;                                                                                                                                                               |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		std::printf("use_certificate_file \"%s\"\n", certificate.c_str());                                                                                                           |
│ │ │ │ │ +|		ctx.use_certificate_file(certificate, context::pem, ec);                                                                                                                     |
│ │ │ │ │ +|		if (ec)                                                                                                                                                                      |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			std::printf("Failed to set certificate file: %s\n"                                                                                                                          |
│ │ │ │ │ +|				, ec.message().c_str());                                                                                                                                                   |
│ │ │ │ │ +|			TEST_CHECK(!ec);                                                                                                                                                            |
│ │ │ │ │ +|			return false;                                                                                                                                                               |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		std::printf("use_private_key_file \"%s\"\n", private_key.c_str());                                                                                                           |
│ │ │ │ │ +|		ctx.use_private_key_file(private_key, context::pem, ec);                                                                                                                     |
│ │ │ │ │ +|		if (ec)                                                                                                                                                                      |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			std::printf("Failed to set private key: %s\n"                                                                                                                               |
│ │ │ │ │ +|				, ec.message().c_str());                                                                                                                                                   |
│ │ │ │ │ +|			TEST_CHECK(!ec);                                                                                                                                                            |
│ │ │ │ │ +|_	_	_	_r_e_t_u_r_n_ _f_a_l_s_e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___s_s_l_._c_p_p_:_5_0_9_ _ _ _ _ _ _|_a_l_s_o_ _t_e_s_t_ _u_s_i_n_g_ _a_ _h_a_s_h_ _t_h_a_t_ _r_e_f_e_r_s_ _t_o_ _a_ _v_a_l_i_d_ _t_o_r_r_e_n_t_ _b_u_t_ _t_h_a_t_ _d_i_f_f_e_r_s_ _f_r_o_m_ _t_h_e_ _S_N_I_ _h_a_s_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** aallssoo tteesstt uussiinngg aa hhaasshh tthhaatt rreeffeerrss ttoo aa vvaalliidd ttoorrrreenntt bbuutt tthhaatt ddiiffffeerrss ffrroomm tthhee SSNNII hhaasshh **********                                                                           |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__ssssll..ccpppp::550099 ******                                                                                                                                               |
│ │ │ │ │ +|print_alerts(ses1, "ses1", true, true, &on_alert);                                                                                                                             |
│ │ │ │ │ +|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		std::printf("Failed SSL handshake: %s\n"                                                                                                                                     |
│ │ │ │ │ +|			, ec.message().c_str());                                                                                                                                                    |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|using namespace lt;                                                                                                                                                            |
│ │ │ │ │ +|	char handshake[] = "\x13" "BitTorrent protocol\0\0\0\0\0\0\0\x04"                                                                                                             |
│ │ │ │ │ +|		"                    " // space for info-hash                                                                                                                                |
│ │ │ │ │ +|		"aaaaaaaaaaaaaaaaaaaa" // peer-id                                                                                                                                            |
│ │ │ │ │ +|		"\0\0\0\x01\x02"; // interested                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ +|	// fill in the info-hash                                                                                                                                                      |
│ │ │ │ │ +|	if (flags & valid_bittorrent_hash)                                                                                                                                            |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		std::memcpy(handshake + 28, &t->info_hashes().v1[0], 20);                                                                                                                    |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|	else                                                                                                                                                                          |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|std::generate(handshake + 28, handshake + 48, &rand);                                                                                                                          |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(parse_hostname_peers)                                                                                                                                             |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	char const response[] = "d5:peersld7:peer id20:aaaaaaaaaaaaaaaaaaaa"                                                                                                          |
│ │ │ │ │ -|		"2:ip13:test_hostname4:porti1000eed"                                                                                                                                         |
│ │ │ │ │ -|		"7:peer id20:bbbbabaababababababa2:ip12:another_host4:porti1001eeee";                                                                                                        |
│ │ │ │ │ -|	error_code ec;                                                                                                                                                                |
│ │ │ │ │ -|	tracker_response resp = parse_tracker_response(response                                                                                                                       |
│ │ │ │ │ -|		, ec, {}, sha1_hash());                                                                                                                                                      |
│ │ │ │ │ +|	// fill in the peer-id                                                                                                                                                        |
│ │ │ │ │ +|	std::generate(handshake + 48, handshake + 68, &rand);                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	TEST_EQUAL(ec, error_code());                                                                                                                                                 |
│ │ │ │ │ -|	TEST_EQUAL(resp.peers.size(), 2);                                                                                                                                             |
│ │ │ │ │ -|	if (resp.peers.size() == 2)                                                                                                                                                   |
│ │ │ │ │ +|	std::printf("bittorrent handshake\n");                                                                                                                                        |
│ │ │ │ │ +|	boost::asio::write(ssl_sock, boost::asio::buffer(handshake, (sizeof(handshake) - 1)), ec);                                                                                    |
│ │ │ │ │ +|	print_alerts(ses1, "ses1", true, true, &on_alert);                                                                                                                            |
│ │ │ │ │ +|	if (ec)                                                                                                                                                                       |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		peer_entry const& e0 = resp.peers[0];                                                                                                                                        |
│ │ │ │ │ -|		peer_entry const& e1 = resp.peers[1];                                                                                                                                        |
│ │ │ │ │ -|		TEST_EQUAL(e0.hostname, "test_hostname");                                                                                                                                    |
│ │ │ │ │ -|		TEST_EQUAL(e0.port, 1000);                                                                                                                                                   |
│ │ │ │ │ -|		TEST_EQUAL(e0.pid, peer_id("aaaaaaaaaaaaaaaaaaaa"));                                                                                                                         |
│ │ │ │ │ +|		std::printf("failed to write bittorrent handshake: %s\n"                                                                                                                     |
│ │ │ │ │ +|			, ec.message().c_str());                                                                                                                                                    |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		TEST_EQUAL(e1.hostname, "another_host");                                                                                                                                     |
│ │ │ │ │ -|		TEST_EQUAL(e1.port, 1001);                                                                                                                                                   |
│ │ │ │ │ -|		TEST_EQUAL(e1.pid, peer_id("bbbbabaababababababa"));                                                                                                                         |
│ │ │ │ │ +|	char buf[68];                                                                                                                                                                 |
│ │ │ │ │ +|	std::printf("read bittorrent handshake\n");                                                                                                                                   |
│ │ │ │ │ +|	boost::asio::read(ssl_sock, boost::asio::buffer(buf, sizeof(buf)), ec);                                                                                                       |
│ │ │ │ │ +|	print_alerts(ses1, "ses1", true, true, &on_alert);                                                                                                                            |
│ │ │ │ │ +|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		std::printf("failed to read bittorrent handshake: %s\n"                                                                                                                      |
│ │ │ │ │ +|			, ec.message().c_str());                                                                                                                                                    |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(parse_peers4)                                                                                                                                                     |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	char const response[] = "d5:peers12:\x01\x02\x03\x04\x30\x10"                                                                                                                 |
│ │ │ │ │ -|		"\x09\x08\x07\x06\x20\x10" "e";                                                                                                                                              |
│ │ │ │ │ -|_	_e_r_r_o_r___c_o_d_e_ _e_c_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|	if (memcmp(buf, "\x13" "BitTorrent protocol", 20) != 0)                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		std::printf("invalid bittorrent handshake\n");                                                                                                                               |
│ │ │ │ │ +|_	_	_r_e_t_u_r_n_ _f_a_l_s_e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/                      |test sending invalid requests (out of bound piece index, offsets and sizes)                                                         |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t___f_a_s_t___e_x_t_e_n_s_i_o_n_._c_p_p_:_1_1_3_5_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt sseennddiinngg iinnvvaalliidd rreeqquueessttss ((oouutt ooff bboouunndd ppiieeccee iinnddeexx,, ooffffsseettss aanndd ssiizzeess)) **********                                                                                        |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____ff_aa_ss_tt____ee_xx_tt_ee_nn_ss_ii_oo_nn_.._cc_pp_pp_::_11_11_33_55_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_t_e_s_t_/_t_e_s_t___p_e_e_r___l_i_s_t_._c_p_p_:   |test erasing peers                                                                                                                  |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_1_2_4_1_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** tteesstt eerraassiinngg ppeeeerrss **********                                                                                                                                                 |
│ │ │ │ │  |_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____pp_ee_ee_rr____ll_ii_ss_tt_.._cc_pp_pp_::_11_22_44_11_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_t_e_s_t_/_t_e_s_t___p_e_e_r___l_i_s_t_._c_p_p_:   |test update_peer_port with allow_multiple_connections_per_ip and without                                                            |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_1_2_4_2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** tteesstt uuppddaattee__ppeeeerr__ppoorrtt wwiitthh aallllooww__mmuullttiippllee__ccoonnnneeccttiioonnss__ppeerr__iipp aanndd wwiitthhoouutt **********                                                                                           |
│ │ │ │ │ @@ -5472,232 +5371,14 @@
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_1_2_4_8_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** tteesstt ccoonnnneeccttiioonn__cclloosseedd **********                                                                                                                                             |
│ │ │ │ │  |_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____pp_ee_ee_rr____ll_ii_ss_tt_.._cc_pp_pp_::_11_22_44_88_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_t_e_s_t_/_t_e_s_t___p_e_e_r___l_i_s_t_._c_p_p_:   |connect candidates recalculation when incrementing failcount                                                                        |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_1_2_4_9_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** ccoonnnneecctt ccaannddiiddaatteess rreeccaallccuullaattiioonn wwhheenn iinnccrreemmeennttiinngg ffaaiillccoouunntt **********                                                                                                       |
│ │ │ │ │  |_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____pp_ee_ee_rr____ll_ii_ss_tt_.._cc_pp_pp_::_11_22_44_99_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___d_h_t_._c_p_p_:_4_7_2_ _ _ _ _ _ _|_c_h_e_c_k_ _t_o_ _m_a_k_e_ _s_u_r_e_ _t_h_e_ _"_b_e_s_t_"_ _i_t_e_m_s_ _a_r_e_ _s_t_o_r_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** cchheecckk ttoo mmaakkee ssuurree tthhee ""bbeesstt"" iitteemmss aarree ssttoorreedd **********                                                                                                                     |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__ddhhtt..ccpppp::447722 ******                                                                                                                                               |
│ │ │ │ │ -|, msg_args().target(items[j].target));                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		key_desc_t const desc[] =                                                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			{ "r", bdecode_node::dict_t, 0, key_desc_t::parse_children },                                                                                                               |
│ │ │ │ │ -|				{ "v", bdecode_node::dict_t, 0, 0},                                                                                                                                        |
│ │ │ │ │ -|				{ "id", bdecode_node::string_t, 20, key_desc_t::last_child},                                                                                                               |
│ │ │ │ │ -|			{ "y", bdecode_node::string_t, 1, 0},                                                                                                                                       |
│ │ │ │ │ -|		};                                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		bdecode_node parsed[4];                                                                                                                                                      |
│ │ │ │ │ -|		char error_string[200];                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		int ret = verify_message(response, desc, parsed, error_string);                                                                                                              |
│ │ │ │ │ -|		if (ret)                                                                                                                                                                     |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			items_num.insert(items_num.begin(), j);                                                                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|TEST_EQUAL(items_num.size(), 4);                                                                                                                                               |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|int sum_distance_exp(int s, node_entry const& e, node_id const& ref)                                                                                                           |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	return s + distance_exp(e.id, ref);                                                                                                                                           |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|std::vector<tcp::endpoint> g_got_peers;                                                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void get_peers_cb(std::vector<tcp::endpoint> const& peers)                                                                                                                     |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	g_got_peers.insert(g_got_peers.end(), peers.begin(), peers.end());                                                                                                            |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|std::vector<dht::item> g_got_items;                                                                                                                                            |
│ │ │ │ │ -|dht::item g_put_item;                                                                                                                                                          |
│ │ │ │ │ -|int g_put_count;                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void get_mutable_item_cb(dht::item const& i, bool a)                                                                                                                           |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	if (!a) return;                                                                                                                                                               |
│ │ │ │ │ -|	if (!i.empty())                                                                                                                                                               |
│ │ │ │ │ -|		g_got_items.push_back(i);                                                                                                                                                    |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void put_mutable_item_data_cb(dht::item& i)                                                                                                                                    |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	if (!i.empty())                                                                                                                                                               |
│ │ │ │ │ -|_	_	_g___g_o_t___i_t_e_m_s_._p_u_s_h___b_a_c_k_(_i_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___d_h_t_._c_p_p_:_3_2_2_3_ _ _ _ _ _|_t_h_i_s_ _w_o_n_'_t_ _w_o_r_k_ _b_e_c_a_u_s_e_ _t_h_e_ _s_e_c_o_n_d_ _n_o_d_e_ _i_s_n_'_t_ _p_i_n_g_e_d_ _s_o_ _i_t_ _w_o_n_t_ _b_e_ _a_d_d_e_d_ _t_o_ _t_h_e_ _r_o_u_t_i_n_g_ _t_a_b_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss wwoonn''tt wwoorrkk bbeeccaauussee tthhee sseeccoonndd nnooddee iissnn''tt ppiinnggeedd ssoo iitt wwoonntt bbee aaddddeedd ttoo tthhee rroouuttiinngg ttaabbllee **********                                                                      |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__ddhhtt..ccpppp::33222233 ******                                                                                                                                              |
│ │ │ │ │ -|bool ret = verify_message(request, get_item_desc_ro, parsed, error_string);                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	TEST_CHECK(ret);                                                                                                                                                              |
│ │ │ │ │ -|	TEST_EQUAL(parsed[3].int_value(), 1);                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// should have one node now, which is 4.4.4.4:1234                                                                                                                            |
│ │ │ │ │ -|	TEST_EQUAL(std::get<0>(node.size()), 1);                                                                                                                                      |
│ │ │ │ │ -|	// and no replacement nodes                                                                                                                                                   |
│ │ │ │ │ -|	TEST_EQUAL(std::get<1>(node.size()), 0);                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// now, disable read_only, try again.                                                                                                                                         |
│ │ │ │ │ -|	g_sent_packets.clear();                                                                                                                                                       |
│ │ │ │ │ -|	sett.set_bool(settings_pack::dht_read_only, false);                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	send_dht_request(node, "get", source, &response);                                                                                                                             |
│ │ │ │ │ -|	// sender should be added to replacement bucket                                                                                                                               |
│ │ │ │ │ -|	TEST_EQUAL(std::get<1>(node.size()), 1);                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	g_sent_packets.clear();                                                                                                                                                       |
│ │ │ │ │ -|#if 0                                                                                                                                                                          |
│ │ │ │ │ -|target = generate_next();                                                                                                                                                      |
│ │ │ │ │ -|node.get_item(target, get_immutable_item_cb);                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// since we have 2 nodes, we should have two packets.                                                                                                                         |
│ │ │ │ │ -|	TEST_EQUAL(g_sent_packets.size(), 2);                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// both of them shouldn't have a 'ro' key.                                                                                                                                    |
│ │ │ │ │ -|	node_from_entry(g_sent_packets.front().second, request);                                                                                                                      |
│ │ │ │ │ -|	ret = verify_message(request, get_item_desc_ro, parsed, error_string);                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	TEST_CHECK(ret);                                                                                                                                                              |
│ │ │ │ │ -|	TEST_CHECK(!parsed[3]);                                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	node_from_entry(g_sent_packets.back().second, request);                                                                                                                       |
│ │ │ │ │ -|	ret = verify_message(request, get_item_desc_ro, parsed, error_string);                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	TEST_CHECK(ret);                                                                                                                                                              |
│ │ │ │ │ -|	TEST_CHECK(!parsed[3]);                                                                                                                                                       |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|// these tests rely on logging being enabled                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(invalid_error_msg)                                                                                                                                                |
│ │ │ │ │ -|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___d_h_t_._c_p_p_:_4_0_8_1_ _ _ _ _ _|_t_e_s_t_ _o_b_f_u_s_c_a_t_e_d___g_e_t___p_e_e_r_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt oobbffuussccaatteedd__ggeett__ppeeeerrss **********                                                                                                                                          |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__ddhhtt..ccpppp::44008811 ******                                                                                                                                              |
│ │ │ │ │ -|TEST_CHECK(sm.has_quota());                                                                                                                                                    |
│ │ │ │ │ -|	});                                                                                                                                                                           |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(rate_limit_accrue_limit)                                                                                                                                          |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	aux::session_settings sett;                                                                                                                                                   |
│ │ │ │ │ -|	sett.set_int(settings_pack::dht_upload_rate_limit, std::numeric_limits<int>::max());                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	test_rate_limit(sett, [](lt::dht::socket_manager& sm) {                                                                                                                       |
│ │ │ │ │ -|		TEST_CHECK(sm.has_quota());                                                                                                                                                  |
│ │ │ │ │ -|		for (int i = 0; i < 10; ++i)                                                                                                                                                 |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			std::this_thread::sleep_for(milliseconds(500));                                                                                                                             |
│ │ │ │ │ -|			TEST_CHECK(sm.has_quota());                                                                                                                                                 |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|	});                                                                                                                                                                           |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|TORRENT_TEST(dht)                                                                                                                                                              |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	// dummy dht test                                                                                                                                                             |
│ │ │ │ │ -|	TEST_CHECK(true);                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/                      |test sending invalid requests (out of bound piece index, offsets and sizes)                                                         |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t___f_a_s_t___e_x_t_e_n_s_i_o_n_._c_p_p_:_1_1_3_5_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt sseennddiinngg iinnvvaalliidd rreeqquueessttss ((oouutt ooff bboouunndd ppiieeccee iinnddeexx,, ooffffsseettss aanndd ssiizzeess)) **********                                                                                        |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____ff_aa_ss_tt____ee_xx_tt_ee_nn_ss_ii_oo_nn_.._cc_pp_pp_::_11_11_33_55_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/                      |test files with different piece size (negative test)                                                                                |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t___r_e_s_o_l_v_e___l_i_n_k_s_._c_p_p_:_9_5_ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteesstt ffiilleess wwiitthh ddiiffffeerreenntt ppiieeccee ssiizzee ((nneeggaattiivvee tteesstt)) **********                                                                                                               |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__rreessoollvvee__lliinnkkss..ccpppp::9955 ******                                                                                                                                      |
│ │ │ │ │ -|{ "test2", "test1_pad_files", 0},                                                                                                                                              |
│ │ │ │ │ -|	{ "test3", "test1_pad_files", 0},                                                                                                                                             |
│ │ │ │ │ -|	{ "test2", "test1_single", 0},                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// these are all padded. The first small file will accidentally also                                                                                                          |
│ │ │ │ │ -|	// match, even though it's not tail padded, the following file is identical                                                                                                   |
│ │ │ │ │ -|	{ "test2_pad_files", "test1_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|	{ "test3_pad_files", "test1_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|	{ "test3_pad_files", "test2_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|	{ "test1_pad_files", "test2_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|	{ "test1_pad_files", "test3_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|	{ "test2_pad_files", "test3_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// one might expect this to work, but since the tail of the single file                                                                                                       |
│ │ │ │ │ -|	// torrent is not padded, the last piece hash won't match                                                                                                                     |
│ │ │ │ │ -|	{ "test1_pad_files", "test1_single", 0},                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// if it's padded on the other hand, it will work                                                                                                                             |
│ │ │ │ │ -|	{ "test1_pad_files", "test1_single_padded", 1},                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_}_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/                      |it would be nice to test resolving of more than just 2 files as well. like 3 single file torrents merged into one, resolving all 3  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t___r_e_s_o_l_v_e___l_i_n_k_s_._c_p_p_:_9_8_ _ _ _ _ _|_f_i_l_e_s_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd bbee nniiccee ttoo tteesstt rreessoollvviinngg ooff mmoorree tthhaann jjuusstt 22 ffiilleess aass wweellll.. lliikkee 33 ssiinnggllee ffiillee ttoorrrreennttss mmeerrggeedd iinnttoo oonnee,, rreessoollvviinngg aallll 33 ffiilleess.. **********                          |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__rreessoollvvee__lliinnkkss..ccpppp::9988 ******                                                                                                                                      |
│ │ │ │ │ -|{ "test2", "test1_single", 0},                                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// these are all padded. The first small file will accidentally also                                                                                                          |
│ │ │ │ │ -|	// match, even though it's not tail padded, the following file is identical                                                                                                   |
│ │ │ │ │ -|	{ "test2_pad_files", "test1_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|	{ "test3_pad_files", "test1_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|	{ "test3_pad_files", "test2_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|	{ "test1_pad_files", "test2_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|	{ "test1_pad_files", "test3_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|	{ "test2_pad_files", "test3_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// one might expect this to work, but since the tail of the single file                                                                                                       |
│ │ │ │ │ -|	// torrent is not padded, the last piece hash won't match                                                                                                                     |
│ │ │ │ │ -|	{ "test1_pad_files", "test1_single", 0},                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// if it's padded on the other hand, it will work                                                                                                                             |
│ │ │ │ │ -|	{ "test1_pad_files", "test1_single_padded", 1},                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|};                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(resolve_links)                                                                                                                                                    |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	std::string path = combine_path(parent_path(current_working_directory())                                                                                                      |
│ │ │ │ │ -|		, "mutable_test_torrents");                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	for (int i = 0; i < int(sizeof(test_torrents)/sizeof(test_torrents[0])); ++i)                                                                                                 |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		test_torrent_t const& e = test_torrents[i];                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		std::string p = combine_path(path, e.filename1) + ".torrent";                                                                                                                |
│ │ │ │ │ -|		std::printf("loading %s\n", p.c_str());                                                                                                                                      |
│ │ │ │ │ -|		std::shared_ptr<torrent_info> ti1 = std::make_shared<torrent_info>(p);                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		p = combine_path(path, e.filename2) + ".torrent";                                                                                                                            |
│ │ │ │ │ -|		std::printf("loading %s\n", p.c_str());                                                                                                                                      |
│ │ │ │ │ -|		std::shared_ptr<torrent_info> ti2 = std::make_shared<torrent_info>(p);                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		std::printf("resolving\n");                                                                                                                                                  |
│ │ │ │ │ -|		resolve_links l(ti1);                                                                                                                                                        |
│ │ │ │ │ -|		l.match(ti2, ".");                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		aux::vector<resolve_links::link_t, file_index_t> const& links = l.get_links();                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		auto const num_matches = std::size_t(std::count_if(links.begin(), links.end()                                                                                                |
│ │ │ │ │ -|			, std::bind(&resolve_links::link_t::ti, _1)));                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// some debug output in case the test fails                                                                                                                                  |
│ │ │ │ │ -|		if (num_matches > e.expected_matches)                                                                                                                                        |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|_	_	_	_f_i_l_e___s_t_o_r_a_g_e_ _c_o_n_s_t_&_ _f_s_ _=_ _t_i_1_-_>_f_i_l_e_s_(_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___r_e_s_u_m_e_._c_p_p_:_5_8_2_ _ _ _|_t_e_s_t_ _w_h_a_t_ _h_a_p_p_e_n_s_ _w_h_e_n_ _l_o_a_d_i_n_g_ _a_ _r_e_s_u_m_e_ _f_i_l_e_ _w_i_t_h_ _b_o_t_h_ _p_i_e_c_e_ _p_r_i_o_r_i_t_i_e_s_ _a_n_d_ _f_i_l_e_ _p_r_i_o_r_i_t_i_e_s_ _(_f_i_l_e_ _p_r_i_o_ _s_h_o_u_l_d_ _t_a_k_e_ _p_r_e_c_e_d_e_n_c_e_)_ _ _ _ _ _ |
│ │ │ │ │  |********** tteesstt wwhhaatt hhaappppeennss wwhheenn llooaaddiinngg aa rreessuummee ffiillee wwiitthh bbootthh ppiieeccee pprriioorriittiieess aanndd ffiillee pprriioorriittiieess ((ffiillee pprriioo sshhoouulldd ttaakkee pprreecceeddeennccee)) **********                                     |
│ │ │ │ │  |****** ....//tteesstt//tteesstt__rreessuummee..ccpppp::558822 ******                                                                                                                                            |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │  |			TEST_EQUAL(pieces[i], true);                                                                                                                                                |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ @@ -5904,393 +5585,920 @@
│ │ │ │ │  |template <typename Fun>                                                                                                                                                        |
│ │ │ │ │  |void test_unfinished_pieces(Fun f)                                                                                                                                             |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │  |	// create a torrent and complete files                                                                                                                                        |
│ │ │ │ │  |	std::shared_ptr<torrent_info> ti = generate_torrent(true, true);                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |_	_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_ _p_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___f_l_a_g_s_._c_p_p_:_1_6_3    |change to a different test setup. currently always paused. test_set_after_add(torrent_flags::paused); test_unset_after_add          |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_(_t_o_r_r_e_n_t___f_l_a_g_s_:_:_p_a_u_s_e_d_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** cchhaannggee ttoo aa ddiiffffeerreenntt tteesstt sseettuupp.. ccuurrrreennttllyy aallwwaayyss ppaauusseedd.. tteesstt__sseett__aafftteerr__aadddd((ttoorrrreenntt__ffllaaggss::::ppaauusseedd));; tteesstt__uunnsseett__aafftteerr__aadddd((ttoorrrreenntt__ffllaaggss::::ppaauusseedd));; **********                 |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__ffllaaggss..ccpppp::116633 ******                                                                                                                                             |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/                      |test files with different piece size (negative test)                                                                                |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t___r_e_s_o_l_v_e___l_i_n_k_s_._c_p_p_:_9_5_ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt ffiilleess wwiitthh ddiiffffeerreenntt ppiieeccee ssiizzee ((nneeggaattiivvee tteesstt)) **********                                                                                                               |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__rreessoollvvee__lliinnkkss..ccpppp::9955 ******                                                                                                                                      |
│ │ │ │ │ +|{ "test2", "test1_pad_files", 0},                                                                                                                                              |
│ │ │ │ │ +|	{ "test3", "test1_pad_files", 0},                                                                                                                                             |
│ │ │ │ │ +|	{ "test2", "test1_single", 0},                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// these are all padded. The first small file will accidentally also                                                                                                          |
│ │ │ │ │ +|	// match, even though it's not tail padded, the following file is identical                                                                                                   |
│ │ │ │ │ +|	{ "test2_pad_files", "test1_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|	{ "test3_pad_files", "test1_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|	{ "test3_pad_files", "test2_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|	{ "test1_pad_files", "test2_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|	{ "test1_pad_files", "test3_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|	{ "test2_pad_files", "test3_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// one might expect this to work, but since the tail of the single file                                                                                                       |
│ │ │ │ │ +|	// torrent is not padded, the last piece hash won't match                                                                                                                     |
│ │ │ │ │ +|	{ "test1_pad_files", "test1_single", 0},                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// if it's padded on the other hand, it will work                                                                                                                             |
│ │ │ │ │ +|	{ "test1_pad_files", "test1_single_padded", 1},                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_}_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/                      |it would be nice to test resolving of more than just 2 files as well. like 3 single file torrents merged into one, resolving all 3  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t___r_e_s_o_l_v_e___l_i_n_k_s_._c_p_p_:_9_8_ _ _ _ _ _|_f_i_l_e_s_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd bbee nniiccee ttoo tteesstt rreessoollvviinngg ooff mmoorree tthhaann jjuusstt 22 ffiilleess aass wweellll.. lliikkee 33 ssiinnggllee ffiillee ttoorrrreennttss mmeerrggeedd iinnttoo oonnee,, rreessoollvviinngg aallll 33 ffiilleess.. **********                          |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__rreessoollvvee__lliinnkkss..ccpppp::9988 ******                                                                                                                                      |
│ │ │ │ │ +|{ "test2", "test1_single", 0},                                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// these are all padded. The first small file will accidentally also                                                                                                          |
│ │ │ │ │ +|	// match, even though it's not tail padded, the following file is identical                                                                                                   |
│ │ │ │ │ +|	{ "test2_pad_files", "test1_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|	{ "test3_pad_files", "test1_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|	{ "test3_pad_files", "test2_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|	{ "test1_pad_files", "test2_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|	{ "test1_pad_files", "test3_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|	{ "test2_pad_files", "test3_pad_files", 2},                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// one might expect this to work, but since the tail of the single file                                                                                                       |
│ │ │ │ │ +|	// torrent is not padded, the last piece hash won't match                                                                                                                     |
│ │ │ │ │ +|	{ "test1_pad_files", "test1_single", 0},                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// if it's padded on the other hand, it will work                                                                                                                             |
│ │ │ │ │ +|	{ "test1_pad_files", "test1_single_padded", 1},                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|};                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(resolve_links)                                                                                                                                                    |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	// share-mode                                                                                                                                                                 |
│ │ │ │ │ -|	test_add_and_get_flags(torrent_flags::share_mode);                                                                                                                            |
│ │ │ │ │ -|	test_set_after_add(torrent_flags::share_mode);                                                                                                                                |
│ │ │ │ │ -|	test_unset_after_add(torrent_flags::share_mode);                                                                                                                              |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	std::string path = combine_path(parent_path(current_working_directory())                                                                                                      |
│ │ │ │ │ +|		, "mutable_test_torrents");                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(flag_apply_ip_filter)                                                                                                                                             |
│ │ │ │ │ +|	for (int i = 0; i < int(sizeof(test_torrents)/sizeof(test_torrents[0])); ++i)                                                                                                 |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		test_torrent_t const& e = test_torrents[i];                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		std::string p = combine_path(path, e.filename1) + ".torrent";                                                                                                                |
│ │ │ │ │ +|		std::printf("loading %s\n", p.c_str());                                                                                                                                      |
│ │ │ │ │ +|		std::shared_ptr<torrent_info> ti1 = std::make_shared<torrent_info>(p);                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		p = combine_path(path, e.filename2) + ".torrent";                                                                                                                            |
│ │ │ │ │ +|		std::printf("loading %s\n", p.c_str());                                                                                                                                      |
│ │ │ │ │ +|		std::shared_ptr<torrent_info> ti2 = std::make_shared<torrent_info>(p);                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		std::printf("resolving\n");                                                                                                                                                  |
│ │ │ │ │ +|		resolve_links l(ti1);                                                                                                                                                        |
│ │ │ │ │ +|		l.match(ti2, ".");                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		aux::vector<resolve_links::link_t, file_index_t> const& links = l.get_links();                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		auto const num_matches = std::size_t(std::count_if(links.begin(), links.end()                                                                                                |
│ │ │ │ │ +|			, std::bind(&resolve_links::link_t::ti, _1)));                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// some debug output in case the test fails                                                                                                                                  |
│ │ │ │ │ +|		if (num_matches > e.expected_matches)                                                                                                                                        |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|_	_	_	_f_i_l_e___s_t_o_r_a_g_e_ _c_o_n_s_t_&_ _f_s_ _=_ _t_i_1_-_>_f_i_l_e_s_(_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_c_k_e_r_._c_p_p_:_6_0_ _ _ _|_t_e_s_t_ _s_c_r_a_p_e_ _r_e_q_u_e_s_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt ssccrraappee rreeqquueessttss **********                                                                                                                                               |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_rr_aa_cc_kk_ee_rr_.._cc_pp_pp_::_66_00_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_c_k_e_r_._c_p_p_:_6_1_ _ _ _|_t_e_s_t_ _p_a_r_s_e_ _p_e_e_r_s_6_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt ppaarrssee ppeeeerrss66 **********                                                                                                                                                  |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_rr_aa_cc_kk_ee_rr_.._cc_pp_pp_::_66_11_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_c_k_e_r_._c_p_p_:_6_2_ _ _ _|_t_e_s_t_ _p_a_r_s_e_ _t_r_a_c_k_e_r_-_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt ppaarrssee ttrraacckkeerr--iidd **********                                                                                                                                              |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_rr_aa_cc_kk_ee_rr_.._cc_pp_pp_::_66_22_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_c_k_e_r_._c_p_p_:_6_3_ _ _ _|_t_e_s_t_ _p_a_r_s_e_ _f_a_i_l_u_r_e_-_r_e_a_s_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt ppaarrssee ffaaiilluurree--rreeaassoonn **********                                                                                                                                          |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_rr_aa_cc_kk_ee_rr_.._cc_pp_pp_::_66_33_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_c_k_e_r_._c_p_p_:_6_4   |test all failure paths, including invalid bencoding not a dictionary no files entry in scrape response no info-hash entry in scrape |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_r_e_s_p_o_n_s_e_ _m_a_l_f_o_r_m_e_d_ _p_e_e_r_s_ _i_n_ _p_e_e_r_ _l_i_s_t_ _o_f_ _d_i_c_t_i_o_n_a_r_i_e_s_ _u_n_e_v_e_n_ _n_u_m_b_e_r_ _o_f_ _b_y_t_e_s_ _i_n_ _p_e_e_r_s_ _a_n_d_ _p_e_e_r_s_6_ _s_t_r_i_n_g_ _r_e_s_p_o_n_s_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt aallll ffaaiilluurree ppaatthhss,, iinncclluuddiinngg iinnvvaalliidd bbeennccooddiinngg nnoott aa ddiiccttiioonnaarryy nnoo ffiilleess eennttrryy iinn ssccrraappee rreessppoonnssee nnoo iinnffoo--hhaasshh eennttrryy iinn ssccrraappee rreessppoonnssee mmaallffoorrmmeedd ppeeeerrss iinn ppeeeerr lliisstt|
│ │ │ │ │ +|ooff ddiiccttiioonnaarriieess uunneevveenn nnuummbbeerr ooff bbyytteess iinn ppeeeerrss aanndd ppeeeerrss66 ssttrriinngg rreessppoonnsseess **********                                                                                              |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__ttrraacckkeerr..ccpppp::6644 ******                                                                                                                                            |
│ │ │ │ │ +|#include "test_utils.hpp"                                                                                                                                                      |
│ │ │ │ │ +|#include "udp_tracker.hpp"                                                                                                                                                     |
│ │ │ │ │ +|#include "settings.hpp"                                                                                                                                                        |
│ │ │ │ │ +|#include "test_utils.hpp"                                                                                                                                                      |
│ │ │ │ │ +|#include "libtorrent/alert.hpp"                                                                                                                                                |
│ │ │ │ │ +|#include "libtorrent/peer_info.hpp" // for peer_list_entry                                                                                                                     |
│ │ │ │ │ +|#include "libtorrent/alert_types.hpp"                                                                                                                                          |
│ │ │ │ │ +|#include "libtorrent/session.hpp"                                                                                                                                              |
│ │ │ │ │ +|#include "libtorrent/session_params.hpp"                                                                                                                                       |
│ │ │ │ │ +|#include "libtorrent/error_code.hpp"                                                                                                                                           |
│ │ │ │ │ +|#include "libtorrent/tracker_manager.hpp"                                                                                                                                      |
│ │ │ │ │ +|#include "libtorrent/http_tracker_connection.hpp" // for parse_tracker_response                                                                                                |
│ │ │ │ │ +|#include "libtorrent/torrent_info.hpp"                                                                                                                                         |
│ │ │ │ │ +|#include "libtorrent/announce_entry.hpp"                                                                                                                                       |
│ │ │ │ │ +|#include "libtorrent/torrent.hpp"                                                                                                                                              |
│ │ │ │ │ +|#include "libtorrent/aux_/path.hpp"                                                                                                                                            |
│ │ │ │ │ +|#include "libtorrent/socket_io.hpp"                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|using namespace lt;                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(parse_hostname_peers)                                                                                                                                             |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	// apply-ip-filter                                                                                                                                                            |
│ │ │ │ │ -|	test_add_and_get_flags(torrent_flags::apply_ip_filter);                                                                                                                       |
│ │ │ │ │ -|	test_set_after_add(torrent_flags::apply_ip_filter);                                                                                                                           |
│ │ │ │ │ -|	test_unset_after_add(torrent_flags::apply_ip_filter);                                                                                                                         |
│ │ │ │ │ +|	char const response[] = "d5:peersld7:peer id20:aaaaaaaaaaaaaaaaaaaa"                                                                                                          |
│ │ │ │ │ +|		"2:ip13:test_hostname4:porti1000eed"                                                                                                                                         |
│ │ │ │ │ +|		"7:peer id20:bbbbabaababababababa2:ip12:another_host4:porti1001eeee";                                                                                                        |
│ │ │ │ │ +|	error_code ec;                                                                                                                                                                |
│ │ │ │ │ +|	tracker_response resp = parse_tracker_response(response                                                                                                                       |
│ │ │ │ │ +|		, ec, {}, sha1_hash());                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	TEST_EQUAL(ec, error_code());                                                                                                                                                 |
│ │ │ │ │ +|	TEST_EQUAL(resp.peers.size(), 2);                                                                                                                                             |
│ │ │ │ │ +|	if (resp.peers.size() == 2)                                                                                                                                                   |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		peer_entry const& e0 = resp.peers[0];                                                                                                                                        |
│ │ │ │ │ +|		peer_entry const& e1 = resp.peers[1];                                                                                                                                        |
│ │ │ │ │ +|		TEST_EQUAL(e0.hostname, "test_hostname");                                                                                                                                    |
│ │ │ │ │ +|		TEST_EQUAL(e0.port, 1000);                                                                                                                                                   |
│ │ │ │ │ +|		TEST_EQUAL(e0.pid, peer_id("aaaaaaaaaaaaaaaaaaaa"));                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TEST_EQUAL(e1.hostname, "another_host");                                                                                                                                     |
│ │ │ │ │ +|		TEST_EQUAL(e1.port, 1001);                                                                                                                                                   |
│ │ │ │ │ +|		TEST_EQUAL(e1.pid, peer_id("bbbbabaababababababa"));                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(flag_paused)                                                                                                                                                      |
│ │ │ │ │ +|TORRENT_TEST(parse_peers4)                                                                                                                                                     |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	// paused                                                                                                                                                                     |
│ │ │ │ │ -|	test_add_and_get_flags(torrent_flags::paused);                                                                                                                                |
│ │ │ │ │ +|	char const response[] = "d5:peers12:\x01\x02\x03\x04\x30\x10"                                                                                                                 |
│ │ │ │ │ +|		"\x09\x08\x07\x06\x20\x10" "e";                                                                                                                                              |
│ │ │ │ │ +|_	_e_r_r_o_r___c_o_d_e_ _e_c_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___u_p_n_p_._c_p_p_:_1_5_6_ _ _ _ _ _|_s_t_o_r_e_ _t_h_e_ _l_o_g_ _a_n_d_ _v_e_r_i_f_y_ _t_h_a_t_ _s_o_m_e_ _k_e_y_ _m_e_s_s_a_g_e_s_ _a_r_e_ _t_h_e_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ssttoorree tthhee lloogg aanndd vveerriiffyy tthhaatt ssoommee kkeeyy mmeessssaaggeess aarree tthheerree **********                                                                                                          |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__uuppnnpp..ccpppp::115566 ******                                                                                                                                              |
│ │ │ │ │ +|, portmap_protocol const protocol, error_code const& err                                                                                                                       |
│ │ │ │ │ +|			, portmap_transport, aux::listen_socket_handle const&) override                                                                                                             |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			callback_info info = {mapping, port, err};                                                                                                                                  |
│ │ │ │ │ +|			callbacks.push_back(info);                                                                                                                                                  |
│ │ │ │ │ +|			std::cout << "mapping: " << static_cast<int>(mapping)                                                                                                                       |
│ │ │ │ │ +|				<< ", port: " << port << ", IP: " << ip                                                                                                                                    |
│ │ │ │ │ +|				<< ", proto: " << static_cast<int>(protocol)                                                                                                                               |
│ │ │ │ │ +|				<< ", error: \"" << err.message() << "\"\n";                                                                                                                               |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|	#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                               |
│ │ │ │ │ +|		bool should_log_portmap(portmap_transport) const override                                                                                                                    |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			return true;                                                                                                                                                                |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		void log_portmap(portmap_transport, char const* msg                                                                                                                          |
│ │ │ │ │ +|			, aux::listen_socket_handle const&) const override                                                                                                                          |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			std::cout << "UPnP: " << msg << std::endl;                                                                                                                                  |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(flag_auto_managed)                                                                                                                                                |
│ │ │ │ │ +|ip_interface pick_upnp_interface()                                                                                                                                             |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	// auto-managed                                                                                                                                                               |
│ │ │ │ │ -|	test_add_and_get_flags(torrent_flags::auto_managed);                                                                                                                          |
│ │ │ │ │ -|	test_set_after_add(torrent_flags::auto_managed);                                                                                                                              |
│ │ │ │ │ -|	test_unset_after_add(torrent_flags::auto_managed);                                                                                                                            |
│ │ │ │ │ +|	lt::io_context ios;                                                                                                                                                           |
│ │ │ │ │ +|	error_code ec;                                                                                                                                                                |
│ │ │ │ │ +|	std::vector<ip_route> const routes = enum_routes(ios, ec);                                                                                                                    |
│ │ │ │ │ +|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		std::cerr << "failed to enumerate routes: " << ec.message() << '\n';                                                                                                         |
│ │ │ │ │ +|		TEST_CHECK(false);                                                                                                                                                           |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|	std::vector<ip_interface> const ifs = enum_net_interfaces(ios, ec);                                                                                                           |
│ │ │ │ │ +|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		std::cerr << "failed to enumerate network interfaces: " << ec.message() << '\n';                                                                                             |
│ │ │ │ │ +|		TEST_CHECK(false);                                                                                                                                                           |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|	int idx = 0;                                                                                                                                                                  |
│ │ │ │ │ +|	for (auto const& face : ifs)                                                                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		if (!face.interface_address.is_v4()) continue;                                                                                                                               |
│ │ │ │ │ +|		std::cout << " - " << idx                                                                                                                                                    |
│ │ │ │ │ +|			<< ' ' << face.interface_address.to_string()                                                                                                                                |
│ │ │ │ │ +|			<< ' ' << int(static_cast<std::uint8_t>(face.state))                                                                                                                        |
│ │ │ │ │ +|			<< ' ' << static_cast<std::uint32_t>(face.flags)                                                                                                                            |
│ │ │ │ │ +|_	_	_	_<_<_ _'_ _'_ _<_<_ _f_a_c_e_._n_a_m_e_ _<_<_ _'_\_n_'_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___d_h_t_._c_p_p_:_4_7_2_ _ _ _ _ _ _|_c_h_e_c_k_ _t_o_ _m_a_k_e_ _s_u_r_e_ _t_h_e_ _"_b_e_s_t_"_ _i_t_e_m_s_ _a_r_e_ _s_t_o_r_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** cchheecckk ttoo mmaakkee ssuurree tthhee ""bbeesstt"" iitteemmss aarree ssttoorreedd **********                                                                                                                     |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__ddhhtt..ccpppp::447722 ******                                                                                                                                               |
│ │ │ │ │ +|, msg_args().target(items[j].target));                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		key_desc_t const desc[] =                                                                                                                                                    |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			{ "r", bdecode_node::dict_t, 0, key_desc_t::parse_children },                                                                                                               |
│ │ │ │ │ +|				{ "v", bdecode_node::dict_t, 0, 0},                                                                                                                                        |
│ │ │ │ │ +|				{ "id", bdecode_node::string_t, 20, key_desc_t::last_child},                                                                                                               |
│ │ │ │ │ +|			{ "y", bdecode_node::string_t, 1, 0},                                                                                                                                       |
│ │ │ │ │ +|		};                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		bdecode_node parsed[4];                                                                                                                                                      |
│ │ │ │ │ +|		char error_string[200];                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		int ret = verify_message(response, desc, parsed, error_string);                                                                                                              |
│ │ │ │ │ +|		if (ret)                                                                                                                                                                     |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			items_num.insert(items_num.begin(), j);                                                                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TEST_EQUAL(items_num.size(), 4);                                                                                                                                               |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// super seeding mode is automatically turned off if we're not a seed                                                                                                          |
│ │ │ │ │ -|// since the posix_disk_io is not threaded, this will happen immediately                                                                                                       |
│ │ │ │ │ -|#if TORRENT_HAVE_MMAP                                                                                                                                                          |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_SUPERSEEDING                                                                                                                                           |
│ │ │ │ │ -|TORRENT_TEST(flag_super_seeding)                                                                                                                                               |
│ │ │ │ │ +|int sum_distance_exp(int s, node_entry const& e, node_id const& ref)                                                                                                           |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	// super-seeding                                                                                                                                                              |
│ │ │ │ │ -|	test_add_and_get_flags(torrent_flags::super_seeding);                                                                                                                         |
│ │ │ │ │ -|	test_unset_after_add(torrent_flags::super_seeding);                                                                                                                           |
│ │ │ │ │ -|	test_set_after_add(torrent_flags::super_seeding);                                                                                                                             |
│ │ │ │ │ +|	return s + distance_exp(e.id, ref);                                                                                                                                           |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(flag_sequential_download)                                                                                                                                         |
│ │ │ │ │ +|std::vector<tcp::endpoint> g_got_peers;                                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|void get_peers_cb(std::vector<tcp::endpoint> const& peers)                                                                                                                     |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	// sequential-download                                                                                                                                                        |
│ │ │ │ │ -|	test_add_and_get_flags(torrent_flags::sequential_download);                                                                                                                   |
│ │ │ │ │ -|	test_set_after_add(torrent_flags::sequential_download);                                                                                                                       |
│ │ │ │ │ -|	test_unset_after_add(torrent_flags::sequential_download);                                                                                                                     |
│ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___f_l_a_g_s_._c_p_p_:_2_0_5    |this test is flaky, since the torrent will become ready before asking for the flags, and by then stop_when_ready will have been     |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_c_l_e_a_r_e_d_ _t_e_s_t___a_d_d___a_n_d___g_e_t___f_l_a_g_s_(_t_o_r_r_e_n_t___f_l_a_g_s_:_:_s_t_o_p___w_h_e_n___r_e_a_d_y_)_;_ _s_e_t_t_i_n_g_ _s_t_o_p_-_w_h_e_n_-_r_e_a_d_y_ _w_h_e_n_ _a_l_r_e_a_d_y_ _s_t_o_p_p_e_d_ _h_a_s_ _n_o_ _e_f_f_e_c_t_._ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss tteesstt iiss ffllaakkyy,, ssiinnccee tthhee ttoorrrreenntt wwiillll bbeeccoommee rreeaaddyy bbeeffoorree aasskkiinngg ffoorr tthhee ffllaaggss,, aanndd bbyy tthheenn ssttoopp__wwhheenn__rreeaaddyy wwiillll hhaavvee bbeeeenn cclleeaarreedd tteesstt__aadddd__aanndd__ggeett__ffllaaggss           |
│ │ │ │ │ -|((ttoorrrreenntt__ffllaaggss::::ssttoopp__wwhheenn__rreeaaddyy));; sseettttiinngg ssttoopp--wwhheenn--rreeaaddyy wwhheenn aallrreeaaddyy ssttooppppeedd hhaass nnoo eeffffeecctt.. **********                                                                            |
│ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____ff_ll_aa_gg_ss_.._cc_pp_pp_::_22_00_55_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___f_l_a_g_s_._c_p_p_:_2_0_9_ _ _ _ _|_c_h_a_n_g_e_ _t_o_ _a_ _d_i_f_f_e_r_e_n_t_ _t_e_s_t_ _s_e_t_u_p_._ _c_u_r_r_e_n_t_l_y_ _a_l_w_a_y_s_ _p_a_u_s_e_d_._ _t_e_s_t___s_e_t___a_f_t_e_r___a_d_d_(_t_o_r_r_e_n_t___f_l_a_g_s_:_:_s_t_o_p___w_h_e_n___r_e_a_d_y_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** cchhaannggee ttoo aa ddiiffffeerreenntt tteesstt sseettuupp.. ccuurrrreennttllyy aallwwaayyss ppaauusseedd.. tteesstt__sseett__aafftteerr__aadddd((ttoorrrreenntt__ffllaaggss::::ssttoopp__wwhheenn__rreeaaddyy));; **********                                                     |
│ │ │ │ │ -|****** ....//tteesstt//tteesstt__ffllaaggss..ccpppp::220099 ******                                                                                                                                             |
│ │ │ │ │ -|test_set_after_add(torrent_flags::super_seeding);                                                                                                                              |
│ │ │ │ │ +|	g_got_peers.insert(g_got_peers.end(), peers.begin(), peers.end());                                                                                                            |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(flag_sequential_download)                                                                                                                                         |
│ │ │ │ │ +|std::vector<dht::item> g_got_items;                                                                                                                                            |
│ │ │ │ │ +|dht::item g_put_item;                                                                                                                                                          |
│ │ │ │ │ +|int g_put_count;                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|void get_mutable_item_cb(dht::item const& i, bool a)                                                                                                                           |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	// sequential-download                                                                                                                                                        |
│ │ │ │ │ -|	test_add_and_get_flags(torrent_flags::sequential_download);                                                                                                                   |
│ │ │ │ │ -|	test_set_after_add(torrent_flags::sequential_download);                                                                                                                       |
│ │ │ │ │ -|	test_unset_after_add(torrent_flags::sequential_download);                                                                                                                     |
│ │ │ │ │ +|	if (!a) return;                                                                                                                                                               |
│ │ │ │ │ +|	if (!i.empty())                                                                                                                                                               |
│ │ │ │ │ +|		g_got_items.push_back(i);                                                                                                                                                    |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// the stop when ready flag will be cleared when the torrent is ready to start                                                                                                 |
│ │ │ │ │ -|// downloading.                                                                                                                                                                |
│ │ │ │ │ -|// since the posix_disk_io is not threaded, this will happen immediately                                                                                                       |
│ │ │ │ │ -|#if TORRENT_HAVE_MMAP                                                                                                                                                          |
│ │ │ │ │ -|TORRENT_TEST(flag_stop_when_ready)                                                                                                                                             |
│ │ │ │ │ +|void put_mutable_item_data_cb(dht::item& i)                                                                                                                                    |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	// stop-when-ready                                                                                                                                                            |
│ │ │ │ │ -|test_unset_after_add(torrent_flags::stop_when_ready);                                                                                                                          |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|	if (!i.empty())                                                                                                                                                               |
│ │ │ │ │ +|_	_	_g___g_o_t___i_t_e_m_s_._p_u_s_h___b_a_c_k_(_i_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___d_h_t_._c_p_p_:_3_2_2_3_ _ _ _ _ _|_t_h_i_s_ _w_o_n_'_t_ _w_o_r_k_ _b_e_c_a_u_s_e_ _t_h_e_ _s_e_c_o_n_d_ _n_o_d_e_ _i_s_n_'_t_ _p_i_n_g_e_d_ _s_o_ _i_t_ _w_o_n_t_ _b_e_ _a_d_d_e_d_ _t_o_ _t_h_e_ _r_o_u_t_i_n_g_ _t_a_b_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss wwoonn''tt wwoorrkk bbeeccaauussee tthhee sseeccoonndd nnooddee iissnn''tt ppiinnggeedd ssoo iitt wwoonntt bbee aaddddeedd ttoo tthhee rroouuttiinngg ttaabbllee **********                                                                      |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__ddhhtt..ccpppp::33222233 ******                                                                                                                                              |
│ │ │ │ │ +|bool ret = verify_message(request, get_item_desc_ro, parsed, error_string);                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	TEST_CHECK(ret);                                                                                                                                                              |
│ │ │ │ │ +|	TEST_EQUAL(parsed[3].int_value(), 1);                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// should have one node now, which is 4.4.4.4:1234                                                                                                                            |
│ │ │ │ │ +|	TEST_EQUAL(std::get<0>(node.size()), 1);                                                                                                                                      |
│ │ │ │ │ +|	// and no replacement nodes                                                                                                                                                   |
│ │ │ │ │ +|	TEST_EQUAL(std::get<1>(node.size()), 0);                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// now, disable read_only, try again.                                                                                                                                         |
│ │ │ │ │ +|	g_sent_packets.clear();                                                                                                                                                       |
│ │ │ │ │ +|	sett.set_bool(settings_pack::dht_read_only, false);                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	send_dht_request(node, "get", source, &response);                                                                                                                             |
│ │ │ │ │ +|	// sender should be added to replacement bucket                                                                                                                               |
│ │ │ │ │ +|	TEST_EQUAL(std::get<1>(node.size()), 1);                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	g_sent_packets.clear();                                                                                                                                                       |
│ │ │ │ │ +|#if 0                                                                                                                                                                          |
│ │ │ │ │ +|target = generate_next();                                                                                                                                                      |
│ │ │ │ │ +|node.get_item(target, get_immutable_item_cb);                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// since we have 2 nodes, we should have two packets.                                                                                                                         |
│ │ │ │ │ +|	TEST_EQUAL(g_sent_packets.size(), 2);                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// both of them shouldn't have a 'ro' key.                                                                                                                                    |
│ │ │ │ │ +|	node_from_entry(g_sent_packets.front().second, request);                                                                                                                      |
│ │ │ │ │ +|	ret = verify_message(request, get_item_desc_ro, parsed, error_string);                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	TEST_CHECK(ret);                                                                                                                                                              |
│ │ │ │ │ +|	TEST_CHECK(!parsed[3]);                                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	node_from_entry(g_sent_packets.back().second, request);                                                                                                                       |
│ │ │ │ │ +|	ret = verify_message(request, get_item_desc_ro, parsed, error_string);                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	TEST_CHECK(ret);                                                                                                                                                              |
│ │ │ │ │ +|	TEST_CHECK(!parsed[3]);                                                                                                                                                       |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(flag_disable_dht)                                                                                                                                                 |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|// these tests rely on logging being enabled                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(invalid_error_msg)                                                                                                                                                |
│ │ │ │ │ +|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___d_h_t_._c_p_p_:_4_0_8_1_ _ _ _ _ _|_t_e_s_t_ _o_b_f_u_s_c_a_t_e_d___g_e_t___p_e_e_r_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt oobbffuussccaatteedd__ggeett__ppeeeerrss **********                                                                                                                                          |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__ddhhtt..ccpppp::44008811 ******                                                                                                                                              |
│ │ │ │ │ +|TEST_CHECK(sm.has_quota());                                                                                                                                                    |
│ │ │ │ │ +|	});                                                                                                                                                                           |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(rate_limit_accrue_limit)                                                                                                                                          |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	test_add_and_get_flags(torrent_flags::disable_dht);                                                                                                                           |
│ │ │ │ │ -|	test_set_after_add(torrent_flags::disable_dht);                                                                                                                               |
│ │ │ │ │ -|	test_unset_after_add(torrent_flags::disable_dht);                                                                                                                             |
│ │ │ │ │ +|	aux::session_settings sett;                                                                                                                                                   |
│ │ │ │ │ +|	sett.set_int(settings_pack::dht_upload_rate_limit, std::numeric_limits<int>::max());                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	test_rate_limit(sett, [](lt::dht::socket_manager& sm) {                                                                                                                       |
│ │ │ │ │ +|		TEST_CHECK(sm.has_quota());                                                                                                                                                  |
│ │ │ │ │ +|		for (int i = 0; i < 10; ++i)                                                                                                                                                 |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			std::this_thread::sleep_for(milliseconds(500));                                                                                                                             |
│ │ │ │ │ +|			TEST_CHECK(sm.has_quota());                                                                                                                                                 |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|	});                                                                                                                                                                           |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(flag_disable_lsd)                                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|TORRENT_TEST(dht)                                                                                                                                                              |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	test_add_and_get_flags(torrent_flags::disable_lsd);                                                                                                                           |
│ │ │ │ │ -|	test_set_after_add(torrent_flags::disable_lsd);                                                                                                                               |
│ │ │ │ │ -|	test_unset_after_add(torrent_flags::disable_lsd);                                                                                                                             |
│ │ │ │ │ +|	// dummy dht test                                                                                                                                                             |
│ │ │ │ │ +|	TEST_CHECK(true);                                                                                                                                                             |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_TEST(flag_disable_pex)                                                                                                                                                 |
│ │ │ │ │ +|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___f_i_l_e___s_t_o_r_a_g_e_._c_p_p_:|test file attributes                                                                                                                |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_1_2_0_8_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt ffiillee aattttrriibbuutteess **********                                                                                                                                               |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____ff_ii_ll_ee____ss_tt_oo_rr_aa_gg_ee_.._cc_pp_pp_::_11_22_00_88_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___f_i_l_e___s_t_o_r_a_g_e_._c_p_p_:|test symlinks                                                                                                                       |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_1_2_0_9_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt ssyymmlliinnkkss **********                                                                                                                                                      |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____ff_ii_ll_ee____ss_tt_oo_rr_aa_gg_ee_.._cc_pp_pp_::_11_22_00_99_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/                      |test the case where we have > 120 samples (and have the base delay actually be updated)                                             |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t___t_i_m_e_s_t_a_m_p___h_i_s_t_o_r_y_._c_p_p_:_5_4_ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt tthhee ccaassee wwhheerree wwee hhaavvee >> 112200 ssaammpplleess ((aanndd hhaavvee tthhee bbaassee ddeellaayy aaccttuuaallllyy bbee uuppddaatteedd)) **********                                                                            |
│ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____tt_ii_mm_ee_ss_tt_aa_mm_pp____hh_ii_ss_tt_oo_rr_yy_.._cc_pp_pp_::_55_44_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/                      |test the case where a sample is lower than the history entry but not lower than the base                                            |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_t_e_s_t___t_i_m_e_s_t_a_m_p___h_i_s_t_o_r_y_._c_p_p_:_5_5_ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteesstt tthhee ccaassee wwhheerree aa ssaammppllee iiss lloowweerr tthhaann tthhee hhiissttoorryy eennttrryy bbuutt nnoott lloowweerr tthhaann tthhee bbaassee **********                                                                           |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__ttiimmeessttaammpp__hhiissttoorryy..ccpppp::5555 ******                                                                                                                                  |
│ │ │ │ │ +|#include "libtorrent/aux_/timestamp_history.hpp"                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|TORRENT_TEST(timestamp_history)                                                                                                                                                |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|	test_add_and_get_flags(torrent_flags::disable_pex);                                                                                                                           |
│ │ │ │ │ -|	test_set_after_add(torrent_flags::disable_pex);                                                                                                                               |
│ │ │ │ │ -|	test_unset_after_add(torrent_flags::disable_pex);                                                                                                                             |
│ │ │ │ │ +|	using namespace lt;                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	aux::timestamp_history h;                                                                                                                                                     |
│ │ │ │ │ +|	TEST_EQUAL(h.add_sample(0x32, false), 0);                                                                                                                                     |
│ │ │ │ │ +|	TEST_EQUAL(h.base(), 0x32);                                                                                                                                                   |
│ │ │ │ │ +|	TEST_EQUAL(h.add_sample(0x33, false), 0x1);                                                                                                                                   |
│ │ │ │ │ +|	TEST_EQUAL(h.base(), 0x32);                                                                                                                                                   |
│ │ │ │ │ +|	TEST_EQUAL(h.add_sample(0x3433, false), 0x3401);                                                                                                                              |
│ │ │ │ │ +|	TEST_EQUAL(h.base(), 0x32);                                                                                                                                                   |
│ │ │ │ │ +|	TEST_EQUAL(h.add_sample(0x30, false), 0);                                                                                                                                     |
│ │ │ │ │ +|	TEST_EQUAL(h.base(), 0x30);                                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// test that wrapping of the timestamp is properly handled                                                                                                                    |
│ │ │ │ │ +|	h.add_sample(0xfffffff3, false);                                                                                                                                              |
│ │ │ │ │ +|	TEST_EQUAL(h.base(), 0xfffffff3);                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │  |_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_a_c_k_e_t___b_u_f_f_e_r_._c_p_p_:_1_5_7_ _ _|_u_s_e_ _c_o_m_p_a_r_e___l_e_s_s___w_r_a_p_ _f_o_r_ _t_h_i_s_ _c_o_m_p_a_r_i_s_o_n_ _a_s_ _w_e_l_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** uussee ccoommppaarree__lleessss__wwrraapp ffoorr tthhiiss ccoommppaarriissoonn aass wweellll **********                                                                                                                  |
│ │ │ │ │ -|****** ....//ssrrcc//ppaacckkeett__bbuuffffeerr..ccpppp::115577 ******                                                                                                                                           |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT_VAL(size <= 0xffff, size);                                                                                                                                    |
│ │ │ │ │ -|		std::uint32_t new_size = m_capacity == 0 ? 16 : m_capacity;                                                                                                                  |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_t_e_s_t_/_t_e_s_t___t_r_a_n_s_f_e_r_._c_p_p_:_1_7_3_ _|_t_h_e_s_e_ _s_e_t_t_i_n_g_s___p_a_c_k_ _t_e_s_t_s_ _b_e_l_o_n_g_ _i_n_ _t_h_e_i_r_ _o_w_n_ _t_e_s_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthheessee sseettttiinnggss__ppaacckk tteessttss bbeelloonngg iinn tthheeiirr oowwnn tteesstt **********                                                                                                                 |
│ │ │ │ │ +|****** ....//tteesstt//tteesstt__ttrraannssffeerr..ccpppp::117733 ******                                                                                                                                          |
│ │ │ │ │ +|// to the time it will take to complete the test                                                                                                                               |
│ │ │ │ │ +|	pack.set_int(settings_pack::min_reconnect_time, 0);                                                                                                                           |
│ │ │ │ │ +|	pack.set_int(settings_pack::stop_tracker_timeout, 1);                                                                                                                         |
│ │ │ │ │ +|	pack.set_bool(settings_pack::announce_to_all_trackers, true);                                                                                                                 |
│ │ │ │ │ +|	pack.set_bool(settings_pack::announce_to_all_tiers, true);                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		while (new_size < size)                                                                                                                                                      |
│ │ │ │ │ -|			new_size <<= 1;                                                                                                                                                             |
│ │ │ │ │ +|	// make sure we announce to both http and udp trackers                                                                                                                        |
│ │ │ │ │ +|	pack.set_bool(settings_pack::prefer_udp_trackers, false);                                                                                                                     |
│ │ │ │ │ +|	pack.set_bool(settings_pack::enable_outgoing_utp, false);                                                                                                                     |
│ │ │ │ │ +|	pack.set_bool(settings_pack::enable_incoming_utp, false);                                                                                                                     |
│ │ │ │ │ +|	pack.set_bool(settings_pack::enable_lsd, false);                                                                                                                              |
│ │ │ │ │ +|	pack.set_bool(settings_pack::enable_natpmp, false);                                                                                                                           |
│ │ │ │ │ +|	pack.set_bool(settings_pack::enable_upnp, false);                                                                                                                             |
│ │ │ │ │ +|	pack.set_bool(settings_pack::enable_dht, false);                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		aux::unique_ptr<packet_ptr[], index_type> new_storage(new packet_ptr[new_size]);                                                                                             |
│ │ │ │ │ +|	pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);                                                                                                      |
│ │ │ │ │ +|	pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_disabled);                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		for (index_type i = m_first; i < (m_first + m_capacity); ++i)                                                                                                                |
│ │ │ │ │ -|			new_storage[i & (new_size - 1)] = std::move(m_storage[i & (m_capacity - 1)]);                                                                                               |
│ │ │ │ │ +|	pack.set_bool(settings_pack::allow_multiple_connections_per_ip, false);                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		m_storage = std::move(new_storage);                                                                                                                                          |
│ │ │ │ │ -|		m_capacity = new_size;                                                                                                                                                       |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|pack.set_int(settings_pack::unchoke_slots_limit, 0);                                                                                                                           |
│ │ │ │ │ +|ses1.apply_settings(pack);                                                                                                                                                     |
│ │ │ │ │ +|	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == 0);                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	packet_ptr packet_buffer::remove(index_type idx)                                                                                                                              |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ -|if (idx >= m_first + m_capacity)                                                                                                                                               |
│ │ │ │ │ -|return packet_ptr();                                                                                                                                                           |
│ │ │ │ │ +|	pack.set_int(settings_pack::unchoke_slots_limit, -1);                                                                                                                         |
│ │ │ │ │ +|	ses1.apply_settings(pack);                                                                                                                                                    |
│ │ │ │ │ +|	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == -1);                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (compare_less_wrap(idx, m_first, 0xffff))                                                                                                                                 |
│ │ │ │ │ -|			return packet_ptr();                                                                                                                                                        |
│ │ │ │ │ +|	pack.set_int(settings_pack::unchoke_slots_limit, 8);                                                                                                                          |
│ │ │ │ │ +|	ses1.apply_settings(pack);                                                                                                                                                    |
│ │ │ │ │ +|	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == 8);                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		std::size_t const mask = m_capacity - 1;                                                                                                                                     |
│ │ │ │ │ -|		packet_ptr old_value = std::move(m_storage[idx & mask]);                                                                                                                     |
│ │ │ │ │ -|		m_storage[idx & mask].reset();                                                                                                                                               |
│ │ │ │ │ +|	ses2.apply_settings(pack);                                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (old_value)                                                                                                                                                               |
│ │ │ │ │ +|	torrent_handle tor1;                                                                                                                                                          |
│ │ │ │ │ +|	torrent_handle tor2;                                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	create_directory("tmp1_transfer", ec);                                                                                                                                        |
│ │ │ │ │ +|	std::ofstream file("tmp1_transfer/temporary");                                                                                                                                |
│ │ │ │ │ +|	std::shared_ptr<torrent_info> t = ::create_torrent(&file, "temporary", 32 * 1024, 13, false);                                                                                 |
│ │ │ │ │ +|	file.close();                                                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	TEST_CHECK(exists(combine_path("tmp1_transfer", "temporary")));                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	add_torrent_params params;                                                                                                                                                    |
│ │ │ │ │ +|	params.storage_mode = storage_mode;                                                                                                                                           |
│ │ │ │ │ +|	params.flags &= ~torrent_flags::paused;                                                                                                                                       |
│ │ │ │ │ +|	params.flags &= ~torrent_flags::auto_managed;                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	wait_for_listen(ses1, "ses1");                                                                                                                                                |
│ │ │ │ │ +|_	_w_a_i_t___f_o_r___l_i_s_t_e_n_(_s_e_s_2_,_ _"_s_e_s_2_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_s_t_o_r_a_g_e___u_t_i_l_s_._c_p_p_:_2_3_0  |ideally, if we end up copying files because of a move across volumes, the source should not be deleted until they've all been       |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_c_o_p_i_e_d_._ _T_h_a_t_ _w_o_u_l_d_ _l_e_t_ _u_s_ _r_o_l_l_b_a_c_k_ _w_i_t_h_ _h_i_g_h_e_r_ _c_o_n_f_i_d_e_n_c_e_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iiddeeaallllyy,, iiff wwee eenndd uupp ccooppyyiinngg ffiilleess bbeeccaauussee ooff aa mmoovvee aaccrroossss vvoolluummeess,, tthhee ssoouurrccee sshhoouulldd nnoott bbee ddeelleetteedd uunnttiill tthheeyy''vvee aallll bbeeeenn ccooppiieedd.. TThhaatt wwoouulldd lleett uuss rroollllbbaacckk wwiitthh    |
│ │ │ │ │ +|hhiigghheerr ccoonnffiiddeennccee.. **********                                                                                                                                                       |
│ │ │ │ │ +|****** ....//ssrrcc//ssttoorraaggee__uuttiillss..ccpppp::223300 ******                                                                                                                                           |
│ │ │ │ │ +|// later                                                                                                                                                                       |
│ │ │ │ │ +|		aux::vector<bool, file_index_t> copied_files(std::size_t(f.num_files()), false);                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// track how far we got in case of an error                                                                                                                                  |
│ │ │ │ │ +|		file_index_t file_index{};                                                                                                                                                   |
│ │ │ │ │ +|		for (auto const i : f.file_range())                                                                                                                                          |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			--m_size;                                                                                                                                                                   |
│ │ │ │ │ -|			if (m_size == 0) m_last = m_first;                                                                                                                                          |
│ │ │ │ │ +|			// files moved out to absolute paths are not moved                                                                                                                          |
│ │ │ │ │ +|			if (f.file_absolute_path(i)) continue;                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			std::string const old_path = combine_path(save_path, f.file_path(i));                                                                                                       |
│ │ │ │ │ +|			std::string const new_path = combine_path(new_save_path, f.file_path(i));                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			error_code ignore;                                                                                                                                                          |
│ │ │ │ │ +|			if (flags == move_flags_t::dont_replace && exists(new_path, ignore))                                                                                                        |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				if (ret == status_t::no_error) ret = status_t::need_full_check;                                                                                                            |
│ │ │ │ │ +|				continue;                                                                                                                                                                  |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|move_file(old_path, new_path, ec);                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// if the source file doesn't exist. That's not a problem                                                                                                                   |
│ │ │ │ │ +|			// we just ignore that file                                                                                                                                                 |
│ │ │ │ │ +|			if (ec.ec == boost::system::errc::no_such_file_or_directory)                                                                                                                |
│ │ │ │ │ +|				ec.ec.clear();                                                                                                                                                             |
│ │ │ │ │ +|			else if (ec                                                                                                                                                                 |
│ │ │ │ │ +|				&& ec.ec != boost::system::errc::invalid_argument                                                                                                                          |
│ │ │ │ │ +|				&& ec.ec != boost::system::errc::permission_denied)                                                                                                                        |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				// moving the file failed                                                                                                                                                  |
│ │ │ │ │ +|				// on OSX, the error when trying to rename a file across different                                                                                                         |
│ │ │ │ │ +|				// volumes is EXDEV, which will make it fall back to copying.                                                                                                              |
│ │ │ │ │ +|				ec.ec.clear();                                                                                                                                                             |
│ │ │ │ │ +|				copy_file(old_path, new_path, ec);                                                                                                                                         |
│ │ │ │ │ +|				if (!ec) copied_files[i] = true;                                                                                                                                           |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (ec)                                                                                                                                                                     |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				ec.file(i);                                                                                                                                                                |
│ │ │ │ │ +|				file_index = i;                                                                                                                                                            |
│ │ │ │ │ +|				break;                                                                                                                                                                     |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (idx == m_first && m_size != 0)                                                                                                                                           |
│ │ │ │ │ +|		if (!ec && move_partfile)                                                                                                                                                    |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			++m_first;                                                                                                                                                                  |
│ │ │ │ │ -|			for (index_type i = 0; i < m_capacity; ++i, ++m_first)                                                                                                                      |
│ │ │ │ │ -|				if (m_storage[m_first & mask]) break;                                                                                                                                      |
│ │ │ │ │ -|			m_first &= 0xffff;                                                                                                                                                          |
│ │ │ │ │ +|			error_code e;                                                                                                                                                               |
│ │ │ │ │ +|			move_partfile(new_save_path, e);                                                                                                                                            |
│ │ │ │ │ +|_	_	_	_i_f_ _(_e_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_s_t_o_r_a_g_e___u_t_i_l_s_._c_p_p_:_5_3_8  |it would seem reasonable to, instead, set the have_pieces bits for the pieces representing these files, and resume with the normal  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_l_o_g_i_c_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd sseeeemm rreeaassoonnaabbllee ttoo,, iinnsstteeaadd,, sseett tthhee hhaavvee__ppiieecceess bbiittss ffoorr tthhee ppiieecceess rreepprreesseennttiinngg tthheessee ffiilleess,, aanndd rreessuummee wwiitthh tthhee nnoorrmmaall llooggiicc **********                           |
│ │ │ │ │ +|****** ....//ssrrcc//ssttoorraaggee__uuttiillss..ccpppp::553388 ******                                                                                                                                           |
│ │ │ │ │ +|continue;                                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|				std::int64_t const size = get_filesize(stat, file_index, fs                                                                                                                |
│ │ │ │ │ +|					, save_path, ec);                                                                                                                                                         |
│ │ │ │ │ +|				if (size < 0) return false;                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|				if (size < fs.file_size(file_index))                                                                                                                                       |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					ec.ec = errors::mismatching_file_size;                                                                                                                                    |
│ │ │ │ │ +|					ec.file(file_index);                                                                                                                                                      |
│ │ │ │ │ +|					ec.operation = operation_t::check_resume;                                                                                                                                 |
│ │ │ │ │ +|					return false;                                                                                                                                                             |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			return true;                                                                                                                                                                |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (((idx + 1) & 0xffff) == m_last && m_size != 0)                                                                                                                           |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			--m_last;                                                                                                                                                                   |
│ │ │ │ │ -|			for (index_type i = 0; i < m_capacity; ++i, --m_last)                                                                                                                       |
│ │ │ │ │ -|				if (m_storage[m_last & mask]) break;                                                                                                                                       |
│ │ │ │ │ -|			++m_last;                                                                                                                                                                   |
│ │ │ │ │ -|_	_	_	_m___l_a_s_t_ _&_=_ _0_x_f_f_f_f_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___h_a_n_d_l_e_._c_p_p_:_4_9_9_ _|_i_n_ _C_+_+_1_4_,_ _u_s_e_ _u_n_i_q_u_e___p_t_r_ _a_n_d_ _m_o_v_e_ _i_t_ _i_n_t_o_ _t_h_e_ _l_a_m_b_d_a_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinn CC++++1144,, uussee uunniiqquuee__ppttrr aanndd mmoovvee iitt iinnttoo tthhee llaammbbddaa **********                                                                                                               |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__hhaannddllee..ccpppp::449999 ******                                                                                                                                          |
│ │ │ │ │ -|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ -|		if (params.save_path.empty())                                                                                                                                                |
│ │ │ │ │ -|			aux::throw_ex<system_error>(error_code(errors::invalid_save_path));                                                                                                         |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		TORRENT_ASSERT_PRECOND(!params.save_path.empty());                                                                                                                           |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS                                                                                                                                       |
│ │ │ │ │ +|		// always trigger a full recheck when we pull in files from other                                                                                                            |
│ │ │ │ │ +|		// torrents, via hard links                                                                                                                                                  |
│ │ │ │ │ +|if (added_files) return false;                                                                                                                                                 |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION < 3                                                                                                                                                    |
│ │ │ │ │ -|		if (!params.info_hashes.has_v1() && !params.info_hashes.has_v2() && !params.ti)                                                                                              |
│ │ │ │ │ -|			params.info_hashes.v1 = params.info_hash;                                                                                                                                   |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		// parse have bitmask. Verify that the files we expect to have                                                                                                               |
│ │ │ │ │ +|		// actually do exist                                                                                                                                                         |
│ │ │ │ │ +|		piece_index_t const end_piece = std::min(rd.have_pieces.end_index(), fs.end_piece());                                                                                        |
│ │ │ │ │ +|		for (piece_index_t i(0); i < end_piece; ++i)                                                                                                                                 |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (rd.have_pieces.get_bit(i) == false) continue;                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the internal torrent object keeps and mutates state in the                                                                                                                |
│ │ │ │ │ -|		// torrent_info object. We can't let that leak back to the client                                                                                                            |
│ │ │ │ │ -|		if (params.ti)                                                                                                                                                               |
│ │ │ │ │ -|			params.ti = std::make_shared<torrent_info>(*params.ti);                                                                                                                     |
│ │ │ │ │ +|			std::vector<file_slice> f = fs.map_block(i, 0, 1);                                                                                                                          |
│ │ │ │ │ +|			TORRENT_ASSERT(!f.empty());                                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// we cannot capture a unique_ptr into a lambda in c++11, so we use a raw                                                                                                    |
│ │ │ │ │ -|		// pointer for now. async_call uses a lambda expression to post the call                                                                                                     |
│ │ │ │ │ -|		// to the main thread                                                                                                                                                        |
│ │ │ │ │ -|auto* p = new add_torrent_params(std::move(params));                                                                                                                           |
│ │ │ │ │ -|auto guard = aux::scope_end([p]{ delete p; });                                                                                                                                 |
│ │ │ │ │ -|		p->save_path = complete(p->save_path);                                                                                                                                       |
│ │ │ │ │ +|			file_index_t const file_index = f[0].file_index;                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|		handle_backwards_compatible_resume_data(*p);                                                                                                                                 |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			// files with priority zero may not have been saved to disk at their                                                                                                        |
│ │ │ │ │ +|			// expected location, but is likely to be in a partfile. Just exempt it                                                                                                     |
│ │ │ │ │ +|			// from checking                                                                                                                                                            |
│ │ │ │ │ +|			if (file_index < file_priority.end_index()                                                                                                                                  |
│ │ │ │ │ +|				&& file_priority[file_index] == dont_download)                                                                                                                             |
│ │ │ │ │ +|				continue;                                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		async_call(&session_impl::async_add_torrent, p);                                                                                                                             |
│ │ │ │ │ -|		guard.disarm();                                                                                                                                                              |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|			if (fs.pad_file_at(file_index)) continue;                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|	// if the torrent already exists, this will throw duplicate_torrent                                                                                                           |
│ │ │ │ │ -|	torrent_handle session_handle::add_torrent(                                                                                                                                   |
│ │ │ │ │ -|		torrent_info const& ti                                                                                                                                                       |
│ │ │ │ │ -|		, std::string const& save_path                                                                                                                                               |
│ │ │ │ │ -|		, entry const& resume_data                                                                                                                                                   |
│ │ │ │ │ -|		, storage_mode_t storage_mode                                                                                                                                                |
│ │ │ │ │ -|		, bool const add_paused)                                                                                                                                                     |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		add_torrent_params p;                                                                                                                                                        |
│ │ │ │ │ -|		p.ti = std::make_shared<torrent_info>(ti);                                                                                                                                   |
│ │ │ │ │ -|		p.save_path = save_path;                                                                                                                                                     |
│ │ │ │ │ -|		if (resume_data.type() != entry::undefined_t)                                                                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			bencode(std::back_inserter(p.resume_data), resume_data);                                                                                                                    |
│ │ │ │ │ +|			if (get_filesize(stat, file_index, fs, save_path, ec) < 0)                                                                                                                  |
│ │ │ │ │ +|				return false;                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// OK, this file existed, good. Now, skip all remaining pieces in                                                                                                           |
│ │ │ │ │ +|			// this file. We're just sanity-checking whether the files exist                                                                                                            |
│ │ │ │ │ +|			// or not.                                                                                                                                                                  |
│ │ │ │ │ +|_	_	_	_p_e_e_r___r_e_q_u_e_s_t_ _c_o_n_s_t_ _p_r_ _=_ _f_s_._m_a_p___f_i_l_e_(_f_i_l_e___i_n_d_e_x_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_r_a_n_d_o_m_._c_p_p_:_1_4_1_ _ _ _ _ _ _ _ _ _|_i_m_p_r_o_v_e_ _c_a_l_l_i_n_g_ _R_A_N_D___b_y_t_e_s_ _m_u_l_t_i_p_l_e_ _t_i_m_e_s_,_ _u_s_i_n_g_ _f_a_l_l_b_a_c_k_ _f_o_r_ _n_o_w_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iimmpprroovvee ccaalllliinngg RRAANNDD__bbyytteess mmuullttiippllee ttiimmeess,, uussiinngg ffaallllbbaacckk ffoorr nnooww **********                                                                                                  |
│ │ │ │ │ +|****** ....//ssrrcc//rraannddoomm..ccpppp::114411 ******                                                                                                                                                  |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		p.storage_mode = storage_mode;                                                                                                                                               |
│ │ │ │ │ -|_	_	_i_f_ _(_a_d_d___p_a_u_s_e_d_)_ _p_._f_l_a_g_s_ _|_=_ _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_:_:_f_l_a_g___p_a_u_s_e_d_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_p_o_s_i_x___p_a_r_t___f_i_l_e_._c_p_p_:_3_3_7|what do we do if someone is currently reading from the disk from this piece? does it matter? Since we won't actively erase the data |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_f_r_o_m_ _d_i_s_k_,_ _b_u_t_ _i_t_ _m_a_y_ _b_e_ _o_v_e_r_w_r_i_t_t_e_n_ _s_o_o_n_,_ _i_t_'_s_ _p_r_o_b_a_b_l_y_ _n_o_t_ _t_h_a_t_ _b_i_g_ _o_f_ _a_ _d_e_a_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** wwhhaatt ddoo wwee ddoo iiff ssoommeeoonnee iiss ccuurrrreennttllyy rreeaaddiinngg ffrroomm tthhee ddiisskk ffrroomm tthhiiss ppiieeccee?? ddooeess iitt mmaatttteerr?? SSiinnccee wwee wwoonn''tt aaccttiivveellyy eerraassee tthhee ddaattaa ffrroomm ddiisskk,, bbuutt iitt mmaayy bbee oovveerrwwrriitttteenn |
│ │ │ │ │ -|ssoooonn,, iitt''ss pprroobbaabbllyy nnoott tthhaatt bbiigg ooff aa ddeeaall **********                                                                                                                               |
│ │ │ │ │ -|****** ....//ssrrcc//ppoossiixx__ppaarrtt__ffiillee..ccpppp::333377 ******                                                                                                                                         |
│ │ │ │ │ -|			if (ec) return {};                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifdef TORRENT_WINDOWS                                                                                                                                                         |
│ │ │ │ │ -|			ret = file_pointer(::_wfopen(convert_to_native_path_string(fn).c_str(), L"wb+"));                                                                                           |
│ │ │ │ │ +|		void crypto_random_bytes(span<char> buffer)                                                                                                                                  |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|#ifdef TORRENT_BUILD_SIMULATOR                                                                                                                                                 |
│ │ │ │ │ +|			// In the simulator we want deterministic random numbers                                                                                                                    |
│ │ │ │ │ +|			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });                                                                                             |
│ │ │ │ │ +|#elif TORRENT_USE_CNG                                                                                                                                                          |
│ │ │ │ │ +|			aux::cng_gen_random(buffer);                                                                                                                                                |
│ │ │ │ │ +|#elif TORRENT_USE_CRYPTOAPI                                                                                                                                                    |
│ │ │ │ │ +|			// windows                                                                                                                                                                  |
│ │ │ │ │ +|			aux::crypt_gen_random(buffer);                                                                                                                                              |
│ │ │ │ │ +|#elif defined TORRENT_USE_LIBCRYPTO && !defined TORRENT_USE_WOLFSSL                                                                                                            |
│ │ │ │ │ +|// wolfSSL uses wc_RNG_GenerateBlock as the internal function for the                                                                                                          |
│ │ │ │ │ +|// openssl compatibility layer. This function API does not support                                                                                                             |
│ │ │ │ │ +|// an arbitrary buffer size (openssl does), it is limited by the                                                                                                               |
│ │ │ │ │ +|// constant RNG_MAX_BLOCK_LEN.                                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|// openssl                                                                                                                                                                     |
│ │ │ │ │ +|			int r = RAND_bytes(reinterpret_cast<unsigned char*>(buffer.data())                                                                                                          |
│ │ │ │ │ +|				, int(buffer.size()));                                                                                                                                                     |
│ │ │ │ │ +|			if (r != 1) aux::throw_ex<system_error>(errors::no_entropy);                                                                                                                |
│ │ │ │ │ +|#elif TORRENT_USE_GETRANDOM                                                                                                                                                    |
│ │ │ │ │ +|			ssize_t const r = ::getrandom(buffer.data(), static_cast<std::size_t>(buffer.size()), 0);                                                                                   |
│ │ │ │ │ +|			if (r == ssize_t(buffer.size())) return;                                                                                                                                    |
│ │ │ │ │ +|			if (r == -1 && errno != ENOSYS) aux::throw_ex<system_error>(error_code(errno, generic_category()));                                                                         |
│ │ │ │ │ +|			static dev_random dev;                                                                                                                                                      |
│ │ │ │ │ +|			dev.read(buffer);                                                                                                                                                           |
│ │ │ │ │ +|#elif TORRENT_USE_DEV_RANDOM                                                                                                                                                   |
│ │ │ │ │ +|			static dev_random dev;                                                                                                                                                      |
│ │ │ │ │ +|			dev.read(buffer);                                                                                                                                                           |
│ │ │ │ │  |#else                                                                                                                                                                          |
│ │ │ │ │ -|			ret = file_pointer(::fopen(fn.c_str(), "wb+"));                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_BROKEN_RANDOM_DEVICE                                                                                                                                               |
│ │ │ │ │ +|			// even pseudo random numbers rely on being able to seed the random                                                                                                         |
│ │ │ │ │ +|			// generator                                                                                                                                                                |
│ │ │ │ │ +|#error "no entropy source available"                                                                                                                                           |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|#ifdef TORRENT_I_WANT_INSECURE_RANDOM_NUMBERS                                                                                                                                  |
│ │ │ │ │ +|			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });                                                                                             |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|#error "no secure entropy source available. If you really want insecure random numbers, define TORRENT_I_WANT_INSECURE_RANDOM_NUMBERS"                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|			if (ret.file() == nullptr)                                                                                                                                                  |
│ │ │ │ │ -|				ec.assign(errno, generic_category());                                                                                                                                      |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		if (ec) return {};                                                                                                                                                           |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_4_0_4_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _f_i_e_l_d_ _i_n_t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmoovvee tthhiiss ffiieelldd iinnttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                 |
│ │ │ │ │ +|****** ....//ssrrcc//aalleerrtt..ccpppp::440044 ******                                                                                                                                                   |
│ │ │ │ │ +|		return torrent_alert::message() + ": state changed to: "                                                                                                                     |
│ │ │ │ │ +|			+ state_str[state];                                                                                                                                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void posix_part_file::free_piece(piece_index_t const piece)                                                                                                                   |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		auto const i = m_piece_map.find(piece);                                                                                                                                      |
│ │ │ │ │ -|		if (i == m_piece_map.end()) return;                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ +|	tracker_error_alert::tracker_error_alert(aux::stack_allocator& alloc                                                                                                          |
│ │ │ │ │ +|		, torrent_handle const& h, tcp::endpoint const& ep, int times                                                                                                                |
│ │ │ │ │ +|		, protocol_version v, string_view u, operation_t const operation                                                                                                             |
│ │ │ │ │ +|		, error_code const& e                                                                                                                                                        |
│ │ │ │ │ +|		, string_view m)                                                                                                                                                             |
│ │ │ │ │ +|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ +|		, times_in_row(times)                                                                                                                                                        |
│ │ │ │ │ +|		, error(e)                                                                                                                                                                   |
│ │ │ │ │ +|		, op(operation)                                                                                                                                                              |
│ │ │ │ │ +|		, m_msg_idx(alloc.copy_string(m))                                                                                                                                            |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|		, status_code(e && e.category() == http_category() ? e.value() : -1)                                                                                                         |
│ │ │ │ │ +|		, msg(m)                                                                                                                                                                     |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|, version(v)                                                                                                                                                                   |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|m_free_slots.push_back(i->second);                                                                                                                                             |
│ │ │ │ │ -|		m_piece_map.erase(i);                                                                                                                                                        |
│ │ │ │ │ -|		m_dirty_metadata = true;                                                                                                                                                     |
│ │ │ │ │ +|	char const* tracker_error_alert::failure_reason() const                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return m_alloc.get().ptr(m_msg_idx);                                                                                                                                         |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void posix_part_file::move_partfile(std::string const& path, error_code& ec)                                                                                                  |
│ │ │ │ │ +|	std::string tracker_error_alert::message() const                                                                                                                              |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		flush_metadata_impl(ec);                                                                                                                                                     |
│ │ │ │ │ -|		if (ec) return;                                                                                                                                                              |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ +|		std::snprintf(ret, sizeof(ret), "%s %s %s \"%s\" (%d)"                                                                                                                       |
│ │ │ │ │ +|			, tracker_alert::message().c_str()                                                                                                                                          |
│ │ │ │ │ +|			, version == protocol_version::V1 ? "v1" : "v2"                                                                                                                             |
│ │ │ │ │ +|			, convert_from_native(error.message()).c_str(), error_message()                                                                                                             |
│ │ │ │ │ +|			, times_in_row);                                                                                                                                                            |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (!m_piece_map.empty())                                                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			std::string old_path = combine_path(m_path, m_name);                                                                                                                        |
│ │ │ │ │ -|			std::string new_path = combine_path(path, m_name);                                                                                                                          |
│ │ │ │ │ +|	tracker_warning_alert::tracker_warning_alert(aux::stack_allocator& alloc                                                                                                      |
│ │ │ │ │ +|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ +|		, string_view u, protocol_version v, string_view m)                                                                                                                          |
│ │ │ │ │ +|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ +|		, m_msg_idx(alloc.copy_string(m))                                                                                                                                            |
│ │ │ │ │ +|_#_i_f_ _T_O_R_R_E_N_T___A_B_I___V_E_R_S_I_O_N_ _=_=_ _1_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_4_3_8_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _i_n_t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmoovvee tthhiiss iinnttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                       |
│ │ │ │ │ +|****** ....//ssrrcc//aalleerrtt..ccpppp::443388 ******                                                                                                                                                   |
│ │ │ │ │ +|return {};                                                                                                                                                                     |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ +|		std::snprintf(ret, sizeof(ret), "%s %s %s \"%s\" (%d)"                                                                                                                       |
│ │ │ │ │ +|			, tracker_alert::message().c_str()                                                                                                                                          |
│ │ │ │ │ +|			, version == protocol_version::V1 ? "v1" : "v2"                                                                                                                             |
│ │ │ │ │ +|			, convert_from_native(error.message()).c_str(), error_message()                                                                                                             |
│ │ │ │ │ +|			, times_in_row);                                                                                                                                                            |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			rename(old_path, new_path, ec);                                                                                                                                             |
│ │ │ │ │ -|			if (ec == boost::system::errc::no_such_file_or_directory)                                                                                                                   |
│ │ │ │ │ -|				ec.clear();                                                                                                                                                                |
│ │ │ │ │ +|	tracker_warning_alert::tracker_warning_alert(aux::stack_allocator& alloc                                                                                                      |
│ │ │ │ │ +|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ +|		, string_view u, protocol_version v, string_view m)                                                                                                                          |
│ │ │ │ │ +|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ +|		, m_msg_idx(alloc.copy_string(m))                                                                                                                                            |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|		, msg(m)                                                                                                                                                                     |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|, version(v)                                                                                                                                                                   |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (ec)                                                                                                                                                                     |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				storage_error se;                                                                                                                                                          |
│ │ │ │ │ -|				aux::copy_file(old_path, new_path, se);                                                                                                                                    |
│ │ │ │ │ -|				ec = se.ec;                                                                                                                                                                |
│ │ │ │ │ -|				if (ec) return;                                                                                                                                                            |
│ │ │ │ │ -|				remove(old_path, ec);                                                                                                                                                      |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		m_path = path;                                                                                                                                                               |
│ │ │ │ │ -|_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_o_s_i_x___p_a_r_t___f_i_l_e_._c_p_p_:_4_2_4_|_i_n_s_t_e_a_d_ _o_f_ _r_e_b_u_i_l_d_i_n_g_ _t_h_e_ _w_h_o_l_e_ _f_i_l_e_ _h_e_a_d_e_r_ _a_n_d_ _f_l_u_s_h_i_n_g_ _i_t_,_ _u_p_d_a_t_e_ _t_h_e_ _s_l_o_t_ _e_n_t_r_i_e_s_ _a_s_ _w_e_ _g_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinnsstteeaadd ooff rreebbuuiillddiinngg tthhee wwhhoollee ffiillee hheeaaddeerr aanndd fflluusshhiinngg iitt,, uuppddaattee tthhee sslloott eennttrriieess aass wwee ggoo **********                                                                      |
│ │ │ │ │ -|****** ....//ssrrcc//ppoossiixx__ppaarrtt__ffiillee..ccpppp::442244 ******                                                                                                                                         |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|				auto bytes_read = std::fread(buf.get(), 1, std::size_t(block_to_copy), file.file());                                                                                       |
│ │ │ │ │ -|				if (int(bytes_read) != block_to_copy)                                                                                                                                      |
│ │ │ │ │ -|					ec.assign(errno, generic_category());                                                                                                                                     |
│ │ │ │ │ +|	char const* tracker_warning_alert::warning_message() const                                                                                                                    |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return m_alloc.get().ptr(m_msg_idx);                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				if (ec) return;                                                                                                                                                            |
│ │ │ │ │ +|	std::string tracker_warning_alert::message() const                                                                                                                            |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		return tracker_alert::message() + (version == protocol_version::V1 ? " v1" : " v2") + " warning: " + warning_message();                                                      |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				f(file_offset, {buf.get(), block_to_copy});                                                                                                                                |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			file_offset += block_to_copy;                                                                                                                                               |
│ │ │ │ │ -|			piece_offset = 0;                                                                                                                                                           |
│ │ │ │ │ -|			size -= block_to_copy;                                                                                                                                                      |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|	scrape_reply_alert::scrape_reply_alert(aux::stack_allocator& alloc                                                                                                            |
│ │ │ │ │ +|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ +|		, int incomp, int comp, string_view u, protocol_version const v)                                                                                                             |
│ │ │ │ │ +|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ +|		, incomplete(incomp)                                                                                                                                                         |
│ │ │ │ │ +|_	_	_,_ _c_o_m_p_l_e_t_e_(_c_o_m_p_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_4_6_4_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _i_n_t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmoovvee tthhiiss iinnttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                       |
│ │ │ │ │ +|****** ....//ssrrcc//aalleerrtt..ccpppp::446644 ******                                                                                                                                                   |
│ │ │ │ │ +|char const* tracker_warning_alert::warning_message() const                                                                                                                     |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return m_alloc.get().ptr(m_msg_idx);                                                                                                                                         |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void posix_part_file::flush_metadata(error_code& ec)                                                                                                                          |
│ │ │ │ │ +|	std::string tracker_warning_alert::message() const                                                                                                                            |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		flush_metadata_impl(ec);                                                                                                                                                     |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		return tracker_alert::message() + (version == protocol_version::V1 ? " v1" : " v2") + " warning: " + warning_message();                                                      |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|void posix_part_file::flush_metadata_impl(error_code& ec)                                                                                                                      |
│ │ │ │ │ +|	scrape_reply_alert::scrape_reply_alert(aux::stack_allocator& alloc                                                                                                            |
│ │ │ │ │ +|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ +|		, int incomp, int comp, string_view u, protocol_version const v)                                                                                                             |
│ │ │ │ │ +|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ +|		, incomplete(incomp)                                                                                                                                                         |
│ │ │ │ │ +|		, complete(comp)                                                                                                                                                             |
│ │ │ │ │ +|, version(v)                                                                                                                                                                   |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|		// do we need to flush the metadata?                                                                                                                                         |
│ │ │ │ │ -|		if (m_dirty_metadata == false) return;                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_piece_map.empty())                                                                                                                                                     |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// if we don't have any pieces left in the                                                                                                                                  |
│ │ │ │ │ -|			// part file, remove it                                                                                                                                                     |
│ │ │ │ │ -|			std::string const p = combine_path(m_path, m_name);                                                                                                                         |
│ │ │ │ │ -|			remove(p, ec);                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			if (ec == boost::system::errc::no_such_file_or_directory)                                                                                                                   |
│ │ │ │ │ -|				ec.clear();                                                                                                                                                                |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		auto f = open_file(open_mode::read_write, ec);                                                                                                                               |
│ │ │ │ │ -|		if (ec) return;                                                                                                                                                              |
│ │ │ │ │ +|	std::string scrape_reply_alert::message() const                                                                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ +|		std::snprintf(ret, sizeof(ret), "%s %s scrape reply: %d %d"                                                                                                                  |
│ │ │ │ │ +|			, tracker_alert::message().c_str()                                                                                                                                          |
│ │ │ │ │ +|			, version == protocol_version::V1 ? "v1" : "v2"                                                                                                                             |
│ │ │ │ │ +|			, incomplete, complete);                                                                                                                                                    |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		std::vector<char> header(static_cast<std::size_t>(m_header_size));                                                                                                           |
│ │ │ │ │ +|	scrape_failed_alert::scrape_failed_alert(aux::stack_allocator& alloc                                                                                                          |
│ │ │ │ │ +|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ +|		, string_view u, protocol_version const v, error_code const& e)                                                                                                              |
│ │ │ │ │ +|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ +|		, error(e)                                                                                                                                                                   |
│ │ │ │ │ +|		, m_msg_idx()                                                                                                                                                                |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|		, msg(convert_from_native(e.message()))                                                                                                                                      |
│ │ │ │ │ +|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_4_9_3_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _i_n_t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmoovvee tthhiiss iinnttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                       |
│ │ │ │ │ +|****** ....//ssrrcc//aalleerrtt..ccpppp::449933 ******                                                                                                                                                   |
│ │ │ │ │ +|return {};                                                                                                                                                                     |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ +|		std::snprintf(ret, sizeof(ret), "%s %s scrape reply: %d %d"                                                                                                                  |
│ │ │ │ │ +|			, tracker_alert::message().c_str()                                                                                                                                          |
│ │ │ │ │ +|			, version == protocol_version::V1 ? "v1" : "v2"                                                                                                                             |
│ │ │ │ │ +|			, incomplete, complete);                                                                                                                                                    |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		using namespace libtorrent::aux;                                                                                                                                             |
│ │ │ │ │ +|	scrape_failed_alert::scrape_failed_alert(aux::stack_allocator& alloc                                                                                                          |
│ │ │ │ │ +|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ +|		, string_view u, protocol_version const v, error_code const& e)                                                                                                              |
│ │ │ │ │ +|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ +|		, error(e)                                                                                                                                                                   |
│ │ │ │ │ +|		, m_msg_idx()                                                                                                                                                                |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|		, msg(convert_from_native(e.message()))                                                                                                                                      |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|, version(v)                                                                                                                                                                   |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		char* ptr = header.data();                                                                                                                                                   |
│ │ │ │ │ -|		write_uint32(m_max_pieces, ptr);                                                                                                                                             |
│ │ │ │ │ -|		write_uint32(m_piece_size, ptr);                                                                                                                                             |
│ │ │ │ │ +|	scrape_failed_alert::scrape_failed_alert(aux::stack_allocator& alloc                                                                                                          |
│ │ │ │ │ +|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ +|		, string_view u, string_view m)                                                                                                                                              |
│ │ │ │ │ +|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ +|		, error(errors::tracker_failure)                                                                                                                                             |
│ │ │ │ │ +|		, m_msg_idx(alloc.copy_string(m))                                                                                                                                            |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|		, msg(m)                                                                                                                                                                     |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		for (piece_index_t piece(0); piece < piece_index_t(m_max_pieces); ++piece)                                                                                                   |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|_	_	_	_a_u_t_o_ _c_o_n_s_t_ _i_ _=_ _m___p_i_e_c_e___m_a_p_._f_i_n_d_(_p_i_e_c_e_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_u_d_p___s_o_c_k_e_t_._c_p_p_:_6_5_9_ _ _ _ _ _|_p_e_r_h_a_p_s_ _a_n_ _a_t_t_e_m_p_t_ _s_h_o_u_l_d_ _b_e_ _m_a_d_e_ _t_o_ _b_i_n_d_ _m___s_o_c_k_s_5___s_o_c_k_ _t_o_ _t_h_e_ _d_e_v_i_c_e_ _o_f_ _m___l_i_s_t_e_n___s_o_c_k_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ppeerrhhaappss aann aatttteemmpptt sshhoouulldd bbee mmaaddee ttoo bbiinndd mm__ssoocckkss55__ssoocckk ttoo tthhee ddeevviiccee ooff mm__lliisstteenn__ssoocckkeett **********                                                                           |
│ │ │ │ │ -|****** ....//ssrrcc//uuddpp__ssoocckkeett..ccpppp::665599 ******                                                                                                                                              |
│ │ │ │ │ -|if (ec)                                                                                                                                                                        |
│ │ │ │ │ +|	char const* scrape_failed_alert::error_message() const                                                                                                                        |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (m_alerts.should_post<socks5_alert>())                                                                                                                                    |
│ │ │ │ │ -|			m_alerts.emplace_alert<socks5_alert>(m_proxy_addr, operation_t::sock_option, ec);                                                                                           |
│ │ │ │ │ -|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ +|		if (m_msg_idx == aux::allocation_slot()) return "";                                                                                                                          |
│ │ │ │ │ +|		else return m_alloc.get().ptr(m_msg_idx);                                                                                                                                    |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	tcp::endpoint const bind_ep(m_listen_socket.get_local_endpoint().address(), 0);                                                                                               |
│ │ │ │ │ -|	m_socks5_sock.bind(bind_ep, ec);                                                                                                                                              |
│ │ │ │ │ -|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ +|	std::string scrape_failed_alert::message() const                                                                                                                              |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (m_alerts.should_post<socks5_alert>())                                                                                                                                    |
│ │ │ │ │ -|			m_alerts.emplace_alert<socks5_alert>(m_proxy_addr, operation_t::sock_bind, ec);                                                                                             |
│ │ │ │ │ -|		++m_failures;                                                                                                                                                                |
│ │ │ │ │ -|		retry_connection();                                                                                                                                                          |
│ │ │ │ │ -|		return;                                                                                                                                                                      |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		return tracker_alert::message() + " scrape failed: " + error_message();                                                                                                      |
│ │ │ │ │ +|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_5_3_2_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _f_i_e_l_d_ _i_n_t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmoovvee tthhiiss ffiieelldd iinnttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                 |
│ │ │ │ │ +|****** ....//ssrrcc//aalleerrtt..ccpppp::553322 ******                                                                                                                                                   |
│ │ │ │ │ +|char const* scrape_failed_alert::error_message() const                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		if (m_msg_idx == aux::allocation_slot()) return "";                                                                                                                          |
│ │ │ │ │ +|		else return m_alloc.get().ptr(m_msg_idx);                                                                                                                                    |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ +|	std::string scrape_failed_alert::message() const                                                                                                                              |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		return tracker_alert::message() + " scrape failed: " + error_message();                                                                                                      |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|ADD_OUTSTANDING_ASYNC("socks5::on_connected");                                                                                                                                 |
│ │ │ │ │ -|	m_socks5_sock.async_connect(m_proxy_addr                                                                                                                                      |
│ │ │ │ │ -|		, std::bind(&socks5::on_connected, self(), _1));                                                                                                                             |
│ │ │ │ │ +|	tracker_reply_alert::tracker_reply_alert(aux::stack_allocator& alloc                                                                                                          |
│ │ │ │ │ +|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ +|		, int np, protocol_version v, string_view u)                                                                                                                                 |
│ │ │ │ │ +|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ +|		, num_peers(np)                                                                                                                                                              |
│ │ │ │ │ +|, version(v)                                                                                                                                                                   |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	ADD_OUTSTANDING_ASYNC("socks5::on_connect_timeout");                                                                                                                          |
│ │ │ │ │ -|	m_timer.expires_after(seconds(10));                                                                                                                                           |
│ │ │ │ │ -|	m_timer.async_wait(std::bind(&socks5::on_connect_timeout                                                                                                                      |
│ │ │ │ │ -|		, self(), _1));                                                                                                                                                              |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|	std::string tracker_reply_alert::message() const                                                                                                                              |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ +|		std::snprintf(ret, sizeof(ret), "%s %s received peers: %d"                                                                                                                   |
│ │ │ │ │ +|			, tracker_alert::message().c_str()                                                                                                                                          |
│ │ │ │ │ +|			, version == protocol_version::V1 ? "v1" : "v2"                                                                                                                             |
│ │ │ │ │ +|			, num_peers);                                                                                                                                                               |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|void socks5::on_connect_timeout(error_code const& e)                                                                                                                           |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	COMPLETE_ASYNC("socks5::on_connect_timeout");                                                                                                                                 |
│ │ │ │ │ +|	dht_reply_alert::dht_reply_alert(aux::stack_allocator& alloc                                                                                                                  |
│ │ │ │ │ +|		, torrent_handle const& h                                                                                                                                                    |
│ │ │ │ │ +|		, int np)                                                                                                                                                                    |
│ │ │ │ │ +|		: tracker_alert(alloc, h, {}, "")                                                                                                                                            |
│ │ │ │ │ +|		, num_peers(np)                                                                                                                                                              |
│ │ │ │ │ +|	{}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	if (e == boost::asio::error::operation_aborted) return;                                                                                                                       |
│ │ │ │ │ +|	std::string dht_reply_alert::message() const                                                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|_#_e_l_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_5_7_6_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmoovvee tthhiiss ttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                         |
│ │ │ │ │ +|****** ....//ssrrcc//aalleerrtt..ccpppp::557766 ******                                                                                                                                                   |
│ │ │ │ │ +|, num_peers(np)                                                                                                                                                                |
│ │ │ │ │ +|	{}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	if (m_abort) return;                                                                                                                                                          |
│ │ │ │ │ +|	std::string dht_reply_alert::message() const                                                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ +|		std::snprintf(ret, sizeof(ret), "%s received DHT peers: %d"                                                                                                                  |
│ │ │ │ │ +|			, tracker_alert::message().c_str(), num_peers);                                                                                                                             |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	if (m_alerts.should_post<socks5_alert>())                                                                                                                                     |
│ │ │ │ │ -|		m_alerts.emplace_alert<socks5_alert>(m_proxy_addr, operation_t::connect, errors::timed_out);                                                                                 |
│ │ │ │ │ +|	tracker_announce_alert::tracker_announce_alert(aux::stack_allocator& alloc                                                                                                    |
│ │ │ │ │ +|		, torrent_handle const& h, tcp::endpoint const& ep, string_view u                                                                                                            |
│ │ │ │ │ +|		, protocol_version const v, event_t const e)                                                                                                                                 |
│ │ │ │ │ +|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ +|		, event(e)                                                                                                                                                                   |
│ │ │ │ │ +|, version(v)                                                                                                                                                                   |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	error_code ignore;                                                                                                                                                            |
│ │ │ │ │ -|	m_socks5_sock.close(ignore);                                                                                                                                                  |
│ │ │ │ │ +|	std::string tracker_announce_alert::message() const                                                                                                                           |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		static const char* const event_str[] = {"none", "completed", "started", "stopped", "paused"};                                                                                |
│ │ │ │ │ +|		return tracker_alert::message()                                                                                                                                              |
│ │ │ │ │ +|			+ (version == protocol_version::V1 ? " v1" : " v2")                                                                                                                         |
│ │ │ │ │ +|			+ " sending announce (" + event_str[static_cast<int>(event)] + ")";                                                                                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	++m_failures;                                                                                                                                                                 |
│ │ │ │ │ -|	retry_connection();                                                                                                                                                           |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|	hash_failed_alert::hash_failed_alert(                                                                                                                                         |
│ │ │ │ │ +|		aux::stack_allocator& alloc                                                                                                                                                  |
│ │ │ │ │ +|		, torrent_handle const& h                                                                                                                                                    |
│ │ │ │ │ +|		, piece_index_t index)                                                                                                                                                       |
│ │ │ │ │ +|		: torrent_alert(alloc, h)                                                                                                                                                    |
│ │ │ │ │ +|		, piece_index(index)                                                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(index >= piece_index_t(0));                                                                                                                                   |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|void socks5::on_connected(error_code const& e)                                                                                                                                 |
│ │ │ │ │ -|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|	std::string hash_failed_alert::message() const                                                                                                                                |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ +|_	_	_r_e_t_u_r_n_ _{_}_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_e_n_u_m___n_e_t_._c_p_p_:_1_4_4_ _ _ _ _ _ _ _|_i_n_ _C_+_+_1_7_,_ _u_s_e_ _____h_a_s___i_n_c_l_u_d_e_ _f_o_r_ _t_h_i_s_._ _O_t_h_e_r_ _o_p_e_r_a_t_i_n_g_ _s_y_s_t_e_m_s_ _a_r_e_ _l_i_k_e_l_y_ _t_o_ _r_e_q_u_i_r_e_ _t_h_i_s_ _a_s_ _w_e_l_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** iinn CC++++1177,, uussee ____hhaass__iinncclluuddee ffoorr tthhiiss.. OOtthheerr ooppeerraattiinngg ssyysstteemmss aarree lliikkeellyy ttoo rreeqquuiirree tthhiiss aass wweellll **********                                                                   |
│ │ │ │ │  |****** ....//ssrrcc//eennuumm__nneett..ccpppp::114444 ******                                                                                                                                                |
│ │ │ │ │  |#include <arpa/inet.h>                                                                                                                                                         |
│ │ │ │ │  |#include <cstring>                                                                                                                                                             |
│ │ │ │ │  |#include <cstdlib>                                                                                                                                                             |
│ │ │ │ │  |#include <unistd.h>                                                                                                                                                            |
│ │ │ │ │ @@ -6472,880 +6680,1708 @@
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |			if (!m_pc.packet_finished()) return true;                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |			error_code ec;                                                                                                                                                              |
│ │ │ │ │  |			bdecode_node msg = bdecode(body, ec);                                                                                                                                       |
│ │ │ │ │  |_	_	_	_i_f_ _(_m_s_g_._t_y_p_e_(_)_ _!_=_ _b_d_e_c_o_d_e___n_o_d_e_:_:_d_i_c_t___t_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_i_p___n_o_t_i_f_i_e_r_._c_p_p_:_4_1_ _ _ _ _ _|_s_i_m_u_l_a_t_o_r_ _s_u_p_p_o_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ssiimmuullaattoorr ssuuppppoorrtt **********                                                                                                                                                  |
│ │ │ │ │ -|****** ....//ssrrcc//iipp__nnoottiiffiieerr..ccpppp::4411 ******                                                                                                                                              |
│ │ │ │ │ -|      from this software without specific prior written permission.                                                                                                            |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_9_5_1_ _ _ _ _ _ _ _|_t_h_i_s_ _c_o_u_l_d_ _b_e_ _o_p_t_i_m_i_z_e_d_ _b_y_ _l_o_o_k_i_n_g_ _u_p_ _w_h_i_c_h_ _f_i_l_e_s_ _a_r_e_ _c_o_m_p_l_e_t_e_ _a_n_d_ _j_u_s_t_ _l_o_o_k_ _a_t_ _t_h_o_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ccoouulldd bbee ooppttiimmiizzeedd bbyy llooookkiinngg uupp wwhhiicchh ffiilleess aarree ccoommpplleettee aanndd jjuusstt llooookk aatt tthhoossee **********                                                                              |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::11995511 ******                                                                                                                                                |
│ │ │ │ │ +|//				TORRENT_ASSERT(picker().have_piece(i));                                                                                                                                  |
│ │ │ │ │ +|				we_have(i);                                                                                                                                                                |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"                                                                                                    |
│ │ │ │ │ -|AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE                                                                                                      |
│ │ │ │ │ -|IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE                                                                                                     |
│ │ │ │ │ -|ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE                                                                                                       |
│ │ │ │ │ -|LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR                                                                                                            |
│ │ │ │ │ -|CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF                                                                                                           |
│ │ │ │ │ -|SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS                                                                                                       |
│ │ │ │ │ -|INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN                                                                                                        |
│ │ │ │ │ -|CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)                                                                                                        |
│ │ │ │ │ -|ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE                                                                                                     |
│ │ │ │ │ -|POSSIBILITY OF SUCH DAMAGE.                                                                                                                                                    |
│ │ │ │ │ +|		set_state(torrent_status::checking_resume_data);                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|*/                                                                                                                                                                             |
│ │ │ │ │ +|		aux::vector<std::string, file_index_t> links;                                                                                                                                |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS                                                                                                                                       |
│ │ │ │ │ +|		if (!m_torrent_file->similar_torrents().empty()                                                                                                                              |
│ │ │ │ │ +|			|| !m_torrent_file->collections().empty())                                                                                                                                  |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			resolve_links res(m_torrent_file);                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/ip_notifier.hpp"                                                                                                                                     |
│ │ │ │ │ -|#include "libtorrent/assert.hpp"                                                                                                                                               |
│ │ │ │ │ +|			for (auto const& ih : m_torrent_file->similar_torrents())                                                                                                                   |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				std::shared_ptr<torrent> t = m_ses.find_torrent(info_hash_t(ih)).lock();                                                                                                   |
│ │ │ │ │ +|				if (!t) continue;                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if defined TORRENT_BUILD_SIMULATOR                                                                                                                                            |
│ │ │ │ │ -|#elif TORRENT_USE_NETLINK                                                                                                                                                      |
│ │ │ │ │ -|#include "libtorrent/netlink.hpp"                                                                                                                                              |
│ │ │ │ │ -|#include "libtorrent/socket.hpp"                                                                                                                                               |
│ │ │ │ │ -|#include <array>                                                                                                                                                               |
│ │ │ │ │ -|#include <unordered_map>                                                                                                                                                       |
│ │ │ │ │ -|#elif TORRENT_USE_SYSTEMCONFIGURATION || TORRENT_USE_SC_NETWORK_REACHABILITY                                                                                                   |
│ │ │ │ │ -|#include <SystemConfiguration/SystemConfiguration.h>                                                                                                                           |
│ │ │ │ │ -|#elif defined TORRENT_WINDOWS                                                                                                                                                  |
│ │ │ │ │ -|#include "libtorrent/aux_/throw.hpp"                                                                                                                                           |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_push.hpp"                                                                                                                           |
│ │ │ │ │ -|#include <iphlpapi.h>                                                                                                                                                          |
│ │ │ │ │ -|#ifdef TORRENT_WINRT                                                                                                                                                           |
│ │ │ │ │ -|#include <netioapi.h>                                                                                                                                                          |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|#include <mutex>                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|				// Only attempt to reuse files from torrents that are seeding.                                                                                                             |
│ │ │ │ │ +|if (!t->is_seed()) continue;                                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/netlink_utils.hpp"                                                                                                                                   |
│ │ │ │ │ +|				res.match(t->get_torrent_file(), t->save_path());                                                                                                                          |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			for (auto const& c : m_torrent_file->collections())                                                                                                                         |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				std::vector<std::shared_ptr<torrent>> ts = m_ses.find_collection(c);                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|namespace libtorrent { namespace aux {                                                                                                                                         |
│ │ │ │ │ +|				for (auto const& t : ts)                                                                                                                                                   |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|_	_	_	_	_	_/_/_ _O_n_l_y_ _a_t_t_e_m_p_t_ _t_o_ _r_e_u_s_e_ _f_i_l_e_s_ _f_r_o_m_ _t_o_r_r_e_n_t_s_ _t_h_a_t_ _a_r_e_ _s_e_e_d_i_n_g_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_9_6_4_ _ _ _ _ _ _ _|_t_h_i_s_ _c_o_u_l_d_ _b_e_ _o_p_t_i_m_i_z_e_d_ _b_y_ _l_o_o_k_i_n_g_ _u_p_ _w_h_i_c_h_ _f_i_l_e_s_ _a_r_e_ _c_o_m_p_l_e_t_e_ _a_n_d_ _j_u_s_t_ _l_o_o_k_ _a_t_ _t_h_o_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ccoouulldd bbee ooppttiimmiizzeedd bbyy llooookkiinngg uupp wwhhiicchh ffiilleess aarree ccoommpplleettee aanndd jjuusstt llooookk aatt tthhoossee **********                                                                              |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::11996644 ******                                                                                                                                                |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|			resolve_links res(m_torrent_file);                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|namespace {                                                                                                                                                                    |
│ │ │ │ │ +|			for (auto const& ih : m_torrent_file->similar_torrents())                                                                                                                   |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				std::shared_ptr<torrent> t = m_ses.find_torrent(info_hash_t(ih)).lock();                                                                                                   |
│ │ │ │ │ +|				if (!t) continue;                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if (TORRENT_USE_SYSTEMCONFIGURATION || TORRENT_USE_SC_NETWORK_REACHABILITY) && \                                                                                              |
│ │ │ │ │ -|	!defined TORRENT_BUILD_SIMULATOR                                                                                                                                              |
│ │ │ │ │ +|				// Only attempt to reuse files from torrents that are seeding.                                                                                                             |
│ │ │ │ │ +|				if (!t->is_seed()) continue;                                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// common utilities for Mac and iOS                                                                                                                                            |
│ │ │ │ │ -|template <typename T> void CFRefRetain(T h) { CFRetain(h); }                                                                                                                   |
│ │ │ │ │ -|_t_e_m_p_l_a_t_e_ _<_t_y_p_e_n_a_m_e_ _T_>_ _v_o_i_d_ _C_F_R_e_f_R_e_l_e_a_s_e_(_T_ _h_)_ _{_ _C_F_R_e_l_e_a_s_e_(_h_)_;_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/                       |technically, this isn't supposed to happen, but it seems to sometimes. Some of the accounting is probably wrong in certain cases    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_h_t_t_p___s_e_e_d___c_o_n_n_e_c_t_i_o_n_._c_p_p_:_4_4_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tteecchhnniiccaallllyy,, tthhiiss iissnn''tt ssuuppppoosseedd ttoo hhaappppeenn,, bbuutt iitt sseeeemmss ttoo ssoommeettiimmeess.. SSoommee ooff tthhee aaccccoouunnttiinngg iiss pprroobbaabbllyy wwrroonngg iinn cceerrttaaiinn ccaasseess **********                                   |
│ │ │ │ │ -|****** ....//ssrrcc//hhttttpp__sseeeedd__ccoonnnneeccttiioonn..ccpppp::444411 ******                                                                                                                                    |
│ │ │ │ │ -|// cut out the chunk header from the receive buffer                                                                                                                            |
│ │ │ │ │ -|					TORRENT_ASSERT(m_chunk_pos + m_body_start < INT_MAX);                                                                                                                     |
│ │ │ │ │ -|					m_recv_buffer.cut(header_size, t->block_size() + 1024, aux::numeric_cast<int>(m_chunk_pos + m_body_start));                                                               |
│ │ │ │ │ -|					recv_buffer = m_recv_buffer.get();                                                                                                                                        |
│ │ │ │ │ -|					recv_buffer = recv_buffer.subspan(m_body_start);                                                                                                                          |
│ │ │ │ │ -|					m_chunk_pos += chunk_size;                                                                                                                                                |
│ │ │ │ │ -|					if (chunk_size == 0)                                                                                                                                                      |
│ │ │ │ │ -|					{                                                                                                                                                                         |
│ │ │ │ │ -|						TORRENT_ASSERT(m_recv_buffer.get().size() < m_chunk_pos + m_body_start + 1                                                                                               |
│ │ │ │ │ -|							|| m_recv_buffer.get()[static_cast<std::ptrdiff_t>(m_chunk_pos + m_body_start)] == 'H'                                                                                  |
│ │ │ │ │ -|							|| (m_parser.chunked_encoding()                                                                                                                                         |
│ │ │ │ │ -|								&& m_recv_buffer.get()[static_cast<std::ptrdiff_t>(m_chunk_pos + m_body_start)] == '\r'));                                                                             |
│ │ │ │ │ -|						m_chunk_pos = -1;                                                                                                                                                        |
│ │ │ │ │ -|					}                                                                                                                                                                         |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ +|				res.match(t->get_torrent_file(), t->save_path());                                                                                                                          |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ +|			for (auto const& c : m_torrent_file->collections())                                                                                                                         |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				std::vector<std::shared_ptr<torrent>> ts = m_ses.find_collection(c);                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			int payload = int(bytes_transferred);                                                                                                                                       |
│ │ │ │ │ -|			if (payload > m_response_left) payload = int(m_response_left);                                                                                                              |
│ │ │ │ │ -|			if (payload > front_request.length) payload = front_request.length;                                                                                                         |
│ │ │ │ │ -|if (payload > outstanding_bytes()) payload = outstanding_bytes();                                                                                                              |
│ │ │ │ │ -|received_bytes(payload, 0);                                                                                                                                                    |
│ │ │ │ │ -|			incoming_piece_fragment(payload);                                                                                                                                           |
│ │ │ │ │ -|			m_response_left -= payload;                                                                                                                                                 |
│ │ │ │ │ +|				for (auto const& t : ts)                                                                                                                                                   |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					// Only attempt to reuse files from torrents that are seeding.                                                                                                            |
│ │ │ │ │ +|if (!t->is_seed()) continue;                                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (m_parser.status_code() == 503)                                                                                                                                          |
│ │ │ │ │ +|					res.match(t->get_torrent_file(), t->save_path());                                                                                                                         |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			std::vector<resolve_links::link_t> const& l = res.get_links();                                                                                                              |
│ │ │ │ │ +|			if (!l.empty())                                                                                                                                                             |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				if (!m_parser.finished()) return;                                                                                                                                          |
│ │ │ │ │ +|				links.resize(m_torrent_file->files().num_files());                                                                                                                         |
│ │ │ │ │ +|				for (auto const& i : l)                                                                                                                                                    |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					if (!i.ti) continue;                                                                                                                                                      |
│ │ │ │ │ +|					links[i.file_idx] = combine_path(i.save_path                                                                                                                              |
│ │ │ │ │ +|						, i.ti->files().file_path(i.file_idx));                                                                                                                                  |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|#endif // TORRENT_DISABLE_MUTABLE_TORRENTS                                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				int retry_time = std::atoi(std::string(recv_buffer.begin(), recv_buffer.end()).c_str());                                                                                   |
│ │ │ │ │ -|				if (retry_time <= 0) retry_time = 60;                                                                                                                                      |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|				peer_log(peer_log_alert::info, "CONNECT", "retrying in %d seconds", retry_time);                                                                                           |
│ │ │ │ │ +|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ +|		TORRENT_ASSERT(m_outstanding_check_files == false);                                                                                                                          |
│ │ │ │ │ +|		m_outstanding_check_files = true;                                                                                                                                            |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				received_bytes(0, int(bytes_transferred));                                                                                                                                 |
│ │ │ │ │ -|				// temporarily unavailable, retry later                                                                                                                                    |
│ │ │ │ │ -|				t->retry_web_seed(this, seconds32(retry_time));                                                                                                                            |
│ │ │ │ │ -|				disconnect(error_code(m_parser.status_code(), http_category()), operation_t::bittorrent, failure);                                                                         |
│ │ │ │ │ -|				return;                                                                                                                                                                    |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ +|		if (!m_add_torrent_params || !(m_add_torrent_params->flags & torrent_flags::no_verify_files))                                                                                |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			m_ses.disk_thread().async_check_files(                                                                                                                                      |
│ │ │ │ │ +|				m_storage, m_add_torrent_params ? m_add_torrent_params.get() : nullptr                                                                                                     |
│ │ │ │ │ +|				, std::move(links), [self = shared_from_this()](status_t st, storage_error const& error)                                                                                   |
│ │ │ │ │ +|_	_	_	_	_{_ _s_e_l_f_-_>_o_n___r_e_s_u_m_e___d_a_t_a___c_h_e_c_k_e_d_(_s_t_,_ _e_r_r_o_r_)_;_ _}_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_2_7_2_8       |this pattern is repeated in a few places. Factor this into a function and generalize the concept of a torrent having a dedicated    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_l_i_s_t_e_n_ _p_o_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ppaatttteerrnn iiss rreeppeeaatteedd iinn aa ffeeww ppllaacceess.. FFaaccttoorr tthhiiss iinnttoo aa ffuunnccttiioonn aanndd ggeenneerraalliizzee tthhee ccoonncceepptt ooff aa ttoorrrreenntt hhaavviinngg aa ddeeddiiccaatteedd lliisstteenn ppoorrtt **********                       |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::22772288 ******                                                                                                                                                |
│ │ │ │ │ +|// not ready for peers. Except, if we don't have metadata,                                                                                                                     |
│ │ │ │ │ +|		// we need peers to download from                                                                                                                                            |
│ │ │ │ │ +|		if (!m_files_checked && valid_metadata()) return;                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (!m_announce_to_lsd) return;                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ +|		// private torrents are never announced on LSD                                                                                                                               |
│ │ │ │ │ +|		if (m_torrent_file->is_valid() && m_torrent_file->priv()) return;                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// we only received the header, no data                                                                                                                                     |
│ │ │ │ │ -|			if (recv_buffer.empty()) break;                                                                                                                                             |
│ │ │ │ │ +|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ +|		// i2p torrents are also never announced on LSD                                                                                                                              |
│ │ │ │ │ +|		// unless we allow mixed swarms                                                                                                                                              |
│ │ │ │ │ +|		if (is_i2p() && !settings().get_bool(settings_pack::allow_i2p_mixed))                                                                                                        |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (recv_buffer.size() < front_request.length) break;                                                                                                                       |
│ │ │ │ │ +|		if (is_paused()) return;                                                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// if the response is chunked, we need to receive the last                                                                                                                  |
│ │ │ │ │ -|			// terminating chunk and the tail headers before we can proceed                                                                                                             |
│ │ │ │ │ -|_	_	_	_i_f_ _(_m___p_a_r_s_e_r_._c_h_u_n_k_e_d___e_n_c_o_d_i_n_g_(_)_ _&_&_ _m___c_h_u_n_k___p_o_s_ _>_=_ _0_)_ _b_r_e_a_k_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_6_1_5_ _ _ _|_c_o_m_e_ _u_p_ _w_i_t_h_ _s_o_m_e_ _a_b_s_t_r_a_c_t_i_o_n_ _t_o_ _d_o_ _t_h_i_s_ _f_o_r_ _g_n_u_t_l_s_ _a_s_ _w_e_l_l_ _l_o_a_d_ _c_e_r_t_i_f_i_c_a_t_e_s_ _f_r_o_m_ _t_h_e_ _w_i_n_d_o_w_s_ _s_y_s_t_e_m_ _c_e_r_t_i_f_i_c_a_t_e_ _s_t_o_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ccoommee uupp wwiitthh ssoommee aabbssttrraaccttiioonn ttoo ddoo tthhiiss ffoorr ggnnuuttllss aass wweellll llooaadd cceerrttiiffiiccaatteess ffrroomm tthhee wwiinnddoowwss ssyysstteemm cceerrttiiffiiccaattee ssttoorree **********                                            |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::661155 ******                                                                                                                                            |
│ │ │ │ │ -|pause();                                                                                                                                                                       |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		if (!m_ses.has_lsd()) return;                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|int port = is_ssl_torrent() ? m_ses.ssl_listen_port() : m_ses.listen_port();                                                                                                   |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		int port = m_ses.listen_port();                                                                                                                                              |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// This function is called by the creating thread, not in the message loop's                                                                                                  |
│ │ │ │ │ -|	// io_context thread.                                                                                                                                                         |
│ │ │ │ │ -|	void session_impl::start_session()                                                                                                                                            |
│ │ │ │ │ +|		// announce with the local discovery service                                                                                                                                 |
│ │ │ │ │ +|		m_torrent_file->info_hashes().for_each([&](sha1_hash const& ih, protocol_version)                                                                                            |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			m_ses.announce_lsd(ih, port);                                                                                                                                               |
│ │ │ │ │ +|		});                                                                                                                                                                          |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void torrent::dht_announce()                                                                                                                                                  |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		if (!m_ses.dht())                                                                                                                                                            |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │  |#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		session_log("start session");                                                                                                                                                |
│ │ │ │ │ +|			debug_log("DHT: no dht initialized");                                                                                                                                       |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		if (!should_announce_dht())                                                                                                                                                  |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|			if (should_log())                                                                                                                                                           |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|_#_i_f_ _T_O_R_R_E_N_T___U_S_E___I_2_P_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_3_8_8_5_ _ _ _ _ _ _ _|_a_d_d_ _o_n_e_ _p_e_e_r_ _p_e_r_ _I_P_ _t_h_e_ _h_o_s_t_n_a_m_e_ _r_e_s_o_l_v_e_s_ _t_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** aadddd oonnee ppeeeerr ppeerr IIPP tthhee hhoossttnnaammee rreessoollvveess ttoo **********                                                                                                                       |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::33888855 ******                                                                                                                                                |
│ │ │ │ │ +|catch (...) { handle_exception(); }                                                                                                                                            |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ -|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ -|		m_ssl_ctx.set_default_verify_paths(ec);                                                                                                                                      |
│ │ │ │ │ +|	void torrent::on_peer_name_lookup(error_code const& e                                                                                                                         |
│ │ │ │ │ +|		, std::vector<address> const& host_list, int const port                                                                                                                      |
│ │ │ │ │ +|		, protocol_version const v) try                                                                                                                                              |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		COMPLETE_ASYNC("torrent::on_peer_name_lookup");                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │  |#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (ec) session_log("SSL set_default verify_paths failed: %s", ec.message().c_str());                                                                                        |
│ │ │ │ │ -|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ +|		if (e && should_log())                                                                                                                                                       |
│ │ │ │ │ +|			debug_log("peer name lookup error: %s", e.message().c_str());                                                                                                               |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|#if defined TORRENT_WINDOWS && defined TORRENT_USE_OPENSSL && !defined TORRENT_WINRT                                                                                           |
│ │ │ │ │ -|X509_STORE* store = X509_STORE_new();                                                                                                                                          |
│ │ │ │ │ -|if (store)                                                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (e || m_abort || host_list.empty() || m_ses.is_aborted()) return;                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|tcp::endpoint host(host_list.front(), std::uint16_t(port));                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_ip_filter && m_ip_filter->access(host.address()) & ip_filter::blocked)                                                                                                 |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			HCERTSTORE system_store = CertOpenSystemStoreA(0, "ROOT");                                                                                                                  |
│ │ │ │ │ -|			// this is best effort                                                                                                                                                      |
│ │ │ │ │ -|			if (system_store)                                                                                                                                                           |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|			if (should_log())                                                                                                                                                           |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				CERT_CONTEXT const* ctx = nullptr;                                                                                                                                         |
│ │ │ │ │ -|				while ((ctx = CertEnumCertificatesInStore(system_store, ctx)) != nullptr)                                                                                                  |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					unsigned char const* cert_ptr = reinterpret_cast<unsigned char const*>(ctx->pbCertEncoded);                                                                               |
│ │ │ │ │ -|					X509* x509 = d2i_X509(nullptr, &cert_ptr, ctx->cbCertEncoded);                                                                                                            |
│ │ │ │ │ -|					// this is best effort                                                                                                                                                    |
│ │ │ │ │ -|					if (!x509) continue;                                                                                                                                                      |
│ │ │ │ │ -|					X509_STORE_add_cert(store, x509);                                                                                                                                         |
│ │ │ │ │ -|					X509_free(x509);                                                                                                                                                          |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|				CertFreeCertificateContext(ctx);                                                                                                                                           |
│ │ │ │ │ -|				CertCloseStore(system_store, 0);                                                                                                                                           |
│ │ │ │ │ +|				debug_log("blocked ip from tracker: %s", host.address().to_string().c_str());                                                                                              |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			if (m_ses.alerts().should_post<peer_blocked_alert>())                                                                                                                       |
│ │ │ │ │ +|				m_ses.alerts().emplace_alert<peer_blocked_alert>(get_handle()                                                                                                              |
│ │ │ │ │ +|					, host, peer_blocked_alert::ip_filter);                                                                                                                                   |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		SSL_CTX* ssl_ctx = m_ssl_ctx.native_handle();                                                                                                                                |
│ │ │ │ │ -|		SSL_CTX_set_cert_store(ssl_ctx, store);                                                                                                                                      |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|#ifdef __APPLE__                                                                                                                                                               |
│ │ │ │ │ -|		m_ssl_ctx.load_verify_file("/etc/ssl/cert.pem", ec);                                                                                                                         |
│ │ │ │ │ +|		if (add_peer(host, peer_info::tracker, v == protocol_version::V2 ? pex_lt_v2 : pex_flags_t(0)))                                                                              |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			state_updated();                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │  |#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (ec) session_log("SSL load_verify_file failed: %s", ec.message().c_str());                                                                                                |
│ │ │ │ │ -|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ -|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_1_4_8_4_ _ _|_i_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _r_e_s_e_r_v_e_(_)_ _t_h_e_s_e_ _v_e_c_t_o_r_s_ _u_p_ _f_r_o_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd bbee nniiccee ttoo rreesseerrvvee(()) tthheessee vveeccttoorrss uupp ffrroonntt **********                                                                                                               |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::11448844 ******                                                                                                                                           |
│ │ │ │ │ -|bandwidth_channel* ch = &p->channel[peer_connection::download_channel];                                                                                                        |
│ │ │ │ │ -|			if (use_quota_overhead(ch, amount_down))                                                                                                                                    |
│ │ │ │ │ -|				ret |= 1 << peer_connection::download_channel;                                                                                                                             |
│ │ │ │ │ -|			ch = &p->channel[peer_connection::upload_channel];                                                                                                                          |
│ │ │ │ │ -|			if (use_quota_overhead(ch, amount_up))                                                                                                                                      |
│ │ │ │ │ -|				ret |= 1 << peer_connection::upload_channel;                                                                                                                               |
│ │ │ │ │ +|			if (should_log())                                                                                                                                                           |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				debug_log("name-lookup add_peer() [ %s ] connect-candidates: %d"                                                                                                           |
│ │ │ │ │ +|					, host.address().to_string().c_str()                                                                                                                                      |
│ │ │ │ │ +|					, m_peer_list ? m_peer_list->num_connect_candidates() : -1);                                                                                                              |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		update_want_peers();                                                                                                                                                         |
│ │ │ │ │ +|_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_5_8_1_ _ _ _ _ _ _ _|_o_n_l_y_ _d_o_ _t_h_i_s_ _i_f_ _t_h_e_ _p_i_e_c_e_ _s_i_z_e_ _>_ _1_ _b_l_o_c_k_s_ _T_h_i_s_ _i_s_ _a_ _v_2_ _t_o_r_r_e_n_t_ _s_o_ _w_e_ _c_a_n_ _r_e_q_u_e_s_t_ _g_e_t_ _b_l_o_c_k_ _l_e_v_e_l_ _h_a_s_h_e_s_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** oonnllyy ddoo tthhiiss iiff tthhee ppiieeccee ssiizzee >> 11 bblloocckkss TThhiiss iiss aa vv22 ttoorrrreenntt ssoo wwee ccaann rreeqquueesstt ggeett bblloocckk lleevveell hhaasshheess.. **********                                                           |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::44558811 ******                                                                                                                                                |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|			std::set<torrent_peer*> ret;                                                                                                                                                |
│ │ │ │ │ +|			if (!blocks.empty() && !downloaders.empty())                                                                                                                                |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				for (auto const b : blocks) ret.insert(downloaders[std::size_t(b)]);                                                                                                       |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				std::copy(downloaders.begin(), downloaders.end(), std::inserter(ret, ret.begin()));                                                                                        |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			return ret;                                                                                                                                                                 |
│ │ │ │ │ +|		}();                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// session_impl is responsible for deleting 'pack'                                                                                                                            |
│ │ │ │ │ -|	void session_impl::apply_settings_pack(std::shared_ptr<settings_pack> pack)                                                                                                   |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ -|		apply_settings_pack_impl(*pack);                                                                                                                                             |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		// if this piece wasn't downloaded from peers, we just found it on disk.                                                                                                     |
│ │ │ │ │ +|		// In that case, we should just consider it as "not-have" and there's no                                                                                                     |
│ │ │ │ │ +|		// need to try to get higher fidelity hashes (yet)                                                                                                                           |
│ │ │ │ │ +|		bool const found_on_disk = peers.size() == 1 && peers.count(nullptr);                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	settings_pack session_impl::get_settings() const                                                                                                                              |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		settings_pack ret;                                                                                                                                                           |
│ │ │ │ │ -|for (int i = settings_pack::string_type_base;                                                                                                                                  |
│ │ │ │ │ -|i < settings_pack::max_string_setting_internal; ++i)                                                                                                                           |
│ │ │ │ │ +|		if (!torrent_file().info_hashes().has_v1() && blocks.empty() && !found_on_disk)                                                                                              |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			ret.set_str(i, m_settings.get_str(i));                                                                                                                                      |
│ │ │ │ │ +|verify_block_hashes(index);                                                                                                                                                    |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// the below code is penalizing peers that sent use bad data.                                                                                                                |
│ │ │ │ │ +|		// increase the total amount of failed bytes                                                                                                                                 |
│ │ │ │ │ +|		if (!found_on_disk)                                                                                                                                                          |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (blocks.empty())                                                                                                                                                         |
│ │ │ │ │ +|				add_failed_bytes(m_torrent_file->piece_size(index));                                                                                                                       |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|				add_failed_bytes(static_cast<int>(blocks.size()) * default_block_size);                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_EXTENSIONS                                                                                                                                             |
│ │ │ │ │ +|			for (auto& ext : m_extensions)                                                                                                                                              |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				ext->on_piece_failed(index);                                                                                                                                               |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// did we receive this piece from a single peer?                                                                                                                            |
│ │ │ │ │ +|			// if we know exactly which blocks failed the hash, we can also be certain                                                                                                  |
│ │ │ │ │ +|			// that all peers in the list sent us bad data                                                                                                                              |
│ │ │ │ │ +|			bool const known_bad_peer = (!found_on_disk && peers.size() == 1) || !blocks.empty();                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			penalize_peers(peers, index, known_bad_peer);                                                                                                                               |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		for (int i = settings_pack::int_type_base;                                                                                                                                   |
│ │ │ │ │ -|			i < settings_pack::max_int_setting_internal; ++i)                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// If m_storage isn't set here, it means we're shutting down                                                                                                                 |
│ │ │ │ │ +|		if (m_storage)                                                                                                                                                               |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			ret.set_int(i, m_settings.get_int(i));                                                                                                                                      |
│ │ │ │ │ +|_	_	_	_/_/_ _i_t_ _d_o_e_s_n_'_t_ _m_a_k_e_ _m_u_c_h_ _s_e_n_s_e_ _t_o_ _f_a_i_l_ _t_o_ _h_a_s_h_ _a_ _p_i_e_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_7_5_2_5_ _ _ _ _ _ _ _|_c_o_m_e_ _u_p_ _w_i_t_h_ _a_ _b_e_t_t_e_r_ _w_a_y_ _o_f_ _d_o_i_n_g_ _t_h_i_s_,_ _i_n_s_t_e_a_d_ _o_f_ _a_n_ _i_m_m_e_d_i_a_t_e_l_y_ _i_n_v_o_k_e_d_ _l_a_m_b_d_a_ _e_x_p_r_e_s_s_i_o_n_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ccoommee uupp wwiitthh aa bbeetttteerr wwaayy ooff ddooiinngg tthhiiss,, iinnsstteeaadd ooff aann iimmmmeeddiiaatteellyy iinnvvookkeedd llaammbbddaa eexxpprreessssiioonn.. **********                                                                      |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::77552255 ******                                                                                                                                                |
│ │ │ │ │ +||| peerinfo->confirmed_supports_utp))                                                                                                                                          |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				sm = m_ses.utp_socket_manager();                                                                                                                                           |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// don't make a TCP connection if it's disabled                                                                                                                             |
│ │ │ │ │ +|			if (sm == nullptr && !settings().get_bool(settings_pack::enable_outgoing_tcp))                                                                                              |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|				if (should_log())                                                                                                                                                          |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					debug_log("discarding peer \"%s\": TCP connections disabled "                                                                                                             |
│ │ │ │ │ +|						"[ supports-utp: %d ]", peerinfo->to_string().c_str()                                                                                                                    |
│ │ │ │ │ +|						, peerinfo->supports_utp);                                                                                                                                               |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|				return false;                                                                                                                                                              |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		for (int i = settings_pack::bool_type_base;                                                                                                                                  |
│ │ │ │ │ -|			i < settings_pack::max_bool_setting_internal; ++i)                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|aux::socket_type s = [&] {                                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ +|		if (peerinfo->is_i2p_addr)                                                                                                                                                   |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			ret.set_bool(i, m_settings.get_bool(i));                                                                                                                                    |
│ │ │ │ │ +|			// It's not entirely obvious why this peer connection is not marked as                                                                                                      |
│ │ │ │ │ +|			// one. The main feature of a peer connection is that whether or not we                                                                                                     |
│ │ │ │ │ +|			// proxy it is configurable. When we use i2p, we want to always prox                                                                                                        |
│ │ │ │ │ +|			// everything via i2p.                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			aux::proxy_settings proxy;                                                                                                                                                  |
│ │ │ │ │ +|			proxy.hostname = settings().get_str(settings_pack::i2p_hostname);                                                                                                           |
│ │ │ │ │ +|			proxy.port = std::uint16_t(settings().get_int(settings_pack::i2p_port));                                                                                                    |
│ │ │ │ │ +|			proxy.type = settings_pack::i2p_proxy;                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			aux::socket_type ret = instantiate_connection(m_ses.get_context()                                                                                                           |
│ │ │ │ │ +|				, proxy, nullptr, nullptr, false, false);                                                                                                                                  |
│ │ │ │ │ +|			i2p_stream& str = boost::get<i2p_stream>(ret);                                                                                                                              |
│ │ │ │ │ +|			str.set_local_i2p_endpoint(m_ses.local_i2p_endpoint());                                                                                                                     |
│ │ │ │ │ +|			str.set_destination(static_cast<i2p_peer*>(peerinfo)->dest());                                                                                                              |
│ │ │ │ │ +|			str.set_command(i2p_stream::cmd_connect);                                                                                                                                   |
│ │ │ │ │ +|			str.set_session_id(m_ses.i2p_session());                                                                                                                                    |
│ │ │ │ │ +|			return ret;                                                                                                                                                                 |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			void* userdata = nullptr;                                                                                                                                                   |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|			if (is_ssl_torrent())                                                                                                                                                       |
│ │ │ │ │ +|_	_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_9_1_1_8_ _ _ _ _ _ _ _|_p_e_r_h_a_p_s_ _0_ _s_h_o_u_l_d_ _a_c_t_u_a_l_l_y_ _m_e_a_n_ _0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ppeerrhhaappss 00 sshhoouulldd aaccttuuaallllyy mmeeaann 00 **********                                                                                                                                   |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::99111188 ******                                                                                                                                                |
│ │ │ │ │ +|// finished torrents may not change their queue positions, as it's set to                                                                                                      |
│ │ │ │ │ +|		// -1                                                                                                                                                                        |
│ │ │ │ │ +|		if ((m_abort || is_finished()) && p != no_pos) return;                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|namespace {                                                                                                                                                                    |
│ │ │ │ │ -|	template <typename Pack>                                                                                                                                                      |
│ │ │ │ │ -|	int get_setting_impl(Pack const& p, int name, int*)                                                                                                                           |
│ │ │ │ │ -|	{ return p.get_int(name); }                                                                                                                                                   |
│ │ │ │ │ +|		TORRENT_ASSERT((p == no_pos) == is_finished()                                                                                                                                |
│ │ │ │ │ +|			|| (!m_auto_managed && p == no_pos)                                                                                                                                         |
│ │ │ │ │ +|			|| (m_abort && p == no_pos)                                                                                                                                                 |
│ │ │ │ │ +|			|| (!m_added && p == no_pos));                                                                                                                                              |
│ │ │ │ │ +|		if (p == m_sequence_number) return;                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	template <typename Pack>                                                                                                                                                      |
│ │ │ │ │ -|	bool get_setting_impl(Pack const& p, int name, bool*)                                                                                                                         |
│ │ │ │ │ -|	{ return p.get_bool(name); }                                                                                                                                                  |
│ │ │ │ │ +|		TORRENT_ASSERT(p >= no_pos);                                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	template <typename Pack>                                                                                                                                                      |
│ │ │ │ │ -|	std::string get_setting_impl(Pack const& p, int name, std::string*)                                                                                                           |
│ │ │ │ │ -|_	_{_ _r_e_t_u_r_n_ _p_._g_e_t___s_t_r_(_n_a_m_e_)_;_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_1_9_9_8  |could this function be merged with expand_unspecified_addresses? right now both listen_endpoint_t and listen_interface_t are almost |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_i_d_e_n_t_i_c_a_l_,_ _m_a_y_b_e_ _t_h_e_ _l_a_t_t_e_r_ _c_o_u_l_d_ _b_e_ _r_e_m_o_v_e_d_ _t_o_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ccoouulldd tthhiiss ffuunnccttiioonn bbee mmeerrggeedd wwiitthh eexxppaanndd__uunnssppeecciiffiieedd__aaddddrreesssseess?? rriigghhtt nnooww bbootthh lliisstteenn__eennddppooiinntt__tt aanndd lliisstteenn__iinntteerrffaaccee__tt aarree aallmmoosstt iiddeennttiiccaall,, mmaayybbee tthhee llaatttteerr ccoouulldd bbee |
│ │ │ │ │ -|rreemmoovveedd ttoooo **********                                                                                                                                                              |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::11999988 ******                                                                                                                                           |
│ │ │ │ │ -|session_log("FATAL SESSION ERROR (%s : %d) [%s]"                                                                                                                               |
│ │ │ │ │ -|			, ec.category().name(), ec.value(), ec.message().c_str());                                                                                                                  |
│ │ │ │ │ +|		state_updated();                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		m_ses.set_queue_position(this, p);                                                                                                                                           |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void torrent::set_max_uploads(int limit, bool const state_update)                                                                                                             |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|if (limit <= 0) limit = (1 << 24) - 1;                                                                                                                                         |
│ │ │ │ │ +|if (int(m_max_uploads) == limit) return;                                                                                                                                       |
│ │ │ │ │ +|		if (state_update) state_updated();                                                                                                                                           |
│ │ │ │ │ +|		m_max_uploads = aux::numeric_cast<std::uint32_t>(limit);                                                                                                                     |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		if (should_log() && state_update)                                                                                                                                            |
│ │ │ │ │ +|			debug_log("*** set-max-uploads: %d", m_max_uploads);                                                                                                                        |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|		this->abort();                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (state_update)                                                                                                                                                            |
│ │ │ │ │ +|			set_need_save_resume(torrent_handle::if_config_changed);                                                                                                                    |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_impl::on_ip_change(error_code const& ec)                                                                                                                         |
│ │ │ │ │ +|	void torrent::set_max_connections(int limit, bool const state_update)                                                                                                         |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ +|_	_	_T_O_R_R_E_N_T___A_S_S_E_R_T_(_i_s___s_i_n_g_l_e___t_h_r_e_a_d_(_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_9_1_3_5_ _ _ _ _ _ _ _|_p_e_r_h_a_p_s_ _0_ _s_h_o_u_l_d_ _a_c_t_u_a_l_l_y_ _m_e_a_n_ _0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ppeerrhhaappss 00 sshhoouulldd aaccttuuaallllyy mmeeaann 00 **********                                                                                                                                   |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::99113355 ******                                                                                                                                                |
│ │ │ │ │ +|	void torrent::set_max_uploads(int limit, bool const state_update)                                                                                                             |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		if (limit <= 0) limit = (1 << 24) - 1;                                                                                                                                       |
│ │ │ │ │ +|		if (int(m_max_uploads) == limit) return;                                                                                                                                     |
│ │ │ │ │ +|		if (state_update) state_updated();                                                                                                                                           |
│ │ │ │ │ +|		m_max_uploads = aux::numeric_cast<std::uint32_t>(limit);                                                                                                                     |
│ │ │ │ │  |#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (!ec)                                                                                                                                                                     |
│ │ │ │ │ -|			session_log("received ip change from internal ip_notifier");                                                                                                                |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ -|			session_log("received error on_ip_change: %d, %s", ec.value(), ec.message().c_str());                                                                                       |
│ │ │ │ │ +|		if (should_log() && state_update)                                                                                                                                            |
│ │ │ │ │ +|			debug_log("*** set-max-uploads: %d", m_max_uploads);                                                                                                                        |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|		if (ec || m_abort || !m_ip_notifier) return;                                                                                                                                 |
│ │ │ │ │ -|		m_ip_notifier->async_wait([this] (error_code const& e)                                                                                                                       |
│ │ │ │ │ -|			{ wrap(&session_impl::on_ip_change, e); });                                                                                                                                 |
│ │ │ │ │ -|		reopen_network_sockets({});                                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (state_update)                                                                                                                                                            |
│ │ │ │ │ +|			set_need_save_resume(torrent_handle::if_config_changed);                                                                                                                    |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|void interface_to_endpoints(listen_interface_t const& iface                                                                                                                    |
│ │ │ │ │ -|, listen_socket_flags_t flags                                                                                                                                                  |
│ │ │ │ │ -|		, span<ip_interface const> const ifs                                                                                                                                         |
│ │ │ │ │ -|		, std::vector<listen_endpoint_t>& eps)                                                                                                                                       |
│ │ │ │ │ +|	void torrent::set_max_connections(int limit, bool const state_update)                                                                                                         |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		flags |= iface.local ? listen_socket_t::local_network : listen_socket_flags_t{};                                                                                             |
│ │ │ │ │ -|		transport const ssl = iface.ssl ? transport::ssl : transport::plaintext;                                                                                                     |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|if (limit <= 0) limit = (1 << 24) - 1;                                                                                                                                         |
│ │ │ │ │ +|if (int(m_max_connections) == limit) return;                                                                                                                                   |
│ │ │ │ │ +|		if (state_update) state_updated();                                                                                                                                           |
│ │ │ │ │ +|		m_max_connections = aux::numeric_cast<std::uint32_t>(limit);                                                                                                                 |
│ │ │ │ │ +|		update_want_peers();                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// First, check to see if it's an IP address                                                                                                                                 |
│ │ │ │ │ -|		error_code err;                                                                                                                                                              |
│ │ │ │ │ -|		address const adr = make_address(iface.device.c_str(), err);                                                                                                                 |
│ │ │ │ │ -|		if (!err)                                                                                                                                                                    |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		if (should_log() && state_update)                                                                                                                                            |
│ │ │ │ │ +|			debug_log("*** set-max-connections: %d", m_max_connections);                                                                                                                |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (num_peers() > int(m_max_connections))                                                                                                                                    |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			eps.emplace_back(adr, iface.port, std::string{}, ssl, flags);                                                                                                               |
│ │ │ │ │ +|			disconnect_peers(num_peers() - m_max_connections                                                                                                                            |
│ │ │ │ │ +|				, errors::too_many_connections);                                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			flags |= listen_socket_t::was_expanded;                                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// this is the case where device names a network device. We need to                                                                                                         |
│ │ │ │ │ -|			// enumerate all IPs associated with this device                                                                                                                            |
│ │ │ │ │ -|			for (auto const& ipface : ifs)                                                                                                                                              |
│ │ │ │ │ +|		if (state_update)                                                                                                                                                            |
│ │ │ │ │ +|			set_need_save_resume(torrent_handle::if_config_changed);                                                                                                                    |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void torrent::set_upload_limit(int const limit)                                                                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		set_limit_impl(limit, peer_connection::upload_channel);                                                                                                                      |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		debug_log("*** set-upload-limit: %d", limit);                                                                                                                                |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void torrent::set_download_limit(int const limit)                                                                                                                             |
│ │ │ │ │ +|_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_1_0_6_1_ _ _ _ _ _ _|_i_n_s_t_e_a_d_ _o_f_ _r_e_s_o_r_t_i_n_g_ _t_h_e_ _w_h_o_l_e_ _l_i_s_t_,_ _i_n_s_e_r_t_ _t_h_e_ _p_e_e_r_s_ _d_i_r_e_c_t_l_y_ _i_n_t_o_ _t_h_e_ _r_i_g_h_t_ _p_l_a_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinnsstteeaadd ooff rreessoorrttiinngg tthhee wwhhoollee lliisstt,, iinnsseerrtt tthhee ppeeeerrss ddiirreeccttllyy iinnttoo tthhee rriigghhtt ppllaaccee **********                                                                                |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::1111006611 ******                                                                                                                                               |
│ │ │ │ │ +|std::printf("timed out [average-piece-time: %d ms ]\n"                                                                                                                         |
│ │ │ │ │ +|					, m_average_piece_time);                                                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// pick all blocks for this piece. the peers list is kept up to date                                                                                                        |
│ │ │ │ │ +|			// and sorted. when we issue a request to a peer, its download queue                                                                                                        |
│ │ │ │ │ +|			// time will increase and it may need to be bumped in the peers list,                                                                                                       |
│ │ │ │ │ +|			// since it's ordered by download queue time                                                                                                                                |
│ │ │ │ │ +|			pick_time_critical_block(peers, ignore_peers                                                                                                                                |
│ │ │ │ │ +|				, peers_with_requests                                                                                                                                                      |
│ │ │ │ │ +|				, pi, &i, m_picker.get()                                                                                                                                                   |
│ │ │ │ │ +|				, blocks_in_piece, timed_out);                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// put back the peers we ignored into the peer list for the next piece                                                                                                      |
│ │ │ │ │ +|			if (!ignore_peers.empty())                                                                                                                                                  |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				// we're looking for a specific interface, and its address                                                                                                                 |
│ │ │ │ │ -|				// (which must be of the same family as the address we're                                                                                                                  |
│ │ │ │ │ -|				// connecting to)                                                                                                                                                          |
│ │ │ │ │ -|				if (iface.device != ipface.name) continue;                                                                                                                                 |
│ │ │ │ │ +|				peers.insert(peers.begin(), ignore_peers.begin(), ignore_peers.end());                                                                                                     |
│ │ │ │ │ +|				ignore_peers.clear();                                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				bool const local = iface.local                                                                                                                                             |
│ │ │ │ │ -|					|| ipface.interface_address.is_loopback()                                                                                                                                 |
│ │ │ │ │ -|_	_	_	_	_	_|_|_ _i_s___l_i_n_k___l_o_c_a_l_(_i_p_f_a_c_e_._i_n_t_e_r_f_a_c_e___a_d_d_r_e_s_s_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|           |                              |it would probably be better to do this by having a listen-socket "version" number that gets bumped. And instead of setting a bool to|
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_2_3_0_6  |disable a tracker, we set the version number that it was disabled at. This change would affect the ABI in 1.2, so should be done in |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_._0_ _o_r_ _l_a_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd pprroobbaabbllyy bbee bbeetttteerr ttoo ddoo tthhiiss bbyy hhaavviinngg aa lliisstteenn--ssoocckkeett ""vveerrssiioonn"" nnuummbbeerr tthhaatt ggeettss bbuummppeedd.. AAnndd iinnsstteeaadd ooff sseettttiinngg aa bbooooll ttoo ddiissaabbllee aa ttrraacckkeerr,, wwee sseett tthhee       |
│ │ │ │ │ -|vveerrssiioonn nnuummbbeerr tthhaatt iitt wwaass ddiissaabblleedd aatt.. TThhiiss cchhaannggee wwoouulldd aaffffeecctt tthhee AABBII iinn 11..22,, ssoo sshhoouulldd bbee ddoonnee iinn 22..00 oorr llaatteerr **********                                                       |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::22330066 ******                                                                                                                                           |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|			for (auto const& s : m_listen_sockets)                                                                                                                                      |
│ │ │ │ │ -|				remap_ports(remap_natpmp_and_upnp, *s);                                                                                                                                    |
│ │ │ │ │ +|std::sort(peers.begin(), peers.end()                                                                                                                                           |
│ │ │ │ │ +|, [] (peer_connection const* lhs, peer_connection const* rhs)                                                                                                                  |
│ │ │ │ │ +|					{ return lhs->download_queue_time(16*1024) < rhs->download_queue_time(16*1024); });                                                                                       |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// if this peer's download time exceeds 2 seconds, we're done.                                                                                                              |
│ │ │ │ │ +|			// We don't want to build unreasonably long request queues                                                                                                                  |
│ │ │ │ │ +|			if (!peers.empty() && peers[0]->download_queue_time() > milliseconds(2000))                                                                                                 |
│ │ │ │ │ +|				break;                                                                                                                                                                     |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// commit all the time critical requests                                                                                                                                     |
│ │ │ │ │ +|		for (auto p : peers_with_requests)                                                                                                                                           |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// new sockets need to map ports even if the caller did not request                                                                                                         |
│ │ │ │ │ -|			// re-mapping                                                                                                                                                               |
│ │ │ │ │ -|			for (auto const& s : new_sockets)                                                                                                                                           |
│ │ │ │ │ -|				remap_ports(remap_natpmp_and_upnp, *s);                                                                                                                                    |
│ │ │ │ │ +|			p->send_block_requests();                                                                                                                                                   |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif // TORRENT_DISABLE_STREAMING                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		update_lsd();                                                                                                                                                                |
│ │ │ │ │ +|	std::set<std::string> torrent::web_seeds(web_seed_entry::type_t const type) const                                                                                             |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		std::set<std::string> ret;                                                                                                                                                   |
│ │ │ │ │ +|		for (auto const& s : m_web_seeds)                                                                                                                                            |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (s.peer_info.banned) continue;                                                                                                                                           |
│ │ │ │ │ +|			if (s.removed) continue;                                                                                                                                                    |
│ │ │ │ │ +|			if (s.type != type) continue;                                                                                                                                               |
│ │ │ │ │ +|			ret.insert(s.url);                                                                                                                                                          |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|_	_	_r_e_t_u_r_n_ _r_e_t_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n_._c_p_p_:_5_4_0_ _ _ _ _ _ _ _ _|_I_n_ _C_+_+_1_7_._ _u_s_e_ _i_f_ _c_o_n_s_t_e_x_p_r_ _i_n_s_t_e_a_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** IInn CC++++1177.. uussee iiff ccoonnsstteexxpprr iinnsstteeaadd **********                                                                                                                                 |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn..ccpppp::554400 ******                                                                                                                                                 |
│ │ │ │ │ +|{}                                                                                                                                                                             |
│ │ │ │ │ +|	session_proxy::session_proxy(session_proxy const&) = default;                                                                                                                 |
│ │ │ │ │ +|	session_proxy& session_proxy::operator=(session_proxy const&) & = default;                                                                                                    |
│ │ │ │ │ +|	session_proxy::session_proxy(session_proxy&&) noexcept = default;                                                                                                             |
│ │ │ │ │ +|	session_proxy& session_proxy::operator=(session_proxy&&) & noexcept = default;                                                                                                |
│ │ │ │ │ +|	session_proxy::~session_proxy()                                                                                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		if (m_thread && m_thread.use_count() == 1)                                                                                                                                   |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|#if defined TORRENT_ASIO_DEBUGGING                                                                                                                                             |
│ │ │ │ │ +|			wait_for_asio_handlers();                                                                                                                                                   |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			m_thread->join();                                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ -|		open_new_incoming_i2p_connection();                                                                                                                                          |
│ │ │ │ │ +|	TORRENT_EXPORT std::unique_ptr<disk_interface> default_disk_io_constructor(                                                                                                   |
│ │ │ │ │ +|		io_context& ios, settings_interface const& sett, counters& cnt)                                                                                                              |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#if TORRENT_HAVE_MMAP || TORRENT_HAVE_MAP_VIEW_OF_FILE                                                                                                                         |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"                                                                                                               |
│ │ │ │ │ +|if (sizeof(void*) == 8)                                                                                                                                                        |
│ │ │ │ │ +|			return mmap_disk_io_constructor(ios, sett, cnt);                                                                                                                            |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │ +|			return posix_disk_io_constructor(ios, sett, cnt);                                                                                                                           |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		return posix_disk_io_constructor(ios, sett, cnt);                                                                                                                            |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// trackers that were not reachable, may have become reachable now.                                                                                                          |
│ │ │ │ │ -|		// so clear the "disabled" flags to let them be tried one more time                                                                                                          |
│ │ │ │ │ -|for (auto& t : m_torrents)                                                                                                                                                     |
│ │ │ │ │ -|t->enable_all_trackers();                                                                                                                                                      |
│ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_f_i_l_e___s_t_o_r_a_g_e_._c_p_p_:_4_5_7_ _ _ _|_m_a_y_b_e_ _i_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _h_a_v_e_ _a_ _b_e_t_t_e_r_ _i_n_d_e_x_ _h_e_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmaayybbee iitt wwoouulldd bbee nniiccee ttoo hhaavvee aa bbeetttteerr iinnddeexx hheerree **********                                                                                                                 |
│ │ │ │ │ +|****** ....//ssrrcc//ffiillee__ssttoorraaggee..ccpppp::445577 ******                                                                                                                                            |
│ │ │ │ │ +|// find the file iterator and file offset                                                                                                                                      |
│ │ │ │ │ +|		aux::file_entry target;                                                                                                                                                      |
│ │ │ │ │ +|		target.offset = aux::numeric_cast<std::uint64_t>(offset);                                                                                                                    |
│ │ │ │ │ +|		TORRENT_ASSERT(!compare_file_offset(target, m_files.front()));                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		auto file_iter = std::upper_bound(                                                                                                                                           |
│ │ │ │ │ +|			m_files.begin(), m_files.end(), target, compare_file_offset);                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(file_iter != m_files.begin());                                                                                                                                |
│ │ │ │ │ +|		--file_iter;                                                                                                                                                                 |
│ │ │ │ │ +|		return file_index_t{int(file_iter - m_files.begin())};                                                                                                                       |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_impl::reopen_network_sockets(reopen_network_flags_t const options)                                                                                               |
│ │ │ │ │ +|	file_index_t file_storage::file_index_at_piece(piece_index_t const piece) const                                                                                               |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		reopen_listen_sockets(bool(options & session_handle::reopen_map_ports));                                                                                                     |
│ │ │ │ │ +|		return file_index_at_offset(static_cast<int>(piece) * std::int64_t(piece_length()));                                                                                         |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	namespace {                                                                                                                                                                   |
│ │ │ │ │ -|		template <typename MapProtocol, typename ProtoType, typename EndpointType>                                                                                                   |
│ │ │ │ │ -|		void map_port(MapProtocol& m, ProtoType protocol, EndpointType const& ep                                                                                                     |
│ │ │ │ │ -|			, port_mapping_t& map_handle, std::string const& device)                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (map_handle != port_mapping_t{-1}) m.delete_mapping(map_handle);                                                                                                         |
│ │ │ │ │ -|			map_handle = port_mapping_t{-1};                                                                                                                                            |
│ │ │ │ │ +|	file_index_t file_storage::file_index_for_root(sha256_hash const& root_hash) const                                                                                            |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|for (file_index_t const i : file_range())                                                                                                                                      |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|			if (root(i) == root_hash) return i;                                                                                                                                         |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		return file_index_t{-1};                                                                                                                                                     |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			address const addr = ep.address();                                                                                                                                          |
│ │ │ │ │ -|			// with IPv4 the interface might be behind NAT so we can't skip them                                                                                                        |
│ │ │ │ │ -|			// based on the scope of the local address                                                                                                                                  |
│ │ │ │ │ -|			if (addr.is_v6() && is_local(addr))                                                                                                                                         |
│ │ │ │ │ -|				return;                                                                                                                                                                    |
│ │ │ │ │ +|	piece_index_t file_storage::piece_index_at_file(file_index_t f) const                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return piece_index_t{aux::numeric_cast<int>(file_offset(f) / piece_length())};                                                                                               |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// only update this mapping if we actually have a socket listening                                                                                                          |
│ │ │ │ │ -|			if (ep != EndpointType())                                                                                                                                                   |
│ │ │ │ │ -|				map_handle = m.add_mapping(protocol, ep.port(), ep, device);                                                                                                               |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION <= 2                                                                                                                                                   |
│ │ │ │ │ +|	char const* file_storage::file_name_ptr(file_index_t const index) const                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return m_files[index].name;                                                                                                                                                  |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_impl::remap_ports(remap_port_mask_t const mask                                                                                                                   |
│ │ │ │ │ -|_	_	_,_ _l_i_s_t_e_n___s_o_c_k_e_t___t_&_ _s_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_2_8_6_6_ _ _|_t_h_i_s_ _s_i_z_e_ _n_e_e_d_ _t_o_ _b_e_ _c_a_p_p_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ssiizzee nneeeedd ttoo bbee ccaappppeedd **********                                                                                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::22886666 ******                                                                                                                                           |
│ │ │ │ │ -|// handshaking                                                                                                                                                                 |
│ │ │ │ │ -|				return socket_type(ssl_stream<tcp::socket>(tcp::socket(std::move(s)), m_peer_ssl_ctx));                                                                                    |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ +|	int file_storage::file_name_len(file_index_t const index) const                                                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		if (m_files[index].name_len == aux::file_entry::name_is_owned)                                                                                                               |
│ │ │ │ │ +|			return -1;                                                                                                                                                                  |
│ │ │ │ │ +|		return m_files[index].name_len;                                                                                                                                              |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	std::vector<file_slice> file_storage::map_block(piece_index_t const piece                                                                                                     |
│ │ │ │ │ +|		, std::int64_t const offset, std::int64_t size) const                                                                                                                        |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT_PRECOND(piece >= piece_index_t{0});                                                                                                                           |
│ │ │ │ │ +|_	_	_T_O_R_R_E_N_T___A_S_S_E_R_T___P_R_E_C_O_N_D_(_p_i_e_c_e_ _<_ _e_n_d___p_i_e_c_e_(_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_f_i_l_e___s_t_o_r_a_g_e_._c_p_p_:_1_2_4_2_ _ _|_t_h_i_s_ _w_o_u_l_d_ _b_e_ _m_o_r_e_ _e_f_f_i_c_i_e_n_t_ _i_f_ _m___p_a_t_h_s_ _w_a_s_ _s_o_r_t_e_d_ _f_i_r_s_t_,_ _s_u_c_h_ _t_h_a_t_ _a_ _l_o_w_e_r_ _p_a_t_h_ _i_n_d_e_x_ _a_l_w_a_y_s_ _m_e_a_n_t_ _s_o_r_t_e_d_-_b_e_f_o_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss wwoouulldd bbee mmoorree eeffffiicciieenntt iiff mm__ppaatthhss wwaass ssoorrtteedd ffiirrsstt,, ssuucchh tthhaatt aa lloowweerr ppaatthh iinnddeexx aallwwaayyss mmeeaanntt ssoorrtteedd--bbeeffoorree **********                                                  |
│ │ │ │ │ +|****** ....//ssrrcc//ffiillee__ssttoorraaggee..ccpppp::11224422 ******                                                                                                                                           |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void file_storage::canonicalize_impl(bool const backwards_compatible)                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(piece_length() >= 16 * 1024);                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// use this vector to track the new ordering of files                                                                                                                        |
│ │ │ │ │ +|		// this allows the use of STL algorithms despite them                                                                                                                        |
│ │ │ │ │ +|		// not supporting a custom swap functor                                                                                                                                      |
│ │ │ │ │ +|		aux::vector<file_index_t, file_index_t> new_order(end_file());                                                                                                               |
│ │ │ │ │ +|		for (auto i : file_range())                                                                                                                                                  |
│ │ │ │ │ +|			new_order[i] = i;                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// remove any existing pad files                                                                                                                                             |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			auto pad_begin = std::partition(new_order.begin(), new_order.end()                                                                                                          |
│ │ │ │ │ +|				, [this](file_index_t i) { return !m_files[i].pad_file; });                                                                                                                |
│ │ │ │ │ +|			new_order.erase(pad_begin, new_order.end());                                                                                                                                |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|// sort files by path/name                                                                                                                                                     |
│ │ │ │ │ +|		std::sort(new_order.begin(), new_order.end()                                                                                                                                 |
│ │ │ │ │ +|			, [this](file_index_t l, file_index_t r)                                                                                                                                    |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// assuming m_paths are unique!                                                                                                                                             |
│ │ │ │ │ +|			auto const& lf = m_files[l];                                                                                                                                                |
│ │ │ │ │ +|			auto const& rf = m_files[r];                                                                                                                                                |
│ │ │ │ │ +|			if (lf.path_index != rf.path_index)                                                                                                                                         |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				return socket_type(tcp::socket(std::move(s)));                                                                                                                             |
│ │ │ │ │ +|				int const ret = path_compare(m_paths[lf.path_index], lf.filename()                                                                                                         |
│ │ │ │ │ +|					, m_paths[rf.path_index], rf.filename());                                                                                                                                 |
│ │ │ │ │ +|				if (ret != 0) return ret < 0;                                                                                                                                              |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ -|		}();                                                                                                                                                                         |
│ │ │ │ │ +|			return lf.filename() < rf.filename();                                                                                                                                       |
│ │ │ │ │ +|		});                                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ -|		TORRENT_ASSERT((ssl == transport::ssl) == is_ssl(c));                                                                                                                        |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		aux::vector<aux::file_entry, file_index_t> new_files;                                                                                                                        |
│ │ │ │ │ +|		aux::vector<char const*, file_index_t> new_file_hashes;                                                                                                                      |
│ │ │ │ │ +|		aux::vector<std::time_t, file_index_t> new_mtime;                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ -|		if (ssl == transport::ssl)                                                                                                                                                   |
│ │ │ │ │ +|		// reserve enough space for the worst case after padding                                                                                                                     |
│ │ │ │ │ +|		new_files.reserve(new_order.size() * 2 - 1);                                                                                                                                 |
│ │ │ │ │ +|		if (!m_file_hashes.empty())                                                                                                                                                  |
│ │ │ │ │ +|			new_file_hashes.reserve(new_order.size() * 2 - 1);                                                                                                                          |
│ │ │ │ │ +|		if (!m_mtime.empty())                                                                                                                                                        |
│ │ │ │ │ +|			new_mtime.reserve(new_order.size() * 2 - 1);                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// re-compute offsets and insert pad files as necessary                                                                                                                      |
│ │ │ │ │ +|_	_	_s_t_d_:_:_i_n_t_6_4___t_ _o_f_f_ _=_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_f_i_l_e___s_t_o_r_a_g_e_._c_p_p_:_1_3_4_5_ _ _|_i_n_ _C_+_+_1_7_ _t_h_i_s_ _c_o_u_l_d_ _b_e_ _s_t_r_i_n_g___v_i_e_w_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinn CC++++1177 tthhiiss ccoouulldd bbee ssttrriinngg__vviieeww **********                                                                                                                                 |
│ │ │ │ │ +|****** ....//ssrrcc//ffiillee__ssttoorraaggee..ccpppp::11334455 ******                                                                                                                                           |
│ │ │ │ │ +|add_pad_file(i);                                                                                                                                                               |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		m_files = std::move(new_files);                                                                                                                                              |
│ │ │ │ │ +|		m_file_hashes = std::move(new_file_hashes);                                                                                                                                  |
│ │ │ │ │ +|		m_mtime = std::move(new_mtime);                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		m_total_size = off;                                                                                                                                                          |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void file_storage::sanitize_symlinks()                                                                                                                                        |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		// symlinks are unusual, this function is optimized assuming there are no                                                                                                    |
│ │ │ │ │ +|		// symbolic links in the torrent. If we find one symbolic link, we'll                                                                                                        |
│ │ │ │ │ +|		// build the hash table of files it's allowed to refer to, but don't pay                                                                                                     |
│ │ │ │ │ +|		// that price up-front.                                                                                                                                                      |
│ │ │ │ │ +|		std::unordered_map<std::string, file_index_t> file_map;                                                                                                                      |
│ │ │ │ │ +|		bool file_map_initialized = false;                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// lazily instantiated set of all valid directories a symlink may point to                                                                                                   |
│ │ │ │ │ +|std::unordered_set<std::string> dir_map;                                                                                                                                       |
│ │ │ │ │ +|bool dir_map_initialized = false;                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// symbolic links that points to directories                                                                                                                                 |
│ │ │ │ │ +|		std::unordered_map<std::string, std::string> dir_links;                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// we validate symlinks in (potentially) 2 passes over the files.                                                                                                            |
│ │ │ │ │ +|		// remaining symlinks to validate after the first pass                                                                                                                       |
│ │ │ │ │ +|		std::vector<file_index_t> symlinks_to_validate;                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		for (auto const i : file_range())                                                                                                                                            |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			TORRENT_ASSERT(is_ssl(c));                                                                                                                                                  |
│ │ │ │ │ +|			if (!(file_flags(i) & file_storage::flag_symlink)) continue;                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// save the socket so we can cancel the handshake                                                                                                                           |
│ │ │ │ │ -|auto iter = m_incoming_sockets.emplace(std::make_unique<socket_type>(std::move(c))).first;                                                                                     |
│ │ │ │ │ +|			if (!file_map_initialized)                                                                                                                                                  |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				for (auto const j : file_range())                                                                                                                                          |
│ │ │ │ │ +|					file_map.insert({internal_file_path(j), j});                                                                                                                              |
│ │ │ │ │ +|				file_map_initialized = true;                                                                                                                                               |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			auto sock = iter->get();                                                                                                                                                    |
│ │ │ │ │ -|			// for SSL connections, incoming_connection() is called                                                                                                                     |
│ │ │ │ │ -|			// after the handshake is done                                                                                                                                              |
│ │ │ │ │ -|			ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");                                                                                                                       |
│ │ │ │ │ -|			boost::get<ssl_stream<tcp::socket>>(**iter).async_accept_handshake(                                                                                                         |
│ │ │ │ │ -|				[this, sock] (error_code const& err) { ssl_handshake(err, sock); });                                                                                                       |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			aux::file_entry const& fe = m_files[i];                                                                                                                                     |
│ │ │ │ │ +|			TORRENT_ASSERT(fe.symlink_index < int(m_symlinks.size()));                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// symlink targets are only allowed to point to files or directories in                                                                                                     |
│ │ │ │ │ +|			// this torrent.                                                                                                                                                            |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				std::string target = m_symlinks[fe.symlink_index];                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|				if (is_complete(target))                                                                                                                                                   |
│ │ │ │ │ +|_	_	_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/                       |introduce a web-seed default class which has a low download priority                                                                |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_w_e_b___c_o_n_n_e_c_t_i_o_n___b_a_s_e_._c_p_p_:_7_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinnttrroodduuccee aa wweebb--sseeeedd ddeeffaauulltt ccllaassss wwhhiicchh hhaass aa llooww ddoowwnnllooaadd pprriioorriittyy **********                                                                                               |
│ │ │ │ │ +|****** ....//ssrrcc//wweebb__ccoonnnneeccttiioonn__bbaassee..ccpppp::7722 ******                                                                                                                                      |
│ │ │ │ │ +|: peer_connection(pack)                                                                                                                                                        |
│ │ │ │ │ +|		, m_first_request(true)                                                                                                                                                      |
│ │ │ │ │ +|		, m_ssl(false)                                                                                                                                                               |
│ │ │ │ │ +|		, m_external_auth(web.auth)                                                                                                                                                  |
│ │ │ │ │ +|		, m_extra_headers(web.extra_headers)                                                                                                                                         |
│ │ │ │ │ +|		, m_parser(http_parser::dont_parse_chunks)                                                                                                                                   |
│ │ │ │ │ +|		, m_body_start(0)                                                                                                                                                            |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(&web.peer_info == pack.peerinfo);                                                                                                                             |
│ │ │ │ │ +|		// when going through a proxy, we don't necessarily have an endpoint here,                                                                                                   |
│ │ │ │ │ +|		// since the proxy might be resolving the hostname, not us                                                                                                                   |
│ │ │ │ │ +|		TORRENT_ASSERT(web.endpoints.empty() || web.endpoints.front() == pack.endp);                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(is_outgoing());                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(!m_torrent.lock()->is_upload_only());                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// we only want left-over bandwidth                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|std::string protocol;                                                                                                                                                          |
│ │ │ │ │ +|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ +|		std::tie(protocol, m_basic_auth, m_host, m_port, m_path)                                                                                                                     |
│ │ │ │ │ +|			= parse_url_components(web.url, ec);                                                                                                                                        |
│ │ │ │ │ +|		TORRENT_ASSERT(!ec);                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (m_port == -1 && protocol == "http")                                                                                                                                      |
│ │ │ │ │ +|			m_port = 80;                                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ +|		if (protocol == "https")                                                                                                                                                     |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			incoming_connection(std::move(c));                                                                                                                                          |
│ │ │ │ │ +|			m_ssl = true;                                                                                                                                                               |
│ │ │ │ │ +|			if (m_port == -1) m_port = 443;                                                                                                                                             |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (!m_basic_auth.empty())                                                                                                                                                   |
│ │ │ │ │ +|			m_basic_auth = base64encode(m_basic_auth);                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		m_server_string = m_host;                                                                                                                                                    |
│ │ │ │ │ +|		aux::verify_encoding(m_server_string);                                                                                                                                       |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|	int web_connection_base::timeout() const                                                                                                                                      |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		// since this is a web seed, change the timeout                                                                                                                              |
│ │ │ │ │ +|		// according to the settings.                                                                                                                                                |
│ │ │ │ │ +|		return m_settings.get_int(settings_pack::urlseed_timeout);                                                                                                                   |
│ │ │ │ │ +|_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_c_p_u_i_d_._c_p_p_:_1_3_1_ _ _ _ _ _ _ _ _ _ _|_e_n_a_b_l_e_ _w_h_e_n_ _a_a_r_c_h_6_4_ _i_s_ _r_e_a_l_l_y_ _t_e_s_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** eennaabbllee wwhheenn aaaarrcchh6644 iiss rreeaallllyy tteesstteedd **********                                                                                                                               |
│ │ │ │ │ +|****** ....//ssrrcc//ccppuuiidd..ccpppp::113311 ******                                                                                                                                                   |
│ │ │ │ │ +|bool supports_mmx() noexcept                                                                                                                                                   |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#if TORRENT_HAS_SSE                                                                                                                                                            |
│ │ │ │ │ +|		std::uint32_t cpui[4] = {0};                                                                                                                                                 |
│ │ │ │ │ +|		cpuid(cpui, 1);                                                                                                                                                              |
│ │ │ │ │ +|		return (cpui[2] & (1 << 23)) != 0;                                                                                                                                           |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_impl::on_incoming_utp_ssl(socket_type s)                                                                                                                         |
│ │ │ │ │ +|	bool supports_arm_neon() noexcept                                                                                                                                             |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_ssl(s));                                                                                                                                                   |
│ │ │ │ │ +|#if TORRENT_HAS_ARM_NEON && TORRENT_HAS_AUXV                                                                                                                                   |
│ │ │ │ │ +|#if defined __arm__                                                                                                                                                            |
│ │ │ │ │ +|		//return (getauxval(AT_HWCAP) & HWCAP_NEON);                                                                                                                                 |
│ │ │ │ │ +|		return (helper_getauxval(16) & (1 << 12));                                                                                                                                   |
│ │ │ │ │ +|#elif defined __aarch64__                                                                                                                                                      |
│ │ │ │ │ +|		//return (getauxval(AT_HWCAP) & HWCAP_ASIMD);                                                                                                                                |
│ │ │ │ │ +|		//return (getauxval(16) & (1 << 1));                                                                                                                                         |
│ │ │ │ │ +|return false;                                                                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_	_	_/_/_ _s_a_v_e_ _t_h_e_ _s_o_c_k_e_t_ _s_o_ _w_e_ _c_a_n_ _c_a_n_c_e_l_ _t_h_e_ _h_a_n_d_s_h_a_k_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_2_8_9_1_ _ _|_t_h_i_s_ _s_i_z_e_ _n_e_e_d_ _t_o_ _b_e_ _c_a_p_p_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ssiizzee nneeeedd ttoo bbee ccaappppeedd **********                                                                                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::22889911 ******                                                                                                                                           |
│ │ │ │ │ -|// after the handshake is done                                                                                                                                                 |
│ │ │ │ │ -|			ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");                                                                                                                       |
│ │ │ │ │ -|			boost::get<ssl_stream<tcp::socket>>(**iter).async_accept_handshake(                                                                                                         |
│ │ │ │ │ -|				[this, sock] (error_code const& err) { ssl_handshake(err, sock); });                                                                                                       |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ +|	bool supports_arm_crc32c() noexcept                                                                                                                                           |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#if TORRENT_HAS_ARM_CRC32 && TORRENT_HAS_AUXV                                                                                                                                  |
│ │ │ │ │ +|#if defined TORRENT_FORCE_ARM_CRC32                                                                                                                                            |
│ │ │ │ │ +|		return true;                                                                                                                                                                 |
│ │ │ │ │ +|#elif defined __arm__                                                                                                                                                          |
│ │ │ │ │ +|		//return (getauxval(AT_HWCAP2) & HWCAP2_CRC32);                                                                                                                              |
│ │ │ │ │ +|		return (helper_getauxval(26) & (1 << 4));                                                                                                                                    |
│ │ │ │ │ +|#elif defined __aarch64__                                                                                                                                                      |
│ │ │ │ │ +|		//return (getauxval(AT_HWCAP) & HWCAP_CRC32);                                                                                                                                |
│ │ │ │ │ +|		return (helper_getauxval(16) & (1 << 7));                                                                                                                                    |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			incoming_connection(std::move(c));                                                                                                                                          |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|} // anonymous namespace                                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_impl::on_incoming_utp_ssl(socket_type s)                                                                                                                         |
│ │ │ │ │ +|	bool const sse42_support = supports_sse42();                                                                                                                                  |
│ │ │ │ │ +|	bool const mmx_support = supports_mmx();                                                                                                                                      |
│ │ │ │ │ +|	bool const arm_neon_support = supports_arm_neon();                                                                                                                            |
│ │ │ │ │ +|	bool const arm_crc32c_support = supports_arm_crc32c();                                                                                                                        |
│ │ │ │ │ +|_}_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_d_i_s_a_b_l_e_d___d_i_s_k___i_o_._c_p_p_:  |it would be nice to return a valid hash of zeroes here                                                                              |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_1_0_6_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd bbee nniiccee ttoo rreettuurrnn aa vvaalliidd hhaasshh ooff zzeerrooeess hheerree **********                                                                                                             |
│ │ │ │ │ +|****** ....//ssrrcc//ddiissaabblleedd__ddiisskk__iioo..ccpppp::110066 ******                                                                                                                                        |
│ │ │ │ │ +|});                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	bool async_write(storage_index_t                                                                                                                                              |
│ │ │ │ │ +|		, peer_request const& r                                                                                                                                                      |
│ │ │ │ │ +|		, char const*, std::shared_ptr<disk_observer>                                                                                                                                |
│ │ │ │ │ +|		, std::function<void(storage_error const&)> handler                                                                                                                          |
│ │ │ │ │ +|		, disk_job_flags_t) override                                                                                                                                                 |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_ssl(s));                                                                                                                                                   |
│ │ │ │ │ +|		TORRENT_ASSERT(r.length <= default_block_size);                                                                                                                              |
│ │ │ │ │ +|		TORRENT_UNUSED(r);                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// save the socket so we can cancel the handshake                                                                                                                            |
│ │ │ │ │ +|		post(m_ios, [h = std::move(handler)] { h(storage_error{}); });                                                                                                               |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|auto iter = m_incoming_sockets.emplace(std::make_unique<socket_type>(std::move(s))).first;                                                                                     |
│ │ │ │ │ -|auto sock = iter->get();                                                                                                                                                       |
│ │ │ │ │ +|	void async_hash(storage_index_t                                                                                                                                               |
│ │ │ │ │ +|		, piece_index_t piece, span<sha256_hash>, disk_job_flags_t                                                                                                                   |
│ │ │ │ │ +|		, std::function<void(piece_index_t, sha1_hash const&, storage_error const&)> handler) override                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|post(m_ios, [h = std::move(handler), piece] { h(piece, sha1_hash{}, storage_error{}); });                                                                                      |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// for SSL connections, incoming_connection() is called                                                                                                                      |
│ │ │ │ │ -|		// after the handshake is done                                                                                                                                               |
│ │ │ │ │ -|		ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");                                                                                                                        |
│ │ │ │ │ -|		boost::get<ssl_stream<utp_stream>>(**iter).async_accept_handshake(                                                                                                           |
│ │ │ │ │ -|			[this, sock] (error_code const& err) { ssl_handshake(err, sock); });                                                                                                        |
│ │ │ │ │ +|	void async_hash2(storage_index_t, piece_index_t piece, int                                                                                                                    |
│ │ │ │ │ +|		, disk_job_flags_t                                                                                                                                                           |
│ │ │ │ │ +|		, std::function<void(piece_index_t, sha256_hash const&, storage_error const&)> handler) override                                                                             |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		post(m_ios, [h = std::move(handler), piece]() { h(piece, sha256_hash{}, storage_error{}); });                                                                                |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// to test SSL connections, one can use this openssl command template:                                                                                                        |
│ │ │ │ │ -|	//                                                                                                                                                                            |
│ │ │ │ │ -|	// openssl s_client -cert <client-cert>.pem -key <client-private-key>.pem                                                                                                     |
│ │ │ │ │ -|	//   -CAfile <torrent-cert>.pem  -debug -connect 127.0.0.1:4433 -tls1                                                                                                         |
│ │ │ │ │ -|	//   -servername <hex-encoded-info-hash>                                                                                                                                      |
│ │ │ │ │ +|	void async_move_storage(storage_index_t                                                                                                                                       |
│ │ │ │ │ +|		, std::string p, move_flags_t                                                                                                                                                |
│ │ │ │ │ +|		, std::function<void(status_t, std::string const&, storage_error const&)> handler) override                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		post(m_ios, [h = std::move(handler), path = std::move(p)] () mutable                                                                                                         |
│ │ │ │ │ +|			{ h(status_t::no_error, std::move(path), storage_error{}); });                                                                                                              |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_impl::ssl_handshake(error_code const& ec, socket_type* sock)                                                                                                     |
│ │ │ │ │ +|	void async_release_files(storage_index_t, std::function<void()> handler) override                                                                                             |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		COMPLETE_ASYNC("session_impl::ssl_handshake");                                                                                                                               |
│ │ │ │ │ +|		post(m_ios, [h = std::move(handler)] { h(); });                                                                                                                              |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		auto iter = m_incoming_sockets.find(sock);                                                                                                                                   |
│ │ │ │ │ +|	void async_delete_files(storage_index_t                                                                                                                                       |
│ │ │ │ │ +|		, remove_flags_t, std::function<void(storage_error const&)> handler) override                                                                                                |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		post(m_ios, [h = std::move(handler)] { h(storage_error{}); });                                                                                                               |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// this happens if the SSL connection is aborted because we're shutting                                                                                                      |
│ │ │ │ │ -|		// down                                                                                                                                                                      |
│ │ │ │ │ -|		if (iter == m_incoming_sockets.end()) return;                                                                                                                                |
│ │ │ │ │ +|	void async_check_files(storage_index_t                                                                                                                                        |
│ │ │ │ │ +|_	_	_,_ _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_ _c_o_n_s_t_*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_u_d_p___s_o_c_k_e_t_._c_p_p_:_6_5_9_ _ _ _ _ _|_p_e_r_h_a_p_s_ _a_n_ _a_t_t_e_m_p_t_ _s_h_o_u_l_d_ _b_e_ _m_a_d_e_ _t_o_ _b_i_n_d_ _m___s_o_c_k_s_5___s_o_c_k_ _t_o_ _t_h_e_ _d_e_v_i_c_e_ _o_f_ _m___l_i_s_t_e_n___s_o_c_k_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ppeerrhhaappss aann aatttteemmpptt sshhoouulldd bbee mmaaddee ttoo bbiinndd mm__ssoocckkss55__ssoocckk ttoo tthhee ddeevviiccee ooff mm__lliisstteenn__ssoocckkeett **********                                                                           |
│ │ │ │ │ +|****** ....//ssrrcc//uuddpp__ssoocckkeett..ccpppp::665599 ******                                                                                                                                              |
│ │ │ │ │ +|if (ec)                                                                                                                                                                        |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		if (m_alerts.should_post<socks5_alert>())                                                                                                                                    |
│ │ │ │ │ +|			m_alerts.emplace_alert<socks5_alert>(m_proxy_addr, operation_t::sock_option, ec);                                                                                           |
│ │ │ │ │ +|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		socket_type s(std::move(**iter));                                                                                                                                            |
│ │ │ │ │ -|		TORRENT_ASSERT(is_ssl(s));                                                                                                                                                   |
│ │ │ │ │ -|		m_incoming_sockets.erase(iter);                                                                                                                                              |
│ │ │ │ │ +|	tcp::endpoint const bind_ep(m_listen_socket.get_local_endpoint().address(), 0);                                                                                               |
│ │ │ │ │ +|	m_socks5_sock.bind(bind_ep, ec);                                                                                                                                              |
│ │ │ │ │ +|	if (ec)                                                                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		if (m_alerts.should_post<socks5_alert>())                                                                                                                                    |
│ │ │ │ │ +|			m_alerts.emplace_alert<socks5_alert>(m_proxy_addr, operation_t::sock_bind, ec);                                                                                             |
│ │ │ │ │ +|		++m_failures;                                                                                                                                                                |
│ │ │ │ │ +|		retry_connection();                                                                                                                                                          |
│ │ │ │ │ +|		return;                                                                                                                                                                      |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_	_	_e_r_r_o_r___c_o_d_e_ _e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_3_5_9_0_ _ _|_h_a_v_e_ _a_ _s_e_p_a_r_a_t_e_ _l_i_s_t_ _f_o_r_ _t_h_e_s_e_ _c_o_n_n_e_c_t_i_o_n_s_,_ _i_n_s_t_e_a_d_ _o_f_ _h_a_v_i_n_g_ _t_o_ _l_o_o_p_ _t_h_r_o_u_g_h_ _a_l_l_ _o_f_ _t_h_e_m_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** hhaavvee aa sseeppaarraattee lliisstt ffoorr tthheessee ccoonnnneeccttiioonnss,, iinnsstteeaadd ooff hhaavviinngg ttoo lloooopp tthhrroouugghh aallll ooff tthheemm **********                                                                          |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::33559900 ******                                                                                                                                           |
│ │ │ │ │ -|// --------------------------------------------------------------                                                                                                              |
│ │ │ │ │ -|		if (!m_paused) m_auto_manage_time_scaler--;                                                                                                                                  |
│ │ │ │ │ -|		if (m_auto_manage_time_scaler < 0)                                                                                                                                           |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_auto_manage_time_scaler = settings().get_int(settings_pack::auto_manage_interval);                                                                                        |
│ │ │ │ │ -|			recalculate_auto_managed_torrents();                                                                                                                                        |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// --------------------------------------------------------------                                                                                                            |
│ │ │ │ │ -|		// check for incoming connections that might have timed out                                                                                                                  |
│ │ │ │ │ -|		// --------------------------------------------------------------                                                                                                            |
│ │ │ │ │ +|ADD_OUTSTANDING_ASYNC("socks5::on_connected");                                                                                                                                 |
│ │ │ │ │ +|	m_socks5_sock.async_connect(m_proxy_addr                                                                                                                                      |
│ │ │ │ │ +|		, std::bind(&socks5::on_connected, self(), _1));                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		for (auto i = m_connections.begin(); i != m_connections.end();)                                                                                                              |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			peer_connection* p = (*i).get();                                                                                                                                            |
│ │ │ │ │ -|			++i;                                                                                                                                                                        |
│ │ │ │ │ -|			// ignore connections that already have a torrent, since they                                                                                                               |
│ │ │ │ │ -|			// are ticked through the torrents' second_tick                                                                                                                             |
│ │ │ │ │ -|			if (!p->associated_torrent().expired()) continue;                                                                                                                           |
│ │ │ │ │ +|	ADD_OUTSTANDING_ASYNC("socks5::on_connect_timeout");                                                                                                                          |
│ │ │ │ │ +|	m_timer.expires_after(seconds(10));                                                                                                                                           |
│ │ │ │ │ +|	m_timer.async_wait(std::bind(&socks5::on_connect_timeout                                                                                                                      |
│ │ │ │ │ +|		, self(), _1));                                                                                                                                                              |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|int timeout = m_settings.get_int(settings_pack::handshake_timeout);                                                                                                            |
│ │ │ │ │ -|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ -|			timeout *= is_i2p(p->get_socket()) ? 4 : 1;                                                                                                                                 |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			if (m_last_tick - p->connected_time () > seconds(timeout))                                                                                                                  |
│ │ │ │ │ -|				p->disconnect(errors::timed_out, operation_t::bittorrent);                                                                                                                 |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|void socks5::on_connect_timeout(error_code const& e)                                                                                                                           |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	COMPLETE_ASYNC("socks5::on_connect_timeout");                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// --------------------------------------------------------------                                                                                                            |
│ │ │ │ │ -|		// second_tick every torrent (that wants it)                                                                                                                                 |
│ │ │ │ │ -|		// --------------------------------------------------------------                                                                                                            |
│ │ │ │ │ +|	if (e == boost::asio::error::operation_aborted) return;                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_DEBUG_STREAMING > 0                                                                                                                                                |
│ │ │ │ │ -|		std::printf("\033[2J\033[0;0H");                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	if (m_abort) return;                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		aux::vector<torrent*>& want_tick = m_torrent_lists[torrent_want_tick];                                                                                                       |
│ │ │ │ │ -|		for (int i = 0; i < int(want_tick.size()); ++i)                                                                                                                              |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			torrent& t = *want_tick[i];                                                                                                                                                 |
│ │ │ │ │ -|			TORRENT_ASSERT(t.want_tick());                                                                                                                                              |
│ │ │ │ │ -|			TORRENT_ASSERT(!t.is_aborted());                                                                                                                                            |
│ │ │ │ │ +|	if (m_alerts.should_post<socks5_alert>())                                                                                                                                     |
│ │ │ │ │ +|		m_alerts.emplace_alert<socks5_alert>(m_proxy_addr, operation_t::connect, errors::timed_out);                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			t.second_tick(tick_interval_ms);                                                                                                                                            |
│ │ │ │ │ +|	error_code ignore;                                                                                                                                                            |
│ │ │ │ │ +|	m_socks5_sock.close(ignore);                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// if the call to second_tick caused the torrent                                                                                                                            |
│ │ │ │ │ -|			// to no longer want to be ticked (i.e. it was                                                                                                                              |
│ │ │ │ │ -|			// removed from the list) we need to back up the counter                                                                                                                    |
│ │ │ │ │ -|			// to not miss the torrent after it                                                                                                                                         |
│ │ │ │ │ -|			if (!t.want_tick()) --i;                                                                                                                                                    |
│ │ │ │ │ -|_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_3_6_2_3_ _ _|_t_h_i_s_ _s_h_o_u_l_d_ _a_p_p_l_y_ _t_o_ _a_l_l_ _b_a_n_d_w_i_d_t_h_ _c_h_a_n_n_e_l_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss sshhoouulldd aappppllyy ttoo aallll bbaannddwwiiddtthh cchhaannnneellss **********                                                                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::33662233 ******                                                                                                                                           |
│ │ │ │ │ -|#if TORRENT_DEBUG_STREAMING > 0                                                                                                                                                |
│ │ │ │ │ -|		std::printf("\033[2J\033[0;0H");                                                                                                                                             |
│ │ │ │ │ +|	++m_failures;                                                                                                                                                                 |
│ │ │ │ │ +|	retry_connection();                                                                                                                                                           |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|void socks5::on_connected(error_code const& e)                                                                                                                                 |
│ │ │ │ │ +|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_p_o_s_i_x___p_a_r_t___f_i_l_e_._c_p_p_:_3_3_7|what do we do if someone is currently reading from the disk from this piece? does it matter? Since we won't actively erase the data |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_f_r_o_m_ _d_i_s_k_,_ _b_u_t_ _i_t_ _m_a_y_ _b_e_ _o_v_e_r_w_r_i_t_t_e_n_ _s_o_o_n_,_ _i_t_'_s_ _p_r_o_b_a_b_l_y_ _n_o_t_ _t_h_a_t_ _b_i_g_ _o_f_ _a_ _d_e_a_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** wwhhaatt ddoo wwee ddoo iiff ssoommeeoonnee iiss ccuurrrreennttllyy rreeaaddiinngg ffrroomm tthhee ddiisskk ffrroomm tthhiiss ppiieeccee?? ddooeess iitt mmaatttteerr?? SSiinnccee wwee wwoonn''tt aaccttiivveellyy eerraassee tthhee ddaattaa ffrroomm ddiisskk,, bbuutt iitt mmaayy bbee oovveerrwwrriitttteenn |
│ │ │ │ │ +|ssoooonn,, iitt''ss pprroobbaabbllyy nnoott tthhaatt bbiigg ooff aa ddeeaall **********                                                                                                                               |
│ │ │ │ │ +|****** ....//ssrrcc//ppoossiixx__ppaarrtt__ffiillee..ccpppp::333377 ******                                                                                                                                         |
│ │ │ │ │ +|			if (ec) return {};                                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifdef TORRENT_WINDOWS                                                                                                                                                         |
│ │ │ │ │ +|			ret = file_pointer(::_wfopen(convert_to_native_path_string(fn).c_str(), L"wb+"));                                                                                           |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|			ret = file_pointer(::fopen(fn.c_str(), "wb+"));                                                                                                                             |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|			if (ret.file() == nullptr)                                                                                                                                                  |
│ │ │ │ │ +|				ec.assign(errno, generic_category());                                                                                                                                      |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		if (ec) return {};                                                                                                                                                           |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		aux::vector<torrent*>& want_tick = m_torrent_lists[torrent_want_tick];                                                                                                       |
│ │ │ │ │ -|		for (int i = 0; i < int(want_tick.size()); ++i)                                                                                                                              |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			torrent& t = *want_tick[i];                                                                                                                                                 |
│ │ │ │ │ -|			TORRENT_ASSERT(t.want_tick());                                                                                                                                              |
│ │ │ │ │ -|			TORRENT_ASSERT(!t.is_aborted());                                                                                                                                            |
│ │ │ │ │ +|	void posix_part_file::free_piece(piece_index_t const piece)                                                                                                                   |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		auto const i = m_piece_map.find(piece);                                                                                                                                      |
│ │ │ │ │ +|		if (i == m_piece_map.end()) return;                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			t.second_tick(tick_interval_ms);                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// if the call to second_tick caused the torrent                                                                                                                            |
│ │ │ │ │ -|			// to no longer want to be ticked (i.e. it was                                                                                                                              |
│ │ │ │ │ -|			// removed from the list) we need to back up the counter                                                                                                                    |
│ │ │ │ │ -|			// to not miss the torrent after it                                                                                                                                         |
│ │ │ │ │ -|			if (!t.want_tick()) --i;                                                                                                                                                    |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|m_free_slots.push_back(i->second);                                                                                                                                             |
│ │ │ │ │ +|		m_piece_map.erase(i);                                                                                                                                                        |
│ │ │ │ │ +|		m_dirty_metadata = true;                                                                                                                                                     |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|if (m_settings.get_bool(settings_pack::rate_limit_ip_overhead))                                                                                                                |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|			int const up_limit = upload_rate_limit(m_global_class);                                                                                                                     |
│ │ │ │ │ -|			int const down_limit = download_rate_limit(m_global_class);                                                                                                                 |
│ │ │ │ │ +|	void posix_part_file::move_partfile(std::string const& path, error_code& ec)                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		flush_metadata_impl(ec);                                                                                                                                                     |
│ │ │ │ │ +|		if (ec) return;                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (down_limit > 0                                                                                                                                                          |
│ │ │ │ │ -|				&& m_stat.download_ip_overhead() >= down_limit                                                                                                                             |
│ │ │ │ │ -|				&& m_alerts.should_post<performance_alert>())                                                                                                                              |
│ │ │ │ │ +|		if (!m_piece_map.empty())                                                                                                                                                    |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			std::string old_path = combine_path(m_path, m_name);                                                                                                                        |
│ │ │ │ │ +|			std::string new_path = combine_path(path, m_name);                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			rename(old_path, new_path, ec);                                                                                                                                             |
│ │ │ │ │ +|			if (ec == boost::system::errc::no_such_file_or_directory)                                                                                                                   |
│ │ │ │ │ +|				ec.clear();                                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (ec)                                                                                                                                                                     |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				m_alerts.emplace_alert<performance_alert>(torrent_handle()                                                                                                                 |
│ │ │ │ │ -|					, performance_alert::download_limit_too_low);                                                                                                                             |
│ │ │ │ │ +|				storage_error se;                                                                                                                                                          |
│ │ │ │ │ +|				aux::copy_file(old_path, new_path, se);                                                                                                                                    |
│ │ │ │ │ +|				ec = se.ec;                                                                                                                                                                |
│ │ │ │ │ +|				if (ec) return;                                                                                                                                                            |
│ │ │ │ │ +|				remove(old_path, ec);                                                                                                                                                      |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		m_path = path;                                                                                                                                                               |
│ │ │ │ │ +|_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_o_s_i_x___p_a_r_t___f_i_l_e_._c_p_p_:_4_2_4_|_i_n_s_t_e_a_d_ _o_f_ _r_e_b_u_i_l_d_i_n_g_ _t_h_e_ _w_h_o_l_e_ _f_i_l_e_ _h_e_a_d_e_r_ _a_n_d_ _f_l_u_s_h_i_n_g_ _i_t_,_ _u_p_d_a_t_e_ _t_h_e_ _s_l_o_t_ _e_n_t_r_i_e_s_ _a_s_ _w_e_ _g_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinnsstteeaadd ooff rreebbuuiillddiinngg tthhee wwhhoollee ffiillee hheeaaddeerr aanndd fflluusshhiinngg iitt,, uuppddaattee tthhee sslloott eennttrriieess aass wwee ggoo **********                                                                      |
│ │ │ │ │ +|****** ....//ssrrcc//ppoossiixx__ppaarrtt__ffiillee..ccpppp::442244 ******                                                                                                                                         |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|				auto bytes_read = std::fread(buf.get(), 1, std::size_t(block_to_copy), file.file());                                                                                       |
│ │ │ │ │ +|				if (int(bytes_read) != block_to_copy)                                                                                                                                      |
│ │ │ │ │ +|					ec.assign(errno, generic_category());                                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (up_limit > 0                                                                                                                                                            |
│ │ │ │ │ -|				&& m_stat.upload_ip_overhead() >= up_limit                                                                                                                                 |
│ │ │ │ │ -|				&& m_alerts.should_post<performance_alert>())                                                                                                                              |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				m_alerts.emplace_alert<performance_alert>(torrent_handle()                                                                                                                 |
│ │ │ │ │ -|					, performance_alert::upload_limit_too_low);                                                                                                                               |
│ │ │ │ │ +|				if (ec) return;                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|				f(file_offset, {buf.get(), block_to_copy});                                                                                                                                |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ +|			file_offset += block_to_copy;                                                                                                                                               |
│ │ │ │ │ +|			piece_offset = 0;                                                                                                                                                           |
│ │ │ │ │ +|			size -= block_to_copy;                                                                                                                                                      |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|		m_peak_up_rate = std::max(m_stat.upload_rate(), m_peak_up_rate);                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	void posix_part_file::flush_metadata(error_code& ec)                                                                                                                          |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		flush_metadata_impl(ec);                                                                                                                                                     |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		m_stat.second_tick(tick_interval_ms);                                                                                                                                        |
│ │ │ │ │ +|void posix_part_file::flush_metadata_impl(error_code& ec)                                                                                                                      |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		// do we need to flush the metadata?                                                                                                                                         |
│ │ │ │ │ +|		if (m_dirty_metadata == false) return;                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// --------------------------------------------------------------                                                                                                            |
│ │ │ │ │ -|		// scrape paused torrents that are auto managed                                                                                                                              |
│ │ │ │ │ -|_	_	_/_/_ _(_u_n_l_e_s_s_ _t_h_e_ _s_e_s_s_i_o_n_ _i_s_ _p_a_u_s_e_d_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_4_3_1_4  |use a lower limit than m_settings.connections_limit to allocate the to 10% or so of connection slots for incoming connections cap   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_h_i_s_ _a_t_ _m_a_x_ _-_ _1_,_ _s_i_n_c_e_ _w_e_ _m_a_y_ _a_d_d_ _o_n_e_ _b_e_l_o_w_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** uussee aa lloowweerr lliimmiitt tthhaann mm__sseettttiinnggss..ccoonnnneeccttiioonnss__lliimmiitt ttoo aallllooccaattee tthhee ttoo 1100%% oorr ssoo ooff ccoonnnneeccttiioonn sslloottss ffoorr iinnccoommiinngg ccoonnnneeccttiioonnss ccaapp tthhiiss aatt mmaaxx -- 11,, ssiinnccee wwee mmaayy aadddd oonnee  |
│ │ │ │ │ -|bbeellooww **********                                                                                                                                                                    |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::44331144 ******                                                                                                                                           |
│ │ │ │ │ -|// boost, which are done immediately on a tracker response. These                                                                                                              |
│ │ │ │ │ -|		// connections needs to be deducted from the regular connection attempt                                                                                                      |
│ │ │ │ │ -|		// quota for this tick                                                                                                                                                       |
│ │ │ │ │ -|		if (m_boost_connections > 0)                                                                                                                                                 |
│ │ │ │ │ +|		if (m_piece_map.empty())                                                                                                                                                     |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (m_boost_connections > max_connections)                                                                                                                                  |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				m_boost_connections -= max_connections;                                                                                                                                    |
│ │ │ │ │ -|				max_connections = 0;                                                                                                                                                       |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				max_connections -= m_boost_connections;                                                                                                                                    |
│ │ │ │ │ -|				m_boost_connections = 0;                                                                                                                                                   |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ +|			// if we don't have any pieces left in the                                                                                                                                  |
│ │ │ │ │ +|			// part file, remove it                                                                                                                                                     |
│ │ │ │ │ +|			std::string const p = combine_path(m_path, m_name);                                                                                                                         |
│ │ │ │ │ +|			remove(p, ec);                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (ec == boost::system::errc::no_such_file_or_directory)                                                                                                                   |
│ │ │ │ │ +|				ec.clear();                                                                                                                                                                |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// zero connections speeds are allowed, we just won't make any connections                                                                                                   |
│ │ │ │ │ -|		if (max_connections <= 0) return;                                                                                                                                            |
│ │ │ │ │ +|		auto f = open_file(open_mode::read_write, ec);                                                                                                                               |
│ │ │ │ │ +|		if (ec) return;                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|int const limit = std::min(m_settings.get_int(settings_pack::connections_limit)                                                                                                |
│ │ │ │ │ -|- num_connections(), std::numeric_limits<int>::max() - 1);                                                                                                                     |
│ │ │ │ │ +|		std::vector<char> header(static_cast<std::size_t>(m_header_size));                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// this logic is here to smooth out the number of new connection                                                                                                             |
│ │ │ │ │ -|		// attempts over time, to prevent connecting a large number of                                                                                                               |
│ │ │ │ │ -|		// sockets, wait 10 seconds, and then try again                                                                                                                              |
│ │ │ │ │ -|		if (m_settings.get_bool(settings_pack::smooth_connects) && max_connections > (limit+1) / 2)                                                                                  |
│ │ │ │ │ -|			max_connections = (limit + 1) / 2;                                                                                                                                          |
│ │ │ │ │ +|		using namespace libtorrent::aux;                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		aux::vector<torrent*>& want_peers_download = m_torrent_lists[torrent_want_peers_download];                                                                                   |
│ │ │ │ │ -|		aux::vector<torrent*>& want_peers_finished = m_torrent_lists[torrent_want_peers_finished];                                                                                   |
│ │ │ │ │ +|		char* ptr = header.data();                                                                                                                                                   |
│ │ │ │ │ +|		write_uint32(m_max_pieces, ptr);                                                                                                                                             |
│ │ │ │ │ +|		write_uint32(m_piece_size, ptr);                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// if no torrent want any peers, just return                                                                                                                                 |
│ │ │ │ │ -|		if (want_peers_download.empty() && want_peers_finished.empty()) return;                                                                                                      |
│ │ │ │ │ +|		for (piece_index_t piece(0); piece < piece_index_t(m_max_pieces); ++piece)                                                                                                   |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|_	_	_	_a_u_t_o_ _c_o_n_s_t_ _i_ _=_ _m___p_i_e_c_e___m_a_p_._f_i_n_d_(_p_i_e_c_e_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t___h_a_n_d_l_e_._c_p_p_:_5_8_9_ _|_s_u_p_p_o_r_t_ _m_o_v_i_n_g_ _f_i_l_e_s_ _i_n_t_o_ _t_h_i_s_ _c_a_l_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ssuuppppoorrtt mmoovviinngg ffiilleess iinnttoo tthhiiss ccaallll **********                                                                                                                                |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt__hhaannddllee..ccpppp::558899 ******                                                                                                                                          |
│ │ │ │ │ +|auto retp = &prio;                                                                                                                                                             |
│ │ │ │ │ +|		sync_call(&torrent::piece_priorities, retp);                                                                                                                                 |
│ │ │ │ │ +|		std::vector<int> ret;                                                                                                                                                        |
│ │ │ │ │ +|		ret.reserve(prio.size());                                                                                                                                                    |
│ │ │ │ │ +|		for (auto p : prio)                                                                                                                                                          |
│ │ │ │ │ +|			ret.push_back(int(static_cast<std::uint8_t>(p)));                                                                                                                           |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// if we don't have any connection attempt quota, return                                                                                                                     |
│ │ │ │ │ -|		if (max_connections <= 0) return;                                                                                                                                            |
│ │ │ │ │ +|	void torrent_handle::file_priority(file_index_t index, download_priority_t priority) const                                                                                    |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		async_call(&torrent::set_file_priority, index, priority);                                                                                                                    |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		int steps_since_last_connect = 0;                                                                                                                                            |
│ │ │ │ │ -|		int const num_torrents = int(want_peers_finished.size() + want_peers_download.size());                                                                                       |
│ │ │ │ │ -|		for (;;)                                                                                                                                                                     |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (m_next_downloading_connect_torrent >= int(want_peers_download.size()))                                                                                                  |
│ │ │ │ │ -|				m_next_downloading_connect_torrent = 0;                                                                                                                                    |
│ │ │ │ │ +|	download_priority_t torrent_handle::file_priority(file_index_t index) const                                                                                                   |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return sync_call_ret<download_priority_t>(dont_download, &torrent::file_priority, index);                                                                                    |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (m_next_finished_connect_torrent >= int(want_peers_finished.size()))                                                                                                     |
│ │ │ │ │ -|				m_next_finished_connect_torrent = 0;                                                                                                                                       |
│ │ │ │ │ +|void torrent_handle::prioritize_files(std::vector<download_priority_t> const& files) const                                                                                     |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		async_call(&torrent::prioritize_files                                                                                                                                        |
│ │ │ │ │ +|			, static_cast<aux::vector<download_priority_t, file_index_t> const&>(files));                                                                                               |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			torrent* t = nullptr;                                                                                                                                                       |
│ │ │ │ │ -|			// there are prioritized torrents. Pick one of those                                                                                                                        |
│ │ │ │ │ -|_	_	_	_w_h_i_l_e_ _(_!_m___p_r_i_o___t_o_r_r_e_n_t_s_._e_m_p_t_y_(_)_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_4_4_5_9_ _ _|_p_o_s_t_ _a_ _m_e_s_s_a_g_e_ _t_o_ _h_a_v_e_ _t_h_i_s_ _h_a_p_p_e_n_ _i_m_m_e_d_i_a_t_e_l_y_ _i_n_s_t_e_a_d_ _o_f_ _w_a_i_t_i_n_g_ _f_o_r_ _t_h_e_ _n_e_x_t_ _t_i_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ppoosstt aa mmeessssaaggee ttoo hhaavvee tthhiiss hhaappppeenn iimmmmeeddiiaatteellyy iinnsstteeaadd ooff wwaaiittiinngg ffoorr tthhee nneexxtt ttiicckk **********                                                                                |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::44445599 ******                                                                                                                                           |
│ │ │ │ │ -|continue;                                                                                                                                                                      |
│ │ │ │ │ +|	std::vector<download_priority_t> torrent_handle::get_file_priorities() const                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		aux::vector<download_priority_t, file_index_t> ret;                                                                                                                          |
│ │ │ │ │ +|		auto retp = &ret;                                                                                                                                                            |
│ │ │ │ │ +|		sync_call(&torrent::file_priorities, retp);                                                                                                                                  |
│ │ │ │ │ +|		return TORRENT_RVO(ret);                                                                                                                                                     |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|// ============ start deprecation ===============                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void torrent_handle::prioritize_files(std::vector<int> const& files) const                                                                                                    |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		aux::vector<download_priority_t, file_index_t> file_prio;                                                                                                                    |
│ │ │ │ │ +|		file_prio.reserve(files.size());                                                                                                                                             |
│ │ │ │ │ +|		for (auto const p : files) {                                                                                                                                                 |
│ │ │ │ │ +|			file_prio.push_back(download_priority_t(static_cast<std::uint8_t>(p)));                                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		async_call(&torrent::prioritize_files, file_prio);                                                                                                                           |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	std::vector<int> torrent_handle::file_priorities() const                                                                                                                      |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|_	_	_a_u_x_:_:_v_e_c_t_o_r_<_d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t_,_ _f_i_l_e___i_n_d_e_x___t_>_ _p_r_i_o_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/                       |technically, this isn't supposed to happen, but it seems to sometimes. Some of the accounting is probably wrong in certain cases    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_h_t_t_p___s_e_e_d___c_o_n_n_e_c_t_i_o_n_._c_p_p_:_4_4_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tteecchhnniiccaallllyy,, tthhiiss iissnn''tt ssuuppppoosseedd ttoo hhaappppeenn,, bbuutt iitt sseeeemmss ttoo ssoommeettiimmeess.. SSoommee ooff tthhee aaccccoouunnttiinngg iiss pprroobbaabbllyy wwrroonngg iinn cceerrttaaiinn ccaasseess **********                                   |
│ │ │ │ │ +|****** ....//ssrrcc//hhttttpp__sseeeedd__ccoonnnneeccttiioonn..ccpppp::444411 ******                                                                                                                                    |
│ │ │ │ │ +|// cut out the chunk header from the receive buffer                                                                                                                            |
│ │ │ │ │ +|					TORRENT_ASSERT(m_chunk_pos + m_body_start < INT_MAX);                                                                                                                     |
│ │ │ │ │ +|					m_recv_buffer.cut(header_size, t->block_size() + 1024, aux::numeric_cast<int>(m_chunk_pos + m_body_start));                                                               |
│ │ │ │ │ +|					recv_buffer = m_recv_buffer.get();                                                                                                                                        |
│ │ │ │ │ +|					recv_buffer = recv_buffer.subspan(m_body_start);                                                                                                                          |
│ │ │ │ │ +|					m_chunk_pos += chunk_size;                                                                                                                                                |
│ │ │ │ │ +|					if (chunk_size == 0)                                                                                                                                                      |
│ │ │ │ │ +|					{                                                                                                                                                                         |
│ │ │ │ │ +|						TORRENT_ASSERT(m_recv_buffer.get().size() < m_chunk_pos + m_body_start + 1                                                                                               |
│ │ │ │ │ +|							|| m_recv_buffer.get()[static_cast<std::ptrdiff_t>(m_chunk_pos + m_body_start)] == 'H'                                                                                  |
│ │ │ │ │ +|							|| (m_parser.chunked_encoding()                                                                                                                                         |
│ │ │ │ │ +|								&& m_recv_buffer.get()[static_cast<std::ptrdiff_t>(m_chunk_pos + m_body_start)] == '\r'));                                                                             |
│ │ │ │ │ +|						m_chunk_pos = -1;                                                                                                                                                        |
│ │ │ │ │ +|					}                                                                                                                                                                         |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (!p->is_peer_interested()                                                                                                                                                |
│ │ │ │ │ -|				|| p->is_disconnecting()                                                                                                                                                   |
│ │ │ │ │ -|				|| p->is_connecting())                                                                                                                                                     |
│ │ │ │ │ +|			int payload = int(bytes_transferred);                                                                                                                                       |
│ │ │ │ │ +|			if (payload > m_response_left) payload = int(m_response_left);                                                                                                              |
│ │ │ │ │ +|			if (payload > front_request.length) payload = front_request.length;                                                                                                         |
│ │ │ │ │ +|if (payload > outstanding_bytes()) payload = outstanding_bytes();                                                                                                              |
│ │ │ │ │ +|received_bytes(payload, 0);                                                                                                                                                    |
│ │ │ │ │ +|			incoming_piece_fragment(payload);                                                                                                                                           |
│ │ │ │ │ +|			m_response_left -= payload;                                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (m_parser.status_code() == 503)                                                                                                                                          |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				// this peer is not unchokable. So, if it's unchoked                                                                                                                       |
│ │ │ │ │ -|				// already, make sure to choke it.                                                                                                                                         |
│ │ │ │ │ -|				if (p->is_choked())                                                                                                                                                        |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					p->reset_choke_counters();                                                                                                                                                |
│ │ │ │ │ -|					continue;                                                                                                                                                                 |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|				if (pi && pi->optimistically_unchoked)                                                                                                                                     |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					m_stats_counters.inc_stats_counter(counters::num_peers_up_unchoked_optimistic, -1);                                                                                       |
│ │ │ │ │ -|					pi->optimistically_unchoked = false;                                                                                                                                      |
│ │ │ │ │ -|					// force a new optimistic unchoke                                                                                                                                         |
│ │ │ │ │ -|					m_optimistic_unchoke_time_scaler = 0;                                                                                                                                     |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|t->choke_peer(*p);                                                                                                                                                             |
│ │ │ │ │ -|				p->reset_choke_counters();                                                                                                                                                 |
│ │ │ │ │ -|				continue;                                                                                                                                                                  |
│ │ │ │ │ +|				if (!m_parser.finished()) return;                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|				int retry_time = std::atoi(std::string(recv_buffer.begin(), recv_buffer.end()).c_str());                                                                                   |
│ │ │ │ │ +|				if (retry_time <= 0) retry_time = 60;                                                                                                                                      |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|				peer_log(peer_log_alert::info, "CONNECT", "retrying in %d seconds", retry_time);                                                                                           |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|				received_bytes(0, int(bytes_transferred));                                                                                                                                 |
│ │ │ │ │ +|				// temporarily unavailable, retry later                                                                                                                                    |
│ │ │ │ │ +|				t->retry_web_seed(this, seconds32(retry_time));                                                                                                                            |
│ │ │ │ │ +|				disconnect(error_code(m_parser.status_code(), http_category()), operation_t::bittorrent, failure);                                                                         |
│ │ │ │ │ +|				return;                                                                                                                                                                    |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			peers.push_back(p.get());                                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// we only received the header, no data                                                                                                                                     |
│ │ │ │ │ +|			if (recv_buffer.empty()) break;                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			if (recv_buffer.size() < front_request.length) break;                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// if the response is chunked, we need to receive the last                                                                                                                  |
│ │ │ │ │ +|			// terminating chunk and the tail headers before we can proceed                                                                                                             |
│ │ │ │ │ +|_	_	_	_i_f_ _(_m___p_a_r_s_e_r_._c_h_u_n_k_e_d___e_n_c_o_d_i_n_g_(_)_ _&_&_ _m___c_h_u_n_k___p_o_s_ _>_=_ _0_)_ _b_r_e_a_k_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_m_a_p___d_i_s_k___i_o_._c_p_p_:_5_7_8_ _ _ _|_i_n_ _t_h_e_ _f_u_t_u_r_e_,_ _p_r_o_p_a_g_a_t_e_ _e_x_c_e_p_t_i_o_n_s_ _b_a_c_k_ _t_o_ _t_h_e_ _h_a_n_d_l_e_r_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinn tthhee ffuuttuurree,, pprrooppaaggaattee eexxcceeppttiioonnss bbaacckk ttoo tthhee hhaannddlleerrss **********                                                                                                           |
│ │ │ │ │ +|****** ....//ssrrcc//mmmmaapp__ddiisskk__iioo..ccpppp::557788 ******                                                                                                                                            |
│ │ │ │ │ +|#if DEBUG_DISK_THREAD                                                                                                                                                          |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			std::unique_lock<std::mutex> l(m_job_mutex);                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			DLOG("perform_job job: %s ( %s%s) piece: %d offset: %d outstanding: %d\n"                                                                                                   |
│ │ │ │ │ +|				, job_action_name[j->action]                                                                                                                                               |
│ │ │ │ │ +|				, (j->flags & mmap_disk_job::fence) ? "fence ": ""                                                                                                                         |
│ │ │ │ │ +|				, (j->flags & mmap_disk_job::force_copy) ? "force_copy ": ""                                                                                                               |
│ │ │ │ │ +|				, static_cast<int>(j->piece), j->d.io.offset                                                                                                                               |
│ │ │ │ │ +|				, j->storage ? j->storage->num_outstanding_jobs() : -1);                                                                                                                   |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		int const allowed_upload_slots = unchoke_sort(peers                                                                                                                          |
│ │ │ │ │ -|			, unchoke_interval, m_settings);                                                                                                                                            |
│ │ │ │ │ +|		std::shared_ptr<mmap_storage> storage = j->storage;                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_settings.get_int(settings_pack::choking_algorithm) == settings_pack::fixed_slots_choker)                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(static_cast<int>(j->action) < int(job_functions.size()));                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		m_stats_counters.inc_stats_counter(counters::num_running_disk_jobs, 1);                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// call disk function                                                                                                                                                        |
│ │ │ │ │ +|status_t ret = status_t::no_error;                                                                                                                                             |
│ │ │ │ │ +|try                                                                                                                                                                            |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			int const upload_slots = get_int_setting(settings_pack::unchoke_slots_limit);                                                                                               |
│ │ │ │ │ -|			m_stats_counters.set_value(counters::num_unchoke_slots, upload_slots);                                                                                                      |
│ │ │ │ │ +|			int const idx = static_cast<int>(j->action);                                                                                                                                |
│ │ │ │ │ +|			ret = (this->*(job_functions[static_cast<std::size_t>(idx)]))(j);                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ +|		catch (boost::system::system_error const& err)                                                                                                                               |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_stats_counters.set_value(counters::num_unchoke_slots                                                                                                                      |
│ │ │ │ │ -|				, allowed_upload_slots);                                                                                                                                                   |
│ │ │ │ │ +|			ret = status_t::fatal_disk_error;                                                                                                                                           |
│ │ │ │ │ +|			j->error.ec = err.code();                                                                                                                                                   |
│ │ │ │ │ +|			j->error.operation = operation_t::exception;                                                                                                                                |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (should_log())                                                                                                                                                            |
│ │ │ │ │ +|		catch (std::bad_alloc const&)                                                                                                                                                |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			session_log("RECALCULATE UNCHOKE SLOTS: [ peers: %d "                                                                                                                       |
│ │ │ │ │ -|				"eligible-peers: %d"                                                                                                                                                       |
│ │ │ │ │ -|				" allowed-slots: %d ]"                                                                                                                                                     |
│ │ │ │ │ -|				, int(m_connections.size())                                                                                                                                                |
│ │ │ │ │ -|_	_	_	_	_,_ _i_n_t_(_p_e_e_r_s_._s_i_z_e_(_)_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|           |                              |it might be a nice feature here to limit the number of torrents to send in a single update. By just posting the first n torrents,   |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_4_7_8_6  |they would nicely be round-robined because the torrent lists are always pushed back. Perhaps the status_update_alert could even have|
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_a_ _f_i_x_e_d_ _a_r_r_a_y_ _o_f_ _n_ _e_n_t_r_i_e_s_ _r_a_t_h_e_r_ _t_h_a_n_ _a_ _v_e_c_t_o_r_,_ _t_o_ _f_u_r_t_h_e_r_ _i_m_p_r_o_v_e_ _m_e_m_o_r_y_ _l_o_c_a_l_i_t_y_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt mmiigghhtt bbee aa nniiccee ffeeaattuurree hheerree ttoo lliimmiitt tthhee nnuummbbeerr ooff ttoorrrreennttss ttoo sseenndd iinn aa ssiinnggllee uuppddaattee.. BByy jjuusstt ppoossttiinngg tthhee ffiirrsstt nn ttoorrrreennttss,, tthheeyy wwoouulldd nniicceellyy bbee rroouunndd--rroobbiinneedd     |
│ │ │ │ │ -|bbeeccaauussee tthhee ttoorrrreenntt lliissttss aarree aallwwaayyss ppuusshheedd bbaacckk.. PPeerrhhaappss tthhee ssttaattuuss__uuppddaattee__aalleerrtt ccoouulldd eevveenn hhaavvee aa ffiixxeedd aarrrraayy ooff nn eennttrriieess rraatthheerr tthhaann aa vveeccttoorr,, ttoo ffuurrtthheerr iimmpprroovvee mmeemmoorryy   |
│ │ │ │ │ -|llooccaalliittyy.. **********                                                                                                                                                                |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::44778866 ******                                                                                                                                           |
│ │ │ │ │ -|t->status(&st, flags);                                                                                                                                                         |
│ │ │ │ │ +|			ret = status_t::fatal_disk_error;                                                                                                                                           |
│ │ │ │ │ +|			j->error.ec = errors::no_memory;                                                                                                                                            |
│ │ │ │ │ +|			j->error.operation = operation_t::exception;                                                                                                                                |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		catch (std::exception const&)                                                                                                                                                |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			ret = status_t::fatal_disk_error;                                                                                                                                           |
│ │ │ │ │ +|			j->error.ec = boost::asio::error::fault;                                                                                                                                    |
│ │ │ │ │ +|			j->error.operation = operation_t::exception;                                                                                                                                |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// note that -2 errors are OK                                                                                                                                                |
│ │ │ │ │ +|		TORRENT_ASSERT(ret != status_t::fatal_disk_error                                                                                                                             |
│ │ │ │ │ +|			|| (j->error.ec && j->error.operation != operation_t::unknown));                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_	_	_m___s_t_a_t_s___c_o_u_n_t_e_r_s_._i_n_c___s_t_a_t_s___c_o_u_n_t_e_r_(_c_o_u_n_t_e_r_s_:_:_n_u_m___r_u_n_n_i_n_g___d_i_s_k___j_o_b_s_,_ _-_1_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_m_m_a_p___d_i_s_k___i_o_._c_p_p_:_1_0_1_7  |this is potentially very expensive. One way to solve it would be to have a fence for just this one piece. but it hardly seems worth |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_h_e_ _c_o_m_p_l_e_x_i_t_y_ _a_n_d_ _c_o_s_t_ _j_u_s_t_ _f_o_r_ _t_h_e_ _e_d_g_e_ _c_a_s_e_ _o_f_ _r_e_c_e_i_v_i_n_g_ _a_ _c_o_r_r_u_p_t_ _p_i_e_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss iiss ppootteennttiiaallllyy vveerryy eexxppeennssiivvee.. OOnnee wwaayy ttoo ssoollvvee iitt wwoouulldd bbee ttoo hhaavvee aa ffeennccee ffoorr jjuusstt tthhiiss oonnee ppiieeccee.. bbuutt iitt hhaarrddllyy sseeeemmss wwoorrtthh tthhee ccoommpplleexxiittyy aanndd ccoosstt jjuusstt ffoorr tthhee |
│ │ │ │ │ +|eeddggee ccaassee ooff rreecceeiivviinngg aa ccoorrrruupptt ppiieeccee **********                                                                                                                                   |
│ │ │ │ │ +|****** ....//ssrrcc//mmmmaapp__ddiisskk__iioo..ccpppp::11001177 ******                                                                                                                                           |
│ │ │ │ │ +|aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::file_priority);                                                                                             |
│ │ │ │ │ +|		j->storage = m_torrents[storage]->shared_from_this();                                                                                                                        |
│ │ │ │ │ +|		j->argument = std::move(prios);                                                                                                                                              |
│ │ │ │ │ +|		j->callback = std::move(handler);                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		add_fence_job(j);                                                                                                                                                            |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_impl::post_torrent_updates(status_flags_t const flags)                                                                                                           |
│ │ │ │ │ +|	void mmap_disk_io::async_clear_piece(storage_index_t const storage                                                                                                            |
│ │ │ │ │ +|		, piece_index_t const index, std::function<void(piece_index_t)> handler)                                                                                                     |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|		aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::clear_piece);                                                                                             |
│ │ │ │ │ +|		j->storage = m_torrents[storage]->shared_from_this();                                                                                                                        |
│ │ │ │ │ +|		j->piece = index;                                                                                                                                                            |
│ │ │ │ │ +|		j->callback = std::move(handler);                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		// regular jobs are not guaranteed to be executed in-order                                                                                                                   |
│ │ │ │ │ +|		// since clear piece must guarantee that all write jobs that                                                                                                                 |
│ │ │ │ │ +|		// have been issued finish before the clear piece job completes                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		std::vector<torrent*>& state_updates                                                                                                                                         |
│ │ │ │ │ -|			= m_torrent_lists[aux::session_impl::torrent_state_updates];                                                                                                                |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_m_m_a_p___d_i_s_k___i_o_._c_p_p_:_1_0_2_2  |Perhaps the job queue could be traversed and all jobs for this piece could be cancelled. If there are no threads currently writing  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_o_ _t_h_i_s_ _p_i_e_c_e_,_ _w_e_ _c_o_u_l_d_ _s_k_i_p_ _t_h_e_ _f_e_n_c_e_ _a_l_t_o_g_e_t_h_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** PPeerrhhaappss tthhee jjoobb qquueeuuee ccoouulldd bbee ttrraavveerrsseedd aanndd aallll jjoobbss ffoorr tthhiiss ppiieeccee ccoouulldd bbee ccaanncceelllleedd.. IIff tthheerree aarree nnoo tthhrreeaaddss ccuurrrreennttllyy wwrriittiinngg ttoo tthhiiss ppiieeccee,, wwee ccoouulldd sskkiipp tthhee ffeennccee|
│ │ │ │ │ +|aallttooggeetthheerr **********                                                                                                                                                               |
│ │ │ │ │ +|****** ....//ssrrcc//mmmmaapp__ddiisskk__iioo..ccpppp::11002222 ******                                                                                                                                           |
│ │ │ │ │ +|j->storage = m_torrents[storage]->shared_from_this();                                                                                                                          |
│ │ │ │ │ +|		j->argument = std::move(prios);                                                                                                                                              |
│ │ │ │ │ +|		j->callback = std::move(handler);                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ -|		m_posting_torrent_updates = true;                                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		add_fence_job(j);                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		std::vector<torrent_status> status;                                                                                                                                          |
│ │ │ │ │ -|		status.reserve(state_updates.size());                                                                                                                                        |
│ │ │ │ │ +|	void mmap_disk_io::async_clear_piece(storage_index_t const storage                                                                                                            |
│ │ │ │ │ +|		, piece_index_t const index, std::function<void(piece_index_t)> handler)                                                                                                     |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::clear_piece);                                                                                             |
│ │ │ │ │ +|		j->storage = m_torrents[storage]->shared_from_this();                                                                                                                        |
│ │ │ │ │ +|		j->piece = index;                                                                                                                                                            |
│ │ │ │ │ +|		j->callback = std::move(handler);                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|for (auto& t : state_updates)                                                                                                                                                  |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|			TORRENT_ASSERT(t->m_links[aux::session_impl::torrent_state_updates].in_list());                                                                                             |
│ │ │ │ │ -|			status.emplace_back();                                                                                                                                                      |
│ │ │ │ │ -|			// querying accurate download counters may require                                                                                                                          |
│ │ │ │ │ -|			// the torrent to be loaded. Loading a torrent, and evicting another                                                                                                        |
│ │ │ │ │ -|			// one will lead to calling state_updated(), which screws with                                                                                                              |
│ │ │ │ │ -|			// this list while we're working on it, and break things                                                                                                                    |
│ │ │ │ │ -|			t->status(&status.back(), flags);                                                                                                                                           |
│ │ │ │ │ -|			t->clear_in_state_update();                                                                                                                                                 |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		state_updates.clear();                                                                                                                                                       |
│ │ │ │ │ +|		// regular jobs are not guaranteed to be executed in-order                                                                                                                   |
│ │ │ │ │ +|		// since clear piece must guarantee that all write jobs that                                                                                                                 |
│ │ │ │ │ +|		// have been issued finish before the clear piece job completes                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ -|		m_posting_torrent_updates = false;                                                                                                                                           |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		m_alerts.emplace_alert<state_update_alert>(std::move(status));                                                                                                               |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|add_fence_job(j);                                                                                                                                                              |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void session_impl::post_session_stats()                                                                                                                                       |
│ │ │ │ │ +|	status_t mmap_disk_io::do_hash(aux::mmap_disk_job* j)                                                                                                                         |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (!m_posted_stats_header)                                                                                                                                                  |
│ │ │ │ │ +|		// we're not using a cache. This is the simple path                                                                                                                          |
│ │ │ │ │ +|		// just read straight from the file                                                                                                                                          |
│ │ │ │ │ +|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		bool const v1 = bool(j->flags & disk_interface::v1_hash);                                                                                                                    |
│ │ │ │ │ +|		bool const v2 = !j->d.h.block_hashes.empty();                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		int const piece_size = v1 ? j->storage->files().piece_size(j->piece) : 0;                                                                                                    |
│ │ │ │ │ +|		int const piece_size2 = v2 ? j->storage->files().piece_size2(j->piece) : 0;                                                                                                  |
│ │ │ │ │ +|		int const blocks_in_piece = v1 ? (piece_size + default_block_size - 1) / default_block_size : 0;                                                                             |
│ │ │ │ │ +|		int const blocks_in_piece2 = v2 ? j->storage->files().blocks_in_piece2(j->piece) : 0;                                                                                        |
│ │ │ │ │ +|		aux::open_mode_t const file_mode = file_mode_for_job(j);                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(!v2 || int(j->d.h.block_hashes.size()) >= blocks_in_piece2);                                                                                                  |
│ │ │ │ │ +|		TORRENT_ASSERT(v1 || v2);                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		hasher h;                                                                                                                                                                    |
│ │ │ │ │ +|		int ret = 0;                                                                                                                                                                 |
│ │ │ │ │ +|		int offset = 0;                                                                                                                                                              |
│ │ │ │ │ +|		int const blocks_to_read = std::max(blocks_in_piece, blocks_in_piece2);                                                                                                      |
│ │ │ │ │ +|		time_point const start_time = clock_type::now();                                                                                                                             |
│ │ │ │ │ +|		for (int i = 0; i < blocks_to_read; ++i)                                                                                                                                     |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_posted_stats_header = true;                                                                                                                                               |
│ │ │ │ │ -|			m_alerts.emplace_alert<session_stats_header_alert>();                                                                                                                       |
│ │ │ │ │ +|			bool const v2_block = i < blocks_in_piece2;                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_	_	_	_D_L_O_G_(_"_d_o___h_a_s_h_:_ _r_e_a_d_i_n_g_ _(_p_i_e_c_e_:_ _%_d_ _b_l_o_c_k_:_ _%_d_)_\_n_"_,_ _i_n_t_(_j_-_>_p_i_e_c_e_)_,_ _i_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_c_h_o_k_e_r_._c_p_p_:_2_5_8_ _ _ _ _ _ _ _ _ _|_m_a_k_e_ _c_o_n_f_i_g_u_r_a_b_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmaakkee ccoonnffiigguurraabbllee **********                                                                                                                                                  |
│ │ │ │ │ +|****** ....//ssrrcc//cchhookkeerr..ccpppp::225588 ******                                                                                                                                                  |
│ │ │ │ │ +|// first reset the number of unchoke slots, because we'll calculate                                                                                                            |
│ │ │ │ │ +|			// it purely based on the current state of our peers.                                                                                                                       |
│ │ │ │ │ +|			upload_slots = 0;                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			int rate_threshold = sett.get_int(settings_pack::rate_choker_initial_threshold);                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			std::sort(peers.begin(), peers.end()                                                                                                                                        |
│ │ │ │ │ +|				, [](peer_connection const* lhs, peer_connection const* rhs)                                                                                                               |
│ │ │ │ │ +|				{ return upload_rate_compare(lhs, rhs); });                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			for (auto const* p : peers)                                                                                                                                                 |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				int const rate = int(p->uploaded_in_last_round()                                                                                                                           |
│ │ │ │ │ +|					* 1000 / total_milliseconds(unchoke_interval));                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|				// always have at least 1 unchoke slot                                                                                                                                     |
│ │ │ │ │ +|				if (rate < rate_threshold) break;                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|				++upload_slots;                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|rate_threshold += 2048;                                                                                                                                                        |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|			++upload_slots;                                                                                                                                                             |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		m_disk_thread->update_stats_counters(m_stats_counters);                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|_	_	_i_f_ _(_m___d_h_t_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_1_6_1_ _ _|_f_a_c_t_o_r_ _o_u_t_ _t_h_i_s_ _l_o_g_i_c_ _i_n_t_o_ _a_ _s_e_p_a_r_a_t_e_ _f_u_n_c_t_i_o_n_ _f_o_r_ _u_n_i_t_ _t_e_s_t_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ffaaccttoorr oouutt tthhiiss llooggiicc iinnttoo aa sseeppaarraattee ffuunnccttiioonn ffoorr uunniitt tteessttiinngg **********                                                                                                    |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::55116611 ******                                                                                                                                           |
│ │ │ │ │ -|if (m_settings.get_int(settings_pack::outgoing_port) > 0)                                                                                                                      |
│ │ │ │ │ +|		// sorts the peers that are eligible for unchoke by download rate and                                                                                                        |
│ │ │ │ │ +|		// secondary by total upload. The reason for this is, if all torrents are                                                                                                    |
│ │ │ │ │ +|		// being seeded, the download rate will be 0, and the peers we have sent                                                                                                     |
│ │ │ │ │ +|		// the least to should be unchoked                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// we use partial sort here, because we only care about the top                                                                                                              |
│ │ │ │ │ +|		// upload_slots peers.                                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		int const slots = std::min(upload_slots, int(peers.size()));                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (sett.get_int(settings_pack::seed_choking_algorithm)                                                                                                                      |
│ │ │ │ │ +|			== settings_pack::round_robin)                                                                                                                                              |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|#ifdef TORRENT_WINDOWS                                                                                                                                                         |
│ │ │ │ │ -|			s.set_option(exclusive_address_use(true), ec);                                                                                                                              |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|			s.set_option(tcp::acceptor::reuse_address(true), ec);                                                                                                                       |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			// ignore errors because the underlying socket may not                                                                                                                      |
│ │ │ │ │ -|			// be opened yet. This happens when we're routing through                                                                                                                   |
│ │ │ │ │ -|			// a proxy. In that case, we don't yet know the address of                                                                                                                  |
│ │ │ │ │ -|			// the proxy server, and more importantly, we don't know                                                                                                                    |
│ │ │ │ │ -|			// the address family of its address. This means we can't                                                                                                                   |
│ │ │ │ │ -|			// open the socket yet. The socks abstraction layer defers                                                                                                                  |
│ │ │ │ │ -|			// opening it.                                                                                                                                                              |
│ │ │ │ │ -|			ec.clear();                                                                                                                                                                 |
│ │ │ │ │ -|			bind_ep.port(std::uint16_t(next_port()));                                                                                                                                   |
│ │ │ │ │ +|			int const pieces = sett.get_int(settings_pack::seeding_piece_quota);                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			std::nth_element(peers.begin(), peers.begin()                                                                                                                               |
│ │ │ │ │ +|				+ slots, peers.end()                                                                                                                                                       |
│ │ │ │ │ +|				, [pieces](peer_connection const* lhs, peer_connection const* rhs)                                                                                                         |
│ │ │ │ │ +|				{ return unchoke_compare_rr(lhs, rhs, pieces); });                                                                                                                         |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ +|		else if (sett.get_int(settings_pack::seed_choking_algorithm)                                                                                                                 |
│ │ │ │ │ +|			== settings_pack::fastest_upload)                                                                                                                                           |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			std::nth_element(peers.begin(), peers.begin()                                                                                                                               |
│ │ │ │ │ +|				+ slots, peers.end()                                                                                                                                                       |
│ │ │ │ │ +|_	_	_	_	_,_ _[_]_(_p_e_e_r___c_o_n_n_e_c_t_i_o_n_ _c_o_n_s_t_*_ _l_h_s_,_ _p_e_e_r___c_o_n_n_e_c_t_i_o_n_ _c_o_n_s_t_*_ _r_h_s_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_1_1_0_ _ _ _ _|_i_n_ _C_+_+_2_0_,_ _u_s_e_ _s_t_d_:_:_i_d_e_n_t_i_t_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinn CC++++2200,, uussee ssttdd::::iiddeennttiittyy **********                                                                                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::111100 ******                                                                                                                                             |
│ │ │ │ │ +|allocate_full();                                                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (is_utp(s))                                                                                                                                                               |
│ │ │ │ │ +|		merkle_validate_copy(t, m_tree, root(), m_block_verified);                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		load_verified_bits(verified);                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		optimize_storage();                                                                                                                                                          |
│ │ │ │ │ +|		optimize_storage_piece_layer();                                                                                                                                              |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void merkle_tree::clear()                                                                                                                                                     |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		m_tree.clear();                                                                                                                                                              |
│ │ │ │ │ +|		m_tree.shrink_to_fit();                                                                                                                                                      |
│ │ │ │ │ +|		m_block_verified.clear();                                                                                                                                                    |
│ │ │ │ │ +|		m_mode = mode_t::empty_tree;                                                                                                                                                 |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|namespace {                                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|struct identity                                                                                                                                                                |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		bool operator()(bool b) const { return b; }                                                                                                                                  |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void merkle_tree::load_sparse_tree(span<sha256_hash const> t                                                                                                                  |
│ │ │ │ │ +|		, std::vector<bool> const& mask                                                                                                                                              |
│ │ │ │ │ +|		, std::vector<bool> const& verified)                                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(mask.size() == size());                                                                                                                                       |
│ │ │ │ │ +|		if (size() != mask.size()) return;                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		int const first_block = block_layer_start();                                                                                                                                 |
│ │ │ │ │ +|		int const end_block = first_block + m_num_blocks;                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(first_block < int(mask.size()));                                                                                                                              |
│ │ │ │ │ +|		TORRENT_ASSERT(end_block <= int(mask.size()));                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// if the mask covers all blocks, go straight to block_layer                                                                                                                 |
│ │ │ │ │ +|		// mode, and validate                                                                                                                                                        |
│ │ │ │ │ +|		if (std::all_of(mask.begin() + first_block, mask.begin() + end_block, identity()))                                                                                           |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ +|			// the index in t that points to first_block                                                                                                                                |
│ │ │ │ │ +|			auto const block_index = std::count_if(mask.begin(), mask.begin() + first_block, identity());                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|utp_socket_impl* impl = nullptr;                                                                                                                                               |
│ │ │ │ │ -|			transport ssl = transport::plaintext;                                                                                                                                       |
│ │ │ │ │ -|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ -|			if (boost::get<ssl_stream<utp_stream>>(&s) != nullptr)                                                                                                                      |
│ │ │ │ │ +|			// discrepancy                                                                                                                                                              |
│ │ │ │ │ +|			if (t.size() < block_index + m_num_blocks)                                                                                                                                  |
│ │ │ │ │ +|_	_	_	_	_r_e_t_u_r_n_ _c_l_e_a_r_(_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_3_1_9_ _ _ _ _|_t_h_i_s_ _c_a_n_ _b_e_ _o_p_t_i_m_i_z_e_d_ _b_y_ _u_s_i_n_g_ _m___t_r_e_e_ _a_s_ _s_t_o_r_a_g_e_ _t_o_ _f_i_l_l_ _t_h_i_s_ _t_r_e_e_ _i_n_t_o_,_ _a_n_d_ _t_h_e_n_ _c_l_e_a_r_ _i_t_ _i_f_ _t_h_e_ _h_a_s_h_e_s_ _f_a_i_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ccaann bbee ooppttiimmiizzeedd bbyy uussiinngg mm__ttrreeee aass ssttoorraaggee ttoo ffiillll tthhiiss ttrreeee iinnttoo,, aanndd tthheenn cclleeaarr iitt iiff tthhee hhaasshheess ffaaiill **********                                                      |
│ │ │ │ │ +|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::331199 ******                                                                                                                                             |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// as we set the hashes of interior nodes, we may be able to validate                                                                                                        |
│ │ │ │ │ +|		// block hashes that we had since earlier. Any blocks that can be                                                                                                            |
│ │ │ │ │ +|		// validated, and failed, are added to this list                                                                                                                             |
│ │ │ │ │ +|		add_hashes_result_t ret;                                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// we already have all hashes                                                                                                                                                |
│ │ │ │ │ +|		if (m_mode == mode_t::block_layer)                                                                                                                                           |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// since we're already on the block layer mode, we have the whole                                                                                                           |
│ │ │ │ │ +|			// tree, and we've already reported any pieces as passing that may                                                                                                          |
│ │ │ │ │ +|			// have existed in the tree when we completed it. At this point no                                                                                                          |
│ │ │ │ │ +|			// more pieces should be reported as passed                                                                                                                                 |
│ │ │ │ │ +|			return ret;                                                                                                                                                                 |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		allocate_full();                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|int const leaf_count = merkle_num_leafs(int(hashes.size()));                                                                                                                   |
│ │ │ │ │ +|aux::vector<sha256_hash> tree(merkle_num_nodes(leaf_count));                                                                                                                   |
│ │ │ │ │ +|		std::copy(hashes.begin(), hashes.end(), tree.end() - leaf_count);                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// the end of a file is a special case, we may need to pad the leaf layer                                                                                                    |
│ │ │ │ │ +|		if (leaf_count > hashes.size())                                                                                                                                              |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			int const leaf_layer_size = num_leafs();                                                                                                                                    |
│ │ │ │ │ +|			// assuming uncle_hashes lead all the way to the root, they tell us                                                                                                         |
│ │ │ │ │ +|			// how many layers down we are                                                                                                                                              |
│ │ │ │ │ +|			int const insert_layer_size = leaf_count << uncle_hashes.size();                                                                                                            |
│ │ │ │ │ +|			if (leaf_layer_size != insert_layer_size)                                                                                                                                   |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				impl = boost::get<ssl_stream<utp_stream>>(s).next_layer().get_impl();                                                                                                      |
│ │ │ │ │ -|				ssl = transport::ssl;                                                                                                                                                      |
│ │ │ │ │ +|				sha256_hash const pad_hash = merkle_pad(leaf_layer_size, insert_layer_size);                                                                                               |
│ │ │ │ │ +|				for (int i = int(hashes.size()); i < leaf_count; ++i)                                                                                                                      |
│ │ │ │ │ +|					tree[tree.end_index() - leaf_count + i] = pad_hash;                                                                                                                       |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|				impl = boost::get<utp_stream>(s).get_impl();                                                                                                                               |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			std::vector<std::shared_ptr<listen_socket_t>> with_gateways;                                                                                                                |
│ │ │ │ │ -|			std::shared_ptr<listen_socket_t> match;                                                                                                                                     |
│ │ │ │ │ -|			for (auto& ls : m_listen_sockets)                                                                                                                                           |
│ │ │ │ │ +|		merkle_fill_tree(tree, leaf_count);                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		int const base_num_layers = merkle_num_layers(leaf_count);                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// this is the index of the node where we'll insert the root of the                                                                                                          |
│ │ │ │ │ +|		// subtree (tree). It's also the hash the uncle_hashes are here to prove                                                                                                     |
│ │ │ │ │ +|		// is valid.                                                                                                                                                                 |
│ │ │ │ │ +|		int const insert_root_idx = dest_start_idx >> base_num_layers;                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// start with validating the proofs, and inserting them as we go.                                                                                                            |
│ │ │ │ │ +|		if (!merkle_validate_and_insert_proofs(m_tree, insert_root_idx, tree[0], uncle_hashes))                                                                                      |
│ │ │ │ │ +|_	_	_	_r_e_t_u_r_n_ _{_}_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_3_6_7_ _ _ _ _|_a_ _p_i_e_c_e_ _o_u_t_s_i_d_e_ _o_f_ _t_h_i_s_ _r_a_n_g_e_ _m_a_y_ _a_l_s_o_ _f_a_i_l_,_ _i_f_ _o_n_e_ _o_f_ _t_h_e_ _u_n_c_l_e_ _h_a_s_h_e_s_ _i_s_ _a_t_ _t_h_e_ _l_a_y_e_r_ _r_i_g_h_t_ _a_b_o_v_e_ _t_h_e_ _b_l_o_c_k_ _h_a_s_h_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** aa ppiieeccee oouuttssiiddee ooff tthhiiss rraannggee mmaayy aallssoo ffaaiill,, iiff oonnee ooff tthhee uunnccllee hhaasshheess iiss aatt tthhee llaayyeerr rriigghhtt aabboovvee tthhee bblloocckk hhaasshheess **********                                               |
│ │ │ │ │ +|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::336677 ******                                                                                                                                             |
│ │ │ │ │ +|int const insert_root_idx = dest_start_idx >> base_num_layers;                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// start with validating the proofs, and inserting them as we go.                                                                                                            |
│ │ │ │ │ +|		if (!merkle_validate_and_insert_proofs(m_tree, insert_root_idx, tree[0], uncle_hashes))                                                                                      |
│ │ │ │ │ +|			return {};                                                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// first fill in the subtree of known hashes from the base layer                                                                                                             |
│ │ │ │ │ +|		auto const num_leafs = merkle_num_leafs(m_num_blocks);                                                                                                                       |
│ │ │ │ │ +|		auto const first_leaf = merkle_first_leaf(num_leafs);                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// this is the start of the leaf layer of "tree". We'll use this                                                                                                             |
│ │ │ │ │ +|		// variable to step upwards towards the root                                                                                                                                 |
│ │ │ │ │ +|		int source_cursor = int(tree.size()) - leaf_count;                                                                                                                           |
│ │ │ │ │ +|		// the running index in the loop                                                                                                                                             |
│ │ │ │ │ +|		int dest_cursor = dest_start_idx;                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// the number of tree levels in a piece hash. 0 means the block layer is                                                                                                     |
│ │ │ │ │ +|		// the same as the piece layer                                                                                                                                               |
│ │ │ │ │ +|		int const base = piece_levels();                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|for (int layer_size = leaf_count; layer_size != 0; layer_size /= 2)                                                                                                            |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|			for (int i = 0; i < layer_size; ++i)                                                                                                                                        |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				// this is almost, but not quite, like can_route()                                                                                                                         |
│ │ │ │ │ -|				if (!(ls->flags & listen_socket_t::proxy)                                                                                                                                  |
│ │ │ │ │ -|					&& is_v4(ls->local_endpoint) != remote_address.is_v4())                                                                                                                   |
│ │ │ │ │ +|				int const dst_idx = dest_cursor + i;                                                                                                                                       |
│ │ │ │ │ +|				int const src_idx = source_cursor + i;                                                                                                                                     |
│ │ │ │ │ +|				if (has_node(dst_idx))                                                                                                                                                     |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					if (m_tree[dst_idx] != tree[src_idx])                                                                                                                                     |
│ │ │ │ │ +|					{                                                                                                                                                                         |
│ │ │ │ │ +|						// this must be a block hash because inner nodes are not filled in until                                                                                                 |
│ │ │ │ │ +|						// they can be verified. This assert ensures we're at the                                                                                                                |
│ │ │ │ │ +|						// leaf layer of the file tree                                                                                                                                           |
│ │ │ │ │ +|						TORRENT_ASSERT(dst_idx >= first_leaf);                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|						int const pos = dst_idx - first_leaf;                                                                                                                                    |
│ │ │ │ │ +|						auto const piece = piece_index_t{pos >> m_blocks_per_piece_log} + file_piece_offset;                                                                                     |
│ │ │ │ │ +|						int const block = pos & ((1 << m_blocks_per_piece_log) - 1);                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|						TORRENT_ASSERT(pos < m_num_blocks);                                                                                                                                      |
│ │ │ │ │ +|						if (!ret.failed.empty() && ret.failed.back().first == piece)                                                                                                             |
│ │ │ │ │ +|							ret.failed.back().second.push_back(block);                                                                                                                              |
│ │ │ │ │ +|						else                                                                                                                                                                     |
│ │ │ │ │ +|							ret.failed.emplace_back(piece, std::vector<int>{block});                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|						// now that this hash has been reported as failing, we                                                                                                                   |
│ │ │ │ │ +|						// can clear it. This will prevent it from being                                                                                                                         |
│ │ │ │ │ +|						// reported as failing again.                                                                                                                                            |
│ │ │ │ │ +|						m_tree[dst_idx].clear();                                                                                                                                                 |
│ │ │ │ │ +|					}                                                                                                                                                                         |
│ │ │ │ │ +|_	_	_	_	_	_e_l_s_e_ _i_f_ _(_d_s_t___i_d_x_ _>_=_ _f_i_r_s_t___l_e_a_f_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_4_4_7    |instead of overwriting the root and comparing it against hashes[], write a functions that *validates* a tree by just filling it up  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_o_ _t_h_e_ _l_e_v_e_l_ _b_e_l_o_w_ _t_h_e_ _r_o_o_t_ _a_n_d_ _t_h_e_n_ _v_a_l_i_d_a_t_e_s_ _i_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinnsstteeaadd ooff oovveerrwwrriittiinngg tthhee rroooott aanndd ccoommppaarriinngg iitt aaggaaiinnsstt hhaasshheess[[]],, wwrriittee aa ffuunnccttiioonnss tthhaatt **vvaalliiddaatteess** aa ttrreeee bbyy jjuusstt ffiilllliinngg iitt uupp ttoo tthhee lleevveell bbeellooww tthhee rroooott aanndd tthheenn  |
│ │ │ │ │ +|vvaalliiddaatteess iitt.. **********                                                                                                                                                            |
│ │ │ │ │ +|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::444477 ******                                                                                                                                             |
│ │ │ │ │ +|&& dest_start_idx < first_piece_idx + num_pieces())                                                                                                                            |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			int const blocks_in_piece = 1 << base;                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// it may now be possible to verify the hashes of previously received blocks                                                                                                |
│ │ │ │ │ +|			// try to verify as many child nodes of the received hashes as possible                                                                                                     |
│ │ │ │ │ +|			for (int i = 0; i < int(hashes.size()); ++i)                                                                                                                                |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				int const piece = dest_start_idx + i;                                                                                                                                      |
│ │ │ │ │ +|				if (piece - first_piece_idx >= num_pieces())                                                                                                                               |
│ │ │ │ │ +|					break;                                                                                                                                                                    |
│ │ │ │ │ +|				// the first block in this piece                                                                                                                                           |
│ │ │ │ │ +|				int const block_idx = merkle_get_first_child(piece, base);                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|				int const block_end_idx = std::min(block_idx + blocks_in_piece, first_leaf + m_num_blocks);                                                                                |
│ │ │ │ │ +|				if (std::any_of(m_tree.begin() + block_idx                                                                                                                                 |
│ │ │ │ │ +|					, m_tree.begin() + block_end_idx                                                                                                                                          |
│ │ │ │ │ +|					, [](sha256_hash const& h) { return h.is_all_zeros(); }))                                                                                                                 |
│ │ │ │ │  |					continue;                                                                                                                                                                 |
│ │ │ │ │ -|				if (ls->ssl != ssl) continue;                                                                                                                                              |
│ │ │ │ │ -|				if (!(ls->flags & listen_socket_t::local_network))                                                                                                                         |
│ │ │ │ │ -|					with_gateways.push_back(ls);                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				if (ls->flags & listen_socket_t::proxy                                                                                                                                     |
│ │ │ │ │ -|					|| match_addr_mask(ls->local_endpoint.address(), remote_address, ls->netmask))                                                                                            |
│ │ │ │ │ +|merkle_fill_tree(m_tree, blocks_in_piece, block_idx);                                                                                                                          |
│ │ │ │ │ +|if (m_tree[piece] != hashes[i])                                                                                                                                                |
│ │ │ │ │  |				{                                                                                                                                                                          |
│ │ │ │ │ -|					// is this better than the previous match?                                                                                                                                |
│ │ │ │ │ -|					match = ls;                                                                                                                                                               |
│ │ │ │ │ -|_	_	_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_8_8_0_ _ _|_r_e_f_a_c_t_o_r_,_ _m_o_v_e_ _t_h_e_ _s_t_o_r_a_g_e_ _t_o_ _d_h_t___t_r_a_c_k_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** rreeffaaccttoorr,, mmoovvee tthhee ssttoorraaggee ttoo ddhhtt__ttrraacckkeerr **********                                                                                                                          |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::55888800 ******                                                                                                                                           |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|			session_log("not starting DHT, outstanding router lookups: %d"                                                                                                              |
│ │ │ │ │ -|				, m_outstanding_router_lookups);                                                                                                                                           |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|					merkle_clear_tree(m_tree, blocks_in_piece, block_idx);                                                                                                                    |
│ │ │ │ │ +|					// write back the correct hash                                                                                                                                            |
│ │ │ │ │ +|					m_tree[piece] = hashes[i];                                                                                                                                                |
│ │ │ │ │ +|					TORRENT_ASSERT(blocks_in_piece == blocks_per_piece());                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_abort)                                                                                                                                                                 |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|			session_log("not starting DHT, aborting");                                                                                                                                  |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ +|					// an empty blocks vector indicates that we don't have the                                                                                                                |
│ │ │ │ │ +|					// block hashes, and we can't know which block failed                                                                                                                     |
│ │ │ │ │ +|					// this will cause the block hashes to be requested                                                                                                                       |
│ │ │ │ │ +|					ret.failed.emplace_back(piece_index_t{piece - first_piece_idx} + file_piece_offset                                                                                        |
│ │ │ │ │ +|						, std::vector<int>());                                                                                                                                                   |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|				else                                                                                                                                                                       |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					ret.passed.push_back(piece_index_t{piece - first_piece_idx} + file_piece_offset);                                                                                         |
│ │ │ │ │ +|					// record that these block hashes are correct!                                                                                                                            |
│ │ │ │ │ +|					int const leafs_start = block_idx - block_layer_start();                                                                                                                  |
│ │ │ │ │ +|_	_	_	_	_	_i_n_t_ _c_o_n_s_t_ _l_e_a_f_s___e_n_d_ _=_ _s_t_d_:_:_m_i_n_(_m___n_u_m___b_l_o_c_k_s_,_ _l_e_a_f_s___s_t_a_r_t_ _+_ _b_l_o_c_k_s___i_n___p_i_e_c_e_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_4_7_1_ _ _ _ _|_t_h_i_s_ _c_o_u_l_d_ _b_e_ _d_o_n_e_ _m_o_r_e_ _e_f_f_i_c_i_e_n_t_l_y_ _i_f_ _b_i_t_f_i_e_l_d_ _h_a_d_ _a_ _f_u_n_c_t_i_o_n_ _t_o_ _s_e_t_ _a_ _r_a_n_g_e_ _o_f_ _b_i_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ccoouulldd bbee ddoonnee mmoorree eeffffiicciieennttllyy iiff bbiittffiieelldd hhaadd aa ffuunnccttiioonn ttoo sseett aa rraannggee ooff bbiittss **********                                                                              |
│ │ │ │ │ +|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::447711 ******                                                                                                                                             |
│ │ │ │ │ +|merkle_fill_tree(m_tree, blocks_in_piece, block_idx);                                                                                                                          |
│ │ │ │ │ +|				if (m_tree[piece] != hashes[i])                                                                                                                                            |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					merkle_clear_tree(m_tree, blocks_in_piece, block_idx);                                                                                                                    |
│ │ │ │ │ +|					// write back the correct hash                                                                                                                                            |
│ │ │ │ │ +|					m_tree[piece] = hashes[i];                                                                                                                                                |
│ │ │ │ │ +|					TORRENT_ASSERT(blocks_in_piece == blocks_per_piece());                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|					// an empty blocks vector indicates that we don't have the                                                                                                                |
│ │ │ │ │ +|					// block hashes, and we can't know which block failed                                                                                                                     |
│ │ │ │ │ +|					// this will cause the block hashes to be requested                                                                                                                       |
│ │ │ │ │ +|					ret.failed.emplace_back(piece_index_t{piece - first_piece_idx} + file_piece_offset                                                                                        |
│ │ │ │ │ +|						, std::vector<int>());                                                                                                                                                   |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|				else                                                                                                                                                                       |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					ret.passed.push_back(piece_index_t{piece - first_piece_idx} + file_piece_offset);                                                                                         |
│ │ │ │ │ +|					// record that these block hashes are correct!                                                                                                                            |
│ │ │ │ │ +|					int const leafs_start = block_idx - block_layer_start();                                                                                                                  |
│ │ │ │ │ +|					int const leafs_end = std::min(m_num_blocks, leafs_start + blocks_in_piece);                                                                                              |
│ │ │ │ │ +|for (int k = leafs_start; k < leafs_end; ++k)                                                                                                                                  |
│ │ │ │ │ +|m_block_verified.set_bit(k);                                                                                                                                                   |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|				TORRENT_ASSERT((piece - first_piece_idx) >= 0);                                                                                                                            |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		session_log("starting DHT, running: %s, router lookups: %d"                                                                                                                  |
│ │ │ │ │ -|			, m_dht ? "true" : "false", m_outstanding_router_lookups);                                                                                                                  |
│ │ │ │ │ +|		optimize_storage();                                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	std::tuple<merkle_tree::set_block_result, int, int> merkle_tree::set_block(int const block_index                                                                              |
│ │ │ │ │ +|		, sha256_hash const& h)                                                                                                                                                      |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS                                                                                                                                      |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|		TORRENT_ASSERT(block_index < m_num_blocks);                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|m_dht_storage = m_dht_storage_constructor(m_settings);                                                                                                                         |
│ │ │ │ │ -|m_dht = std::make_shared<dht::dht_tracker>(                                                                                                                                    |
│ │ │ │ │ -|			static_cast<dht::dht_observer*>(this)                                                                                                                                       |
│ │ │ │ │ -|			, m_io_context                                                                                                                                                              |
│ │ │ │ │ -|			, [this](aux::listen_socket_handle const& sock                                                                                                                              |
│ │ │ │ │ -|				, udp::endpoint const& ep                                                                                                                                                  |
│ │ │ │ │ -|				, span<char const> p                                                                                                                                                       |
│ │ │ │ │ -|				, error_code& ec                                                                                                                                                           |
│ │ │ │ │ -|				, udp_send_flags_t const flags)                                                                                                                                            |
│ │ │ │ │ -|				{ send_udp_packet_listen(sock, ep, p, ec, flags); }                                                                                                                        |
│ │ │ │ │ -|			, m_settings                                                                                                                                                                |
│ │ │ │ │ -|			, m_stats_counters                                                                                                                                                          |
│ │ │ │ │ -|			, *m_dht_storage                                                                                                                                                            |
│ │ │ │ │ -|			, std::move(m_dht_state));                                                                                                                                                  |
│ │ │ │ │ +|		auto const num_leafs = merkle_num_leafs(m_num_blocks);                                                                                                                       |
│ │ │ │ │ +|		auto const first_leaf = merkle_first_leaf(num_leafs);                                                                                                                        |
│ │ │ │ │ +|		auto const block_tree_index = first_leaf + block_index;                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		for (auto& s : m_listen_sockets)                                                                                                                                             |
│ │ │ │ │ +|		if (blocks_verified(block_index, 1))                                                                                                                                         |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (s->ssl != transport::ssl                                                                                                                                                |
│ │ │ │ │ -|				&& !(s->flags & listen_socket_t::local_network))                                                                                                                           |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				m_dht->new_socket(s);                                                                                                                                                      |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ +|			// if this blocks's hash is already known, check the passed-in hash against it                                                                                              |
│ │ │ │ │ +|			if (compare_node(block_tree_index, h))                                                                                                                                      |
│ │ │ │ │ +|				return std::make_tuple(set_block_result::ok, block_index, 1);                                                                                                              |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|_	_	_	_	_r_e_t_u_r_n_ _s_t_d_:_:_m_a_k_e___t_u_p_l_e_(_s_e_t___b_l_o_c_k___r_e_s_u_l_t_:_:_b_l_o_c_k___h_a_s_h___f_a_i_l_e_d_,_ _b_l_o_c_k___i_n_d_e_x_,_ _1_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_5_1_4_ _ _ _ _|_u_s_e_ _s_t_r_u_c_t_u_r_e_d_ _b_i_n_d_i_n_g_ _i_n_ _C_+_+_1_7_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** uussee ssttrruuccttuurreedd bbiinnddiinngg iinn CC++++1177 **********                                                                                                                                    |
│ │ │ │ │ +|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::551144 ******                                                                                                                                             |
│ │ │ │ │ +|auto const first_leaf = merkle_first_leaf(num_leafs);                                                                                                                          |
│ │ │ │ │ +|		auto const block_tree_index = first_leaf + block_index;                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (blocks_verified(block_index, 1))                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// if this blocks's hash is already known, check the passed-in hash against it                                                                                              |
│ │ │ │ │ +|			if (compare_node(block_tree_index, h))                                                                                                                                      |
│ │ │ │ │ +|				return std::make_tuple(set_block_result::ok, block_index, 1);                                                                                                              |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|				return std::make_tuple(set_block_result::block_hash_failed, block_index, 1);                                                                                               |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		for (auto const& n : m_dht_router_nodes)                                                                                                                                     |
│ │ │ │ │ +|		allocate_full();                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		m_tree[block_tree_index] = h;                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// to avoid wasting a lot of time hashing nodes only to discover they                                                                                                        |
│ │ │ │ │ +|		// cannot be verified, check first to see if the root of the largest                                                                                                         |
│ │ │ │ │ +|		// computable subtree is known                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|int leafs_start;                                                                                                                                                               |
│ │ │ │ │ +|int leafs_size;                                                                                                                                                                |
│ │ │ │ │ +|		int root_index;                                                                                                                                                              |
│ │ │ │ │ +|		std::tie(leafs_start, leafs_size, root_index) =                                                                                                                              |
│ │ │ │ │ +|			merkle_find_known_subtree(m_tree, block_index, m_num_blocks);                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// if the root node is unknown the hashes cannot be verified yet                                                                                                             |
│ │ │ │ │ +|		if (m_tree[root_index].is_all_zeros())                                                                                                                                       |
│ │ │ │ │ +|			return std::make_tuple(set_block_result::unknown, leafs_start, leafs_size);                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// save the root hash because merkle_fill_tree will overwrite it                                                                                                             |
│ │ │ │ │ +|		sha256_hash const root = m_tree[root_index];                                                                                                                                 |
│ │ │ │ │ +|		merkle_fill_tree(m_tree, leafs_size, first_leaf + leafs_start);                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (root != m_tree[root_index])                                                                                                                                              |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_dht->add_router_node(n);                                                                                                                                                  |
│ │ │ │ │ +|			// hash failure, clear all the internal nodes                                                                                                                               |
│ │ │ │ │ +|			// the whole piece failed the hash check. Clear all block hashes                                                                                                            |
│ │ │ │ │ +|			// in this piece and report a hash failure                                                                                                                                  |
│ │ │ │ │ +|			merkle_clear_tree(m_tree, leafs_size, first_leaf + leafs_start);                                                                                                            |
│ │ │ │ │ +|			m_tree[root_index] = root;                                                                                                                                                  |
│ │ │ │ │ +|			return std::make_tuple(set_block_result::hash_failed, leafs_start, leafs_size);                                                                                             |
│ │ │ │ │ +|_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_5_3_9_ _ _ _ _|_t_h_i_s_ _c_o_u_l_d_ _b_e_ _d_o_n_e_ _m_o_r_e_ _e_f_f_i_c_i_e_n_t_l_y_ _i_f_ _b_i_t_f_i_e_l_d_ _h_a_d_ _a_ _f_u_n_c_t_i_o_n_ _t_o_ _s_e_t_ _a_ _r_a_n_g_e_ _o_f_ _b_i_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ccoouulldd bbee ddoonnee mmoorree eeffffiicciieennttllyy iiff bbiittffiieelldd hhaadd aa ffuunnccttiioonn ttoo sseett aa rraannggee ooff bbiittss **********                                                                              |
│ │ │ │ │ +|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::553399 ******                                                                                                                                             |
│ │ │ │ │ +|merkle_find_known_subtree(m_tree, block_index, m_num_blocks);                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// if the root node is unknown the hashes cannot be verified yet                                                                                                             |
│ │ │ │ │ +|		if (m_tree[root_index].is_all_zeros())                                                                                                                                       |
│ │ │ │ │ +|			return std::make_tuple(set_block_result::unknown, leafs_start, leafs_size);                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// save the root hash because merkle_fill_tree will overwrite it                                                                                                             |
│ │ │ │ │ +|		sha256_hash const root = m_tree[root_index];                                                                                                                                 |
│ │ │ │ │ +|		merkle_fill_tree(m_tree, leafs_size, first_leaf + leafs_start);                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (root != m_tree[root_index])                                                                                                                                              |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// hash failure, clear all the internal nodes                                                                                                                               |
│ │ │ │ │ +|			// the whole piece failed the hash check. Clear all block hashes                                                                                                            |
│ │ │ │ │ +|			// in this piece and report a hash failure                                                                                                                                  |
│ │ │ │ │ +|			merkle_clear_tree(m_tree, leafs_size, first_leaf + leafs_start);                                                                                                            |
│ │ │ │ │ +|			m_tree[root_index] = root;                                                                                                                                                  |
│ │ │ │ │ +|			return std::make_tuple(set_block_result::hash_failed, leafs_start, leafs_size);                                                                                             |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		for (auto const& n : m_dht_nodes)                                                                                                                                            |
│ │ │ │ │ -|_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_6_2_6_7_ _ _|_a_s_s_e_r_t_s_ _t_h_a_t_ _n_o_ _o_u_t_s_t_a_n_d_i_n_g_ _a_s_y_n_c_ _o_p_e_r_a_t_i_o_n_s_ _a_r_e_ _s_t_i_l_l_ _i_n_ _f_l_i_g_h_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** aasssseerrttss tthhaatt nnoo oouuttssttaannddiinngg aassyynncc ooppeerraattiioonnss aarree ssttiillll iinn fflliigghhtt **********                                                                                                   |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::66226677 ******                                                                                                                                           |
│ │ │ │ │ -|if (!m_dht) return;                                                                                                                                                            |
│ │ │ │ │ -|		m_dht->direct_request(ep, e, std::bind(&on_direct_response, std::ref(m_alerts), userdata, _1));                                                                              |
│ │ │ │ │ +|int const leafs_end = std::min(m_num_blocks, leafs_start + leafs_size);                                                                                                        |
│ │ │ │ │ +|for (int i = leafs_start; i < leafs_end; ++i)                                                                                                                                  |
│ │ │ │ │ +|			m_block_verified.set_bit(i);                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// attempting to optimize storage is quite costly, only do it if we have                                                                                                     |
│ │ │ │ │ +|		// a reason to believe it might have an effect                                                                                                                               |
│ │ │ │ │ +|		if (block_index == m_num_blocks - 1 || !m_tree[block_tree_index + 1].is_all_zeros())                                                                                         |
│ │ │ │ │ +|			optimize_storage();                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		return std::make_tuple(set_block_result::ok, leafs_start, leafs_size);                                                                                                       |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	std::size_t merkle_tree::size() const                                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return static_cast<std::size_t>(merkle_num_nodes(merkle_num_leafs(m_num_blocks)));                                                                                           |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	bool session_impl::is_listening() const                                                                                                                                       |
│ │ │ │ │ +|	int merkle_tree::num_pieces() const                                                                                                                                           |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		return !m_listen_sockets.empty();                                                                                                                                            |
│ │ │ │ │ +|		int const ps = blocks_per_piece();                                                                                                                                           |
│ │ │ │ │ +|		TORRENT_ASSERT(ps > 0);                                                                                                                                                      |
│ │ │ │ │ +|		return (m_num_blocks + ps - 1) >> m_blocks_per_piece_log;                                                                                                                    |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	session_impl::~session_impl()                                                                                                                                                 |
│ │ │ │ │ +|	int merkle_tree::block_layer_start() const                                                                                                                                    |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		// since we're destructing the session, no more alerts will make it out to                                                                                                   |
│ │ │ │ │ -|		// the user. So stop posting them now                                                                                                                                        |
│ │ │ │ │ -|		m_alerts.set_alert_mask({});                                                                                                                                                 |
│ │ │ │ │ -|		m_alerts.set_notify_function({});                                                                                                                                            |
│ │ │ │ │ +|		int const num_leafs = merkle_num_leafs(m_num_blocks);                                                                                                                        |
│ │ │ │ │ +|		TORRENT_ASSERT(num_leafs > 0);                                                                                                                                               |
│ │ │ │ │ +|		return merkle_first_leaf(num_leafs);                                                                                                                                         |
│ │ │ │ │ +|_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_._c_p_p_:|pre C++17, GCC and msvc does not make std::string nothrow move assignable, which means no type containing a string will be nothrow  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_7_8_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _a_s_s_i_g_n_a_b_l_e_ _b_y_ _d_e_f_a_u_l_t_ _e_i_t_h_e_r_ _s_t_a_t_i_c___a_s_s_e_r_t_(_s_t_d_:_:_i_s___n_o_t_h_r_o_w___m_o_v_e___a_s_s_i_g_n_a_b_l_e_:_:_v_a_l_u_e_ _,_ _"_s_h_o_u_l_d_ _b_e_ _n_o_t_h_r_o_w_ _m_o_v_e_ _a_s_s_i_g_n_a_b_l_e_"_)_;_ _ _ _ _ _ |
│ │ │ │ │ +|********** pprree CC++++1177,, GGCCCC aanndd mmssvvcc ddooeess nnoott mmaakkee ssttdd::::ssttrriinngg nnootthhrrooww mmoovvee aassssiiggnnaabbllee,, wwhhiicchh mmeeaannss nnoo ttyyppee ccoonnttaaiinniinngg aa ssttrriinngg wwiillll bbee nnootthhrrooww mmoovvee aassssiiggnnaabbllee bbyy ddeeffaauulltt eeiitthheerr     |
│ │ │ │ │ +|ssttaattiicc__aasssseerrtt((ssttdd::::iiss__nnootthhrrooww__mmoovvee__aassssiiggnnaabbllee::::vvaalluuee ,, ""sshhoouulldd bbee nnootthhrrooww mmoovvee aassssiiggnnaabbllee""));; **********                                                                             |
│ │ │ │ │ +|****** ....//ssrrcc//aadddd__ttoorrrreenntt__ppaarraammss..ccpppp::7788 ******                                                                                                                                       |
│ │ │ │ │ +|DECL_FLAG(sequential_download);                                                                                                                                                |
│ │ │ │ │ +|			DECL_FLAG(pinned);                                                                                                                                                          |
│ │ │ │ │ +|			DECL_FLAG(stop_when_ready);                                                                                                                                                 |
│ │ │ │ │ +|			DECL_FLAG(override_trackers);                                                                                                                                               |
│ │ │ │ │ +|			DECL_FLAG(override_web_seeds);                                                                                                                                              |
│ │ │ │ │ +|			DECL_FLAG(need_save_resume);                                                                                                                                                |
│ │ │ │ │ +|			DECL_FLAG(override_resume_data);                                                                                                                                            |
│ │ │ │ │ +|			DECL_FLAG(merge_resume_trackers);                                                                                                                                           |
│ │ │ │ │ +|			DECL_FLAG(use_resume_save_path);                                                                                                                                            |
│ │ │ │ │ +|			DECL_FLAG(merge_resume_http_seeds);                                                                                                                                         |
│ │ │ │ │ +|			DECL_FLAG(default_flags);                                                                                                                                                   |
│ │ │ │ │ +|#undef DECL_FLAG                                                                                                                                                               |
│ │ │ │ │ +|#endif // TORRENT_ABI_VERSION                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// this is not allowed to be the network thread!                                                                                                                             |
│ │ │ │ │ -|//		TORRENT_ASSERT(is_not_thread());                                                                                                                                           |
│ │ │ │ │ +|	static_assert(std::is_nothrow_move_constructible<add_torrent_params>::value                                                                                                   |
│ │ │ │ │ +|		, "should be nothrow move constructible");                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// this can happen if we end the io_context run loop with an exception                                                                                                         |
│ │ │ │ │ -|		m_connections.clear();                                                                                                                                                       |
│ │ │ │ │ -|		for (auto& t : m_torrents)                                                                                                                                                   |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			t->panic();                                                                                                                                                                 |
│ │ │ │ │ -|			t->abort();                                                                                                                                                                 |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		m_torrents.clear();                                                                                                                                                          |
│ │ │ │ │ +|	static_assert(std::is_nothrow_move_constructible<std::string>::value                                                                                                          |
│ │ │ │ │ +|		, "should be nothrow move constructible");                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// this has probably been called already, but in case of sudden                                                                                                              |
│ │ │ │ │ -|		// termination through an exception, it may not have been done                                                                                                               |
│ │ │ │ │ -|		abort_stage2();                                                                                                                                                              |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_._c_p_p_:|it would be nice if this was nothrow default constructible static_assert(std::is_nothrow_default_constructible::value , "should be  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_8_4_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_n_o_t_h_r_o_w_ _d_e_f_a_u_l_t_ _c_o_n_s_t_r_u_c_t_i_b_l_e_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd bbee nniiccee iiff tthhiiss wwaass nnootthhrrooww ddeeffaauulltt ccoonnssttrruuccttiibbllee ssttaattiicc__aasssseerrtt((ssttdd::::iiss__nnootthhrrooww__ddeeffaauulltt__ccoonnssttrruuccttiibbllee::::vvaalluuee ,, ""sshhoouulldd bbee nnootthhrrooww ddeeffaauulltt ccoonnssttrruuccttiibbllee""));; **********|
│ │ │ │ │ +|****** ....//ssrrcc//aadddd__ttoorrrreenntt__ppaarraammss..ccpppp::8844 ******                                                                                                                                       |
│ │ │ │ │ +|DECL_FLAG(pinned);                                                                                                                                                             |
│ │ │ │ │ +|			DECL_FLAG(stop_when_ready);                                                                                                                                                 |
│ │ │ │ │ +|			DECL_FLAG(override_trackers);                                                                                                                                               |
│ │ │ │ │ +|			DECL_FLAG(override_web_seeds);                                                                                                                                              |
│ │ │ │ │ +|			DECL_FLAG(need_save_resume);                                                                                                                                                |
│ │ │ │ │ +|			DECL_FLAG(override_resume_data);                                                                                                                                            |
│ │ │ │ │ +|			DECL_FLAG(merge_resume_trackers);                                                                                                                                           |
│ │ │ │ │ +|			DECL_FLAG(use_resume_save_path);                                                                                                                                            |
│ │ │ │ │ +|			DECL_FLAG(merge_resume_http_seeds);                                                                                                                                         |
│ │ │ │ │ +|			DECL_FLAG(default_flags);                                                                                                                                                   |
│ │ │ │ │ +|#undef DECL_FLAG                                                                                                                                                               |
│ │ │ │ │ +|#endif // TORRENT_ABI_VERSION                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if defined TORRENT_ASIO_DEBUGGING                                                                                                                                             |
│ │ │ │ │ -|		FILE* f = fopen("wakeups.log", "w+");                                                                                                                                        |
│ │ │ │ │ -|		if (f != nullptr)                                                                                                                                                            |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			time_point m = min_time();                                                                                                                                                  |
│ │ │ │ │ -|			if (!_wakeups.empty()) m = _wakeups[0].timestamp;                                                                                                                           |
│ │ │ │ │ -|			time_point prev = m;                                                                                                                                                        |
│ │ │ │ │ -|			std::uint64_t prev_csw = 0;                                                                                                                                                 |
│ │ │ │ │ -|			if (!_wakeups.empty()) prev_csw = _wakeups[0].context_switches;                                                                                                             |
│ │ │ │ │ -|			std::fprintf(f, "abs. time\trel. time\tctx switch\tidle-wakeup\toperation\n");                                                                                              |
│ │ │ │ │ -|			for (wakeup_t const& w : _wakeups)                                                                                                                                          |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				bool const idle_wakeup = w.context_switches > prev_csw;                                                                                                                    |
│ │ │ │ │ -|				std::fprintf(f, "%" PRId64 "\t%" PRId64 "\t%" PRId64 "\t%c\t%s\n"                                                                                                          |
│ │ │ │ │ -|					, total_microseconds(w.timestamp - m)                                                                                                                                     |
│ │ │ │ │ -|					, total_microseconds(w.timestamp - prev)                                                                                                                                  |
│ │ │ │ │ -|_	_	_	_	_	_,_ _w_._c_o_n_t_e_x_t___s_w_i_t_c_h_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|	static_assert(std::is_nothrow_move_constructible<add_torrent_params>::value                                                                                                   |
│ │ │ │ │ +|		, "should be nothrow move constructible");                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	static_assert(std::is_nothrow_move_constructible<std::string>::value                                                                                                          |
│ │ │ │ │ +|		, "should be nothrow move constructible");                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|namespace aux {                                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// returns whether this add_torrent_params object has "resume-data", i.e.                                                                                                     |
│ │ │ │ │ +|	// information about which pieces we have.                                                                                                                                    |
│ │ │ │ │ +|	bool contains_resume_data(add_torrent_params const& atp)                                                                                                                      |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		return !atp.have_pieces.empty()                                                                                                                                              |
│ │ │ │ │ +|			|| (atp.flags & torrent_flags::seed_mode);                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_s_r_c_/_p_a_r_t___f_i_l_e_._c_p_p_:_3_0_0      |what do we do if someone is currently reading from the disk from this piece? does it matter? Since we won't actively erase the data |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_f_r_o_m_ _d_i_s_k_,_ _b_u_t_ _i_t_ _m_a_y_ _b_e_ _o_v_e_r_w_r_i_t_t_e_n_ _s_o_o_n_,_ _i_t_'_s_ _p_r_o_b_a_b_l_y_ _n_o_t_ _t_h_a_t_ _b_i_g_ _o_f_ _a_ _d_e_a_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** wwhhaatt ddoo wwee ddoo iiff ssoommeeoonnee iiss ccuurrrreennttllyy rreeaaddiinngg ffrroomm tthhee ddiisskk ffrroomm tthhiiss ppiieeccee?? ddooeess iitt mmaatttteerr?? SSiinnccee wwee wwoonn''tt aaccttiivveellyy eerraassee tthhee ddaattaa ffrroomm ddiisskk,, bbuutt iitt mmaayy bbee oovveerrwwrriitttteenn |
│ │ │ │ │  |ssoooonn,, iitt''ss pprroobbaabbllyy nnoott tthhaatt bbiigg ooff aa ddeeaall **********                                                                                                                               |
│ │ │ │ │  |****** ....//ssrrcc//ppaarrtt__ffiillee..ccpppp::330000 ******                                                                                                                                               |
│ │ │ │ │  |create_directories(m_path, ec);                                                                                                                                                |
│ │ │ │ │  |				if (ec) return {};                                                                                                                                                         |
│ │ │ │ │ @@ -7448,122 +8484,175 @@
│ │ │ │ │  |		char* ptr = header.data();                                                                                                                                                   |
│ │ │ │ │  |		write_uint32(m_max_pieces, ptr);                                                                                                                                             |
│ │ │ │ │  |		write_uint32(m_piece_size, ptr);                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		for (piece_index_t piece(0); piece < piece_index_t(m_max_pieces); ++piece)                                                                                                   |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │  |_	_	_	_a_u_t_o_ _c_o_n_s_t_ _i_ _=_ _m___p_i_e_c_e___m_a_p_._f_i_n_d_(_p_i_e_c_e_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_u_t_p___s_t_r_e_a_m_._c_p_p_:_1_4_6_7_ _ _ _ _|_t_h_i_s_ _l_o_o_p_ _i_s_ _n_o_t_ _v_e_r_y_ _e_f_f_i_c_i_e_n_t_._ _I_t_ _c_o_u_l_d_ _b_e_ _f_i_x_e_d_ _b_y_ _h_a_v_i_n_g_ _a_ _s_e_p_a_r_a_t_e_ _l_i_s_t_ _o_f_ _s_e_q_u_e_n_c_e_ _n_u_m_b_e_r_s_ _t_h_a_t_ _n_e_e_d_ _r_e_s_e_n_d_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss lloooopp iiss nnoott vveerryy eeffffiicciieenntt.. IItt ccoouulldd bbee ffiixxeedd bbyy hhaavviinngg aa sseeppaarraattee lliisstt ooff sseeqquueennccee nnuummbbeerrss tthhaatt nneeeedd rreesseennddiinngg **********                                               |
│ │ │ │ │ -|****** ....//ssrrcc//uuttpp__ssttrreeaamm..ccpppp::11446677 ******                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	if (m_stalled)                                                                                                                                                                |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (flags & pkt_ack)                                                                                                                                                         |
│ │ │ │ │ -|			defer_ack();                                                                                                                                                                |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// m_out_eof means we're trying to close the write side of this socket,                                                                                                       |
│ │ │ │ │ -|	// we need to flush all payload before we can send the FIN packet, so don't                                                                                                   |
│ │ │ │ │ -|	// store any payload in the nagle packet                                                                                                                                      |
│ │ │ │ │ -|	bool const force = (flags & pkt_ack) || (flags & pkt_fin) || m_out_eof;                                                                                                       |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |this should be the global download rate                                                                                             |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_1_1_0_5_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss sshhoouulldd bbee tthhee gglloobbaall ddoowwnnllooaadd rraattee **********                                                                                                                            |
│ │ │ │ │ +|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::11110055 ******                                                                                                                                        |
│ │ │ │ │ +|		int rate = 0;                                                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// when we want to close the outgoing stream, we need to send the                                                                                                             |
│ │ │ │ │ -|	// remaining nagle packet even though it won't fill a packet.                                                                                                                 |
│ │ │ │ │ -|	bool const force_flush_nagle = m_out_eof && m_write_buffer_size;                                                                                                              |
│ │ │ │ │ +|		// if we haven't received any data recently, the current download rate                                                                                                       |
│ │ │ │ │ +|		// is not representative                                                                                                                                                     |
│ │ │ │ │ +|		if (aux::time_now() - m_last_piece.get(m_connect) > seconds(30) && m_download_rate_peak > 0)                                                                                 |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			rate = m_download_rate_peak;                                                                                                                                                |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		else if (aux::time_now() - m_last_unchoked.get(m_connect) < seconds(5)                                                                                                       |
│ │ │ │ │ +|			&& m_statistics.total_payload_upload() < 2 * 0x4000)                                                                                                                        |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// if we're have only been unchoked for a short period of time,                                                                                                             |
│ │ │ │ │ +|			// we don't know what rate we can get from this peer. Instead of assuming                                                                                                   |
│ │ │ │ │ +|			// the lowest possible rate, assume the average.                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// first see if we need to resend any packets                                                                                                                                 |
│ │ │ │ │ +|			int peers_with_requests = int(stats_counters()[counters::num_peers_down_requests]);                                                                                         |
│ │ │ │ │ +|			// avoid division by 0                                                                                                                                                      |
│ │ │ │ │ +|			if (peers_with_requests == 0) peers_with_requests = 1;                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|for (int i = (m_acked_seq_nr + 1) & ACK_MASK; i != m_seq_nr; i = (i + 1) & ACK_MASK)                                                                                           |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		packet* p = m_outbuf.at(aux::numeric_cast<packet_buffer::index_type>(i));                                                                                                    |
│ │ │ │ │ -|		if (!p) continue;                                                                                                                                                            |
│ │ │ │ │ -|		if (!p->need_resend) continue;                                                                                                                                               |
│ │ │ │ │ -|		if (!resend_packet(p))                                                                                                                                                       |
│ │ │ │ │ +|rate = t->statistics().transfer_rate(stat::download_payload) / peers_with_requests;                                                                                            |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// we couldn't resend the packet. It probably doesn't                                                                                                                       |
│ │ │ │ │ -|			// fit in our cwnd. If force is set, we need to continue                                                                                                                    |
│ │ │ │ │ -|			// to send our packet anyway, if we don't have force set,                                                                                                                   |
│ │ │ │ │ -|			// we might as well return                                                                                                                                                  |
│ │ │ │ │ -|			if (!force) return false;                                                                                                                                                   |
│ │ │ │ │ -|			// resend_packet might have failed                                                                                                                                          |
│ │ │ │ │ -|			if (state() == state_t::error_wait || state() == state_t::deleting) return false;                                                                                           |
│ │ │ │ │ -|			if (m_stalled) return false;                                                                                                                                                |
│ │ │ │ │ -|			break;                                                                                                                                                                      |
│ │ │ │ │ +|			// current download rate in bytes per seconds                                                                                                                               |
│ │ │ │ │ +|			rate = m_statistics.transfer_rate(stat::download_payload);                                                                                                                  |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// don't fast-resend this packet                                                                                                                                             |
│ │ │ │ │ -|		if (m_fast_resend_seq_nr == i)                                                                                                                                               |
│ │ │ │ │ -|			m_fast_resend_seq_nr = (m_fast_resend_seq_nr + 1) & ACK_MASK;                                                                                                               |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		// avoid division by zero                                                                                                                                                    |
│ │ │ │ │ +|		if (rate < 50) rate = 50;                                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// MTU DISCOVERY                                                                                                                                                              |
│ │ │ │ │ +|		// average of current rate and peak                                                                                                                                          |
│ │ │ │ │ +|//		rate = (rate + m_download_rate_peak) / 2;                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// under these conditions, the next packet we send should be an MTU probe.                                                                                                    |
│ │ │ │ │ -|	// MTU probes get to use the mid-point packet size, whereas other packets                                                                                                     |
│ │ │ │ │ -|	// use a conservative packet size of the largest known to work. The reason                                                                                                    |
│ │ │ │ │ -|	// for the cwnd condition is to make sure the probe is surrounded by non-                                                                                                     |
│ │ │ │ │ -|	// probes, to be able to distinguish a loss of the probe vs. just loss in                                                                                                     |
│ │ │ │ │ -|_	_/_/_ _g_e_n_e_r_a_l_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t___h_a_n_d_l_e_._c_p_p_:_5_8_9_ _|_s_u_p_p_o_r_t_ _m_o_v_i_n_g_ _f_i_l_e_s_ _i_n_t_o_ _t_h_i_s_ _c_a_l_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ssuuppppoorrtt mmoovviinngg ffiilleess iinnttoo tthhiiss ccaallll **********                                                                                                                                |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt__hhaannddllee..ccpppp::558899 ******                                                                                                                                          |
│ │ │ │ │ -|auto retp = &prio;                                                                                                                                                             |
│ │ │ │ │ -|		sync_call(&torrent::piece_priorities, retp);                                                                                                                                 |
│ │ │ │ │ -|		std::vector<int> ret;                                                                                                                                                        |
│ │ │ │ │ -|		ret.reserve(prio.size());                                                                                                                                                    |
│ │ │ │ │ -|		for (auto p : prio)                                                                                                                                                          |
│ │ │ │ │ -|			ret.push_back(int(static_cast<std::uint8_t>(p)));                                                                                                                           |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|		return milliseconds((m_outstanding_bytes + extra_bytes                                                                                                                       |
│ │ │ │ │ +|			+ m_queued_time_critical * t->block_size() * 1000) / rate);                                                                                                                 |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent_handle::file_priority(file_index_t index, download_priority_t priority) const                                                                                    |
│ │ │ │ │ +|	void peer_connection::add_stat(std::int64_t const downloaded, std::int64_t const uploaded)                                                                                    |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		async_call(&torrent::set_file_priority, index, priority);                                                                                                                    |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		m_statistics.add_stat(downloaded, uploaded);                                                                                                                                 |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	download_priority_t torrent_handle::file_priority(file_index_t index) const                                                                                                   |
│ │ │ │ │ +|	sha1_hash peer_connection::associated_info_hash() const                                                                                                                       |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		return sync_call_ret<download_priority_t>(dont_download, &torrent::file_priority, index);                                                                                    |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void torrent_handle::prioritize_files(std::vector<download_priority_t> const& files) const                                                                                     |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		async_call(&torrent::prioritize_files                                                                                                                                        |
│ │ │ │ │ -|			, static_cast<aux::vector<download_priority_t, file_index_t> const&>(files));                                                                                               |
│ │ │ │ │ +|		std::shared_ptr<torrent> t = associated_torrent().lock();                                                                                                                    |
│ │ │ │ │ +|		TORRENT_ASSERT(t);                                                                                                                                                           |
│ │ │ │ │ +|		auto const& ih = t->info_hash();                                                                                                                                             |
│ │ │ │ │ +|		// if protocol_v2 is set on the peer, this better be a v2 torrent,                                                                                                           |
│ │ │ │ │ +|_	_	_/_/_ _o_t_h_e_r_w_i_s_e_ _s_o_m_e_t_h_i_n_g_ _i_s_n_'_t_ _r_i_g_h_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |sort the allowed fast set in priority order                                                                                         |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_3_5_3_6_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ssoorrtt tthhee aalllloowweedd ffaasstt sseett iinn pprriioorriittyy oorrddeerr **********                                                                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::33553366 ******                                                                                                                                        |
│ │ │ │ │ +|		// if the peer has the piece and we want                                                                                                                                     |
│ │ │ │ │ +|		// to download it, request it                                                                                                                                                |
│ │ │ │ │ +|		if (index < m_have_piece.end_index()                                                                                                                                         |
│ │ │ │ │ +|			&& m_have_piece[index]                                                                                                                                                      |
│ │ │ │ │ +|			&& !t->have_piece(index)                                                                                                                                                    |
│ │ │ │ │ +|			&& t->valid_metadata()                                                                                                                                                      |
│ │ │ │ │ +|			&& t->has_picker()                                                                                                                                                          |
│ │ │ │ │ +|			&& t->picker().piece_priority(index) > dont_download)                                                                                                                       |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			t->peer_is_interesting(*this);                                                                                                                                              |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::vector<download_priority_t> torrent_handle::get_file_priorities() const                                                                                                  |
│ │ │ │ │ +|	std::vector<piece_index_t> const& peer_connection::allowed_fast()                                                                                                             |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		aux::vector<download_priority_t, file_index_t> ret;                                                                                                                          |
│ │ │ │ │ -|		auto retp = &ret;                                                                                                                                                            |
│ │ │ │ │ -|		sync_call(&torrent::file_priorities, retp);                                                                                                                                  |
│ │ │ │ │ -|		return TORRENT_RVO(ret);                                                                                                                                                     |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(t);                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// ============ start deprecation ===============                                                                                                                              |
│ │ │ │ │ +|return m_allowed_fast;                                                                                                                                                         |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent_handle::prioritize_files(std::vector<int> const& files) const                                                                                                    |
│ │ │ │ │ +|	bool peer_connection::can_request_time_critical() const                                                                                                                       |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		aux::vector<download_priority_t, file_index_t> file_prio;                                                                                                                    |
│ │ │ │ │ -|		file_prio.reserve(files.size());                                                                                                                                             |
│ │ │ │ │ -|		for (auto const p : files) {                                                                                                                                                 |
│ │ │ │ │ -|			file_prio.push_back(download_priority_t(static_cast<std::uint8_t>(p)));                                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		async_call(&torrent::prioritize_files, file_prio);                                                                                                                           |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		if (has_peer_choked() || !is_interesting()) return false;                                                                                                                    |
│ │ │ │ │ +|		if (int(m_download_queue.size()) + int(m_request_queue.size())                                                                                                               |
│ │ │ │ │ +|			> m_desired_queue_size * 2) return false;                                                                                                                                   |
│ │ │ │ │ +|		if (on_parole()) return false;                                                                                                                                               |
│ │ │ │ │ +|		if (m_disconnecting) return false;                                                                                                                                           |
│ │ │ │ │ +|		std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(t);                                                                                                                                                           |
│ │ │ │ │ +|		if (t->upload_mode()) return false;                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// ignore snubbed peers, since they're not likely to return pieces in a                                                                                                      |
│ │ │ │ │ +|		// timely manner anyway                                                                                                                                                      |
│ │ │ │ │ +|		if (m_snubbed) return false;                                                                                                                                                 |
│ │ │ │ │ +|		return true;                                                                                                                                                                 |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::vector<int> torrent_handle::file_priorities() const                                                                                                                      |
│ │ │ │ │ +|	bool peer_connection::make_time_critical(piece_block const& block)                                                                                                            |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|_	_	_a_u_x_:_:_v_e_c_t_o_r_<_d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t_,_ _f_i_l_e___i_n_d_e_x___t_>_ _p_r_i_o_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ +|		auto const rit = std::find_if(m_request_queue.begin()                                                                                                                        |
│ │ │ │ │ +|			, m_request_queue.end(), aux::has_block(block));                                                                                                                            |
│ │ │ │ │ +|		if (rit == m_request_queue.end()) return false;                                                                                                                              |
│ │ │ │ │ +|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ +|		std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                               |
│ │ │ │ │ +|		TORRENT_ASSERT(t);                                                                                                                                                           |
│ │ │ │ │ +|_	_	_T_O_R_R_E_N_T___A_S_S_E_R_T_(_t_-_>_h_a_s___p_i_c_k_e_r_(_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_i_p___n_o_t_i_f_i_e_r_._c_p_p_:_4_1_ _ _ _ _ _|_s_i_m_u_l_a_t_o_r_ _s_u_p_p_o_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ssiimmuullaattoorr ssuuppppoorrtt **********                                                                                                                                                  |
│ │ │ │ │ +|****** ....//ssrrcc//iipp__nnoottiiffiieerr..ccpppp::4411 ******                                                                                                                                              |
│ │ │ │ │ +|      from this software without specific prior written permission.                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"                                                                                                    |
│ │ │ │ │ +|AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE                                                                                                      |
│ │ │ │ │ +|IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE                                                                                                     |
│ │ │ │ │ +|ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE                                                                                                       |
│ │ │ │ │ +|LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR                                                                                                            |
│ │ │ │ │ +|CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF                                                                                                           |
│ │ │ │ │ +|SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS                                                                                                       |
│ │ │ │ │ +|INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN                                                                                                        |
│ │ │ │ │ +|CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)                                                                                                        |
│ │ │ │ │ +|ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE                                                                                                     |
│ │ │ │ │ +|POSSIBILITY OF SUCH DAMAGE.                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|*/                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#include "libtorrent/aux_/ip_notifier.hpp"                                                                                                                                     |
│ │ │ │ │ +|#include "libtorrent/assert.hpp"                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if defined TORRENT_BUILD_SIMULATOR                                                                                                                                            |
│ │ │ │ │ +|#elif TORRENT_USE_NETLINK                                                                                                                                                      |
│ │ │ │ │ +|#include "libtorrent/netlink.hpp"                                                                                                                                              |
│ │ │ │ │ +|#include "libtorrent/socket.hpp"                                                                                                                                               |
│ │ │ │ │ +|#include <array>                                                                                                                                                               |
│ │ │ │ │ +|#include <unordered_map>                                                                                                                                                       |
│ │ │ │ │ +|#elif TORRENT_USE_SYSTEMCONFIGURATION || TORRENT_USE_SC_NETWORK_REACHABILITY                                                                                                   |
│ │ │ │ │ +|#include <SystemConfiguration/SystemConfiguration.h>                                                                                                                           |
│ │ │ │ │ +|#elif defined TORRENT_WINDOWS                                                                                                                                                  |
│ │ │ │ │ +|#include "libtorrent/aux_/throw.hpp"                                                                                                                                           |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_push.hpp"                                                                                                                           |
│ │ │ │ │ +|#include <iphlpapi.h>                                                                                                                                                          |
│ │ │ │ │ +|#ifdef TORRENT_WINRT                                                                                                                                                           |
│ │ │ │ │ +|#include <netioapi.h>                                                                                                                                                          |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#include <mutex>                                                                                                                                                               |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#include "libtorrent/aux_/netlink_utils.hpp"                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|namespace libtorrent { namespace aux {                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|namespace {                                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if (TORRENT_USE_SYSTEMCONFIGURATION || TORRENT_USE_SC_NETWORK_REACHABILITY) && \                                                                                              |
│ │ │ │ │ +|	!defined TORRENT_BUILD_SIMULATOR                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|// common utilities for Mac and iOS                                                                                                                                            |
│ │ │ │ │ +|template <typename T> void CFRefRetain(T h) { CFRetain(h); }                                                                                                                   |
│ │ │ │ │ +|_t_e_m_p_l_a_t_e_ _<_t_y_p_e_n_a_m_e_ _T_>_ _v_o_i_d_ _C_F_R_e_f_R_e_l_e_a_s_e_(_T_ _h_)_ _{_ _C_F_R_e_l_e_a_s_e_(_h_)_;_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_t_t_i_n_g_s___p_a_c_k_._c_p_p_:_3_0_5_ _ _|_d_e_p_r_e_c_a_t_e_ _t_h_i_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** ddeepprreeccaattee tthhiiss **********                                                                                                                                                     |
│ │ │ │ │  |****** ....//ssrrcc//sseettttiinnggss__ppaacckk..ccpppp::330055 ******                                                                                                                                           |
│ │ │ │ │  |SET(outgoing_port, 0, nullptr),                                                                                                                                                |
│ │ │ │ │  |		SET(num_outgoing_ports, 0, nullptr),                                                                                                                                         |
│ │ │ │ │  |		SET(peer_dscp, 0x04, &session_impl::update_peer_dscp),                                                                                                                       |
│ │ │ │ │  |		SET(active_downloads, 3, &session_impl::trigger_auto_manage),                                                                                                                |
│ │ │ │ │ @@ -7664,122 +8753,185 @@
│ │ │ │ │  |		sett.bulk_set([&](aux::session_settings_single_thread& s)                                                                                                                    |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │  |			apply_pack_impl(pack, s, ses ? &callbacks : nullptr);                                                                                                                       |
│ │ │ │ │  |		});                                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// call the callbacks once all the settings have been applied, and                                                                                                           |
│ │ │ │ │  |_	_	_/_/_ _o_n_l_y_ _o_n_c_e_ _p_e_r_ _c_a_l_l_b_a_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/                       |why is this a linked list?                                                                                                          |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_u_d_p___t_r_a_c_k_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:_6_3_3_|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** wwhhyy iiss tthhiiss aa lliinnkkeedd lliisstt?? **********                                                                                                                                         |
│ │ │ │ │ -|****** ....//ssrrcc//uuddpp__ttrraacckkeerr__ccoonnnneeccttiioonn..ccpppp::663333 ******                                                                                                                                  |
│ │ │ │ │ -|ipv6_peer_entry e{};                                                                                                                                                           |
│ │ │ │ │ -|				std::memcpy(e.ip.data(), buf.data(), 16);                                                                                                                                  |
│ │ │ │ │ -|				buf = buf.subspan(16);                                                                                                                                                     |
│ │ │ │ │ -|				e.port = aux::read_uint16(buf);                                                                                                                                            |
│ │ │ │ │ -|				resp.peers6.push_back(e);                                                                                                                                                  |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			resp.peers4.reserve(static_cast<std::size_t>(num_peers));                                                                                                                   |
│ │ │ │ │ -|			for (int i = 0; i < num_peers; ++i)                                                                                                                                         |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				ipv4_peer_entry e{};                                                                                                                                                       |
│ │ │ │ │ -|				std::memcpy(e.ip.data(), buf.data(), 4);                                                                                                                                   |
│ │ │ │ │ -|				buf = buf.subspan(4);                                                                                                                                                      |
│ │ │ │ │ -|				e.port = aux::read_uint16(buf);                                                                                                                                            |
│ │ │ │ │ -|				resp.peers4.push_back(e);                                                                                                                                                  |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_u_t_p___s_t_r_e_a_m_._c_p_p_:_1_4_6_7_ _ _ _ _|_t_h_i_s_ _l_o_o_p_ _i_s_ _n_o_t_ _v_e_r_y_ _e_f_f_i_c_i_e_n_t_._ _I_t_ _c_o_u_l_d_ _b_e_ _f_i_x_e_d_ _b_y_ _h_a_v_i_n_g_ _a_ _s_e_p_a_r_a_t_e_ _l_i_s_t_ _o_f_ _s_e_q_u_e_n_c_e_ _n_u_m_b_e_r_s_ _t_h_a_t_ _n_e_e_d_ _r_e_s_e_n_d_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss lloooopp iiss nnoott vveerryy eeffffiicciieenntt.. IItt ccoouulldd bbee ffiixxeedd bbyy hhaavviinngg aa sseeppaarraattee lliisstt ooff sseeqquueennccee nnuummbbeerrss tthhaatt nneeeedd rreesseennddiinngg **********                                               |
│ │ │ │ │ +|****** ....//ssrrcc//uuttpp__ssttrreeaamm..ccpppp::11446677 ******                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|std::list<address> ip_list;                                                                                                                                                    |
│ │ │ │ │ -|std::transform(m_endpoints.begin(), m_endpoints.end(), std::back_inserter(ip_list)                                                                                             |
│ │ │ │ │ -|			, [](tcp::endpoint const& ep) { return ep.address(); } );                                                                                                                   |
│ │ │ │ │ +|	if (m_stalled)                                                                                                                                                                |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		if (flags & pkt_ack)                                                                                                                                                         |
│ │ │ │ │ +|			defer_ack();                                                                                                                                                                |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		cb->tracker_response(tracker_req(), m_target.address(), ip_list, resp);                                                                                                      |
│ │ │ │ │ +|	// m_out_eof means we're trying to close the write side of this socket,                                                                                                       |
│ │ │ │ │ +|	// we need to flush all payload before we can send the FIN packet, so don't                                                                                                   |
│ │ │ │ │ +|	// store any payload in the nagle packet                                                                                                                                      |
│ │ │ │ │ +|	bool const force = (flags & pkt_ack) || (flags & pkt_fin) || m_out_eof;                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		close();                                                                                                                                                                     |
│ │ │ │ │ -|		return true;                                                                                                                                                                 |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|	// when we want to close the outgoing stream, we need to send the                                                                                                             |
│ │ │ │ │ +|	// remaining nagle packet even though it won't fill a packet.                                                                                                                 |
│ │ │ │ │ +|	bool const force_flush_nagle = m_out_eof && m_write_buffer_size;                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	bool udp_tracker_connection::on_scrape_response(span<char const> buf)                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		restart_read_timeout();                                                                                                                                                      |
│ │ │ │ │ -|		auto const action = static_cast<action_t>(aux::read_int32(buf));                                                                                                             |
│ │ │ │ │ -|		std::uint32_t const transaction = aux::read_uint32(buf);                                                                                                                     |
│ │ │ │ │ +|	// first see if we need to resend any packets                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (transaction != m_transaction_id)                                                                                                                                         |
│ │ │ │ │ +|for (int i = (m_acked_seq_nr + 1) & ACK_MASK; i != m_seq_nr; i = (i + 1) & ACK_MASK)                                                                                           |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|		packet* p = m_outbuf.at(aux::numeric_cast<packet_buffer::index_type>(i));                                                                                                    |
│ │ │ │ │ +|		if (!p) continue;                                                                                                                                                            |
│ │ │ │ │ +|		if (!p->need_resend) continue;                                                                                                                                               |
│ │ │ │ │ +|		if (!resend_packet(p))                                                                                                                                                       |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			fail(error_code(errors::invalid_tracker_transaction_id), operation_t::bittorrent);                                                                                          |
│ │ │ │ │ -|			return false;                                                                                                                                                               |
│ │ │ │ │ +|			// we couldn't resend the packet. It probably doesn't                                                                                                                       |
│ │ │ │ │ +|			// fit in our cwnd. If force is set, we need to continue                                                                                                                    |
│ │ │ │ │ +|			// to send our packet anyway, if we don't have force set,                                                                                                                   |
│ │ │ │ │ +|			// we might as well return                                                                                                                                                  |
│ │ │ │ │ +|			if (!force) return false;                                                                                                                                                   |
│ │ │ │ │ +|			// resend_packet might have failed                                                                                                                                          |
│ │ │ │ │ +|			if (state() == state_t::error_wait || state() == state_t::deleting) return false;                                                                                           |
│ │ │ │ │ +|			if (m_stalled) return false;                                                                                                                                                |
│ │ │ │ │ +|			break;                                                                                                                                                                      |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (action == action_t::error)                                                                                                                                               |
│ │ │ │ │ +|		// don't fast-resend this packet                                                                                                                                             |
│ │ │ │ │ +|		if (m_fast_resend_seq_nr == i)                                                                                                                                               |
│ │ │ │ │ +|			m_fast_resend_seq_nr = (m_fast_resend_seq_nr + 1) & ACK_MASK;                                                                                                               |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// MTU DISCOVERY                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// under these conditions, the next packet we send should be an MTU probe.                                                                                                    |
│ │ │ │ │ +|	// MTU probes get to use the mid-point packet size, whereas other packets                                                                                                     |
│ │ │ │ │ +|	// use a conservative packet size of the largest known to work. The reason                                                                                                    |
│ │ │ │ │ +|	// for the cwnd condition is to make sure the probe is surrounded by non-                                                                                                     |
│ │ │ │ │ +|	// probes, to be able to distinguish a loss of the probe vs. just loss in                                                                                                     |
│ │ │ │ │ +|_	_/_/_ _g_e_n_e_r_a_l_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_u_t_p___s_o_c_k_e_t___m_a_n_a_g_e_r_._c_p_p_:|this should not be heap allocated, sockets should be movable                                                                        |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_2_0_4_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss sshhoouulldd nnoott bbee hheeaapp aallllooccaatteedd,, ssoocckkeettss sshhoouulldd bbee mmoovvaabbllee **********                                                                                                       |
│ │ │ │ │ +|****** ....//ssrrcc//uuttpp__ssoocckkeett__mmaannaaggeerr..ccpppp::220044 ******                                                                                                                                      |
│ │ │ │ │ +|//		UTP_LOGV("incoming packet id:%d source:%s\n", id, print_endpoint(ep).c_str());                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (!m_sett.get_bool(settings_pack::enable_incoming_utp))                                                                                                                    |
│ │ │ │ │ +|			return false;                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// if not found, see if it's a SYN packet, if it is,                                                                                                                         |
│ │ │ │ │ +|		// create a new utp_stream                                                                                                                                                   |
│ │ │ │ │ +|		if (ph->get_type() == ST_SYN)                                                                                                                                                |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			fail(error_code(errors::tracker_failure), operation_t::bittorrent                                                                                                           |
│ │ │ │ │ -|				, std::string(buf.data(), static_cast<std::size_t>(buf.size())).c_str());                                                                                                  |
│ │ │ │ │ +|			// possible SYN flood. Just ignore                                                                                                                                          |
│ │ │ │ │ +|			if (int(m_utp_sockets.size()) > m_sett.get_int(settings_pack::connections_limit) * 2)                                                                                       |
│ │ │ │ │ +|				return false;                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			TORRENT_ASSERT(m_new_connection == -1);                                                                                                                                     |
│ │ │ │ │ +|			// create the new socket with this ID                                                                                                                                       |
│ │ │ │ │ +|			m_new_connection = id;                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|//			UTP_LOGV("not found, new connection id:%d\n", m_new_connection);                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|aux::socket_type c(aux::instantiate_connection(m_ios, aux::proxy_settings(), m_ssl_context, this, true, false));                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			utp_stream* str = nullptr;                                                                                                                                                  |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|			if (is_ssl(c))                                                                                                                                                              |
│ │ │ │ │ +|				str = &boost::get<ssl_stream<utp_stream>>(c).next_layer();                                                                                                                 |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|				str = boost::get<utp_stream>(&c);                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			TORRENT_ASSERT(str);                                                                                                                                                        |
│ │ │ │ │ +|			int const mtu = mtu_for_dest(ep.address());                                                                                                                                 |
│ │ │ │ │ +|			str->get_impl()->init_mtu(mtu);                                                                                                                                             |
│ │ │ │ │ +|			str->get_impl()->m_sock = std::move(socket);                                                                                                                                |
│ │ │ │ │ +|			bool const ret = str->get_impl()->incoming_packet(p, ep, receive_time);                                                                                                     |
│ │ │ │ │ +|			if (!ret) return false;                                                                                                                                                     |
│ │ │ │ │ +|			m_last_socket = str->get_impl();                                                                                                                                            |
│ │ │ │ │ +|			m_cb(std::move(c));                                                                                                                                                         |
│ │ │ │ │ +|			// the connection most likely changed its connection ID here                                                                                                                |
│ │ │ │ │ +|			// we need to move it to the correct ID                                                                                                                                     |
│ │ │ │ │  |			return true;                                                                                                                                                                |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (action != action_t::scrape)                                                                                                                                              |
│ │ │ │ │ -|_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_a_g_n_e_t___u_r_i_._c_p_p_:_4_3_9_ _ _ _ _ _|_w_h_a_t_'_s_ _t_h_e_ _r_i_g_h_t_ _n_u_m_b_e_r_ _h_e_r_e_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** wwhhaatt''ss tthhee rriigghhtt nnuummbbeerr hheerree?? **********                                                                                                                                      |
│ │ │ │ │ -|****** ....//ssrrcc//mmaaggnneett__uurrii..ccpppp::443399 ******                                                                                                                                              |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|			else if (string_equal_no_case(name, "so"_sv)) // select-only (files)                                                                                                        |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				// accept only digits, '-' and ','                                                                                                                                         |
│ │ │ │ │ -|				if (std::any_of(value.begin(), value.end(), [](char c)                                                                                                                     |
│ │ │ │ │ -|					{ return !is_digit(c) && c != '-' && c != ','; }))                                                                                                                        |
│ │ │ │ │ -|					continue;                                                                                                                                                                 |
│ │ │ │ │ +|		if (ph->get_type() == ST_RESET) return false;                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				// make sure all file priorities are set to 0, except the ones                                                                                                             |
│ │ │ │ │ -|				// we specify in the file_priorities                                                                                                                                       |
│ │ │ │ │ -|				p.flags |= torrent_flags::default_dont_download;                                                                                                                           |
│ │ │ │ │ +|		// #error send reset                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				do                                                                                                                                                                         |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					string_view token;                                                                                                                                                        |
│ │ │ │ │ -|					std::tie(token, value) = split_string(value, ',');                                                                                                                        |
│ │ │ │ │ +|		return false;                                                                                                                                                                |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|					if (token.empty()) continue;                                                                                                                                              |
│ │ │ │ │ +|_	_v_o_i_d_ _u_t_p___s_o_c_k_e_t___m_a_n_a_g_e_r_:_:_s_u_b_s_c_r_i_b_e___w_r_i_t_a_b_l_e_(_u_t_p___s_o_c_k_e_t___i_m_p_l_*_ _s_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/                       |move stats_counter_t out of counters                                                                                                |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._c_p_p_:_4_0_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmoovvee ssttaattss__ccoouunntteerr__tt oouutt ooff ccoouunntteerrss **********                                                                                                                               |
│ │ │ │ │ +|_**_**_**_ _.._.._//_ss_rr_cc_//_pp_ee_rr_ff_oo_rr_mm_aa_nn_cc_ee____cc_oo_uu_nn_tt_ee_rr_ss_.._cc_pp_pp_::_44_00_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/                       |should bittorrent keep-alive messages have a counter too?                                                                           |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._c_p_p_:_4_1_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** sshhoouulldd bbiittttoorrrreenntt kkeeeepp--aalliivvee mmeessssaaggeess hhaavvee aa ccoouunntteerr ttoooo?? **********                                                                                                          |
│ │ │ │ │ +|_**_**_**_ _.._.._//_ss_rr_cc_//_pp_ee_rr_ff_oo_rr_mm_aa_nn_cc_ee____cc_oo_uu_nn_tt_ee_rr_ss_.._cc_pp_pp_::_44_11_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/                       |It would be nice if this could be an internal type. default_disk_constructor depends on it now                                      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._c_p_p_:_4_2_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** IItt wwoouulldd bbee nniiccee iiff tthhiiss ccoouulldd bbee aann iinntteerrnnaall ttyyppee.. ddeeffaauulltt__ddiisskk__ccoonnssttrruuccttoorr ddeeppeennddss oonn iitt nnooww **********                                                                     |
│ │ │ │ │ +|****** ....//ssrrcc//ppeerrffoorrmmaannccee__ccoouunntteerrss..ccpppp::4422 ******                                                                                                                                     |
│ │ │ │ │ +|THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"                                                                                                    |
│ │ │ │ │ +|AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE                                                                                                      |
│ │ │ │ │ +|IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE                                                                                                     |
│ │ │ │ │ +|ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE                                                                                                       |
│ │ │ │ │ +|LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR                                                                                                            |
│ │ │ │ │ +|CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF                                                                                                           |
│ │ │ │ │ +|SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS                                                                                                       |
│ │ │ │ │ +|INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN                                                                                                        |
│ │ │ │ │ +|CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)                                                                                                        |
│ │ │ │ │ +|ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE                                                                                                     |
│ │ │ │ │ +|POSSIBILITY OF SUCH DAMAGE.                                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|					int idx1, idx2;                                                                                                                                                           |
│ │ │ │ │ -|constexpr int max_index = 10000; // can't risk out of memory                                                                                                                   |
│ │ │ │ │ +|*/                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|					auto const divider = token.find_first_of('-');                                                                                                                            |
│ │ │ │ │ -|					if (divider != std::string::npos) // it's a range                                                                                                                         |
│ │ │ │ │ -|					{                                                                                                                                                                         |
│ │ │ │ │ -|						if (divider == 0) // no start index                                                                                                                                      |
│ │ │ │ │ -|							continue;                                                                                                                                                               |
│ │ │ │ │ -|						if (divider == token.size() - 1) // no end index                                                                                                                         |
│ │ │ │ │ -|							continue;                                                                                                                                                               |
│ │ │ │ │ +|#include "libtorrent/performance_counters.hpp"                                                                                                                                 |
│ │ │ │ │ +|#include "libtorrent/assert.hpp"                                                                                                                                               |
│ │ │ │ │ +|#include <cstring> // for memset                                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|						idx1 = std::atoi(token.substr(0, divider).to_string().c_str());                                                                                                          |
│ │ │ │ │ -|						if (idx1 < 0 || idx1 > max_index) // invalid index                                                                                                                       |
│ │ │ │ │ -|							continue;                                                                                                                                                               |
│ │ │ │ │ -|						idx2 = std::atoi(token.substr(divider + 1).to_string().c_str());                                                                                                         |
│ │ │ │ │ -|						if (idx2 < 0 || idx2 > max_index) // invalid index                                                                                                                       |
│ │ │ │ │ -|							continue;                                                                                                                                                               |
│ │ │ │ │ +|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|						if (idx1 > idx2) // wrong range limits                                                                                                                                   |
│ │ │ │ │ -|							continue;                                                                                                                                                               |
│ │ │ │ │ -|					}                                                                                                                                                                         |
│ │ │ │ │ -|					else // it's an index                                                                                                                                                     |
│ │ │ │ │ -|					{                                                                                                                                                                         |
│ │ │ │ │ -|						idx1 = std::atoi(token.to_string().c_str());                                                                                                                             |
│ │ │ │ │ -|						if (idx1 < 0 || idx1 > max_index) // invalid index                                                                                                                       |
│ │ │ │ │ -|							continue;                                                                                                                                                               |
│ │ │ │ │ -|						idx2 = idx1;                                                                                                                                                             |
│ │ │ │ │ -|					}                                                                                                                                                                         |
│ │ │ │ │ +|counters::counters() TORRENT_COUNTER_NOEXCEPT                                                                                                                                  |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|#ifdef ATOMIC_LLONG_LOCK_FREE                                                                                                                                                  |
│ │ │ │ │ +|		for (auto& counter : m_stats_counter)                                                                                                                                        |
│ │ │ │ │ +|			counter.store(0, std::memory_order_relaxed);                                                                                                                                |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		m_stats_counter.fill(0);                                                                                                                                                     |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|					if (int(p.file_priorities.size()) <= idx2)                                                                                                                                |
│ │ │ │ │ -|_	_	_	_	_	_	_p_._f_i_l_e___p_r_i_o_r_i_t_i_e_s_._r_e_s_i_z_e_(_s_t_a_t_i_c___c_a_s_t_<_s_t_d_:_:_s_i_z_e___t_>_(_i_d_x_2_)_ _+_ _1_,_ _d_o_n_t___d_o_w_n_l_o_a_d_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|	counters::counters(counters const& c) TORRENT_COUNTER_NOEXCEPT                                                                                                                |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef ATOMIC_LLONG_LOCK_FREE                                                                                                                                                  |
│ │ │ │ │ +|		for (int i = 0; i < m_stats_counter.end_index(); ++i)                                                                                                                        |
│ │ │ │ │ +|			m_stats_counter[i].store(                                                                                                                                                   |
│ │ │ │ │ +|				c.m_stats_counter[i].load(std::memory_order_relaxed)                                                                                                                       |
│ │ │ │ │ +|					, std::memory_order_relaxed);                                                                                                                                             |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		std::lock_guard<std::mutex> l(c.m_mutex);                                                                                                                                    |
│ │ │ │ │ +|		m_stats_counter = c.m_stats_counter;                                                                                                                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	counters& counters::operator=(counters const& c) & TORRENT_COUNTER_NOEXCEPT                                                                                                   |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		if (&c == this) return *this;                                                                                                                                                |
│ │ │ │ │ +|#ifdef ATOMIC_LLONG_LOCK_FREE                                                                                                                                                  |
│ │ │ │ │ +|		for (int i = 0; i < m_stats_counter.end_index(); ++i)                                                                                                                        |
│ │ │ │ │ +|			m_stats_counter[i].store(                                                                                                                                                   |
│ │ │ │ │ +|				c.m_stats_counter[i].load(std::memory_order_relaxed)                                                                                                                       |
│ │ │ │ │ +|_	_	_	_	_	_,_ _s_t_d_:_:_m_e_m_o_r_y___o_r_d_e_r___r_e_l_a_x_e_d_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_h_a_s_h___p_i_c_k_e_r_._c_p_p_:_3_0_9_ _ _ _ _|_u_s_e_ _s_t_r_u_c_t_u_r_e_d_ _b_i_n_d_i_n_g_s_ _i_n_ _C_+_+_1_7_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** uussee ssttrruuccttuurreedd bbiinnddiinnggss iinn CC++++1177 **********                                                                                                                                   |
│ │ │ │ │  |****** ....//ssrrcc//hhaasshh__ppiicckkeerr..ccpppp::330099 ******                                                                                                                                             |
│ │ │ │ │  |, int const offset, sha256_hash const& h)                                                                                                                                      |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │  |		TORRENT_ASSERT(offset >= 0);                                                                                                                                                 |
│ │ │ │ │  |		auto const f = m_files.file_index_at_piece(piece);                                                                                                                           |
│ │ │ │ │ @@ -7825,773 +8977,312 @@
│ │ │ │ │  |		TORRENT_ASSERT(req.base == m_piece_layer && req.index % 512 == 0);                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		for (int i = req.index; i < req.index + req.count; i += 512)                                                                                                                 |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │  |			m_piece_hash_requested[req.file][i / 512].last_request = min_time();                                                                                                        |
│ │ │ │ │  |			--m_piece_hash_requested[req.file][i / 512].num_requests;                                                                                                                   |
│ │ │ │ │  |_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t___p_e_e_r_._c_p_p_:_1_9_2_ _ _ _|_h_o_w_ _d_o_ _w_e_ _d_e_a_l_ _w_i_t_h_ _o_u_r_ _e_x_t_e_r_n_a_l_ _a_d_d_r_e_s_s_ _c_h_a_n_g_i_n_g_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** hhooww ddoo wwee ddeeaall wwiitthh oouurr eexxtteerrnnaall aaddddrreessss cchhaannggiinngg?? **********                                                                                                                 |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt__ppeeeerr..ccpppp::119922 ******                                                                                                                                            |
│ │ │ │ │ -|// connections. If it fails, we'll                                                                                                                                             |
│ │ │ │ │ -|		// retry with encryption                                                                                                                                                     |
│ │ │ │ │ -|		, pe_support(false)                                                                                                                                                          |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		, is_v6_addr(false)                                                                                                                                                          |
│ │ │ │ │ -|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ -|		, is_i2p_addr(false)                                                                                                                                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		, on_parole(false)                                                                                                                                                           |
│ │ │ │ │ -|		, banned(false)                                                                                                                                                              |
│ │ │ │ │ -|		, supports_utp(true) // assume peers support utp                                                                                                                             |
│ │ │ │ │ -|		, confirmed_supports_utp(false)                                                                                                                                              |
│ │ │ │ │ -|		, supports_holepunch(false)                                                                                                                                                  |
│ │ │ │ │ -|		, web_seed(false)                                                                                                                                                            |
│ │ │ │ │ -|		, protocol_v2(false)                                                                                                                                                         |
│ │ │ │ │ -|	{}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	std::uint32_t torrent_peer::rank(external_ip const& external, int external_port) const                                                                                        |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(in_use);                                                                                                                                                      |
│ │ │ │ │ -|if (peer_rank == 0)                                                                                                                                                            |
│ │ │ │ │ -|peer_rank = peer_priority(                                                                                                                                                     |
│ │ │ │ │ -|				tcp::endpoint(external.external_address(this->address()), std::uint16_t(external_port))                                                                                    |
│ │ │ │ │ -|				, tcp::endpoint(this->address(), this->port));                                                                                                                             |
│ │ │ │ │ -|		return peer_rank;                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_e___c_r_y_p_t_o_._c_p_p_:_6_0_ _ _ _ _ _ _ _|_i_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _g_e_t_ _t_h_e_ _l_i_t_e_r_a_l_ _w_o_r_k_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd bbee nniiccee ttoo ggeett tthhee lliitteerraall wwoorrkkiinngg **********                                                                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//ppee__ccrryyppttoo..ccpppp::6600 ******                                                                                                                                                |
│ │ │ │ │ +|#include <algorithm>                                                                                                                                                           |
│ │ │ │ │ +|#include <random>                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|	std::string torrent_peer::to_string() const                                                                                                                                   |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(in_use);                                                                                                                                                      |
│ │ │ │ │ -|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ -|		if (is_i2p_addr) return dest().to_string();                                                                                                                                  |
│ │ │ │ │ -|#endif // TORRENT_USE_I2P                                                                                                                                                      |
│ │ │ │ │ -|		return address().to_string();                                                                                                                                                |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_push.hpp"                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::int64_t torrent_peer::total_download() const                                                                                                                             |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(in_use);                                                                                                                                                      |
│ │ │ │ │ -|		if (connection != nullptr)                                                                                                                                                   |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			TORRENT_ASSERT(prev_amount_download == 0);                                                                                                                                  |
│ │ │ │ │ -|			return connection->statistics().total_payload_download();                                                                                                                   |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		else                                                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			return std::int64_t(prev_amount_download) << 10;                                                                                                                            |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_d_i_s_a_b_l_e_d___d_i_s_k___i_o_._c_p_p_:  |it would be nice to return a valid hash of zeroes here                                                                              |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_1_0_6_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd bbee nniiccee ttoo rreettuurrnn aa vvaalliidd hhaasshh ooff zzeerrooeess hheerree **********                                                                                                             |
│ │ │ │ │ -|****** ....//ssrrcc//ddiissaabblleedd__ddiisskk__iioo..ccpppp::110066 ******                                                                                                                                        |
│ │ │ │ │ -|});                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|#include <boost/multiprecision/integer.hpp>                                                                                                                                    |
│ │ │ │ │ +|#include <boost/multiprecision/cpp_int.hpp>                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	bool async_write(storage_index_t                                                                                                                                              |
│ │ │ │ │ -|		, peer_request const& r                                                                                                                                                      |
│ │ │ │ │ -|		, char const*, std::shared_ptr<disk_observer>                                                                                                                                |
│ │ │ │ │ -|		, std::function<void(storage_error const&)> handler                                                                                                                          |
│ │ │ │ │ -|		, disk_job_flags_t) override                                                                                                                                                 |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(r.length <= default_block_size);                                                                                                                              |
│ │ │ │ │ -|		TORRENT_UNUSED(r);                                                                                                                                                           |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		post(m_ios, [h = std::move(handler)] { h(storage_error{}); });                                                                                                               |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|#include "libtorrent/random.hpp"                                                                                                                                               |
│ │ │ │ │ +|#include "libtorrent/aux_/alloca.hpp"                                                                                                                                          |
│ │ │ │ │ +|#include "libtorrent/pe_crypto.hpp"                                                                                                                                            |
│ │ │ │ │ +|#include "libtorrent/hasher.hpp"                                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void async_hash(storage_index_t                                                                                                                                               |
│ │ │ │ │ -|		, piece_index_t piece, span<sha256_hash>, disk_job_flags_t                                                                                                                   |
│ │ │ │ │ -|		, std::function<void(piece_index_t, sha1_hash const&, storage_error const&)> handler) override                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|post(m_ios, [h = std::move(handler), piece] { h(piece, sha1_hash{}, storage_error{}); });                                                                                      |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void async_hash2(storage_index_t, piece_index_t piece, int                                                                                                                    |
│ │ │ │ │ -|		, disk_job_flags_t                                                                                                                                                           |
│ │ │ │ │ -|		, std::function<void(piece_index_t, sha256_hash const&, storage_error const&)> handler) override                                                                             |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		post(m_ios, [h = std::move(handler), piece]() { h(piece, sha256_hash{}, storage_error{}); });                                                                                |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|	namespace mp = boost::multiprecision;                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void async_move_storage(storage_index_t                                                                                                                                       |
│ │ │ │ │ -|		, std::string p, move_flags_t                                                                                                                                                |
│ │ │ │ │ -|		, std::function<void(status_t, std::string const&, storage_error const&)> handler) override                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		post(m_ios, [h = std::move(handler), path = std::move(p)] () mutable                                                                                                         |
│ │ │ │ │ -|			{ h(status_t::no_error, std::move(path), storage_error{}); });                                                                                                              |
│ │ │ │ │ +|	namespace {                                                                                                                                                                   |
│ │ │ │ │ +|key_t const dh_prime                                                                                                                                                           |
│ │ │ │ │ +|("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63|36210000000000090563");
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void async_release_files(storage_index_t, std::function<void()> handler) override                                                                                             |
│ │ │ │ │ +|	std::array<char, 96> export_key(key_t const& k)                                                                                                                               |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		post(m_ios, [h = std::move(handler)] { h(); });                                                                                                                              |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		std::array<char, 96> ret;                                                                                                                                                    |
│ │ │ │ │ +|		auto* begin = reinterpret_cast<std::uint8_t*>(ret.data());                                                                                                                   |
│ │ │ │ │ +|_	_	_s_t_d_:_:_u_i_n_t_8___t_*_ _e_n_d_ _=_ _m_p_:_:_e_x_p_o_r_t___b_i_t_s_(_k_,_ _b_e_g_i_n_,_ _8_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_e___c_r_y_p_t_o_._c_p_p_:_7_1_ _ _ _ _ _ _ _|_i_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _b_e_ _a_b_l_e_ _t_o_ _e_x_p_o_r_t_ _t_o_ _a_ _f_i_x_e_d_ _w_i_d_t_h_ _f_i_e_l_d_,_ _s_o_ _w_e_ _w_o_u_l_d_n_'_t_ _h_a_v_e_ _t_o_ _s_h_i_f_t_ _i_t_ _l_a_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd bbee nniiccee ttoo bbee aabbllee ttoo eexxppoorrtt ttoo aa ffiixxeedd wwiiddtthh ffiieelldd,, ssoo wwee wwoouullddnn''tt hhaavvee ttoo sshhiifftt iitt llaatteerr **********                                                                |
│ │ │ │ │ +|****** ....//ssrrcc//ppee__ccrryyppttoo..ccpppp::7711 ******                                                                                                                                                |
│ │ │ │ │ +|#include "libtorrent/random.hpp"                                                                                                                                               |
│ │ │ │ │ +|#include "libtorrent/aux_/alloca.hpp"                                                                                                                                          |
│ │ │ │ │ +|#include "libtorrent/pe_crypto.hpp"                                                                                                                                            |
│ │ │ │ │ +|#include "libtorrent/hasher.hpp"                                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void async_delete_files(storage_index_t                                                                                                                                       |
│ │ │ │ │ -|		, remove_flags_t, std::function<void(storage_error const&)> handler) override                                                                                                |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		post(m_ios, [h = std::move(handler)] { h(storage_error{}); });                                                                                                               |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void async_check_files(storage_index_t                                                                                                                                        |
│ │ │ │ │ -|_	_	_,_ _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_ _c_o_n_s_t_*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_4_0_4_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _f_i_e_l_d_ _i_n_t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmoovvee tthhiiss ffiieelldd iinnttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                 |
│ │ │ │ │ -|****** ....//ssrrcc//aalleerrtt..ccpppp::440044 ******                                                                                                                                                   |
│ │ │ │ │ -|		return torrent_alert::message() + ": state changed to: "                                                                                                                     |
│ │ │ │ │ -|			+ state_str[state];                                                                                                                                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|	namespace mp = boost::multiprecision;                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	tracker_error_alert::tracker_error_alert(aux::stack_allocator& alloc                                                                                                          |
│ │ │ │ │ -|		, torrent_handle const& h, tcp::endpoint const& ep, int times                                                                                                                |
│ │ │ │ │ -|		, protocol_version v, string_view u, operation_t const operation                                                                                                             |
│ │ │ │ │ -|		, error_code const& e                                                                                                                                                        |
│ │ │ │ │ -|		, string_view m)                                                                                                                                                             |
│ │ │ │ │ -|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ -|		, times_in_row(times)                                                                                                                                                        |
│ │ │ │ │ -|		, error(e)                                                                                                                                                                   |
│ │ │ │ │ -|		, op(operation)                                                                                                                                                              |
│ │ │ │ │ -|		, m_msg_idx(alloc.copy_string(m))                                                                                                                                            |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|		, status_code(e && e.category() == http_category() ? e.value() : -1)                                                                                                         |
│ │ │ │ │ -|		, msg(m)                                                                                                                                                                     |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|, version(v)                                                                                                                                                                   |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ +|	namespace {                                                                                                                                                                   |
│ │ │ │ │ +|		key_t const dh_prime                                                                                                                                                         |
│ │ │ │ │ +|			                                                                                                                                                                            |
│ │ │ │ │ +|("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63|36210000000000090563");
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	char const* tracker_error_alert::failure_reason() const                                                                                                                       |
│ │ │ │ │ +|	std::array<char, 96> export_key(key_t const& k)                                                                                                                               |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		return m_alloc.get().ptr(m_msg_idx);                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		std::array<char, 96> ret;                                                                                                                                                    |
│ │ │ │ │ +|		auto* begin = reinterpret_cast<std::uint8_t*>(ret.data());                                                                                                                   |
│ │ │ │ │ +|		std::uint8_t* end = mp::export_bits(k, begin, 8);                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string tracker_error_alert::message() const                                                                                                                              |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ -|		std::snprintf(ret, sizeof(ret), "%s %s %s \"%s\" (%d)"                                                                                                                       |
│ │ │ │ │ -|			, tracker_alert::message().c_str()                                                                                                                                          |
│ │ │ │ │ -|			, version == protocol_version::V1 ? "v1" : "v2"                                                                                                                             |
│ │ │ │ │ -|			, convert_from_native(error.message()).c_str(), error_message()                                                                                                             |
│ │ │ │ │ -|			, times_in_row);                                                                                                                                                            |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|if (end < begin + 96)                                                                                                                                                          |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|			int const len = int(end - begin);                                                                                                                                           |
│ │ │ │ │ +|#if defined __GNUC__ && __GNUC__ == 12                                                                                                                                         |
│ │ │ │ │ +|#pragma GCC diagnostic push                                                                                                                                                    |
│ │ │ │ │ +|#pragma GCC diagnostic ignored "-Wstringop-overflow"                                                                                                                           |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	tracker_warning_alert::tracker_warning_alert(aux::stack_allocator& alloc                                                                                                      |
│ │ │ │ │ -|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ -|		, string_view u, protocol_version v, string_view m)                                                                                                                          |
│ │ │ │ │ -|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ -|		, m_msg_idx(alloc.copy_string(m))                                                                                                                                            |
│ │ │ │ │ -|_#_i_f_ _T_O_R_R_E_N_T___A_B_I___V_E_R_S_I_O_N_ _=_=_ _1_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_4_3_8_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _i_n_t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmoovvee tthhiiss iinnttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                       |
│ │ │ │ │ -|****** ....//ssrrcc//aalleerrtt..ccpppp::443388 ******                                                                                                                                                   |
│ │ │ │ │ -|return {};                                                                                                                                                                     |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ -|		std::snprintf(ret, sizeof(ret), "%s %s %s \"%s\" (%d)"                                                                                                                       |
│ │ │ │ │ -|			, tracker_alert::message().c_str()                                                                                                                                          |
│ │ │ │ │ -|			, version == protocol_version::V1 ? "v1" : "v2"                                                                                                                             |
│ │ │ │ │ -|			, convert_from_native(error.message()).c_str(), error_message()                                                                                                             |
│ │ │ │ │ -|			, times_in_row);                                                                                                                                                            |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|			std::memmove(begin + 96 - len, begin, aux::numeric_cast<std::size_t>(len));                                                                                                 |
│ │ │ │ │ +|#if defined __GNUC__ && __GNUC__ == 12                                                                                                                                         |
│ │ │ │ │ +|#pragma GCC diagnostic pop                                                                                                                                                     |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|			std::memset(begin, 0, aux::numeric_cast<std::size_t>(96 - len));                                                                                                            |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	tracker_warning_alert::tracker_warning_alert(aux::stack_allocator& alloc                                                                                                      |
│ │ │ │ │ -|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ -|		, string_view u, protocol_version v, string_view m)                                                                                                                          |
│ │ │ │ │ -|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ -|		, m_msg_idx(alloc.copy_string(m))                                                                                                                                            |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|		, msg(m)                                                                                                                                                                     |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|, version(v)                                                                                                                                                                   |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|	void rc4_init(const unsigned char* in, std::size_t len, rc4 *state);                                                                                                          |
│ │ │ │ │ +|	std::size_t rc4_encrypt(unsigned char *out, std::size_t outlen, rc4 *state);                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	char const* tracker_warning_alert::warning_message() const                                                                                                                    |
│ │ │ │ │ +|	// Set the prime P and the generator, generate local public key                                                                                                               |
│ │ │ │ │ +|	dh_key_exchange::dh_key_exchange()                                                                                                                                            |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		return m_alloc.get().ptr(m_msg_idx);                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		aux::array<std::uint8_t, 96> random_key;                                                                                                                                     |
│ │ │ │ │ +|		aux::random_bytes({reinterpret_cast<char*>(random_key.data())                                                                                                                |
│ │ │ │ │ +|			, static_cast<std::ptrdiff_t>(random_key.size())});                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string tracker_warning_alert::message() const                                                                                                                            |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		return tracker_alert::message() + (version == protocol_version::V1 ? " v1" : " v2") + " warning: " + warning_message();                                                      |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		// create local key (random)                                                                                                                                                 |
│ │ │ │ │ +|		mp::import_bits(m_dh_local_secret, random_key.begin(), random_key.end());                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	scrape_reply_alert::scrape_reply_alert(aux::stack_allocator& alloc                                                                                                            |
│ │ │ │ │ -|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ -|		, int incomp, int comp, string_view u, protocol_version const v)                                                                                                             |
│ │ │ │ │ -|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ -|		, incomplete(incomp)                                                                                                                                                         |
│ │ │ │ │ -|_	_	_,_ _c_o_m_p_l_e_t_e_(_c_o_m_p_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_4_6_4_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _i_n_t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmoovvee tthhiiss iinnttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                       |
│ │ │ │ │ -|****** ....//ssrrcc//aalleerrtt..ccpppp::446644 ******                                                                                                                                                   |
│ │ │ │ │ -|char const* tracker_warning_alert::warning_message() const                                                                                                                     |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		return m_alloc.get().ptr(m_msg_idx);                                                                                                                                         |
│ │ │ │ │ +|		// key = (2 ^ secret) % prime                                                                                                                                                |
│ │ │ │ │ +|_	_	_m___d_h___l_o_c_a_l___k_e_y_ _=_ _m_p_:_:_p_o_w_m_(_k_e_y___t_(_2_)_,_ _m___d_h___l_o_c_a_l___s_e_c_r_e_t_,_ _d_h___p_r_i_m_e_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_l_o_a_d___t_o_r_r_e_n_t_._c_p_p_:_1_2_1_ _ _ _|_m_o_v_e_ _t_h_e_ _l_o_a_d_i_n_g_ _l_o_g_i_c_ _f_r_o_m_ _t_o_r_r_e_n_t___i_n_f_o_ _c_o_n_s_t_r_u_c_t_o_r_ _i_n_t_o_ _h_e_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmoovvee tthhee llooaaddiinngg llooggiicc ffrroomm ttoorrrreenntt__iinnffoo ccoonnssttrruuccttoorr iinnttoo hheerree **********                                                                                                     |
│ │ │ │ │ +|****** ....//ssrrcc//llooaadd__ttoorrrreenntt..ccpppp::112211 ******                                                                                                                                            |
│ │ │ │ │ +|mask.resize(std::size_t(full_size), false);                                                                                                                                    |
│ │ │ │ │ +|				for (int i = merkle_first_leaf(piece_layer_size)                                                                                                                           |
│ │ │ │ │ +|					, end = i + num_pieces; i < end; ++i)                                                                                                                                     |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					mask[std::size_t(i)] = true;                                                                                                                                              |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			ti->free_piece_layers();                                                                                                                                                    |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		atp.info_hashes = atp.ti->info_hashes();                                                                                                                                     |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string tracker_warning_alert::message() const                                                                                                                            |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		return tracker_alert::message() + (version == protocol_version::V1 ? " v1" : " v2") + " warning: " + warning_message();                                                      |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|	add_torrent_params load_torrent_file(std::string const& filename)                                                                                                             |
│ │ │ │ │ +|	{ return load_torrent_file(filename, load_torrent_limits{}); }                                                                                                                |
│ │ │ │ │ +|	add_torrent_params load_torrent_buffer(span<char const> buffer)                                                                                                               |
│ │ │ │ │ +|	{ return load_torrent_buffer(buffer, load_torrent_limits{}); }                                                                                                                |
│ │ │ │ │ +|	add_torrent_params load_torrent_parsed(bdecode_node const& torrent_file)                                                                                                      |
│ │ │ │ │ +|	{ return load_torrent_parsed(torrent_file, load_torrent_limits{}); }                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	scrape_reply_alert::scrape_reply_alert(aux::stack_allocator& alloc                                                                                                            |
│ │ │ │ │ -|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ -|		, int incomp, int comp, string_view u, protocol_version const v)                                                                                                             |
│ │ │ │ │ -|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ -|		, incomplete(incomp)                                                                                                                                                         |
│ │ │ │ │ -|		, complete(comp)                                                                                                                                                             |
│ │ │ │ │ -|, version(v)                                                                                                                                                                   |
│ │ │ │ │ +|add_torrent_params load_torrent_file(std::string const& filename, load_torrent_limits const& cfg)                                                                              |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ +|		add_torrent_params ret;                                                                                                                                                      |
│ │ │ │ │ +|		ret.ti = std::make_shared<torrent_info>(filename, cfg);                                                                                                                      |
│ │ │ │ │ +|		update_atp(ret);                                                                                                                                                             |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string scrape_reply_alert::message() const                                                                                                                               |
│ │ │ │ │ +|	add_torrent_params load_torrent_buffer(span<char const> buffer, load_torrent_limits const& cfg)                                                                               |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ -|		std::snprintf(ret, sizeof(ret), "%s %s scrape reply: %d %d"                                                                                                                  |
│ │ │ │ │ -|			, tracker_alert::message().c_str()                                                                                                                                          |
│ │ │ │ │ -|			, version == protocol_version::V1 ? "v1" : "v2"                                                                                                                             |
│ │ │ │ │ -|			, incomplete, complete);                                                                                                                                                    |
│ │ │ │ │ +|		add_torrent_params ret;                                                                                                                                                      |
│ │ │ │ │ +|		ret.ti = std::make_shared<torrent_info>(buffer, cfg, from_span);                                                                                                             |
│ │ │ │ │ +|		update_atp(ret);                                                                                                                                                             |
│ │ │ │ │  |		return ret;                                                                                                                                                                  |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	scrape_failed_alert::scrape_failed_alert(aux::stack_allocator& alloc                                                                                                          |
│ │ │ │ │ -|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ -|		, string_view u, protocol_version const v, error_code const& e)                                                                                                              |
│ │ │ │ │ -|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ -|		, error(e)                                                                                                                                                                   |
│ │ │ │ │ -|		, m_msg_idx()                                                                                                                                                                |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|		, msg(convert_from_native(e.message()))                                                                                                                                      |
│ │ │ │ │ -|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_4_9_3_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _i_n_t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmoovvee tthhiiss iinnttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                       |
│ │ │ │ │ -|****** ....//ssrrcc//aalleerrtt..ccpppp::449933 ******                                                                                                                                                   |
│ │ │ │ │ -|return {};                                                                                                                                                                     |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ -|		std::snprintf(ret, sizeof(ret), "%s %s scrape reply: %d %d"                                                                                                                  |
│ │ │ │ │ -|			, tracker_alert::message().c_str()                                                                                                                                          |
│ │ │ │ │ -|			, version == protocol_version::V1 ? "v1" : "v2"                                                                                                                             |
│ │ │ │ │ -|			, incomplete, complete);                                                                                                                                                    |
│ │ │ │ │ +|	add_torrent_params load_torrent_parsed(bdecode_node const& torrent_file, load_torrent_limits const& cfg)                                                                      |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		add_torrent_params ret;                                                                                                                                                      |
│ │ │ │ │ +|		ret.ti = std::make_shared<torrent_info>(torrent_file, cfg);                                                                                                                  |
│ │ │ │ │ +|		update_atp(ret);                                                                                                                                                             |
│ │ │ │ │  |		return ret;                                                                                                                                                                  |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	scrape_failed_alert::scrape_failed_alert(aux::stack_allocator& alloc                                                                                                          |
│ │ │ │ │ -|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ -|		, string_view u, protocol_version const v, error_code const& e)                                                                                                              |
│ │ │ │ │ -|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ -|		, error(e)                                                                                                                                                                   |
│ │ │ │ │ -|		, m_msg_idx()                                                                                                                                                                |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|		, msg(convert_from_native(e.message()))                                                                                                                                      |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|, version(v)                                                                                                                                                                   |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t___i_n_f_o_._c_p_p_:_8_8_7_ _ _ _|_t_h_i_s_ _s_h_o_u_l_d_ _b_e_ _c_o_n_s_i_d_e_r_e_d_ _a_ _f_a_i_l_u_r_e_,_ _a_n_d_ _t_h_e_ _._t_o_r_r_e_n_t_ _f_i_l_e_ _r_e_j_e_c_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss sshhoouulldd bbee ccoonnssiiddeerreedd aa ffaaiilluurree,, aanndd tthhee ..ttoorrrreenntt ffiillee rreejjeecctteedd **********                                                                                                |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt__iinnffoo..ccpppp::888877 ******                                                                                                                                            |
│ │ │ │ │ +|std::string ext = extension(filename);                                                                                                                                         |
│ │ │ │ │ +|			int cnt = 0;                                                                                                                                                                |
│ │ │ │ │ +|			for (;;)                                                                                                                                                                    |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				++cnt;                                                                                                                                                                     |
│ │ │ │ │ +|				char new_ext[50];                                                                                                                                                          |
│ │ │ │ │ +|				std::snprintf(new_ext, sizeof(new_ext), ".%d%s", cnt, ext.c_str());                                                                                                        |
│ │ │ │ │ +|				filename = base + new_ext;                                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	scrape_failed_alert::scrape_failed_alert(aux::stack_allocator& alloc                                                                                                          |
│ │ │ │ │ -|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ -|		, string_view u, string_view m)                                                                                                                                              |
│ │ │ │ │ -|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ -|		, error(errors::tracker_failure)                                                                                                                                             |
│ │ │ │ │ -|		, m_msg_idx(alloc.copy_string(m))                                                                                                                                            |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|		, msg(m)                                                                                                                                                                     |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|				boost::crc_optimal<32, 0x1EDC6F41, 0xFFFFFFFF, 0xFFFFFFFF, true, true> crc;                                                                                                |
│ │ │ │ │ +|				process_string_lowercase(crc, filename);                                                                                                                                   |
│ │ │ │ │ +|				std::uint32_t const new_hash = crc.checksum();                                                                                                                             |
│ │ │ │ │ +|				if (files.find(new_hash) == files.end())                                                                                                                                   |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					files.insert({new_hash, {i, 0}});                                                                                                                                         |
│ │ │ │ │ +|					break;                                                                                                                                                                    |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|				++num_collisions;                                                                                                                                                          |
│ │ │ │ │ +|				if (num_collisions > 100)                                                                                                                                                  |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	char const* scrape_failed_alert::error_message() const                                                                                                                        |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (m_msg_idx == aux::allocation_slot()) return "";                                                                                                                          |
│ │ │ │ │ -|		else return m_alloc.get().ptr(m_msg_idx);                                                                                                                                    |
│ │ │ │ │ +|			copy_on_write();                                                                                                                                                            |
│ │ │ │ │ +|			m_files.rename_file(i, filename);                                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string scrape_failed_alert::message() const                                                                                                                              |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		return tracker_alert::message() + " scrape failed: " + error_message();                                                                                                      |
│ │ │ │ │ -|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_5_3_2_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _f_i_e_l_d_ _i_n_t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmoovvee tthhiiss ffiieelldd iinnttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                 |
│ │ │ │ │ -|****** ....//ssrrcc//aalleerrtt..ccpppp::553322 ******                                                                                                                                                   |
│ │ │ │ │ -|char const* scrape_failed_alert::error_message() const                                                                                                                         |
│ │ │ │ │ +|	void torrent_info::remap_files(file_storage const& f)                                                                                                                         |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (m_msg_idx == aux::allocation_slot()) return "";                                                                                                                          |
│ │ │ │ │ -|		else return m_alloc.get().ptr(m_msg_idx);                                                                                                                                    |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string scrape_failed_alert::message() const                                                                                                                              |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		return tracker_alert::message() + " scrape failed: " + error_message();                                                                                                      |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_loaded());                                                                                                                                                 |
│ │ │ │ │ +|		// the new specified file storage must have the exact                                                                                                                        |
│ │ │ │ │ +|		// same size as the current file storage                                                                                                                                     |
│ │ │ │ │ +|		TORRENT_ASSERT(m_files.total_size() == f.total_size());                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	tracker_reply_alert::tracker_reply_alert(aux::stack_allocator& alloc                                                                                                          |
│ │ │ │ │ -|		, torrent_handle const& h, tcp::endpoint const& ep                                                                                                                           |
│ │ │ │ │ -|		, int np, protocol_version v, string_view u)                                                                                                                                 |
│ │ │ │ │ -|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ -|		, num_peers(np)                                                                                                                                                              |
│ │ │ │ │ -|, version(v)                                                                                                                                                                   |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ +|		if (m_files.total_size() != f.total_size()) return;                                                                                                                          |
│ │ │ │ │ +|		copy_on_write();                                                                                                                                                             |
│ │ │ │ │ +|		m_files = f;                                                                                                                                                                 |
│ │ │ │ │ +|		m_files.set_num_pieces(m_orig_files->num_pieces());                                                                                                                          |
│ │ │ │ │ +|		m_files.set_piece_length(m_orig_files->piece_length());                                                                                                                      |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string tracker_reply_alert::message() const                                                                                                                              |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|	// standard constructor that parses a torrent file                                                                                                                            |
│ │ │ │ │ +|	torrent_info::torrent_info(entry const& torrent_file)                                                                                                                         |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ +|		std::vector<char> tmp;                                                                                                                                                       |
│ │ │ │ │ +|		std::back_insert_iterator<std::vector<char>> out(tmp);                                                                                                                       |
│ │ │ │ │ +|_	_	_b_e_n_c_o_d_e_(_o_u_t_,_ _t_o_r_r_e_n_t___f_i_l_e_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___h_a_n_d_l_e_._c_p_p_:_4_9_9_ _|_i_n_ _C_+_+_1_4_,_ _u_s_e_ _u_n_i_q_u_e___p_t_r_ _a_n_d_ _m_o_v_e_ _i_t_ _i_n_t_o_ _t_h_e_ _l_a_m_b_d_a_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinn CC++++1144,, uussee uunniiqquuee__ppttrr aanndd mmoovvee iitt iinnttoo tthhee llaammbbddaa **********                                                                                                               |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__hhaannddllee..ccpppp::449999 ******                                                                                                                                          |
│ │ │ │ │ +|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ +|		if (params.save_path.empty())                                                                                                                                                |
│ │ │ │ │ +|			aux::throw_ex<system_error>(error_code(errors::invalid_save_path));                                                                                                         |
│ │ │ │ │  |#else                                                                                                                                                                          |
│ │ │ │ │ -|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ -|		std::snprintf(ret, sizeof(ret), "%s %s received peers: %d"                                                                                                                   |
│ │ │ │ │ -|			, tracker_alert::message().c_str()                                                                                                                                          |
│ │ │ │ │ -|			, version == protocol_version::V1 ? "v1" : "v2"                                                                                                                             |
│ │ │ │ │ -|			, num_peers);                                                                                                                                                               |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|		TORRENT_ASSERT_PRECOND(!params.save_path.empty());                                                                                                                           |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	dht_reply_alert::dht_reply_alert(aux::stack_allocator& alloc                                                                                                                  |
│ │ │ │ │ -|		, torrent_handle const& h                                                                                                                                                    |
│ │ │ │ │ -|		, int np)                                                                                                                                                                    |
│ │ │ │ │ -|		: tracker_alert(alloc, h, {}, "")                                                                                                                                            |
│ │ │ │ │ -|		, num_peers(np)                                                                                                                                                              |
│ │ │ │ │ -|	{}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	std::string dht_reply_alert::message() const                                                                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|_#_e_l_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_a_l_e_r_t_._c_p_p_:_5_7_6_ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _t_h_i_s_ _t_o_ _t_r_a_c_k_e_r___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmoovvee tthhiiss ttoo ttrraacckkeerr__aalleerrtt **********                                                                                                                                         |
│ │ │ │ │ -|****** ....//ssrrcc//aalleerrtt..ccpppp::557766 ******                                                                                                                                                   |
│ │ │ │ │ -|, num_peers(np)                                                                                                                                                                |
│ │ │ │ │ -|	{}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	std::string dht_reply_alert::message() const                                                                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		char ret[400];                                                                                                                                                               |
│ │ │ │ │ -|		std::snprintf(ret, sizeof(ret), "%s received DHT peers: %d"                                                                                                                  |
│ │ │ │ │ -|			, tracker_alert::message().c_str(), num_peers);                                                                                                                             |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION < 3                                                                                                                                                    |
│ │ │ │ │ +|		if (!params.info_hashes.has_v1() && !params.info_hashes.has_v2() && !params.ti)                                                                                              |
│ │ │ │ │ +|			params.info_hashes.v1 = params.info_hash;                                                                                                                                   |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	tracker_announce_alert::tracker_announce_alert(aux::stack_allocator& alloc                                                                                                    |
│ │ │ │ │ -|		, torrent_handle const& h, tcp::endpoint const& ep, string_view u                                                                                                            |
│ │ │ │ │ -|		, protocol_version const v, event_t const e)                                                                                                                                 |
│ │ │ │ │ -|		: tracker_alert(alloc, h, ep, u)                                                                                                                                             |
│ │ │ │ │ -|		, event(e)                                                                                                                                                                   |
│ │ │ │ │ -|, version(v)                                                                                                                                                                   |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		TORRENT_ASSERT(!u.empty());                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		// the internal torrent object keeps and mutates state in the                                                                                                                |
│ │ │ │ │ +|		// torrent_info object. We can't let that leak back to the client                                                                                                            |
│ │ │ │ │ +|		if (params.ti)                                                                                                                                                               |
│ │ │ │ │ +|			params.ti = std::make_shared<torrent_info>(*params.ti);                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string tracker_announce_alert::message() const                                                                                                                           |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|		return {};                                                                                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		static const char* const event_str[] = {"none", "completed", "started", "stopped", "paused"};                                                                                |
│ │ │ │ │ -|		return tracker_alert::message()                                                                                                                                              |
│ │ │ │ │ -|			+ (version == protocol_version::V1 ? " v1" : " v2")                                                                                                                         |
│ │ │ │ │ -|			+ " sending announce (" + event_str[static_cast<int>(event)] + ")";                                                                                                         |
│ │ │ │ │ +|		// we cannot capture a unique_ptr into a lambda in c++11, so we use a raw                                                                                                    |
│ │ │ │ │ +|		// pointer for now. async_call uses a lambda expression to post the call                                                                                                     |
│ │ │ │ │ +|		// to the main thread                                                                                                                                                        |
│ │ │ │ │ +|auto* p = new add_torrent_params(std::move(params));                                                                                                                           |
│ │ │ │ │ +|auto guard = aux::scope_end([p]{ delete p; });                                                                                                                                 |
│ │ │ │ │ +|		p->save_path = complete(p->save_path);                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|		handle_backwards_compatible_resume_data(*p);                                                                                                                                 |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	hash_failed_alert::hash_failed_alert(                                                                                                                                         |
│ │ │ │ │ -|		aux::stack_allocator& alloc                                                                                                                                                  |
│ │ │ │ │ -|		, torrent_handle const& h                                                                                                                                                    |
│ │ │ │ │ -|		, piece_index_t index)                                                                                                                                                       |
│ │ │ │ │ -|		: torrent_alert(alloc, h)                                                                                                                                                    |
│ │ │ │ │ -|		, piece_index(index)                                                                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(index >= piece_index_t(0));                                                                                                                                   |
│ │ │ │ │ +|		async_call(&session_impl::async_add_torrent, p);                                                                                                                             |
│ │ │ │ │ +|		guard.disarm();                                                                                                                                                              |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::string hash_failed_alert::message() const                                                                                                                                |
│ │ │ │ │ +|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|	// if the torrent already exists, this will throw duplicate_torrent                                                                                                           |
│ │ │ │ │ +|	torrent_handle session_handle::add_torrent(                                                                                                                                   |
│ │ │ │ │ +|		torrent_info const& ti                                                                                                                                                       |
│ │ │ │ │ +|		, std::string const& save_path                                                                                                                                               |
│ │ │ │ │ +|		, entry const& resume_data                                                                                                                                                   |
│ │ │ │ │ +|		, storage_mode_t storage_mode                                                                                                                                                |
│ │ │ │ │ +|		, bool const add_paused)                                                                                                                                                     |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG                                                                                                                                               |
│ │ │ │ │ -|_	_	_r_e_t_u_r_n_ _{_}_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_r_a_n_d_o_m_._c_p_p_:_1_4_1_ _ _ _ _ _ _ _ _ _|_i_m_p_r_o_v_e_ _c_a_l_l_i_n_g_ _R_A_N_D___b_y_t_e_s_ _m_u_l_t_i_p_l_e_ _t_i_m_e_s_,_ _u_s_i_n_g_ _f_a_l_l_b_a_c_k_ _f_o_r_ _n_o_w_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iimmpprroovvee ccaalllliinngg RRAANNDD__bbyytteess mmuullttiippllee ttiimmeess,, uussiinngg ffaallllbbaacckk ffoorr nnooww **********                                                                                                  |
│ │ │ │ │ -|****** ....//ssrrcc//rraannddoomm..ccpppp::114411 ******                                                                                                                                                  |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		void crypto_random_bytes(span<char> buffer)                                                                                                                                  |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|#ifdef TORRENT_BUILD_SIMULATOR                                                                                                                                                 |
│ │ │ │ │ -|			// In the simulator we want deterministic random numbers                                                                                                                    |
│ │ │ │ │ -|			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });                                                                                             |
│ │ │ │ │ -|#elif TORRENT_USE_CNG                                                                                                                                                          |
│ │ │ │ │ -|			aux::cng_gen_random(buffer);                                                                                                                                                |
│ │ │ │ │ -|#elif TORRENT_USE_CRYPTOAPI                                                                                                                                                    |
│ │ │ │ │ -|			// windows                                                                                                                                                                  |
│ │ │ │ │ -|			aux::crypt_gen_random(buffer);                                                                                                                                              |
│ │ │ │ │ -|#elif defined TORRENT_USE_LIBCRYPTO && !defined TORRENT_USE_WOLFSSL                                                                                                            |
│ │ │ │ │ -|// wolfSSL uses wc_RNG_GenerateBlock as the internal function for the                                                                                                          |
│ │ │ │ │ -|// openssl compatibility layer. This function API does not support                                                                                                             |
│ │ │ │ │ -|// an arbitrary buffer size (openssl does), it is limited by the                                                                                                               |
│ │ │ │ │ -|// constant RNG_MAX_BLOCK_LEN.                                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|// openssl                                                                                                                                                                     |
│ │ │ │ │ -|			int r = RAND_bytes(reinterpret_cast<unsigned char*>(buffer.data())                                                                                                          |
│ │ │ │ │ -|				, int(buffer.size()));                                                                                                                                                     |
│ │ │ │ │ -|			if (r != 1) aux::throw_ex<system_error>(errors::no_entropy);                                                                                                                |
│ │ │ │ │ -|#elif TORRENT_USE_GETRANDOM                                                                                                                                                    |
│ │ │ │ │ -|			ssize_t const r = ::getrandom(buffer.data(), static_cast<std::size_t>(buffer.size()), 0);                                                                                   |
│ │ │ │ │ -|			if (r == ssize_t(buffer.size())) return;                                                                                                                                    |
│ │ │ │ │ -|			if (r == -1 && errno != ENOSYS) aux::throw_ex<system_error>(error_code(errno, generic_category()));                                                                         |
│ │ │ │ │ -|			static dev_random dev;                                                                                                                                                      |
│ │ │ │ │ -|			dev.read(buffer);                                                                                                                                                           |
│ │ │ │ │ -|#elif TORRENT_USE_DEV_RANDOM                                                                                                                                                   |
│ │ │ │ │ -|			static dev_random dev;                                                                                                                                                      |
│ │ │ │ │ -|			dev.read(buffer);                                                                                                                                                           |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_BROKEN_RANDOM_DEVICE                                                                                                                                               |
│ │ │ │ │ -|			// even pseudo random numbers rely on being able to seed the random                                                                                                         |
│ │ │ │ │ -|			// generator                                                                                                                                                                |
│ │ │ │ │ -|#error "no entropy source available"                                                                                                                                           |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|#ifdef TORRENT_I_WANT_INSECURE_RANDOM_NUMBERS                                                                                                                                  |
│ │ │ │ │ -|			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });                                                                                             |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|#error "no secure entropy source available. If you really want insecure random numbers, define TORRENT_I_WANT_INSECURE_RANDOM_NUMBERS"                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_s_t_o_r_a_g_e___u_t_i_l_s_._c_p_p_:_2_3_0  |ideally, if we end up copying files because of a move across volumes, the source should not be deleted until they've all been       |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_c_o_p_i_e_d_._ _T_h_a_t_ _w_o_u_l_d_ _l_e_t_ _u_s_ _r_o_l_l_b_a_c_k_ _w_i_t_h_ _h_i_g_h_e_r_ _c_o_n_f_i_d_e_n_c_e_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iiddeeaallllyy,, iiff wwee eenndd uupp ccooppyyiinngg ffiilleess bbeeccaauussee ooff aa mmoovvee aaccrroossss vvoolluummeess,, tthhee ssoouurrccee sshhoouulldd nnoott bbee ddeelleetteedd uunnttiill tthheeyy''vvee aallll bbeeeenn ccooppiieedd.. TThhaatt wwoouulldd lleett uuss rroollllbbaacckk wwiitthh    |
│ │ │ │ │ -|hhiigghheerr ccoonnffiiddeennccee.. **********                                                                                                                                                       |
│ │ │ │ │ -|****** ....//ssrrcc//ssttoorraaggee__uuttiillss..ccpppp::223300 ******                                                                                                                                           |
│ │ │ │ │ -|// later                                                                                                                                                                       |
│ │ │ │ │ -|		aux::vector<bool, file_index_t> copied_files(std::size_t(f.num_files()), false);                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// track how far we got in case of an error                                                                                                                                  |
│ │ │ │ │ -|		file_index_t file_index{};                                                                                                                                                   |
│ │ │ │ │ -|		for (auto const i : f.file_range())                                                                                                                                          |
│ │ │ │ │ +|		add_torrent_params p;                                                                                                                                                        |
│ │ │ │ │ +|		p.ti = std::make_shared<torrent_info>(ti);                                                                                                                                   |
│ │ │ │ │ +|		p.save_path = save_path;                                                                                                                                                     |
│ │ │ │ │ +|		if (resume_data.type() != entry::undefined_t)                                                                                                                                |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// files moved out to absolute paths are not moved                                                                                                                          |
│ │ │ │ │ -|			if (f.file_absolute_path(i)) continue;                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			std::string const old_path = combine_path(save_path, f.file_path(i));                                                                                                       |
│ │ │ │ │ -|			std::string const new_path = combine_path(new_save_path, f.file_path(i));                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			error_code ignore;                                                                                                                                                          |
│ │ │ │ │ -|			if (flags == move_flags_t::dont_replace && exists(new_path, ignore))                                                                                                        |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				if (ret == status_t::no_error) ret = status_t::need_full_check;                                                                                                            |
│ │ │ │ │ -|				continue;                                                                                                                                                                  |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|move_file(old_path, new_path, ec);                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// if the source file doesn't exist. That's not a problem                                                                                                                   |
│ │ │ │ │ -|			// we just ignore that file                                                                                                                                                 |
│ │ │ │ │ -|			if (ec.ec == boost::system::errc::no_such_file_or_directory)                                                                                                                |
│ │ │ │ │ -|				ec.ec.clear();                                                                                                                                                             |
│ │ │ │ │ -|			else if (ec                                                                                                                                                                 |
│ │ │ │ │ -|				&& ec.ec != boost::system::errc::invalid_argument                                                                                                                          |
│ │ │ │ │ -|				&& ec.ec != boost::system::errc::permission_denied)                                                                                                                        |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				// moving the file failed                                                                                                                                                  |
│ │ │ │ │ -|				// on OSX, the error when trying to rename a file across different                                                                                                         |
│ │ │ │ │ -|				// volumes is EXDEV, which will make it fall back to copying.                                                                                                              |
│ │ │ │ │ -|				ec.ec.clear();                                                                                                                                                             |
│ │ │ │ │ -|				copy_file(old_path, new_path, ec);                                                                                                                                         |
│ │ │ │ │ -|				if (!ec) copied_files[i] = true;                                                                                                                                           |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			if (ec)                                                                                                                                                                     |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				ec.file(i);                                                                                                                                                                |
│ │ │ │ │ -|				file_index = i;                                                                                                                                                            |
│ │ │ │ │ -|				break;                                                                                                                                                                     |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ +|			bencode(std::back_inserter(p.resume_data), resume_data);                                                                                                                    |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (!ec && move_partfile)                                                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			error_code e;                                                                                                                                                               |
│ │ │ │ │ -|			move_partfile(new_save_path, e);                                                                                                                                            |
│ │ │ │ │ -|_	_	_	_i_f_ _(_e_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_s_t_o_r_a_g_e___u_t_i_l_s_._c_p_p_:_5_3_8  |it would seem reasonable to, instead, set the have_pieces bits for the pieces representing these files, and resume with the normal  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_l_o_g_i_c_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd sseeeemm rreeaassoonnaabbllee ttoo,, iinnsstteeaadd,, sseett tthhee hhaavvee__ppiieecceess bbiittss ffoorr tthhee ppiieecceess rreepprreesseennttiinngg tthheessee ffiilleess,, aanndd rreessuummee wwiitthh tthhee nnoorrmmaall llooggiicc **********                           |
│ │ │ │ │ -|****** ....//ssrrcc//ssttoorraaggee__uuttiillss..ccpppp::553388 ******                                                                                                                                           |
│ │ │ │ │ -|continue;                                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|				std::int64_t const size = get_filesize(stat, file_index, fs                                                                                                                |
│ │ │ │ │ -|					, save_path, ec);                                                                                                                                                         |
│ │ │ │ │ -|				if (size < 0) return false;                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|				if (size < fs.file_size(file_index))                                                                                                                                       |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					ec.ec = errors::mismatching_file_size;                                                                                                                                    |
│ │ │ │ │ -|					ec.file(file_index);                                                                                                                                                      |
│ │ │ │ │ -|					ec.operation = operation_t::check_resume;                                                                                                                                 |
│ │ │ │ │ -|					return false;                                                                                                                                                             |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ +|		p.storage_mode = storage_mode;                                                                                                                                               |
│ │ │ │ │ +|_	_	_i_f_ _(_a_d_d___p_a_u_s_e_d_)_ _p_._f_l_a_g_s_ _|_=_ _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_:_:_f_l_a_g___p_a_u_s_e_d_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/                       |why is this a linked list?                                                                                                          |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_u_d_p___t_r_a_c_k_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:_6_3_3_|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** wwhhyy iiss tthhiiss aa lliinnkkeedd lliisstt?? **********                                                                                                                                         |
│ │ │ │ │ +|****** ....//ssrrcc//uuddpp__ttrraacckkeerr__ccoonnnneeccttiioonn..ccpppp::663333 ******                                                                                                                                  |
│ │ │ │ │ +|ipv6_peer_entry e{};                                                                                                                                                           |
│ │ │ │ │ +|				std::memcpy(e.ip.data(), buf.data(), 16);                                                                                                                                  |
│ │ │ │ │ +|				buf = buf.subspan(16);                                                                                                                                                     |
│ │ │ │ │ +|				e.port = aux::read_uint16(buf);                                                                                                                                            |
│ │ │ │ │ +|				resp.peers6.push_back(e);                                                                                                                                                  |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ -|			return true;                                                                                                                                                                |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS                                                                                                                                       |
│ │ │ │ │ -|		// always trigger a full recheck when we pull in files from other                                                                                                            |
│ │ │ │ │ -|		// torrents, via hard links                                                                                                                                                  |
│ │ │ │ │ -|if (added_files) return false;                                                                                                                                                 |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// parse have bitmask. Verify that the files we expect to have                                                                                                               |
│ │ │ │ │ -|		// actually do exist                                                                                                                                                         |
│ │ │ │ │ -|		piece_index_t const end_piece = std::min(rd.have_pieces.end_index(), fs.end_piece());                                                                                        |
│ │ │ │ │ -|		for (piece_index_t i(0); i < end_piece; ++i)                                                                                                                                 |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (rd.have_pieces.get_bit(i) == false) continue;                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			std::vector<file_slice> f = fs.map_block(i, 0, 1);                                                                                                                          |
│ │ │ │ │ -|			TORRENT_ASSERT(!f.empty());                                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			file_index_t const file_index = f[0].file_index;                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// files with priority zero may not have been saved to disk at their                                                                                                        |
│ │ │ │ │ -|			// expected location, but is likely to be in a partfile. Just exempt it                                                                                                     |
│ │ │ │ │ -|			// from checking                                                                                                                                                            |
│ │ │ │ │ -|			if (file_index < file_priority.end_index()                                                                                                                                  |
│ │ │ │ │ -|				&& file_priority[file_index] == dont_download)                                                                                                                             |
│ │ │ │ │ -|				continue;                                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			if (fs.pad_file_at(file_index)) continue;                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			if (get_filesize(stat, file_index, fs, save_path, ec) < 0)                                                                                                                  |
│ │ │ │ │ -|				return false;                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// OK, this file existed, good. Now, skip all remaining pieces in                                                                                                           |
│ │ │ │ │ -|			// this file. We're just sanity-checking whether the files exist                                                                                                            |
│ │ │ │ │ -|			// or not.                                                                                                                                                                  |
│ │ │ │ │ -|_	_	_	_p_e_e_r___r_e_q_u_e_s_t_ _c_o_n_s_t_ _p_r_ _=_ _f_s_._m_a_p___f_i_l_e_(_f_i_l_e___i_n_d_e_x_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |this should be the global download rate                                                                                             |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_1_1_0_5_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss sshhoouulldd bbee tthhee gglloobbaall ddoowwnnllooaadd rraattee **********                                                                                                                            |
│ │ │ │ │ -|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::11110055 ******                                                                                                                                        |
│ │ │ │ │ -|		int rate = 0;                                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// if we haven't received any data recently, the current download rate                                                                                                       |
│ │ │ │ │ -|		// is not representative                                                                                                                                                     |
│ │ │ │ │ -|		if (aux::time_now() - m_last_piece.get(m_connect) > seconds(30) && m_download_rate_peak > 0)                                                                                 |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			rate = m_download_rate_peak;                                                                                                                                                |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		else if (aux::time_now() - m_last_unchoked.get(m_connect) < seconds(5)                                                                                                       |
│ │ │ │ │ -|			&& m_statistics.total_payload_upload() < 2 * 0x4000)                                                                                                                        |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// if we're have only been unchoked for a short period of time,                                                                                                             |
│ │ │ │ │ -|			// we don't know what rate we can get from this peer. Instead of assuming                                                                                                   |
│ │ │ │ │ -|			// the lowest possible rate, assume the average.                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			int peers_with_requests = int(stats_counters()[counters::num_peers_down_requests]);                                                                                         |
│ │ │ │ │ -|			// avoid division by 0                                                                                                                                                      |
│ │ │ │ │ -|			if (peers_with_requests == 0) peers_with_requests = 1;                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|rate = t->statistics().transfer_rate(stat::download_payload) / peers_with_requests;                                                                                            |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │  |		else                                                                                                                                                                         |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// current download rate in bytes per seconds                                                                                                                               |
│ │ │ │ │ -|			rate = m_statistics.transfer_rate(stat::download_payload);                                                                                                                  |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// avoid division by zero                                                                                                                                                    |
│ │ │ │ │ -|		if (rate < 50) rate = 50;                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// average of current rate and peak                                                                                                                                          |
│ │ │ │ │ -|//		rate = (rate + m_download_rate_peak) / 2;                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		return milliseconds((m_outstanding_bytes + extra_bytes                                                                                                                       |
│ │ │ │ │ -|			+ m_queued_time_critical * t->block_size() * 1000) / rate);                                                                                                                 |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void peer_connection::add_stat(std::int64_t const downloaded, std::int64_t const uploaded)                                                                                    |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|		m_statistics.add_stat(downloaded, uploaded);                                                                                                                                 |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	sha1_hash peer_connection::associated_info_hash() const                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::shared_ptr<torrent> t = associated_torrent().lock();                                                                                                                    |
│ │ │ │ │ -|		TORRENT_ASSERT(t);                                                                                                                                                           |
│ │ │ │ │ -|		auto const& ih = t->info_hash();                                                                                                                                             |
│ │ │ │ │ -|		// if protocol_v2 is set on the peer, this better be a v2 torrent,                                                                                                           |
│ │ │ │ │ -|_	_	_/_/_ _o_t_h_e_r_w_i_s_e_ _s_o_m_e_t_h_i_n_g_ _i_s_n_'_t_ _r_i_g_h_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_:   |sort the allowed fast set in priority order                                                                                         |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_3_5_3_6_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ssoorrtt tthhee aalllloowweedd ffaasstt sseett iinn pprriioorriittyy oorrddeerr **********                                                                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::33553366 ******                                                                                                                                        |
│ │ │ │ │ -|		// if the peer has the piece and we want                                                                                                                                     |
│ │ │ │ │ -|		// to download it, request it                                                                                                                                                |
│ │ │ │ │ -|		if (index < m_have_piece.end_index()                                                                                                                                         |
│ │ │ │ │ -|			&& m_have_piece[index]                                                                                                                                                      |
│ │ │ │ │ -|			&& !t->have_piece(index)                                                                                                                                                    |
│ │ │ │ │ -|			&& t->valid_metadata()                                                                                                                                                      |
│ │ │ │ │ -|			&& t->has_picker()                                                                                                                                                          |
│ │ │ │ │ -|			&& t->picker().piece_priority(index) > dont_download)                                                                                                                       |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			t->peer_is_interesting(*this);                                                                                                                                              |
│ │ │ │ │ +|			resp.peers4.reserve(static_cast<std::size_t>(num_peers));                                                                                                                   |
│ │ │ │ │ +|			for (int i = 0; i < num_peers; ++i)                                                                                                                                         |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				ipv4_peer_entry e{};                                                                                                                                                       |
│ │ │ │ │ +|				std::memcpy(e.ip.data(), buf.data(), 4);                                                                                                                                   |
│ │ │ │ │ +|				buf = buf.subspan(4);                                                                                                                                                      |
│ │ │ │ │ +|				e.port = aux::read_uint16(buf);                                                                                                                                            |
│ │ │ │ │ +|				resp.peers4.push_back(e);                                                                                                                                                  |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	std::vector<piece_index_t> const& peer_connection::allowed_fast()                                                                                                             |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|		std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(t);                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|return m_allowed_fast;                                                                                                                                                         |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	bool peer_connection::can_request_time_critical() const                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|		if (has_peer_choked() || !is_interesting()) return false;                                                                                                                    |
│ │ │ │ │ -|		if (int(m_download_queue.size()) + int(m_request_queue.size())                                                                                                               |
│ │ │ │ │ -|			> m_desired_queue_size * 2) return false;                                                                                                                                   |
│ │ │ │ │ -|		if (on_parole()) return false;                                                                                                                                               |
│ │ │ │ │ -|		if (m_disconnecting) return false;                                                                                                                                           |
│ │ │ │ │ -|		std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(t);                                                                                                                                                           |
│ │ │ │ │ -|		if (t->upload_mode()) return false;                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// ignore snubbed peers, since they're not likely to return pieces in a                                                                                                      |
│ │ │ │ │ -|		// timely manner anyway                                                                                                                                                      |
│ │ │ │ │ -|		if (m_snubbed) return false;                                                                                                                                                 |
│ │ │ │ │ -|		return true;                                                                                                                                                                 |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	bool peer_connection::make_time_critical(piece_block const& block)                                                                                                            |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|		auto const rit = std::find_if(m_request_queue.begin()                                                                                                                        |
│ │ │ │ │ -|			, m_request_queue.end(), aux::has_block(block));                                                                                                                            |
│ │ │ │ │ -|		if (rit == m_request_queue.end()) return false;                                                                                                                              |
│ │ │ │ │ -|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ -|		std::shared_ptr<torrent> t = m_torrent.lock();                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(t);                                                                                                                                                           |
│ │ │ │ │ -|_	_	_T_O_R_R_E_N_T___A_S_S_E_R_T_(_t_-_>_h_a_s___p_i_c_k_e_r_(_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/                       |move stats_counter_t out of counters                                                                                                |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._c_p_p_:_4_0_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmoovvee ssttaattss__ccoouunntteerr__tt oouutt ooff ccoouunntteerrss **********                                                                                                                               |
│ │ │ │ │ -|_**_**_**_ _.._.._//_ss_rr_cc_//_pp_ee_rr_ff_oo_rr_mm_aa_nn_cc_ee____cc_oo_uu_nn_tt_ee_rr_ss_.._cc_pp_pp_::_44_00_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/                       |should bittorrent keep-alive messages have a counter too?                                                                           |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._c_p_p_:_4_1_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** sshhoouulldd bbiittttoorrrreenntt kkeeeepp--aalliivvee mmeessssaaggeess hhaavvee aa ccoouunntteerr ttoooo?? **********                                                                                                          |
│ │ │ │ │ -|_**_**_**_ _.._.._//_ss_rr_cc_//_pp_ee_rr_ff_oo_rr_mm_aa_nn_cc_ee____cc_oo_uu_nn_tt_ee_rr_ss_.._cc_pp_pp_::_44_11_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/                       |It would be nice if this could be an internal type. default_disk_constructor depends on it now                                      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._c_p_p_:_4_2_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** IItt wwoouulldd bbee nniiccee iiff tthhiiss ccoouulldd bbee aann iinntteerrnnaall ttyyppee.. ddeeffaauulltt__ddiisskk__ccoonnssttrruuccttoorr ddeeppeennddss oonn iitt nnooww **********                                                                     |
│ │ │ │ │ -|****** ....//ssrrcc//ppeerrffoorrmmaannccee__ccoouunntteerrss..ccpppp::4422 ******                                                                                                                                     |
│ │ │ │ │ -|THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"                                                                                                    |
│ │ │ │ │ -|AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE                                                                                                      |
│ │ │ │ │ -|IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE                                                                                                     |
│ │ │ │ │ -|ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE                                                                                                       |
│ │ │ │ │ -|LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR                                                                                                            |
│ │ │ │ │ -|CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF                                                                                                           |
│ │ │ │ │ -|SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS                                                                                                       |
│ │ │ │ │ -|INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN                                                                                                        |
│ │ │ │ │ -|CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)                                                                                                        |
│ │ │ │ │ -|ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE                                                                                                     |
│ │ │ │ │ -|POSSIBILITY OF SUCH DAMAGE.                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|*/                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/performance_counters.hpp"                                                                                                                                 |
│ │ │ │ │ -|#include "libtorrent/assert.hpp"                                                                                                                                               |
│ │ │ │ │ -|#include <cstring> // for memset                                                                                                                                               |
│ │ │ │ │ +|std::list<address> ip_list;                                                                                                                                                    |
│ │ │ │ │ +|std::transform(m_endpoints.begin(), m_endpoints.end(), std::back_inserter(ip_list)                                                                                             |
│ │ │ │ │ +|			, [](tcp::endpoint const& ep) { return ep.address(); } );                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │ +|		cb->tracker_response(tracker_req(), m_target.address(), ip_list, resp);                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|counters::counters() TORRENT_COUNTER_NOEXCEPT                                                                                                                                  |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|#ifdef ATOMIC_LLONG_LOCK_FREE                                                                                                                                                  |
│ │ │ │ │ -|		for (auto& counter : m_stats_counter)                                                                                                                                        |
│ │ │ │ │ -|			counter.store(0, std::memory_order_relaxed);                                                                                                                                |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		m_stats_counter.fill(0);                                                                                                                                                     |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		close();                                                                                                                                                                     |
│ │ │ │ │ +|		return true;                                                                                                                                                                 |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	counters::counters(counters const& c) TORRENT_COUNTER_NOEXCEPT                                                                                                                |
│ │ │ │ │ +|	bool udp_tracker_connection::on_scrape_response(span<char const> buf)                                                                                                         |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef ATOMIC_LLONG_LOCK_FREE                                                                                                                                                  |
│ │ │ │ │ -|		for (int i = 0; i < m_stats_counter.end_index(); ++i)                                                                                                                        |
│ │ │ │ │ -|			m_stats_counter[i].store(                                                                                                                                                   |
│ │ │ │ │ -|				c.m_stats_counter[i].load(std::memory_order_relaxed)                                                                                                                       |
│ │ │ │ │ -|					, std::memory_order_relaxed);                                                                                                                                             |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		std::lock_guard<std::mutex> l(c.m_mutex);                                                                                                                                    |
│ │ │ │ │ -|		m_stats_counter = c.m_stats_counter;                                                                                                                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		restart_read_timeout();                                                                                                                                                      |
│ │ │ │ │ +|		auto const action = static_cast<action_t>(aux::read_int32(buf));                                                                                                             |
│ │ │ │ │ +|		std::uint32_t const transaction = aux::read_uint32(buf);                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	counters& counters::operator=(counters const& c) & TORRENT_COUNTER_NOEXCEPT                                                                                                   |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (&c == this) return *this;                                                                                                                                                |
│ │ │ │ │ -|#ifdef ATOMIC_LLONG_LOCK_FREE                                                                                                                                                  |
│ │ │ │ │ -|		for (int i = 0; i < m_stats_counter.end_index(); ++i)                                                                                                                        |
│ │ │ │ │ -|			m_stats_counter[i].store(                                                                                                                                                   |
│ │ │ │ │ -|				c.m_stats_counter[i].load(std::memory_order_relaxed)                                                                                                                       |
│ │ │ │ │ -|_	_	_	_	_	_,_ _s_t_d_:_:_m_e_m_o_r_y___o_r_d_e_r___r_e_l_a_x_e_d_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|		if (transaction != m_transaction_id)                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			fail(error_code(errors::invalid_tracker_transaction_id), operation_t::bittorrent);                                                                                          |
│ │ │ │ │ +|			return false;                                                                                                                                                               |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (action == action_t::error)                                                                                                                                               |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			fail(error_code(errors::tracker_failure), operation_t::bittorrent                                                                                                           |
│ │ │ │ │ +|				, std::string(buf.data(), static_cast<std::size_t>(buf.size())).c_str());                                                                                                  |
│ │ │ │ │ +|			return true;                                                                                                                                                                |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		if (action != action_t::scrape)                                                                                                                                              |
│ │ │ │ │ +|_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_i_e_c_e___p_i_c_k_e_r_._c_p_p_:_1_2_1_ _ _ _|_f_i_n_d_ _a_ _b_e_t_t_e_r_ _p_l_a_c_e_ _f_o_r_ _t_h_i_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** ffiinndd aa bbeetttteerr ppllaaccee ffoorr tthhiiss **********                                                                                                                                       |
│ │ │ │ │  |****** ....//ssrrcc//ppiieeccee__ppiicckkeerr..ccpppp::112211 ******                                                                                                                                            |
│ │ │ │ │  |if (limit == 0)                                                                                                                                                                |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │  |				std::cerr << " ...";                                                                                                                                                       |
│ │ │ │ │  |				break;                                                                                                                                                                     |
│ │ │ │ │ @@ -8852,14 +9543,68 @@
│ │ │ │ │  |		TORRENT_ASSERT(!m_piece_map[block.piece_index].have());                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		piece_pos& p = m_piece_map[block.piece_index];                                                                                                                               |
│ │ │ │ │  |		if (p.download_queue() == piece_pos::piece_open)                                                                                                                             |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │  |#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS                                                                                                                                      |
│ │ │ │ │  |_	_	_	_I_N_V_A_R_I_A_N_T___C_H_E_C_K_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t___p_e_e_r_._c_p_p_:_1_9_2_ _ _ _|_h_o_w_ _d_o_ _w_e_ _d_e_a_l_ _w_i_t_h_ _o_u_r_ _e_x_t_e_r_n_a_l_ _a_d_d_r_e_s_s_ _c_h_a_n_g_i_n_g_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** hhooww ddoo wwee ddeeaall wwiitthh oouurr eexxtteerrnnaall aaddddrreessss cchhaannggiinngg?? **********                                                                                                                 |
│ │ │ │ │ +|****** ....//ssrrcc//ttoorrrreenntt__ppeeeerr..ccpppp::119922 ******                                                                                                                                            |
│ │ │ │ │ +|// connections. If it fails, we'll                                                                                                                                             |
│ │ │ │ │ +|		// retry with encryption                                                                                                                                                     |
│ │ │ │ │ +|		, pe_support(false)                                                                                                                                                          |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		, is_v6_addr(false)                                                                                                                                                          |
│ │ │ │ │ +|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ +|		, is_i2p_addr(false)                                                                                                                                                         |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		, on_parole(false)                                                                                                                                                           |
│ │ │ │ │ +|		, banned(false)                                                                                                                                                              |
│ │ │ │ │ +|		, supports_utp(true) // assume peers support utp                                                                                                                             |
│ │ │ │ │ +|		, confirmed_supports_utp(false)                                                                                                                                              |
│ │ │ │ │ +|		, supports_holepunch(false)                                                                                                                                                  |
│ │ │ │ │ +|		, web_seed(false)                                                                                                                                                            |
│ │ │ │ │ +|		, protocol_v2(false)                                                                                                                                                         |
│ │ │ │ │ +|	{}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	std::uint32_t torrent_peer::rank(external_ip const& external, int external_port) const                                                                                        |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(in_use);                                                                                                                                                      |
│ │ │ │ │ +|if (peer_rank == 0)                                                                                                                                                            |
│ │ │ │ │ +|peer_rank = peer_priority(                                                                                                                                                     |
│ │ │ │ │ +|				tcp::endpoint(external.external_address(this->address()), std::uint16_t(external_port))                                                                                    |
│ │ │ │ │ +|				, tcp::endpoint(this->address(), this->port));                                                                                                                             |
│ │ │ │ │ +|		return peer_rank;                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|	std::string torrent_peer::to_string() const                                                                                                                                   |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(in_use);                                                                                                                                                      |
│ │ │ │ │ +|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ +|		if (is_i2p_addr) return dest().to_string();                                                                                                                                  |
│ │ │ │ │ +|#endif // TORRENT_USE_I2P                                                                                                                                                      |
│ │ │ │ │ +|		return address().to_string();                                                                                                                                                |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	std::int64_t torrent_peer::total_download() const                                                                                                                             |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(in_use);                                                                                                                                                      |
│ │ │ │ │ +|		if (connection != nullptr)                                                                                                                                                   |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			TORRENT_ASSERT(prev_amount_download == 0);                                                                                                                                  |
│ │ │ │ │ +|			return connection->statistics().total_payload_download();                                                                                                                   |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			return std::int64_t(prev_amount_download) << 10;                                                                                                                            |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_c_r_e_a_t_e___t_o_r_r_e_n_t_._c_p_p_:_6_1_8_ _|_t_h_i_s_ _c_a_n_ _b_e_ _o_p_t_i_m_i_z_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** tthhiiss ccaann bbee ooppttiimmiizzeedd **********                                                                                                                                              |
│ │ │ │ │  |****** ....//ssrrcc//ccrreeaattee__ttoorrrreenntt..ccpppp::661188 ******                                                                                                                                          |
│ │ │ │ │  |std::string& attr = e["attr"].string();                                                                                                                                        |
│ │ │ │ │  |		if (flags & file_storage::flag_pad_file) attr += 'p';                                                                                                                        |
│ │ │ │ │  |		if (flags & file_storage::flag_hidden) attr += 'h';                                                                                                                          |
│ │ │ │ │  |		if (flags & file_storage::flag_executable) attr += 'x';                                                                                                                      |
│ │ │ │ │ @@ -8906,1624 +9651,879 @@
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		if (!m_nodes.empty())                                                                                                                                                        |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │  |			entry& nodes = dict["nodes"];                                                                                                                                               |
│ │ │ │ │  |			entry::list_type& nodes_list = nodes.list();                                                                                                                                |
│ │ │ │ │  |			for (auto const& n : m_nodes)                                                                                                                                               |
│ │ │ │ │  |_	_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_9_5_1_ _ _ _ _ _ _ _|_t_h_i_s_ _c_o_u_l_d_ _b_e_ _o_p_t_i_m_i_z_e_d_ _b_y_ _l_o_o_k_i_n_g_ _u_p_ _w_h_i_c_h_ _f_i_l_e_s_ _a_r_e_ _c_o_m_p_l_e_t_e_ _a_n_d_ _j_u_s_t_ _l_o_o_k_ _a_t_ _t_h_o_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ccoouulldd bbee ooppttiimmiizzeedd bbyy llooookkiinngg uupp wwhhiicchh ffiilleess aarree ccoommpplleettee aanndd jjuusstt llooookk aatt tthhoossee **********                                                                              |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::11995511 ******                                                                                                                                                |
│ │ │ │ │ -|//				TORRENT_ASSERT(picker().have_piece(i));                                                                                                                                  |
│ │ │ │ │ -|				we_have(i);                                                                                                                                                                |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		set_state(torrent_status::checking_resume_data);                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		aux::vector<std::string, file_index_t> links;                                                                                                                                |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS                                                                                                                                       |
│ │ │ │ │ -|		if (!m_torrent_file->similar_torrents().empty()                                                                                                                              |
│ │ │ │ │ -|			|| !m_torrent_file->collections().empty())                                                                                                                                  |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			resolve_links res(m_torrent_file);                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			for (auto const& ih : m_torrent_file->similar_torrents())                                                                                                                   |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				std::shared_ptr<torrent> t = m_ses.find_torrent(info_hash_t(ih)).lock();                                                                                                   |
│ │ │ │ │ -|				if (!t) continue;                                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|				// Only attempt to reuse files from torrents that are seeding.                                                                                                             |
│ │ │ │ │ -|if (!t->is_seed()) continue;                                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|				res.match(t->get_torrent_file(), t->save_path());                                                                                                                          |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			for (auto const& c : m_torrent_file->collections())                                                                                                                         |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				std::vector<std::shared_ptr<torrent>> ts = m_ses.find_collection(c);                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|				for (auto const& t : ts)                                                                                                                                                   |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|_	_	_	_	_	_/_/_ _O_n_l_y_ _a_t_t_e_m_p_t_ _t_o_ _r_e_u_s_e_ _f_i_l_e_s_ _f_r_o_m_ _t_o_r_r_e_n_t_s_ _t_h_a_t_ _a_r_e_ _s_e_e_d_i_n_g_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_9_6_4_ _ _ _ _ _ _ _|_t_h_i_s_ _c_o_u_l_d_ _b_e_ _o_p_t_i_m_i_z_e_d_ _b_y_ _l_o_o_k_i_n_g_ _u_p_ _w_h_i_c_h_ _f_i_l_e_s_ _a_r_e_ _c_o_m_p_l_e_t_e_ _a_n_d_ _j_u_s_t_ _l_o_o_k_ _a_t_ _t_h_o_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ccoouulldd bbee ooppttiimmiizzeedd bbyy llooookkiinngg uupp wwhhiicchh ffiilleess aarree ccoommpplleettee aanndd jjuusstt llooookk aatt tthhoossee **********                                                                              |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::11996644 ******                                                                                                                                                |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|			resolve_links res(m_torrent_file);                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			for (auto const& ih : m_torrent_file->similar_torrents())                                                                                                                   |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				std::shared_ptr<torrent> t = m_ses.find_torrent(info_hash_t(ih)).lock();                                                                                                   |
│ │ │ │ │ -|				if (!t) continue;                                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|				// Only attempt to reuse files from torrents that are seeding.                                                                                                             |
│ │ │ │ │ -|				if (!t->is_seed()) continue;                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|				res.match(t->get_torrent_file(), t->save_path());                                                                                                                          |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			for (auto const& c : m_torrent_file->collections())                                                                                                                         |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_a_g_n_e_t___u_r_i_._c_p_p_:_4_3_9_ _ _ _ _ _|_w_h_a_t_'_s_ _t_h_e_ _r_i_g_h_t_ _n_u_m_b_e_r_ _h_e_r_e_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** wwhhaatt''ss tthhee rriigghhtt nnuummbbeerr hheerree?? **********                                                                                                                                      |
│ │ │ │ │ +|****** ....//ssrrcc//mmaaggnneett__uurrii..ccpppp::443399 ******                                                                                                                                              |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|			else if (string_equal_no_case(name, "so"_sv)) // select-only (files)                                                                                                        |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				std::vector<std::shared_ptr<torrent>> ts = m_ses.find_collection(c);                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|				for (auto const& t : ts)                                                                                                                                                   |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					// Only attempt to reuse files from torrents that are seeding.                                                                                                            |
│ │ │ │ │ -|if (!t->is_seed()) continue;                                                                                                                                                   |
│ │ │ │ │ +|				// accept only digits, '-' and ','                                                                                                                                         |
│ │ │ │ │ +|				if (std::any_of(value.begin(), value.end(), [](char c)                                                                                                                     |
│ │ │ │ │ +|					{ return !is_digit(c) && c != '-' && c != ','; }))                                                                                                                        |
│ │ │ │ │ +|					continue;                                                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|					res.match(t->get_torrent_file(), t->save_path());                                                                                                                         |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ +|				// make sure all file priorities are set to 0, except the ones                                                                                                             |
│ │ │ │ │ +|				// we specify in the file_priorities                                                                                                                                       |
│ │ │ │ │ +|				p.flags |= torrent_flags::default_dont_download;                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			std::vector<resolve_links::link_t> const& l = res.get_links();                                                                                                              |
│ │ │ │ │ -|			if (!l.empty())                                                                                                                                                             |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				links.resize(m_torrent_file->files().num_files());                                                                                                                         |
│ │ │ │ │ -|				for (auto const& i : l)                                                                                                                                                    |
│ │ │ │ │ +|				do                                                                                                                                                                         |
│ │ │ │ │  |				{                                                                                                                                                                          |
│ │ │ │ │ -|					if (!i.ti) continue;                                                                                                                                                      |
│ │ │ │ │ -|					links[i.file_idx] = combine_path(i.save_path                                                                                                                              |
│ │ │ │ │ -|						, i.ti->files().file_path(i.file_idx));                                                                                                                                  |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|#endif // TORRENT_DISABLE_MUTABLE_TORRENTS                                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ -|		TORRENT_ASSERT(m_outstanding_check_files == false);                                                                                                                          |
│ │ │ │ │ -|		m_outstanding_check_files = true;                                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (!m_add_torrent_params || !(m_add_torrent_params->flags & torrent_flags::no_verify_files))                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_ses.disk_thread().async_check_files(                                                                                                                                      |
│ │ │ │ │ -|				m_storage, m_add_torrent_params ? m_add_torrent_params.get() : nullptr                                                                                                     |
│ │ │ │ │ -|				, std::move(links), [self = shared_from_this()](status_t st, storage_error const& error)                                                                                   |
│ │ │ │ │ -|_	_	_	_	_{_ _s_e_l_f_-_>_o_n___r_e_s_u_m_e___d_a_t_a___c_h_e_c_k_e_d_(_s_t_,_ _e_r_r_o_r_)_;_ _}_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_2_7_2_8       |this pattern is repeated in a few places. Factor this into a function and generalize the concept of a torrent having a dedicated    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_l_i_s_t_e_n_ _p_o_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ppaatttteerrnn iiss rreeppeeaatteedd iinn aa ffeeww ppllaacceess.. FFaaccttoorr tthhiiss iinnttoo aa ffuunnccttiioonn aanndd ggeenneerraalliizzee tthhee ccoonncceepptt ooff aa ttoorrrreenntt hhaavviinngg aa ddeeddiiccaatteedd lliisstteenn ppoorrtt **********                       |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::22772288 ******                                                                                                                                                |
│ │ │ │ │ -|// not ready for peers. Except, if we don't have metadata,                                                                                                                     |
│ │ │ │ │ -|		// we need peers to download from                                                                                                                                            |
│ │ │ │ │ -|		if (!m_files_checked && valid_metadata()) return;                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (!m_announce_to_lsd) return;                                                                                                                                              |
│ │ │ │ │ +|					string_view token;                                                                                                                                                        |
│ │ │ │ │ +|					std::tie(token, value) = split_string(value, ',');                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// private torrents are never announced on LSD                                                                                                                               |
│ │ │ │ │ -|		if (m_torrent_file->is_valid() && m_torrent_file->priv()) return;                                                                                                            |
│ │ │ │ │ +|					if (token.empty()) continue;                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ -|		// i2p torrents are also never announced on LSD                                                                                                                              |
│ │ │ │ │ -|		// unless we allow mixed swarms                                                                                                                                              |
│ │ │ │ │ -|		if (is_i2p() && !settings().get_bool(settings_pack::allow_i2p_mixed))                                                                                                        |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|					int idx1, idx2;                                                                                                                                                           |
│ │ │ │ │ +|constexpr int max_index = 10000; // can't risk out of memory                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (is_paused()) return;                                                                                                                                                     |
│ │ │ │ │ +|					auto const divider = token.find_first_of('-');                                                                                                                            |
│ │ │ │ │ +|					if (divider != std::string::npos) // it's a range                                                                                                                         |
│ │ │ │ │ +|					{                                                                                                                                                                         |
│ │ │ │ │ +|						if (divider == 0) // no start index                                                                                                                                      |
│ │ │ │ │ +|							continue;                                                                                                                                                               |
│ │ │ │ │ +|						if (divider == token.size() - 1) // no end index                                                                                                                         |
│ │ │ │ │ +|							continue;                                                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (!m_ses.has_lsd()) return;                                                                                                                                                |
│ │ │ │ │ +|						idx1 = std::atoi(token.substr(0, divider).to_string().c_str());                                                                                                          |
│ │ │ │ │ +|						if (idx1 < 0 || idx1 > max_index) // invalid index                                                                                                                       |
│ │ │ │ │ +|							continue;                                                                                                                                                               |
│ │ │ │ │ +|						idx2 = std::atoi(token.substr(divider + 1).to_string().c_str());                                                                                                         |
│ │ │ │ │ +|						if (idx2 < 0 || idx2 > max_index) // invalid index                                                                                                                       |
│ │ │ │ │ +|							continue;                                                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ -|int port = is_ssl_torrent() ? m_ses.ssl_listen_port() : m_ses.listen_port();                                                                                                   |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		int port = m_ses.listen_port();                                                                                                                                              |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|						if (idx1 > idx2) // wrong range limits                                                                                                                                   |
│ │ │ │ │ +|							continue;                                                                                                                                                               |
│ │ │ │ │ +|					}                                                                                                                                                                         |
│ │ │ │ │ +|					else // it's an index                                                                                                                                                     |
│ │ │ │ │ +|					{                                                                                                                                                                         |
│ │ │ │ │ +|						idx1 = std::atoi(token.to_string().c_str());                                                                                                                             |
│ │ │ │ │ +|						if (idx1 < 0 || idx1 > max_index) // invalid index                                                                                                                       |
│ │ │ │ │ +|							continue;                                                                                                                                                               |
│ │ │ │ │ +|						idx2 = idx1;                                                                                                                                                             |
│ │ │ │ │ +|					}                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// announce with the local discovery service                                                                                                                                 |
│ │ │ │ │ -|		m_torrent_file->info_hashes().for_each([&](sha1_hash const& ih, protocol_version)                                                                                            |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_ses.announce_lsd(ih, port);                                                                                                                                               |
│ │ │ │ │ -|		});                                                                                                                                                                          |
│ │ │ │ │ +|					if (int(p.file_priorities.size()) <= idx2)                                                                                                                                |
│ │ │ │ │ +|_	_	_	_	_	_	_p_._f_i_l_e___p_r_i_o_r_i_t_i_e_s_._r_e_s_i_z_e_(_s_t_a_t_i_c___c_a_s_t_<_s_t_d_:_:_s_i_z_e___t_>_(_i_d_x_2_)_ _+_ _1_,_ _d_o_n_t___d_o_w_n_l_o_a_d_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_6_1_5_ _ _ _|_c_o_m_e_ _u_p_ _w_i_t_h_ _s_o_m_e_ _a_b_s_t_r_a_c_t_i_o_n_ _t_o_ _d_o_ _t_h_i_s_ _f_o_r_ _g_n_u_t_l_s_ _a_s_ _w_e_l_l_ _l_o_a_d_ _c_e_r_t_i_f_i_c_a_t_e_s_ _f_r_o_m_ _t_h_e_ _w_i_n_d_o_w_s_ _s_y_s_t_e_m_ _c_e_r_t_i_f_i_c_a_t_e_ _s_t_o_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ccoommee uupp wwiitthh ssoommee aabbssttrraaccttiioonn ttoo ddoo tthhiiss ffoorr ggnnuuttllss aass wweellll llooaadd cceerrttiiffiiccaatteess ffrroomm tthhee wwiinnddoowwss ssyysstteemm cceerrttiiffiiccaattee ssttoorree **********                                            |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::661155 ******                                                                                                                                            |
│ │ │ │ │ +|pause();                                                                                                                                                                       |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::dht_announce()                                                                                                                                                  |
│ │ │ │ │ +|	// This function is called by the creating thread, not in the message loop's                                                                                                  |
│ │ │ │ │ +|	// io_context thread.                                                                                                                                                         |
│ │ │ │ │ +|	void session_impl::start_session()                                                                                                                                            |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|		if (!m_ses.dht())                                                                                                                                                            |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|			debug_log("DHT: no dht initialized");                                                                                                                                       |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		if (!should_announce_dht())                                                                                                                                                  |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │  |#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|			if (should_log())                                                                                                                                                           |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|_#_i_f_ _T_O_R_R_E_N_T___U_S_E___I_2_P_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_3_8_8_5_ _ _ _ _ _ _ _|_a_d_d_ _o_n_e_ _p_e_e_r_ _p_e_r_ _I_P_ _t_h_e_ _h_o_s_t_n_a_m_e_ _r_e_s_o_l_v_e_s_ _t_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** aadddd oonnee ppeeeerr ppeerr IIPP tthhee hhoossttnnaammee rreessoollvveess ttoo **********                                                                                                                       |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::33888855 ******                                                                                                                                                |
│ │ │ │ │ -|catch (...) { handle_exception(); }                                                                                                                                            |
│ │ │ │ │ +|		session_log("start session");                                                                                                                                                |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::on_peer_name_lookup(error_code const& e                                                                                                                         |
│ │ │ │ │ -|		, std::vector<address> const& host_list, int const port                                                                                                                      |
│ │ │ │ │ -|		, protocol_version const v) try                                                                                                                                              |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		COMPLETE_ASYNC("torrent::on_peer_name_lookup");                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ +|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ +|		m_ssl_ctx.set_default_verify_paths(ec);                                                                                                                                      |
│ │ │ │ │  |#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (e && should_log())                                                                                                                                                       |
│ │ │ │ │ -|			debug_log("peer name lookup error: %s", e.message().c_str());                                                                                                               |
│ │ │ │ │ +|		if (ec) session_log("SSL set_default verify_paths failed: %s", ec.message().c_str());                                                                                        |
│ │ │ │ │ +|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (e || m_abort || host_list.empty() || m_ses.is_aborted()) return;                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|tcp::endpoint host(host_list.front(), std::uint16_t(port));                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_ip_filter && m_ip_filter->access(host.address()) & ip_filter::blocked)                                                                                                 |
│ │ │ │ │ +|#if defined TORRENT_WINDOWS && defined TORRENT_USE_OPENSSL && !defined TORRENT_WINRT                                                                                           |
│ │ │ │ │ +|X509_STORE* store = X509_STORE_new();                                                                                                                                          |
│ │ │ │ │ +|if (store)                                                                                                                                                                     |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|			if (should_log())                                                                                                                                                           |
│ │ │ │ │ +|			HCERTSTORE system_store = CertOpenSystemStoreA(0, "ROOT");                                                                                                                  |
│ │ │ │ │ +|			// this is best effort                                                                                                                                                      |
│ │ │ │ │ +|			if (system_store)                                                                                                                                                           |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				debug_log("blocked ip from tracker: %s", host.address().to_string().c_str());                                                                                              |
│ │ │ │ │ +|				CERT_CONTEXT const* ctx = nullptr;                                                                                                                                         |
│ │ │ │ │ +|				while ((ctx = CertEnumCertificatesInStore(system_store, ctx)) != nullptr)                                                                                                  |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					unsigned char const* cert_ptr = reinterpret_cast<unsigned char const*>(ctx->pbCertEncoded);                                                                               |
│ │ │ │ │ +|					X509* x509 = d2i_X509(nullptr, &cert_ptr, ctx->cbCertEncoded);                                                                                                            |
│ │ │ │ │ +|					// this is best effort                                                                                                                                                    |
│ │ │ │ │ +|					if (!x509) continue;                                                                                                                                                      |
│ │ │ │ │ +|					X509_STORE_add_cert(store, x509);                                                                                                                                         |
│ │ │ │ │ +|					X509_free(x509);                                                                                                                                                          |
│ │ │ │ │ +|				}                                                                                                                                                                          |
│ │ │ │ │ +|				CertFreeCertificateContext(ctx);                                                                                                                                           |
│ │ │ │ │ +|				CertCloseStore(system_store, 0);                                                                                                                                           |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			if (m_ses.alerts().should_post<peer_blocked_alert>())                                                                                                                       |
│ │ │ │ │ -|				m_ses.alerts().emplace_alert<peer_blocked_alert>(get_handle()                                                                                                              |
│ │ │ │ │ -|					, host, peer_blocked_alert::ip_filter);                                                                                                                                   |
│ │ │ │ │ -|			return;                                                                                                                                                                     |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (add_peer(host, peer_info::tracker, v == protocol_version::V2 ? pex_lt_v2 : pex_flags_t(0)))                                                                              |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			state_updated();                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|			if (should_log())                                                                                                                                                           |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				debug_log("name-lookup add_peer() [ %s ] connect-candidates: %d"                                                                                                           |
│ │ │ │ │ -|					, host.address().to_string().c_str()                                                                                                                                      |
│ │ │ │ │ -|					, m_peer_list ? m_peer_list->num_connect_candidates() : -1);                                                                                                              |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ +|		SSL_CTX* ssl_ctx = m_ssl_ctx.native_handle();                                                                                                                                |
│ │ │ │ │ +|		SSL_CTX_set_cert_store(ssl_ctx, store);                                                                                                                                      |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|#ifdef __APPLE__                                                                                                                                                               |
│ │ │ │ │ +|		m_ssl_ctx.load_verify_file("/etc/ssl/cert.pem", ec);                                                                                                                         |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		if (ec) session_log("SSL load_verify_file failed: %s", ec.message().c_str());                                                                                                |
│ │ │ │ │ +|		ec.clear();                                                                                                                                                                  |
│ │ │ │ │ +|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_1_4_8_4_ _ _|_i_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _r_e_s_e_r_v_e_(_)_ _t_h_e_s_e_ _v_e_c_t_o_r_s_ _u_p_ _f_r_o_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd bbee nniiccee ttoo rreesseerrvvee(()) tthheessee vveeccttoorrss uupp ffrroonntt **********                                                                                                               |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::11448844 ******                                                                                                                                           |
│ │ │ │ │ +|bandwidth_channel* ch = &p->channel[peer_connection::download_channel];                                                                                                        |
│ │ │ │ │ +|			if (use_quota_overhead(ch, amount_down))                                                                                                                                    |
│ │ │ │ │ +|				ret |= 1 << peer_connection::download_channel;                                                                                                                             |
│ │ │ │ │ +|			ch = &p->channel[peer_connection::upload_channel];                                                                                                                          |
│ │ │ │ │ +|			if (use_quota_overhead(ch, amount_up))                                                                                                                                      |
│ │ │ │ │ +|				ret |= 1 << peer_connection::upload_channel;                                                                                                                               |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		update_want_peers();                                                                                                                                                         |
│ │ │ │ │ -|_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_4_5_8_1_ _ _ _ _ _ _ _|_o_n_l_y_ _d_o_ _t_h_i_s_ _i_f_ _t_h_e_ _p_i_e_c_e_ _s_i_z_e_ _>_ _1_ _b_l_o_c_k_s_ _T_h_i_s_ _i_s_ _a_ _v_2_ _t_o_r_r_e_n_t_ _s_o_ _w_e_ _c_a_n_ _r_e_q_u_e_s_t_ _g_e_t_ _b_l_o_c_k_ _l_e_v_e_l_ _h_a_s_h_e_s_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** oonnllyy ddoo tthhiiss iiff tthhee ppiieeccee ssiizzee >> 11 bblloocckkss TThhiiss iiss aa vv22 ttoorrrreenntt ssoo wwee ccaann rreeqquueesstt ggeett bblloocckk lleevveell hhaasshheess.. **********                                                           |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::44558811 ******                                                                                                                                                |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|			std::set<torrent_peer*> ret;                                                                                                                                                |
│ │ │ │ │ -|			if (!blocks.empty() && !downloaders.empty())                                                                                                                                |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				for (auto const b : blocks) ret.insert(downloaders[std::size_t(b)]);                                                                                                       |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				std::copy(downloaders.begin(), downloaders.end(), std::inserter(ret, ret.begin()));                                                                                        |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			return ret;                                                                                                                                                                 |
│ │ │ │ │ -|		}();                                                                                                                                                                         |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// if this piece wasn't downloaded from peers, we just found it on disk.                                                                                                     |
│ │ │ │ │ -|		// In that case, we should just consider it as "not-have" and there's no                                                                                                     |
│ │ │ │ │ -|		// need to try to get higher fidelity hashes (yet)                                                                                                                           |
│ │ │ │ │ -|		bool const found_on_disk = peers.size() == 1 && peers.count(nullptr);                                                                                                        |
│ │ │ │ │ +|	// session_impl is responsible for deleting 'pack'                                                                                                                            |
│ │ │ │ │ +|	void session_impl::apply_settings_pack(std::shared_ptr<settings_pack> pack)                                                                                                   |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|		apply_settings_pack_impl(*pack);                                                                                                                                             |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (!torrent_file().info_hashes().has_v1() && blocks.empty() && !found_on_disk)                                                                                              |
│ │ │ │ │ +|	settings_pack session_impl::get_settings() const                                                                                                                              |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		settings_pack ret;                                                                                                                                                           |
│ │ │ │ │ +|for (int i = settings_pack::string_type_base;                                                                                                                                  |
│ │ │ │ │ +|i < settings_pack::max_string_setting_internal; ++i)                                                                                                                           |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|verify_block_hashes(index);                                                                                                                                                    |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// the below code is penalizing peers that sent use bad data.                                                                                                                |
│ │ │ │ │ -|		// increase the total amount of failed bytes                                                                                                                                 |
│ │ │ │ │ -|		if (!found_on_disk)                                                                                                                                                          |
│ │ │ │ │ +|			ret.set_str(i, m_settings.get_str(i));                                                                                                                                      |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		for (int i = settings_pack::int_type_base;                                                                                                                                   |
│ │ │ │ │ +|			i < settings_pack::max_int_setting_internal; ++i)                                                                                                                           |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (blocks.empty())                                                                                                                                                         |
│ │ │ │ │ -|				add_failed_bytes(m_torrent_file->piece_size(index));                                                                                                                       |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ -|				add_failed_bytes(static_cast<int>(blocks.size()) * default_block_size);                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_EXTENSIONS                                                                                                                                             |
│ │ │ │ │ -|			for (auto& ext : m_extensions)                                                                                                                                              |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				ext->on_piece_failed(index);                                                                                                                                               |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			ret.set_int(i, m_settings.get_int(i));                                                                                                                                      |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		for (int i = settings_pack::bool_type_base;                                                                                                                                  |
│ │ │ │ │ +|			i < settings_pack::max_bool_setting_internal; ++i)                                                                                                                          |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			ret.set_bool(i, m_settings.get_bool(i));                                                                                                                                    |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// did we receive this piece from a single peer?                                                                                                                            |
│ │ │ │ │ -|			// if we know exactly which blocks failed the hash, we can also be certain                                                                                                  |
│ │ │ │ │ -|			// that all peers in the list sent us bad data                                                                                                                              |
│ │ │ │ │ -|			bool const known_bad_peer = (!found_on_disk && peers.size() == 1) || !blocks.empty();                                                                                       |
│ │ │ │ │ +|namespace {                                                                                                                                                                    |
│ │ │ │ │ +|	template <typename Pack>                                                                                                                                                      |
│ │ │ │ │ +|	int get_setting_impl(Pack const& p, int name, int*)                                                                                                                           |
│ │ │ │ │ +|	{ return p.get_int(name); }                                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			penalize_peers(peers, index, known_bad_peer);                                                                                                                               |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|	template <typename Pack>                                                                                                                                                      |
│ │ │ │ │ +|	bool get_setting_impl(Pack const& p, int name, bool*)                                                                                                                         |
│ │ │ │ │ +|	{ return p.get_bool(name); }                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// If m_storage isn't set here, it means we're shutting down                                                                                                                 |
│ │ │ │ │ -|		if (m_storage)                                                                                                                                                               |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|_	_	_	_/_/_ _i_t_ _d_o_e_s_n_'_t_ _m_a_k_e_ _m_u_c_h_ _s_e_n_s_e_ _t_o_ _f_a_i_l_ _t_o_ _h_a_s_h_ _a_ _p_i_e_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_7_5_2_5_ _ _ _ _ _ _ _|_c_o_m_e_ _u_p_ _w_i_t_h_ _a_ _b_e_t_t_e_r_ _w_a_y_ _o_f_ _d_o_i_n_g_ _t_h_i_s_,_ _i_n_s_t_e_a_d_ _o_f_ _a_n_ _i_m_m_e_d_i_a_t_e_l_y_ _i_n_v_o_k_e_d_ _l_a_m_b_d_a_ _e_x_p_r_e_s_s_i_o_n_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ccoommee uupp wwiitthh aa bbeetttteerr wwaayy ooff ddooiinngg tthhiiss,, iinnsstteeaadd ooff aann iimmmmeeddiiaatteellyy iinnvvookkeedd llaammbbddaa eexxpprreessssiioonn.. **********                                                                      |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::77552255 ******                                                                                                                                                |
│ │ │ │ │ -||| peerinfo->confirmed_supports_utp))                                                                                                                                          |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				sm = m_ses.utp_socket_manager();                                                                                                                                           |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ +|	template <typename Pack>                                                                                                                                                      |
│ │ │ │ │ +|	std::string get_setting_impl(Pack const& p, int name, std::string*)                                                                                                           |
│ │ │ │ │ +|_	_{_ _r_e_t_u_r_n_ _p_._g_e_t___s_t_r_(_n_a_m_e_)_;_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_1_9_9_8  |could this function be merged with expand_unspecified_addresses? right now both listen_endpoint_t and listen_interface_t are almost |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_i_d_e_n_t_i_c_a_l_,_ _m_a_y_b_e_ _t_h_e_ _l_a_t_t_e_r_ _c_o_u_l_d_ _b_e_ _r_e_m_o_v_e_d_ _t_o_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ccoouulldd tthhiiss ffuunnccttiioonn bbee mmeerrggeedd wwiitthh eexxppaanndd__uunnssppeecciiffiieedd__aaddddrreesssseess?? rriigghhtt nnooww bbootthh lliisstteenn__eennddppooiinntt__tt aanndd lliisstteenn__iinntteerrffaaccee__tt aarree aallmmoosstt iiddeennttiiccaall,, mmaayybbee tthhee llaatttteerr ccoouulldd bbee |
│ │ │ │ │ +|rreemmoovveedd ttoooo **********                                                                                                                                                              |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::11999988 ******                                                                                                                                           |
│ │ │ │ │ +|session_log("FATAL SESSION ERROR (%s : %d) [%s]"                                                                                                                               |
│ │ │ │ │ +|			, ec.category().name(), ec.value(), ec.message().c_str());                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		this->abort();                                                                                                                                                               |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// don't make a TCP connection if it's disabled                                                                                                                             |
│ │ │ │ │ -|			if (sm == nullptr && !settings().get_bool(settings_pack::enable_outgoing_tcp))                                                                                              |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ +|	void session_impl::on_ip_change(error_code const& ec)                                                                                                                         |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │  |#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|				if (should_log())                                                                                                                                                          |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					debug_log("discarding peer \"%s\": TCP connections disabled "                                                                                                             |
│ │ │ │ │ -|						"[ supports-utp: %d ]", peerinfo->to_string().c_str()                                                                                                                    |
│ │ │ │ │ -|						, peerinfo->supports_utp);                                                                                                                                               |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ +|		if (!ec)                                                                                                                                                                     |
│ │ │ │ │ +|			session_log("received ip change from internal ip_notifier");                                                                                                                |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │ +|			session_log("received error on_ip_change: %d, %s", ec.value(), ec.message().c_str());                                                                                       |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|				return false;                                                                                                                                                              |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|		if (ec || m_abort || !m_ip_notifier) return;                                                                                                                                 |
│ │ │ │ │ +|		m_ip_notifier->async_wait([this] (error_code const& e)                                                                                                                       |
│ │ │ │ │ +|			{ wrap(&session_impl::on_ip_change, e); });                                                                                                                                 |
│ │ │ │ │ +|		reopen_network_sockets({});                                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|aux::socket_type s = [&] {                                                                                                                                                     |
│ │ │ │ │ +|void interface_to_endpoints(listen_interface_t const& iface                                                                                                                    |
│ │ │ │ │ +|, listen_socket_flags_t flags                                                                                                                                                  |
│ │ │ │ │ +|		, span<ip_interface const> const ifs                                                                                                                                         |
│ │ │ │ │ +|		, std::vector<listen_endpoint_t>& eps)                                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		flags |= iface.local ? listen_socket_t::local_network : listen_socket_flags_t{};                                                                                             |
│ │ │ │ │ +|		transport const ssl = iface.ssl ? transport::ssl : transport::plaintext;                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ -|		if (peerinfo->is_i2p_addr)                                                                                                                                                   |
│ │ │ │ │ +|		// First, check to see if it's an IP address                                                                                                                                 |
│ │ │ │ │ +|		error_code err;                                                                                                                                                              |
│ │ │ │ │ +|		address const adr = make_address(iface.device.c_str(), err);                                                                                                                 |
│ │ │ │ │ +|		if (!err)                                                                                                                                                                    |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// It's not entirely obvious why this peer connection is not marked as                                                                                                      |
│ │ │ │ │ -|			// one. The main feature of a peer connection is that whether or not we                                                                                                     |
│ │ │ │ │ -|			// proxy it is configurable. When we use i2p, we want to always prox                                                                                                        |
│ │ │ │ │ -|			// everything via i2p.                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			aux::proxy_settings proxy;                                                                                                                                                  |
│ │ │ │ │ -|			proxy.hostname = settings().get_str(settings_pack::i2p_hostname);                                                                                                           |
│ │ │ │ │ -|			proxy.port = std::uint16_t(settings().get_int(settings_pack::i2p_port));                                                                                                    |
│ │ │ │ │ -|			proxy.type = settings_pack::i2p_proxy;                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			aux::socket_type ret = instantiate_connection(m_ses.get_context()                                                                                                           |
│ │ │ │ │ -|				, proxy, nullptr, nullptr, false, false);                                                                                                                                  |
│ │ │ │ │ -|			i2p_stream& str = boost::get<i2p_stream>(ret);                                                                                                                              |
│ │ │ │ │ -|			str.set_local_i2p_endpoint(m_ses.local_i2p_endpoint());                                                                                                                     |
│ │ │ │ │ -|			str.set_destination(static_cast<i2p_peer*>(peerinfo)->dest());                                                                                                              |
│ │ │ │ │ -|			str.set_command(i2p_stream::cmd_connect);                                                                                                                                   |
│ │ │ │ │ -|			str.set_session_id(m_ses.i2p_session());                                                                                                                                    |
│ │ │ │ │ -|			return ret;                                                                                                                                                                 |
│ │ │ │ │ +|			eps.emplace_back(adr, iface.port, std::string{}, ssl, flags);                                                                                                               |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |		else                                                                                                                                                                         |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			void* userdata = nullptr;                                                                                                                                                   |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ -|			if (is_ssl_torrent())                                                                                                                                                       |
│ │ │ │ │ -|_	_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_9_1_1_8_ _ _ _ _ _ _ _|_p_e_r_h_a_p_s_ _0_ _s_h_o_u_l_d_ _a_c_t_u_a_l_l_y_ _m_e_a_n_ _0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ppeerrhhaappss 00 sshhoouulldd aaccttuuaallllyy mmeeaann 00 **********                                                                                                                                   |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::99111188 ******                                                                                                                                                |
│ │ │ │ │ -|// finished torrents may not change their queue positions, as it's set to                                                                                                      |
│ │ │ │ │ -|		// -1                                                                                                                                                                        |
│ │ │ │ │ -|		if ((m_abort || is_finished()) && p != no_pos) return;                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT((p == no_pos) == is_finished()                                                                                                                                |
│ │ │ │ │ -|			|| (!m_auto_managed && p == no_pos)                                                                                                                                         |
│ │ │ │ │ -|			|| (m_abort && p == no_pos)                                                                                                                                                 |
│ │ │ │ │ -|			|| (!m_added && p == no_pos));                                                                                                                                              |
│ │ │ │ │ -|		if (p == m_sequence_number) return;                                                                                                                                          |
│ │ │ │ │ +|			flags |= listen_socket_t::was_expanded;                                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(p >= no_pos);                                                                                                                                                 |
│ │ │ │ │ +|			// this is the case where device names a network device. We need to                                                                                                         |
│ │ │ │ │ +|			// enumerate all IPs associated with this device                                                                                                                            |
│ │ │ │ │ +|			for (auto const& ipface : ifs)                                                                                                                                              |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				// we're looking for a specific interface, and its address                                                                                                                 |
│ │ │ │ │ +|				// (which must be of the same family as the address we're                                                                                                                  |
│ │ │ │ │ +|				// connecting to)                                                                                                                                                          |
│ │ │ │ │ +|				if (iface.device != ipface.name) continue;                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		state_updated();                                                                                                                                                             |
│ │ │ │ │ +|				bool const local = iface.local                                                                                                                                             |
│ │ │ │ │ +|					|| ipface.interface_address.is_loopback()                                                                                                                                 |
│ │ │ │ │ +|_	_	_	_	_	_|_|_ _i_s___l_i_n_k___l_o_c_a_l_(_i_p_f_a_c_e_._i_n_t_e_r_f_a_c_e___a_d_d_r_e_s_s_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|           |                              |it would probably be better to do this by having a listen-socket "version" number that gets bumped. And instead of setting a bool to|
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_2_3_0_6  |disable a tracker, we set the version number that it was disabled at. This change would affect the ABI in 1.2, so should be done in |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_._0_ _o_r_ _l_a_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd pprroobbaabbllyy bbee bbeetttteerr ttoo ddoo tthhiiss bbyy hhaavviinngg aa lliisstteenn--ssoocckkeett ""vveerrssiioonn"" nnuummbbeerr tthhaatt ggeettss bbuummppeedd.. AAnndd iinnsstteeaadd ooff sseettttiinngg aa bbooooll ttoo ddiissaabbllee aa ttrraacckkeerr,, wwee sseett tthhee       |
│ │ │ │ │ +|vveerrssiioonn nnuummbbeerr tthhaatt iitt wwaass ddiissaabblleedd aatt.. TThhiiss cchhaannggee wwoouulldd aaffffeecctt tthhee AABBII iinn 11..22,, ssoo sshhoouulldd bbee ddoonnee iinn 22..00 oorr llaatteerr **********                                                       |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::22330066 ******                                                                                                                                           |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|			for (auto const& s : m_listen_sockets)                                                                                                                                      |
│ │ │ │ │ +|				remap_ports(remap_natpmp_and_upnp, *s);                                                                                                                                    |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// new sockets need to map ports even if the caller did not request                                                                                                         |
│ │ │ │ │ +|			// re-mapping                                                                                                                                                               |
│ │ │ │ │ +|			for (auto const& s : new_sockets)                                                                                                                                           |
│ │ │ │ │ +|				remap_ports(remap_natpmp_and_upnp, *s);                                                                                                                                    |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		m_ses.set_queue_position(this, p);                                                                                                                                           |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		update_lsd();                                                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::set_max_uploads(int limit, bool const state_update)                                                                                                             |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|if (limit <= 0) limit = (1 << 24) - 1;                                                                                                                                         |
│ │ │ │ │ -|if (int(m_max_uploads) == limit) return;                                                                                                                                       |
│ │ │ │ │ -|		if (state_update) state_updated();                                                                                                                                           |
│ │ │ │ │ -|		m_max_uploads = aux::numeric_cast<std::uint32_t>(limit);                                                                                                                     |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (should_log() && state_update)                                                                                                                                            |
│ │ │ │ │ -|			debug_log("*** set-max-uploads: %d", m_max_uploads);                                                                                                                        |
│ │ │ │ │ +|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ +|		open_new_incoming_i2p_connection();                                                                                                                                          |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (state_update)                                                                                                                                                            |
│ │ │ │ │ -|			set_need_save_resume(torrent_handle::if_config_changed);                                                                                                                    |
│ │ │ │ │ +|		// trackers that were not reachable, may have become reachable now.                                                                                                          |
│ │ │ │ │ +|		// so clear the "disabled" flags to let them be tried one more time                                                                                                          |
│ │ │ │ │ +|for (auto& t : m_torrents)                                                                                                                                                     |
│ │ │ │ │ +|t->enable_all_trackers();                                                                                                                                                      |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::set_max_connections(int limit, bool const state_update)                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|_	_	_T_O_R_R_E_N_T___A_S_S_E_R_T_(_i_s___s_i_n_g_l_e___t_h_r_e_a_d_(_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_9_1_3_5_ _ _ _ _ _ _ _|_p_e_r_h_a_p_s_ _0_ _s_h_o_u_l_d_ _a_c_t_u_a_l_l_y_ _m_e_a_n_ _0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ppeerrhhaappss 00 sshhoouulldd aaccttuuaallllyy mmeeaann 00 **********                                                                                                                                   |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::99113355 ******                                                                                                                                                |
│ │ │ │ │ -|	void torrent::set_max_uploads(int limit, bool const state_update)                                                                                                             |
│ │ │ │ │ +|	void session_impl::reopen_network_sockets(reopen_network_flags_t const options)                                                                                               |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|		if (limit <= 0) limit = (1 << 24) - 1;                                                                                                                                       |
│ │ │ │ │ -|		if (int(m_max_uploads) == limit) return;                                                                                                                                     |
│ │ │ │ │ -|		if (state_update) state_updated();                                                                                                                                           |
│ │ │ │ │ -|		m_max_uploads = aux::numeric_cast<std::uint32_t>(limit);                                                                                                                     |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (should_log() && state_update)                                                                                                                                            |
│ │ │ │ │ -|			debug_log("*** set-max-uploads: %d", m_max_uploads);                                                                                                                        |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (state_update)                                                                                                                                                            |
│ │ │ │ │ -|			set_need_save_resume(torrent_handle::if_config_changed);                                                                                                                    |
│ │ │ │ │ +|		reopen_listen_sockets(bool(options & session_handle::reopen_map_ports));                                                                                                     |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::set_max_connections(int limit, bool const state_update)                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|if (limit <= 0) limit = (1 << 24) - 1;                                                                                                                                         |
│ │ │ │ │ -|if (int(m_max_connections) == limit) return;                                                                                                                                   |
│ │ │ │ │ -|		if (state_update) state_updated();                                                                                                                                           |
│ │ │ │ │ -|		m_max_connections = aux::numeric_cast<std::uint32_t>(limit);                                                                                                                 |
│ │ │ │ │ -|		update_want_peers();                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		if (should_log() && state_update)                                                                                                                                            |
│ │ │ │ │ -|			debug_log("*** set-max-connections: %d", m_max_connections);                                                                                                                |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (num_peers() > int(m_max_connections))                                                                                                                                    |
│ │ │ │ │ +|	namespace {                                                                                                                                                                   |
│ │ │ │ │ +|		template <typename MapProtocol, typename ProtoType, typename EndpointType>                                                                                                   |
│ │ │ │ │ +|		void map_port(MapProtocol& m, ProtoType protocol, EndpointType const& ep                                                                                                     |
│ │ │ │ │ +|			, port_mapping_t& map_handle, std::string const& device)                                                                                                                    |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			disconnect_peers(num_peers() - m_max_connections                                                                                                                            |
│ │ │ │ │ -|				, errors::too_many_connections);                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|			if (map_handle != port_mapping_t{-1}) m.delete_mapping(map_handle);                                                                                                         |
│ │ │ │ │ +|			map_handle = port_mapping_t{-1};                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (state_update)                                                                                                                                                            |
│ │ │ │ │ -|			set_need_save_resume(torrent_handle::if_config_changed);                                                                                                                    |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|			address const addr = ep.address();                                                                                                                                          |
│ │ │ │ │ +|			// with IPv4 the interface might be behind NAT so we can't skip them                                                                                                        |
│ │ │ │ │ +|			// based on the scope of the local address                                                                                                                                  |
│ │ │ │ │ +|			if (addr.is_v6() && is_local(addr))                                                                                                                                         |
│ │ │ │ │ +|				return;                                                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::set_upload_limit(int const limit)                                                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		set_limit_impl(limit, peer_connection::upload_channel);                                                                                                                      |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		debug_log("*** set-upload-limit: %d", limit);                                                                                                                                |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			// only update this mapping if we actually have a socket listening                                                                                                          |
│ │ │ │ │ +|			if (ep != EndpointType())                                                                                                                                                   |
│ │ │ │ │ +|				map_handle = m.add_mapping(protocol, ep.port(), ep, device);                                                                                                               |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent::set_download_limit(int const limit)                                                                                                                             |
│ │ │ │ │ -|_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t_._c_p_p_:_1_1_0_6_1_ _ _ _ _ _ _|_i_n_s_t_e_a_d_ _o_f_ _r_e_s_o_r_t_i_n_g_ _t_h_e_ _w_h_o_l_e_ _l_i_s_t_,_ _i_n_s_e_r_t_ _t_h_e_ _p_e_e_r_s_ _d_i_r_e_c_t_l_y_ _i_n_t_o_ _t_h_e_ _r_i_g_h_t_ _p_l_a_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinnsstteeaadd ooff rreessoorrttiinngg tthhee wwhhoollee lliisstt,, iinnsseerrtt tthhee ppeeeerrss ddiirreeccttllyy iinnttoo tthhee rriigghhtt ppllaaccee **********                                                                                |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt..ccpppp::1111006611 ******                                                                                                                                               |
│ │ │ │ │ -|std::printf("timed out [average-piece-time: %d ms ]\n"                                                                                                                         |
│ │ │ │ │ -|					, m_average_piece_time);                                                                                                                                                  |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	void session_impl::remap_ports(remap_port_mask_t const mask                                                                                                                   |
│ │ │ │ │ +|_	_	_,_ _l_i_s_t_e_n___s_o_c_k_e_t___t_&_ _s_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_2_8_6_6_ _ _|_t_h_i_s_ _s_i_z_e_ _n_e_e_d_ _t_o_ _b_e_ _c_a_p_p_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ssiizzee nneeeedd ttoo bbee ccaappppeedd **********                                                                                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::22886666 ******                                                                                                                                           |
│ │ │ │ │ +|// handshaking                                                                                                                                                                 |
│ │ │ │ │ +|				return socket_type(ssl_stream<tcp::socket>(tcp::socket(std::move(s)), m_peer_ssl_ctx));                                                                                    |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// pick all blocks for this piece. the peers list is kept up to date                                                                                                        |
│ │ │ │ │ -|			// and sorted. when we issue a request to a peer, its download queue                                                                                                        |
│ │ │ │ │ -|			// time will increase and it may need to be bumped in the peers list,                                                                                                       |
│ │ │ │ │ -|			// since it's ordered by download queue time                                                                                                                                |
│ │ │ │ │ -|			pick_time_critical_block(peers, ignore_peers                                                                                                                                |
│ │ │ │ │ -|				, peers_with_requests                                                                                                                                                      |
│ │ │ │ │ -|				, pi, &i, m_picker.get()                                                                                                                                                   |
│ │ │ │ │ -|				, blocks_in_piece, timed_out);                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// put back the peers we ignored into the peer list for the next piece                                                                                                      |
│ │ │ │ │ -|			if (!ignore_peers.empty())                                                                                                                                                  |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				peers.insert(peers.begin(), ignore_peers.begin(), ignore_peers.end());                                                                                                     |
│ │ │ │ │ -|				ignore_peers.clear();                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|std::sort(peers.begin(), peers.end()                                                                                                                                           |
│ │ │ │ │ -|, [] (peer_connection const* lhs, peer_connection const* rhs)                                                                                                                  |
│ │ │ │ │ -|					{ return lhs->download_queue_time(16*1024) < rhs->download_queue_time(16*1024); });                                                                                       |
│ │ │ │ │ +|				return socket_type(tcp::socket(std::move(s)));                                                                                                                             |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ +|		}();                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// if this peer's download time exceeds 2 seconds, we're done.                                                                                                              |
│ │ │ │ │ -|			// We don't want to build unreasonably long request queues                                                                                                                  |
│ │ │ │ │ -|			if (!peers.empty() && peers[0]->download_queue_time() > milliseconds(2000))                                                                                                 |
│ │ │ │ │ -|				break;                                                                                                                                                                     |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|		TORRENT_ASSERT((ssl == transport::ssl) == is_ssl(c));                                                                                                                        |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// commit all the time critical requests                                                                                                                                     |
│ │ │ │ │ -|		for (auto p : peers_with_requests)                                                                                                                                           |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|		if (ssl == transport::ssl)                                                                                                                                                   |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			p->send_block_requests();                                                                                                                                                   |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif // TORRENT_DISABLE_STREAMING                                                                                                                                            |
│ │ │ │ │ +|			TORRENT_ASSERT(is_ssl(c));                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::set<std::string> torrent::web_seeds(web_seed_entry::type_t const type) const                                                                                             |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │ -|		std::set<std::string> ret;                                                                                                                                                   |
│ │ │ │ │ -|		for (auto const& s : m_web_seeds)                                                                                                                                            |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (s.peer_info.banned) continue;                                                                                                                                           |
│ │ │ │ │ -|			if (s.removed) continue;                                                                                                                                                    |
│ │ │ │ │ -|			if (s.type != type) continue;                                                                                                                                               |
│ │ │ │ │ -|			ret.insert(s.url);                                                                                                                                                          |
│ │ │ │ │ +|			// save the socket so we can cancel the handshake                                                                                                                           |
│ │ │ │ │ +|auto iter = m_incoming_sockets.emplace(std::make_unique<socket_type>(std::move(c))).first;                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			auto sock = iter->get();                                                                                                                                                    |
│ │ │ │ │ +|			// for SSL connections, incoming_connection() is called                                                                                                                     |
│ │ │ │ │ +|			// after the handshake is done                                                                                                                                              |
│ │ │ │ │ +|			ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");                                                                                                                       |
│ │ │ │ │ +|			boost::get<ssl_stream<tcp::socket>>(**iter).async_accept_handshake(                                                                                                         |
│ │ │ │ │ +|				[this, sock] (error_code const& err) { ssl_handshake(err, sock); });                                                                                                       |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|_	_	_r_e_t_u_r_n_ _r_e_t_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n_._c_p_p_:_5_4_0_ _ _ _ _ _ _ _ _|_I_n_ _C_+_+_1_7_._ _u_s_e_ _i_f_ _c_o_n_s_t_e_x_p_r_ _i_n_s_t_e_a_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** IInn CC++++1177.. uussee iiff ccoonnsstteexxpprr iinnsstteeaadd **********                                                                                                                                 |
│ │ │ │ │ -|****** ....//ssrrcc//sseessssiioonn..ccpppp::554400 ******                                                                                                                                                 |
│ │ │ │ │ -|{}                                                                                                                                                                             |
│ │ │ │ │ -|	session_proxy::session_proxy(session_proxy const&) = default;                                                                                                                 |
│ │ │ │ │ -|	session_proxy& session_proxy::operator=(session_proxy const&) & = default;                                                                                                    |
│ │ │ │ │ -|	session_proxy::session_proxy(session_proxy&&) noexcept = default;                                                                                                             |
│ │ │ │ │ -|	session_proxy& session_proxy::operator=(session_proxy&&) & noexcept = default;                                                                                                |
│ │ │ │ │ -|	session_proxy::~session_proxy()                                                                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (m_thread && m_thread.use_count() == 1)                                                                                                                                   |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|#if defined TORRENT_ASIO_DEBUGGING                                                                                                                                             |
│ │ │ │ │ -|			wait_for_asio_handlers();                                                                                                                                                   |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|			m_thread->join();                                                                                                                                                           |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			incoming_connection(std::move(c));                                                                                                                                          |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	TORRENT_EXPORT std::unique_ptr<disk_interface> default_disk_io_constructor(                                                                                                   |
│ │ │ │ │ -|		io_context& ios, settings_interface const& sett, counters& cnt)                                                                                                              |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void session_impl::on_incoming_utp_ssl(socket_type s)                                                                                                                         |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#if TORRENT_HAVE_MMAP || TORRENT_HAVE_MAP_VIEW_OF_FILE                                                                                                                         |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"                                                                                                               |
│ │ │ │ │ -|if (sizeof(void*) == 8)                                                                                                                                                        |
│ │ │ │ │ -|			return mmap_disk_io_constructor(ios, sett, cnt);                                                                                                                            |
│ │ │ │ │ +|		TORRENT_ASSERT(is_ssl(s));                                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_	_	_/_/_ _s_a_v_e_ _t_h_e_ _s_o_c_k_e_t_ _s_o_ _w_e_ _c_a_n_ _c_a_n_c_e_l_ _t_h_e_ _h_a_n_d_s_h_a_k_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_2_8_9_1_ _ _|_t_h_i_s_ _s_i_z_e_ _n_e_e_d_ _t_o_ _b_e_ _c_a_p_p_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss ssiizzee nneeeedd ttoo bbee ccaappppeedd **********                                                                                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::22889911 ******                                                                                                                                           |
│ │ │ │ │ +|// after the handshake is done                                                                                                                                                 |
│ │ │ │ │ +|			ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");                                                                                                                       |
│ │ │ │ │ +|			boost::get<ssl_stream<tcp::socket>>(**iter).async_accept_handshake(                                                                                                         |
│ │ │ │ │ +|				[this, sock] (error_code const& err) { ssl_handshake(err, sock); });                                                                                                       |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |		else                                                                                                                                                                         |
│ │ │ │ │ -|			return posix_disk_io_constructor(ios, sett, cnt);                                                                                                                           |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		return posix_disk_io_constructor(ios, sett, cnt);                                                                                                                            |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			incoming_connection(std::move(c));                                                                                                                                          |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_c_p_u_i_d_._c_p_p_:_1_3_1_ _ _ _ _ _ _ _ _ _ _|_e_n_a_b_l_e_ _w_h_e_n_ _a_a_r_c_h_6_4_ _i_s_ _r_e_a_l_l_y_ _t_e_s_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** eennaabbllee wwhheenn aaaarrcchh6644 iiss rreeaallllyy tteesstteedd **********                                                                                                                               |
│ │ │ │ │ -|****** ....//ssrrcc//ccppuuiidd..ccpppp::113311 ******                                                                                                                                                   |
│ │ │ │ │ -|bool supports_mmx() noexcept                                                                                                                                                   |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#if TORRENT_HAS_SSE                                                                                                                                                            |
│ │ │ │ │ -|		std::uint32_t cpui[4] = {0};                                                                                                                                                 |
│ │ │ │ │ -|		cpuid(cpui, 1);                                                                                                                                                              |
│ │ │ │ │ -|		return (cpui[2] & (1 << 23)) != 0;                                                                                                                                           |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	bool supports_arm_neon() noexcept                                                                                                                                             |
│ │ │ │ │ +|	void session_impl::on_incoming_utp_ssl(socket_type s)                                                                                                                         |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|#if TORRENT_HAS_ARM_NEON && TORRENT_HAS_AUXV                                                                                                                                   |
│ │ │ │ │ -|#if defined __arm__                                                                                                                                                            |
│ │ │ │ │ -|		//return (getauxval(AT_HWCAP) & HWCAP_NEON);                                                                                                                                 |
│ │ │ │ │ -|		return (helper_getauxval(16) & (1 << 12));                                                                                                                                   |
│ │ │ │ │ -|#elif defined __aarch64__                                                                                                                                                      |
│ │ │ │ │ -|		//return (getauxval(AT_HWCAP) & HWCAP_ASIMD);                                                                                                                                |
│ │ │ │ │ -|		//return (getauxval(16) & (1 << 1));                                                                                                                                         |
│ │ │ │ │ -|return false;                                                                                                                                                                  |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_ssl(s));                                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	bool supports_arm_crc32c() noexcept                                                                                                                                           |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#if TORRENT_HAS_ARM_CRC32 && TORRENT_HAS_AUXV                                                                                                                                  |
│ │ │ │ │ -|#if defined TORRENT_FORCE_ARM_CRC32                                                                                                                                            |
│ │ │ │ │ -|		return true;                                                                                                                                                                 |
│ │ │ │ │ -|#elif defined __arm__                                                                                                                                                          |
│ │ │ │ │ -|		//return (getauxval(AT_HWCAP2) & HWCAP2_CRC32);                                                                                                                              |
│ │ │ │ │ -|		return (helper_getauxval(26) & (1 << 4));                                                                                                                                    |
│ │ │ │ │ -|#elif defined __aarch64__                                                                                                                                                      |
│ │ │ │ │ -|		//return (getauxval(AT_HWCAP) & HWCAP_CRC32);                                                                                                                                |
│ │ │ │ │ -|		return (helper_getauxval(16) & (1 << 7));                                                                                                                                    |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		// save the socket so we can cancel the handshake                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|} // anonymous namespace                                                                                                                                                       |
│ │ │ │ │ +|auto iter = m_incoming_sockets.emplace(std::make_unique<socket_type>(std::move(s))).first;                                                                                     |
│ │ │ │ │ +|auto sock = iter->get();                                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	bool const sse42_support = supports_sse42();                                                                                                                                  |
│ │ │ │ │ -|	bool const mmx_support = supports_mmx();                                                                                                                                      |
│ │ │ │ │ -|	bool const arm_neon_support = supports_arm_neon();                                                                                                                            |
│ │ │ │ │ -|	bool const arm_crc32c_support = supports_arm_crc32c();                                                                                                                        |
│ │ │ │ │ -|_}_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_c_h_o_k_e_r_._c_p_p_:_2_5_8_ _ _ _ _ _ _ _ _ _|_m_a_k_e_ _c_o_n_f_i_g_u_r_a_b_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmaakkee ccoonnffiigguurraabbllee **********                                                                                                                                                  |
│ │ │ │ │ -|****** ....//ssrrcc//cchhookkeerr..ccpppp::225588 ******                                                                                                                                                  |
│ │ │ │ │ -|// first reset the number of unchoke slots, because we'll calculate                                                                                                            |
│ │ │ │ │ -|			// it purely based on the current state of our peers.                                                                                                                       |
│ │ │ │ │ -|			upload_slots = 0;                                                                                                                                                           |
│ │ │ │ │ +|		// for SSL connections, incoming_connection() is called                                                                                                                      |
│ │ │ │ │ +|		// after the handshake is done                                                                                                                                               |
│ │ │ │ │ +|		ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");                                                                                                                        |
│ │ │ │ │ +|		boost::get<ssl_stream<utp_stream>>(**iter).async_accept_handshake(                                                                                                           |
│ │ │ │ │ +|			[this, sock] (error_code const& err) { ssl_handshake(err, sock); });                                                                                                        |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			int rate_threshold = sett.get_int(settings_pack::rate_choker_initial_threshold);                                                                                            |
│ │ │ │ │ +|	// to test SSL connections, one can use this openssl command template:                                                                                                        |
│ │ │ │ │ +|	//                                                                                                                                                                            |
│ │ │ │ │ +|	// openssl s_client -cert <client-cert>.pem -key <client-private-key>.pem                                                                                                     |
│ │ │ │ │ +|	//   -CAfile <torrent-cert>.pem  -debug -connect 127.0.0.1:4433 -tls1                                                                                                         |
│ │ │ │ │ +|	//   -servername <hex-encoded-info-hash>                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			std::sort(peers.begin(), peers.end()                                                                                                                                        |
│ │ │ │ │ -|				, [](peer_connection const* lhs, peer_connection const* rhs)                                                                                                               |
│ │ │ │ │ -|				{ return upload_rate_compare(lhs, rhs); });                                                                                                                                |
│ │ │ │ │ +|	void session_impl::ssl_handshake(error_code const& ec, socket_type* sock)                                                                                                     |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		COMPLETE_ASYNC("session_impl::ssl_handshake");                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			for (auto const* p : peers)                                                                                                                                                 |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				int const rate = int(p->uploaded_in_last_round()                                                                                                                           |
│ │ │ │ │ -|					* 1000 / total_milliseconds(unchoke_interval));                                                                                                                           |
│ │ │ │ │ +|		auto iter = m_incoming_sockets.find(sock);                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				// always have at least 1 unchoke slot                                                                                                                                     |
│ │ │ │ │ -|				if (rate < rate_threshold) break;                                                                                                                                          |
│ │ │ │ │ +|		// this happens if the SSL connection is aborted because we're shutting                                                                                                      |
│ │ │ │ │ +|		// down                                                                                                                                                                      |
│ │ │ │ │ +|		if (iter == m_incoming_sockets.end()) return;                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				++upload_slots;                                                                                                                                                            |
│ │ │ │ │ +|		socket_type s(std::move(**iter));                                                                                                                                            |
│ │ │ │ │ +|		TORRENT_ASSERT(is_ssl(s));                                                                                                                                                   |
│ │ │ │ │ +|		m_incoming_sockets.erase(iter);                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|rate_threshold += 2048;                                                                                                                                                        |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|			++upload_slots;                                                                                                                                                             |
│ │ │ │ │ +|_	_	_e_r_r_o_r___c_o_d_e_ _e_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_3_5_9_0_ _ _|_h_a_v_e_ _a_ _s_e_p_a_r_a_t_e_ _l_i_s_t_ _f_o_r_ _t_h_e_s_e_ _c_o_n_n_e_c_t_i_o_n_s_,_ _i_n_s_t_e_a_d_ _o_f_ _h_a_v_i_n_g_ _t_o_ _l_o_o_p_ _t_h_r_o_u_g_h_ _a_l_l_ _o_f_ _t_h_e_m_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** hhaavvee aa sseeppaarraattee lliisstt ffoorr tthheessee ccoonnnneeccttiioonnss,, iinnsstteeaadd ooff hhaavviinngg ttoo lloooopp tthhrroouugghh aallll ooff tthheemm **********                                                                          |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::33559900 ******                                                                                                                                           |
│ │ │ │ │ +|// --------------------------------------------------------------                                                                                                              |
│ │ │ │ │ +|		if (!m_paused) m_auto_manage_time_scaler--;                                                                                                                                  |
│ │ │ │ │ +|		if (m_auto_manage_time_scaler < 0)                                                                                                                                           |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			m_auto_manage_time_scaler = settings().get_int(settings_pack::auto_manage_interval);                                                                                        |
│ │ │ │ │ +|			recalculate_auto_managed_torrents();                                                                                                                                        |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// sorts the peers that are eligible for unchoke by download rate and                                                                                                        |
│ │ │ │ │ -|		// secondary by total upload. The reason for this is, if all torrents are                                                                                                    |
│ │ │ │ │ -|		// being seeded, the download rate will be 0, and the peers we have sent                                                                                                     |
│ │ │ │ │ -|		// the least to should be unchoked                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// we use partial sort here, because we only care about the top                                                                                                              |
│ │ │ │ │ -|		// upload_slots peers.                                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		int const slots = std::min(upload_slots, int(peers.size()));                                                                                                                 |
│ │ │ │ │ +|		// --------------------------------------------------------------                                                                                                            |
│ │ │ │ │ +|		// check for incoming connections that might have timed out                                                                                                                  |
│ │ │ │ │ +|		// --------------------------------------------------------------                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (sett.get_int(settings_pack::seed_choking_algorithm)                                                                                                                      |
│ │ │ │ │ -|			== settings_pack::round_robin)                                                                                                                                              |
│ │ │ │ │ +|		for (auto i = m_connections.begin(); i != m_connections.end();)                                                                                                              |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			int const pieces = sett.get_int(settings_pack::seeding_piece_quota);                                                                                                        |
│ │ │ │ │ +|			peer_connection* p = (*i).get();                                                                                                                                            |
│ │ │ │ │ +|			++i;                                                                                                                                                                        |
│ │ │ │ │ +|			// ignore connections that already have a torrent, since they                                                                                                               |
│ │ │ │ │ +|			// are ticked through the torrents' second_tick                                                                                                                             |
│ │ │ │ │ +|			if (!p->associated_torrent().expired()) continue;                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			std::nth_element(peers.begin(), peers.begin()                                                                                                                               |
│ │ │ │ │ -|				+ slots, peers.end()                                                                                                                                                       |
│ │ │ │ │ -|				, [pieces](peer_connection const* lhs, peer_connection const* rhs)                                                                                                         |
│ │ │ │ │ -|				{ return unchoke_compare_rr(lhs, rhs, pieces); });                                                                                                                         |
│ │ │ │ │ +|int timeout = m_settings.get_int(settings_pack::handshake_timeout);                                                                                                            |
│ │ │ │ │ +|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ +|			timeout *= is_i2p(p->get_socket()) ? 4 : 1;                                                                                                                                 |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			if (m_last_tick - p->connected_time () > seconds(timeout))                                                                                                                  |
│ │ │ │ │ +|				p->disconnect(errors::timed_out, operation_t::bittorrent);                                                                                                                 |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		else if (sett.get_int(settings_pack::seed_choking_algorithm)                                                                                                                 |
│ │ │ │ │ -|			== settings_pack::fastest_upload)                                                                                                                                           |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			std::nth_element(peers.begin(), peers.begin()                                                                                                                               |
│ │ │ │ │ -|				+ slots, peers.end()                                                                                                                                                       |
│ │ │ │ │ -|_	_	_	_	_,_ _[_]_(_p_e_e_r___c_o_n_n_e_c_t_i_o_n_ _c_o_n_s_t_*_ _l_h_s_,_ _p_e_e_r___c_o_n_n_e_c_t_i_o_n_ _c_o_n_s_t_*_ _r_h_s_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_1_1_0_ _ _ _ _|_i_n_ _C_+_+_2_0_,_ _u_s_e_ _s_t_d_:_:_i_d_e_n_t_i_t_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinn CC++++2200,, uussee ssttdd::::iiddeennttiittyy **********                                                                                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::111100 ******                                                                                                                                             |
│ │ │ │ │ -|allocate_full();                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		merkle_validate_copy(t, m_tree, root(), m_block_verified);                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		load_verified_bits(verified);                                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		optimize_storage();                                                                                                                                                          |
│ │ │ │ │ -|		optimize_storage_piece_layer();                                                                                                                                              |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		// --------------------------------------------------------------                                                                                                            |
│ │ │ │ │ +|		// second_tick every torrent (that wants it)                                                                                                                                 |
│ │ │ │ │ +|		// --------------------------------------------------------------                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void merkle_tree::clear()                                                                                                                                                     |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		m_tree.clear();                                                                                                                                                              |
│ │ │ │ │ -|		m_tree.shrink_to_fit();                                                                                                                                                      |
│ │ │ │ │ -|		m_block_verified.clear();                                                                                                                                                    |
│ │ │ │ │ -|		m_mode = mode_t::empty_tree;                                                                                                                                                 |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|#if TORRENT_DEBUG_STREAMING > 0                                                                                                                                                |
│ │ │ │ │ +|		std::printf("\033[2J\033[0;0H");                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|namespace {                                                                                                                                                                    |
│ │ │ │ │ +|		aux::vector<torrent*>& want_tick = m_torrent_lists[torrent_want_tick];                                                                                                       |
│ │ │ │ │ +|		for (int i = 0; i < int(want_tick.size()); ++i)                                                                                                                              |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			torrent& t = *want_tick[i];                                                                                                                                                 |
│ │ │ │ │ +|			TORRENT_ASSERT(t.want_tick());                                                                                                                                              |
│ │ │ │ │ +|			TORRENT_ASSERT(!t.is_aborted());                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|struct identity                                                                                                                                                                |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		bool operator()(bool b) const { return b; }                                                                                                                                  |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|			t.second_tick(tick_interval_ms);                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void merkle_tree::load_sparse_tree(span<sha256_hash const> t                                                                                                                  |
│ │ │ │ │ -|		, std::vector<bool> const& mask                                                                                                                                              |
│ │ │ │ │ -|		, std::vector<bool> const& verified)                                                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(mask.size() == size());                                                                                                                                       |
│ │ │ │ │ -|		if (size() != mask.size()) return;                                                                                                                                           |
│ │ │ │ │ +|			// if the call to second_tick caused the torrent                                                                                                                            |
│ │ │ │ │ +|			// to no longer want to be ticked (i.e. it was                                                                                                                              |
│ │ │ │ │ +|			// removed from the list) we need to back up the counter                                                                                                                    |
│ │ │ │ │ +|			// to not miss the torrent after it                                                                                                                                         |
│ │ │ │ │ +|			if (!t.want_tick()) --i;                                                                                                                                                    |
│ │ │ │ │ +|_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_3_6_2_3_ _ _|_t_h_i_s_ _s_h_o_u_l_d_ _a_p_p_l_y_ _t_o_ _a_l_l_ _b_a_n_d_w_i_d_t_h_ _c_h_a_n_n_e_l_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss sshhoouulldd aappppllyy ttoo aallll bbaannddwwiiddtthh cchhaannnneellss **********                                                                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::33662233 ******                                                                                                                                           |
│ │ │ │ │ +|#if TORRENT_DEBUG_STREAMING > 0                                                                                                                                                |
│ │ │ │ │ +|		std::printf("\033[2J\033[0;0H");                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		int const first_block = block_layer_start();                                                                                                                                 |
│ │ │ │ │ -|		int const end_block = first_block + m_num_blocks;                                                                                                                            |
│ │ │ │ │ +|		aux::vector<torrent*>& want_tick = m_torrent_lists[torrent_want_tick];                                                                                                       |
│ │ │ │ │ +|		for (int i = 0; i < int(want_tick.size()); ++i)                                                                                                                              |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			torrent& t = *want_tick[i];                                                                                                                                                 |
│ │ │ │ │ +|			TORRENT_ASSERT(t.want_tick());                                                                                                                                              |
│ │ │ │ │ +|			TORRENT_ASSERT(!t.is_aborted());                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(first_block < int(mask.size()));                                                                                                                              |
│ │ │ │ │ -|		TORRENT_ASSERT(end_block <= int(mask.size()));                                                                                                                               |
│ │ │ │ │ +|			t.second_tick(tick_interval_ms);                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// if the mask covers all blocks, go straight to block_layer                                                                                                                 |
│ │ │ │ │ -|		// mode, and validate                                                                                                                                                        |
│ │ │ │ │ -|		if (std::all_of(mask.begin() + first_block, mask.begin() + end_block, identity()))                                                                                           |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// the index in t that points to first_block                                                                                                                                |
│ │ │ │ │ -|			auto const block_index = std::count_if(mask.begin(), mask.begin() + first_block, identity());                                                                               |
│ │ │ │ │ +|			// if the call to second_tick caused the torrent                                                                                                                            |
│ │ │ │ │ +|			// to no longer want to be ticked (i.e. it was                                                                                                                              |
│ │ │ │ │ +|			// removed from the list) we need to back up the counter                                                                                                                    |
│ │ │ │ │ +|			// to not miss the torrent after it                                                                                                                                         |
│ │ │ │ │ +|			if (!t.want_tick()) --i;                                                                                                                                                    |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// discrepancy                                                                                                                                                              |
│ │ │ │ │ -|			if (t.size() < block_index + m_num_blocks)                                                                                                                                  |
│ │ │ │ │ -|_	_	_	_	_r_e_t_u_r_n_ _c_l_e_a_r_(_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_3_1_9_ _ _ _ _|_t_h_i_s_ _c_a_n_ _b_e_ _o_p_t_i_m_i_z_e_d_ _b_y_ _u_s_i_n_g_ _m___t_r_e_e_ _a_s_ _s_t_o_r_a_g_e_ _t_o_ _f_i_l_l_ _t_h_i_s_ _t_r_e_e_ _i_n_t_o_,_ _a_n_d_ _t_h_e_n_ _c_l_e_a_r_ _i_t_ _i_f_ _t_h_e_ _h_a_s_h_e_s_ _f_a_i_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ccaann bbee ooppttiimmiizzeedd bbyy uussiinngg mm__ttrreeee aass ssttoorraaggee ttoo ffiillll tthhiiss ttrreeee iinnttoo,, aanndd tthheenn cclleeaarr iitt iiff tthhee hhaasshheess ffaaiill **********                                                      |
│ │ │ │ │ -|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::331199 ******                                                                                                                                             |
│ │ │ │ │ +|if (m_settings.get_bool(settings_pack::rate_limit_ip_overhead))                                                                                                                |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|			int const up_limit = upload_rate_limit(m_global_class);                                                                                                                     |
│ │ │ │ │ +|			int const down_limit = download_rate_limit(m_global_class);                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// as we set the hashes of interior nodes, we may be able to validate                                                                                                        |
│ │ │ │ │ -|		// block hashes that we had since earlier. Any blocks that can be                                                                                                            |
│ │ │ │ │ -|		// validated, and failed, are added to this list                                                                                                                             |
│ │ │ │ │ -|		add_hashes_result_t ret;                                                                                                                                                     |
│ │ │ │ │ +|			if (down_limit > 0                                                                                                                                                          |
│ │ │ │ │ +|				&& m_stat.download_ip_overhead() >= down_limit                                                                                                                             |
│ │ │ │ │ +|				&& m_alerts.should_post<performance_alert>())                                                                                                                              |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				m_alerts.emplace_alert<performance_alert>(torrent_handle()                                                                                                                 |
│ │ │ │ │ +|					, performance_alert::download_limit_too_low);                                                                                                                             |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// we already have all hashes                                                                                                                                                |
│ │ │ │ │ -|		if (m_mode == mode_t::block_layer)                                                                                                                                           |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// since we're already on the block layer mode, we have the whole                                                                                                           |
│ │ │ │ │ -|			// tree, and we've already reported any pieces as passing that may                                                                                                          |
│ │ │ │ │ -|			// have existed in the tree when we completed it. At this point no                                                                                                          |
│ │ │ │ │ -|			// more pieces should be reported as passed                                                                                                                                 |
│ │ │ │ │ -|			return ret;                                                                                                                                                                 |
│ │ │ │ │ +|			if (up_limit > 0                                                                                                                                                            |
│ │ │ │ │ +|				&& m_stat.upload_ip_overhead() >= up_limit                                                                                                                                 |
│ │ │ │ │ +|				&& m_alerts.should_post<performance_alert>())                                                                                                                              |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				m_alerts.emplace_alert<performance_alert>(torrent_handle()                                                                                                                 |
│ │ │ │ │ +|					, performance_alert::upload_limit_too_low);                                                                                                                               |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		allocate_full();                                                                                                                                                             |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|		m_peak_up_rate = std::max(m_stat.upload_rate(), m_peak_up_rate);                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|int const leaf_count = merkle_num_leafs(int(hashes.size()));                                                                                                                   |
│ │ │ │ │ -|aux::vector<sha256_hash> tree(merkle_num_nodes(leaf_count));                                                                                                                   |
│ │ │ │ │ -|		std::copy(hashes.begin(), hashes.end(), tree.end() - leaf_count);                                                                                                            |
│ │ │ │ │ +|		m_stat.second_tick(tick_interval_ms);                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the end of a file is a special case, we may need to pad the leaf layer                                                                                                    |
│ │ │ │ │ -|		if (leaf_count > hashes.size())                                                                                                                                              |
│ │ │ │ │ +|		// --------------------------------------------------------------                                                                                                            |
│ │ │ │ │ +|		// scrape paused torrents that are auto managed                                                                                                                              |
│ │ │ │ │ +|_	_	_/_/_ _(_u_n_l_e_s_s_ _t_h_e_ _s_e_s_s_i_o_n_ _i_s_ _p_a_u_s_e_d_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_4_3_1_4  |use a lower limit than m_settings.connections_limit to allocate the to 10% or so of connection slots for incoming connections cap   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_h_i_s_ _a_t_ _m_a_x_ _-_ _1_,_ _s_i_n_c_e_ _w_e_ _m_a_y_ _a_d_d_ _o_n_e_ _b_e_l_o_w_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** uussee aa lloowweerr lliimmiitt tthhaann mm__sseettttiinnggss..ccoonnnneeccttiioonnss__lliimmiitt ttoo aallllooccaattee tthhee ttoo 1100%% oorr ssoo ooff ccoonnnneeccttiioonn sslloottss ffoorr iinnccoommiinngg ccoonnnneeccttiioonnss ccaapp tthhiiss aatt mmaaxx -- 11,, ssiinnccee wwee mmaayy aadddd oonnee  |
│ │ │ │ │ +|bbeellooww **********                                                                                                                                                                    |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::44331144 ******                                                                                                                                           |
│ │ │ │ │ +|// boost, which are done immediately on a tracker response. These                                                                                                              |
│ │ │ │ │ +|		// connections needs to be deducted from the regular connection attempt                                                                                                      |
│ │ │ │ │ +|		// quota for this tick                                                                                                                                                       |
│ │ │ │ │ +|		if (m_boost_connections > 0)                                                                                                                                                 |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			int const leaf_layer_size = num_leafs();                                                                                                                                    |
│ │ │ │ │ -|			// assuming uncle_hashes lead all the way to the root, they tell us                                                                                                         |
│ │ │ │ │ -|			// how many layers down we are                                                                                                                                              |
│ │ │ │ │ -|			int const insert_layer_size = leaf_count << uncle_hashes.size();                                                                                                            |
│ │ │ │ │ -|			if (leaf_layer_size != insert_layer_size)                                                                                                                                   |
│ │ │ │ │ +|			if (m_boost_connections > max_connections)                                                                                                                                  |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				sha256_hash const pad_hash = merkle_pad(leaf_layer_size, insert_layer_size);                                                                                               |
│ │ │ │ │ -|				for (int i = int(hashes.size()); i < leaf_count; ++i)                                                                                                                      |
│ │ │ │ │ -|					tree[tree.end_index() - leaf_count + i] = pad_hash;                                                                                                                       |
│ │ │ │ │ +|				m_boost_connections -= max_connections;                                                                                                                                    |
│ │ │ │ │ +|				max_connections = 0;                                                                                                                                                       |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				max_connections -= m_boost_connections;                                                                                                                                    |
│ │ │ │ │ +|				m_boost_connections = 0;                                                                                                                                                   |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		merkle_fill_tree(tree, leaf_count);                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		int const base_num_layers = merkle_num_layers(leaf_count);                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// this is the index of the node where we'll insert the root of the                                                                                                          |
│ │ │ │ │ -|		// subtree (tree). It's also the hash the uncle_hashes are here to prove                                                                                                     |
│ │ │ │ │ -|		// is valid.                                                                                                                                                                 |
│ │ │ │ │ -|		int const insert_root_idx = dest_start_idx >> base_num_layers;                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// start with validating the proofs, and inserting them as we go.                                                                                                            |
│ │ │ │ │ -|		if (!merkle_validate_and_insert_proofs(m_tree, insert_root_idx, tree[0], uncle_hashes))                                                                                      |
│ │ │ │ │ -|_	_	_	_r_e_t_u_r_n_ _{_}_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_3_6_7_ _ _ _ _|_a_ _p_i_e_c_e_ _o_u_t_s_i_d_e_ _o_f_ _t_h_i_s_ _r_a_n_g_e_ _m_a_y_ _a_l_s_o_ _f_a_i_l_,_ _i_f_ _o_n_e_ _o_f_ _t_h_e_ _u_n_c_l_e_ _h_a_s_h_e_s_ _i_s_ _a_t_ _t_h_e_ _l_a_y_e_r_ _r_i_g_h_t_ _a_b_o_v_e_ _t_h_e_ _b_l_o_c_k_ _h_a_s_h_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** aa ppiieeccee oouuttssiiddee ooff tthhiiss rraannggee mmaayy aallssoo ffaaiill,, iiff oonnee ooff tthhee uunnccllee hhaasshheess iiss aatt tthhee llaayyeerr rriigghhtt aabboovvee tthhee bblloocckk hhaasshheess **********                                               |
│ │ │ │ │ -|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::336677 ******                                                                                                                                             |
│ │ │ │ │ -|int const insert_root_idx = dest_start_idx >> base_num_layers;                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// start with validating the proofs, and inserting them as we go.                                                                                                            |
│ │ │ │ │ -|		if (!merkle_validate_and_insert_proofs(m_tree, insert_root_idx, tree[0], uncle_hashes))                                                                                      |
│ │ │ │ │ -|			return {};                                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// first fill in the subtree of known hashes from the base layer                                                                                                             |
│ │ │ │ │ -|		auto const num_leafs = merkle_num_leafs(m_num_blocks);                                                                                                                       |
│ │ │ │ │ -|		auto const first_leaf = merkle_first_leaf(num_leafs);                                                                                                                        |
│ │ │ │ │ +|		// zero connections speeds are allowed, we just won't make any connections                                                                                                   |
│ │ │ │ │ +|		if (max_connections <= 0) return;                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// this is the start of the leaf layer of "tree". We'll use this                                                                                                             |
│ │ │ │ │ -|		// variable to step upwards towards the root                                                                                                                                 |
│ │ │ │ │ -|		int source_cursor = int(tree.size()) - leaf_count;                                                                                                                           |
│ │ │ │ │ -|		// the running index in the loop                                                                                                                                             |
│ │ │ │ │ -|		int dest_cursor = dest_start_idx;                                                                                                                                            |
│ │ │ │ │ +|int const limit = std::min(m_settings.get_int(settings_pack::connections_limit)                                                                                                |
│ │ │ │ │ +|- num_connections(), std::numeric_limits<int>::max() - 1);                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of tree levels in a piece hash. 0 means the block layer is                                                                                                     |
│ │ │ │ │ -|		// the same as the piece layer                                                                                                                                               |
│ │ │ │ │ -|		int const base = piece_levels();                                                                                                                                             |
│ │ │ │ │ +|		// this logic is here to smooth out the number of new connection                                                                                                             |
│ │ │ │ │ +|		// attempts over time, to prevent connecting a large number of                                                                                                               |
│ │ │ │ │ +|		// sockets, wait 10 seconds, and then try again                                                                                                                              |
│ │ │ │ │ +|		if (m_settings.get_bool(settings_pack::smooth_connects) && max_connections > (limit+1) / 2)                                                                                  |
│ │ │ │ │ +|			max_connections = (limit + 1) / 2;                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|for (int layer_size = leaf_count; layer_size != 0; layer_size /= 2)                                                                                                            |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|			for (int i = 0; i < layer_size; ++i)                                                                                                                                        |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				int const dst_idx = dest_cursor + i;                                                                                                                                       |
│ │ │ │ │ -|				int const src_idx = source_cursor + i;                                                                                                                                     |
│ │ │ │ │ -|				if (has_node(dst_idx))                                                                                                                                                     |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					if (m_tree[dst_idx] != tree[src_idx])                                                                                                                                     |
│ │ │ │ │ -|					{                                                                                                                                                                         |
│ │ │ │ │ -|						// this must be a block hash because inner nodes are not filled in until                                                                                                 |
│ │ │ │ │ -|						// they can be verified. This assert ensures we're at the                                                                                                                |
│ │ │ │ │ -|						// leaf layer of the file tree                                                                                                                                           |
│ │ │ │ │ -|						TORRENT_ASSERT(dst_idx >= first_leaf);                                                                                                                                   |
│ │ │ │ │ +|		aux::vector<torrent*>& want_peers_download = m_torrent_lists[torrent_want_peers_download];                                                                                   |
│ │ │ │ │ +|		aux::vector<torrent*>& want_peers_finished = m_torrent_lists[torrent_want_peers_finished];                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|						int const pos = dst_idx - first_leaf;                                                                                                                                    |
│ │ │ │ │ -|						auto const piece = piece_index_t{pos >> m_blocks_per_piece_log} + file_piece_offset;                                                                                     |
│ │ │ │ │ -|						int const block = pos & ((1 << m_blocks_per_piece_log) - 1);                                                                                                             |
│ │ │ │ │ +|		// if no torrent want any peers, just return                                                                                                                                 |
│ │ │ │ │ +|		if (want_peers_download.empty() && want_peers_finished.empty()) return;                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|						TORRENT_ASSERT(pos < m_num_blocks);                                                                                                                                      |
│ │ │ │ │ -|						if (!ret.failed.empty() && ret.failed.back().first == piece)                                                                                                             |
│ │ │ │ │ -|							ret.failed.back().second.push_back(block);                                                                                                                              |
│ │ │ │ │ -|						else                                                                                                                                                                     |
│ │ │ │ │ -|							ret.failed.emplace_back(piece, std::vector<int>{block});                                                                                                                |
│ │ │ │ │ +|		// if we don't have any connection attempt quota, return                                                                                                                     |
│ │ │ │ │ +|		if (max_connections <= 0) return;                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|						// now that this hash has been reported as failing, we                                                                                                                   |
│ │ │ │ │ -|						// can clear it. This will prevent it from being                                                                                                                         |
│ │ │ │ │ -|						// reported as failing again.                                                                                                                                            |
│ │ │ │ │ -|						m_tree[dst_idx].clear();                                                                                                                                                 |
│ │ │ │ │ -|					}                                                                                                                                                                         |
│ │ │ │ │ -|_	_	_	_	_	_e_l_s_e_ _i_f_ _(_d_s_t___i_d_x_ _>_=_ _f_i_r_s_t___l_e_a_f_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_4_4_7    |instead of overwriting the root and comparing it against hashes[], write a functions that *validates* a tree by just filling it up  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_o_ _t_h_e_ _l_e_v_e_l_ _b_e_l_o_w_ _t_h_e_ _r_o_o_t_ _a_n_d_ _t_h_e_n_ _v_a_l_i_d_a_t_e_s_ _i_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinnsstteeaadd ooff oovveerrwwrriittiinngg tthhee rroooott aanndd ccoommppaarriinngg iitt aaggaaiinnsstt hhaasshheess[[]],, wwrriittee aa ffuunnccttiioonnss tthhaatt **vvaalliiddaatteess** aa ttrreeee bbyy jjuusstt ffiilllliinngg iitt uupp ttoo tthhee lleevveell bbeellooww tthhee rroooott aanndd tthheenn  |
│ │ │ │ │ -|vvaalliiddaatteess iitt.. **********                                                                                                                                                            |
│ │ │ │ │ -|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::444477 ******                                                                                                                                             |
│ │ │ │ │ -|&& dest_start_idx < first_piece_idx + num_pieces())                                                                                                                            |
│ │ │ │ │ +|		int steps_since_last_connect = 0;                                                                                                                                            |
│ │ │ │ │ +|		int const num_torrents = int(want_peers_finished.size() + want_peers_download.size());                                                                                       |
│ │ │ │ │ +|		for (;;)                                                                                                                                                                     |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			int const blocks_in_piece = 1 << base;                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// it may now be possible to verify the hashes of previously received blocks                                                                                                |
│ │ │ │ │ -|			// try to verify as many child nodes of the received hashes as possible                                                                                                     |
│ │ │ │ │ -|			for (int i = 0; i < int(hashes.size()); ++i)                                                                                                                                |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				int const piece = dest_start_idx + i;                                                                                                                                      |
│ │ │ │ │ -|				if (piece - first_piece_idx >= num_pieces())                                                                                                                               |
│ │ │ │ │ -|					break;                                                                                                                                                                    |
│ │ │ │ │ -|				// the first block in this piece                                                                                                                                           |
│ │ │ │ │ -|				int const block_idx = merkle_get_first_child(piece, base);                                                                                                                 |
│ │ │ │ │ +|			if (m_next_downloading_connect_torrent >= int(want_peers_download.size()))                                                                                                  |
│ │ │ │ │ +|				m_next_downloading_connect_torrent = 0;                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|				int const block_end_idx = std::min(block_idx + blocks_in_piece, first_leaf + m_num_blocks);                                                                                |
│ │ │ │ │ -|				if (std::any_of(m_tree.begin() + block_idx                                                                                                                                 |
│ │ │ │ │ -|					, m_tree.begin() + block_end_idx                                                                                                                                          |
│ │ │ │ │ -|					, [](sha256_hash const& h) { return h.is_all_zeros(); }))                                                                                                                 |
│ │ │ │ │ -|					continue;                                                                                                                                                                 |
│ │ │ │ │ +|			if (m_next_finished_connect_torrent >= int(want_peers_finished.size()))                                                                                                     |
│ │ │ │ │ +|				m_next_finished_connect_torrent = 0;                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|merkle_fill_tree(m_tree, blocks_in_piece, block_idx);                                                                                                                          |
│ │ │ │ │ -|if (m_tree[piece] != hashes[i])                                                                                                                                                |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					merkle_clear_tree(m_tree, blocks_in_piece, block_idx);                                                                                                                    |
│ │ │ │ │ -|					// write back the correct hash                                                                                                                                            |
│ │ │ │ │ -|					m_tree[piece] = hashes[i];                                                                                                                                                |
│ │ │ │ │ -|					TORRENT_ASSERT(blocks_in_piece == blocks_per_piece());                                                                                                                    |
│ │ │ │ │ +|			torrent* t = nullptr;                                                                                                                                                       |
│ │ │ │ │ +|			// there are prioritized torrents. Pick one of those                                                                                                                        |
│ │ │ │ │ +|_	_	_	_w_h_i_l_e_ _(_!_m___p_r_i_o___t_o_r_r_e_n_t_s_._e_m_p_t_y_(_)_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_4_4_5_9_ _ _|_p_o_s_t_ _a_ _m_e_s_s_a_g_e_ _t_o_ _h_a_v_e_ _t_h_i_s_ _h_a_p_p_e_n_ _i_m_m_e_d_i_a_t_e_l_y_ _i_n_s_t_e_a_d_ _o_f_ _w_a_i_t_i_n_g_ _f_o_r_ _t_h_e_ _n_e_x_t_ _t_i_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ppoosstt aa mmeessssaaggee ttoo hhaavvee tthhiiss hhaappppeenn iimmmmeeddiiaatteellyy iinnsstteeaadd ooff wwaaiittiinngg ffoorr tthhee nneexxtt ttiicckk **********                                                                                |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::44445599 ******                                                                                                                                           |
│ │ │ │ │ +|continue;                                                                                                                                                                      |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|					// an empty blocks vector indicates that we don't have the                                                                                                                |
│ │ │ │ │ -|					// block hashes, and we can't know which block failed                                                                                                                     |
│ │ │ │ │ -|					// this will cause the block hashes to be requested                                                                                                                       |
│ │ │ │ │ -|					ret.failed.emplace_back(piece_index_t{piece - first_piece_idx} + file_piece_offset                                                                                        |
│ │ │ │ │ -|						, std::vector<int>());                                                                                                                                                   |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|				else                                                                                                                                                                       |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					ret.passed.push_back(piece_index_t{piece - first_piece_idx} + file_piece_offset);                                                                                         |
│ │ │ │ │ -|					// record that these block hashes are correct!                                                                                                                            |
│ │ │ │ │ -|					int const leafs_start = block_idx - block_layer_start();                                                                                                                  |
│ │ │ │ │ -|_	_	_	_	_	_i_n_t_ _c_o_n_s_t_ _l_e_a_f_s___e_n_d_ _=_ _s_t_d_:_:_m_i_n_(_m___n_u_m___b_l_o_c_k_s_,_ _l_e_a_f_s___s_t_a_r_t_ _+_ _b_l_o_c_k_s___i_n___p_i_e_c_e_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_4_7_1_ _ _ _ _|_t_h_i_s_ _c_o_u_l_d_ _b_e_ _d_o_n_e_ _m_o_r_e_ _e_f_f_i_c_i_e_n_t_l_y_ _i_f_ _b_i_t_f_i_e_l_d_ _h_a_d_ _a_ _f_u_n_c_t_i_o_n_ _t_o_ _s_e_t_ _a_ _r_a_n_g_e_ _o_f_ _b_i_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ccoouulldd bbee ddoonnee mmoorree eeffffiicciieennttllyy iiff bbiittffiieelldd hhaadd aa ffuunnccttiioonn ttoo sseett aa rraannggee ooff bbiittss **********                                                                              |
│ │ │ │ │ -|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::447711 ******                                                                                                                                             |
│ │ │ │ │ -|merkle_fill_tree(m_tree, blocks_in_piece, block_idx);                                                                                                                          |
│ │ │ │ │ -|				if (m_tree[piece] != hashes[i])                                                                                                                                            |
│ │ │ │ │ +|			if (!p->is_peer_interested()                                                                                                                                                |
│ │ │ │ │ +|				|| p->is_disconnecting()                                                                                                                                                   |
│ │ │ │ │ +|				|| p->is_connecting())                                                                                                                                                     |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				// this peer is not unchokable. So, if it's unchoked                                                                                                                       |
│ │ │ │ │ +|				// already, make sure to choke it.                                                                                                                                         |
│ │ │ │ │ +|				if (p->is_choked())                                                                                                                                                        |
│ │ │ │ │  |				{                                                                                                                                                                          |
│ │ │ │ │ -|					merkle_clear_tree(m_tree, blocks_in_piece, block_idx);                                                                                                                    |
│ │ │ │ │ -|					// write back the correct hash                                                                                                                                            |
│ │ │ │ │ -|					m_tree[piece] = hashes[i];                                                                                                                                                |
│ │ │ │ │ -|					TORRENT_ASSERT(blocks_in_piece == blocks_per_piece());                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|					// an empty blocks vector indicates that we don't have the                                                                                                                |
│ │ │ │ │ -|					// block hashes, and we can't know which block failed                                                                                                                     |
│ │ │ │ │ -|					// this will cause the block hashes to be requested                                                                                                                       |
│ │ │ │ │ -|					ret.failed.emplace_back(piece_index_t{piece - first_piece_idx} + file_piece_offset                                                                                        |
│ │ │ │ │ -|						, std::vector<int>());                                                                                                                                                   |
│ │ │ │ │ +|					p->reset_choke_counters();                                                                                                                                                |
│ │ │ │ │ +|					continue;                                                                                                                                                                 |
│ │ │ │ │  |				}                                                                                                                                                                          |
│ │ │ │ │ -|				else                                                                                                                                                                       |
│ │ │ │ │ +|				if (pi && pi->optimistically_unchoked)                                                                                                                                     |
│ │ │ │ │  |				{                                                                                                                                                                          |
│ │ │ │ │ -|					ret.passed.push_back(piece_index_t{piece - first_piece_idx} + file_piece_offset);                                                                                         |
│ │ │ │ │ -|					// record that these block hashes are correct!                                                                                                                            |
│ │ │ │ │ -|					int const leafs_start = block_idx - block_layer_start();                                                                                                                  |
│ │ │ │ │ -|					int const leafs_end = std::min(m_num_blocks, leafs_start + blocks_in_piece);                                                                                              |
│ │ │ │ │ -|for (int k = leafs_start; k < leafs_end; ++k)                                                                                                                                  |
│ │ │ │ │ -|m_block_verified.set_bit(k);                                                                                                                                                   |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|				TORRENT_ASSERT((piece - first_piece_idx) >= 0);                                                                                                                            |
│ │ │ │ │ +|					m_stats_counters.inc_stats_counter(counters::num_peers_up_unchoked_optimistic, -1);                                                                                       |
│ │ │ │ │ +|					pi->optimistically_unchoked = false;                                                                                                                                      |
│ │ │ │ │ +|					// force a new optimistic unchoke                                                                                                                                         |
│ │ │ │ │ +|					m_optimistic_unchoke_time_scaler = 0;                                                                                                                                     |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|t->choke_peer(*p);                                                                                                                                                             |
│ │ │ │ │ +|				p->reset_choke_counters();                                                                                                                                                 |
│ │ │ │ │ +|				continue;                                                                                                                                                                  |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		optimize_storage();                                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	std::tuple<merkle_tree::set_block_result, int, int> merkle_tree::set_block(int const block_index                                                                              |
│ │ │ │ │ -|		, sha256_hash const& h)                                                                                                                                                      |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS                                                                                                                                      |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|		TORRENT_ASSERT(block_index < m_num_blocks);                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		auto const num_leafs = merkle_num_leafs(m_num_blocks);                                                                                                                       |
│ │ │ │ │ -|		auto const first_leaf = merkle_first_leaf(num_leafs);                                                                                                                        |
│ │ │ │ │ -|		auto const block_tree_index = first_leaf + block_index;                                                                                                                      |
│ │ │ │ │ +|			peers.push_back(p.get());                                                                                                                                                   |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (blocks_verified(block_index, 1))                                                                                                                                         |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// if this blocks's hash is already known, check the passed-in hash against it                                                                                              |
│ │ │ │ │ -|			if (compare_node(block_tree_index, h))                                                                                                                                      |
│ │ │ │ │ -|				return std::make_tuple(set_block_result::ok, block_index, 1);                                                                                                              |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ -|_	_	_	_	_r_e_t_u_r_n_ _s_t_d_:_:_m_a_k_e___t_u_p_l_e_(_s_e_t___b_l_o_c_k___r_e_s_u_l_t_:_:_b_l_o_c_k___h_a_s_h___f_a_i_l_e_d_,_ _b_l_o_c_k___i_n_d_e_x_,_ _1_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_5_1_4_ _ _ _ _|_u_s_e_ _s_t_r_u_c_t_u_r_e_d_ _b_i_n_d_i_n_g_ _i_n_ _C_+_+_1_7_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** uussee ssttrruuccttuurreedd bbiinnddiinngg iinn CC++++1177 **********                                                                                                                                    |
│ │ │ │ │ -|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::551144 ******                                                                                                                                             |
│ │ │ │ │ -|auto const first_leaf = merkle_first_leaf(num_leafs);                                                                                                                          |
│ │ │ │ │ -|		auto const block_tree_index = first_leaf + block_index;                                                                                                                      |
│ │ │ │ │ +|		int const allowed_upload_slots = unchoke_sort(peers                                                                                                                          |
│ │ │ │ │ +|			, unchoke_interval, m_settings);                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (blocks_verified(block_index, 1))                                                                                                                                         |
│ │ │ │ │ +|		if (m_settings.get_int(settings_pack::choking_algorithm) == settings_pack::fixed_slots_choker)                                                                               |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// if this blocks's hash is already known, check the passed-in hash against it                                                                                              |
│ │ │ │ │ -|			if (compare_node(block_tree_index, h))                                                                                                                                      |
│ │ │ │ │ -|				return std::make_tuple(set_block_result::ok, block_index, 1);                                                                                                              |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ -|				return std::make_tuple(set_block_result::block_hash_failed, block_index, 1);                                                                                               |
│ │ │ │ │ +|			int const upload_slots = get_int_setting(settings_pack::unchoke_slots_limit);                                                                                               |
│ │ │ │ │ +|			m_stats_counters.set_value(counters::num_unchoke_slots, upload_slots);                                                                                                      |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		allocate_full();                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		m_tree[block_tree_index] = h;                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// to avoid wasting a lot of time hashing nodes only to discover they                                                                                                        |
│ │ │ │ │ -|		// cannot be verified, check first to see if the root of the largest                                                                                                         |
│ │ │ │ │ -|		// computable subtree is known                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|int leafs_start;                                                                                                                                                               |
│ │ │ │ │ -|int leafs_size;                                                                                                                                                                |
│ │ │ │ │ -|		int root_index;                                                                                                                                                              |
│ │ │ │ │ -|		std::tie(leafs_start, leafs_size, root_index) =                                                                                                                              |
│ │ │ │ │ -|			merkle_find_known_subtree(m_tree, block_index, m_num_blocks);                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// if the root node is unknown the hashes cannot be verified yet                                                                                                             |
│ │ │ │ │ -|		if (m_tree[root_index].is_all_zeros())                                                                                                                                       |
│ │ │ │ │ -|			return std::make_tuple(set_block_result::unknown, leafs_start, leafs_size);                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// save the root hash because merkle_fill_tree will overwrite it                                                                                                             |
│ │ │ │ │ -|		sha256_hash const root = m_tree[root_index];                                                                                                                                 |
│ │ │ │ │ -|		merkle_fill_tree(m_tree, leafs_size, first_leaf + leafs_start);                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (root != m_tree[root_index])                                                                                                                                              |
│ │ │ │ │ +|		else                                                                                                                                                                         |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// hash failure, clear all the internal nodes                                                                                                                               |
│ │ │ │ │ -|			// the whole piece failed the hash check. Clear all block hashes                                                                                                            |
│ │ │ │ │ -|			// in this piece and report a hash failure                                                                                                                                  |
│ │ │ │ │ -|			merkle_clear_tree(m_tree, leafs_size, first_leaf + leafs_start);                                                                                                            |
│ │ │ │ │ -|			m_tree[root_index] = root;                                                                                                                                                  |
│ │ │ │ │ -|			return std::make_tuple(set_block_result::hash_failed, leafs_start, leafs_size);                                                                                             |
│ │ │ │ │ -|_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_e_r_k_l_e___t_r_e_e_._c_p_p_:_5_3_9_ _ _ _ _|_t_h_i_s_ _c_o_u_l_d_ _b_e_ _d_o_n_e_ _m_o_r_e_ _e_f_f_i_c_i_e_n_t_l_y_ _i_f_ _b_i_t_f_i_e_l_d_ _h_a_d_ _a_ _f_u_n_c_t_i_o_n_ _t_o_ _s_e_t_ _a_ _r_a_n_g_e_ _o_f_ _b_i_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss ccoouulldd bbee ddoonnee mmoorree eeffffiicciieennttllyy iiff bbiittffiieelldd hhaadd aa ffuunnccttiioonn ttoo sseett aa rraannggee ooff bbiittss **********                                                                              |
│ │ │ │ │ -|****** ....//ssrrcc//mmeerrkkllee__ttrreeee..ccpppp::553399 ******                                                                                                                                             |
│ │ │ │ │ -|merkle_find_known_subtree(m_tree, block_index, m_num_blocks);                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// if the root node is unknown the hashes cannot be verified yet                                                                                                             |
│ │ │ │ │ -|		if (m_tree[root_index].is_all_zeros())                                                                                                                                       |
│ │ │ │ │ -|			return std::make_tuple(set_block_result::unknown, leafs_start, leafs_size);                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// save the root hash because merkle_fill_tree will overwrite it                                                                                                             |
│ │ │ │ │ -|		sha256_hash const root = m_tree[root_index];                                                                                                                                 |
│ │ │ │ │ -|		merkle_fill_tree(m_tree, leafs_size, first_leaf + leafs_start);                                                                                                              |
│ │ │ │ │ +|			m_stats_counters.set_value(counters::num_unchoke_slots                                                                                                                      |
│ │ │ │ │ +|				, allowed_upload_slots);                                                                                                                                                   |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (root != m_tree[root_index])                                                                                                                                              |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		if (should_log())                                                                                                                                                            |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// hash failure, clear all the internal nodes                                                                                                                               |
│ │ │ │ │ -|			// the whole piece failed the hash check. Clear all block hashes                                                                                                            |
│ │ │ │ │ -|			// in this piece and report a hash failure                                                                                                                                  |
│ │ │ │ │ -|			merkle_clear_tree(m_tree, leafs_size, first_leaf + leafs_start);                                                                                                            |
│ │ │ │ │ -|			m_tree[root_index] = root;                                                                                                                                                  |
│ │ │ │ │ -|			return std::make_tuple(set_block_result::hash_failed, leafs_start, leafs_size);                                                                                             |
│ │ │ │ │ +|			session_log("RECALCULATE UNCHOKE SLOTS: [ peers: %d "                                                                                                                       |
│ │ │ │ │ +|				"eligible-peers: %d"                                                                                                                                                       |
│ │ │ │ │ +|				" allowed-slots: %d ]"                                                                                                                                                     |
│ │ │ │ │ +|				, int(m_connections.size())                                                                                                                                                |
│ │ │ │ │ +|_	_	_	_	_,_ _i_n_t_(_p_e_e_r_s_._s_i_z_e_(_)_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|           |                              |it might be a nice feature here to limit the number of torrents to send in a single update. By just posting the first n torrents,   |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_4_7_8_6  |they would nicely be round-robined because the torrent lists are always pushed back. Perhaps the status_update_alert could even have|
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_a_ _f_i_x_e_d_ _a_r_r_a_y_ _o_f_ _n_ _e_n_t_r_i_e_s_ _r_a_t_h_e_r_ _t_h_a_n_ _a_ _v_e_c_t_o_r_,_ _t_o_ _f_u_r_t_h_e_r_ _i_m_p_r_o_v_e_ _m_e_m_o_r_y_ _l_o_c_a_l_i_t_y_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt mmiigghhtt bbee aa nniiccee ffeeaattuurree hheerree ttoo lliimmiitt tthhee nnuummbbeerr ooff ttoorrrreennttss ttoo sseenndd iinn aa ssiinnggllee uuppddaattee.. BByy jjuusstt ppoossttiinngg tthhee ffiirrsstt nn ttoorrrreennttss,, tthheeyy wwoouulldd nniicceellyy bbee rroouunndd--rroobbiinneedd     |
│ │ │ │ │ +|bbeeccaauussee tthhee ttoorrrreenntt lliissttss aarree aallwwaayyss ppuusshheedd bbaacckk.. PPeerrhhaappss tthhee ssttaattuuss__uuppddaattee__aalleerrtt ccoouulldd eevveenn hhaavvee aa ffiixxeedd aarrrraayy ooff nn eennttrriieess rraatthheerr tthhaann aa vveeccttoorr,, ttoo ffuurrtthheerr iimmpprroovvee mmeemmoorryy   |
│ │ │ │ │ +|llooccaalliittyy.. **********                                                                                                                                                                |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::44778866 ******                                                                                                                                           |
│ │ │ │ │ +|t->status(&st, flags);                                                                                                                                                         |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|int const leafs_end = std::min(m_num_blocks, leafs_start + leafs_size);                                                                                                        |
│ │ │ │ │ -|for (int i = leafs_start; i < leafs_end; ++i)                                                                                                                                  |
│ │ │ │ │ -|			m_block_verified.set_bit(i);                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// attempting to optimize storage is quite costly, only do it if we have                                                                                                     |
│ │ │ │ │ -|		// a reason to believe it might have an effect                                                                                                                               |
│ │ │ │ │ -|		if (block_index == m_num_blocks - 1 || !m_tree[block_tree_index + 1].is_all_zeros())                                                                                         |
│ │ │ │ │ -|			optimize_storage();                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		return std::make_tuple(set_block_result::ok, leafs_start, leafs_size);                                                                                                       |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	std::size_t merkle_tree::size() const                                                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		return static_cast<std::size_t>(merkle_num_nodes(merkle_num_leafs(m_num_blocks)));                                                                                           |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	int merkle_tree::num_pieces() const                                                                                                                                           |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		int const ps = blocks_per_piece();                                                                                                                                           |
│ │ │ │ │ -|		TORRENT_ASSERT(ps > 0);                                                                                                                                                      |
│ │ │ │ │ -|		return (m_num_blocks + ps - 1) >> m_blocks_per_piece_log;                                                                                                                    |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	int merkle_tree::block_layer_start() const                                                                                                                                    |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		int const num_leafs = merkle_num_leafs(m_num_blocks);                                                                                                                        |
│ │ │ │ │ -|		TORRENT_ASSERT(num_leafs > 0);                                                                                                                                               |
│ │ │ │ │ -|		return merkle_first_leaf(num_leafs);                                                                                                                                         |
│ │ │ │ │ -|_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_e___c_r_y_p_t_o_._c_p_p_:_6_0_ _ _ _ _ _ _ _|_i_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _g_e_t_ _t_h_e_ _l_i_t_e_r_a_l_ _w_o_r_k_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd bbee nniiccee ttoo ggeett tthhee lliitteerraall wwoorrkkiinngg **********                                                                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//ppee__ccrryyppttoo..ccpppp::6600 ******                                                                                                                                                |
│ │ │ │ │ -|#include <algorithm>                                                                                                                                                           |
│ │ │ │ │ -|#include <random>                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_push.hpp"                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#include <boost/multiprecision/integer.hpp>                                                                                                                                    |
│ │ │ │ │ -|#include <boost/multiprecision/cpp_int.hpp>                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/random.hpp"                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/alloca.hpp"                                                                                                                                          |
│ │ │ │ │ -|#include "libtorrent/pe_crypto.hpp"                                                                                                                                            |
│ │ │ │ │ -|#include "libtorrent/hasher.hpp"                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	namespace mp = boost::multiprecision;                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	namespace {                                                                                                                                                                   |
│ │ │ │ │ -|key_t const dh_prime                                                                                                                                                           |
│ │ │ │ │ -|("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63|36210000000000090563");
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::array<char, 96> export_key(key_t const& k)                                                                                                                               |
│ │ │ │ │ +|	void session_impl::post_torrent_updates(status_flags_t const flags)                                                                                                           |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::array<char, 96> ret;                                                                                                                                                    |
│ │ │ │ │ -|		auto* begin = reinterpret_cast<std::uint8_t*>(ret.data());                                                                                                                   |
│ │ │ │ │ -|_	_	_s_t_d_:_:_u_i_n_t_8___t_*_ _e_n_d_ _=_ _m_p_:_:_e_x_p_o_r_t___b_i_t_s_(_k_,_ _b_e_g_i_n_,_ _8_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_e___c_r_y_p_t_o_._c_p_p_:_7_1_ _ _ _ _ _ _ _|_i_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _b_e_ _a_b_l_e_ _t_o_ _e_x_p_o_r_t_ _t_o_ _a_ _f_i_x_e_d_ _w_i_d_t_h_ _f_i_e_l_d_,_ _s_o_ _w_e_ _w_o_u_l_d_n_'_t_ _h_a_v_e_ _t_o_ _s_h_i_f_t_ _i_t_ _l_a_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd bbee nniiccee ttoo bbee aabbllee ttoo eexxppoorrtt ttoo aa ffiixxeedd wwiiddtthh ffiieelldd,, ssoo wwee wwoouullddnn''tt hhaavvee ttoo sshhiifftt iitt llaatteerr **********                                                                |
│ │ │ │ │ -|****** ....//ssrrcc//ppee__ccrryyppttoo..ccpppp::7711 ******                                                                                                                                                |
│ │ │ │ │ -|#include "libtorrent/random.hpp"                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/alloca.hpp"                                                                                                                                          |
│ │ │ │ │ -|#include "libtorrent/pe_crypto.hpp"                                                                                                                                            |
│ │ │ │ │ -|#include "libtorrent/hasher.hpp"                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	namespace mp = boost::multiprecision;                                                                                                                                         |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	namespace {                                                                                                                                                                   |
│ │ │ │ │ -|		key_t const dh_prime                                                                                                                                                         |
│ │ │ │ │ -|			                                                                                                                                                                            |
│ │ │ │ │ -|("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63|36210000000000090563");
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(is_single_thread());                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::array<char, 96> export_key(key_t const& k)                                                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::array<char, 96> ret;                                                                                                                                                    |
│ │ │ │ │ -|		auto* begin = reinterpret_cast<std::uint8_t*>(ret.data());                                                                                                                   |
│ │ │ │ │ -|		std::uint8_t* end = mp::export_bits(k, begin, 8);                                                                                                                            |
│ │ │ │ │ +|		std::vector<torrent*>& state_updates                                                                                                                                         |
│ │ │ │ │ +|			= m_torrent_lists[aux::session_impl::torrent_state_updates];                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|if (end < begin + 96)                                                                                                                                                          |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|			int const len = int(end - begin);                                                                                                                                           |
│ │ │ │ │ -|#if defined __GNUC__ && __GNUC__ == 12                                                                                                                                         |
│ │ │ │ │ -|#pragma GCC diagnostic push                                                                                                                                                    |
│ │ │ │ │ -|#pragma GCC diagnostic ignored "-Wstringop-overflow"                                                                                                                           |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|			std::memmove(begin + 96 - len, begin, aux::numeric_cast<std::size_t>(len));                                                                                                 |
│ │ │ │ │ -|#if defined __GNUC__ && __GNUC__ == 12                                                                                                                                         |
│ │ │ │ │ -|#pragma GCC diagnostic pop                                                                                                                                                     |
│ │ │ │ │ +|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ +|		m_posting_torrent_updates = true;                                                                                                                                            |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|			std::memset(begin, 0, aux::numeric_cast<std::size_t>(96 - len));                                                                                                            |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void rc4_init(const unsigned char* in, std::size_t len, rc4 *state);                                                                                                          |
│ │ │ │ │ -|	std::size_t rc4_encrypt(unsigned char *out, std::size_t outlen, rc4 *state);                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// Set the prime P and the generator, generate local public key                                                                                                               |
│ │ │ │ │ -|	dh_key_exchange::dh_key_exchange()                                                                                                                                            |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		aux::array<std::uint8_t, 96> random_key;                                                                                                                                     |
│ │ │ │ │ -|		aux::random_bytes({reinterpret_cast<char*>(random_key.data())                                                                                                                |
│ │ │ │ │ -|			, static_cast<std::ptrdiff_t>(random_key.size())});                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// create local key (random)                                                                                                                                                 |
│ │ │ │ │ -|		mp::import_bits(m_dh_local_secret, random_key.begin(), random_key.end());                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// key = (2 ^ secret) % prime                                                                                                                                                |
│ │ │ │ │ -|_	_	_m___d_h___l_o_c_a_l___k_e_y_ _=_ _m_p_:_:_p_o_w_m_(_k_e_y___t_(_2_)_,_ _m___d_h___l_o_c_a_l___s_e_c_r_e_t_,_ _d_h___p_r_i_m_e_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_f_i_l_e___s_t_o_r_a_g_e_._c_p_p_:_4_5_7_ _ _ _|_m_a_y_b_e_ _i_t_ _w_o_u_l_d_ _b_e_ _n_i_c_e_ _t_o_ _h_a_v_e_ _a_ _b_e_t_t_e_r_ _i_n_d_e_x_ _h_e_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmaayybbee iitt wwoouulldd bbee nniiccee ttoo hhaavvee aa bbeetttteerr iinnddeexx hheerree **********                                                                                                                 |
│ │ │ │ │ -|****** ....//ssrrcc//ffiillee__ssttoorraaggee..ccpppp::445577 ******                                                                                                                                            |
│ │ │ │ │ -|// find the file iterator and file offset                                                                                                                                      |
│ │ │ │ │ -|		aux::file_entry target;                                                                                                                                                      |
│ │ │ │ │ -|		target.offset = aux::numeric_cast<std::uint64_t>(offset);                                                                                                                    |
│ │ │ │ │ -|		TORRENT_ASSERT(!compare_file_offset(target, m_files.front()));                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		auto file_iter = std::upper_bound(                                                                                                                                           |
│ │ │ │ │ -|			m_files.begin(), m_files.end(), target, compare_file_offset);                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(file_iter != m_files.begin());                                                                                                                                |
│ │ │ │ │ -|		--file_iter;                                                                                                                                                                 |
│ │ │ │ │ -|		return file_index_t{int(file_iter - m_files.begin())};                                                                                                                       |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	file_index_t file_storage::file_index_at_piece(piece_index_t const piece) const                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		return file_index_at_offset(static_cast<int>(piece) * std::int64_t(piece_length()));                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		std::vector<torrent_status> status;                                                                                                                                          |
│ │ │ │ │ +|		status.reserve(state_updates.size());                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	file_index_t file_storage::file_index_for_root(sha256_hash const& root_hash) const                                                                                            |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|for (file_index_t const i : file_range())                                                                                                                                      |
│ │ │ │ │ +|for (auto& t : state_updates)                                                                                                                                                  |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │ -|			if (root(i) == root_hash) return i;                                                                                                                                         |
│ │ │ │ │ +|			TORRENT_ASSERT(t->m_links[aux::session_impl::torrent_state_updates].in_list());                                                                                             |
│ │ │ │ │ +|			status.emplace_back();                                                                                                                                                      |
│ │ │ │ │ +|			// querying accurate download counters may require                                                                                                                          |
│ │ │ │ │ +|			// the torrent to be loaded. Loading a torrent, and evicting another                                                                                                        |
│ │ │ │ │ +|			// one will lead to calling state_updated(), which screws with                                                                                                              |
│ │ │ │ │ +|			// this list while we're working on it, and break things                                                                                                                    |
│ │ │ │ │ +|			t->status(&status.back(), flags);                                                                                                                                           |
│ │ │ │ │ +|			t->clear_in_state_update();                                                                                                                                                 |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		return file_index_t{-1};                                                                                                                                                     |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	piece_index_t file_storage::piece_index_at_file(file_index_t f) const                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		return piece_index_t{aux::numeric_cast<int>(file_offset(f) / piece_length())};                                                                                               |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION <= 2                                                                                                                                                   |
│ │ │ │ │ -|	char const* file_storage::file_name_ptr(file_index_t const index) const                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		return m_files[index].name;                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		state_updates.clear();                                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	int file_storage::file_name_len(file_index_t const index) const                                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		if (m_files[index].name_len == aux::file_entry::name_is_owned)                                                                                                               |
│ │ │ │ │ -|			return -1;                                                                                                                                                                  |
│ │ │ │ │ -|		return m_files[index].name_len;                                                                                                                                              |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|#if TORRENT_USE_ASSERTS                                                                                                                                                        |
│ │ │ │ │ +|		m_posting_torrent_updates = false;                                                                                                                                           |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	std::vector<file_slice> file_storage::map_block(piece_index_t const piece                                                                                                     |
│ │ │ │ │ -|		, std::int64_t const offset, std::int64_t size) const                                                                                                                        |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT_PRECOND(piece >= piece_index_t{0});                                                                                                                           |
│ │ │ │ │ -|_	_	_T_O_R_R_E_N_T___A_S_S_E_R_T___P_R_E_C_O_N_D_(_p_i_e_c_e_ _<_ _e_n_d___p_i_e_c_e_(_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_f_i_l_e___s_t_o_r_a_g_e_._c_p_p_:_1_2_4_2_ _ _|_t_h_i_s_ _w_o_u_l_d_ _b_e_ _m_o_r_e_ _e_f_f_i_c_i_e_n_t_ _i_f_ _m___p_a_t_h_s_ _w_a_s_ _s_o_r_t_e_d_ _f_i_r_s_t_,_ _s_u_c_h_ _t_h_a_t_ _a_ _l_o_w_e_r_ _p_a_t_h_ _i_n_d_e_x_ _a_l_w_a_y_s_ _m_e_a_n_t_ _s_o_r_t_e_d_-_b_e_f_o_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss wwoouulldd bbee mmoorree eeffffiicciieenntt iiff mm__ppaatthhss wwaass ssoorrtteedd ffiirrsstt,, ssuucchh tthhaatt aa lloowweerr ppaatthh iinnddeexx aallwwaayyss mmeeaanntt ssoorrtteedd--bbeeffoorree **********                                                  |
│ │ │ │ │ -|****** ....//ssrrcc//ffiillee__ssttoorraaggee..ccpppp::11224422 ******                                                                                                                                           |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|		m_alerts.emplace_alert<state_update_alert>(std::move(status));                                                                                                               |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void file_storage::canonicalize_impl(bool const backwards_compatible)                                                                                                         |
│ │ │ │ │ +|	void session_impl::post_session_stats()                                                                                                                                       |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(piece_length() >= 16 * 1024);                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// use this vector to track the new ordering of files                                                                                                                        |
│ │ │ │ │ -|		// this allows the use of STL algorithms despite them                                                                                                                        |
│ │ │ │ │ -|		// not supporting a custom swap functor                                                                                                                                      |
│ │ │ │ │ -|		aux::vector<file_index_t, file_index_t> new_order(end_file());                                                                                                               |
│ │ │ │ │ -|		for (auto i : file_range())                                                                                                                                                  |
│ │ │ │ │ -|			new_order[i] = i;                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// remove any existing pad files                                                                                                                                             |
│ │ │ │ │ +|		if (!m_posted_stats_header)                                                                                                                                                  |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			auto pad_begin = std::partition(new_order.begin(), new_order.end()                                                                                                          |
│ │ │ │ │ -|				, [this](file_index_t i) { return !m_files[i].pad_file; });                                                                                                                |
│ │ │ │ │ -|			new_order.erase(pad_begin, new_order.end());                                                                                                                                |
│ │ │ │ │ +|			m_posted_stats_header = true;                                                                                                                                               |
│ │ │ │ │ +|			m_alerts.emplace_alert<session_stats_header_alert>();                                                                                                                       |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ +|		m_disk_thread->update_stats_counters(m_stats_counters);                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|// sort files by path/name                                                                                                                                                     |
│ │ │ │ │ -|		std::sort(new_order.begin(), new_order.end()                                                                                                                                 |
│ │ │ │ │ -|			, [this](file_index_t l, file_index_t r)                                                                                                                                    |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|_	_	_i_f_ _(_m___d_h_t_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_1_6_1_ _ _|_f_a_c_t_o_r_ _o_u_t_ _t_h_i_s_ _l_o_g_i_c_ _i_n_t_o_ _a_ _s_e_p_a_r_a_t_e_ _f_u_n_c_t_i_o_n_ _f_o_r_ _u_n_i_t_ _t_e_s_t_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ffaaccttoorr oouutt tthhiiss llooggiicc iinnttoo aa sseeppaarraattee ffuunnccttiioonn ffoorr uunniitt tteessttiinngg **********                                                                                                    |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::55116611 ******                                                                                                                                           |
│ │ │ │ │ +|if (m_settings.get_int(settings_pack::outgoing_port) > 0)                                                                                                                      |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			// assuming m_paths are unique!                                                                                                                                             |
│ │ │ │ │ -|			auto const& lf = m_files[l];                                                                                                                                                |
│ │ │ │ │ -|			auto const& rf = m_files[r];                                                                                                                                                |
│ │ │ │ │ -|			if (lf.path_index != rf.path_index)                                                                                                                                         |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				int const ret = path_compare(m_paths[lf.path_index], lf.filename()                                                                                                         |
│ │ │ │ │ -|					, m_paths[rf.path_index], rf.filename());                                                                                                                                 |
│ │ │ │ │ -|				if (ret != 0) return ret < 0;                                                                                                                                              |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			return lf.filename() < rf.filename();                                                                                                                                       |
│ │ │ │ │ -|		});                                                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		aux::vector<aux::file_entry, file_index_t> new_files;                                                                                                                        |
│ │ │ │ │ -|		aux::vector<char const*, file_index_t> new_file_hashes;                                                                                                                      |
│ │ │ │ │ -|		aux::vector<std::time_t, file_index_t> new_mtime;                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// reserve enough space for the worst case after padding                                                                                                                     |
│ │ │ │ │ -|		new_files.reserve(new_order.size() * 2 - 1);                                                                                                                                 |
│ │ │ │ │ -|		if (!m_file_hashes.empty())                                                                                                                                                  |
│ │ │ │ │ -|			new_file_hashes.reserve(new_order.size() * 2 - 1);                                                                                                                          |
│ │ │ │ │ -|		if (!m_mtime.empty())                                                                                                                                                        |
│ │ │ │ │ -|			new_mtime.reserve(new_order.size() * 2 - 1);                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// re-compute offsets and insert pad files as necessary                                                                                                                      |
│ │ │ │ │ -|_	_	_s_t_d_:_:_i_n_t_6_4___t_ _o_f_f_ _=_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_f_i_l_e___s_t_o_r_a_g_e_._c_p_p_:_1_3_4_5_ _ _|_i_n_ _C_+_+_1_7_ _t_h_i_s_ _c_o_u_l_d_ _b_e_ _s_t_r_i_n_g___v_i_e_w_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinn CC++++1177 tthhiiss ccoouulldd bbee ssttrriinngg__vviieeww **********                                                                                                                                 |
│ │ │ │ │ -|****** ....//ssrrcc//ffiillee__ssttoorraaggee..ccpppp::11334455 ******                                                                                                                                           |
│ │ │ │ │ -|add_pad_file(i);                                                                                                                                                               |
│ │ │ │ │ +|#ifdef TORRENT_WINDOWS                                                                                                                                                         |
│ │ │ │ │ +|			s.set_option(exclusive_address_use(true), ec);                                                                                                                              |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|			s.set_option(tcp::acceptor::reuse_address(true), ec);                                                                                                                       |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|			// ignore errors because the underlying socket may not                                                                                                                      |
│ │ │ │ │ +|			// be opened yet. This happens when we're routing through                                                                                                                   |
│ │ │ │ │ +|			// a proxy. In that case, we don't yet know the address of                                                                                                                  |
│ │ │ │ │ +|			// the proxy server, and more importantly, we don't know                                                                                                                    |
│ │ │ │ │ +|			// the address family of its address. This means we can't                                                                                                                   |
│ │ │ │ │ +|			// open the socket yet. The socks abstraction layer defers                                                                                                                  |
│ │ │ │ │ +|			// opening it.                                                                                                                                                              |
│ │ │ │ │ +|			ec.clear();                                                                                                                                                                 |
│ │ │ │ │ +|			bind_ep.port(std::uint16_t(next_port()));                                                                                                                                   |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		m_files = std::move(new_files);                                                                                                                                              |
│ │ │ │ │ -|		m_file_hashes = std::move(new_file_hashes);                                                                                                                                  |
│ │ │ │ │ -|		m_mtime = std::move(new_mtime);                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		m_total_size = off;                                                                                                                                                          |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void file_storage::sanitize_symlinks()                                                                                                                                        |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		// symlinks are unusual, this function is optimized assuming there are no                                                                                                    |
│ │ │ │ │ -|		// symbolic links in the torrent. If we find one symbolic link, we'll                                                                                                        |
│ │ │ │ │ -|		// build the hash table of files it's allowed to refer to, but don't pay                                                                                                     |
│ │ │ │ │ -|		// that price up-front.                                                                                                                                                      |
│ │ │ │ │ -|		std::unordered_map<std::string, file_index_t> file_map;                                                                                                                      |
│ │ │ │ │ -|		bool file_map_initialized = false;                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// lazily instantiated set of all valid directories a symlink may point to                                                                                                   |
│ │ │ │ │ -|std::unordered_set<std::string> dir_map;                                                                                                                                       |
│ │ │ │ │ -|bool dir_map_initialized = false;                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// symbolic links that points to directories                                                                                                                                 |
│ │ │ │ │ -|		std::unordered_map<std::string, std::string> dir_links;                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// we validate symlinks in (potentially) 2 passes over the files.                                                                                                            |
│ │ │ │ │ -|		// remaining symlinks to validate after the first pass                                                                                                                       |
│ │ │ │ │ -|		std::vector<file_index_t> symlinks_to_validate;                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		for (auto const i : file_range())                                                                                                                                            |
│ │ │ │ │ +|		if (is_utp(s))                                                                                                                                                               |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (!(file_flags(i) & file_storage::flag_symlink)) continue;                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			if (!file_map_initialized)                                                                                                                                                  |
│ │ │ │ │ +|utp_socket_impl* impl = nullptr;                                                                                                                                               |
│ │ │ │ │ +|			transport ssl = transport::plaintext;                                                                                                                                       |
│ │ │ │ │ +|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ +|			if (boost::get<ssl_stream<utp_stream>>(&s) != nullptr)                                                                                                                      |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				for (auto const j : file_range())                                                                                                                                          |
│ │ │ │ │ -|					file_map.insert({internal_file_path(j), j});                                                                                                                              |
│ │ │ │ │ -|				file_map_initialized = true;                                                                                                                                               |
│ │ │ │ │ +|				impl = boost::get<ssl_stream<utp_stream>>(s).next_layer().get_impl();                                                                                                      |
│ │ │ │ │ +|				ssl = transport::ssl;                                                                                                                                                      |
│ │ │ │ │  |			}                                                                                                                                                                           |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|				impl = boost::get<utp_stream>(s).get_impl();                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			aux::file_entry const& fe = m_files[i];                                                                                                                                     |
│ │ │ │ │ -|			TORRENT_ASSERT(fe.symlink_index < int(m_symlinks.size()));                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// symlink targets are only allowed to point to files or directories in                                                                                                     |
│ │ │ │ │ -|			// this torrent.                                                                                                                                                            |
│ │ │ │ │ +|			std::vector<std::shared_ptr<listen_socket_t>> with_gateways;                                                                                                                |
│ │ │ │ │ +|			std::shared_ptr<listen_socket_t> match;                                                                                                                                     |
│ │ │ │ │ +|			for (auto& ls : m_listen_sockets)                                                                                                                                           |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				std::string target = m_symlinks[fe.symlink_index];                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|				if (is_complete(target))                                                                                                                                                   |
│ │ │ │ │ -|_	_	_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_u_t_p___s_o_c_k_e_t___m_a_n_a_g_e_r_._c_p_p_:|this should not be heap allocated, sockets should be movable                                                                        |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_2_0_4_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss sshhoouulldd nnoott bbee hheeaapp aallllooccaatteedd,, ssoocckkeettss sshhoouulldd bbee mmoovvaabbllee **********                                                                                                       |
│ │ │ │ │ -|****** ....//ssrrcc//uuttpp__ssoocckkeett__mmaannaaggeerr..ccpppp::220044 ******                                                                                                                                      |
│ │ │ │ │ -|//		UTP_LOGV("incoming packet id:%d source:%s\n", id, print_endpoint(ep).c_str());                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (!m_sett.get_bool(settings_pack::enable_incoming_utp))                                                                                                                    |
│ │ │ │ │ -|			return false;                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// if not found, see if it's a SYN packet, if it is,                                                                                                                         |
│ │ │ │ │ -|		// create a new utp_stream                                                                                                                                                   |
│ │ │ │ │ -|		if (ph->get_type() == ST_SYN)                                                                                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// possible SYN flood. Just ignore                                                                                                                                          |
│ │ │ │ │ -|			if (int(m_utp_sockets.size()) > m_sett.get_int(settings_pack::connections_limit) * 2)                                                                                       |
│ │ │ │ │ -|				return false;                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			TORRENT_ASSERT(m_new_connection == -1);                                                                                                                                     |
│ │ │ │ │ -|			// create the new socket with this ID                                                                                                                                       |
│ │ │ │ │ -|			m_new_connection = id;                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|//			UTP_LOGV("not found, new connection id:%d\n", m_new_connection);                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|aux::socket_type c(aux::instantiate_connection(m_ios, aux::proxy_settings(), m_ssl_context, this, true, false));                                                               |
│ │ │ │ │ +|				// this is almost, but not quite, like can_route()                                                                                                                         |
│ │ │ │ │ +|				if (!(ls->flags & listen_socket_t::proxy)                                                                                                                                  |
│ │ │ │ │ +|					&& is_v4(ls->local_endpoint) != remote_address.is_v4())                                                                                                                   |
│ │ │ │ │ +|					continue;                                                                                                                                                                 |
│ │ │ │ │ +|				if (ls->ssl != ssl) continue;                                                                                                                                              |
│ │ │ │ │ +|				if (!(ls->flags & listen_socket_t::local_network))                                                                                                                         |
│ │ │ │ │ +|					with_gateways.push_back(ls);                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			utp_stream* str = nullptr;                                                                                                                                                  |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ -|			if (is_ssl(c))                                                                                                                                                              |
│ │ │ │ │ -|				str = &boost::get<ssl_stream<utp_stream>>(c).next_layer();                                                                                                                 |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ +|				if (ls->flags & listen_socket_t::proxy                                                                                                                                     |
│ │ │ │ │ +|					|| match_addr_mask(ls->local_endpoint.address(), remote_address, ls->netmask))                                                                                            |
│ │ │ │ │ +|				{                                                                                                                                                                          |
│ │ │ │ │ +|					// is this better than the previous match?                                                                                                                                |
│ │ │ │ │ +|					match = ls;                                                                                                                                                               |
│ │ │ │ │ +|_	_	_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_5_8_8_0_ _ _|_r_e_f_a_c_t_o_r_,_ _m_o_v_e_ _t_h_e_ _s_t_o_r_a_g_e_ _t_o_ _d_h_t___t_r_a_c_k_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** rreeffaaccttoorr,, mmoovvee tthhee ssttoorraaggee ttoo ddhhtt__ttrraacckkeerr **********                                                                                                                          |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::55888800 ******                                                                                                                                           |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|			session_log("not starting DHT, outstanding router lookups: %d"                                                                                                              |
│ │ │ │ │ +|				, m_outstanding_router_lookups);                                                                                                                                           |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|				str = boost::get<utp_stream>(&c);                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			TORRENT_ASSERT(str);                                                                                                                                                        |
│ │ │ │ │ -|			int const mtu = mtu_for_dest(ep.address());                                                                                                                                 |
│ │ │ │ │ -|			str->get_impl()->init_mtu(mtu);                                                                                                                                             |
│ │ │ │ │ -|			str->get_impl()->m_sock = std::move(socket);                                                                                                                                |
│ │ │ │ │ -|			bool const ret = str->get_impl()->incoming_packet(p, ep, receive_time);                                                                                                     |
│ │ │ │ │ -|			if (!ret) return false;                                                                                                                                                     |
│ │ │ │ │ -|			m_last_socket = str->get_impl();                                                                                                                                            |
│ │ │ │ │ -|			m_cb(std::move(c));                                                                                                                                                         |
│ │ │ │ │ -|			// the connection most likely changed its connection ID here                                                                                                                |
│ │ │ │ │ -|			// we need to move it to the correct ID                                                                                                                                     |
│ │ │ │ │ -|			return true;                                                                                                                                                                |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (ph->get_type() == ST_RESET) return false;                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// #error send reset                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		return false;                                                                                                                                                                |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_	_v_o_i_d_ _u_t_p___s_o_c_k_e_t___m_a_n_a_g_e_r_:_:_s_u_b_s_c_r_i_b_e___w_r_i_t_a_b_l_e_(_u_t_p___s_o_c_k_e_t___i_m_p_l_*_ _s_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_m_m_a_p___d_i_s_k___i_o_._c_p_p_:_5_7_8_ _ _ _|_i_n_ _t_h_e_ _f_u_t_u_r_e_,_ _p_r_o_p_a_g_a_t_e_ _e_x_c_e_p_t_i_o_n_s_ _b_a_c_k_ _t_o_ _t_h_e_ _h_a_n_d_l_e_r_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinn tthhee ffuuttuurree,, pprrooppaaggaattee eexxcceeppttiioonnss bbaacckk ttoo tthhee hhaannddlleerrss **********                                                                                                           |
│ │ │ │ │ -|****** ....//ssrrcc//mmmmaapp__ddiisskk__iioo..ccpppp::557788 ******                                                                                                                                            |
│ │ │ │ │ -|#if DEBUG_DISK_THREAD                                                                                                                                                          |
│ │ │ │ │ +|		if (m_abort)                                                                                                                                                                 |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			std::unique_lock<std::mutex> l(m_job_mutex);                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			DLOG("perform_job job: %s ( %s%s) piece: %d offset: %d outstanding: %d\n"                                                                                                   |
│ │ │ │ │ -|				, job_action_name[j->action]                                                                                                                                               |
│ │ │ │ │ -|				, (j->flags & mmap_disk_job::fence) ? "fence ": ""                                                                                                                         |
│ │ │ │ │ -|				, (j->flags & mmap_disk_job::force_copy) ? "force_copy ": ""                                                                                                               |
│ │ │ │ │ -|				, static_cast<int>(j->piece), j->d.io.offset                                                                                                                               |
│ │ │ │ │ -|				, j->storage ? j->storage->num_outstanding_jobs() : -1);                                                                                                                   |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|			session_log("not starting DHT, aborting");                                                                                                                                  |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ +|			return;                                                                                                                                                                     |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		std::shared_ptr<mmap_storage> storage = j->storage;                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(static_cast<int>(j->action) < int(job_functions.size()));                                                                                                     |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		session_log("starting DHT, running: %s, router lookups: %d"                                                                                                                  |
│ │ │ │ │ +|			, m_dht ? "true" : "false", m_outstanding_router_lookups);                                                                                                                  |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		m_stats_counters.inc_stats_counter(counters::num_running_disk_jobs, 1);                                                                                                      |
│ │ │ │ │ +|m_dht_storage = m_dht_storage_constructor(m_settings);                                                                                                                         |
│ │ │ │ │ +|m_dht = std::make_shared<dht::dht_tracker>(                                                                                                                                    |
│ │ │ │ │ +|			static_cast<dht::dht_observer*>(this)                                                                                                                                       |
│ │ │ │ │ +|			, m_io_context                                                                                                                                                              |
│ │ │ │ │ +|			, [this](aux::listen_socket_handle const& sock                                                                                                                              |
│ │ │ │ │ +|				, udp::endpoint const& ep                                                                                                                                                  |
│ │ │ │ │ +|				, span<char const> p                                                                                                                                                       |
│ │ │ │ │ +|				, error_code& ec                                                                                                                                                           |
│ │ │ │ │ +|				, udp_send_flags_t const flags)                                                                                                                                            |
│ │ │ │ │ +|				{ send_udp_packet_listen(sock, ep, p, ec, flags); }                                                                                                                        |
│ │ │ │ │ +|			, m_settings                                                                                                                                                                |
│ │ │ │ │ +|			, m_stats_counters                                                                                                                                                          |
│ │ │ │ │ +|			, *m_dht_storage                                                                                                                                                            |
│ │ │ │ │ +|			, std::move(m_dht_state));                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// call disk function                                                                                                                                                        |
│ │ │ │ │ -|status_t ret = status_t::no_error;                                                                                                                                             |
│ │ │ │ │ -|try                                                                                                                                                                            |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			int const idx = static_cast<int>(j->action);                                                                                                                                |
│ │ │ │ │ -|			ret = (this->*(job_functions[static_cast<std::size_t>(idx)]))(j);                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		catch (boost::system::system_error const& err)                                                                                                                               |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			ret = status_t::fatal_disk_error;                                                                                                                                           |
│ │ │ │ │ -|			j->error.ec = err.code();                                                                                                                                                   |
│ │ │ │ │ -|			j->error.operation = operation_t::exception;                                                                                                                                |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		catch (std::bad_alloc const&)                                                                                                                                                |
│ │ │ │ │ +|		for (auto& s : m_listen_sockets)                                                                                                                                             |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			ret = status_t::fatal_disk_error;                                                                                                                                           |
│ │ │ │ │ -|			j->error.ec = errors::no_memory;                                                                                                                                            |
│ │ │ │ │ -|			j->error.operation = operation_t::exception;                                                                                                                                |
│ │ │ │ │ +|			if (s->ssl != transport::ssl                                                                                                                                                |
│ │ │ │ │ +|				&& !(s->flags & listen_socket_t::local_network))                                                                                                                           |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				m_dht->new_socket(s);                                                                                                                                                      |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|		catch (std::exception const&)                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		for (auto const& n : m_dht_router_nodes)                                                                                                                                     |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			ret = status_t::fatal_disk_error;                                                                                                                                           |
│ │ │ │ │ -|			j->error.ec = boost::asio::error::fault;                                                                                                                                    |
│ │ │ │ │ -|			j->error.operation = operation_t::exception;                                                                                                                                |
│ │ │ │ │ +|			m_dht->add_router_node(n);                                                                                                                                                  |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// note that -2 errors are OK                                                                                                                                                |
│ │ │ │ │ -|		TORRENT_ASSERT(ret != status_t::fatal_disk_error                                                                                                                             |
│ │ │ │ │ -|			|| (j->error.ec && j->error.operation != operation_t::unknown));                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_	_	_m___s_t_a_t_s___c_o_u_n_t_e_r_s_._i_n_c___s_t_a_t_s___c_o_u_n_t_e_r_(_c_o_u_n_t_e_r_s_:_:_n_u_m___r_u_n_n_i_n_g___d_i_s_k___j_o_b_s_,_ _-_1_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_m_m_a_p___d_i_s_k___i_o_._c_p_p_:_1_0_1_7  |this is potentially very expensive. One way to solve it would be to have a fence for just this one piece. but it hardly seems worth |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_h_e_ _c_o_m_p_l_e_x_i_t_y_ _a_n_d_ _c_o_s_t_ _j_u_s_t_ _f_o_r_ _t_h_e_ _e_d_g_e_ _c_a_s_e_ _o_f_ _r_e_c_e_i_v_i_n_g_ _a_ _c_o_r_r_u_p_t_ _p_i_e_c_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss iiss ppootteennttiiaallllyy vveerryy eexxppeennssiivvee.. OOnnee wwaayy ttoo ssoollvvee iitt wwoouulldd bbee ttoo hhaavvee aa ffeennccee ffoorr jjuusstt tthhiiss oonnee ppiieeccee.. bbuutt iitt hhaarrddllyy sseeeemmss wwoorrtthh tthhee ccoommpplleexxiittyy aanndd ccoosstt jjuusstt ffoorr tthhee |
│ │ │ │ │ -|eeddggee ccaassee ooff rreecceeiivviinngg aa ccoorrrruupptt ppiieeccee **********                                                                                                                                   |
│ │ │ │ │ -|****** ....//ssrrcc//mmmmaapp__ddiisskk__iioo..ccpppp::11001177 ******                                                                                                                                           |
│ │ │ │ │ -|aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::file_priority);                                                                                             |
│ │ │ │ │ -|		j->storage = m_torrents[storage]->shared_from_this();                                                                                                                        |
│ │ │ │ │ -|		j->argument = std::move(prios);                                                                                                                                              |
│ │ │ │ │ -|		j->callback = std::move(handler);                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		add_fence_job(j);                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void mmap_disk_io::async_clear_piece(storage_index_t const storage                                                                                                            |
│ │ │ │ │ -|		, piece_index_t const index, std::function<void(piece_index_t)> handler)                                                                                                     |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::clear_piece);                                                                                             |
│ │ │ │ │ -|		j->storage = m_torrents[storage]->shared_from_this();                                                                                                                        |
│ │ │ │ │ -|		j->piece = index;                                                                                                                                                            |
│ │ │ │ │ -|		j->callback = std::move(handler);                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// regular jobs are not guaranteed to be executed in-order                                                                                                                   |
│ │ │ │ │ -|		// since clear piece must guarantee that all write jobs that                                                                                                                 |
│ │ │ │ │ -|		// have been issued finish before the clear piece job completes                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_m_m_a_p___d_i_s_k___i_o_._c_p_p_:_1_0_2_2  |Perhaps the job queue could be traversed and all jobs for this piece could be cancelled. If there are no threads currently writing  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_o_ _t_h_i_s_ _p_i_e_c_e_,_ _w_e_ _c_o_u_l_d_ _s_k_i_p_ _t_h_e_ _f_e_n_c_e_ _a_l_t_o_g_e_t_h_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** PPeerrhhaappss tthhee jjoobb qquueeuuee ccoouulldd bbee ttrraavveerrsseedd aanndd aallll jjoobbss ffoorr tthhiiss ppiieeccee ccoouulldd bbee ccaanncceelllleedd.. IIff tthheerree aarree nnoo tthhrreeaaddss ccuurrrreennttllyy wwrriittiinngg ttoo tthhiiss ppiieeccee,, wwee ccoouulldd sskkiipp tthhee ffeennccee|
│ │ │ │ │ -|aallttooggeetthheerr **********                                                                                                                                                               |
│ │ │ │ │ -|****** ....//ssrrcc//mmmmaapp__ddiisskk__iioo..ccpppp::11002222 ******                                                                                                                                           |
│ │ │ │ │ -|j->storage = m_torrents[storage]->shared_from_this();                                                                                                                          |
│ │ │ │ │ -|		j->argument = std::move(prios);                                                                                                                                              |
│ │ │ │ │ -|		j->callback = std::move(handler);                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		add_fence_job(j);                                                                                                                                                            |
│ │ │ │ │ +|		for (auto const& n : m_dht_nodes)                                                                                                                                            |
│ │ │ │ │ +|_	_	_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_s_e_s_s_i_o_n___i_m_p_l_._c_p_p_:_6_2_6_7_ _ _|_a_s_s_e_r_t_s_ _t_h_a_t_ _n_o_ _o_u_t_s_t_a_n_d_i_n_g_ _a_s_y_n_c_ _o_p_e_r_a_t_i_o_n_s_ _a_r_e_ _s_t_i_l_l_ _i_n_ _f_l_i_g_h_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** aasssseerrttss tthhaatt nnoo oouuttssttaannddiinngg aassyynncc ooppeerraattiioonnss aarree ssttiillll iinn fflliigghhtt **********                                                                                                   |
│ │ │ │ │ +|****** ....//ssrrcc//sseessssiioonn__iimmppll..ccpppp::66226677 ******                                                                                                                                           |
│ │ │ │ │ +|if (!m_dht) return;                                                                                                                                                            |
│ │ │ │ │ +|		m_dht->direct_request(ep, e, std::bind(&on_direct_response, std::ref(m_alerts), userdata, _1));                                                                              |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void mmap_disk_io::async_clear_piece(storage_index_t const storage                                                                                                            |
│ │ │ │ │ -|		, piece_index_t const index, std::function<void(piece_index_t)> handler)                                                                                                     |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		aux::mmap_disk_job* j = m_job_pool.allocate_job(aux::job_action_t::clear_piece);                                                                                             |
│ │ │ │ │ -|		j->storage = m_torrents[storage]->shared_from_this();                                                                                                                        |
│ │ │ │ │ -|		j->piece = index;                                                                                                                                                            |
│ │ │ │ │ -|		j->callback = std::move(handler);                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// regular jobs are not guaranteed to be executed in-order                                                                                                                   |
│ │ │ │ │ -|		// since clear piece must guarantee that all write jobs that                                                                                                                 |
│ │ │ │ │ -|		// have been issued finish before the clear piece job completes                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|add_fence_job(j);                                                                                                                                                              |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	status_t mmap_disk_io::do_hash(aux::mmap_disk_job* j)                                                                                                                         |
│ │ │ │ │ +|	bool session_impl::is_listening() const                                                                                                                                       |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		// we're not using a cache. This is the simple path                                                                                                                          |
│ │ │ │ │ -|		// just read straight from the file                                                                                                                                          |
│ │ │ │ │ -|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		bool const v1 = bool(j->flags & disk_interface::v1_hash);                                                                                                                    |
│ │ │ │ │ -|		bool const v2 = !j->d.h.block_hashes.empty();                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		int const piece_size = v1 ? j->storage->files().piece_size(j->piece) : 0;                                                                                                    |
│ │ │ │ │ -|		int const piece_size2 = v2 ? j->storage->files().piece_size2(j->piece) : 0;                                                                                                  |
│ │ │ │ │ -|		int const blocks_in_piece = v1 ? (piece_size + default_block_size - 1) / default_block_size : 0;                                                                             |
│ │ │ │ │ -|		int const blocks_in_piece2 = v2 ? j->storage->files().blocks_in_piece2(j->piece) : 0;                                                                                        |
│ │ │ │ │ -|		aux::open_mode_t const file_mode = file_mode_for_job(j);                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(!v2 || int(j->d.h.block_hashes.size()) >= blocks_in_piece2);                                                                                                  |
│ │ │ │ │ -|		TORRENT_ASSERT(v1 || v2);                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		hasher h;                                                                                                                                                                    |
│ │ │ │ │ -|		int ret = 0;                                                                                                                                                                 |
│ │ │ │ │ -|		int offset = 0;                                                                                                                                                              |
│ │ │ │ │ -|		int const blocks_to_read = std::max(blocks_in_piece, blocks_in_piece2);                                                                                                      |
│ │ │ │ │ -|		time_point const start_time = clock_type::now();                                                                                                                             |
│ │ │ │ │ -|		for (int i = 0; i < blocks_to_read; ++i)                                                                                                                                     |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			bool const v2_block = i < blocks_in_piece2;                                                                                                                                 |
│ │ │ │ │ +|		return !m_listen_sockets.empty();                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_	_	_	_D_L_O_G_(_"_d_o___h_a_s_h_:_ _r_e_a_d_i_n_g_ _(_p_i_e_c_e_:_ _%_d_ _b_l_o_c_k_:_ _%_d_)_\_n_"_,_ _i_n_t_(_j_-_>_p_i_e_c_e_)_,_ _i_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/                       |introduce a web-seed default class which has a low download priority                                                                |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_w_e_b___c_o_n_n_e_c_t_i_o_n___b_a_s_e_._c_p_p_:_7_2_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinnttrroodduuccee aa wweebb--sseeeedd ddeeffaauulltt ccllaassss wwhhiicchh hhaass aa llooww ddoowwnnllooaadd pprriioorriittyy **********                                                                                               |
│ │ │ │ │ -|****** ....//ssrrcc//wweebb__ccoonnnneeccttiioonn__bbaassee..ccpppp::7722 ******                                                                                                                                      |
│ │ │ │ │ -|: peer_connection(pack)                                                                                                                                                        |
│ │ │ │ │ -|		, m_first_request(true)                                                                                                                                                      |
│ │ │ │ │ -|		, m_ssl(false)                                                                                                                                                               |
│ │ │ │ │ -|		, m_external_auth(web.auth)                                                                                                                                                  |
│ │ │ │ │ -|		, m_extra_headers(web.extra_headers)                                                                                                                                         |
│ │ │ │ │ -|		, m_parser(http_parser::dont_parse_chunks)                                                                                                                                   |
│ │ │ │ │ -|		, m_body_start(0)                                                                                                                                                            |
│ │ │ │ │ +|	session_impl::~session_impl()                                                                                                                                                 |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(&web.peer_info == pack.peerinfo);                                                                                                                             |
│ │ │ │ │ -|		// when going through a proxy, we don't necessarily have an endpoint here,                                                                                                   |
│ │ │ │ │ -|		// since the proxy might be resolving the hostname, not us                                                                                                                   |
│ │ │ │ │ -|		TORRENT_ASSERT(web.endpoints.empty() || web.endpoints.front() == pack.endp);                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(is_outgoing());                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(!m_torrent.lock()->is_upload_only());                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// we only want left-over bandwidth                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|std::string protocol;                                                                                                                                                          |
│ │ │ │ │ -|		error_code ec;                                                                                                                                                               |
│ │ │ │ │ -|		std::tie(protocol, m_basic_auth, m_host, m_port, m_path)                                                                                                                     |
│ │ │ │ │ -|			= parse_url_components(web.url, ec);                                                                                                                                        |
│ │ │ │ │ -|		TORRENT_ASSERT(!ec);                                                                                                                                                         |
│ │ │ │ │ +|		// since we're destructing the session, no more alerts will make it out to                                                                                                   |
│ │ │ │ │ +|		// the user. So stop posting them now                                                                                                                                        |
│ │ │ │ │ +|		m_alerts.set_alert_mask({});                                                                                                                                                 |
│ │ │ │ │ +|		m_alerts.set_notify_function({});                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_port == -1 && protocol == "http")                                                                                                                                      |
│ │ │ │ │ -|			m_port = 80;                                                                                                                                                                |
│ │ │ │ │ +|		// this is not allowed to be the network thread!                                                                                                                             |
│ │ │ │ │ +|//		TORRENT_ASSERT(is_not_thread());                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_SSL                                                                                                                                                            |
│ │ │ │ │ -|		if (protocol == "https")                                                                                                                                                     |
│ │ │ │ │ +|// this can happen if we end the io_context run loop with an exception                                                                                                         |
│ │ │ │ │ +|		m_connections.clear();                                                                                                                                                       |
│ │ │ │ │ +|		for (auto& t : m_torrents)                                                                                                                                                   |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			m_ssl = true;                                                                                                                                                               |
│ │ │ │ │ -|			if (m_port == -1) m_port = 443;                                                                                                                                             |
│ │ │ │ │ +|			t->panic();                                                                                                                                                                 |
│ │ │ │ │ +|			t->abort();                                                                                                                                                                 |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (!m_basic_auth.empty())                                                                                                                                                   |
│ │ │ │ │ -|			m_basic_auth = base64encode(m_basic_auth);                                                                                                                                  |
│ │ │ │ │ +|		m_torrents.clear();                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		m_server_string = m_host;                                                                                                                                                    |
│ │ │ │ │ -|		aux::verify_encoding(m_server_string);                                                                                                                                       |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		// this has probably been called already, but in case of sudden                                                                                                              |
│ │ │ │ │ +|		// termination through an exception, it may not have been done                                                                                                               |
│ │ │ │ │ +|		abort_stage2();                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	int web_connection_base::timeout() const                                                                                                                                      |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		// since this is a web seed, change the timeout                                                                                                                              |
│ │ │ │ │ -|		// according to the settings.                                                                                                                                                |
│ │ │ │ │ -|		return m_settings.get_int(settings_pack::urlseed_timeout);                                                                                                                   |
│ │ │ │ │ -|_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_t_o_r_r_e_n_t___i_n_f_o_._c_p_p_:_8_8_7_ _ _ _|_t_h_i_s_ _s_h_o_u_l_d_ _b_e_ _c_o_n_s_i_d_e_r_e_d_ _a_ _f_a_i_l_u_r_e_,_ _a_n_d_ _t_h_e_ _._t_o_r_r_e_n_t_ _f_i_l_e_ _r_e_j_e_c_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss sshhoouulldd bbee ccoonnssiiddeerreedd aa ffaaiilluurree,, aanndd tthhee ..ttoorrrreenntt ffiillee rreejjeecctteedd **********                                                                                                |
│ │ │ │ │ -|****** ....//ssrrcc//ttoorrrreenntt__iinnffoo..ccpppp::888877 ******                                                                                                                                            |
│ │ │ │ │ -|std::string ext = extension(filename);                                                                                                                                         |
│ │ │ │ │ -|			int cnt = 0;                                                                                                                                                                |
│ │ │ │ │ -|			for (;;)                                                                                                                                                                    |
│ │ │ │ │ +|#if defined TORRENT_ASIO_DEBUGGING                                                                                                                                             |
│ │ │ │ │ +|		FILE* f = fopen("wakeups.log", "w+");                                                                                                                                        |
│ │ │ │ │ +|		if (f != nullptr)                                                                                                                                                            |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			time_point m = min_time();                                                                                                                                                  |
│ │ │ │ │ +|			if (!_wakeups.empty()) m = _wakeups[0].timestamp;                                                                                                                           |
│ │ │ │ │ +|			time_point prev = m;                                                                                                                                                        |
│ │ │ │ │ +|			std::uint64_t prev_csw = 0;                                                                                                                                                 |
│ │ │ │ │ +|			if (!_wakeups.empty()) prev_csw = _wakeups[0].context_switches;                                                                                                             |
│ │ │ │ │ +|			std::fprintf(f, "abs. time\trel. time\tctx switch\tidle-wakeup\toperation\n");                                                                                              |
│ │ │ │ │ +|			for (wakeup_t const& w : _wakeups)                                                                                                                                          |
│ │ │ │ │  |			{                                                                                                                                                                           |
│ │ │ │ │ -|				++cnt;                                                                                                                                                                     |
│ │ │ │ │ -|				char new_ext[50];                                                                                                                                                          |
│ │ │ │ │ -|				std::snprintf(new_ext, sizeof(new_ext), ".%d%s", cnt, ext.c_str());                                                                                                        |
│ │ │ │ │ -|				filename = base + new_ext;                                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|				boost::crc_optimal<32, 0x1EDC6F41, 0xFFFFFFFF, 0xFFFFFFFF, true, true> crc;                                                                                                |
│ │ │ │ │ -|				process_string_lowercase(crc, filename);                                                                                                                                   |
│ │ │ │ │ -|				std::uint32_t const new_hash = crc.checksum();                                                                                                                             |
│ │ │ │ │ -|				if (files.find(new_hash) == files.end())                                                                                                                                   |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					files.insert({new_hash, {i, 0}});                                                                                                                                         |
│ │ │ │ │ -|					break;                                                                                                                                                                    |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|				++num_collisions;                                                                                                                                                          |
│ │ │ │ │ -|				if (num_collisions > 100)                                                                                                                                                  |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			copy_on_write();                                                                                                                                                            |
│ │ │ │ │ -|			m_files.rename_file(i, filename);                                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void torrent_info::remap_files(file_storage const& f)                                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ +|				bool const idle_wakeup = w.context_switches > prev_csw;                                                                                                                    |
│ │ │ │ │ +|				std::fprintf(f, "%" PRId64 "\t%" PRId64 "\t%" PRId64 "\t%c\t%s\n"                                                                                                          |
│ │ │ │ │ +|					, total_microseconds(w.timestamp - m)                                                                                                                                     |
│ │ │ │ │ +|					, total_microseconds(w.timestamp - prev)                                                                                                                                  |
│ │ │ │ │ +|_	_	_	_	_	_,_ _w_._c_o_n_t_e_x_t___s_w_i_t_c_h_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_a_c_k_e_t___b_u_f_f_e_r_._c_p_p_:_1_5_7_ _ _|_u_s_e_ _c_o_m_p_a_r_e___l_e_s_s___w_r_a_p_ _f_o_r_ _t_h_i_s_ _c_o_m_p_a_r_i_s_o_n_ _a_s_ _w_e_l_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** uussee ccoommppaarree__lleessss__wwrraapp ffoorr tthhiiss ccoommppaarriissoonn aass wweellll **********                                                                                                                  |
│ │ │ │ │ +|****** ....//ssrrcc//ppaacckkeett__bbuuffffeerr..ccpppp::115577 ******                                                                                                                                           |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │  |		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT_VAL(size <= 0xffff, size);                                                                                                                                    |
│ │ │ │ │ +|		std::uint32_t new_size = m_capacity == 0 ? 16 : m_capacity;                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		TORRENT_ASSERT(is_loaded());                                                                                                                                                 |
│ │ │ │ │ -|		// the new specified file storage must have the exact                                                                                                                        |
│ │ │ │ │ -|		// same size as the current file storage                                                                                                                                     |
│ │ │ │ │ -|		TORRENT_ASSERT(m_files.total_size() == f.total_size());                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		if (m_files.total_size() != f.total_size()) return;                                                                                                                          |
│ │ │ │ │ -|		copy_on_write();                                                                                                                                                             |
│ │ │ │ │ -|		m_files = f;                                                                                                                                                                 |
│ │ │ │ │ -|		m_files.set_num_pieces(m_orig_files->num_pieces());                                                                                                                          |
│ │ │ │ │ -|		m_files.set_piece_length(m_orig_files->piece_length());                                                                                                                      |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|	// standard constructor that parses a torrent file                                                                                                                            |
│ │ │ │ │ -|	torrent_info::torrent_info(entry const& torrent_file)                                                                                                                         |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::vector<char> tmp;                                                                                                                                                       |
│ │ │ │ │ -|		std::back_insert_iterator<std::vector<char>> out(tmp);                                                                                                                       |
│ │ │ │ │ -|_	_	_b_e_n_c_o_d_e_(_o_u_t_,_ _t_o_r_r_e_n_t___f_i_l_e_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_l_o_a_d___t_o_r_r_e_n_t_._c_p_p_:_1_2_1_ _ _ _|_m_o_v_e_ _t_h_e_ _l_o_a_d_i_n_g_ _l_o_g_i_c_ _f_r_o_m_ _t_o_r_r_e_n_t___i_n_f_o_ _c_o_n_s_t_r_u_c_t_o_r_ _i_n_t_o_ _h_e_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmoovvee tthhee llooaaddiinngg llooggiicc ffrroomm ttoorrrreenntt__iinnffoo ccoonnssttrruuccttoorr iinnttoo hheerree **********                                                                                                     |
│ │ │ │ │ -|****** ....//ssrrcc//llooaadd__ttoorrrreenntt..ccpppp::112211 ******                                                                                                                                            |
│ │ │ │ │ -|mask.resize(std::size_t(full_size), false);                                                                                                                                    |
│ │ │ │ │ -|				for (int i = merkle_first_leaf(piece_layer_size)                                                                                                                           |
│ │ │ │ │ -|					, end = i + num_pieces; i < end; ++i)                                                                                                                                     |
│ │ │ │ │ -|				{                                                                                                                                                                          |
│ │ │ │ │ -|					mask[std::size_t(i)] = true;                                                                                                                                              |
│ │ │ │ │ -|				}                                                                                                                                                                          |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			ti->free_piece_layers();                                                                                                                                                    |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		atp.info_hashes = atp.ti->info_hashes();                                                                                                                                     |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|		while (new_size < size)                                                                                                                                                      |
│ │ │ │ │ +|			new_size <<= 1;                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	add_torrent_params load_torrent_file(std::string const& filename)                                                                                                             |
│ │ │ │ │ -|	{ return load_torrent_file(filename, load_torrent_limits{}); }                                                                                                                |
│ │ │ │ │ -|	add_torrent_params load_torrent_buffer(span<char const> buffer)                                                                                                               |
│ │ │ │ │ -|	{ return load_torrent_buffer(buffer, load_torrent_limits{}); }                                                                                                                |
│ │ │ │ │ -|	add_torrent_params load_torrent_parsed(bdecode_node const& torrent_file)                                                                                                      |
│ │ │ │ │ -|	{ return load_torrent_parsed(torrent_file, load_torrent_limits{}); }                                                                                                          |
│ │ │ │ │ +|		aux::unique_ptr<packet_ptr[], index_type> new_storage(new packet_ptr[new_size]);                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|add_torrent_params load_torrent_file(std::string const& filename, load_torrent_limits const& cfg)                                                                              |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|		add_torrent_params ret;                                                                                                                                                      |
│ │ │ │ │ -|		ret.ti = std::make_shared<torrent_info>(filename, cfg);                                                                                                                      |
│ │ │ │ │ -|		update_atp(ret);                                                                                                                                                             |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|		for (index_type i = m_first; i < (m_first + m_capacity); ++i)                                                                                                                |
│ │ │ │ │ +|			new_storage[i & (new_size - 1)] = std::move(m_storage[i & (m_capacity - 1)]);                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	add_torrent_params load_torrent_buffer(span<char const> buffer, load_torrent_limits const& cfg)                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		add_torrent_params ret;                                                                                                                                                      |
│ │ │ │ │ -|		ret.ti = std::make_shared<torrent_info>(buffer, cfg, from_span);                                                                                                             |
│ │ │ │ │ -|		update_atp(ret);                                                                                                                                                             |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ +|		m_storage = std::move(new_storage);                                                                                                                                          |
│ │ │ │ │ +|		m_capacity = new_size;                                                                                                                                                       |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	add_torrent_params load_torrent_parsed(bdecode_node const& torrent_file, load_torrent_limits const& cfg)                                                                      |
│ │ │ │ │ +|	packet_ptr packet_buffer::remove(index_type idx)                                                                                                                              |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		add_torrent_params ret;                                                                                                                                                      |
│ │ │ │ │ -|		ret.ti = std::make_shared<torrent_info>(torrent_file, cfg);                                                                                                                  |
│ │ │ │ │ -|		update_atp(ret);                                                                                                                                                             |
│ │ │ │ │ -|		return ret;                                                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_._c_p_p_:|pre C++17, GCC and msvc does not make std::string nothrow move assignable, which means no type containing a string will be nothrow  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_7_8_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_m_o_v_e_ _a_s_s_i_g_n_a_b_l_e_ _b_y_ _d_e_f_a_u_l_t_ _e_i_t_h_e_r_ _s_t_a_t_i_c___a_s_s_e_r_t_(_s_t_d_:_:_i_s___n_o_t_h_r_o_w___m_o_v_e___a_s_s_i_g_n_a_b_l_e_:_:_v_a_l_u_e_ _,_ _"_s_h_o_u_l_d_ _b_e_ _n_o_t_h_r_o_w_ _m_o_v_e_ _a_s_s_i_g_n_a_b_l_e_"_)_;_ _ _ _ _ _ |
│ │ │ │ │ -|********** pprree CC++++1177,, GGCCCC aanndd mmssvvcc ddooeess nnoott mmaakkee ssttdd::::ssttrriinngg nnootthhrrooww mmoovvee aassssiiggnnaabbllee,, wwhhiicchh mmeeaannss nnoo ttyyppee ccoonnttaaiinniinngg aa ssttrriinngg wwiillll bbee nnootthhrrooww mmoovvee aassssiiggnnaabbllee bbyy ddeeffaauulltt eeiitthheerr     |
│ │ │ │ │ -|ssttaattiicc__aasssseerrtt((ssttdd::::iiss__nnootthhrrooww__mmoovvee__aassssiiggnnaabbllee::::vvaalluuee ,, ""sshhoouulldd bbee nnootthhrrooww mmoovvee aassssiiggnnaabbllee""));; **********                                                                             |
│ │ │ │ │ -|****** ....//ssrrcc//aadddd__ttoorrrreenntt__ppaarraammss..ccpppp::7788 ******                                                                                                                                       |
│ │ │ │ │ -|DECL_FLAG(sequential_download);                                                                                                                                                |
│ │ │ │ │ -|			DECL_FLAG(pinned);                                                                                                                                                          |
│ │ │ │ │ -|			DECL_FLAG(stop_when_ready);                                                                                                                                                 |
│ │ │ │ │ -|			DECL_FLAG(override_trackers);                                                                                                                                               |
│ │ │ │ │ -|			DECL_FLAG(override_web_seeds);                                                                                                                                              |
│ │ │ │ │ -|			DECL_FLAG(need_save_resume);                                                                                                                                                |
│ │ │ │ │ -|			DECL_FLAG(override_resume_data);                                                                                                                                            |
│ │ │ │ │ -|			DECL_FLAG(merge_resume_trackers);                                                                                                                                           |
│ │ │ │ │ -|			DECL_FLAG(use_resume_save_path);                                                                                                                                            |
│ │ │ │ │ -|			DECL_FLAG(merge_resume_http_seeds);                                                                                                                                         |
│ │ │ │ │ -|			DECL_FLAG(default_flags);                                                                                                                                                   |
│ │ │ │ │ -|#undef DECL_FLAG                                                                                                                                                               |
│ │ │ │ │ -|#endif // TORRENT_ABI_VERSION                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	static_assert(std::is_nothrow_move_constructible<add_torrent_params>::value                                                                                                   |
│ │ │ │ │ -|		, "should be nothrow move constructible");                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	static_assert(std::is_nothrow_move_constructible<std::string>::value                                                                                                          |
│ │ │ │ │ -|		, "should be nothrow move constructible");                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_._c_p_p_:|it would be nice if this was nothrow default constructible static_assert(std::is_nothrow_default_constructible::value , "should be  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_8_4_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_n_o_t_h_r_o_w_ _d_e_f_a_u_l_t_ _c_o_n_s_t_r_u_c_t_i_b_l_e_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd bbee nniiccee iiff tthhiiss wwaass nnootthhrrooww ddeeffaauulltt ccoonnssttrruuccttiibbllee ssttaattiicc__aasssseerrtt((ssttdd::::iiss__nnootthhrrooww__ddeeffaauulltt__ccoonnssttrruuccttiibbllee::::vvaalluuee ,, ""sshhoouulldd bbee nnootthhrrooww ddeeffaauulltt ccoonnssttrruuccttiibbllee""));; **********|
│ │ │ │ │ -|****** ....//ssrrcc//aadddd__ttoorrrreenntt__ppaarraammss..ccpppp::8844 ******                                                                                                                                       |
│ │ │ │ │ -|DECL_FLAG(pinned);                                                                                                                                                             |
│ │ │ │ │ -|			DECL_FLAG(stop_when_ready);                                                                                                                                                 |
│ │ │ │ │ -|			DECL_FLAG(override_trackers);                                                                                                                                               |
│ │ │ │ │ -|			DECL_FLAG(override_web_seeds);                                                                                                                                              |
│ │ │ │ │ -|			DECL_FLAG(need_save_resume);                                                                                                                                                |
│ │ │ │ │ -|			DECL_FLAG(override_resume_data);                                                                                                                                            |
│ │ │ │ │ -|			DECL_FLAG(merge_resume_trackers);                                                                                                                                           |
│ │ │ │ │ -|			DECL_FLAG(use_resume_save_path);                                                                                                                                            |
│ │ │ │ │ -|			DECL_FLAG(merge_resume_http_seeds);                                                                                                                                         |
│ │ │ │ │ -|			DECL_FLAG(default_flags);                                                                                                                                                   |
│ │ │ │ │ -|#undef DECL_FLAG                                                                                                                                                               |
│ │ │ │ │ -|#endif // TORRENT_ABI_VERSION                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	static_assert(std::is_nothrow_move_constructible<add_torrent_params>::value                                                                                                   |
│ │ │ │ │ -|		, "should be nothrow move constructible");                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	static_assert(std::is_nothrow_move_constructible<std::string>::value                                                                                                          |
│ │ │ │ │ -|		, "should be nothrow move constructible");                                                                                                                                   |
│ │ │ │ │ +|		INVARIANT_CHECK;                                                                                                                                                             |
│ │ │ │ │ +|if (idx >= m_first + m_capacity)                                                                                                                                               |
│ │ │ │ │ +|return packet_ptr();                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ +|		if (compare_less_wrap(idx, m_first, 0xffff))                                                                                                                                 |
│ │ │ │ │ +|			return packet_ptr();                                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ +|		std::size_t const mask = m_capacity - 1;                                                                                                                                     |
│ │ │ │ │ +|		packet_ptr old_value = std::move(m_storage[idx & mask]);                                                                                                                     |
│ │ │ │ │ +|		m_storage[idx & mask].reset();                                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|namespace aux {                                                                                                                                                                |
│ │ │ │ │ +|		if (old_value)                                                                                                                                                               |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			--m_size;                                                                                                                                                                   |
│ │ │ │ │ +|			if (m_size == 0) m_last = m_first;                                                                                                                                          |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// returns whether this add_torrent_params object has "resume-data", i.e.                                                                                                     |
│ │ │ │ │ -|	// information about which pieces we have.                                                                                                                                    |
│ │ │ │ │ -|	bool contains_resume_data(add_torrent_params const& atp)                                                                                                                      |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		return !atp.have_pieces.empty()                                                                                                                                              |
│ │ │ │ │ -|			|| (atp.flags & torrent_flags::seed_mode);                                                                                                                                  |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|		if (idx == m_first && m_size != 0)                                                                                                                                           |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			++m_first;                                                                                                                                                                  |
│ │ │ │ │ +|			for (index_type i = 0; i < m_capacity; ++i, ++m_first)                                                                                                                      |
│ │ │ │ │ +|				if (m_storage[m_first & mask]) break;                                                                                                                                      |
│ │ │ │ │ +|			m_first &= 0xffff;                                                                                                                                                          |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|		if (((idx + 1) & 0xffff) == m_last && m_size != 0)                                                                                                                           |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			--m_last;                                                                                                                                                                   |
│ │ │ │ │ +|			for (index_type i = 0; i < m_capacity; ++i, --m_last)                                                                                                                       |
│ │ │ │ │ +|				if (m_storage[m_last & mask]) break;                                                                                                                                       |
│ │ │ │ │ +|			++m_last;                                                                                                                                                                   |
│ │ │ │ │ +|_	_	_	_m___l_a_s_t_ _&_=_ _0_x_f_f_f_f_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/_n_o_d_e_._c_p_p_:_1_1_7_7_ _|_k_e_e_p_ _t_h_e_ _r_e_t_u_r_n_e_d_ _v_a_l_u_e_ _t_o_ _p_a_s_s_ _a_s_ _a_ _l_i_m_i_t_ _t_o_ _w_r_i_t_e___n_o_d_e_s___e_n_t_r_i_e_s_ _w_h_e_n_ _i_m_p_l_e_m_e_n_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** kkeeeepp tthhee rreettuurrnneedd vvaalluuee ttoo ppaassss aass aa lliimmiitt ttoo wwrriittee__nnooddeess__eennttrriieess wwhheenn iimmpplleemmeenntteedd **********                                                                                 |
│ │ │ │ │  |****** ....//ssrrcc//kkaaddeemmlliiaa//nnooddee..ccpppp::11117777 ******                                                                                                                                          |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |	else if (query == "sample_infohashes")                                                                                                                                        |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ @@ -10618,14 +10618,161 @@
│ │ │ │ │  |		std::vector<node_entry> const n = wanted_node->m_table.find_node(info_hash, {});                                                                                             |
│ │ │ │ │  |		r[wanted_node->protocol_nodes_key()] = write_nodes_entry(n);                                                                                                                 |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |node::protocol_descriptor const& node::map_protocol_to_descriptor(udp const protocol)                                                                                          |
│ │ │ │ │  |_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |This is temporary. For now, only report the largest routing table (of potentially multiple ones, for multi-homed systems) in next   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_r_o_u_t_i_n_g___t_a_b_l_e_._c_p_p_:_2_8_9_ _ _ _ _ _ _ _ _ _|_m_a_j_o_r_ _v_e_r_s_i_o_n_,_ _b_r_e_a_k_ _t_h_e_ _A_B_I_ _a_n_d_ _s_u_p_p_o_r_t_ _r_e_p_o_r_t_i_n_g_ _a_l_l_ _o_f_ _t_h_e_m_ _i_n_ _t_h_e_ _d_h_t___s_t_a_t_s___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** TThhiiss iiss tteemmppoorraarryy.. FFoorr nnooww,, oonnllyy rreeppoorrtt tthhee llaarrggeesstt rroouuttiinngg ttaabbllee ((ooff ppootteennttiiaallllyy mmuullttiippllee oonneess,, ffoorr mmuullttii--hhoommeedd ssyysstteemmss)) iinn nneexxtt mmaajjoorr vveerrssiioonn,, bbrreeaakk tthhee AABBII aanndd       |
│ │ │ │ │ +|ssuuppppoorrtt rreeppoorrttiinngg aallll ooff tthheemm iinn tthhee ddhhtt__ssttaattss__aalleerrtt **********                                                                                                                     |
│ │ │ │ │ +|****** ....//ssrrcc//kkaaddeemmlliiaa//rroouuttiinngg__ttaabbllee..ccpppp::228899 ******                                                                                                                                  |
│ │ │ │ │ +|, m_bucket_size(bucket_size)                                                                                                                                                   |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	// bucket sizes must be a power of 2                                                                                                                                          |
│ │ │ │ │ +|	TORRENT_ASSERT_VAL(((bucket_size - 1) & bucket_size) == 0, bucket_size);                                                                                                      |
│ │ │ │ │ +|	TORRENT_UNUSED(log);                                                                                                                                                          |
│ │ │ │ │ +|	m_buckets.reserve(30);                                                                                                                                                        |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|int routing_table::bucket_limit(int bucket) const                                                                                                                              |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	if (!m_settings.get_bool(settings_pack::dht_extended_routing_table)) return m_bucket_size;                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	static const aux::array<int, 4> size_exceptions{{{16, 8, 4, 2}}};                                                                                                             |
│ │ │ │ │ +|	if (bucket < size_exceptions.end_index())                                                                                                                                     |
│ │ │ │ │ +|		return m_bucket_size * size_exceptions[bucket];                                                                                                                              |
│ │ │ │ │ +|	return m_bucket_size;                                                                                                                                                         |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|void routing_table::status(std::vector<dht_routing_bucket>& s) const                                                                                                           |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|if (s.size() > m_buckets.size()) return;                                                                                                                                       |
│ │ │ │ │ +|s.clear();                                                                                                                                                                     |
│ │ │ │ │ +|	for (auto const& i : m_buckets)                                                                                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		dht_routing_bucket b;                                                                                                                                                        |
│ │ │ │ │ +|		b.num_nodes = int(i.live_nodes.size());                                                                                                                                      |
│ │ │ │ │ +|		b.num_replacements = int(i.replacements.size());                                                                                                                             |
│ │ │ │ │ +|		s.push_back(b);                                                                                                                                                              |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_#_i_f_ _T_O_R_R_E_N_T___A_B_I___V_E_R_S_I_O_N_ _=_=_ _1_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |arvidn note when it's across IPv4 and IPv6, adding (dht_global_nodes) would make sense. in the future though, where we may have one |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_r_o_u_t_i_n_g___t_a_b_l_e_._c_p_p_:_3_1_4_ _ _ _ _ _ _ _ _ _|_D_H_T_ _n_o_d_e_ _p_e_r_ _e_x_t_e_r_n_a_l_ _i_n_t_e_r_f_a_c_e_ _(_w_h_i_c_h_ _m_a_y_ _b_e_ _m_u_l_t_i_p_l_e_ _o_f_ _t_h_e_ _s_a_m_e_ _a_d_d_r_e_s_s_ _f_a_m_i_l_y_)_,_ _t_h_e_n_ _i_t_ _b_e_c_o_m_e_s_ _a_ _b_i_t_ _t_r_i_c_k_i_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** aarrvviiddnn nnoottee wwhheenn iitt''ss aaccrroossss IIPPvv44 aanndd IIPPvv66,, aaddddiinngg ((ddhhtt__gglloobbaall__nnooddeess)) wwoouulldd mmaakkee sseennssee.. iinn tthhee ffuuttuurree tthhoouugghh,, wwhheerree wwee mmaayy hhaavvee oonnee DDHHTT nnooddee ppeerr eexxtteerrnnaall iinntteerrffaaccee      |
│ │ │ │ │ +|((wwhhiicchh mmaayy bbee mmuullttiippllee ooff tthhee ssaammee aaddddrreessss ffaammiillyy)),, tthheenn iitt bbeeccoommeess aa bbiitt ttrriicckkiieerr **********                                                                                       |
│ │ │ │ │ +|****** ....//ssrrcc//kkaaddeemmlliiaa//rroouuttiinngg__ttaabbllee..ccpppp::331144 ******                                                                                                                                  |
│ │ │ │ │ +|if (s.size() > m_buckets.size()) return;                                                                                                                                       |
│ │ │ │ │ +|	s.clear();                                                                                                                                                                    |
│ │ │ │ │ +|	for (auto const& i : m_buckets)                                                                                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		dht_routing_bucket b;                                                                                                                                                        |
│ │ │ │ │ +|		b.num_nodes = int(i.live_nodes.size());                                                                                                                                      |
│ │ │ │ │ +|		b.num_replacements = int(i.replacements.size());                                                                                                                             |
│ │ │ │ │ +|		s.push_back(b);                                                                                                                                                              |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|void routing_table::status(session_status& s) const                                                                                                                            |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	int dht_nodes;                                                                                                                                                                |
│ │ │ │ │ +|	int dht_node_cache;                                                                                                                                                           |
│ │ │ │ │ +|	int ignore;                                                                                                                                                                   |
│ │ │ │ │ +|	std::tie(dht_nodes, dht_node_cache, ignore) = size();                                                                                                                         |
│ │ │ │ │ +|	s.dht_nodes += dht_nodes;                                                                                                                                                     |
│ │ │ │ │ +|	s.dht_node_cache += dht_node_cache;                                                                                                                                           |
│ │ │ │ │ +|s.dht_global_nodes += num_global_nodes();                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	for (auto const& i : m_buckets)                                                                                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		dht_routing_bucket b;                                                                                                                                                        |
│ │ │ │ │ +|		b.num_nodes = int(i.live_nodes.size());                                                                                                                                      |
│ │ │ │ │ +|		b.num_replacements = int(i.replacements.size());                                                                                                                             |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|		b.last_active = 0;                                                                                                                                                           |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		s.dht_routing_table.push_back(b);                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|std::tuple<int, int, int> routing_table::size() const                                                                                                                          |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	int nodes = 0;                                                                                                                                                                |
│ │ │ │ │ +|	int replacements = 0;                                                                                                                                                         |
│ │ │ │ │ +|	int confirmed = 0;                                                                                                                                                            |
│ │ │ │ │ +|	for (auto const& i : m_buckets)                                                                                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		nodes += int(i.live_nodes.size());                                                                                                                                           |
│ │ │ │ │ +|		confirmed += static_cast<int>(std::count_if(i.live_nodes.begin(), i.live_nodes.end()                                                                                         |
│ │ │ │ │ +|			, [](node_entry const& k) { return k.confirmed(); } ));                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		replacements += int(i.replacements.size());                                                                                                                                  |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|	return std::make_tuple(nodes, replacements, confirmed);                                                                                                                       |
│ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |this need to take bucket "prefix" into account. It should be unified with add_node_impl()                                           |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_r_o_u_t_i_n_g___t_a_b_l_e_._c_p_p_:_5_1_8_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** tthhiiss nneeeedd ttoo ttaakkee bbuucckkeett ""pprreeffiixx"" iinnttoo aaccccoouunntt.. IItt sshhoouulldd bbee uunniiffiieedd wwiitthh aadddd__nnooddee__iimmppll(()) **********                                                                          |
│ │ │ │ │ +|****** ....//ssrrcc//kkaaddeemmlliiaa//rroouuttiinngg__ttaabbllee..ccpppp::551188 ******                                                                                                                                  |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	for (auto i = m_buckets.begin() , end(m_buckets.end()); i != end; ++i)                                                                                                        |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		for (auto j = i->replacements.begin(); j != i->replacements.end(); ++j)                                                                                                      |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (j->addr() != ep.address()) continue;                                                                                                                                    |
│ │ │ │ │ +|			if (j->port() != ep.port()) continue;                                                                                                                                       |
│ │ │ │ │ +|			return std::make_tuple(&*j, i, &i->replacements);                                                                                                                           |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|		for (auto j = i->live_nodes.begin(); j != i->live_nodes.end(); ++j)                                                                                                          |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			if (j->addr() != ep.address()) continue;                                                                                                                                    |
│ │ │ │ │ +|			if (j->port() != ep.port()) continue;                                                                                                                                       |
│ │ │ │ │ +|			return std::make_tuple(&*j, i, &i->live_nodes);                                                                                                                             |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|	return std::tuple<node_entry*, routing_table::table_t::iterator, bucket_t*>                                                                                                   |
│ │ │ │ │ +|	{nullptr, m_buckets.end(), nullptr};                                                                                                                                          |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|void routing_table::fill_from_replacements(table_t::iterator bucket)                                                                                                           |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	bucket_t& b = bucket->live_nodes;                                                                                                                                             |
│ │ │ │ │ +|	bucket_t& rb = bucket->replacements;                                                                                                                                          |
│ │ │ │ │ +|	int const bucket_size = bucket_limit(int(std::distance(m_buckets.begin(), bucket)));                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	if (int(b.size()) >= bucket_size) return;                                                                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// sort by RTT first, to find the node with the lowest                                                                                                                        |
│ │ │ │ │ +|	// RTT that is pinged                                                                                                                                                         |
│ │ │ │ │ +|	std::sort(rb.begin(), rb.end());                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	while (int(b.size()) < bucket_size && !rb.empty())                                                                                                                            |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		auto j = std::find_if(rb.begin(), rb.end(), std::bind(&node_entry::pinged, _1));                                                                                             |
│ │ │ │ │ +|		if (j == rb.end()) break;                                                                                                                                                    |
│ │ │ │ │ +|		b.push_back(*j);                                                                                                                                                             |
│ │ │ │ │ +|		rb.erase(j);                                                                                                                                                                 |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|void routing_table::prune_empty_bucket()                                                                                                                                       |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	if (m_buckets.back().live_nodes.empty()                                                                                                                                       |
│ │ │ │ │ +|		&& m_buckets.back().replacements.empty())                                                                                                                                    |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		m_buckets.erase(m_buckets.end() - 1);                                                                                                                                        |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_v_o_i_d_ _r_o_u_t_i_n_g___t_a_b_l_e_:_:_r_e_m_o_v_e___n_o_d_e_(_n_o_d_e___e_n_t_r_y_*_ _n_,_ _b_u_c_k_e_t___t_*_ _b_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/_p_u_t___d_a_t_a_._c_p_p_: |what if o is not an instance of put_data_observer? This need to be redesigned for better type safety.                               |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_9_2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** wwhhaatt iiff oo iiss nnoott aann iinnssttaannccee ooff ppuutt__ddaattaa__oobbsseerrvveerr?? TThhiiss nneeeedd ttoo bbee rreeddeessiiggnneedd ffoorr bbeetttteerr ttyyppee ssaaffeettyy.. **********                                                              |
│ │ │ │ │  |****** ....//ssrrcc//kkaaddeemmlliiaa//ppuutt__ddaattaa..ccpppp::9922 ******                                                                                                                                        |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ @@ -10722,68 +10869,14 @@
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |	address_v4::bytes_type b4{};                                                                                                                                                  |
│ │ │ │ │  |	address_v6::bytes_type b6{};                                                                                                                                                  |
│ │ │ │ │  |	if (ip_.is_v6())                                                                                                                                                              |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │  |		b6 = ip_.to_v6().to_bytes();                                                                                                                                                 |
│ │ │ │ │  |_	_	_i_p_ _=_ _b_6_._d_a_t_a_(_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |pick the closest node rather than the first                                                                                         |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_d_h_t___t_r_a_c_k_e_r_._c_p_p_:_3_1_7_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ppiicckk tthhee cclloosseesstt nnooddee rraatthheerr tthhaann tthhee ffiirrsstt **********                                                                                                                        |
│ │ │ │ │ -|****** ....//ssrrcc//kkaaddeemmlliiaa//ddhhtt__ttrraacckkeerr..ccpppp::331177 ******                                                                                                                                    |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ -|		m_log->log(dht_logger::tracker, "*** new write key*** %d nodes"                                                                                                              |
│ │ │ │ │ -|			, int(m_nodes.size()));                                                                                                                                                     |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void dht_tracker::update_storage_node_ids()                                                                                                                                   |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		std::vector<sha1_hash> ids;                                                                                                                                                  |
│ │ │ │ │ -|		for (auto& n : m_nodes)                                                                                                                                                      |
│ │ │ │ │ -|			ids.push_back(n.second.dht.nid());                                                                                                                                          |
│ │ │ │ │ -|		m_storage.update_node_ids(ids);                                                                                                                                              |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	node* dht_tracker::get_node(node_id const& id, std::string const& family_name)                                                                                                |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_UNUSED(id);                                                                                                                                                          |
│ │ │ │ │ -|		for (auto& n : m_nodes)                                                                                                                                                      |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|if (n.second.dht.protocol_family_name() == family_name)                                                                                                                        |
│ │ │ │ │ -|return &n.second.dht;                                                                                                                                                          |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		return nullptr;                                                                                                                                                              |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void dht_tracker::get_peers(sha1_hash const& ih                                                                                                                               |
│ │ │ │ │ -|		, std::function<void(std::vector<tcp::endpoint> const&)> f)                                                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		for (auto& n : m_nodes)                                                                                                                                                      |
│ │ │ │ │ -|			n.second.dht.get_peers(ih, f, {}, {});                                                                                                                                      |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void dht_tracker::announce(sha1_hash const& ih, int listen_port                                                                                                               |
│ │ │ │ │ -|		, announce_flags_t const flags                                                                                                                                               |
│ │ │ │ │ -|		, std::function<void(std::vector<tcp::endpoint> const&)> f)                                                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		for (auto& n : m_nodes)                                                                                                                                                      |
│ │ │ │ │ -|			n.second.dht.announce(ih, listen_port, flags, f);                                                                                                                           |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void dht_tracker::sample_infohashes(udp::endpoint const& ep, sha1_hash const& target                                                                                          |
│ │ │ │ │ -|		, std::function<void(node_id                                                                                                                                                 |
│ │ │ │ │ -|			, time_duration                                                                                                                                                             |
│ │ │ │ │ -|			, int, std::vector<sha1_hash>                                                                                                                                               |
│ │ │ │ │ -|			, std::vector<std::pair<sha1_hash, udp::endpoint>>)> f)                                                                                                                     |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		for (auto& n : m_nodes)                                                                                                                                                      |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|_	_	_	_i_f_ _(_e_p_._p_r_o_t_o_c_o_l_(_)_ _!_=_ _(_n_._f_i_r_s_t_._g_e_t___e_x_t_e_r_n_a_l___a_d_d_r_e_s_s_(_)_._i_s___v_4_(_)_ _?_ _u_d_p_:_:_v_4_(_)_ _:_ _u_d_p_:_:_v_6_(_)_)_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/_i_t_e_m_._c_p_p_:_1_4_3_ _ _|_i_m_p_l_e_m_e_n_t_ _c_t_o_r_ _f_o_r_ _e_n_t_r_y_ _f_r_o_m_ _b_d_e_c_o_d_e___n_o_d_e_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** iimmpplleemmeenntt ccttoorr ffoorr eennttrryy ffrroomm bbddeeccooddee__nnooddee?? **********                                                                                                                        |
│ │ │ │ │  |****** ....//ssrrcc//kkaaddeemmlliiaa//iitteemm..ccpppp::114433 ******                                                                                                                                           |
│ │ │ │ │  |, secret_key const& sk)                                                                                                                                                        |
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │  |	char str[1200];                                                                                                                                                               |
│ │ │ │ │  |	int const len = canonical_string(v, seq, salt, str);                                                                                                                          |
│ │ │ │ │ @@ -10830,161 +10923,68 @@
│ │ │ │ │  |	m_pk = pk;                                                                                                                                                                    |
│ │ │ │ │  |	m_seq = seq;                                                                                                                                                                  |
│ │ │ │ │  |	m_mutable = true;                                                                                                                                                             |
│ │ │ │ │  |	m_value = std::move(v);                                                                                                                                                       |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |_v_o_i_d_ _i_t_e_m_:_:_a_s_s_i_g_n_(_b_d_e_c_o_d_e___n_o_d_e_ _c_o_n_s_t_&_ _v_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |This is temporary. For now, only report the largest routing table (of potentially multiple ones, for multi-homed systems) in next   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_r_o_u_t_i_n_g___t_a_b_l_e_._c_p_p_:_2_8_9_ _ _ _ _ _ _ _ _ _|_m_a_j_o_r_ _v_e_r_s_i_o_n_,_ _b_r_e_a_k_ _t_h_e_ _A_B_I_ _a_n_d_ _s_u_p_p_o_r_t_ _r_e_p_o_r_t_i_n_g_ _a_l_l_ _o_f_ _t_h_e_m_ _i_n_ _t_h_e_ _d_h_t___s_t_a_t_s___a_l_e_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** TThhiiss iiss tteemmppoorraarryy.. FFoorr nnooww,, oonnllyy rreeppoorrtt tthhee llaarrggeesstt rroouuttiinngg ttaabbllee ((ooff ppootteennttiiaallllyy mmuullttiippllee oonneess,, ffoorr mmuullttii--hhoommeedd ssyysstteemmss)) iinn nneexxtt mmaajjoorr vveerrssiioonn,, bbrreeaakk tthhee AABBII aanndd       |
│ │ │ │ │ -|ssuuppppoorrtt rreeppoorrttiinngg aallll ooff tthheemm iinn tthhee ddhhtt__ssttaattss__aalleerrtt **********                                                                                                                     |
│ │ │ │ │ -|****** ....//ssrrcc//kkaaddeemmlliiaa//rroouuttiinngg__ttaabbllee..ccpppp::228899 ******                                                                                                                                  |
│ │ │ │ │ -|, m_bucket_size(bucket_size)                                                                                                                                                   |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	// bucket sizes must be a power of 2                                                                                                                                          |
│ │ │ │ │ -|	TORRENT_ASSERT_VAL(((bucket_size - 1) & bucket_size) == 0, bucket_size);                                                                                                      |
│ │ │ │ │ -|	TORRENT_UNUSED(log);                                                                                                                                                          |
│ │ │ │ │ -|	m_buckets.reserve(30);                                                                                                                                                        |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|int routing_table::bucket_limit(int bucket) const                                                                                                                              |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	if (!m_settings.get_bool(settings_pack::dht_extended_routing_table)) return m_bucket_size;                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	static const aux::array<int, 4> size_exceptions{{{16, 8, 4, 2}}};                                                                                                             |
│ │ │ │ │ -|	if (bucket < size_exceptions.end_index())                                                                                                                                     |
│ │ │ │ │ -|		return m_bucket_size * size_exceptions[bucket];                                                                                                                              |
│ │ │ │ │ -|	return m_bucket_size;                                                                                                                                                         |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void routing_table::status(std::vector<dht_routing_bucket>& s) const                                                                                                           |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|if (s.size() > m_buckets.size()) return;                                                                                                                                       |
│ │ │ │ │ -|s.clear();                                                                                                                                                                     |
│ │ │ │ │ -|	for (auto const& i : m_buckets)                                                                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		dht_routing_bucket b;                                                                                                                                                        |
│ │ │ │ │ -|		b.num_nodes = int(i.live_nodes.size());                                                                                                                                      |
│ │ │ │ │ -|		b.num_replacements = int(i.replacements.size());                                                                                                                             |
│ │ │ │ │ -|		s.push_back(b);                                                                                                                                                              |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_#_i_f_ _T_O_R_R_E_N_T___A_B_I___V_E_R_S_I_O_N_ _=_=_ _1_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |arvidn note when it's across IPv4 and IPv6, adding (dht_global_nodes) would make sense. in the future though, where we may have one |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_r_o_u_t_i_n_g___t_a_b_l_e_._c_p_p_:_3_1_4_ _ _ _ _ _ _ _ _ _|_D_H_T_ _n_o_d_e_ _p_e_r_ _e_x_t_e_r_n_a_l_ _i_n_t_e_r_f_a_c_e_ _(_w_h_i_c_h_ _m_a_y_ _b_e_ _m_u_l_t_i_p_l_e_ _o_f_ _t_h_e_ _s_a_m_e_ _a_d_d_r_e_s_s_ _f_a_m_i_l_y_)_,_ _t_h_e_n_ _i_t_ _b_e_c_o_m_e_s_ _a_ _b_i_t_ _t_r_i_c_k_i_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** aarrvviiddnn nnoottee wwhheenn iitt''ss aaccrroossss IIPPvv44 aanndd IIPPvv66,, aaddddiinngg ((ddhhtt__gglloobbaall__nnooddeess)) wwoouulldd mmaakkee sseennssee.. iinn tthhee ffuuttuurree tthhoouugghh,, wwhheerree wwee mmaayy hhaavvee oonnee DDHHTT nnooddee ppeerr eexxtteerrnnaall iinntteerrffaaccee      |
│ │ │ │ │ -|((wwhhiicchh mmaayy bbee mmuullttiippllee ooff tthhee ssaammee aaddddrreessss ffaammiillyy)),, tthheenn iitt bbeeccoommeess aa bbiitt ttrriicckkiieerr **********                                                                                       |
│ │ │ │ │ -|****** ....//ssrrcc//kkaaddeemmlliiaa//rroouuttiinngg__ttaabbllee..ccpppp::331144 ******                                                                                                                                  |
│ │ │ │ │ -|if (s.size() > m_buckets.size()) return;                                                                                                                                       |
│ │ │ │ │ -|	s.clear();                                                                                                                                                                    |
│ │ │ │ │ -|	for (auto const& i : m_buckets)                                                                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		dht_routing_bucket b;                                                                                                                                                        |
│ │ │ │ │ -|		b.num_nodes = int(i.live_nodes.size());                                                                                                                                      |
│ │ │ │ │ -|		b.num_replacements = int(i.replacements.size());                                                                                                                             |
│ │ │ │ │ -|		s.push_back(b);                                                                                                                                                              |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|void routing_table::status(session_status& s) const                                                                                                                            |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	int dht_nodes;                                                                                                                                                                |
│ │ │ │ │ -|	int dht_node_cache;                                                                                                                                                           |
│ │ │ │ │ -|	int ignore;                                                                                                                                                                   |
│ │ │ │ │ -|	std::tie(dht_nodes, dht_node_cache, ignore) = size();                                                                                                                         |
│ │ │ │ │ -|	s.dht_nodes += dht_nodes;                                                                                                                                                     |
│ │ │ │ │ -|	s.dht_node_cache += dht_node_cache;                                                                                                                                           |
│ │ │ │ │ -|s.dht_global_nodes += num_global_nodes();                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	for (auto const& i : m_buckets)                                                                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		dht_routing_bucket b;                                                                                                                                                        |
│ │ │ │ │ -|		b.num_nodes = int(i.live_nodes.size());                                                                                                                                      |
│ │ │ │ │ -|		b.num_replacements = int(i.replacements.size());                                                                                                                             |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|		b.last_active = 0;                                                                                                                                                           |
│ │ │ │ │ +|relevance 0|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |pick the closest node rather than the first                                                                                         |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_d_h_t___t_r_a_c_k_e_r_._c_p_p_:_3_1_7_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ppiicckk tthhee cclloosseesstt nnooddee rraatthheerr tthhaann tthhee ffiirrsstt **********                                                                                                                        |
│ │ │ │ │ +|****** ....//ssrrcc//kkaaddeemmlliiaa//ddhhtt__ttrraacckkeerr..ccpppp::331177 ******                                                                                                                                    |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │ +|		m_log->log(dht_logger::tracker, "*** new write key*** %d nodes"                                                                                                              |
│ │ │ │ │ +|			, int(m_nodes.size()));                                                                                                                                                     |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │ -|		s.dht_routing_table.push_back(b);                                                                                                                                            |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|std::tuple<int, int, int> routing_table::size() const                                                                                                                          |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	int nodes = 0;                                                                                                                                                                |
│ │ │ │ │ -|	int replacements = 0;                                                                                                                                                         |
│ │ │ │ │ -|	int confirmed = 0;                                                                                                                                                            |
│ │ │ │ │ -|	for (auto const& i : m_buckets)                                                                                                                                               |
│ │ │ │ │ +|	void dht_tracker::update_storage_node_ids()                                                                                                                                   |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		nodes += int(i.live_nodes.size());                                                                                                                                           |
│ │ │ │ │ -|		confirmed += static_cast<int>(std::count_if(i.live_nodes.begin(), i.live_nodes.end()                                                                                         |
│ │ │ │ │ -|			, [](node_entry const& k) { return k.confirmed(); } ));                                                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		replacements += int(i.replacements.size());                                                                                                                                  |
│ │ │ │ │ +|		std::vector<sha1_hash> ids;                                                                                                                                                  |
│ │ │ │ │ +|		for (auto& n : m_nodes)                                                                                                                                                      |
│ │ │ │ │ +|			ids.push_back(n.second.dht.nid());                                                                                                                                          |
│ │ │ │ │ +|		m_storage.update_node_ids(ids);                                                                                                                                              |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ -|	return std::make_tuple(nodes, replacements, confirmed);                                                                                                                       |
│ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_s_r_c_/_k_a_d_e_m_l_i_a_/              |this need to take bucket "prefix" into account. It should be unified with add_node_impl()                                           |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_r_o_u_t_i_n_g___t_a_b_l_e_._c_p_p_:_5_1_8_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** tthhiiss nneeeedd ttoo ttaakkee bbuucckkeett ""pprreeffiixx"" iinnttoo aaccccoouunntt.. IItt sshhoouulldd bbee uunniiffiieedd wwiitthh aadddd__nnooddee__iimmppll(()) **********                                                                          |
│ │ │ │ │ -|****** ....//ssrrcc//kkaaddeemmlliiaa//rroouuttiinngg__ttaabbllee..ccpppp::551188 ******                                                                                                                                  |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	for (auto i = m_buckets.begin() , end(m_buckets.end()); i != end; ++i)                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	node* dht_tracker::get_node(node_id const& id, std::string const& family_name)                                                                                                |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		for (auto j = i->replacements.begin(); j != i->replacements.end(); ++j)                                                                                                      |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (j->addr() != ep.address()) continue;                                                                                                                                    |
│ │ │ │ │ -|			if (j->port() != ep.port()) continue;                                                                                                                                       |
│ │ │ │ │ -|			return std::make_tuple(&*j, i, &i->replacements);                                                                                                                           |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|		for (auto j = i->live_nodes.begin(); j != i->live_nodes.end(); ++j)                                                                                                          |
│ │ │ │ │ +|		TORRENT_UNUSED(id);                                                                                                                                                          |
│ │ │ │ │ +|		for (auto& n : m_nodes)                                                                                                                                                      |
│ │ │ │ │  |		{                                                                                                                                                                            |
│ │ │ │ │ -|			if (j->addr() != ep.address()) continue;                                                                                                                                    |
│ │ │ │ │ -|			if (j->port() != ep.port()) continue;                                                                                                                                       |
│ │ │ │ │ -|			return std::make_tuple(&*j, i, &i->live_nodes);                                                                                                                             |
│ │ │ │ │ +|if (n.second.dht.protocol_family_name() == family_name)                                                                                                                        |
│ │ │ │ │ +|return &n.second.dht;                                                                                                                                                          |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|	return std::tuple<node_entry*, routing_table::table_t::iterator, bucket_t*>                                                                                                   |
│ │ │ │ │ -|	{nullptr, m_buckets.end(), nullptr};                                                                                                                                          |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|void routing_table::fill_from_replacements(table_t::iterator bucket)                                                                                                           |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	bucket_t& b = bucket->live_nodes;                                                                                                                                             |
│ │ │ │ │ -|	bucket_t& rb = bucket->replacements;                                                                                                                                          |
│ │ │ │ │ -|	int const bucket_size = bucket_limit(int(std::distance(m_buckets.begin(), bucket)));                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	if (int(b.size()) >= bucket_size) return;                                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// sort by RTT first, to find the node with the lowest                                                                                                                        |
│ │ │ │ │ -|	// RTT that is pinged                                                                                                                                                         |
│ │ │ │ │ -|	std::sort(rb.begin(), rb.end());                                                                                                                                              |
│ │ │ │ │ +|		return nullptr;                                                                                                                                                              |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	while (int(b.size()) < bucket_size && !rb.empty())                                                                                                                            |
│ │ │ │ │ +|	void dht_tracker::get_peers(sha1_hash const& ih                                                                                                                               |
│ │ │ │ │ +|		, std::function<void(std::vector<tcp::endpoint> const&)> f)                                                                                                                  |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		auto j = std::find_if(rb.begin(), rb.end(), std::bind(&node_entry::pinged, _1));                                                                                             |
│ │ │ │ │ -|		if (j == rb.end()) break;                                                                                                                                                    |
│ │ │ │ │ -|		b.push_back(*j);                                                                                                                                                             |
│ │ │ │ │ -|		rb.erase(j);                                                                                                                                                                 |
│ │ │ │ │ +|		for (auto& n : m_nodes)                                                                                                                                                      |
│ │ │ │ │ +|			n.second.dht.get_peers(ih, f, {}, {});                                                                                                                                      |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|void routing_table::prune_empty_bucket()                                                                                                                                       |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	if (m_buckets.back().live_nodes.empty()                                                                                                                                       |
│ │ │ │ │ -|		&& m_buckets.back().replacements.empty())                                                                                                                                    |
│ │ │ │ │ +|	void dht_tracker::announce(sha1_hash const& ih, int listen_port                                                                                                               |
│ │ │ │ │ +|		, announce_flags_t const flags                                                                                                                                               |
│ │ │ │ │ +|		, std::function<void(std::vector<tcp::endpoint> const&)> f)                                                                                                                  |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		m_buckets.erase(m_buckets.end() - 1);                                                                                                                                        |
│ │ │ │ │ +|		for (auto& n : m_nodes)                                                                                                                                                      |
│ │ │ │ │ +|			n.second.dht.announce(ih, listen_port, flags, f);                                                                                                                           |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_v_o_i_d_ _r_o_u_t_i_n_g___t_a_b_l_e_:_:_r_e_m_o_v_e___n_o_d_e_(_n_o_d_e___e_n_t_r_y_*_ _n_,_ _b_u_c_k_e_t___t_*_ _b_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|	void dht_tracker::sample_infohashes(udp::endpoint const& ep, sha1_hash const& target                                                                                          |
│ │ │ │ │ +|		, std::function<void(node_id                                                                                                                                                 |
│ │ │ │ │ +|			, time_duration                                                                                                                                                             |
│ │ │ │ │ +|			, int, std::vector<sha1_hash>                                                                                                                                               |
│ │ │ │ │ +|			, std::vector<std::pair<sha1_hash, udp::endpoint>>)> f)                                                                                                                     |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		for (auto& n : m_nodes)                                                                                                                                                      |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|_	_	_	_i_f_ _(_e_p_._p_r_o_t_o_c_o_l_(_)_ _!_=_ _(_n_._f_i_r_s_t_._g_e_t___e_x_t_e_r_n_a_l___a_d_d_r_e_s_s_(_)_._i_s___v_4_(_)_ _?_ _u_d_p_:_:_v_4_(_)_ _:_ _u_d_p_:_:_v_6_(_)_)_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |change the type to std::shared_ptr in C++17 it is used as if immutable, it cannot be const for technical reasons right now.         |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_t_o_r_r_e_n_t___i_n_f_o_._h_p_p_:_7_2_9_ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** cchhaannggee tthhee ttyyppee ttoo ssttdd::::sshhaarreedd__ppttrr iinn CC++++1177 iitt iiss uusseedd aass iiff iimmmmuuttaabbllee,, iitt ccaannnnoott bbee ccoonnsstt ffoorr tteecchhnniiccaall rreeaassoonnss rriigghhtt nnooww.. **********                                        |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//ttoorrrreenntt__iinnffoo..hhpppp::772299 ******                                                                                                                             |
│ │ │ │ │  |		// these are the collections from outside of the info-dict. These are                                                                                                        |
│ │ │ │ │  |		// owning strings, since we only keep the info-section around, these                                                                                                         |
│ │ │ │ │  |		// cannot be pointers into that buffer.                                                                                                                                      |
│ │ │ │ │ @@ -11031,152 +11031,121 @@
│ │ │ │ │  |		std::int32_t m_piece_hashes = 0;                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// the number of bytes in m_info_section                                                                                                                                     |
│ │ │ │ │  |		std::int32_t m_info_section_size = 0;                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// this is used when creating a torrent. If there's                                                                                                                          |
│ │ │ │ │  |_	_	_/_/_ _o_n_l_y_ _o_n_e_ _f_i_l_e_ _t_h_e_r_e_ _a_r_e_ _c_a_s_e_s_ _w_h_e_r_e_ _i_t_'_s_ _i_m_p_o_s_s_i_b_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |hide this declaration when deprecated functions are disabled, and remove its internal use                                           |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_i_d_e_n_t_i_f_y___c_l_i_e_n_t_._h_p_p_:_4_8_ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** hhiiddee tthhiiss ddeeccllaarraattiioonn wwhheenn ddeepprreeccaatteedd ffuunnccttiioonnss aarree ddiissaabblleedd,, aanndd rreemmoovvee iittss iinntteerrnnaall uussee **********                                                                          |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//iiddeennttiiffyy__cclliieenntt..hhpppp::4488 ******                                                                                                                           |
│ │ │ │ │ -|CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)                                                                                                        |
│ │ │ │ │ -|ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE                                                                                                     |
│ │ │ │ │ -|POSSIBILITY OF SUCH DAMAGE.                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|*/                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED                                                                                                                                   |
│ │ │ │ │ -|#define TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED                                                                                                                                   |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |should this be allocated lazily?                                                                                                    |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_p_i_e_c_e___p_i_c_k_e_r_._h_p_p_:_8_2_3_ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** sshhoouulldd tthhiiss bbee aallllooccaatteedd llaazziillyy?? **********                                                                                                                                   |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppiieeccee__ppiicckkeerr..hhpppp::882233 ******                                                                                                                             |
│ │ │ │ │ +|// download list it may live in now                                                                                                                                            |
│ │ │ │ │ +|		std::vector<downloading_piece>::iterator update_piece_state(                                                                                                                 |
│ │ │ │ │ +|			std::vector<downloading_piece>::iterator dp);                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/config.hpp"                                                                                                                                               |
│ │ │ │ │ +|	private:                                                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_push.hpp"                                                                                                                           |
│ │ │ │ │ -|#include <boost/optional.hpp>                                                                                                                                                  |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │ +|#if TORRENT_USE_ASSERTS || TORRENT_USE_INVARIANT_CHECKS                                                                                                                        |
│ │ │ │ │ +|		index_range<download_queue_t> categories() const                                                                                                                             |
│ │ │ │ │ +|		{ return {{}, piece_picker::piece_pos::num_download_categories}; }                                                                                                           |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/peer_id.hpp"                                                                                                                                              |
│ │ │ │ │ -|#include "libtorrent/fingerprint.hpp"                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|namespace aux {                                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	TORRENT_EXTRA_EXPORT                                                                                                                                                          |
│ │ │ │ │ -|	std::string identify_client_impl(const peer_id& p);                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// these functions don't really need to be public. This mechanism of                                                                                                          |
│ │ │ │ │ -|	// advertising client software and version is also out-dated.                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// This function can can be used to extract a string describing a client                                                                                                      |
│ │ │ │ │ -|	// version from its peer-id. It will recognize most clients that have this                                                                                                    |
│ │ │ │ │ -|	// kind of identification in the peer-id.                                                                                                                                     |
│ │ │ │ │ -|	TORRENT_DEPRECATED_EXPORT                                                                                                                                                     |
│ │ │ │ │ -|	std::string identify_client(const peer_id& p);                                                                                                                                |
│ │ │ │ │ +|		// the following vectors are mutable because they sometimes may                                                                                                              |
│ │ │ │ │ +|		// be updated lazily, triggered by const functions                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|		// this maps indices to number of peers that has this piece and                                                                                                              |
│ │ │ │ │ +|		// index into the m_piece_info vectors.                                                                                                                                      |
│ │ │ │ │ +|		// piece_pos::we_have_index means that we have the piece, so it                                                                                                              |
│ │ │ │ │ +|		// doesn't exist in the piece_info buckets                                                                                                                                   |
│ │ │ │ │ +|		// pieces with the filtered flag set doesn't have entries in                                                                                                                 |
│ │ │ │ │ +|		// the m_piece_info buckets either                                                                                                                                           |
│ │ │ │ │ +|mutable aux::vector<piece_pos, piece_index_t> m_piece_map;                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"                                                                                                               |
│ │ │ │ │ +|		// tracks the number of bytes in a specific piece that are part of a pad                                                                                                     |
│ │ │ │ │ +|		// file. The padding is assumed to be at the end of the piece, and the                                                                                                       |
│ │ │ │ │ +|		// blocks covered by the pad bytes are not picked by the piece picker                                                                                                        |
│ │ │ │ │ +|		std::unordered_map<piece_index_t, int> m_pads_in_piece;                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	// Returns an optional fingerprint if any can be identified from the peer                                                                                                     |
│ │ │ │ │ -|	// id. This can be used to automate the identification of clients. It will                                                                                                    |
│ │ │ │ │ -|	// not be able to identify peers with non- standard encodings. Only Azureus                                                                                                   |
│ │ │ │ │ -|	// style, Shadow's style and Mainline style.                                                                                                                                  |
│ │ │ │ │ -|	TORRENT_DEPRECATED_EXPORT                                                                                                                                                     |
│ │ │ │ │ -|	boost::optional<fingerprint>                                                                                                                                                  |
│ │ │ │ │ -|		client_fingerprint(peer_id const& p);                                                                                                                                        |
│ │ │ │ │ +|		// when the adjacent_piece affinity is enabled, this contains the most                                                                                                       |
│ │ │ │ │ +|		// recent "extents" of adjacent pieces that have been requested from                                                                                                         |
│ │ │ │ │ +|		// this is mutable because it's updated by functions to pick pieces, which                                                                                                   |
│ │ │ │ │ +|		// are const. That's an efficient place to update it, since it's being                                                                                                       |
│ │ │ │ │ +|		// traversed already.                                                                                                                                                        |
│ │ │ │ │ +|		mutable std::vector<piece_extent_t> m_recent_extents;                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_#_i_n_c_l_u_d_e_ _"_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/_d_i_s_a_b_l_e___w_a_r_n_i_n_g_s___p_o_p_._h_p_p_"_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |move to aux                                                                                                                         |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_s_o_c_k_e_t___t_y_p_e_._h_p_p_:_6_0_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmoovvee ttoo aauuxx **********                                                                                                                                                        |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ssoocckkeett__ttyyppee..hhpppp::6600 ******                                                                                                                               |
│ │ │ │ │ -|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │ +|		// the number of bytes of pad file set in this piece picker                                                                                                                  |
│ │ │ │ │ +|		std::int64_t m_num_pad_bytes = 0;                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// A type describing kinds of sockets involved in various operations or events.                                                                                                |
│ │ │ │ │ -|enum class socket_type_t : std::uint8_t {                                                                                                                                      |
│ │ │ │ │ -|	tcp,                                                                                                                                                                          |
│ │ │ │ │ -|	socks5,                                                                                                                                                                       |
│ │ │ │ │ -|	http,                                                                                                                                                                         |
│ │ │ │ │ -|	utp,                                                                                                                                                                          |
│ │ │ │ │ -|	i2p,                                                                                                                                                                          |
│ │ │ │ │ -|	tcp_ssl,                                                                                                                                                                      |
│ │ │ │ │ -|	socks5_ssl,                                                                                                                                                                   |
│ │ │ │ │ -|	http_ssl,                                                                                                                                                                     |
│ │ │ │ │ -|	utp_ssl,                                                                                                                                                                      |
│ │ │ │ │ +|		// the number of pad blocks that we already have                                                                                                                             |
│ │ │ │ │ +|		std::int64_t m_have_pad_bytes = 0;                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION <= 2                                                                                                                                                   |
│ │ │ │ │ -|	udp TORRENT_DEPRECATED_ENUM = utp,                                                                                                                                            |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|};                                                                                                                                                                             |
│ │ │ │ │ +|		// the number of pad blocks part of filtered pieces we don't have                                                                                                            |
│ │ │ │ │ +|		std::int64_t m_filtered_pad_bytes = 0;                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// return a short human readable name for types of socket                                                                                                                      |
│ │ │ │ │ -|char const* socket_type_name(socket_type_t);                                                                                                                                   |
│ │ │ │ │ +|		// the number of pad blocks we have that are also filtered                                                                                                                   |
│ │ │ │ │ +|		std::int64_t m_have_filtered_pad_bytes = 0;                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|		// the number of seeds. These are not added to                                                                                                                               |
│ │ │ │ │ +|		// the availability counters of the pieces                                                                                                                                   |
│ │ │ │ │ +|		int m_seeds = 0;                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |include the number of peers received from this tracker, at last announce                                                            |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_a_n_n_o_u_n_c_e___e_n_t_r_y_._h_p_p_:_7_6_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinncclluuddee tthhee nnuummbbeerr ooff ppeeeerrss rreecceeiivveedd ffrroomm tthhiiss ttrraacckkeerr,, aatt llaasstt aannnnoouunnccee **********                                                                                           |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aannnnoouunnccee__eennttrryy..hhpppp::7766 ******                                                                                                                            |
│ │ │ │ │ -|	struct TORRENT_EXPORT announce_infohash                                                                                                                                       |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		// internal                                                                                                                                                                  |
│ │ │ │ │ -|		TORRENT_UNEXPORT announce_infohash();                                                                                                                                        |
│ │ │ │ │ +|_	_	_/_/_ _t_h_i_s_ _v_e_c_t_o_r_ _c_o_n_t_a_i_n_s_ _a_l_l_ _p_i_e_c_e_ _i_n_d_i_c_e_s_ _t_h_a_t_ _a_r_e_ _p_i_c_k_a_b_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |it would be more intuitive to account "wanted" pieces instead of filtered                                                           |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_p_i_e_c_e___p_i_c_k_e_r_._h_p_p_:_8_9_5_ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd bbee mmoorree iinnttuuiittiivvee ttoo aaccccoouunntt ""wwaanntteedd"" ppiieecceess iinnsstteeaadd ooff ffiilltteerreedd **********                                                                                          |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppiieeccee__ppiicckkeerr..hhpppp::889955 ******                                                                                                                             |
│ │ │ │ │ +|		// this holds the information of the blocks in partially downloaded                                                                                                          |
│ │ │ │ │ +|		// pieces. the downloading_piece::info index point into this vector for                                                                                                      |
│ │ │ │ │ +|		// its storage                                                                                                                                                               |
│ │ │ │ │ +|		aux::vector<block_info> m_block_info;                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// if this tracker has returned an error or warning message                                                                                                                  |
│ │ │ │ │ -|		// that message is stored here                                                                                                                                               |
│ │ │ │ │ -|		std::string message;                                                                                                                                                         |
│ │ │ │ │ +|		// these are block ranges in m_block_info that are free. The numbers                                                                                                         |
│ │ │ │ │ +|		// in here, when multiplied by blocks_per_piece is the index to the                                                                                                          |
│ │ │ │ │ +|		// first block in the range that's free to use by a new downloading_piece.                                                                                                   |
│ │ │ │ │ +|		// this is a free-list.                                                                                                                                                      |
│ │ │ │ │ +|		std::vector<std::uint16_t> m_free_block_infos;                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// if this tracker failed the last time it was contacted                                                                                                                     |
│ │ │ │ │ -|		// this error code specifies what error occurred                                                                                                                             |
│ │ │ │ │ -|		error_code last_error;                                                                                                                                                       |
│ │ │ │ │ +|		std::uint16_t m_blocks_in_last_piece = 0;                                                                                                                                    |
│ │ │ │ │ +|		int m_piece_size = 0;                                                                                                                                                        |
│ │ │ │ │ +|		std::int64_t m_total_size = 0;                                                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the time of next tracker announce                                                                                                                                         |
│ │ │ │ │ -|		time_point32 next_announce = (time_point32::min)();                                                                                                                          |
│ │ │ │ │ +|		// the number of filtered pieces that we don't already                                                                                                                       |
│ │ │ │ │ +|		// have. total_number_of_pieces - number_of_pieces_we_have                                                                                                                   |
│ │ │ │ │ +|		// - num_filtered is supposed to the number of pieces                                                                                                                        |
│ │ │ │ │ +|		// we still want to download                                                                                                                                                 |
│ │ │ │ │ +|int m_num_filtered = 0;                                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// no announces before this time                                                                                                                                             |
│ │ │ │ │ -|		time_point32 min_announce = (time_point32::min)();                                                                                                                           |
│ │ │ │ │ +|		// the number of pieces we have that also are filtered                                                                                                                       |
│ │ │ │ │ +|		int m_num_have_filtered = 0;                                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ +|		// we have all pieces in the range [0, m_cursor)                                                                                                                             |
│ │ │ │ │ +|		// m_cursor is the first piece we don't have                                                                                                                                 |
│ │ │ │ │ +|		piece_index_t m_cursor{0};                                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// these are either -1 or the scrape information this tracker last                                                                                                             |
│ │ │ │ │ -|		// responded with. *incomplete* is the current number of downloaders in                                                                                                      |
│ │ │ │ │ -|		// the swarm, *complete* is the current number of seeds in the swarm and                                                                                                     |
│ │ │ │ │ -|		// *downloaded* is the cumulative number of completed downloads of this                                                                                                      |
│ │ │ │ │ -|		// torrent, since the beginning of time (from this tracker's point of                                                                                                        |
│ │ │ │ │ -|		// view).                                                                                                                                                                    |
│ │ │ │ │ +|		// we have all pieces in the range [m_reverse_cursor, end)                                                                                                                   |
│ │ │ │ │ +|		// m_reverse_cursor is the first piece where we also have                                                                                                                    |
│ │ │ │ │ +|		// all the subsequent pieces                                                                                                                                                 |
│ │ │ │ │ +|		piece_index_t m_reverse_cursor{0};                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// if this tracker has returned scrape data, these fields are filled in                                                                                                      |
│ │ │ │ │ -|		// with valid numbers. Otherwise they are set to -1. ``incomplete`` counts                                                                                                   |
│ │ │ │ │ -|		// the number of current downloaders. ``complete`` counts the number of                                                                                                      |
│ │ │ │ │ -|		// current peers completed the download, or "seeds". ``downloaded`` is the                                                                                                   |
│ │ │ │ │ -|		// cumulative number of completed downloads.                                                                                                                                 |
│ │ │ │ │ -|		int scrape_incomplete = -1;                                                                                                                                                  |
│ │ │ │ │ -|		int scrape_complete = -1;                                                                                                                                                    |
│ │ │ │ │ -|		int scrape_downloaded = -1;                                                                                                                                                  |
│ │ │ │ │ +|		// the number of pieces we have (i.e. passed hash check).                                                                                                                    |
│ │ │ │ │ +|		// This includes pieces that we have filtered but still have                                                                                                                 |
│ │ │ │ │ +|		int m_num_have = 0;                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of times in a row we have failed to announce to this                                                                                                           |
│ │ │ │ │ -|		// tracker.                                                                                                                                                                  |
│ │ │ │ │ -|		std::uint8_t fails : 7;                                                                                                                                                      |
│ │ │ │ │ +|		// if this is set to true, it means update_pieces()                                                                                                                          |
│ │ │ │ │ +|		// has to be called before accessing m_pieces.                                                                                                                               |
│ │ │ │ │ +|		mutable bool m_dirty = false;                                                                                                                                                |
│ │ │ │ │ +|	public:                                                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// true while we're waiting for a response from the tracker.                                                                                                                 |
│ │ │ │ │ -|		bool updating : 1;                                                                                                                                                           |
│ │ │ │ │ +|		enum { max_pieces = (std::numeric_limits<int>::max)() - 1 };                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// set to true when we get a valid response from an announce                                                                                                                 |
│ │ │ │ │ -|		// with event=started. If it is set, we won't send start in the subsequent                                                                                                   |
│ │ │ │ │ -|		// announces.                                                                                                                                                                |
│ │ │ │ │ -|		bool start_sent : 1;                                                                                                                                                         |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// set to true when we send a event=completed.                                                                                                                               |
│ │ │ │ │ -|_	_	_b_o_o_l_ _c_o_m_p_l_e_t_e___s_e_n_t_ _:_ _1_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_#_e_n_d_i_f_ _/_/_ _T_O_R_R_E_N_T___P_I_E_C_E___P_I_C_K_E_R___H_P_P___I_N_C_L_U_D_E_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |make this a raw pointer. perhaps keep the shared_ptr around further down the object to maintain an owner                            |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_t_o_r_r_e_n_t_._h_p_p_:_2_8_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** mmaakkee tthhiiss aa rraaww ppooiinntteerr.. ppeerrhhaappss kkeeeepp tthhee sshhaarreedd__ppttrr aarroouunndd ffuurrtthheerr ddoowwnn tthhee oobbjjeecctt ttoo mmaaiinnttaaiinn aann oowwnneerr **********                                                           |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//ttoorrrreenntt..hhpppp::228800 ******                                                                                                                                  |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |	};                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ @@ -11442,14 +11411,108 @@
│ │ │ │ │  |		// remember that this is an SSL torrent, so that we don't                                                                                                                    |
│ │ │ │ │  |		// accidentally start seeding it without any authentication.                                                                                                                 |
│ │ │ │ │  |		bool m_ssl_torrent:1;                                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// this is set to true if we're trying to delete the                                                                                                                         |
│ │ │ │ │  |		// files belonging to it. When set, don't write any                                                                                                                          |
│ │ │ │ │  |_	_	_/_/_ _m_o_r_e_ _b_l_o_c_k_s_ _t_o_ _d_i_s_k_!_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |some space could be saved here by making gauges 32 bits                                                                             |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._h_p_p_:_4_8_5_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ssoommee ssppaaccee ccoouulldd bbee ssaavveedd hheerree bbyy mmaakkiinngg ggaauuggeess 3322 bbiittss **********                                                                                                            |
│ │ │ │ │ +|_**_**_**_ _.._.._//_ii_nn_cc_ll_uu_dd_ee_//_ll_ii_bb_tt_oo_rr_rr_ee_nn_tt_//_pp_ee_rr_ff_oo_rr_mm_aa_nn_cc_ee____cc_oo_uu_nn_tt_ee_rr_ss_.._hh_pp_pp_::_44_88_55_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |restore these to regular integers. Instead have one copy of the counters per thread and collect them at convenient synchronization  |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._h_p_p_:_4_8_6_ _ _|_p_o_i_n_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** rreessttoorree tthheessee ttoo rreegguullaarr iinntteeggeerrss.. IInnsstteeaadd hhaavvee oonnee ccooppyy ooff tthhee ccoouunntteerrss ppeerr tthhrreeaadd aanndd ccoolllleecctt tthheemm aatt ccoonnvveenniieenntt ssyynncchhrroonniizzaattiioonn ppooiinnttss **********                          |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppeerrffoorrmmaannccee__ccoouunntteerrss..hhpppp::448866 ******                                                                                                                     |
│ │ │ │ │ +|#ifdef ATOMIC_LLONG_LOCK_FREE                                                                                                                                                  |
│ │ │ │ │ +|#define TORRENT_COUNTER_NOEXCEPT noexcept                                                                                                                                      |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|#define TORRENT_COUNTER_NOEXCEPT                                                                                                                                               |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		counters() TORRENT_COUNTER_NOEXCEPT;                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		counters(counters const&) TORRENT_COUNTER_NOEXCEPT;                                                                                                                          |
│ │ │ │ │ +|		counters& operator=(counters const&) & TORRENT_COUNTER_NOEXCEPT;                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// returns the new value                                                                                                                                                     |
│ │ │ │ │ +|		std::int64_t inc_stats_counter(int c, std::int64_t value = 1) TORRENT_COUNTER_NOEXCEPT;                                                                                      |
│ │ │ │ │ +|		std::int64_t operator[](int i) const TORRENT_COUNTER_NOEXCEPT;                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		void set_value(int c, std::int64_t value) TORRENT_COUNTER_NOEXCEPT;                                                                                                          |
│ │ │ │ │ +|		void blend_stats_counter(int c, std::int64_t value, int ratio) TORRENT_COUNTER_NOEXCEPT;                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	private:                                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifdef ATOMIC_LLONG_LOCK_FREE                                                                                                                                                  |
│ │ │ │ │ +|aux::array<std::atomic<std::int64_t>, num_counters> m_stats_counter;                                                                                                           |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|		// if the atomic type isn't lock-free, use a single lock instead, for                                                                                                        |
│ │ │ │ │ +|		// the whole array                                                                                                                                                           |
│ │ │ │ │ +|		mutable std::mutex m_mutex;                                                                                                                                                  |
│ │ │ │ │ +|		aux::array<std::int64_t, num_counters> m_stats_counter;                                                                                                                      |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |include the number of peers received from this tracker, at last announce                                                            |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_a_n_n_o_u_n_c_e___e_n_t_r_y_._h_p_p_:_7_6_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinncclluuddee tthhee nnuummbbeerr ooff ppeeeerrss rreecceeiivveedd ffrroomm tthhiiss ttrraacckkeerr,, aatt llaasstt aannnnoouunnccee **********                                                                                           |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aannnnoouunnccee__eennttrryy..hhpppp::7766 ******                                                                                                                            |
│ │ │ │ │ +|	struct TORRENT_EXPORT announce_infohash                                                                                                                                       |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		// internal                                                                                                                                                                  |
│ │ │ │ │ +|		TORRENT_UNEXPORT announce_infohash();                                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// if this tracker has returned an error or warning message                                                                                                                  |
│ │ │ │ │ +|		// that message is stored here                                                                                                                                               |
│ │ │ │ │ +|		std::string message;                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// if this tracker failed the last time it was contacted                                                                                                                     |
│ │ │ │ │ +|		// this error code specifies what error occurred                                                                                                                             |
│ │ │ │ │ +|		error_code last_error;                                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// the time of next tracker announce                                                                                                                                         |
│ │ │ │ │ +|		time_point32 next_announce = (time_point32::min)();                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// no announces before this time                                                                                                                                             |
│ │ │ │ │ +|		time_point32 min_announce = (time_point32::min)();                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|// these are either -1 or the scrape information this tracker last                                                                                                             |
│ │ │ │ │ +|		// responded with. *incomplete* is the current number of downloaders in                                                                                                      |
│ │ │ │ │ +|		// the swarm, *complete* is the current number of seeds in the swarm and                                                                                                     |
│ │ │ │ │ +|		// *downloaded* is the cumulative number of completed downloads of this                                                                                                      |
│ │ │ │ │ +|		// torrent, since the beginning of time (from this tracker's point of                                                                                                        |
│ │ │ │ │ +|		// view).                                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// if this tracker has returned scrape data, these fields are filled in                                                                                                      |
│ │ │ │ │ +|		// with valid numbers. Otherwise they are set to -1. ``incomplete`` counts                                                                                                   |
│ │ │ │ │ +|		// the number of current downloaders. ``complete`` counts the number of                                                                                                      |
│ │ │ │ │ +|		// current peers completed the download, or "seeds". ``downloaded`` is the                                                                                                   |
│ │ │ │ │ +|		// cumulative number of completed downloads.                                                                                                                                 |
│ │ │ │ │ +|		int scrape_incomplete = -1;                                                                                                                                                  |
│ │ │ │ │ +|		int scrape_complete = -1;                                                                                                                                                    |
│ │ │ │ │ +|		int scrape_downloaded = -1;                                                                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// the number of times in a row we have failed to announce to this                                                                                                           |
│ │ │ │ │ +|		// tracker.                                                                                                                                                                  |
│ │ │ │ │ +|		std::uint8_t fails : 7;                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// true while we're waiting for a response from the tracker.                                                                                                                 |
│ │ │ │ │ +|		bool updating : 1;                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// set to true when we get a valid response from an announce                                                                                                                 |
│ │ │ │ │ +|		// with event=started. If it is set, we won't send start in the subsequent                                                                                                   |
│ │ │ │ │ +|		// announces.                                                                                                                                                                |
│ │ │ │ │ +|		bool start_sent : 1;                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// set to true when we send a event=completed.                                                                                                                               |
│ │ │ │ │ +|_	_	_b_o_o_l_ _c_o_m_p_l_e_t_e___s_e_n_t_ _:_ _1_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |           |_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |                                                                                                                                    |
│ │ │ │ │  |relevance 0|_p_e_e_r___c_o_n_n_e_c_t_i_o_n___i_n_t_e_r_f_a_c_e_._h_p_p_:|make this interface smaller!                                                                                                        |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_5_1_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** mmaakkee tthhiiss iinntteerrffaaccee ssmmaalllleerr!! **********                                                                                                                                       |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppeeeerr__ccoonnnneeccttiioonn__iinntteerrffaaccee..hhpppp::5511 ******                                                                                                                 |
│ │ │ │ │  |*/                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ @@ -11497,121 +11560,208 @@
│ │ │ │ │  |		virtual stat const& statistics() const = 0;                                                                                                                                  |
│ │ │ │ │  |		virtual void get_peer_info(peer_info& p) const = 0;                                                                                                                          |
│ │ │ │ │  |#ifndef TORRENT_DISABLE_LOGGING                                                                                                                                                |
│ │ │ │ │  |		virtual bool should_log(peer_log_alert::direction_t direction) const = 0;                                                                                                    |
│ │ │ │ │  |		virtual void peer_log(peer_log_alert::direction_t direction                                                                                                                  |
│ │ │ │ │  |			, char const* event, char const* fmt = "", ...) const noexcept TORRENT_FORMAT(4,5) = 0;                                                                                     |
│ │ │ │ │  |_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |should this be allocated lazily?                                                                                                    |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_p_i_e_c_e___p_i_c_k_e_r_._h_p_p_:_8_2_3_ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** sshhoouulldd tthhiiss bbee aallllooccaatteedd llaazziillyy?? **********                                                                                                                                   |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppiieeccee__ppiicckkeerr..hhpppp::882233 ******                                                                                                                             |
│ │ │ │ │ -|// download list it may live in now                                                                                                                                            |
│ │ │ │ │ -|		std::vector<downloading_piece>::iterator update_piece_state(                                                                                                                 |
│ │ │ │ │ -|			std::vector<downloading_piece>::iterator dp);                                                                                                                               |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |support batched adding of block hashes for reduced overhead?                                                                        |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_h_a_s_h___p_i_c_k_e_r_._h_p_p_:_1_5_5_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ssuuppppoorrtt bbaattcchheedd aaddddiinngg ooff bblloocckk hhaasshheess ffoorr rreedduucceedd oovveerrhheeaadd?? **********                                                                                                       |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//hhaasshh__ppiicckkeerr..hhpppp::115555 ******                                                                                                                              |
│ │ │ │ │ +|// the number of hashes in the range                                                                                                                                           |
│ │ │ │ │ +|		int count = 0;                                                                                                                                                               |
│ │ │ │ │ +|		int proof_layers = 0;                                                                                                                                                        |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	// validates the hash_request, to ensure its invariant as well as matching                                                                                                    |
│ │ │ │ │ +|	// the torrent's file_storage and the number of hashes accompanying the                                                                                                       |
│ │ │ │ │ +|	// request                                                                                                                                                                    |
│ │ │ │ │ +|	TORRENT_EXTRA_EXPORT                                                                                                                                                          |
│ │ │ │ │ +|	bool validate_hash_request(hash_request const& hr, file_storage const& fs);                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	class TORRENT_EXTRA_EXPORT hash_picker                                                                                                                                        |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|	public:                                                                                                                                                                       |
│ │ │ │ │ +|		hash_picker(file_storage const& files                                                                                                                                        |
│ │ │ │ │ +|			, aux::vector<aux::merkle_tree, file_index_t>& trees);                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		hash_request pick_hashes(typed_bitfield<piece_index_t> const& pieces);                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		add_hashes_result add_hashes(hash_request const& req, span<sha256_hash const> hashes);                                                                                       |
│ │ │ │ │ +|set_block_hash_result set_block_hash(piece_index_t piece, int offset, sha256_hash const& h);                                                                                   |
│ │ │ │ │ +|void hashes_rejected(hash_request const& req);                                                                                                                                 |
│ │ │ │ │ +|		void verify_block_hashes(piece_index_t index);                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// do we know the piece layer hash for a piece                                                                                                                               |
│ │ │ │ │ +|		bool have_hash(piece_index_t index) const;                                                                                                                                   |
│ │ │ │ │ +|		// do we know all the block hashes for a file?                                                                                                                               |
│ │ │ │ │ +|		bool have_all(file_index_t file) const;                                                                                                                                      |
│ │ │ │ │ +|		bool have_all() const;                                                                                                                                                       |
│ │ │ │ │ +|		bool piece_verified(piece_index_t piece) const;                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		int piece_layer() const { return m_piece_layer; }                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |	private:                                                                                                                                                                      |
│ │ │ │ │ +|		// returns the number of proof layers needed to verify the node's hash                                                                                                       |
│ │ │ │ │ +|		int layers_to_verify(node_index idx) const;                                                                                                                                  |
│ │ │ │ │ +|		int file_num_layers(file_index_t idx) const;                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_ASSERTS || TORRENT_USE_INVARIANT_CHECKS                                                                                                                        |
│ │ │ │ │ -|		index_range<download_queue_t> categories() const                                                                                                                             |
│ │ │ │ │ -|		{ return {{}, piece_picker::piece_pos::num_download_categories}; }                                                                                                           |
│ │ │ │ │ +|		struct piece_hash_request                                                                                                                                                    |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			time_point last_request = min_time();                                                                                                                                       |
│ │ │ │ │ +|			int num_requests = 0;                                                                                                                                                       |
│ │ │ │ │ +|			bool have = false;                                                                                                                                                          |
│ │ │ │ │ +|		};                                                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		struct priority_block_request                                                                                                                                                |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			priority_block_request(file_index_t const f, int const b)                                                                                                                   |
│ │ │ │ │ +|				: file(f), block(b) {}                                                                                                                                                     |
│ │ │ │ │ +|			file_index_t file;                                                                                                                                                          |
│ │ │ │ │ +|_	_	_	_i_n_t_ _b_l_o_c_k_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |hide this declaration when deprecated functions are disabled, and remove its internal use                                           |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_i_d_e_n_t_i_f_y___c_l_i_e_n_t_._h_p_p_:_4_8_ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** hhiiddee tthhiiss ddeeccllaarraattiioonn wwhheenn ddeepprreeccaatteedd ffuunnccttiioonnss aarree ddiissaabblleedd,, aanndd rreemmoovvee iittss iinntteerrnnaall uussee **********                                                                          |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//iiddeennttiiffyy__cclliieenntt..hhpppp::4488 ******                                                                                                                           |
│ │ │ │ │ +|CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)                                                                                                        |
│ │ │ │ │ +|ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE                                                                                                     |
│ │ │ │ │ +|POSSIBILITY OF SUCH DAMAGE.                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|*/                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED                                                                                                                                   |
│ │ │ │ │ +|#define TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#include "libtorrent/config.hpp"                                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_push.hpp"                                                                                                                           |
│ │ │ │ │ +|#include <boost/optional.hpp>                                                                                                                                                  |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the following vectors are mutable because they sometimes may                                                                                                              |
│ │ │ │ │ -|		// be updated lazily, triggered by const functions                                                                                                                           |
│ │ │ │ │ +|#include "libtorrent/peer_id.hpp"                                                                                                                                              |
│ │ │ │ │ +|#include "libtorrent/fingerprint.hpp"                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// this maps indices to number of peers that has this piece and                                                                                                              |
│ │ │ │ │ -|		// index into the m_piece_info vectors.                                                                                                                                      |
│ │ │ │ │ -|		// piece_pos::we_have_index means that we have the piece, so it                                                                                                              |
│ │ │ │ │ -|		// doesn't exist in the piece_info buckets                                                                                                                                   |
│ │ │ │ │ -|		// pieces with the filtered flag set doesn't have entries in                                                                                                                 |
│ │ │ │ │ -|		// the m_piece_info buckets either                                                                                                                                           |
│ │ │ │ │ -|mutable aux::vector<piece_pos, piece_index_t> m_piece_map;                                                                                                                     |
│ │ │ │ │ +|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// tracks the number of bytes in a specific piece that are part of a pad                                                                                                     |
│ │ │ │ │ -|		// file. The padding is assumed to be at the end of the piece, and the                                                                                                       |
│ │ │ │ │ -|		// blocks covered by the pad bytes are not picked by the piece picker                                                                                                        |
│ │ │ │ │ -|		std::unordered_map<piece_index_t, int> m_pads_in_piece;                                                                                                                      |
│ │ │ │ │ +|namespace aux {                                                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// when the adjacent_piece affinity is enabled, this contains the most                                                                                                       |
│ │ │ │ │ -|		// recent "extents" of adjacent pieces that have been requested from                                                                                                         |
│ │ │ │ │ -|		// this is mutable because it's updated by functions to pick pieces, which                                                                                                   |
│ │ │ │ │ -|		// are const. That's an efficient place to update it, since it's being                                                                                                       |
│ │ │ │ │ -|		// traversed already.                                                                                                                                                        |
│ │ │ │ │ -|		mutable std::vector<piece_extent_t> m_recent_extents;                                                                                                                        |
│ │ │ │ │ +|	TORRENT_EXTRA_EXPORT                                                                                                                                                          |
│ │ │ │ │ +|	std::string identify_client_impl(const peer_id& p);                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of bytes of pad file set in this piece picker                                                                                                                  |
│ │ │ │ │ -|		std::int64_t m_num_pad_bytes = 0;                                                                                                                                            |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of pad blocks that we already have                                                                                                                             |
│ │ │ │ │ -|		std::int64_t m_have_pad_bytes = 0;                                                                                                                                           |
│ │ │ │ │ +|	// these functions don't really need to be public. This mechanism of                                                                                                          |
│ │ │ │ │ +|	// advertising client software and version is also out-dated.                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of pad blocks part of filtered pieces we don't have                                                                                                            |
│ │ │ │ │ -|		std::int64_t m_filtered_pad_bytes = 0;                                                                                                                                       |
│ │ │ │ │ +|	// This function can can be used to extract a string describing a client                                                                                                      |
│ │ │ │ │ +|	// version from its peer-id. It will recognize most clients that have this                                                                                                    |
│ │ │ │ │ +|	// kind of identification in the peer-id.                                                                                                                                     |
│ │ │ │ │ +|	TORRENT_DEPRECATED_EXPORT                                                                                                                                                     |
│ │ │ │ │ +|	std::string identify_client(const peer_id& p);                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of pad blocks we have that are also filtered                                                                                                                   |
│ │ │ │ │ -|		std::int64_t m_have_filtered_pad_bytes = 0;                                                                                                                                  |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of seeds. These are not added to                                                                                                                               |
│ │ │ │ │ -|		// the availability counters of the pieces                                                                                                                                   |
│ │ │ │ │ -|		int m_seeds = 0;                                                                                                                                                             |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"                                                                                                               |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_	_	_/_/_ _t_h_i_s_ _v_e_c_t_o_r_ _c_o_n_t_a_i_n_s_ _a_l_l_ _p_i_e_c_e_ _i_n_d_i_c_e_s_ _t_h_a_t_ _a_r_e_ _p_i_c_k_a_b_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |it would be more intuitive to account "wanted" pieces instead of filtered                                                           |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_p_i_e_c_e___p_i_c_k_e_r_._h_p_p_:_8_9_5_ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd bbee mmoorree iinnttuuiittiivvee ttoo aaccccoouunntt ""wwaanntteedd"" ppiieecceess iinnsstteeaadd ooff ffiilltteerreedd **********                                                                                          |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppiieeccee__ppiicckkeerr..hhpppp::889955 ******                                                                                                                             |
│ │ │ │ │ -|		// this holds the information of the blocks in partially downloaded                                                                                                          |
│ │ │ │ │ -|		// pieces. the downloading_piece::info index point into this vector for                                                                                                      |
│ │ │ │ │ -|		// its storage                                                                                                                                                               |
│ │ │ │ │ -|		aux::vector<block_info> m_block_info;                                                                                                                                        |
│ │ │ │ │ +|	// Returns an optional fingerprint if any can be identified from the peer                                                                                                     |
│ │ │ │ │ +|	// id. This can be used to automate the identification of clients. It will                                                                                                    |
│ │ │ │ │ +|	// not be able to identify peers with non- standard encodings. Only Azureus                                                                                                   |
│ │ │ │ │ +|	// style, Shadow's style and Mainline style.                                                                                                                                  |
│ │ │ │ │ +|	TORRENT_DEPRECATED_EXPORT                                                                                                                                                     |
│ │ │ │ │ +|	boost::optional<fingerprint>                                                                                                                                                  |
│ │ │ │ │ +|		client_fingerprint(peer_id const& p);                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// these are block ranges in m_block_info that are free. The numbers                                                                                                         |
│ │ │ │ │ -|		// in here, when multiplied by blocks_per_piece is the index to the                                                                                                          |
│ │ │ │ │ -|		// first block in the range that's free to use by a new downloading_piece.                                                                                                   |
│ │ │ │ │ -|		// this is a free-list.                                                                                                                                                      |
│ │ │ │ │ -|		std::vector<std::uint16_t> m_free_block_infos;                                                                                                                               |
│ │ │ │ │ +|_#_i_n_c_l_u_d_e_ _"_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/_d_i_s_a_b_l_e___w_a_r_n_i_n_g_s___p_o_p_._h_p_p_"_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |support using the windows API for UPnP operations as well                                                                           |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_u_p_n_p_._h_p_p_:_1_6_2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ssuuppppoorrtt uussiinngg tthhee wwiinnddoowwss AAPPII ffoorr UUPPnnPP ooppeerraattiioonnss aass wweellll **********                                                                                                          |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//uuppnnpp..hhpppp::116622 ******                                                                                                                                     |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	bool in_error_code = false;                                                                                                                                                   |
│ │ │ │ │ +|	bool exit = false;                                                                                                                                                            |
│ │ │ │ │ +|	int error_code = -1;                                                                                                                                                          |
│ │ │ │ │ +|};                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		std::uint16_t m_blocks_in_last_piece = 0;                                                                                                                                    |
│ │ │ │ │ -|		int m_piece_size = 0;                                                                                                                                                        |
│ │ │ │ │ -|		std::int64_t m_total_size = 0;                                                                                                                                               |
│ │ │ │ │ +|struct ip_address_parse_state: error_code_parse_state                                                                                                                          |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	bool in_ip_address = false;                                                                                                                                                   |
│ │ │ │ │ +|	std::string ip_address;                                                                                                                                                       |
│ │ │ │ │ +|};                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of filtered pieces that we don't already                                                                                                                       |
│ │ │ │ │ -|		// have. total_number_of_pieces - number_of_pieces_we_have                                                                                                                   |
│ │ │ │ │ -|		// - num_filtered is supposed to the number of pieces                                                                                                                        |
│ │ │ │ │ -|		// we still want to download                                                                                                                                                 |
│ │ │ │ │ -|int m_num_filtered = 0;                                                                                                                                                        |
│ │ │ │ │ +|TORRENT_EXTRA_EXPORT void find_control_url(int type, string_view, parse_state& state);                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of pieces we have that also are filtered                                                                                                                       |
│ │ │ │ │ -|		int m_num_have_filtered = 0;                                                                                                                                                 |
│ │ │ │ │ +|TORRENT_EXTRA_EXPORT void find_error_code(int type, string_view string                                                                                                         |
│ │ │ │ │ +|	, error_code_parse_state& state);                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// we have all pieces in the range [0, m_cursor)                                                                                                                             |
│ │ │ │ │ -|		// m_cursor is the first piece we don't have                                                                                                                                 |
│ │ │ │ │ -|		piece_index_t m_cursor{0};                                                                                                                                                   |
│ │ │ │ │ +|TORRENT_EXTRA_EXPORT void find_ip_address(int type, string_view string                                                                                                         |
│ │ │ │ │ +|	, ip_address_parse_state& state);                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// we have all pieces in the range [m_reverse_cursor, end)                                                                                                                   |
│ │ │ │ │ -|		// m_reverse_cursor is the first piece where we also have                                                                                                                    |
│ │ │ │ │ -|		// all the subsequent pieces                                                                                                                                                 |
│ │ │ │ │ -|		piece_index_t m_reverse_cursor{0};                                                                                                                                           |
│ │ │ │ │ +|struct TORRENT_EXTRA_EXPORT upnp final                                                                                                                                         |
│ │ │ │ │ +|: std::enable_shared_from_this<upnp>                                                                                                                                           |
│ │ │ │ │ +|	, single_threaded                                                                                                                                                             |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	upnp(io_context& ios                                                                                                                                                          |
│ │ │ │ │ +|		, aux::session_settings const& settings                                                                                                                                      |
│ │ │ │ │ +|		, aux::portmap_callback& cb                                                                                                                                                  |
│ │ │ │ │ +|		, address_v4 listen_address                                                                                                                                                  |
│ │ │ │ │ +|		, address_v4 netmask                                                                                                                                                         |
│ │ │ │ │ +|		, std::string listen_device                                                                                                                                                  |
│ │ │ │ │ +|		, aux::listen_socket_handle ls);                                                                                                                                             |
│ │ │ │ │ +|	~upnp();                                                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of pieces we have (i.e. passed hash check).                                                                                                                    |
│ │ │ │ │ -|		// This includes pieces that we have filtered but still have                                                                                                                 |
│ │ │ │ │ -|		int m_num_have = 0;                                                                                                                                                          |
│ │ │ │ │ +|	void start();                                                                                                                                                                 |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		// if this is set to true, it means update_pieces()                                                                                                                          |
│ │ │ │ │ -|		// has to be called before accessing m_pieces.                                                                                                                               |
│ │ │ │ │ -|		mutable bool m_dirty = false;                                                                                                                                                |
│ │ │ │ │ -|	public:                                                                                                                                                                       |
│ │ │ │ │ +|	// Attempts to add a port mapping for the specified protocol. Valid protocols are                                                                                             |
│ │ │ │ │ +|	// ``upnp::tcp`` and ``upnp::udp`` for the UPnP class and ``natpmp::tcp`` and                                                                                                 |
│ │ │ │ │ +|	// ``natpmp::udp`` for the NAT-PMP class.                                                                                                                                     |
│ │ │ │ │ +|	//                                                                                                                                                                            |
│ │ │ │ │ +|	// ``external_port`` is the port on the external address that will be mapped. This                                                                                            |
│ │ │ │ │ +|	// is a hint, you are not guaranteed that this port will be available, and it may                                                                                             |
│ │ │ │ │ +|	// end up being something else. In the portmap_alert_ notification, the actual                                                                                                |
│ │ │ │ │ +|	// external port is reported.                                                                                                                                                 |
│ │ │ │ │ +|	//                                                                                                                                                                            |
│ │ │ │ │ +|	// ``local_port`` is the port in the local machine that the mapping should forward                                                                                            |
│ │ │ │ │ +|	// to.                                                                                                                                                                        |
│ │ │ │ │ +|	//                                                                                                                                                                            |
│ │ │ │ │ +|	// The return value is an index that identifies this port mapping. This is used                                                                                               |
│ │ │ │ │ +|	// to refer to mappings that fails or succeeds in the portmap_error_alert_ and                                                                                                |
│ │ │ │ │ +|	// portmap_alert_ respectively. If The mapping fails immediately, the return value                                                                                            |
│ │ │ │ │ +|_	_/_/_ _i_s_ _-_1_,_ _w_h_i_c_h_ _m_e_a_n_s_ _f_a_i_l_u_r_e_._ _T_h_e_r_e_ _w_i_l_l_ _n_o_t_ _b_e_ _a_n_y_ _e_r_r_o_r_ _a_l_e_r_t_ _n_o_t_i_f_i_c_a_t_i_o_n_ _f_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |move to aux                                                                                                                         |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_s_o_c_k_e_t___t_y_p_e_._h_p_p_:_6_0_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmoovvee ttoo aauuxx **********                                                                                                                                                        |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ssoocckkeett__ttyyppee..hhpppp::6600 ******                                                                                                                               |
│ │ │ │ │ +|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|		enum { max_pieces = (std::numeric_limits<int>::max)() - 1 };                                                                                                                 |
│ │ │ │ │ +|// A type describing kinds of sockets involved in various operations or events.                                                                                                |
│ │ │ │ │ +|enum class socket_type_t : std::uint8_t {                                                                                                                                      |
│ │ │ │ │ +|	tcp,                                                                                                                                                                          |
│ │ │ │ │ +|	socks5,                                                                                                                                                                       |
│ │ │ │ │ +|	http,                                                                                                                                                                         |
│ │ │ │ │ +|	utp,                                                                                                                                                                          |
│ │ │ │ │ +|	i2p,                                                                                                                                                                          |
│ │ │ │ │ +|	tcp_ssl,                                                                                                                                                                      |
│ │ │ │ │ +|	socks5_ssl,                                                                                                                                                                   |
│ │ │ │ │ +|	http_ssl,                                                                                                                                                                     |
│ │ │ │ │ +|	utp_ssl,                                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION <= 2                                                                                                                                                   |
│ │ │ │ │ +|	udp TORRENT_DEPRECATED_ENUM = utp,                                                                                                                                            |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|};                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|// return a short human readable name for types of socket                                                                                                                      |
│ │ │ │ │ +|char const* socket_type_name(socket_type_t);                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │  |}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|_#_e_n_d_i_f_ _/_/_ _T_O_R_R_E_N_T___P_I_E_C_E___P_I_C_K_E_R___H_P_P___I_N_C_L_U_D_E_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |make this a string_view                                                                                                             |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_i_2_p___s_t_r_e_a_m_._h_p_p_:_5_3_3_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** mmaakkee tthhiiss aa ssttrriinngg__vviieeww **********                                                                                                                                            |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//ii22pp__ssttrreeaamm..hhpppp::553333 ******                                                                                                                               |
│ │ │ │ │  |		char tmp[20];                                                                                                                                                                |
│ │ │ │ │  |		aux::random_bytes(tmp);                                                                                                                                                      |
│ │ │ │ │  |		m_session_id.resize(sizeof(tmp)*2);                                                                                                                                          |
│ │ │ │ │ @@ -11658,14 +11808,69 @@
│ │ │ │ │  |			return;                                                                                                                                                                     |
│ │ │ │ │  |		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		do_name_lookup("ME", wrap_allocator(                                                                                                                                         |
│ │ │ │ │  |			[this](error_code const& e, char const* dst, Handler hn) {                                                                                                                  |
│ │ │ │ │  |				set_local_endpoint(e, dst, std::move(hn));                                                                                                                                 |
│ │ │ │ │  |_	_	_	_}_,_ _s_t_d_:_:_m_o_v_e_(_h_)_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |it would be nice to remember the bind port and bind once we know where the proxy is m_sock.bind(endpoint, ec);                      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_p_r_o_x_y___b_a_s_e_._h_p_p_:_2_2_7_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd bbee nniiccee ttoo rreemmeemmbbeerr tthhee bbiinndd ppoorrtt aanndd bbiinndd oonnccee wwee kknnooww wwhheerree tthhee pprrooxxyy iiss mm__ssoocckk..bbiinndd((eennddppooiinntt,, eecc));; **********                                                     |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//pprrooxxyy__bbaassee..hhpppp::222277 ******                                                                                                                               |
│ │ │ │ │ +|TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                             |
│ │ │ │ │ +|		m_sock.cancel();                                                                                                                                                             |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void cancel(error_code& ec)                                                                                                                                                   |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ +|		m_sock.cancel(ec);                                                                                                                                                           |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void bind(endpoint_type const& /* endpoint */, error_code& /* ec */)                                                                                                          |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ +|		// the reason why we ignore binds here is because we don't                                                                                                                   |
│ │ │ │ │ +|		// (necessarily) yet know what address family the proxy                                                                                                                      |
│ │ │ │ │ +|		// will resolve to, and binding to the wrong one would                                                                                                                       |
│ │ │ │ │ +|		// break our connection attempt later. The caller here                                                                                                                       |
│ │ │ │ │ +|		// doesn't necessarily know that we're proxying, so this                                                                                                                     |
│ │ │ │ │ +|		// bind address is based on the final endpoint, not the                                                                                                                      |
│ │ │ │ │ +|		// proxy.                                                                                                                                                                    |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ +|	void open(protocol_type const&)                                                                                                                                               |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ +|//		m_sock.open(p);                                                                                                                                                            |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void open(protocol_type const&, error_code&)                                                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ +|		// we need to ignore this for the same reason as stated                                                                                                                      |
│ │ │ │ │ +|		// for ignoring bind()                                                                                                                                                       |
│ │ │ │ │ +|//		m_sock.open(p, ec);                                                                                                                                                        |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ +|	void close()                                                                                                                                                                  |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ +|		m_remote_endpoint = endpoint_type();                                                                                                                                         |
│ │ │ │ │ +|		m_sock.close();                                                                                                                                                              |
│ │ │ │ │ +|		m_resolver.cancel();                                                                                                                                                         |
│ │ │ │ │ +|	}                                                                                                                                                                             |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|	void close(error_code& ec)                                                                                                                                                    |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|_	_	_T_O_R_R_E_N_T___A_S_S_E_R_T_(_m___m_a_g_i_c_ _=_=_ _0_x_1_3_3_7_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |replace this by the standard string_view in C++17                                                                                   |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_s_t_r_i_n_g___v_i_e_w_._h_p_p_:_4_0_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** rreeppllaaccee tthhiiss bbyy tthhee ssttaannddaarrdd ssttrriinngg__vviieeww iinn CC++++1177 **********                                                                                                                  |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//ssttrriinngg__vviieeww..hhpppp::4400 ******                                                                                                                               |
│ │ │ │ │  |AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE                                                                                                      |
│ │ │ │ │  |IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE                                                                                                     |
│ │ │ │ │  |ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE                                                                                                       |
│ │ │ │ │ @@ -11713,124 +11918,69 @@
│ │ │ │ │  |{                                                                                                                                                                              |
│ │ │ │ │  |	while (pos < v.size())                                                                                                                                                        |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │  |		if (std::strchr(c, v[pos]) != nullptr) return pos;                                                                                                                           |
│ │ │ │ │  |		++pos;                                                                                                                                                                       |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |_	_r_e_t_u_r_n_ _s_t_r_i_n_g___v_i_e_w_:_:_n_p_o_s_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |support batched adding of block hashes for reduced overhead?                                                                        |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_h_a_s_h___p_i_c_k_e_r_._h_p_p_:_1_5_5_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ssuuppppoorrtt bbaattcchheedd aaddddiinngg ooff bblloocckk hhaasshheess ffoorr rreedduucceedd oovveerrhheeaadd?? **********                                                                                                       |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//hhaasshh__ppiicckkeerr..hhpppp::115555 ******                                                                                                                              |
│ │ │ │ │ -|// the number of hashes in the range                                                                                                                                           |
│ │ │ │ │ -|		int count = 0;                                                                                                                                                               |
│ │ │ │ │ -|		int proof_layers = 0;                                                                                                                                                        |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// validates the hash_request, to ensure its invariant as well as matching                                                                                                    |
│ │ │ │ │ -|	// the torrent's file_storage and the number of hashes accompanying the                                                                                                       |
│ │ │ │ │ -|	// request                                                                                                                                                                    |
│ │ │ │ │ -|	TORRENT_EXTRA_EXPORT                                                                                                                                                          |
│ │ │ │ │ -|	bool validate_hash_request(hash_request const& hr, file_storage const& fs);                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	class TORRENT_EXTRA_EXPORT hash_picker                                                                                                                                        |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|	public:                                                                                                                                                                       |
│ │ │ │ │ -|		hash_picker(file_storage const& files                                                                                                                                        |
│ │ │ │ │ -|			, aux::vector<aux::merkle_tree, file_index_t>& trees);                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		hash_request pick_hashes(typed_bitfield<piece_index_t> const& pieces);                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		add_hashes_result add_hashes(hash_request const& req, span<sha256_hash const> hashes);                                                                                       |
│ │ │ │ │ -|set_block_hash_result set_block_hash(piece_index_t piece, int offset, sha256_hash const& h);                                                                                   |
│ │ │ │ │ -|void hashes_rejected(hash_request const& req);                                                                                                                                 |
│ │ │ │ │ -|		void verify_block_hashes(piece_index_t index);                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// do we know the piece layer hash for a piece                                                                                                                               |
│ │ │ │ │ -|		bool have_hash(piece_index_t index) const;                                                                                                                                   |
│ │ │ │ │ -|		// do we know all the block hashes for a file?                                                                                                                               |
│ │ │ │ │ -|		bool have_all(file_index_t file) const;                                                                                                                                      |
│ │ │ │ │ -|		bool have_all() const;                                                                                                                                                       |
│ │ │ │ │ -|		bool piece_verified(piece_index_t piece) const;                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		int piece_layer() const { return m_piece_layer; }                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	private:                                                                                                                                                                      |
│ │ │ │ │ -|		// returns the number of proof layers needed to verify the node's hash                                                                                                       |
│ │ │ │ │ -|		int layers_to_verify(node_index idx) const;                                                                                                                                  |
│ │ │ │ │ -|		int file_num_layers(file_index_t idx) const;                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		struct piece_hash_request                                                                                                                                                    |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			time_point last_request = min_time();                                                                                                                                       |
│ │ │ │ │ -|			int num_requests = 0;                                                                                                                                                       |
│ │ │ │ │ -|			bool have = false;                                                                                                                                                          |
│ │ │ │ │ -|		};                                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		struct priority_block_request                                                                                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			priority_block_request(file_index_t const f, int const b)                                                                                                                   |
│ │ │ │ │ -|				: file(f), block(b) {}                                                                                                                                                     |
│ │ │ │ │ -|			file_index_t file;                                                                                                                                                          |
│ │ │ │ │ -|_	_	_	_i_n_t_ _b_l_o_c_k_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |it would be nice to remember the bind port and bind once we know where the proxy is m_sock.bind(endpoint, ec);                      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_p_r_o_x_y___b_a_s_e_._h_p_p_:_2_2_7_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd bbee nniiccee ttoo rreemmeemmbbeerr tthhee bbiinndd ppoorrtt aanndd bbiinndd oonnccee wwee kknnooww wwhheerree tthhee pprrooxxyy iiss mm__ssoocckk..bbiinndd((eennddppooiinntt,, eecc));; **********                                                     |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//pprrooxxyy__bbaassee..hhpppp::222277 ******                                                                                                                               |
│ │ │ │ │ -|TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                             |
│ │ │ │ │ -|		m_sock.cancel();                                                                                                                                                             |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |we could bind the socket here, since we know what the target endpoint is of the proxy                                               |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_s_o_c_k_s_5___s_t_r_e_a_m_._h_p_p_:_1_9_7_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** wwee ccoouulldd bbiinndd tthhee ssoocckkeett hheerree,, ssiinnccee wwee kknnooww wwhhaatt tthhee ttaarrggeett eennddppooiinntt iiss ooff tthhee pprrooxxyy **********                                                                              |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ssoocckkss55__ssttrreeaamm..hhpppp::119977 ******                                                                                                                            |
│ │ │ │ │ +|}, std::move(handler)));                                                                                                                                                       |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void cancel(error_code& ec)                                                                                                                                                   |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ -|		m_sock.cancel(ec);                                                                                                                                                           |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ +|private:                                                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void bind(endpoint_type const& /* endpoint */, error_code& /* ec */)                                                                                                          |
│ │ │ │ │ +|	template <typename Handler>                                                                                                                                                   |
│ │ │ │ │ +|	void name_lookup(error_code const& e, tcp::resolver::results_type ips                                                                                                         |
│ │ │ │ │ +|		, Handler h)                                                                                                                                                                 |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ -|		// the reason why we ignore binds here is because we don't                                                                                                                   |
│ │ │ │ │ -|		// (necessarily) yet know what address family the proxy                                                                                                                      |
│ │ │ │ │ -|		// will resolve to, and binding to the wrong one would                                                                                                                       |
│ │ │ │ │ -|		// break our connection attempt later. The caller here                                                                                                                       |
│ │ │ │ │ -|		// doesn't necessarily know that we're proxying, so this                                                                                                                     |
│ │ │ │ │ -|		// bind address is based on the final endpoint, not the                                                                                                                      |
│ │ │ │ │ -|		// proxy.                                                                                                                                                                    |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ +|		COMPLETE_ASYNC("socks5_stream::name_lookup");                                                                                                                                |
│ │ │ │ │ +|		if (handle_error(e, std::move(h))) return;                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ -|	void open(protocol_type const&)                                                                                                                                               |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ -|//		m_sock.open(p);                                                                                                                                                            |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		auto i = ips.begin();                                                                                                                                                        |
│ │ │ │ │ +|		if (!m_sock.is_open())                                                                                                                                                       |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			error_code ec;                                                                                                                                                              |
│ │ │ │ │ +|			m_sock.open(i->endpoint().protocol(), ec);                                                                                                                                  |
│ │ │ │ │ +|			if (handle_error(ec, std::move(h))) return;                                                                                                                                 |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void open(protocol_type const&, error_code&)                                                                                                                                  |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ -|		// we need to ignore this for the same reason as stated                                                                                                                      |
│ │ │ │ │ -|		// for ignoring bind()                                                                                                                                                       |
│ │ │ │ │ -|//		m_sock.open(p, ec);                                                                                                                                                        |
│ │ │ │ │ +|ADD_OUTSTANDING_ASYNC("socks5_stream::connected");                                                                                                                             |
│ │ │ │ │ +|m_sock.async_connect(i->endpoint(), wrap_allocator(                                                                                                                            |
│ │ │ │ │ +|			[this](error_code const& ec, Handler hn)                                                                                                                                    |
│ │ │ │ │ +|			{ connected(ec, std::move(hn)); }, std::move(h)));                                                                                                                          |
│ │ │ │ │  |	}                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef BOOST_NO_EXCEPTIONS                                                                                                                                                    |
│ │ │ │ │ -|	void close()                                                                                                                                                                  |
│ │ │ │ │ +|	template <typename Handler>                                                                                                                                                   |
│ │ │ │ │ +|	void connected(error_code const& e, Handler h)                                                                                                                                |
│ │ │ │ │  |	{                                                                                                                                                                             |
│ │ │ │ │ -|		TORRENT_ASSERT(m_magic == 0x1337);                                                                                                                                           |
│ │ │ │ │ -|		m_remote_endpoint = endpoint_type();                                                                                                                                         |
│ │ │ │ │ -|		m_sock.close();                                                                                                                                                              |
│ │ │ │ │ -|		m_resolver.cancel();                                                                                                                                                         |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		COMPLETE_ASYNC("socks5_stream::connected");                                                                                                                                  |
│ │ │ │ │ +|		if (handle_error(e, std::move(h))) return;                                                                                                                                   |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|	void close(error_code& ec)                                                                                                                                                    |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|_	_	_T_O_R_R_E_N_T___A_S_S_E_R_T_(_m___m_a_g_i_c_ _=_=_ _0_x_1_3_3_7_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|		using namespace libtorrent::aux;                                                                                                                                             |
│ │ │ │ │ +|		if (m_version == 5)                                                                                                                                                          |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			// send SOCKS5 authentication methods                                                                                                                                       |
│ │ │ │ │ +|			m_buffer.resize(m_user.empty()?3:4);                                                                                                                                        |
│ │ │ │ │ +|			char* p = &m_buffer[0];                                                                                                                                                     |
│ │ │ │ │ +|			write_uint8(5, p); // SOCKS VERSION 5                                                                                                                                       |
│ │ │ │ │ +|			if (m_user.empty())                                                                                                                                                         |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				write_uint8(1, p); // 1 authentication method (no auth)                                                                                                                    |
│ │ │ │ │ +|				write_uint8(0, p); // no authentication                                                                                                                                    |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|			else                                                                                                                                                                        |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				write_uint8(2, p); // 2 authentication methods                                                                                                                             |
│ │ │ │ │ +|				write_uint8(0, p); // no authentication                                                                                                                                    |
│ │ │ │ │ +|				write_uint8(2, p); // username/password                                                                                                                                    |
│ │ │ │ │ +|			}                                                                                                                                                                           |
│ │ │ │ │ +|_	_	_	_A_D_D___O_U_T_S_T_A_N_D_I_N_G___A_S_Y_N_C_(_"_s_o_c_k_s_5___s_t_r_e_a_m_:_:_h_a_n_d_s_h_a_k_e_1_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |make this a raw pointer (to save size in the first cache line) and make the constructor take a raw pointer. torrent objects should  |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._h_p_p_:_2_1_8_ _ _ _ _ _ _ _|_a_l_w_a_y_s_ _o_u_t_l_i_v_e_ _t_h_e_i_r_ _p_e_e_r_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** mmaakkee tthhiiss aa rraaww ppooiinntteerr ((ttoo ssaavvee ssiizzee iinn tthhee ffiirrsstt ccaacchhee lliinnee)) aanndd mmaakkee tthhee ccoonnssttrruuccttoorr ttaakkee aa rraaww ppooiinntteerr.. ttoorrrreenntt oobbjjeeccttss sshhoouulldd aallwwaayyss oouuttlliivvee tthheeiirr ppeeeerrss **********      |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppeeeerr__ccoonnnneeccttiioonn..hhpppp::221188 ******                                                                                                                          |
│ │ │ │ │  |, m_snubbed(false)                                                                                                                                                             |
│ │ │ │ │  |			, m_interesting(false)                                                                                                                                                      |
│ │ │ │ │  |			, m_choked(true)                                                                                                                                                            |
│ │ │ │ │ @@ -11932,164 +12082,14 @@
│ │ │ │ │  |		// let plugins control flags that should always be set                                                                                                                       |
│ │ │ │ │  |		picker_options_t m_picker_options{};                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// the number of invalid piece-requests                                                                                                                                      |
│ │ │ │ │  |		// we have got from this peer. If the request                                                                                                                                |
│ │ │ │ │  |		// queue gets empty, and there have been                                                                                                                                     |
│ │ │ │ │  |_	_	_/_/_ _i_n_v_a_l_i_d_ _r_e_q_u_e_s_t_s_,_ _w_e_ _c_a_n_ _a_s_s_u_m_e_ _t_h_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |we could bind the socket here, since we know what the target endpoint is of the proxy                                               |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_s_o_c_k_s_5___s_t_r_e_a_m_._h_p_p_:_1_9_7_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** wwee ccoouulldd bbiinndd tthhee ssoocckkeett hheerree,, ssiinnccee wwee kknnooww wwhhaatt tthhee ttaarrggeett eennddppooiinntt iiss ooff tthhee pprrooxxyy **********                                                                              |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ssoocckkss55__ssttrreeaamm..hhpppp::119977 ******                                                                                                                            |
│ │ │ │ │ -|}, std::move(handler)));                                                                                                                                                       |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|private:                                                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	template <typename Handler>                                                                                                                                                   |
│ │ │ │ │ -|	void name_lookup(error_code const& e, tcp::resolver::results_type ips                                                                                                         |
│ │ │ │ │ -|		, Handler h)                                                                                                                                                                 |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		COMPLETE_ASYNC("socks5_stream::name_lookup");                                                                                                                                |
│ │ │ │ │ -|		if (handle_error(e, std::move(h))) return;                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		auto i = ips.begin();                                                                                                                                                        |
│ │ │ │ │ -|		if (!m_sock.is_open())                                                                                                                                                       |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			error_code ec;                                                                                                                                                              |
│ │ │ │ │ -|			m_sock.open(i->endpoint().protocol(), ec);                                                                                                                                  |
│ │ │ │ │ -|			if (handle_error(ec, std::move(h))) return;                                                                                                                                 |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|ADD_OUTSTANDING_ASYNC("socks5_stream::connected");                                                                                                                             |
│ │ │ │ │ -|m_sock.async_connect(i->endpoint(), wrap_allocator(                                                                                                                            |
│ │ │ │ │ -|			[this](error_code const& ec, Handler hn)                                                                                                                                    |
│ │ │ │ │ -|			{ connected(ec, std::move(hn)); }, std::move(h)));                                                                                                                          |
│ │ │ │ │ -|	}                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	template <typename Handler>                                                                                                                                                   |
│ │ │ │ │ -|	void connected(error_code const& e, Handler h)                                                                                                                                |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		COMPLETE_ASYNC("socks5_stream::connected");                                                                                                                                  |
│ │ │ │ │ -|		if (handle_error(e, std::move(h))) return;                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		using namespace libtorrent::aux;                                                                                                                                             |
│ │ │ │ │ -|		if (m_version == 5)                                                                                                                                                          |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			// send SOCKS5 authentication methods                                                                                                                                       |
│ │ │ │ │ -|			m_buffer.resize(m_user.empty()?3:4);                                                                                                                                        |
│ │ │ │ │ -|			char* p = &m_buffer[0];                                                                                                                                                     |
│ │ │ │ │ -|			write_uint8(5, p); // SOCKS VERSION 5                                                                                                                                       |
│ │ │ │ │ -|			if (m_user.empty())                                                                                                                                                         |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				write_uint8(1, p); // 1 authentication method (no auth)                                                                                                                    |
│ │ │ │ │ -|				write_uint8(0, p); // no authentication                                                                                                                                    |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|			else                                                                                                                                                                        |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				write_uint8(2, p); // 2 authentication methods                                                                                                                             |
│ │ │ │ │ -|				write_uint8(0, p); // no authentication                                                                                                                                    |
│ │ │ │ │ -|				write_uint8(2, p); // username/password                                                                                                                                    |
│ │ │ │ │ -|			}                                                                                                                                                                           |
│ │ │ │ │ -|_	_	_	_A_D_D___O_U_T_S_T_A_N_D_I_N_G___A_S_Y_N_C_(_"_s_o_c_k_s_5___s_t_r_e_a_m_:_:_h_a_n_d_s_h_a_k_e_1_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |support using the windows API for UPnP operations as well                                                                           |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_u_p_n_p_._h_p_p_:_1_6_2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ssuuppppoorrtt uussiinngg tthhee wwiinnddoowwss AAPPII ffoorr UUPPnnPP ooppeerraattiioonnss aass wweellll **********                                                                                                          |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//uuppnnpp..hhpppp::116622 ******                                                                                                                                     |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	bool in_error_code = false;                                                                                                                                                   |
│ │ │ │ │ -|	bool exit = false;                                                                                                                                                            |
│ │ │ │ │ -|	int error_code = -1;                                                                                                                                                          |
│ │ │ │ │ -|};                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|struct ip_address_parse_state: error_code_parse_state                                                                                                                          |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	bool in_ip_address = false;                                                                                                                                                   |
│ │ │ │ │ -|	std::string ip_address;                                                                                                                                                       |
│ │ │ │ │ -|};                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_EXTRA_EXPORT void find_control_url(int type, string_view, parse_state& state);                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_EXTRA_EXPORT void find_error_code(int type, string_view string                                                                                                         |
│ │ │ │ │ -|	, error_code_parse_state& state);                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|TORRENT_EXTRA_EXPORT void find_ip_address(int type, string_view string                                                                                                         |
│ │ │ │ │ -|	, ip_address_parse_state& state);                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|struct TORRENT_EXTRA_EXPORT upnp final                                                                                                                                         |
│ │ │ │ │ -|: std::enable_shared_from_this<upnp>                                                                                                                                           |
│ │ │ │ │ -|	, single_threaded                                                                                                                                                             |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	upnp(io_context& ios                                                                                                                                                          |
│ │ │ │ │ -|		, aux::session_settings const& settings                                                                                                                                      |
│ │ │ │ │ -|		, aux::portmap_callback& cb                                                                                                                                                  |
│ │ │ │ │ -|		, address_v4 listen_address                                                                                                                                                  |
│ │ │ │ │ -|		, address_v4 netmask                                                                                                                                                         |
│ │ │ │ │ -|		, std::string listen_device                                                                                                                                                  |
│ │ │ │ │ -|		, aux::listen_socket_handle ls);                                                                                                                                             |
│ │ │ │ │ -|	~upnp();                                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	void start();                                                                                                                                                                 |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	// Attempts to add a port mapping for the specified protocol. Valid protocols are                                                                                             |
│ │ │ │ │ -|	// ``upnp::tcp`` and ``upnp::udp`` for the UPnP class and ``natpmp::tcp`` and                                                                                                 |
│ │ │ │ │ -|	// ``natpmp::udp`` for the NAT-PMP class.                                                                                                                                     |
│ │ │ │ │ -|	//                                                                                                                                                                            |
│ │ │ │ │ -|	// ``external_port`` is the port on the external address that will be mapped. This                                                                                            |
│ │ │ │ │ -|	// is a hint, you are not guaranteed that this port will be available, and it may                                                                                             |
│ │ │ │ │ -|	// end up being something else. In the portmap_alert_ notification, the actual                                                                                                |
│ │ │ │ │ -|	// external port is reported.                                                                                                                                                 |
│ │ │ │ │ -|	//                                                                                                                                                                            |
│ │ │ │ │ -|	// ``local_port`` is the port in the local machine that the mapping should forward                                                                                            |
│ │ │ │ │ -|	// to.                                                                                                                                                                        |
│ │ │ │ │ -|	//                                                                                                                                                                            |
│ │ │ │ │ -|	// The return value is an index that identifies this port mapping. This is used                                                                                               |
│ │ │ │ │ -|	// to refer to mappings that fails or succeeds in the portmap_error_alert_ and                                                                                                |
│ │ │ │ │ -|	// portmap_alert_ respectively. If The mapping fails immediately, the return value                                                                                            |
│ │ │ │ │ -|_	_/_/_ _i_s_ _-_1_,_ _w_h_i_c_h_ _m_e_a_n_s_ _f_a_i_l_u_r_e_._ _T_h_e_r_e_ _w_i_l_l_ _n_o_t_ _b_e_ _a_n_y_ _e_r_r_o_r_ _a_l_e_r_t_ _n_o_t_i_f_i_c_a_t_i_o_n_ _f_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |some space could be saved here by making gauges 32 bits                                                                             |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._h_p_p_:_4_8_5_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ssoommee ssppaaccee ccoouulldd bbee ssaavveedd hheerree bbyy mmaakkiinngg ggaauuggeess 3322 bbiittss **********                                                                                                            |
│ │ │ │ │ -|_**_**_**_ _.._.._//_ii_nn_cc_ll_uu_dd_ee_//_ll_ii_bb_tt_oo_rr_rr_ee_nn_tt_//_pp_ee_rr_ff_oo_rr_mm_aa_nn_cc_ee____cc_oo_uu_nn_tt_ee_rr_ss_.._hh_pp_pp_::_44_88_55_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |restore these to regular integers. Instead have one copy of the counters per thread and collect them at convenient synchronization  |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e___c_o_u_n_t_e_r_s_._h_p_p_:_4_8_6_ _ _|_p_o_i_n_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** rreessttoorree tthheessee ttoo rreegguullaarr iinntteeggeerrss.. IInnsstteeaadd hhaavvee oonnee ccooppyy ooff tthhee ccoouunntteerrss ppeerr tthhrreeaadd aanndd ccoolllleecctt tthheemm aatt ccoonnvveenniieenntt ssyynncchhrroonniizzaattiioonn ppooiinnttss **********                          |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//ppeerrffoorrmmaannccee__ccoouunntteerrss..hhpppp::448866 ******                                                                                                                     |
│ │ │ │ │ -|#ifdef ATOMIC_LLONG_LOCK_FREE                                                                                                                                                  |
│ │ │ │ │ -|#define TORRENT_COUNTER_NOEXCEPT noexcept                                                                                                                                      |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|#define TORRENT_COUNTER_NOEXCEPT                                                                                                                                               |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		counters() TORRENT_COUNTER_NOEXCEPT;                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		counters(counters const&) TORRENT_COUNTER_NOEXCEPT;                                                                                                                          |
│ │ │ │ │ -|		counters& operator=(counters const&) & TORRENT_COUNTER_NOEXCEPT;                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// returns the new value                                                                                                                                                     |
│ │ │ │ │ -|		std::int64_t inc_stats_counter(int c, std::int64_t value = 1) TORRENT_COUNTER_NOEXCEPT;                                                                                      |
│ │ │ │ │ -|		std::int64_t operator[](int i) const TORRENT_COUNTER_NOEXCEPT;                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		void set_value(int c, std::int64_t value) TORRENT_COUNTER_NOEXCEPT;                                                                                                          |
│ │ │ │ │ -|		void blend_stats_counter(int c, std::int64_t value, int ratio) TORRENT_COUNTER_NOEXCEPT;                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	private:                                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifdef ATOMIC_LLONG_LOCK_FREE                                                                                                                                                  |
│ │ │ │ │ -|aux::array<std::atomic<std::int64_t>, num_counters> m_stats_counter;                                                                                                           |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|		// if the atomic type isn't lock-free, use a single lock instead, for                                                                                                        |
│ │ │ │ │ -|		// the whole array                                                                                                                                                           |
│ │ │ │ │ -|		mutable std::mutex m_mutex;                                                                                                                                                  |
│ │ │ │ │ -|		aux::array<std::int64_t, num_counters> m_stats_counter;                                                                                                                      |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/        |move this to its own .hpp/.cpp pair?                                                                                                |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_k_a_d_e_m_l_i_a_/_m_s_g_._h_p_p_:_8_7_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** mmoovvee tthhiiss ttoo iittss oowwnn ..hhpppp//..ccpppp ppaaiirr?? **********                                                                                                                               |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//kkaaddeemmlliiaa//mmssgg..hhpppp::8877 ******                                                                                                                              |
│ │ │ │ │  |int flags;                                                                                                                                                                     |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |	enum {                                                                                                                                                                        |
│ │ │ │ │ @@ -12177,328 +12177,58 @@
│ │ │ │ │  |		, secret_key const& sk);                                                                                                                                                     |
│ │ │ │ │  |	explicit item(bdecode_node const& v);                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |	void assign(entry v);                                                                                                                                                         |
│ │ │ │ │  |	void assign(entry v, span<char const> salt                                                                                                                                    |
│ │ │ │ │  |		, sequence_number seq                                                                                                                                                        |
│ │ │ │ │  |_	_	_,_ _p_u_b_l_i_c___k_e_y_ _c_o_n_s_t_&_ _p_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |it would be nice to not have this be part of session_interface                                                                      |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_n_t_e_r_f_a_c_e_._h_p_p_:_2_1_2_ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iitt wwoouulldd bbee nniiccee ttoo nnoott hhaavvee tthhiiss bbee ppaarrtt ooff sseessssiioonn__iinntteerrffaaccee **********                                                                                                     |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iinntteerrffaaccee..hhpppp::221122 ******                                                                                                                   |
│ │ │ │ │ -|virtual void deferred_submit_jobs() = 0;                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		virtual std::uint16_t listen_port() const = 0;                                                                                                                               |
│ │ │ │ │ -|		virtual std::uint16_t ssl_listen_port() const = 0;                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		virtual int listen_port(aux::transport ssl, address const& local_addr) = 0;                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		virtual void for_each_listen_socket(std::function<void(aux::listen_socket_handle const&)> f) = 0;                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// ask for which interface and port to bind outgoing peer connections on                                                                                                     |
│ │ │ │ │ -|		virtual tcp::endpoint bind_outgoing_socket(socket_type& s, address const&                                                                                                    |
│ │ │ │ │ -|			remote_address, error_code& ec) const = 0;                                                                                                                                  |
│ │ │ │ │ -|		virtual bool verify_bound_address(address const& addr, bool utp                                                                                                              |
│ │ │ │ │ -|			, error_code& ec) = 0;                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS                                                                                                                                       |
│ │ │ │ │ -|		virtual std::vector<std::shared_ptr<torrent>> find_collection(                                                                                                               |
│ │ │ │ │ -|			std::string const& collection) const = 0;                                                                                                                                   |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|virtual proxy_settings proxy() const = 0;                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ -|		virtual char const* i2p_session() const = 0;                                                                                                                                 |
│ │ │ │ │ -|		virtual std::string const& local_i2p_endpoint() const = 0;                                                                                                                   |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		virtual void prioritize_connections(std::weak_ptr<torrent> t) = 0;                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		virtual void trigger_auto_manage() = 0;                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		virtual void apply_settings_pack(std::shared_ptr<settings_pack> pack) = 0;                                                                                                   |
│ │ │ │ │ -|		virtual session_settings const& settings() const = 0;                                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		virtual void queue_tracker_request(tracker_request req                                                                                                                       |
│ │ │ │ │ -|			, std::weak_ptr<request_callback> c) = 0;                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// peer-classes                                                                                                                                                              |
│ │ │ │ │ -|		virtual void set_peer_classes(peer_class_set* s, address const& a, socket_type_t st) = 0;                                                                                    |
│ │ │ │ │ -|		virtual peer_class_pool const& peer_classes() const = 0;                                                                                                                     |
│ │ │ │ │ -|		virtual peer_class_pool& peer_classes() = 0;                                                                                                                                 |
│ │ │ │ │ -|		virtual bool ignore_unchoke_slots_set(peer_class_set const& set) const = 0;                                                                                                  |
│ │ │ │ │ -|		virtual int copy_pertinent_channels(peer_class_set const& set                                                                                                                |
│ │ │ │ │ -|			, int channel, bandwidth_channel** dst, int m) = 0;                                                                                                                         |
│ │ │ │ │ -|		virtual int use_quota_overhead(peer_class_set& set, int amount_down, int amount_up) = 0;                                                                                     |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		virtual bandwidth_manager* get_bandwidth_manager(int channel) = 0;                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		virtual void sent_bytes(int bytes_payload, int bytes_protocol) = 0;                                                                                                          |
│ │ │ │ │ -|		virtual void received_bytes(int bytes_payload, int bytes_protocol) = 0;                                                                                                      |
│ │ │ │ │ -|_	_	_v_i_r_t_u_a_l_ _v_o_i_d_ _t_r_a_n_c_i_e_v_e___i_p___p_a_c_k_e_t_(_i_n_t_ _b_y_t_e_s_,_ _b_o_o_l_ _i_p_v_6_)_ _=_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |make these direct members and generate shared_ptrs to them which alias the listen_socket_t shared_ptr                               |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_m_p_l_._h_p_p_:_2_6_5_ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** mmaakkee tthheessee ddiirreecctt mmeemmbbeerrss aanndd ggeenneerraattee sshhaarreedd__ppttrrss ttoo tthheemm wwhhiicchh aalliiaass tthhee lliisstteenn__ssoocckkeett__tt sshhaarreedd__ppttrr **********                                                              |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iimmppll..hhpppp::226655 ******                                                                                                                        |
│ │ │ │ │ -|if (udp_sock) return udp_sock->sock.local_port();                                                                                                                              |
│ │ │ │ │ -|			return 0;                                                                                                                                                                   |
│ │ │ │ │ -|		}                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// 0 is natpmp 1 is upnp                                                                                                                                                     |
│ │ │ │ │ -|		// the order of these arrays determines the priority in                                                                                                                      |
│ │ │ │ │ -|		// which their ports will be announced to peers                                                                                                                              |
│ │ │ │ │ -|		aux::array<listen_port_mapping, 2, portmap_transport> tcp_port_mapping;                                                                                                      |
│ │ │ │ │ -|		aux::array<listen_port_mapping, 2, portmap_transport> udp_port_mapping;                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// indicates whether this is an SSL listen socket or not                                                                                                                     |
│ │ │ │ │ -|		transport ssl = transport::plaintext;                                                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		listen_socket_flags_t flags = accept_incoming;                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// the actual sockets (TCP listen socket and UDP socket)                                                                                                                     |
│ │ │ │ │ -|		// An entry does not necessarily have a UDP or TCP socket. One of these                                                                                                      |
│ │ │ │ │ -|		// pointers may be nullptr!                                                                                                                                                  |
│ │ │ │ │ -|		// These must be shared_ptr to avoid a dangling reference if an                                                                                                              |
│ │ │ │ │ -|		// incoming packet is in the event queue when the socket is erased                                                                                                           |
│ │ │ │ │ -|std::shared_ptr<tcp::acceptor> sock;                                                                                                                                           |
│ │ │ │ │ -|std::shared_ptr<aux::session_udp_socket> udp_sock;                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// since udp packets are expected to be dispatched frequently, this saves                                                                                                    |
│ │ │ │ │ -|		// time on handler allocation every time we read again.                                                                                                                      |
│ │ │ │ │ -|		aux::handler_storage<aux::udp_handler_max_size, aux::udp_handler> udp_handler_storage;                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		std::shared_ptr<natpmp> natpmp_mapper;                                                                                                                                       |
│ │ │ │ │ -|		std::shared_ptr<upnp> upnp_mapper;                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		std::shared_ptr<struct lsd> lsd;                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// set to true when we receive an incoming connection from this listen                                                                                                       |
│ │ │ │ │ -|		// socket                                                                                                                                                                    |
│ │ │ │ │ -|		bool incoming_connection = false;                                                                                                                                            |
│ │ │ │ │ -|	};                                                                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		struct TORRENT_EXTRA_EXPORT listen_endpoint_t                                                                                                                                |
│ │ │ │ │ -|		{                                                                                                                                                                            |
│ │ │ │ │ -|			listen_endpoint_t(address const& adr, int p, std::string dev, transport s                                                                                                   |
│ │ │ │ │ -|				, listen_socket_flags_t f, address const& nmask = address{})                                                                                                               |
│ │ │ │ │ -|				: addr(adr), netmask(nmask), port(p), device(std::move(dev)), ssl(s), flags(f) {}                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			bool operator==(listen_endpoint_t const& o) const                                                                                                                           |
│ │ │ │ │ -|			{                                                                                                                                                                           |
│ │ │ │ │ -|				return addr == o.addr                                                                                                                                                      |
│ │ │ │ │ -|					&& port == o.port                                                                                                                                                         |
│ │ │ │ │ -|					&& device == o.device                                                                                                                                                     |
│ │ │ │ │ -|					&& ssl == o.ssl                                                                                                                                                           |
│ │ │ │ │ -|					&& flags == o.flags;                                                                                                                                                      |
│ │ │ │ │ -|_	_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |replace this by a proper asio timer                                                                                                 |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_m_p_l_._h_p_p_:_1_0_6_8_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** rreeppllaaccee tthhiiss bbyy aa pprrooppeerr aassiioo ttiimmeerr **********                                                                                                                                |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iimmppll..hhpppp::11006688 ******                                                                                                                       |
│ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ -|			void on_incoming_utp_ssl(socket_type s);                                                                                                                                    |
│ │ │ │ │ -|			void ssl_handshake(error_code const& ec, socket_type* s);                                                                                                                   |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |figure out which version of clang this is supported in                                                                              |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_d_e_p_r_e_c_a_t_e_d_._h_p_p_:_4_7_ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** ffiigguurree oouutt wwhhiicchh vveerrssiioonn ooff ccllaanngg tthhiiss iiss ssuuppppoorrtteedd iinn **********                                                                                                             |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//ddeepprreeccaatteedd..hhpppp::4477 ******                                                                                                                           |
│ │ │ │ │ +|CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)                                                                                                        |
│ │ │ │ │ +|ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE                                                                                                     |
│ │ │ │ │ +|POSSIBILITY OF SUCH DAMAGE.                                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// round-robin index into m_outgoing_interfaces                                                                                                                             |
│ │ │ │ │ -|			mutable std::uint8_t m_interface_index = 0;                                                                                                                                 |
│ │ │ │ │ +|*/                                                                                                                                                                             |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			std::shared_ptr<listen_socket_t> setup_listener(                                                                                                                            |
│ │ │ │ │ -|				listen_endpoint_t const& lep, error_code& ec);                                                                                                                             |
│ │ │ │ │ +|#ifndef TORRENT_DEPRECATED_HPP_INCLUDED                                                                                                                                        |
│ │ │ │ │ +|#define TORRENT_DEPRECATED_HPP_INCLUDED                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|			dht::dht_state m_dht_state;                                                                                                                                                 |
│ │ │ │ │ +|#if !defined TORRENT_BUILDING_LIBRARY                                                                                                                                          |
│ │ │ │ │ +|# define TORRENT_DEPRECATED [[deprecated]]                                                                                                                                     |
│ │ │ │ │ +|#else                                                                                                                                                                          |
│ │ │ │ │ +|# define TORRENT_DEPRECATED                                                                                                                                                    |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// this is initialized to the unchoke_interval                                                                                                                              |
│ │ │ │ │ -|			// session_setting and decreased every second.                                                                                                                              |
│ │ │ │ │ -|			// when it reaches zero, it is reset to the                                                                                                                                 |
│ │ │ │ │ -|			// unchoke_interval and the unchoke set is                                                                                                                                  |
│ │ │ │ │ -|			// recomputed.                                                                                                                                                              |
│ │ │ │ │ -|int m_unchoke_time_scaler = 0;                                                                                                                                                 |
│ │ │ │ │ +|#if defined __clang__                                                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// this is used to decide when to recalculate which                                                                                                                         |
│ │ │ │ │ -|_	_	_	_/_/_ _t_o_r_r_e_n_t_s_ _t_o_ _k_e_e_p_ _q_u_e_u_e_d_ _a_n_d_ _w_h_i_c_h_ _t_o_ _a_c_t_i_v_a_t_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |replace this by a proper asio timer                                                                                                 |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_m_p_l_._h_p_p_:_1_0_7_3_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** rreeppllaaccee tthhiiss bbyy aa pprrooppeerr aassiioo ttiimmeerr **********                                                                                                                                |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iimmppll..hhpppp::11007733 ******                                                                                                                       |
│ │ │ │ │ -|			// round-robin index into m_outgoing_interfaces                                                                                                                             |
│ │ │ │ │ -|			mutable std::uint8_t m_interface_index = 0;                                                                                                                                 |
│ │ │ │ │ +|// ====== CLANG ========                                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			std::shared_ptr<listen_socket_t> setup_listener(                                                                                                                            |
│ │ │ │ │ -|				listen_endpoint_t const& lep, error_code& ec);                                                                                                                             |
│ │ │ │ │ +|# if !defined TORRENT_BUILDING_LIBRARY                                                                                                                                         |
│ │ │ │ │ +|#  define TORRENT_DEPRECATED_ENUM __attribute__ ((deprecated))                                                                                                                 |
│ │ │ │ │ +|# endif                                                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|			dht::dht_state m_dht_state;                                                                                                                                                 |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|#elif defined __GNUC__                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// this is initialized to the unchoke_interval                                                                                                                              |
│ │ │ │ │ -|			// session_setting and decreased every second.                                                                                                                              |
│ │ │ │ │ -|			// when it reaches zero, it is reset to the                                                                                                                                 |
│ │ │ │ │ -|			// unchoke_interval and the unchoke set is                                                                                                                                  |
│ │ │ │ │ -|			// recomputed.                                                                                                                                                              |
│ │ │ │ │ -|			int m_unchoke_time_scaler = 0;                                                                                                                                              |
│ │ │ │ │ +|// ======== GCC ========                                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// this is used to decide when to recalculate which                                                                                                                         |
│ │ │ │ │ -|			// torrents to keep queued and which to activate                                                                                                                            |
│ │ │ │ │ -|int m_auto_manage_time_scaler = 0;                                                                                                                                             |
│ │ │ │ │ +|// deprecation markup is only enabled when libtorrent                                                                                                                          |
│ │ │ │ │ +|// headers are included by clients, not while building                                                                                                                         |
│ │ │ │ │ +|// libtorrent itself                                                                                                                                                           |
│ │ │ │ │ +|# if __GNUC__ >= 6 && !defined TORRENT_BUILDING_LIBRARY                                                                                                                        |
│ │ │ │ │ +|#  define TORRENT_DEPRECATED_ENUM __attribute__ ((deprecated))                                                                                                                 |
│ │ │ │ │ +|# endif                                                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// works like unchoke_time_scaler but it                                                                                                                                    |
│ │ │ │ │ -|			// is only decreased when the unchoke set                                                                                                                                   |
│ │ │ │ │ -|			// is recomputed, and when it reaches zero,                                                                                                                                 |
│ │ │ │ │ -|_	_	_	_/_/_ _t_h_e_ _o_p_t_i_m_i_s_t_i_c_ _u_n_c_h_o_k_e_ _i_s_ _m_o_v_e_d_ _t_o_ _a_n_o_t_h_e_r_ _p_e_e_r_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |replace this by a proper asio timer                                                                                                 |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_m_p_l_._h_p_p_:_1_0_8_0_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** rreeppllaaccee tthhiiss bbyy aa pprrooppeerr aassiioo ttiimmeerr **********                                                                                                                                |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iimmppll..hhpppp::11008800 ******                                                                                                                       |
│ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ -|			dht::dht_state m_dht_state;                                                                                                                                                 |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			// this is initialized to the unchoke_interval                                                                                                                              |
│ │ │ │ │ -|			// session_setting and decreased every second.                                                                                                                              |
│ │ │ │ │ -|			// when it reaches zero, it is reset to the                                                                                                                                 |
│ │ │ │ │ -|			// unchoke_interval and the unchoke set is                                                                                                                                  |
│ │ │ │ │ -|			// recomputed.                                                                                                                                                              |
│ │ │ │ │ -|			int m_unchoke_time_scaler = 0;                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// this is used to decide when to recalculate which                                                                                                                         |
│ │ │ │ │ -|			// torrents to keep queued and which to activate                                                                                                                            |
│ │ │ │ │ -|			int m_auto_manage_time_scaler = 0;                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// works like unchoke_time_scaler but it                                                                                                                                    |
│ │ │ │ │ -|			// is only decreased when the unchoke set                                                                                                                                   |
│ │ │ │ │ -|			// is recomputed, and when it reaches zero,                                                                                                                                 |
│ │ │ │ │ -|			// the optimistic unchoke is moved to another peer.                                                                                                                         |
│ │ │ │ │ -|int m_optimistic_unchoke_time_scaler = 0;                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// works like unchoke_time_scaler. Each time                                                                                                                                |
│ │ │ │ │ -|			// it reaches 0, and all the connections are                                                                                                                                |
│ │ │ │ │ -|			// used, the worst connection will be disconnected                                                                                                                          |
│ │ │ │ │ -|			// from the torrent with the most peers                                                                                                                                     |
│ │ │ │ │ -|			int m_disconnect_time_scaler = 90;                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// when this scaler reaches zero, it will                                                                                                                                   |
│ │ │ │ │ -|			// scrape one of the auto managed, paused,                                                                                                                                  |
│ │ │ │ │ -|			// torrents.                                                                                                                                                                |
│ │ │ │ │ -|			int m_auto_scrape_time_scaler = 180;                                                                                                                                        |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// statistics gathered from all torrents.                                                                                                                                   |
│ │ │ │ │ -|			stat m_stat;                                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			// implements session_interface                                                                                                                                             |
│ │ │ │ │ -|			void sent_bytes(int bytes_payload, int bytes_protocol) override;                                                                                                            |
│ │ │ │ │ -|			void received_bytes(int bytes_payload, int bytes_protocol) override;                                                                                                        |
│ │ │ │ │ -|			void trancieve_ip_packet(int bytes, bool ipv6) override;                                                                                                                    |
│ │ │ │ │ -|			void sent_syn(bool ipv6) override;                                                                                                                                          |
│ │ │ │ │ -|			void received_synack(bool ipv6) override;                                                                                                                                   |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ -|			int m_peak_up_rate = 0;                                                                                                                                                     |
│ │ │ │ │ +|#ifndef TORRENT_DEPRECATED_ENUM                                                                                                                                                |
│ │ │ │ │ +|#define TORRENT_DEPRECATED_ENUM                                                                                                                                                |
│ │ │ │ │  |#endif                                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|			void on_tick(error_code const& e);                                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|			void try_connect_more_peers();                                                                                                                                              |
│ │ │ │ │ -|_	_	_	_v_o_i_d_ _a_u_t_o___m_a_n_a_g_e___c_h_e_c_k_i_n_g___t_o_r_r_e_n_t_s_(_s_t_d_:_:_v_e_c_t_o_r_<_t_o_r_r_e_n_t_*_>_&_ _l_i_s_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |include the number of peers received from this tracker, at last announce                                                            |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_a_n_n_o_u_n_c_e___e_n_t_r_y_._h_p_p_:_7_4_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** iinncclluuddee tthhee nnuummbbeerr ooff ppeeeerrss rreecceeiivveedd ffrroomm tthhiiss ttrraacckkeerr,, aatt llaasstt aannnnoouunnccee **********                                                                                           |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//aannnnoouunnccee__eennttrryy..hhpppp::7744 ******                                                                                                                       |
│ │ │ │ │ -|namespace aux {                                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|	struct TORRENT_EXTRA_EXPORT announce_infohash                                                                                                                                 |
│ │ │ │ │ -|	{                                                                                                                                                                             |
│ │ │ │ │ -|		announce_infohash();                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// if this tracker has returned an error or warning message                                                                                                                  |
│ │ │ │ │ -|		// that message is stored here                                                                                                                                               |
│ │ │ │ │ -|		std::string message;                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// if this tracker failed the last time it was contacted                                                                                                                     |
│ │ │ │ │ -|		// this error code specifies what error occurred                                                                                                                             |
│ │ │ │ │ -|		error_code last_error;                                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// the time of next tracker announce                                                                                                                                         |
│ │ │ │ │ -|		time_point32 next_announce = (time_point32::min)();                                                                                                                          |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// no announces before this time                                                                                                                                             |
│ │ │ │ │ -|		time_point32 min_announce = (time_point32::min)();                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|// these are either -1 or the scrape information this tracker last                                                                                                             |
│ │ │ │ │ -|		// responded with. *incomplete* is the current number of downloaders in                                                                                                      |
│ │ │ │ │ -|		// the swarm, *complete* is the current number of seeds in the swarm and                                                                                                     |
│ │ │ │ │ -|		// *downloaded* is the cumulative number of completed downloads of this                                                                                                      |
│ │ │ │ │ -|		// torrent, since the beginning of time (from this tracker's point of                                                                                                        |
│ │ │ │ │ -|		// view).                                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// if this tracker has returned scrape data, these fields are filled in                                                                                                      |
│ │ │ │ │ -|		// with valid numbers. Otherwise they are set to -1. ``incomplete`` counts                                                                                                   |
│ │ │ │ │ -|		// the number of current downloaders. ``complete`` counts the number of                                                                                                      |
│ │ │ │ │ -|		// current peers completed the download, or "seeds". ``downloaded`` is the                                                                                                   |
│ │ │ │ │ -|		// cumulative number of completed downloads.                                                                                                                                 |
│ │ │ │ │ -|		int scrape_incomplete = -1;                                                                                                                                                  |
│ │ │ │ │ -|		int scrape_complete = -1;                                                                                                                                                    |
│ │ │ │ │ -|		int scrape_downloaded = -1;                                                                                                                                                  |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// the number of times in a row we have failed to announce to this                                                                                                           |
│ │ │ │ │ -|		// tracker.                                                                                                                                                                  |
│ │ │ │ │ -|		std::uint8_t fails : 7;                                                                                                                                                      |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// true while we're waiting for a response from the tracker.                                                                                                                 |
│ │ │ │ │ -|		bool updating : 1;                                                                                                                                                           |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// set to true when we get a valid response from an announce                                                                                                                 |
│ │ │ │ │ -|		// with event=started. If it is set, we won't send start in the subsequent                                                                                                   |
│ │ │ │ │ -|		// announces.                                                                                                                                                                |
│ │ │ │ │ -|		bool start_sent : 1;                                                                                                                                                         |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|		// set to true when we send a event=completed.                                                                                                                               |
│ │ │ │ │ -|_	_	_b_o_o_l_ _c_o_m_p_l_e_t_e___s_e_n_t_ _:_ _1_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |ensure the alignment is good here                                                                                                   |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_p_o_o_l_._h_p_p_:_4_9_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** eennssuurree tthhee aalliiggnnmmeenntt iiss ggoooodd hheerree **********                                                                                                                                  |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//ppooooll..hhpppp::4499 ******                                                                                                                                 |
│ │ │ │ │ -|POSSIBILITY OF SUCH DAMAGE.                                                                                                                                                    |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|*/                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_POOL_HPP                                                                                                                                                       |
│ │ │ │ │ -|#define TORRENT_POOL_HPP                                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_push.hpp"                                                                                                                           |
│ │ │ │ │ -|#include <boost/pool/pool.hpp>                                                                                                                                                 |
│ │ │ │ │ -|#include <boost/pool/object_pool.hpp>                                                                                                                                          |
│ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │ -|namespace aux {                                                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|struct allocator_new_delete                                                                                                                                                    |
│ │ │ │ │ -|{                                                                                                                                                                              |
│ │ │ │ │ -|	using size_type = std::size_t;                                                                                                                                                |
│ │ │ │ │ -|	using difference_type = std::ptrdiff_t;                                                                                                                                       |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|static char* malloc(size_type const bytes)                                                                                                                                     |
│ │ │ │ │ -|{ return new char[bytes]; }                                                                                                                                                    |
│ │ │ │ │ -|	static void free(char* const block)                                                                                                                                           |
│ │ │ │ │ -|	{ delete [] block; }                                                                                                                                                          |
│ │ │ │ │ -|};                                                                                                                                                                             |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|using pool = boost::pool<allocator_new_delete>;                                                                                                                                |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|template <typename T>                                                                                                                                                          |
│ │ │ │ │ -|using object_pool = boost::object_pool<T, allocator_new_delete>;                                                                                                               |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|}                                                                                                                                                                              |
│ │ │ │ │ -|                                                                                                                                                                               |
│ │ │ │ │  |_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |remove this constructor. Don't support "uninitialized" trees. This also requires not constructing these for pad-files and small     |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_m_e_r_k_l_e___t_r_e_e_._h_p_p_:_8_5_ _ _ _ _ _ _ _ _ _ _ _ _|_f_i_l_e_s_ _a_s_ _w_e_l_l_._ _S_o_,_ _a_ _s_p_a_r_s_e_ _h_a_s_h_ _l_i_s_t_ _i_n_ _t_o_r_r_e_n_t___i_n_f_o_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** rreemmoovvee tthhiiss ccoonnssttrruuccttoorr.. DDoonn''tt ssuuppppoorrtt ""uunniinniittiiaalliizzeedd"" ttrreeeess.. TThhiiss aallssoo rreeqquuiirreess nnoott ccoonnssttrruuccttiinngg tthheessee ffoorr ppaadd--ffiilleess aanndd ssmmaallll ffiilleess aass wweellll.. SSoo,, aa ssppaarrssee hhaasshh lliisstt iinn |
│ │ │ │ │  |ttoorrrreenntt__iinnffoo **********                                                                                                                                                             |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//mmeerrkkllee__ttrreeee..hhpppp::8855 ******                                                                                                                          |
│ │ │ │ │  |// The invariant of the tree is that all interior nodes (i.e. all but the very                                                                                                 |
│ │ │ │ │ @@ -12600,57 +12330,106 @@
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// we don't have any hashes in this tree. m_tree should be empty                                                                                                             |
│ │ │ │ │  |		// an empty tree still always have the root hash (available as root())                                                                                                       |
│ │ │ │ │  |		empty_tree,                                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |		// in this mode, m_tree represents the full tree, including padding.                                                                                                         |
│ │ │ │ │  |_	_	_f_u_l_l___t_r_e_e_,_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |figure out which version of clang this is supported in                                                                              |
│ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_d_e_p_r_e_c_a_t_e_d_._h_p_p_:_4_7_ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ -|********** ffiigguurree oouutt wwhhiicchh vveerrssiioonn ooff ccllaanngg tthhiiss iiss ssuuppppoorrtteedd iinn **********                                                                                                             |
│ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//ddeepprreeccaatteedd..hhpppp::4477 ******                                                                                                                           |
│ │ │ │ │ -|CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)                                                                                                        |
│ │ │ │ │ -|ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE                                                                                                     |
│ │ │ │ │ -|POSSIBILITY OF SUCH DAMAGE.                                                                                                                                                    |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |include the number of peers received from this tracker, at last announce                                                            |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_a_n_n_o_u_n_c_e___e_n_t_r_y_._h_p_p_:_7_4_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iinncclluuddee tthhee nnuummbbeerr ooff ppeeeerrss rreecceeiivveedd ffrroomm tthhiiss ttrraacckkeerr,, aatt llaasstt aannnnoouunnccee **********                                                                                           |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//aannnnoouunnccee__eennttrryy..hhpppp::7744 ******                                                                                                                       |
│ │ │ │ │ +|namespace aux {                                                                                                                                                                |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|*/                                                                                                                                                                             |
│ │ │ │ │ +|	struct TORRENT_EXTRA_EXPORT announce_infohash                                                                                                                                 |
│ │ │ │ │ +|	{                                                                                                                                                                             |
│ │ │ │ │ +|		announce_infohash();                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DEPRECATED_HPP_INCLUDED                                                                                                                                        |
│ │ │ │ │ -|#define TORRENT_DEPRECATED_HPP_INCLUDED                                                                                                                                        |
│ │ │ │ │ +|		// if this tracker has returned an error or warning message                                                                                                                  |
│ │ │ │ │ +|		// that message is stored here                                                                                                                                               |
│ │ │ │ │ +|		std::string message;                                                                                                                                                         |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if !defined TORRENT_BUILDING_LIBRARY                                                                                                                                          |
│ │ │ │ │ -|# define TORRENT_DEPRECATED [[deprecated]]                                                                                                                                     |
│ │ │ │ │ -|#else                                                                                                                                                                          |
│ │ │ │ │ -|# define TORRENT_DEPRECATED                                                                                                                                                    |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		// if this tracker failed the last time it was contacted                                                                                                                     |
│ │ │ │ │ +|		// this error code specifies what error occurred                                                                                                                             |
│ │ │ │ │ +|		error_code last_error;                                                                                                                                                       |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#if defined __clang__                                                                                                                                                          |
│ │ │ │ │ +|		// the time of next tracker announce                                                                                                                                         |
│ │ │ │ │ +|		time_point32 next_announce = (time_point32::min)();                                                                                                                          |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// ====== CLANG ========                                                                                                                                                       |
│ │ │ │ │ +|		// no announces before this time                                                                                                                                             |
│ │ │ │ │ +|		time_point32 min_announce = (time_point32::min)();                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|# if !defined TORRENT_BUILDING_LIBRARY                                                                                                                                         |
│ │ │ │ │ -|#  define TORRENT_DEPRECATED_ENUM __attribute__ ((deprecated))                                                                                                                 |
│ │ │ │ │ -|# endif                                                                                                                                                                        |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#elif defined __GNUC__                                                                                                                                                         |
│ │ │ │ │ +|// these are either -1 or the scrape information this tracker last                                                                                                             |
│ │ │ │ │ +|		// responded with. *incomplete* is the current number of downloaders in                                                                                                      |
│ │ │ │ │ +|		// the swarm, *complete* is the current number of seeds in the swarm and                                                                                                     |
│ │ │ │ │ +|		// *downloaded* is the cumulative number of completed downloads of this                                                                                                      |
│ │ │ │ │ +|		// torrent, since the beginning of time (from this tracker's point of                                                                                                        |
│ │ │ │ │ +|		// view).                                                                                                                                                                    |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// ======== GCC ========                                                                                                                                                       |
│ │ │ │ │ +|		// if this tracker has returned scrape data, these fields are filled in                                                                                                      |
│ │ │ │ │ +|		// with valid numbers. Otherwise they are set to -1. ``incomplete`` counts                                                                                                   |
│ │ │ │ │ +|		// the number of current downloaders. ``complete`` counts the number of                                                                                                      |
│ │ │ │ │ +|		// current peers completed the download, or "seeds". ``downloaded`` is the                                                                                                   |
│ │ │ │ │ +|		// cumulative number of completed downloads.                                                                                                                                 |
│ │ │ │ │ +|		int scrape_incomplete = -1;                                                                                                                                                  |
│ │ │ │ │ +|		int scrape_complete = -1;                                                                                                                                                    |
│ │ │ │ │ +|		int scrape_downloaded = -1;                                                                                                                                                  |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|// deprecation markup is only enabled when libtorrent                                                                                                                          |
│ │ │ │ │ -|// headers are included by clients, not while building                                                                                                                         |
│ │ │ │ │ -|// libtorrent itself                                                                                                                                                           |
│ │ │ │ │ -|# if __GNUC__ >= 6 && !defined TORRENT_BUILDING_LIBRARY                                                                                                                        |
│ │ │ │ │ -|#  define TORRENT_DEPRECATED_ENUM __attribute__ ((deprecated))                                                                                                                 |
│ │ │ │ │ -|# endif                                                                                                                                                                        |
│ │ │ │ │ +|		// the number of times in a row we have failed to announce to this                                                                                                           |
│ │ │ │ │ +|		// tracker.                                                                                                                                                                  |
│ │ │ │ │ +|		std::uint8_t fails : 7;                                                                                                                                                      |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		// true while we're waiting for a response from the tracker.                                                                                                                 |
│ │ │ │ │ +|		bool updating : 1;                                                                                                                                                           |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │ -|#ifndef TORRENT_DEPRECATED_ENUM                                                                                                                                                |
│ │ │ │ │ -|#define TORRENT_DEPRECATED_ENUM                                                                                                                                                |
│ │ │ │ │ -|#endif                                                                                                                                                                         |
│ │ │ │ │ +|		// set to true when we get a valid response from an announce                                                                                                                 |
│ │ │ │ │ +|		// with event=started. If it is set, we won't send start in the subsequent                                                                                                   |
│ │ │ │ │ +|		// announces.                                                                                                                                                                |
│ │ │ │ │ +|		bool start_sent : 1;                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// set to true when we send a event=completed.                                                                                                                               |
│ │ │ │ │ +|_	_	_b_o_o_l_ _c_o_m_p_l_e_t_e___s_e_n_t_ _:_ _1_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |ensure the alignment is good here                                                                                                   |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_p_o_o_l_._h_p_p_:_4_9_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** eennssuurree tthhee aalliiggnnmmeenntt iiss ggoooodd hheerree **********                                                                                                                                  |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//ppooooll..hhpppp::4499 ******                                                                                                                                 |
│ │ │ │ │ +|POSSIBILITY OF SUCH DAMAGE.                                                                                                                                                    |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|*/                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_POOL_HPP                                                                                                                                                       |
│ │ │ │ │ +|#define TORRENT_POOL_HPP                                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_push.hpp"                                                                                                                           |
│ │ │ │ │ +|#include <boost/pool/pool.hpp>                                                                                                                                                 |
│ │ │ │ │ +|#include <boost/pool/object_pool.hpp>                                                                                                                                          |
│ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_pop.hpp"                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|namespace libtorrent {                                                                                                                                                         |
│ │ │ │ │ +|namespace aux {                                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|struct allocator_new_delete                                                                                                                                                    |
│ │ │ │ │ +|{                                                                                                                                                                              |
│ │ │ │ │ +|	using size_type = std::size_t;                                                                                                                                                |
│ │ │ │ │ +|	using difference_type = std::ptrdiff_t;                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|static char* malloc(size_type const bytes)                                                                                                                                     |
│ │ │ │ │ +|{ return new char[bytes]; }                                                                                                                                                    |
│ │ │ │ │ +|	static void free(char* const block)                                                                                                                                           |
│ │ │ │ │ +|	{ delete [] block; }                                                                                                                                                          |
│ │ │ │ │ +|};                                                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|using pool = boost::pool<allocator_new_delete>;                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|template <typename T>                                                                                                                                                          |
│ │ │ │ │ +|using object_pool = boost::object_pool<T, allocator_new_delete>;                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │ +|}                                                                                                                                                                              |
│ │ │ │ │  |                                                                                                                                                                               |
│ │ │ │ │  |_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |in C++17, Handler and Storage could just use "auto"                                                                                 |
│ │ │ │ │  |_ _ _ _ _ _ _ _ _ _ _ _|_a_l_l_o_c_a_t_i_n_g___h_a_n_d_l_e_r_._h_p_p_:_3_1_6_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │  |********** iinn CC++++1177,, HHaannddlleerr aanndd SSttoorraaggee ccoouulldd jjuusstt uussee ""aauuttoo"" **********                                                                                                                |
│ │ │ │ │  |****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//aallllooccaattiinngg__hhaannddlleerr..hhpppp::331166 ******                                                                                                                  |
│ │ │ │ │  |	private:                                                                                                                                                                      |
│ │ │ │ │ @@ -12754,7 +12533,228 @@
│ │ │ │ │  |	// it's important that these match the enums in performance_counters for                                                                                                      |
│ │ │ │ │  |	// num_utp_idle etc.                                                                                                                                                          |
│ │ │ │ │  |	enum class state_t {                                                                                                                                                          |
│ │ │ │ │  |		// not yet connected                                                                                                                                                         |
│ │ │ │ │  |		none,                                                                                                                                                                        |
│ │ │ │ │  |		// sent a syn packet, not received any acks                                                                                                                                  |
│ │ │ │ │  |_	_	_s_y_n___s_e_n_t_,_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |make these direct members and generate shared_ptrs to them which alias the listen_socket_t shared_ptr                               |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_m_p_l_._h_p_p_:_2_6_5_ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** mmaakkee tthheessee ddiirreecctt mmeemmbbeerrss aanndd ggeenneerraattee sshhaarreedd__ppttrrss ttoo tthheemm wwhhiicchh aalliiaass tthhee lliisstteenn__ssoocckkeett__tt sshhaarreedd__ppttrr **********                                                              |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iimmppll..hhpppp::226655 ******                                                                                                                        |
│ │ │ │ │ +|if (udp_sock) return udp_sock->sock.local_port();                                                                                                                              |
│ │ │ │ │ +|			return 0;                                                                                                                                                                   |
│ │ │ │ │ +|		}                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// 0 is natpmp 1 is upnp                                                                                                                                                     |
│ │ │ │ │ +|		// the order of these arrays determines the priority in                                                                                                                      |
│ │ │ │ │ +|		// which their ports will be announced to peers                                                                                                                              |
│ │ │ │ │ +|		aux::array<listen_port_mapping, 2, portmap_transport> tcp_port_mapping;                                                                                                      |
│ │ │ │ │ +|		aux::array<listen_port_mapping, 2, portmap_transport> udp_port_mapping;                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// indicates whether this is an SSL listen socket or not                                                                                                                     |
│ │ │ │ │ +|		transport ssl = transport::plaintext;                                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		listen_socket_flags_t flags = accept_incoming;                                                                                                                               |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// the actual sockets (TCP listen socket and UDP socket)                                                                                                                     |
│ │ │ │ │ +|		// An entry does not necessarily have a UDP or TCP socket. One of these                                                                                                      |
│ │ │ │ │ +|		// pointers may be nullptr!                                                                                                                                                  |
│ │ │ │ │ +|		// These must be shared_ptr to avoid a dangling reference if an                                                                                                              |
│ │ │ │ │ +|		// incoming packet is in the event queue when the socket is erased                                                                                                           |
│ │ │ │ │ +|std::shared_ptr<tcp::acceptor> sock;                                                                                                                                           |
│ │ │ │ │ +|std::shared_ptr<aux::session_udp_socket> udp_sock;                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// since udp packets are expected to be dispatched frequently, this saves                                                                                                    |
│ │ │ │ │ +|		// time on handler allocation every time we read again.                                                                                                                      |
│ │ │ │ │ +|		aux::handler_storage<aux::udp_handler_max_size, aux::udp_handler> udp_handler_storage;                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		std::shared_ptr<natpmp> natpmp_mapper;                                                                                                                                       |
│ │ │ │ │ +|		std::shared_ptr<upnp> upnp_mapper;                                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		std::shared_ptr<struct lsd> lsd;                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// set to true when we receive an incoming connection from this listen                                                                                                       |
│ │ │ │ │ +|		// socket                                                                                                                                                                    |
│ │ │ │ │ +|		bool incoming_connection = false;                                                                                                                                            |
│ │ │ │ │ +|	};                                                                                                                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		struct TORRENT_EXTRA_EXPORT listen_endpoint_t                                                                                                                                |
│ │ │ │ │ +|		{                                                                                                                                                                            |
│ │ │ │ │ +|			listen_endpoint_t(address const& adr, int p, std::string dev, transport s                                                                                                   |
│ │ │ │ │ +|				, listen_socket_flags_t f, address const& nmask = address{})                                                                                                               |
│ │ │ │ │ +|				: addr(adr), netmask(nmask), port(p), device(std::move(dev)), ssl(s), flags(f) {}                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			bool operator==(listen_endpoint_t const& o) const                                                                                                                           |
│ │ │ │ │ +|			{                                                                                                                                                                           |
│ │ │ │ │ +|				return addr == o.addr                                                                                                                                                      |
│ │ │ │ │ +|					&& port == o.port                                                                                                                                                         |
│ │ │ │ │ +|					&& device == o.device                                                                                                                                                     |
│ │ │ │ │ +|					&& ssl == o.ssl                                                                                                                                                           |
│ │ │ │ │ +|					&& flags == o.flags;                                                                                                                                                      |
│ │ │ │ │ +|_	_	_	_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |replace this by a proper asio timer                                                                                                 |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_m_p_l_._h_p_p_:_1_0_6_8_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** rreeppllaaccee tthhiiss bbyy aa pprrooppeerr aassiioo ttiimmeerr **********                                                                                                                                |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iimmppll..hhpppp::11006688 ******                                                                                                                       |
│ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS                                                                                                                                                       |
│ │ │ │ │ +|			void on_incoming_utp_ssl(socket_type s);                                                                                                                                    |
│ │ │ │ │ +|			void ssl_handshake(error_code const& ec, socket_type* s);                                                                                                                   |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// round-robin index into m_outgoing_interfaces                                                                                                                             |
│ │ │ │ │ +|			mutable std::uint8_t m_interface_index = 0;                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			std::shared_ptr<listen_socket_t> setup_listener(                                                                                                                            |
│ │ │ │ │ +|				listen_endpoint_t const& lep, error_code& ec);                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|			dht::dht_state m_dht_state;                                                                                                                                                 |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// this is initialized to the unchoke_interval                                                                                                                              |
│ │ │ │ │ +|			// session_setting and decreased every second.                                                                                                                              |
│ │ │ │ │ +|			// when it reaches zero, it is reset to the                                                                                                                                 |
│ │ │ │ │ +|			// unchoke_interval and the unchoke set is                                                                                                                                  |
│ │ │ │ │ +|			// recomputed.                                                                                                                                                              |
│ │ │ │ │ +|int m_unchoke_time_scaler = 0;                                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// this is used to decide when to recalculate which                                                                                                                         |
│ │ │ │ │ +|_	_	_	_/_/_ _t_o_r_r_e_n_t_s_ _t_o_ _k_e_e_p_ _q_u_e_u_e_d_ _a_n_d_ _w_h_i_c_h_ _t_o_ _a_c_t_i_v_a_t_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |replace this by a proper asio timer                                                                                                 |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_m_p_l_._h_p_p_:_1_0_7_3_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** rreeppllaaccee tthhiiss bbyy aa pprrooppeerr aassiioo ttiimmeerr **********                                                                                                                                |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iimmppll..hhpppp::11007733 ******                                                                                                                       |
│ │ │ │ │ +|			// round-robin index into m_outgoing_interfaces                                                                                                                             |
│ │ │ │ │ +|			mutable std::uint8_t m_interface_index = 0;                                                                                                                                 |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			std::shared_ptr<listen_socket_t> setup_listener(                                                                                                                            |
│ │ │ │ │ +|				listen_endpoint_t const& lep, error_code& ec);                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|			dht::dht_state m_dht_state;                                                                                                                                                 |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// this is initialized to the unchoke_interval                                                                                                                              |
│ │ │ │ │ +|			// session_setting and decreased every second.                                                                                                                              |
│ │ │ │ │ +|			// when it reaches zero, it is reset to the                                                                                                                                 |
│ │ │ │ │ +|			// unchoke_interval and the unchoke set is                                                                                                                                  |
│ │ │ │ │ +|			// recomputed.                                                                                                                                                              |
│ │ │ │ │ +|			int m_unchoke_time_scaler = 0;                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// this is used to decide when to recalculate which                                                                                                                         |
│ │ │ │ │ +|			// torrents to keep queued and which to activate                                                                                                                            |
│ │ │ │ │ +|int m_auto_manage_time_scaler = 0;                                                                                                                                             |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// works like unchoke_time_scaler but it                                                                                                                                    |
│ │ │ │ │ +|			// is only decreased when the unchoke set                                                                                                                                   |
│ │ │ │ │ +|			// is recomputed, and when it reaches zero,                                                                                                                                 |
│ │ │ │ │ +|_	_	_	_/_/_ _t_h_e_ _o_p_t_i_m_i_s_t_i_c_ _u_n_c_h_o_k_e_ _i_s_ _m_o_v_e_d_ _t_o_ _a_n_o_t_h_e_r_ _p_e_e_r_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |replace this by a proper asio timer                                                                                                 |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_m_p_l_._h_p_p_:_1_0_8_0_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** rreeppllaaccee tthhiiss bbyy aa pprrooppeerr aassiioo ttiimmeerr **********                                                                                                                                |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iimmppll..hhpppp::11008800 ******                                                                                                                       |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT                                                                                                                                                    |
│ │ │ │ │ +|			dht::dht_state m_dht_state;                                                                                                                                                 |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// this is initialized to the unchoke_interval                                                                                                                              |
│ │ │ │ │ +|			// session_setting and decreased every second.                                                                                                                              |
│ │ │ │ │ +|			// when it reaches zero, it is reset to the                                                                                                                                 |
│ │ │ │ │ +|			// unchoke_interval and the unchoke set is                                                                                                                                  |
│ │ │ │ │ +|			// recomputed.                                                                                                                                                              |
│ │ │ │ │ +|			int m_unchoke_time_scaler = 0;                                                                                                                                              |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// this is used to decide when to recalculate which                                                                                                                         |
│ │ │ │ │ +|			// torrents to keep queued and which to activate                                                                                                                            |
│ │ │ │ │ +|			int m_auto_manage_time_scaler = 0;                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// works like unchoke_time_scaler but it                                                                                                                                    |
│ │ │ │ │ +|			// is only decreased when the unchoke set                                                                                                                                   |
│ │ │ │ │ +|			// is recomputed, and when it reaches zero,                                                                                                                                 |
│ │ │ │ │ +|			// the optimistic unchoke is moved to another peer.                                                                                                                         |
│ │ │ │ │ +|int m_optimistic_unchoke_time_scaler = 0;                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// works like unchoke_time_scaler. Each time                                                                                                                                |
│ │ │ │ │ +|			// it reaches 0, and all the connections are                                                                                                                                |
│ │ │ │ │ +|			// used, the worst connection will be disconnected                                                                                                                          |
│ │ │ │ │ +|			// from the torrent with the most peers                                                                                                                                     |
│ │ │ │ │ +|			int m_disconnect_time_scaler = 90;                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// when this scaler reaches zero, it will                                                                                                                                   |
│ │ │ │ │ +|			// scrape one of the auto managed, paused,                                                                                                                                  |
│ │ │ │ │ +|			// torrents.                                                                                                                                                                |
│ │ │ │ │ +|			int m_auto_scrape_time_scaler = 180;                                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// statistics gathered from all torrents.                                                                                                                                   |
│ │ │ │ │ +|			stat m_stat;                                                                                                                                                                |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			// implements session_interface                                                                                                                                             |
│ │ │ │ │ +|			void sent_bytes(int bytes_payload, int bytes_protocol) override;                                                                                                            |
│ │ │ │ │ +|			void received_bytes(int bytes_payload, int bytes_protocol) override;                                                                                                        |
│ │ │ │ │ +|			void trancieve_ip_packet(int bytes, bool ipv6) override;                                                                                                                    |
│ │ │ │ │ +|			void sent_syn(bool ipv6) override;                                                                                                                                          |
│ │ │ │ │ +|			void received_synack(bool ipv6) override;                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1                                                                                                                                                   |
│ │ │ │ │ +|			int m_peak_up_rate = 0;                                                                                                                                                     |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			void on_tick(error_code const& e);                                                                                                                                          |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|			void try_connect_more_peers();                                                                                                                                              |
│ │ │ │ │ +|_	_	_	_v_o_i_d_ _a_u_t_o___m_a_n_a_g_e___c_h_e_c_k_i_n_g___t_o_r_r_e_n_t_s_(_s_t_d_:_:_v_e_c_t_o_r_<_t_o_r_r_e_n_t_*_>_&_ _l_i_s_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/   |it would be nice to not have this be part of session_interface                                                                      |
│ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_s_e_s_s_i_o_n___i_n_t_e_r_f_a_c_e_._h_p_p_:_2_1_2_ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
│ │ │ │ │ +|********** iitt wwoouulldd bbee nniiccee ttoo nnoott hhaavvee tthhiiss bbee ppaarrtt ooff sseessssiioonn__iinntteerrffaaccee **********                                                                                                     |
│ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//sseessssiioonn__iinntteerrffaaccee..hhpppp::221122 ******                                                                                                                   |
│ │ │ │ │ +|virtual void deferred_submit_jobs() = 0;                                                                                                                                       |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		virtual std::uint16_t listen_port() const = 0;                                                                                                                               |
│ │ │ │ │ +|		virtual std::uint16_t ssl_listen_port() const = 0;                                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		virtual int listen_port(aux::transport ssl, address const& local_addr) = 0;                                                                                                  |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		virtual void for_each_listen_socket(std::function<void(aux::listen_socket_handle const&)> f) = 0;                                                                            |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// ask for which interface and port to bind outgoing peer connections on                                                                                                     |
│ │ │ │ │ +|		virtual tcp::endpoint bind_outgoing_socket(socket_type& s, address const&                                                                                                    |
│ │ │ │ │ +|			remote_address, error_code& ec) const = 0;                                                                                                                                  |
│ │ │ │ │ +|		virtual bool verify_bound_address(address const& addr, bool utp                                                                                                              |
│ │ │ │ │ +|			, error_code& ec) = 0;                                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS                                                                                                                                       |
│ │ │ │ │ +|		virtual std::vector<std::shared_ptr<torrent>> find_collection(                                                                                                               |
│ │ │ │ │ +|			std::string const& collection) const = 0;                                                                                                                                   |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|virtual proxy_settings proxy() const = 0;                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|#if TORRENT_USE_I2P                                                                                                                                                            |
│ │ │ │ │ +|		virtual char const* i2p_session() const = 0;                                                                                                                                 |
│ │ │ │ │ +|		virtual std::string const& local_i2p_endpoint() const = 0;                                                                                                                   |
│ │ │ │ │ +|#endif                                                                                                                                                                         |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		virtual void prioritize_connections(std::weak_ptr<torrent> t) = 0;                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		virtual void trigger_auto_manage() = 0;                                                                                                                                      |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		virtual void apply_settings_pack(std::shared_ptr<settings_pack> pack) = 0;                                                                                                   |
│ │ │ │ │ +|		virtual session_settings const& settings() const = 0;                                                                                                                        |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		virtual void queue_tracker_request(tracker_request req                                                                                                                       |
│ │ │ │ │ +|			, std::weak_ptr<request_callback> c) = 0;                                                                                                                                   |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		// peer-classes                                                                                                                                                              |
│ │ │ │ │ +|		virtual void set_peer_classes(peer_class_set* s, address const& a, socket_type_t st) = 0;                                                                                    |
│ │ │ │ │ +|		virtual peer_class_pool const& peer_classes() const = 0;                                                                                                                     |
│ │ │ │ │ +|		virtual peer_class_pool& peer_classes() = 0;                                                                                                                                 |
│ │ │ │ │ +|		virtual bool ignore_unchoke_slots_set(peer_class_set const& set) const = 0;                                                                                                  |
│ │ │ │ │ +|		virtual int copy_pertinent_channels(peer_class_set const& set                                                                                                                |
│ │ │ │ │ +|			, int channel, bandwidth_channel** dst, int m) = 0;                                                                                                                         |
│ │ │ │ │ +|		virtual int use_quota_overhead(peer_class_set& set, int amount_down, int amount_up) = 0;                                                                                     |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		virtual bandwidth_manager* get_bandwidth_manager(int channel) = 0;                                                                                                           |
│ │ │ │ │ +|                                                                                                                                                                               |
│ │ │ │ │ +|		virtual void sent_bytes(int bytes_payload, int bytes_protocol) = 0;                                                                                                          |
│ │ │ │ │ +|		virtual void received_bytes(int bytes_payload, int bytes_protocol) = 0;                                                                                                      |
│ │ │ │ │ +|_	_	_v_i_r_t_u_a_l_ _v_o_i_d_ _t_r_a_n_c_i_e_v_e___i_p___p_a_c_k_e_t_(_i_n_t_ _b_y_t_e_s_,_ _b_o_o_l_ _i_p_v_6_)_ _=_ _0_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |